Exemple #1
0
        static void Image(string[] args)
        {
            OptionSession<ImageJob, OptionGroup> session = new OptionSession<ImageJob, OptionGroup>();
              session.NewOption("printHeader", OptionGroup.General, 'x', null, null, "...");
              session.NewOption("printDisassemble", OptionGroup.General, 'D', null, null, "...");

              ImageJob ij = new ImageJob();
              List<string> files = session.Parse(args, ij);

              foreach (string file in files) {
            ij.Run(file);
            Console.WriteLine();
              }
        }
Exemple #2
0
        static void Cc(string[] args)
        {
            OptionSession<CCompiler, OptionGroup> session = new OptionSession<CCompiler, OptionGroup>();
              session.NewOption("DoCompile", OptionGroup.Compile_Command, 'c', null, null, "Compile and assemble the source files, but do not link.");
              session.NewOption("DoAssemble", OptionGroup.Compile_Command, 'S', null, null, "Compile but doesn't assemble. The output is formed of mnemonics.");
              session.NewOption("DoPreProcess", OptionGroup.Compile_Command, 'E', null, null, "Stop after the pre-processing stage. Output give all pre-processing decision.");
              session.NewOption("DoParse", OptionGroup.Compile_Command, 'P', null, null, "Parse a C source file and print all definitions.");
              session.NewOption("DoDependancies", OptionGroup.Compile_Command, 'M', null, null, "Print all dependence headers as make target.");

              // session.NewOption("Disx86", OptionGroup.Unit_Test, '\0', "Disx86", null, "Lanch unitt-test for Intelx86 disassembly.");

              session.NewOption("Output", OptionGroup.General, 'o', null, "file", "Place output in file file. By default give text output on stdout and binary on file named a.out.");
              session.NewOption("Statistics", OptionGroup.General, 'Q', null, null, "Print some statistics about each modules/pass.");
              session.NewOption("Warning", OptionGroup.General, 'W', null, "warn", "Enable/disable some compilation warning.");

              session.NewOption("IncludeDirs", OptionGroup.C_Source, 'I', null, "dir", "Add a new header directory.");
              session.NewOption("LibrariesDirs", OptionGroup.C_Source, 'L', null, "dir", "Add a new libraries directory.");
              session.NewOption("Define", OptionGroup.C_Source, 'D', null, "macro", "Define a macro (equal to MACRO=value or MACRO).");
              session.NewOption("Undefine", OptionGroup.C_Source, 'U', null, "macro", "Undefine a macro (equal to MACRO).");

              CCompiler cc = new CCompiler();

              // DEFINE CONFIG_LDDIR="\"lib64\"" & TCC_TARGET_X86_64
              // cc.Define("CONFIG_LDDIR=\"lib64\"");
              // cc.Define("TCC_TARGET_X86_64");
              cc.Define("__STDC_VERSION__=201410");

              // ADD INCLUDE DIR
              cc.IncludeDirs.Add(StandardLibraryHeaderDirectory);

              // Read Command line
              List<string> files = session.Parse(args, cc);

              foreach (string file in files) {
            cc.Compile(file);
            Console.WriteLine();
              }
        }