Exemple #1
0
        public StateStorage SaveCurrentState()
        {
            StateStorage currentState = new StateStorage();

            // Store source
            currentState.SourceCode = this.SourceCode;

            // Store general state
            currentState.Ended = this.Ended;
            currentState.DontExectuteIF = this.DontExectuteIF;
            currentState.ProgramPosition = this.CodeParser.ProgramPosition;

            // Store variables
            currentState.NumericVariables = (System.Collections.ArrayList)this.NumericVariables.Clone();
            currentState.StringVariables = (System.Collections.ArrayList)this.StringVariables.Clone();

            // Store WHILE-WEND state
            currentState.WHILEStack = (int[]) this.WHILEStack.Clone();
            currentState.WHILEStackPosition = this.WHILEStackPosition;

            // Store GOSUB-RETURN state
            currentState.GOSUBStack = (int[])this.GOSUBStack.Clone();
            currentState.GOSUBStackPosition = this.GOSUBStackPosition;

            // Store FOR-NEXT state
            currentState.FORStack = (ForToken.ForStackItem[]) this.FORStack.Clone();
            currentState.FORStackPosition = this.FORStackPosition;

            return currentState;
        }