Ejemplo n.º 1
0
        static int Main(string[] args)
        {
            GLibInitialize();

            CompilerOptions opts = new CompilerOptions();

            try {
                opts.parse_args(args);
            } catch (Exception e) {
                stdout.printf("%s\n", e.Message);
                stdout.printf("Run '%s --help' to see a full list of available command line options.\n", AppDomain.CurrentDomain.FriendlyName);
                return(1);
            }

            if (opts.cc_options != null)
            {
                for (int i = 0; i < opts.cc_options.Count; i++)
                {
                    string cc_opt = opts.cc_options[i];
                    if (cc_opt.Length > 0 && cc_opt[0] == '\'')
                    {
                        cc_opt             = cc_opt.Substring(1, cc_opt.Length - 2).Trim();
                        opts.cc_options[i] = cc_opt;
                    }
                }
            }

            if (opts.version)
            {
                stdout.printf("Vala %s\n", Config.BUILD_VERSION);
                return(0);
            }
            else if (opts.api_version)
            {
                stdout.printf("%s\n", Config.API_VERSION);
                return(0);
            }

            if (opts.sources == null && opts.fast_vapis == null)
            {
                stderr.printf("No source file specified.\n");
                return(1);
            }

            //int result = run_source(opts);
            //return result;
            var compiler = new Compiler(opts);
            int result   = compiler.run();

            GLibDispose();
            return(result);
        }