void parse_options() { // Parse command line options, and update the environment to match the // specified options. argp->usage( "Usage: jogo [OPTIONS] FILE...\n\n" "Compiles Jogo source files into a library or executable.\n\n" " -a, --assembly Compile, but do not assemble or link.\n" " -c, --compile Compile and assemble, but do not link.\n" " -e, --execute Execute program as a script.\n" " -d, --debug Emit debug information.\n" " -l, --library LIB Compile and link with native library LIB.\n" " -i, --include DIR Add the directory DIR to the search path.\n" " -o, --output FILE Write compiler output to FILE.\n" " -m, --make Compile input files and out-of-date dependencies.\n" " -h, --help Print this help message.\n" " -v, --verbose Print extra information during compilation.\n" " -g, --generator GEN Use code generator GEN.\n" " --build-dir DIR Output directory for object files.\n" " --dump-ir Output the intermediate representation.\n" " --dump-ast Output the abstract syntax tree.\n" " --dump-liveness Output liveness info when printing the IR.\n" " --dump-regalloc Dump register allocations.\n" " --dump-reggraph Dump register interference graphs.\n" " --version Print the compiler version number.\n"); for (ArgToken tok = argp->next(); tok; tok = argp->next()) { // Convert abbreviated flags into the longer descriptive form (e.g., // convert -p to --path) if (ArgToken::SHORT == tok.type()) { parse_short_option(tok.value()); } else if (ArgToken::LONG == tok.type()) { parse_option(tok.value()); } else { env->input(tok.value()); } } std::string gen = env->generator(); if (gen != "Intel64" && gen != "C" && gen != "Nasm64") { argp->error("Invalid code generator (options: Intel64, NAsm64, C)"); } if (!env->inputs()) { argp->error("No input files."); } }