Ejemplo n.º 1
0
Archivo: repl.cs Proyecto: nestalk/mono
		static int Main (string [] args)
		{
			var cmd = new CommandLineParser (Console.Out);
			cmd.UnknownOptionHandler += HandleExtraArguments;

			var settings = cmd.ParseArguments (args);
			if (settings == null)
				return 1;
			var startup_files = new string [settings.SourceFiles.Count];
			int i = 0;
			foreach (var source in settings.SourceFiles)
				startup_files [i++] = source.FullPathName;
			settings.SourceFiles.Clear ();

			var eval = new Evaluator (new CompilerContext (settings, new ConsoleReportPrinter ()));

			eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
			eval.DescribeTypeExpressions = true;

			CSharpShell shell;
#if !ON_DOTNET
			if (attach.HasValue) {
				shell = new ClientCSharpShell (eval, attach.Value);
			} else if (agent != null) {
				new CSharpAgent (eval, agent).Run (startup_files);
				return 0;
			} else
#endif
			{
				shell = new CSharpShell (eval);
			}
			return shell.Run (startup_files);
		}
Ejemplo n.º 2
0
        public int Run()
        {
            // Enable unsafe code by default
            var settings = new CompilerSettings () {
                Unsafe = true
            };

            var startup_files = new string [0];
            settings.SourceFiles.Clear ();
            ReportPrinter printer= new ConsoleReportPrinter ();
            var eval = new Evaluator (new CompilerContext (settings, printer));
            eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
            eval.DescribeTypeExpressions = true;
            eval.WaitOnTask = true;

            CSharpShell shell;
            #if !ON_DOTNET
            if (attach.HasValue) {
                shell = new ClientCSharpShell (eval, attach.Value);
            } else if (agent != null) {
                new CSharpAgent (eval, agent, agent_stderr).Run (startup_files);
                return 0;
            } else
                #endif
            {
                shell = new CSharpShell (eval, console);
            }
            return shell.Run (startup_files);
        }
Ejemplo n.º 3
0
        static int Main(string [] args)
        {
            var cmd = new CommandLineParser(Console.Out);

            cmd.UnknownOptionHandler += HandleExtraArguments;

            var settings = cmd.ParseArguments(args);

            if (settings == null)
            {
                return(1);
            }
            var startup_files = new string [settings.SourceFiles.Count];
            int i             = 0;

            foreach (var source in settings.SourceFiles)
            {
                startup_files [i++] = source.FullPathName;
            }
            settings.SourceFiles.Clear();

            TextWriter    agent_stderr = null;
            ReportPrinter printer;

            if (agent != null)
            {
                agent_stderr = new StringWriter();
                printer      = new StreamReportPrinter(agent_stderr);
            }
            else
            {
                printer = new ConsoleReportPrinter();
            }

            var eval = new Evaluator(new CompilerContext(settings, printer));

            eval.InteractiveBaseClass    = typeof(InteractiveBaseShell);
            eval.DescribeTypeExpressions = true;

            CSharpShell shell;

#if !ON_DOTNET
            if (attach.HasValue)
            {
                shell = new ClientCSharpShell(eval, attach.Value);
            }
            else if (agent != null)
            {
                new CSharpAgent(eval, agent, agent_stderr).Run(startup_files);
                return(0);
            }
            else
#endif
            {
                shell = new CSharpShell(eval);
            }
            return(shell.Run(startup_files));
        }
Ejemplo n.º 4
0
        static int Main(string [] args)
        {
            var r   = new Report(new ConsoleReportPrinter());
            var cmd = new CommandLineParser(r);

            cmd.UnknownOptionHandler += HandleExtraArguments;

            var settings = cmd.ParseArguments(args);

            if (settings == null || r.Errors > 0)
            {
                return(1);
            }

            var eval = new Evaluator(settings, r);

            eval.InteractiveBaseClass    = typeof(InteractiveBaseShell);
            eval.DescribeTypeExpressions = true;

            string[] startup_files = { };

            /*
             * try {
             *      startup_files = Evaluator.InitAndGetStartupFiles (args, HandleExtraArguments);
             *      Evaluator.DescribeTypeExpressions = true;
             *      Evaluator.SetInteractiveBaseClass (typeof (InteractiveBaseShell));
             * } catch {
             *      return 1;
             * }
             */

            CSharpShell shell;

#if !ON_DOTNET
            if (attach.HasValue)
            {
                shell = new ClientCSharpShell(eval, attach.Value);
            }
            else if (agent != null)
            {
                new CSharpAgent(eval, agent).Run(startup_files);
                return(0);
            }
            else
#endif
            {
                shell = new CSharpShell(eval);
            }

            return(shell.Run(startup_files));
        }
