Exemple #1
0
 private static void findAndCallConstructor(
     string name,
     parse_tree.parameter_list parameters,
     ClassTabPage ctp, int count, NClass.Core.ClassType theClass)
 {
     foreach (NClass.Core.Operation op in theClass.Operations)
     {
         if (op is NClass.Core.Constructor)
         {
             if ((op as NClass.Core.Constructor).numberArguments == count)
             {
                 Procedure_Chart sc = (op as NClass.Core.Constructor).raptorTab
                                      as Procedure_Chart;
                 if (sc != null)
                 {
                     Runtime.Set_Running(sc);
                     Invoke_Tab_Procedure_Enter(
                         parameters, sc, Runtime.getContext());
                     CallStack.setContext(Runtime.getContext());
                     return;
                 }
             }
         }
     }
     throw new System.Exception("could not find constructor for " + name +
                                " with " + count + " parameter(s).");
 }
Exemple #2
0
 public static IEnumerable <Procedure_Chart> allMethods(ClassTabPage ctp)
 {
     foreach (TabPage tp in ctp.tabControl1.TabPages)
     {
         if (tp is Procedure_Chart)
         {
             yield return(tp as Procedure_Chart);
         }
     }
 }
Exemple #3
0
        public object createClass(string name, NClass.Core.ClassType ct)
        {
            form.Clear_Undo();
            ClassTabPage ctp = new ClassTabPage(form, name);

            ctp.ct = ct;
            form.carlisle.TabPages.Add(ctp);
            form.modified = true;
            return(ctp);
        }
Exemple #4
0
        public void reorderMethods(object theClass, IEnumerable <NClass.Core.Operation> operations)
        {
            ClassTabPage ctp = (theClass as ClassTabPage);

            ctp.tabControl1.TabPages.Clear();
            foreach (NClass.Core.Operation operation in operations)
            {
                if (operation is NClass.Core.Method)
                {
                    (theClass as ClassTabPage).tabControl1.TabPages.Add(
                        (operation as NClass.Core.Method).raptorTab as Procedure_Chart);
                }
            }
            form.modified = true;
        }
Exemple #5
0
 public static IEnumerable <Subchart> allSubcharts(System.Windows.Forms.TabControl.TabPageCollection tabpages)
 {
     foreach (TabPage tp in tabpages)
     {
         if (tp is Subchart)
         {
             yield return(tp as Subchart);
         }
         else if (tp is ClassTabPage)
         {
             ClassTabPage ctp = tp as ClassTabPage;
             for (int j = 0; j < ctp.tabControl1.TabPages.Count; j++)
             {
                 yield return(ctp.tabControl1.TabPages[j] as Subchart);
             }
         }
     }
 }
Exemple #6
0
        public static void Invoke_This_Constructor(parse_tree.parameter_list parameters)
        {
            ClassTabPage ctp = Runtime.parent.currentClass();

            if (ctp == null)
            {
                throw new System.Exception("no constructor in " + Runtime.parent.running_tab.Text);
            }
            if (state == State_Enum.Entering)
            {
                int count = parse_tree_pkg.count_parameters(parameters);
                NClass.Core.ClassType theClass = Runtime.parent.projectCore.findClass(ctp.Text);
                findAndCallConstructor(
                    theClass.Name, parameters, ctp, count, theClass);
            }
            else
            {
                call_rect.running = false;
            }
        }
Exemple #7
0
        public void resetAttributes(object theClass, IEnumerable <NClass.Core.Field> fields)
        {
            ClassTabPage ctp = (theClass as ClassTabPage);

            ctp.listBox1.Nodes.Clear();
            foreach (NClass.Core.Field field in fields)
            {
                string s = "";
                if (field.IsReadonly || field.IsConstant)
                {
                    s += "(constant)";
                }
                if (field.IsStatic)
                {
                    s += "(static)";
                }
                ctp.listBox1.Nodes.Add(field.GetCaption() + s);
            }
            form.modified = true;
        }