Пример #1
0
        public OPipeServer(string pipeName, Evaluator evaluator = null)
        {
            _pipeName = pipeName;
            Evaluator = evaluator ?? new Evaluator();

            _queryInterface = new QueryInterface();
            _queryInterface.UpsertIndexedSymbols(new[] { "quote", "lambda", "if", "begin", "define", "set!", "call/cc", });
            _queryInterface.UpsertIndexedSymbols(Evaluator.DefaultEnviroment.Variables.Keys.ToArray());
            RegisterImplementation(_queryInterface);

            listerThread = new Thread(ListenerHandler);
            listerThread.IsBackground = true;
            listerThread.Start();
        }
Пример #2
0
        public OTcpServer(int port, Evaluator evaluator = null)
        {
            Evaluator = evaluator ?? new Evaluator();

            _queryInterface = new QueryInterface();
            _queryInterface.UpsertIndexedSymbols(new [] { "quote", "lambda", "if", "begin", "define", "set!", "call/cc", });
            _queryInterface.UpsertIndexedSymbols(Evaluator.DefaultEnviroment.Variables.Keys.ToArray());
            RegisterImplementation(_queryInterface);

            _listener = new TcpListener(IPAddress.Any, port);
            _listener.Start();

            Evaluator.DefaultEnviroment.Define("get-context-tcp-client", new Func <dynamic>(() => ContexTcpClient));

            listerThread = new Thread(ListenerHandler);
            listerThread.IsBackground = true;
            listerThread.Start(_listener);
        }
Пример #3
0
        public void RegisterImplementation(object instanceOfImplementation)
        {
            var symbols = ClassRegistrator.Register(Evaluator.DefaultEnviroment, instanceOfImplementation);

            _queryInterface.UpsertIndexedSymbols(symbols);
        }