Ejemplo n.º 1
0
        /// <summary>
        /// Main function.
        /// </summary>
        /// <param name="args">Arguments from comand line.</param>
        public static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Usage();
                return;
            }

            var builder = new ContainerBuilder();

            builder.RegisterInstance(new GlassTeletype()).As <ITeletype>();
            RegisterTypes.Register(builder);
            try
            {
                var program     = File.ReadAllLines(args[0]);
                var container   = builder.Build();
                var interpreter = container.Resolve <IInterpreter>();
                interpreter.Execute(program);
            }
            catch (Exception ex)
            {
                Console.WriteLine($".Net exception {ex}");
                Console.ReadKey();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main program. Passes argument one to interpreter as a run file command.
        /// </summary>
        /// <param name="args">Arguments from the command line.</param>
        public static void Main(string[] args)
        {
            string initialCommand = string.Empty;

            if (args.Length == 1)
            {
                initialCommand = $"RUN \"{args[0]}\"";
            }
            else
            {
                Console.WriteLine("Welcome to Classic BASIC, let us program like it's 1979");
            }

            var builder = new ContainerBuilder();

            builder.RegisterInstance(new GlassTeletype(initialCommand)).As <ITeletype>();
            RegisterTypes.Register(builder);
            try
            {
                var container   = builder.Build();
                var interpreter = container.Resolve <IInterpreter>();
                interpreter.Execute();
            }
            catch (Exception ex)
            {
                Console.WriteLine($".Net exception {ex}");
                Console.ReadKey();
            }
        }
Ejemplo n.º 3
0
 protected NetCommon(Peer peer)
 {
     _Peer    = peer;
     _Context = new Context {
         Language = ELanguage.Pi
     };
     RegisterTypes.Register(_Context.Registry);
 }
Ejemplo n.º 4
0
        public static void SetupSut(TestContext context)
        {
            var builder = new ContainerBuilder();

            RegisterTypes.Register(builder);
            builder.RegisterInstance(new MockTeletype()).As <ITeletype>();
            var container = builder.Build();

            _tokeniser = container.Resolve <ITokeniser>();
        }
Ejemplo n.º 5
0
        public static void SetupTokeniser(TestContext context)
        {
            _mockTeletype = new MockTeletype();
            var builder = new ContainerBuilder();

            RegisterTypes.Register(builder);
            builder.RegisterInstance(_mockTeletype).As <ITeletype>();

            var container = builder.Build();

            _tokeniser          = container.Resolve <ITokeniser>();
            _runEnvironment     = container.Resolve <IRunEnvironment>();
            _variableRepository = container.Resolve <IVariableRepository>();
        }
Ejemplo n.º 6
0
        private Program(string[] args)
            : base(args)
        {
            _context = new Context {
                Language = ELanguage.Rho
            };
            RegisterTypes.Register(_context.Registry);

            if (!StartPeer(args))
            {
                Exit(1);
            }

            SetupPeer();

            RunInitialisationScripts();
        }