#ifndef optionsIncluded #define optionsIncluded /* * A command-line options module. The following options are currently defined: * * -v or -verbose or -print-progress * Print translation progress to stdout. The output is of the form * "Checking ...", where the "..." includes the names of modules, * objects, and operations. * * -i or -interactive * After translation of any files, enter the interactive interpreter * loop. THIS OPTION IS NOT CURRENTLY IMPLEMENTED. * * -dump-memory * Dump the contents of the global memory pool upon completion of * execution of all top-level expressions contained in the input * files. This dump occurs prior to entering the interactive loop, * and no further dumping occurs during the interactive session. THIS * OPTION IS NOT CURRENTLY IMPLEMENTED. * * -dump-symtabs * Dump the contents of the entire symbol table hierarchy, upon * completion of type checking all input files. This dump occurs * prior to the memory dump, if any, and prior to entering the * interactive loop. No further dumping occurs during the interactive * session. THIS OPTION IS NOT CURRENTLY IMPLEMENTED. * * -dump-universe * Dump the contents of all tables in the value universe, upon * completion of execution of the top-level expressions contained in * the input files. This dump occurs prior to entering the * interactive loop, and no further dumping occurs during the * interactive session. IMPLEMENTATION OF THIS OPTION IS PENDING. * * -universe-duplicates * Allow duplicate values to be stored in universe value tables. If * this option is off (the default), then duplicate values are not * stored within any single value table, though duplicate values may * in fact appear across value tables. E.g., suppose * -universe-duplicates is false, and we have value tables X and Y. * Under these circumstances, no duplicate value will appear in either * X or Y, but the same value may appear independently in X and in Y, * if X and Y contain values of compatible types. IMPLEMENTATION OF * THIS OPTION IS PENDING. * * -h or -help * Print a short usage message to stdout, then exit immediately, * without performing any translation. * * The following conventions apply to options processing: * * 1. Single-character options canNOT be run together in a single option * word. E.g., the -v and -i options cannot be combined into -vi. The * -vi option is unrecognized, as are any other such combinations. * * 2. For each option of the form x-y-z, there is * * a. A hidden boolean flag variable named x_y_z_flag. The value of the * variable is true if the option -x-y-z appears on the command line. * E.g., the variable print_progress_flag is true if -print-progress * appears on the command line (or if one of its synonyms -v or * -verbose appears). All flag variables are initialized to false. * * b. A public boolean function named XYZOn. The function returns the * value of the corresponding flag. E.g., PrintProgressOn returns * the value of print_progress_on_flag. * * 3. For some options, there is a set function named SetXYZ(bool). This * function can be used to set the value of an option flag * programmatically, independent from how it may have been set on the * command line. E.g., the function SetDumpUniverse is used to set the * value of dump_universe_flag, which will affect the subsequent * behavior of the DumpUniverseOn function. * * */ #include "std-macros.h" typedef enum { OPTIONS_OK, OPTIONS_FAILED, OPTIONS_START_INTERACTIVE } OptionsStatus; /** * Init all options to false. */ void InitOptions(); /*** * Option query functions. Each simply returns the current value of the * corresponding flag. */ bool WarnOnObjRedefOn(); bool PrintProgressOn(); bool DumpMemoryOn(); bool DumpSymtabsOn(); bool DumpUniverseOn(); bool UniverseDuplicatesOn(); /*** * Selected option seting functions. */ void SetDumpUniverseOn(bool val); void SetUniverseDuplicatesOn(bool val); /** * Process command-line options per the conventios described in the top-level * comment. */ OptionsStatus ProcessCommandLineOptions(int argc, char** argv); /** * Print a short help message to stdout, in normal UNIX form. The message * cites the reference manual and man page for further details. */ void PrintUsage(); #endif