Exemple #1
0
 static void Main(string[] args)
 {
     Init();
     Head();
     Run(args);
     TrickyDebug.AttachWait();
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Source.Hello();
            Compile.Hello();
            Dirry.InitAltDrives();
            Instruction.Init();
            MKL.Version("Wendicka Project - WASM_Main.cs", "20.03.01");
            MKL.Lic("Wendicka Project - WASM_Main.cs", "GNU General Public License 3");
            Console.WriteLine($"Wendicka Assembler {MKL.Newest} - (c) {MKL.CYear(2020)} Jeroen P. Broks\n");
            if (args.Length == 0)
            {
                Console.WriteLine("Usage: WASM [options] <File>");
                TrickyDebug.AttachWait();
                return;
            }
            var parse = new FlagParse(args);

            parse.CrBool("s", false);
            parse.Parse();
            Silence = parse.GetBool("s");
            foreach (string f in parse.Args)
            {
                Compile.Go(Dirry.AD(f).Replace("\\", "/"));
            }
            Console.WriteLine($"\tErrors: {Errors}; Warnings: {Warnings}");
            TrickyDebug.AttachWait();
        }
Exemple #3
0
 void RunMain()
 {
     if (fp.GetBool("h"))
     {
         HelpScreen();
         TrickyDebug.AttachWait();
         return;
     }
 }
Exemple #4
0
 public static void CRASH(string w)
 {
     Console.Beep();
     Console.Beep();
     Console.ForegroundColor = ConsoleColor.Red;
     Console.Write("FATAL ");
     Error(w);
     TrickyDebug.AttachWait();
     Environment.Exit(10);
 }
Exemple #5
0
 static void Main(string[] args)
 {
     if (args.Length == 0)
     {
         HelpScreen();
     }
     else
     {
         RunScript(args);
     }
     TrickyDebug.AttachWait();
 }
Exemple #6
0
 static void Main(string[] args)
 {
     Dirry.InitAltDrives();
     if (args.Length == 0)
     {
         NoStuff();
     }
     else
     {
         Run(args);
     }
     TrickyDebug.AttachWait();
 }
Exemple #7
0
        static void Main(string[] args)
        {
            try {
                MKL.Lic("Quick Neil - QuickNeil.cs", "GNU General Public License 3");
                MKL.Version("Quick Neil - QuickNeil.cs", "20.08.14");
                if (args.Length == 0)
                {
                    Head();
                    QCol.Cyan("Usage: ");
                    QCol.Yellow($"{qstr.StripAll(MKL.MyExe)} ");
                    QCol.Green("<script file> ");
                    QCol.Magenta("[<arguments>]\n\n");
                    QCol.White($"{MKL.All()}\n\n");
                    return;
                }
                else
                {
                    var addargs = new StringBuilder("{");
                    for (int i = 1; i < args.Length; i++)
                    {
                        if (i >= 2)
                        {
                            addargs.Append(", ");
                        }
                        var arg = args[i].Replace("\\", "\\\\");
                        for (int j = 0; j < 256; j++)
                        {
                            if (j < 32 || j > 120 || (char)j == '"')
                            {
                                arg = arg.Replace($"{(char)j}", $"\\{qstr.Right($"00{j}", 3)}");
                            }
                        }
                        addargs.Append($"\"{arg}\"");
                    }
                    addargs.Append("}");
                    Debug.WriteLine($"DBG:Argument array {addargs}");
                    //throw new Exception ($"Argument array {addargs}"); // debug only!
                    LoadScript(args[0], $"{addargs}");
                }
            } catch (Exception e) {
                QCol.QuickError(e.Message);
#if DEBUG
                QCol.Cyan("Traceback\n");
                QCol.White($"{e.StackTrace}\n");
#endif
            } finally {
                TrickyDebug.AttachWait();
            }
        }
Exemple #8
0
 static void Main(string[] args)
 {
     Dirry.InitAltDrives();
     JCR6_lzma.Init();
     JCR6_zlib.Init();
     if (args.Length != 1)
     {
         Console.WriteLine("Usage: KthuraConvert <Project>");
     }
     else
     {
         var M = new Program(args[0]);
         M.Run();
     }
     TrickyDebug.AttachWait();
 }
