Esempio n. 1
0
        public static void RunGuiMode(CommandLineOptions options)
        {
            Runtime.ProgramFeature = "kiezellisp-gui";
            Runtime.DebugMode = options.Debug;
            Runtime.Repl = false;
            Runtime.OptimizerEnabled = !Runtime.DebugMode;
            Runtime.ScriptName = options.ScriptName;
            Runtime.UserArguments = options.UserArguments;

            try
            {
                Runtime.Reset();
                Runtime.RestartLoadFiles(0);
                Runtime.Run(options.ScriptName, Symbols.LoadPrintKeyword, false, Symbols.LoadVerboseKeyword, false);
                Runtime.Exit();
            }
            catch (Exception ex)
            {
                Runtime.PrintTrace(Runtime.GetDiagnostics(ex));
            }
        }
Esempio n. 2
0
        public static void RunConsoleMode(CommandLineOptions options)
        {
            Runtime.ProgramFeature = "kiezellisp-con";
            Runtime.DebugMode = options.Debug;
            Runtime.Repl = options.Repl;
            Runtime.OptimizerEnabled = !Runtime.DebugMode;
            Runtime.ScriptName = options.ScriptName;
            Runtime.UserArguments = options.UserArguments;

            if (options.ScriptName == null)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);
                Console.WriteLine(Runtime.GetVersion());
                Console.WriteLine(fileVersion.LegalCopyright);
                Console.WriteLine("Type `help` for help on top-level commands");
            }
            ReadEvalPrintLoop(commandOptionArgument: options.ScriptName, initialized: false);
        }
Esempio n. 3
0
 public static void Init(CommandLineOptions options)
 {
     Options = options;
     Width = options.Width;
     Height = options.Height;
     SetFrameType(FrameType.Thin);
     DefaultForeColor = MakeColor(options.ForeColor);
     DefaultBackColor = MakeColor(options.BackColor);
     DefaultInfoColor = MakeColor(options.InfoColor);
     DefaultErrorColor = MakeColor(options.ErrorColor);
     DefaultWarningColor = MakeColor(options.WarningColor);
     DefaultHighlightForeColor = MakeColor(options.HighlightForeColor);
     DefaultHighlightBackColor = MakeColor(options.HighlightBackColor);
     DefaultShadowBackColor = MakeColor(options.ShadowBackColor);
     InitFonts(options.FontName, options.FontSize);
     TerminalWindow = new ReplTextForm(new TextWindowCreateArgs(options));
     StdScr = TerminalWindow.Content.Window;
     TerminalWindow.Show();
     TerminalWindow.Activate();
     Runtime.CreateThread(RunGuiReplMode);
     Application.Run(TerminalWindow);
 }
Esempio n. 4
0
 public TextWindowCreateArgs(CommandLineOptions options)
 {
     //
     // Called for REPL window
     //
     Left = -1;
     Top = -1;
     Width = options.Width;
     Height = options.Height;
     BufferWidth = Math.Max(Width, options.BufferWidth);
     BufferHeight = Math.Max(Height, options.BufferHeight);
     ForeColor = RuntimeRepl.MakeColor(options.ForeColor);
     BackColor = RuntimeRepl.MakeColor(options.BackColor);
     Caption = "Kiezellisp";
     Visible = true;
     Resizable = true;
     Scrollable = true;
     CodeCompletion = true;
     HtmlPrefix = options.HtmlPrefix;
     Owned = false;
     Border = true;
     OnCloseFunction = null;
 }
Esempio n. 5
0
        public static CommandLineOptions ParseArgs(string[] args)
        {
            var defaults = ParseReplConfigurationFile(GetReplConfigurationFile());
            var options  = new CommandLineOptions(defaults);
            var parser   = new CommandLineParser();

            parser.AddOption("--debug");
            parser.AddOption("--release");
            parser.AddOption("--repl");
            parser.AddOption("--no-repl");
            parser.AddOption("--width number");
            parser.AddOption("--height number");
            parser.AddOption("--buffer-width number");
            parser.AddOption("--buffer-height number");
            parser.AddOption("--fore-color name");
            parser.AddOption("--back-color name");
            parser.AddOption("--info-color name");
            parser.AddOption("--error-color name");
            parser.AddOption("--warning-color name");
            parser.AddOption("--highlight-fore-color name");
            parser.AddOption("--highlight-back-color name");
            parser.AddOption("--shadow-back-color name");
            parser.AddOption("--font-name name");
            parser.AddOption("--font-size size");
            parser.AddOption("--html-prefix str");

            parser.Parse(args);

            var s = parser.GetArgument(0);

            if (s != null)
            {
                options.ScriptName    = s;
                options.Debug         = false;
                options.Repl          = false;
                options.UserArguments = Runtime.AsList(parser.GetArgumentArray(1));
            }

            if (parser.GetOption("repl") != null)
            {
                options.Repl = true;
            }

            if (parser.GetOption("no-repl") != null)
            {
                options.Repl = false;
            }

            if (parser.GetOption("release") != null)
            {
                options.Debug = false;
            }

            if (parser.GetOption("debug") != null)
            {
                options.Debug = true;
            }

            if ((s = parser.GetOption("width")) != null)
            {
                options.Width = (int)s.ParseNumber();
            }

            if ((s = parser.GetOption("height")) != null)
            {
                options.Height       = (int)s.ParseNumber();
                options.BufferHeight = 10 * options.Height;
            }

            if ((s = parser.GetOption("buffer-height")) != null)
            {
                options.BufferHeight = (int)s.ParseNumber();
            }

            if ((s = parser.GetOption("fore-color")) != null)
            {
                options.ForeColor = s;
            }

            if ((s = parser.GetOption("back-color")) != null)
            {
                options.BackColor = s;
            }

            if ((s = parser.GetOption("info-color")) != null)
            {
                options.InfoColor = s;
            }

            if ((s = parser.GetOption("error-color")) != null)
            {
                options.ErrorColor = s;
            }

            if ((s = parser.GetOption("warning-color")) != null)
            {
                options.BackColor = s;
            }

            if ((s = parser.GetOption("highlight-fore-color")) != null)
            {
                options.HighlightForeColor = s;
            }

            if ((s = parser.GetOption("highlight-back-color")) != null)
            {
                options.HighlightBackColor = s;
            }

            if ((s = parser.GetOption("shadow-back-color")) != null)
            {
                options.ShadowBackColor = s;
            }

            if ((s = parser.GetOption("font-name")) != null)
            {
                options.FontName = s;
            }

            if ((s = parser.GetOption("font-size")) != null)
            {
                options.FontSize = (int)s.ParseNumber();
            }

            if ((s = parser.GetOption("html-prefix")) != null)
            {
                options.HtmlPrefix = s;
            }

            return(options);
        }