Esempio n. 1
0
        public dynamic RunFunc(SynFunc func, params dynamic[] var)
        {
            var new_scope = new SynScope();

            PushScope(new_scope);
            if (func.Type == FuncType.CCode)
            {
                var rv = func.RealCode.Invoke(var);
                PopScope();
                return(rv);
            }
            else
            {
                var rv = func.Link.Exec();
                PopScope();
                return(rv);
            }


            PopScope();

            Console.WriteLine("Running:" + func.Name);


            return(null);
        }
Esempio n. 2
0
        public void PushScope(SynScope scope)
        {
            var top = TopScope;

            if (top != null)
            {
                scope.Root = top;
            }
            Scopes.Push(scope);
        }
Esempio n. 3
0
        public void PushClassScope(Structs.StructModule mod)
        {
            var c_scope = new SynScope();

            PushScope(c_scope);

            foreach (var vv in mod.Vars)
            {
                RegVar(vv);
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        public dynamic RunMeth(Structs.StructModule mod, string name, params dynamic[] pars)
        {
            //Console.WriteLine("Running method:" + name);

            var m_scope = new SynScope();

            PushScope(m_scope);

            foreach (var vv in mod.Vars)
            {
                RegVar(vv);
            }

            var meth = mod.FindMethod(name);

            int pc = 0;

            if (meth.Pars != null && meth.Pars.Pars != null)
            {
                foreach (var p in meth.Pars.Pars)
                {
                    RegVar(p);

                    p.Value = pars[pc];
                }
            }

            //var func = meth;

            //RunFunc(new SynFunc(meth), pars);

            var func = new SynFunc(meth);



            var val = func.Link.Exec();

            var nv = new Vivid.Structs.Var();

            nv.Value = val;


            PopScope();

            return(nv);

            return(null);
        }
Esempio n. 6
0
        public void DebugScope(SynScope s)
        {
            Console.WriteLine("Scope:");

            foreach (var v in s.Vars)
            {
                Console.WriteLine("Var:" + v.Name + " Value:" + v.Value);
                if (v.Value is Structs.StructModule)
                {
                    DebugMod(v.Value);
                }
            }



            if (s.Root != null)
            {
                DebugScope(s.Root);
            }
        }
Esempio n. 7
0
        public void Run()
        {
            var game_s = new SynScope();

            SynHost.Active.PushScope(game_s);

            CompiledSrc.EntryPoint.Game.Begin();

            CurState = new SynGameState(CompiledSrc.EntryPoint.InitState);



            SynGameHost.GameLink = this;



            SynGameHost.InitState = new SynGameHostState();

            var host = new SynGameHost();

            host.Run();
        }