Exemple #9
0
        static void LoadScript(string script, string args)
        {
            script = Dirry.AD(script.Replace("\\", "/"));
            State  = new Lua();
            var CallScript = $"ls = loadstring or load\nlocal LoadNeil = assert(ls(\"{NeilScript.Replace("\\","\\\\").Replace("\n", "\\n").Replace("\r", "").Replace("\"","\\\"")}\",\"Neil itself\"))\nNeil = LoadNeil()";

            Debug.WriteLine(CallScript);
            State.DoString(CallScript, "Call Neil itself");
            // newk,oftype,rw,defaultvalue
            // if (true) throw new Exception(args);
            State.DoString($"Neil.Globals('Args','table','constant',{args})", "Set CLI arguments");
            new API(State, script);
            TrickyDebug.Chat("Loaded Neil");
            var s = QuickStream.LoadString(Dirry.AD(script));

            TrickyDebug.Chat($"Loaded Script: {script}");
            //var scr = s.Replace("\\", "\\\\").Replace("\n", "\\n").Replace("\r", "").Replace("\"", "\\\"");
            var scr = s.Replace("\\", "\\\\");

            for (int i = 0; i < 256; i++)
            {
                if (i < 32 || i > 120 || (char)i == '"')
                {
                    scr = scr.Replace($"{(char)i}", $"\\{qstr.Right($"00{i}", 3)}");
                }
            }
            // Console.WriteLine($"<C#>{scr}</C#>");
            // Console.WriteLine($"Script: {script}");
            TrickyDebug.Chat("String secured");
            var sendscr = $"local translation = assert(Neil.Translate(\"{scr}\",\"Translate: {script}\"))\n\nlocal err; QUICKNEILSCRIPTFUNCTION,err = ls(translation,\"{script}\")\n\nif not QUICKNEILSCRIPTFUNCTION then error(\"Compiling the translation failed\\n\"..tostring(err)..\"\\n\\n\"..translation) end";

            //Console.WriteLine($"<TRANSLATION>\n{sendscr}\n</TRANSLATION>");
            Debug.WriteLine(sendscr);
            State.DoString(sendscr, "Translating");
            State.DoString("QUICKNEILSCRIPTFUNCTION()", "Run-Time");
        }
Exemple #10
0
        static void Main(string[] args)
        {
            // Header
            QCol.Red("Kitty "); QCol.Magenta("Coded by: Tricky\n");
            QCol.Yellow($"(c) {MKL.CYear(2019)} Jeroen P. Broks\n\n");
            // Init
            Dirry.InitAltDrives();
            KittyHigh.Init();
            new KittyHighCS();
            new KittyHighNIL();
            new KittyHighLua();
            new KittyHighGINI();
            new KittyHighScyndi();
            new KittyBlitzMax();
            new KittyHighC();
            new KittyHighPascal();
            new KittyHighBrainFuck();
            new KittyHighGo();
            new KittyHighBlitzBasic();
            new KittyHighSASKIA();
            new KittyHighPython();
            new KittyHighJavaScript();
            new KittyHighWhiteSpace();
            new KittyHighBASIC();
            new KittyHighJava();
            new KittyHighINI();
            new KittyHighVB();
            new KittyHighCobra();
            new KittyHighHtml();
            new KittyHighXml();
            new KittyHighNeil();
            var slin = true;

            if (args.Length == 0)
            {
                QCol.Green("Kitty is a simple program which will help you view source files in syntax highlight\n");
                QCol.Magenta("Usage:\t");
                QCol.Yellow("Kitty ");
                QCol.Cyan("<switches> ");
                QCol.White("<files>");
                QCol.Green("[");
                QCol.Cyan("<switches> ");
                QCol.White("<files>");
                QCol.Green("..]");
                Console.WriteLine("\n\n");
                QCol.Yellow("Please note that switches affect all files defined after it not those that come before it. This allows you to configure each file shown\n\n");
                QCol.Cyan("-ln              "); QCol.Yellow("Toggle line numbers on/off (default is on)\n");
                QCol.Cyan("-nolinenumbers   "); QCol.Yellow("Turn line numbers off\n");
                QCol.Cyan("-Showlinenumbers "); QCol.Yellow("Turn line numbers on\n");
                QCol.Cyan("-re              "); QCol.Yellow("Toggle searching by RegEx (this allows limited support for Wild Cards and more nice things)\n");
                QCol.Cyan("-p, -more        "); QCol.Yellow("Turn \"more\" mode on/off. (Read note below)\n");
                QCol.Cyan("-support         "); QCol.Yellow("Show a list of all supported file formats\n");
                QCol.Red("\n\nThe \"more\" mode!\n");
                QCol.Yellow("Does not entirely work the same as the 'more' utility, but has the same primary function!\n");
                QCol.Yellow("When the \"more\" bar appears you can hit space to show the next line, Enter/Return to show the entire next page and escape to turn the more mode off\n");
                QCol.White("\n\nKitty can be used as as CLI tool, but the integry has been made to be included in your own projects, and has been released under the terms of the zlib license\n\n");
                return;
            }
            // Go for it
            QCol.Doing("Called from:", System.IO.Directory.GetCurrentDirectory());
            void ViewFile(string a)
            {
                try {
                    var arg = Dirry.AD(a).Replace("\\", "/");
                    QCol.Doing("Reading", arg); KittyHigh.PageBreak();
                    var src  = QuickStream.LoadString(arg);
                    var eoln = qstr.EOLNType(arg);
                    // QCol.Doing("EOLN", eoln); // didn't work anyway
                    //QCol.OriCol();
                    var       ext    = qstr.ExtractExt(arg).ToLower();
                    KittyHigh Viewer = KittyHigh.Langs["OTHER"];
                    if (KittyHigh.Langs.ContainsKey(ext))
                    {
                        Viewer = KittyHigh.Langs[ext];
                    }
                    QCol.Doing("Type", Viewer.Language); KittyHigh.PageBreak();
                    KittyHigh.WriteLine();
                    Viewer.Show(src, slin);
                } catch (Exception ex) {
                    QCol.QuickError($"{ex.Message}\n");
#if DEBUG
                    QCol.Magenta($"{ex.StackTrace}\n\n");
#endif
                }
            }

            var aregex = false;
            foreach (string a in args)
            {
                if (qstr.Prefixed(a, "-"))
                {
                    switch (a.ToLower())
                    {
                    case "-ln": slin = !slin; break;

                    case "-nolinenumbers": slin = false; break;

                    case "-showlinenumbers": slin = true; break;

                    case "-p":
                    case "-more": KittyHigh.BrkLines = !KittyHigh.BrkLines; break;

                    case "-re": aregex = !aregex; break;

                    case "-support":
                        foreach (string ext in KittyHigh.Langs.Keys)
                        {
                            QCol.Cyan(qstr.Left($"{ext}                    ", 20));
                            QCol.Yellow($"{KittyHigh.Langs[ext].Language}\n");
                        }
                        break;

                    default: QCol.QuickError($"Unknown switch: {a}"); break;
                    }
                }
                else if (aregex)
                {
                    QCol.Doing("Searching for RegEx", a);
                    var rgxl = RegExTree.Tree(a);
                    foreach (string af in rgxl)
                    {
                        ViewFile(af);
                    }
                }
                else
                {
                    ViewFile(a);
                }
            }
            TrickyDebug.AttachWait();
        }
