aboutsummaryrefslogtreecommitdiff
path: root/src/driver/utils.c
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-11-30 00:35:51 +0000
committerdos-reis <gdr@axiomatics.org>2010-11-30 00:35:51 +0000
commitcadd6f77df5ad2f93d1c494525db8a192bed87b5 (patch)
tree1662ed293232382d988bac5e9c2fea089ea80b07 /src/driver/utils.c
parenteadaa332441dbb0bbc710e4803cd73970859cc1f (diff)
downloadopen-axiom-cadd6f77df5ad2f93d1c494525db8a192bed87b5.tar.gz
* etc/Makefile.in: Use the driver.
* driver/utils.c (get_suffix): New. (option_value): Likewise. (preprocess_arguments): Handle --translate and --build-databases. * driver/main.c (upgrade_environment): Change argument type to Command. Upgrade LD_LIBRARY_PATH too. * boot/translator.boot (loadSystemRuntimeCore): Don't prefix the shared library file name with the system path.
Diffstat (limited to 'src/driver/utils.c')
-rw-r--r--src/driver/utils.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/driver/utils.c b/src/driver/utils.c
index 42b0183d..89e1ad4c 100644
--- a/src/driver/utils.c
+++ b/src/driver/utils.c
@@ -86,6 +86,14 @@ namespace OpenAxiom {
exec_path()
{ }
+ static const char*
+ get_suffix(const char* first, const char* last, const char* seq) {
+ for (; first < last; ++first, ++seq)
+ if (*first != *seq)
+ return 0;
+ return seq;
+ }
+
// -- Return non-null if `lhs' is a prefix of `rhs'. When non-null
// -- the pointer points to the '=' character that starts of the
// -- value supplied to the argument.
@@ -97,6 +105,21 @@ namespace OpenAxiom {
return rhs + N - 1;
}
+ const char*
+ option_value(const Command* command, const char* opt) {
+ const int n = strlen(opt);
+ for (int i = 1; i < command->core.argc; ++i) {
+ const char* arg = command->core.argv[i];
+ if (strlen(arg) < n)
+ continue;
+ if(const char* val = get_suffix(opt, opt + n, arg)) {
+ if (*val++ == '=')
+ return val;
+ break;
+ }
+ }
+ return 0;
+ }
/* Return a path to the running system, either as specified on command
line through --system=, or as specified at configuration time. */
@@ -311,7 +334,8 @@ preprocess_arguments(Command* command, int argc, char** argv)
if (strcmp(argv[i], "--script") == 0)
driver = script_driver;
else if(strcmp(argv[i], "--compile") == 0
- or strcmp(argv[i], "--translate") == 0)
+ or strcmp(argv[i], "--translate") == 0
+ or strcmp(argv[i], "--build-databases") == 0)
driver = compiler_driver;
else if (strcmp(argv[i], "--make") == 0)
driver = linker_driver;