예제 #1
0
파일: Translate.cs 프로젝트: vipyami/IL2C
        public override bool Execute()
        {
            var outputPath       = this.OutputPath.ItemSpec.Trim();
            var debugInformation = string.IsNullOrWhiteSpace(this.DebugInformation)
                ? DebugInformationOptions.CommentOnly
                : (DebugInformationOptions)Enum.Parse(typeof(DebugInformationOptions), this.DebugInformation);

            var logw = new LogWriter(message =>
                                     this.Log.LogMessage(
                                         MessageImportance.High,
                                         "{0}", message));

            SimpleDriver.TranslateAll(
                logw,
                outputPath,
                this.ReadSymbols,
                this.EnableCpp,
                this.EnableBundler,
                debugInformation,
                this.AssemblyPaths.
                Select(path => path.ItemSpec.Trim()).
                ToArray());

            return(true);
        }
예제 #2
0
파일: Program.cs 프로젝트: vipyami/IL2C
        public static int Main(string[] args)
        {
            try
            {
                var debugInformationOptions = DebugInformationOptions.None;
                var readSymbols             = true;
                var enableBundler           = false;
                var enableCpp = false;
                var help      = false;

                var options = new OptionSet()
                {
                    { "g1|debug", "Emit debug informations (contains only comments)", v => debugInformationOptions = DebugInformationOptions.CommentOnly },
                    { "g|g2|debug-full", "Emit debug informations (contains line numbers)", v => debugInformationOptions = DebugInformationOptions.Full },
                    { "no-read-symbols", "NO read symbol files", _ => readSymbols = false },
                    { "cpp", "Produce C++ extension files (apply extension *.cpp instead *.c, body will not change)", _ => enableCpp = true },
                    { "bundler", "Produce bundler source file", _ => enableBundler = true },
                    { "h|help", "Print this help", _ => help = true },
                };

                var extra = options.Parse(args);
                if (help || (extra.Count < 2))
                {
                    Console.Out.WriteLine("usage: il2c.exe [options] <output_path> <assembly_path>");
                    options.WriteOptionDescriptions(Console.Out);
                }
                else
                {
                    var outputPath    = extra[0];
                    var assemblyPaths = extra.Skip(1);

                    SimpleDriver.TranslateAll(
                        Console.Out,
                        outputPath,
                        readSymbols,
                        enableCpp,
                        enableBundler,
                        debugInformationOptions,
                        assemblyPaths);
                }

                return(0);
            }
            catch (OptionException ex)
            {
                Console.Error.WriteLine(ex.Message);
                return(Marshal.GetHRForException(ex));
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(Marshal.GetHRForException(ex));
            }
        }