Exemple #11
0
        static void Main(string[] args)
        {
            // Diagonally?
            Dijkstra.Config_AllowDiagonally = false;
            // Create BlockMap
            var map = QuickStream.LoadLines($"{qstr.ExtractDir(MKL.MyExe)}/TestDijkStra_Map.txt");
            var buf = new bool[map[0].Length, map.Length];
            int SX = 0, SY = 0, EX = 0, EY = 0;

            for (int y = 0; y < map.Length; y++)
            {
                for (int x = 0; x < map[y].Length; x++)
                {
                    buf[x, y] = map[y][x] != 'X';
                    switch (map[y][x])
                    {
                    case 'E':
                        EX = x;
                        EY = y;
                        Console.WriteLine($"  End position: ({EX},{EY})");
                        break;

                    case 'S':
                        SX = x;
                        SY = y;
                        Console.WriteLine($"Start position: ({SX},{SY})");
                        break;
                    }
                }
            }
            Console.WriteLine($"Calculating route from ({SX},{SY}) to ({EX},{EY})");
            var D     = new Dijkstra(buf, SX, SY, EX, EY);
            var Route = D.Start();

            Console.WriteLine($"Success: {Route.Success} - Length: {Route.Nodes.Length}");
            int u = 0; // unit count!

            for (int y = 0; y < map.Length; y++)
            {
                if (y == 0)
                {
                    var t = "";
                    var e = "";
                    for (int i = 0; i < map[y].Length; i++)
                    {
                        if (i % 10 == 0)
                        {
                            t += $"{(int)Math.Floor((decimal)i / 10)}";
                        }
                        else
                        {
                            t += " ";
                        }
                        e += i % 10;
                    }
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.WriteLine($"{t}\n{e}");
                }
                for (int x = 0; x < map[y].Length; x++)
                {
                    //int m = u % 10;
                    var hasnode = false;
                    foreach (Node N in Route.Nodes)
                    {
                        hasnode = hasnode || (N.x == x && N.y == y);
                    }
                    if (hasnode)
                    {
                        Console.ForegroundColor = (ConsoleColor)9;
                        Console.Write('*');
                    }
                    else if (!(buf[x, y]))
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("X");
                    }
                    else
                    {
                        Console.Write(" ");
                    }
                }
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"    {y}");
            }
            Console.ResetColor();
            foreach (Node N in Route.Nodes)
            {
                Console.Write($"({N.x},{N.y}); ");
            }
            Console.WriteLine("\n"); // Yes, skip two lines... I know dirty code!
            TrickyDebug.AttachWait();
        }