Exemplo n.º 1
0
 public Compiler(StartParams args)
 {
     arguments = args;
     output_asm = string.Format ("{0}.asm", args.output);
 }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            if (args.Length == 0) {
                BanWitches ();
            }

            // Initialize start parameters with default values
            StartParams sp = new StartParams () {
                input = new List<string> (),
                output = "kernel.iso",
                entry = "auto",
                verbose = false,
            };

            // Check for specific arguments
            for (int i = 0; i < args.Length; i++) {
                switch (args[i])
                {
                    case "-i":
                    case "--include":
                        if (args.Length < ++i || !File.Exists (args[i]))
                        {
                            Console.WriteLine ("Path expected. U mad bro?");
                            BanWitches ();
                        }
                        sp.input.Add (Path.GetFullPath (args[i]));
                        break;

                    case "-e":
                    case "--entry":
                        if (args.Length < ++i)
                        {
                            Console.WriteLine ("String expected. U mad bro?");
                            BanWitches ();
                        }
                        sp.entry = args[i];
                        break;

                    case "-o":
                    case "--output":
                        if (args.Length < ++i)
                        {
                            Console.WriteLine ("Path expected. U mad bro?");
                            BanWitches ();
                        }
                        sp.output = Path.GetFullPath (args[i]);
                        break;

                    case "-v":
                    case "--verbose":
                        sp.verbose = true;
                        break;

                    default:
                        Console.WriteLine ("Unrecognized argument: \'{0}\'", args[i]);
                        BanWitches ();
                        break;
                }
            }

            // Let's start..
            Compiler compiler = new Compiler (sp);
            compiler.Start ();
        }