Exemplo n.º 1
0
        public static void Make_Undoable(Visual_Flow_Form form)
        {
            Subchart current = form.selectedTabMaybeNull();

            if (current == null)
            {
                return;
            }
            Action new_action;
            bool   was_enabled;

            new_action       = new Action();
            new_action.clone = current.Start.Clone();
            new_action.kind  = Action_Kind.Change_Tab;
            new_action.chart = current;
            if (!Component.BARTPE && !Component.VM && !Component.MONO)
            {
                was_enabled = new_action.chart.tab_overlay.Enabled;
                new_action.chart.tab_overlay.Enabled = false;
                new_action.ink = new_action.chart.tab_overlay.Ink.Clone();
                new_action.chart.tab_overlay.Enabled = was_enabled;
            }
            Add_Undo_Action(new_action, form);
            Clear_Redo(form);
        }
Exemplo n.º 2
0
        public static void Make_Delete_Tab_Undoable(Visual_Flow_Form form, Subchart chart)
        {
            Action new_action;

            form.modified    = true;
            new_action       = new Action();
            new_action.kind  = Action_Kind.Delete_Tab;
            new_action.chart = chart;
            Add_Undo_Action(new_action, form);
            Clear_Redo(form);
        }
Exemplo n.º 3
0
        public static void Make_Rename_Tab_Undoable(Visual_Flow_Form form, Subchart chart,
                                                    string old_name, string new_name)
        {
            Action new_action;

            form.modified       = true;
            new_action          = new Action();
            new_action.kind     = Action_Kind.Rename_Tab;
            new_action.new_name = new_name;
            new_action.old_name = old_name;
            new_action.chart    = chart;
            Add_Undo_Action(new_action, form);
            Clear_Redo(form);
        }
Exemplo n.º 4
0
        public override void compile_pass1(generate_interface.typ gen)
        {
            if (this.kind == Kind_Of.Call &&
                ((parse_tree.procedure_call) this.parse_tree).is_tab_call())
            {
                string call_name = interpreter_pkg.get_name_call(this.parse_tree as parse_tree.procedure_call,
                                                                 this.Text);
                Subchart sub = Find_Start(call_name);
                if (!(sub is Procedure_Chart))
                {
                    if (sub.am_compiling)
                    {
                        throw new System.Exception("The RAPTOR compiler does not support recursive programs.\n" +
                                                   "Recursion found at call to: " + this.Text + "\n" +
                                                   "Cycle of calls includes: " + Recursion_Involves());
                    }
                    sub.am_compiling = true;
                    sub.Start.compile_pass1(gen);
                    sub.am_compiling = false;
                }
                else
                {
                    Procedure_Chart           pc   = sub as Procedure_Chart;
                    parse_tree.parameter_list walk = ((parse_tree.procedure_call) this.parse_tree).param_list;
                    for (int i = 0; i < pc.num_params; i++)
                    {
                        // it seems like we would want to call pass1 on our parameters
                        // but this may give us the mistaken impression that an array is a variable
                        // if it is passed

                        //    walk.parameter.compile_pass1(gen);
                        walk = walk.next;
                    }
                }
            }
            else if (this.parse_tree != null)
            {
                interpreter_pkg.compile_pass1(this.parse_tree, this.Text, gen);
            }
            if (this.Successor != null)
            {
                this.Successor.compile_pass1(gen);
            }
        }
Exemplo n.º 5
0
        public static void Invoke_Tab_Procedure(string name,
                                                parse_tree.parameter_list parameters)
        {
            Subchart sc = Runtime.parent.Find_Tab(name) as Subchart;

            if (!(sc is Procedure_Chart))
            {
                end_oval.running  = false;
                call_rect.running = false;
                Runtime.parent.Possible_Tab_Update(next_chart);
                return;
            }
            if (state == State_Enum.Entering)
            {
                Invoke_Tab_Procedure_Enter(parameters, sc as Procedure_Chart, null);
            }
            else
            {
                Invoke_Tab_Procedure_Exit(parameters, sc as Procedure_Chart);
            }
        }
Exemplo n.º 6
0
 public override void Emit_Code(generate_interface.typ gen)
 {
     if (this.kind == Kind_Of.Call &&
         ((parse_tree.procedure_call) this.parse_tree).is_tab_call())
     {
         string call_name = interpreter_pkg.get_name_call(this.parse_tree as parse_tree.procedure_call,
                                                          this.Text);
         Subchart called_chart = Find_Start(call_name);
         if (!(called_chart is Procedure_Chart))
         {
             called_chart.Start.Emit_Code(gen);
         }
         else
         {
             Procedure_Chart           pc   = called_chart as Procedure_Chart;
             parse_tree.parameter_list walk = ((parse_tree.procedure_call) this.parse_tree).param_list;
             object o = gen.Emit_Call_Subchart(pc.Text);
             for (int i = 0; i < pc.num_params; i++)
             {
                 parse_tree_pkg.emit_parameter_number(walk.parameter, gen, 0);
                 walk = walk.next;
                 if (walk != null)
                 {
                     gen.Emit_Next_Parameter(o);
                 }
             }
             gen.Emit_Last_Parameter(o);
         }
     }
     else if (this.parse_tree != null)
     {
         interpreter_pkg.emit_code(this.parse_tree, this.Text, gen);
     }
     if (this.Successor != null)
     {
         this.Successor.Emit_Code(gen);
     }
 }