Ejemplo n.º 5
0
Archivo: repl.cs Proyecto: GirlD/mono
		static int Main (string [] args)
		{
			var cmd = new CommandLineParser (Console.Out);
			cmd.UnknownOptionHandler += HandleExtraArguments;

			// Enable unsafe code by default
			var settings = new CompilerSettings () {
				Unsafe = true
			};

			if (!cmd.ParseArguments (settings, args))
				return 1;

			var startup_files = new string [settings.SourceFiles.Count];
			int i = 0;
			foreach (var source in settings.SourceFiles)
				startup_files [i++] = source.FullPathName;
			settings.SourceFiles.Clear ();

			TextWriter agent_stderr = null;
			ReportPrinter printer;
			if (agent != null) {
				agent_stderr = new StringWriter ();
				printer = new StreamReportPrinter (agent_stderr);
			} else {
				printer = new ConsoleReportPrinter ();
			}

			var eval = new Evaluator (new CompilerContext (settings, printer));

			eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
			eval.DescribeTypeExpressions = true;
			eval.WaitOnTask = true;

			CSharpShell shell;
#if !ON_DOTNET
			if (attach.HasValue) {
				shell = new ClientCSharpShell (eval, attach.Value);
			} else if (agent != null) {
				new CSharpAgent (eval, agent, agent_stderr).Run (startup_files);
				return 0;
			} else
#endif
			{
				shell = new CSharpShell (eval);
			}
			return shell.Run (startup_files);
		}
Ejemplo n.º 6
0
Archivo: repl.cs Proyecto: saga/mono
		static int Main (string [] args)
		{
			var r = new Report (new ConsoleReportPrinter ());
			var cmd = new CommandLineParser (r);
			cmd.UnknownOptionHandler += HandleExtraArguments;

			var settings = cmd.ParseArguments (args);
			if (settings == null || r.Errors > 0)
				return 1;

			var eval = new Evaluator (settings, r);

			eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
			eval.DescribeTypeExpressions = true;

			string[] startup_files = { };
			/*
			try {
				startup_files = Evaluator.InitAndGetStartupFiles (args, HandleExtraArguments);
				Evaluator.DescribeTypeExpressions = true;
				Evaluator.SetInteractiveBaseClass (typeof (InteractiveBaseShell));
			} catch {
				return 1;
			}
			*/

			CSharpShell shell;
#if !ON_DOTNET
			if (attach.HasValue) {
				shell = new ClientCSharpShell (eval, attach.Value);
			} else if (agent != null) {
				new CSharpAgent (eval, agent).Run (startup_files);
				return 0;
			} else
#endif
			{
				shell = new CSharpShell (eval);
			}

			return shell.Run (startup_files);
		}
Ejemplo n.º 7
0
        static int Main(string [] args)
        {
            if (!SplitDriverAndScriptArguments(ref args, out script_args))
            {
                return(1);
            }

            var cmd = new CommandLineParser(Console.Out);

            cmd.UnknownOptionHandler += HandleExtraArguments;

            // Enable unsafe code by default
            var settings = new CompilerSettings()
            {
                Unsafe = true
            };

            if (!cmd.ParseArguments(settings, args))
            {
                return(1);
            }

            var startup_files = new string [settings.SourceFiles.Count];
            int i             = 0;

            foreach (var source in settings.SourceFiles)
            {
                startup_files [i++] = source.OriginalFullPathName;
            }
            settings.SourceFiles.Clear();

            TextWriter    agent_stderr = null;
            ReportPrinter printer;

            if (agent != null)
            {
                agent_stderr = new StringWriter();
                printer      = new StreamReportPrinter(agent_stderr);
            }
            else
            {
                printer = new ConsoleReportPrinter();
            }

            var eval = new Evaluator(new CompilerContext(settings, printer));

            eval.InteractiveBaseClass    = typeof(InteractiveBaseShell);
            eval.DescribeTypeExpressions = true;
            eval.WaitOnTask = true;

            CSharpShell shell;

#if !ON_DOTNET
            if (attach.HasValue)
            {
                shell = new ClientCSharpShell_v1(eval, attach.Value);
            }
            else if (agent != null)
            {
                new CSharpAgent(eval, agent, agent_stderr).Run(startup_files);
                return(0);
            }
            else
#endif
            if (target_host != null)
            {
                shell = new ClientCSharpShell(eval, target_host, target_port);
            }
            else
            {
                shell = new CSharpShell(eval);
            }

            return(shell.Run(startup_files));
        }