Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try {
                ShellNetworkGlue.Init();
            } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); return; }
            Console.WriteLine("connected");


            var CState = new ConsoleState {
                Exec = (str_in) => {
                    var req_eval = new EVAL_Req {
                        expr = str_in
                    };
                    EVAL_Resp resp = ShellNetworkGlue.EVAL(req_eval);
                    return
                        ("\n" +
                         (resp.success ? "OK" : "Error") +
                         resp.msg +
                         string.Join("\n", resp.result.Select(_ => _.ToString()).ToArray()));
                },

                AC = (str_in, offs) => {
                    var req_ac = new AC_Req {
                        arg = str_in, offs = offs
                    };
                    AC_Resp resp = ShellNetworkGlue.AC(req_ac);

                    return(resp);
                }
            };
            Action <string> DBG_push = (in_str) => {
                /*
                 * var TL = new TokenLine();
                 * var Tok = new ShellToken { s_offs = 0 , e_offs = in_str.Length , orig = in_str , id = ShellTokenE.Error };
                 * TL.SetTokens ( new [] { Tok } );
                 * CState.H_push( TL);
                 */
            };


            DBG_push("ZingType ::  .lel");

            while (true)
            {
                CState.STEP();
            }
        }
Exemplo n.º 2
0
        /*
         *  From the way this is currently written, one can inject a dummy scenegraph in UEngineMock by writing to
         *  public class Resources {
         *       public static GameObject []  roots                     = new GameObject[0];
         *       // [...]
         *  }
         *
         *
         *
         */



        static void Main(string[] args)
        {
            // dummy scenegraph
            // var go = new GameObject() ;
            // go.name = "Cube_1" ;
            Resources.roots = DummySceneGraph1.roots;
            //



            var CState = new ConsoleState {
                Exec = (str_in) => {    // "res dummy : (" + str_in + ")"
                    var resp = Operations.Operations.EVAL_stateless(new ShellCommon.EVAL_Req {
                        expr = str_in
                    });
                    return("\n" +
                           (resp.success ? "OK" : "Error") +
                           resp.msg +
                           string.Join("\n", resp.result.Select(_ => _.ToString()).ToArray()));
                },
                AC = (str, pos) => {
                    return(Operations.Operations.AC(new ShellCommon.AC_Req {
                        arg = str, offs = pos
                    }, TMP_dumping_ground.GetAST_ptokBase));
                }                                                                                       //   ^. from ShellServerHook.cs
            };



            Action <string> DBG_push = (in_str) => {
                /*
                 * var TL = new TokenLine();
                 * var Tok = new ShellToken { s_offs = 0 , e_offs = in_str.Length , orig = in_str , id = ShellTokenE.Error };
                 * TL.SetTokens ( new [] { Tok } );
                 * CState.H_push( TL);
                 */
            };


            DBG_push("ZingType ::  .lel");

            while (true)
            {
                CState.STEP();
            }
        }