public static CalledFunction CallEventFunction(Process parent, string label, LogicalLine retAddress) { var called = new CalledFunction(label); var newLabelList = new List <FunctionLabelLine>(); called.Finished = false; called.eventLabelList = parent.LabelDictionary.GetEventLabels(label); if (called.eventLabelList == null) { var line = parent.LabelDictionary.GetNonEventLabel(label); if (parent.LabelDictionary.GetNonEventLabel(label) != null) { throw new CodeEE("イベント関数でない関数@" + label + "(" + line.Position.Filename + ":" + line.Position.LineNo + "行目)に対しEVENT呼び出しが行われました"); } return(null); } called.counter = -1; called.group = 0; called.ShiftNext(); called.TopLabel = called.CurrentLabel; called.ReturnAddress = retAddress; called.IsEvent = true; return(called); }
public void Return(Int64 ret) { if (IsFunctionMethod) { ReturnF(null); return; } //sequential = false;//いずれにしろ順列ではない。 //呼び出し元は全部スクリプト処理 //if (functionList.Count == 0) //{ // throw new ExeEE("実行中の関数が存在しません"); //} CalledFunction called = functionList[functionList.Count - 1]; if (called.IsJump) { //JUMPした場合。即座にRETURN RESULTする。 if (called.TopLabel.hasPrivDynamicVar) { called.TopLabel.Out(); } functionList.Remove(called); if (Program.DebugMode) { console.DebugRemoveTraceLog(); } Return(ret); return; } if (!called.IsEvent) { if (called.TopLabel.hasPrivDynamicVar) { called.TopLabel.Out(); } currentLine = null; } else { if (called.CurrentLabel.hasPrivDynamicVar) { called.CurrentLabel.Out(); } //#Singleフラグ付き関数で1が返された。 //1752 非0ではなく1と等価であることを見るように修正 //1756 全てを終了ではなく#PRIや#LATERのグループごとに修正 if (called.IsOnly) { called.FinishEvent(); } else if ((called.HasSingleFlag) && (ret == 1)) { called.ShiftNextGroup(); } else { called.ShiftNext(); //次の同名関数に進む。 } currentLine = called.CurrentLabel; //関数の始点(@~~)へ移動。呼ぶべき関数が無ければnull if (called.CurrentLabel != null) { lineCount++; if (called.CurrentLabel.hasPrivDynamicVar) { called.CurrentLabel.In(); } } } if (Program.DebugMode) { console.DebugRemoveTraceLog(); } //関数終了 if (currentLine == null) { currentLine = called.ReturnAddress; functionList.RemoveAt(functionList.Count - 1); if (currentLine == null) { //この時点でfunctionListは空のはず //functionList.Clear();//全て終了。stateEndProcessに処理を返す if (begintype != BeginType.NULL) //BEGIN XXが行なわれていれば { Begin(); } return; } lineCount++; //ShfitNextLine(); return; } else if (Program.DebugMode) { FunctionLabelLine label = called.CurrentLabel; console.DebugAddTraceLog("CALL :@" + label.LabelName + ":" + label.Position.ToString() + "行目"); } lineCount++; //ShfitNextLine(); return; }
public static CalledFunction CallEventFunction(Process parent, string label, LogicalLine retAddress) { CalledFunction called = new CalledFunction(label); List<FunctionLabelLine> newLabelList = new List<FunctionLabelLine>(); called.Finished = false; called.eventLabelList = parent.LabelDictionary.GetEventLabels(label); if (called.eventLabelList == null) { FunctionLabelLine line = parent.LabelDictionary.GetNonEventLabel(label); if (parent.LabelDictionary.GetNonEventLabel(label) != null) { throw new CodeEE("イベント関数でない関数@" + label + "(" + line.Position.Filename + ":" + line.Position.LineNo + "行目)に対しEVENT呼び出しが行われました"); } return null; } called.counter = -1; called.group = 0; called.ShiftNext(); called.TopLabel = called.CurrentLabel; called.returnAddress = retAddress; return called; }