diff options
author | dos-reis <gdr@axiomatics.org> | 2011-06-05 22:50:39 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-06-05 22:50:39 +0000 |
commit | 08694a36b0b686351c8a2dbd2746bc78ea0dc221 (patch) | |
tree | c312197a0172c5e2782dca81e44179ee08dbdab0 /src/utils | |
parent | 337e66b09fee7f98beca1a2f47c589cc622e50c7 (diff) | |
download | open-axiom-08694a36b0b686351c8a2dbd2746bc78ea0dc221.tar.gz |
* utils/command.cc (default_driver): New.
(preprocess_arguments): Use it. Honor --no-gui on Windows.
(OPENAXIOM_DEFAULT_DRIVER): Remove.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/command.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/utils/command.cc b/src/utils/command.cc index 498e2f4e..f53e6f70 100644 --- a/src/utils/command.cc +++ b/src/utils/command.cc @@ -249,13 +249,15 @@ build_rts_options(Command* command, Driver driver) } } -#if OPENAXIOM_USE_SMAN -# define OPENAXIOM_DEFAULT_DRIVER sman_driver -#elif OPENAXIOM_USE_GUI -# define OPENAXIOM_DEFAULT_DRIVER gui_driver -#else -# define OPENAXIOM_DEFAULT_DRIVER core_driver -#endif +// Return a description of the driver to invokve by default. +static Driver default_driver(bool explicit_no_gui) { + if (OPENAXIOM_USE_SMAN) + return sman_driver; + else if (OPENAXIOM_USE_GUI and not explicit_no_gui) + return gui_driver; + else + return core_driver; +} static void print_line(const char* line) { @@ -338,6 +340,7 @@ preprocess_arguments(Command* command, int argc, char** argv) int other = 1; int files = 0; Driver driver = unknown_driver; + bool explicit_no_gui = false; // True if --no-gui explicitly specified. command->root_dir = get_systemdir(argc, argv); for (i = 1; i < argc; ++i) @@ -370,9 +373,13 @@ preprocess_arguments(Command* command, int argc, char** argv) if (const Driver d = option_driver(argv[i])) driver = d; else { - if (argv[i][0] == '-') - /* Maybe option for the driver. */ - ; + /* Maybe option for the driver. */ + if (argv[i][0] == '-') { + // this is awkward to handle here since it supposed + // to go to Superman. FIXME when sman is gone. + if (strcmp(argv[i], "--no-gui") == 0) + explicit_no_gui = true; + } else if (strlen(argv[i]) > 0) /* Assume a file. */ ++files; @@ -416,7 +423,7 @@ preprocess_arguments(Command* command, int argc, char** argv) break; } else if (driver == unknown_driver) - driver = OPENAXIOM_DEFAULT_DRIVER; + driver = default_driver(explicit_no_gui); command->core.argv[command->core.argc] = NULL; build_rts_options(command, driver); |