Пример #1
0
        // test script
        private void buttonCheckSyntax_Click(object sender, EventArgs e)
        {
            CCompiler tCompiler = new CCompiler();

            string tScriptToTest = @richTextBoxScript.Text;;

            tCompiler.CheckSyntax(tScriptToTest);

            richTextBoxCompilerOutput.Text = tCompiler._compilerOutput;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            CCompiler tCompiler = new CCompiler();


            // Look for primitive properties in the settings
            CApplicationSettings settings = new CApplicationSettings();

            settings.Load("aurora_stettings.xml");

            // Really need another pointer ???
            // CCellMatrix theMatrix = _cellMatrix;

            // Call the compiler and run the code;


            //serial._compCore = this.richTextBoxCompCore.Text;

            tCompiler._injection_definition  = this.richTextBoxCompVar.Text;
            tCompiler._injection_constructor = this.richTextBoxCompConst.Text;
            tCompiler._injection_primitives  = this.richTextBoxCompPrim.Text;

            string tScriptToTest = ""; // @richTextBoxScript.Text; // Main script to compile

            //tCompiler.PreCompileScript(tScriptToTest);
            //tCompiler.RunPrecompiledScript(theMatrix);


            // Get the feedback of the compilation/run;
            //richTextBoxFeedBack.Text = tCompiler._compilerOutput;
            //richTextBoxFeedBack.Text += tCompiler._runOutput;
            //textBoxPrevCellValue.Text = _cellMatrix._lastEvaluatedValue; //.ToString();

            //_lastFeedback = tCompiler._runOutput;


            if (tCompiler.CheckSyntax(tScriptToTest))
            {
                MessageBox.Show("Script is ok.",
                                "P2 C# Compiler 1.07");
            }
            else
            {
                MessageBox.Show(tCompiler._compilerOutput,
                                "P2 C# Compiler 1.07");
            }
        }
        // Test compile
        private void button5_Click_1(object sender, EventArgs e)
        {
            CCompiler tCompiler = new CCompiler();

            string tScriptToTest = richTextBoxScriptHeader.Text;

            if (tCompiler.CheckSyntax(tScriptToTest))
            {
                MessageBox.Show("Script is ok.",
                                "P2 C# Compiler 1.07");
            }
            else
            {
                MessageBox.Show(tCompiler._compilerOutput,
                                "P2 C# Compiler 1.07");
            }
        }
Пример #4
0
        private void DoEval()
        {
            CCompiler tCompiler = new CCompiler();

            // Apply Cycée counter to the cell evaluated
            _cell.CycleInc();
            DisplayCellCycle();


            // Look for primitive properties in the settings
            CApplicationSettings settings = new CApplicationSettings();

            settings.Load("aurora_stettings.xml");

            // Really need another pointer ???
            CCellMatrix theMatrix = _cellMatrix;

            // Call the compiler and run the code;

            tCompiler._injection_definition  = settings._compPrimitiveInit;
            tCompiler._injection_constructor = settings._compPrimitiveConstructor;
            tCompiler._injection_primitives  = settings._compPrimitiveFunctions;

            string tScriptToTest = @richTextBoxScript.Text; // Main script to compile

            tCompiler.PreCompileScript(tScriptToTest);
            tCompiler.RunPrecompiledScript(theMatrix);


            // Get the feedback of the compilation/run;
            richTextBoxFeedBack.Text  = tCompiler._compilerOutput;
            richTextBoxFeedBack.Text += tCompiler._runOutput;
            textBoxPrevCellValue.Text = _cellMatrix._lastEvaluatedValue; //.ToString();

            _lastFeedback = tCompiler._runOutput;

            DisplayCellMainStatus(_cellMatrix._lastCellStatus);
        }