Exemplo n.º 7
0
        private bool CreateNewTab(string s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                if (!(Char.IsLetterOrDigit(s[i]) || s[i] == '_'))
                {
                    return(false);
                }
            }
            if (!Char.IsLetter(s, 0) || !token_helpers_pkg.verify_id(s))
            {
                return(false);
            }
            DialogResult dialog_result = MessageBox.Show("Do you wish to create a new tab named "
                                                         + s, "Create new tab?", MessageBoxButtons.YesNo);

            if (dialog_result == DialogResult.Yes)
            {
                Subchart sc = new Subchart(the_form, s);
                Undo_Stack.Make_Add_Tab_Undoable(the_form, sc);
                the_form.Make_Undoable();
                the_form.carlisle.TabPages.Add(sc);
                result = interpreter_pkg.call_syntax(this.assignment_Text.Text, Rec);
                the_form.carlisle.SelectedTab = sc;
                Rec.Text       = this.assignment_Text.Text;
                Rec.parse_tree = result.tree;
                this.error     = false;
                Rec.changed();
                ((Visual_Flow_Form)the_form).flow_panel.Invalidate();
                this.Close();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        public static void Redo_Action(Visual_Flow_Form form)
        {
            Subchart current = form.selectedTabMaybeNull();

            if (num_redo > 0 && current != null)
            {
                Action this_action = ((Action)Redo_array[num_redo - 1]);
                Action undo_action;
                undo_action       = new Action();
                undo_action.kind  = this_action.kind;
                undo_action.chart = this_action.chart;
                switch (this_action.kind)
                {
                case Action_Kind.Rename_Tab:
                    undo_action.old_name = this_action.old_name;
                    undo_action.new_name = this_action.new_name;
                    Add_Undo_Action(undo_action, form);

                    this_action.chart.Text = this_action.new_name;
                    form.Rename_Tab(this_action.old_name, this_action.new_name);
                    form.carlisle.SelectedTab = this_action.chart;
                    break;

                case Action_Kind.Add_Tab:
                    Add_Undo_Action(undo_action, form);

                    form.carlisle.TabPages.Add(this_action.chart);
                    form.carlisle.SelectedTab = this_action.chart;
                    break;

                case Action_Kind.Delete_Tab:
                    Add_Undo_Action(undo_action, form);

                    form.carlisle.TabPages.Remove(this_action.chart);
                    break;

                case Action_Kind.Change_Tab:
                    undo_action.clone = this_action.chart.Start.Clone();
                    bool was_enabled = true;
                    if (!Component.BARTPE && !Component.VM && !Component.MONO)
                    {
                        was_enabled = this_action.chart.tab_overlay.Enabled;
                        this_action.chart.tab_overlay.Enabled = false;
                        undo_action.ink = this_action.chart.tab_overlay.Ink.Clone();
                    }
                    Add_Undo_Action(undo_action, form);

                    this_action.chart.Start = (Oval)this_action.clone.Clone();
                    if (!Component.BARTPE && !Component.VM && !Component.MONO)
                    {
                        this_action.chart.tab_overlay.Ink     = this_action.ink.Clone();
                        this_action.chart.tab_overlay.Enabled = was_enabled;
                    }
                    this_action.chart.Start.scale = form.scale;
                    this_action.chart.Start.Scale(form.scale);
                    form.my_layout();
                    form.Current_Selection = current.Start.select(-1000, -1000);
                    this_action.chart.flow_panel.Invalidate();
                    (this_action.chart.Parent as System.Windows.Forms.TabControl).SelectedTab = this_action.chart;
                    if (this_action.chart.Parent != form.carlisle)
                    {
                        form.carlisle.SelectedTab = this_action.chart.Parent.Parent as System.Windows.Forms.TabPage;
                    }
                    //form.carlisle.SelectedTab=this_action.chart;
                    break;
                }

                Decrement_Redoable(form);
            }
        }
Exemplo n.º 9
0
        public static int Parameter_Count(string s)
        {
            Subchart chart = form.Find_Tab(s);

            return(chart.num_params);
        }
Exemplo n.º 10
0
        public static void Push(Component obj, Subchart code)
        {
            StackFrame frame = new StackFrame(obj, code);

            stack.Add(frame);
        }
Exemplo n.º 11
0
 public StackFrame(Component the_obj, Subchart the_code)
 {
     this.obj  = the_obj;
     this.code = the_code;
 }