private bool writeSavedataTextFrom(int saveIndex) { EraDataResult result = vEvaluator.CheckData(saveIndex, EraSaveFileType.Normal); console.Print(result.DataMes); console.NewLine(); return(result.State == EraDataState.OK); }
bool doFlowControlFunction(InstructionLine func) { switch (func.FunctionCode) { case FunctionCode.LOADDATA: { ExpressionArgument intExpArg = (ExpressionArgument)func.Argument; Int64 target = intExpArg.Term.GetIntValue(exm); if (target < 0) { throw new CodeEE("LOADDATAの引数に負の値(" + target.ToString() + ")が指定されました"); } else if (target > int.MaxValue) { throw new CodeEE("LOADDATAの引数(" + target.ToString() + ")が大きすぎます"); } //EraDataResult result = vEvaluator.checkData((int)target); EraDataResult result = vEvaluator.CheckData((int)target, EraSaveFileType.Normal); if (result.State != EraDataState.OK) { throw new CodeEE("不正なデータをロードしようとしました"); } if (!vEvaluator.LoadFrom((int)target)) { throw new ExeEE("ファイルのロード中に予期しないエラーが発生しました"); } state.ClearFunctionList(); state.SystemState = SystemStateCode.LoadData_DataLoaded; return(false); } case FunctionCode.TRYCALLLIST: case FunctionCode.TRYJUMPLIST: { //if (!sequential)//RETURNで帰ってきた //{ // state.JumpTo(func.JumpTo); // break; //} string funcName = ""; CalledFunction callto = null; SpCallArgment cfa = null; foreach (InstructionLine iLine in func.callList) { cfa = (SpCallArgment)iLine.Argument; funcName = cfa.FuncnameTerm.GetStrValue(exm); if (Config.ICFunction) { funcName = funcName.ToUpper(); } callto = CalledFunction.CallFunction(this, funcName, func.JumpTo); if (callto == null) { continue; } callto.IsJump = func.Function.IsJump(); string errMes; UserDefinedFunctionArgument args = callto.ConvertArg(cfa.RowArgs, out errMes); if (args == null) { throw new CodeEE(errMes); } state.IntoFunction(callto, args, exm); return(true); } state.JumpTo(func.JumpTo); } break; case FunctionCode.TRYGOTOLIST: { string funcName = ""; LogicalLine jumpto = null; foreach (InstructionLine iLine in func.callList) { if (iLine.Argument == null) { ArgumentParser.SetArgumentTo(iLine); } funcName = ((SpCallArgment)iLine.Argument).FuncnameTerm.GetStrValue(exm); if (Config.ICVariable) { funcName = funcName.ToUpper(); } jumpto = state.CurrentCalled.CallLabel(this, funcName); if (jumpto != null) { break; } } if (jumpto == null) { state.JumpTo(func.JumpTo); } else { state.JumpTo(jumpto); } } break; case FunctionCode.CALLTRAIN: { ExpressionArgument intExpArg = (ExpressionArgument)func.Argument; Int64 count = intExpArg.Term.GetIntValue(exm); SetCommnds(count); return(false); } case FunctionCode.STOPCALLTRAIN: { if (isCTrain) { ClearCommands(); skipPrint = false; } return(false); } case FunctionCode.DOTRAIN: { switch (state.SystemState) { //case SystemStateCode.Train_Begin://BEGIN TRAINから。 case SystemStateCode.Train_CallEventTrain: //@EVENTTRAINの呼び出し中。スキップ可能 case SystemStateCode.Train_CallShowStatus: //@SHOW_STATUSの呼び出し中 //case SystemStateCode.Train_CallComAbleXX://@COM_ABLExxの呼び出し中。 case SystemStateCode.Train_CallShowUserCom: //@SHOW_USERCOMの呼び出し中 //case SystemStateCode.Train_WaitInput://入力待ち状態。選択が実行可能ならEVENTCOMからCOMxx、そうでなければ@USERCOMにRESULTを渡す //case SystemStateCode.Train_CallEventCom://@EVENTCOMの呼び出し中 //case SystemStateCode.Train_CallComXX://@COMxxの呼び出し中 //case SystemStateCode.Train_CallSourceCheck://@SOURCE_CHECKの呼び出し中 case SystemStateCode.Train_CallEventComEnd: //@EVENTCOMENDの呼び出し中。スキップ可能。Train_CallEventTrainへ帰る。@USERCOMの呼び出し中もここ break; default: exm.Console.PrintSystemLine(state.SystemState.ToString()); throw new CodeEE("DOTRAIN命令をこの位置で実行することはできません"); } coms.Clear(); isCTrain = false; this.count = 0; Int64 train = ((ExpressionArgument)func.Argument).Term.GetIntValue(exm); if (train < 0) { throw new CodeEE("DOTRAIN命令に0未満の値が渡されました"); } if (train >= TrainName.Length) { throw new CodeEE("DOTRAIN命令にTRAINNAMEの配列数以上の値が渡されました"); } doTrainSelectCom = train; state.SystemState = SystemStateCode.Train_DoTrain; return(false); } #if DEBUG default: throw new ExeEE("未定義の関数です"); #endif } return(true); }