Beispiel #1
0
        private void Debugger(bool ended)
        {
            if (!ended)
            {
                for (int ind = 0; ind < DebugCells.RowCount; ind++)
                {
                    DebugCells.Rows[ind].Cells[1].Value = BfInterpreter.buf[ind];
                }
                RichTextBoxWPath richTextBox = GetRichTextBoxFromSelectedTab();
                if (debugResult.commands == "")
                {
                    debugResult.commands = richTextBox.Text;
                }
                if (debugResult.commands.Length == 0)
                {
                    return;
                }
                int right = richTextBox.TextLength;
                while ((debugResult.i < right) && (bfCommands.IndexOf(debugResult.commands[debugResult.i]) == -1))
                {
                    debugResult.i++;
                }

                if (debugResult.i < right)
                {
                    SelectCharacter(richTextBox, debugResult.i);

                    InputData inputData = new InputData();
                    inputData.callInputBox = RunInputBox;

                    debugResult = BfInterpreter.DebugProgram(debugResult, inputData);
                    debugResult.i++;
                }
                else
                {
                    return;
                }
                output.Text = debugResult.resultStr.ToString();
            }
            if (ended)
            {
                output.Clear();
                debugResult.ClearResult();
                BfInterpreter.Reset();
            }
        }