Beispiel #1
0
 public SynScope(StructEntry entry)
 {
     foreach (var mod in entry.Modules)
     {
         var s_mod = new SynModule(mod);
     }
 }
Beispiel #2
0
        public dynamic RunMeth(SynModule mod, string name, params dynamic[] pars)
        {
            var m_scope = new SynScope();

            PushScope(m_scope);

            Console.WriteLine("Running method:" + name);

            PopScope();

            return(null);
        }
Beispiel #3
0
        public void LoadModules(string path)
        {
            var dirInfo = new DirectoryInfo(path);

            while (true)
            {
                bool done = true;

                foreach (var mod_folder in dirInfo.GetDirectories())
                {
                    Console.WriteLine("Module:" + mod_folder.Name);

                    var mod = new SynModule(mod_folder.FullName, mod_folder.Name);

                    mod.Compile();

                    BaseModules.Add(mod);
                }
                if (done)
                {
                    return;
                }
            }
        }
Beispiel #4
0
        private void WriteModule(SynModule mod)
        {
            Tab = 1;
            WriteClassHeader(mod.DirectModule.ModuleName);

            ClassVars.Clear();

            foreach (var v in mod.DirectModule.Vars)
            {
                // WriteVar(v);
                Console.WriteLine("Var:" + v.Name);
                ClassVars.Add(v.Name);
            }

            foreach (var v in mod.DirectModule.StaticVars)
            {
                // WriteStaticVar(v);
                Console.WriteLine("Var:" + v.Name);
                ClassVars.Add(v.Name);
            }



            foreach (var meth in mod.DirectModule.Methods)
            {
                AddVars(meth.Code);
            }

            foreach (var func in mod.DirectModule.StaticFuncs)
            {
                AddVars(func.Code);
            }
            foreach (var v in Vars)
            {
                bool add = true;
                foreach (var cv in ClassVars)
                {
                    if (cv == v)
                    {
                        add = false;
                        break;
                    }
                }
                if (add)
                {
                    ClassVars.Add(v);
                }
            }

            foreach (var cv in ClassVars)
            {
                Tab = 2;
                Write("public dynamic " + cv + " = null;");
            }


            Vars.Clear();


            foreach (var meth in mod.DirectModule.Methods)
            {
                if (meth.FuncName == mod.DirectModule.ModuleName)
                {
                    Tab = 3;
                    WriteNewFunc(meth);
                }
                else
                {
                    Tab = 3;
                    WriteFunc(meth);
                }
            }
            Tab = 2;
            WriteClassFooter();
        }
Beispiel #5
0
        public Vivid.Structs.StructModule CreateInstance()
        {
            var new_mod = new SynModule(DirectModule.CreateInstance());

            return(new_mod.DirectModule);
        }