aboutsummaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-11-19 22:58:51 +0000
committerdos-reis <gdr@axiomatics.org>2010-11-19 22:58:51 +0000
commit5b484d68a91e5867c96ac409253f3503b188aadd (patch)
tree603edd807121b9440b80202d502426a4b53d7ade /src/driver
parent32a0482710c76733805bca604c2089c231cd733f (diff)
downloadopen-axiom-5b484d68a91e5867c96ac409253f3503b188aadd.tar.gz
* driver/utils.c (openaxiom_allocate_argv): New.
(openaxiom_build_rts_options): Use it. Tidy. Handle Clozure CL and CLISP.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/utils.c29
-rw-r--r--src/driver/utils.h33
2 files changed, 35 insertions, 27 deletions
diff --git a/src/driver/utils.c b/src/driver/utils.c
index ed85339d..6914c5ac 100644
--- a/src/driver/utils.c
+++ b/src/driver/utils.c
@@ -113,6 +113,15 @@ openaxiom_make_path_for(const char* prefix, openaxiom_driver driver)
return execpath;
}
+/* Allocate a nul-terminated vector for holding pointers to arguments
+ for the base Lisp runtime. */
+static void
+openaxiom_allocate_argv(openaxiom_command* command, int n) {
+ command->rt_argc = n;
+ command->rt_argv = (char**) malloc((n + 1) * sizeof(char*));
+ command->rt_argv[n] = 0;
+}
+
/* Build arguments, if any, to be supplied to the runtime system
of `driver'. */
void
@@ -133,9 +142,7 @@ openaxiom_build_rts_options(openaxiom_command* command,
case openaxiom_script_driver:
switch (OPENAXIOM_BASE_RTS) {
case openaxiom_gcl_runtime:
- command->rt_argc = 3;
- command->rt_argv = (char **)
- malloc(command->rt_argc * sizeof (char*));
+ openaxiom_allocate_argv(command, 3);
command->rt_argv[0] = (char*) "-batch";
command->rt_argv[1] = (char*) "-eval";
command->rt_argv[2] =
@@ -143,14 +150,24 @@ openaxiom_build_rts_options(openaxiom_command* command,
break;
case openaxiom_sbcl_runtime:
- command->rt_argc = 4;
- command->rt_argv = (char **)
- malloc(command->rt_argc * sizeof (char*));
+ openaxiom_allocate_argv(command, 4);
command->rt_argv[0] = (char*) "--noinform";
command->rt_argv[1] = (char*) "--end-runtime-options";
command->rt_argv[2] = (char*) "--noprint";
command->rt_argv[3] = (char*) "--end-toplevel-options";
break;
+
+ case openaxiom_clozure_runtime:
+ openaxiom_allocate_argv(command, 2);
+ command->rt_argv[0] = (char*) "--quiet";
+ command->rt_argv[1] = (char*) "--batch";
+ break;
+
+ case openaxiom_clisp_runtime:
+ openaxiom_allocate_argv(command, 2);
+ command->rt_argv[0] = (char*) "--quiet";
+ command->rt_argv[1] = (char*) "-norc";
+ break;
default:
abort();
diff --git a/src/driver/utils.h b/src/driver/utils.h
index b47970da..8f56ba45 100644
--- a/src/driver/utils.h
+++ b/src/driver/utils.h
@@ -42,12 +42,8 @@
# include <windows.h>
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* A list of drivers for OpenAxiom. */
-typedef enum openaxiom_driver {
+enum openaxiom_driver {
openaxiom_unknown_driver, /* unknown driver */
openaxiom_null_driver, /* do nothing */
openaxiom_config_driver, /* print out configuration information */
@@ -56,26 +52,26 @@ typedef enum openaxiom_driver {
openaxiom_script_driver, /* start the core system in script mode. */
openaxiom_compiler_driver, /* start the core system in compiler mode. */
openaxiom_execute_driver /* Execute a command. */
-} openaxiom_driver;
+};
/* A list of runtime support systems for OpenAxiom. */
-typedef enum openaxiom_runtime {
+enum openaxiom_runtime {
openaxiom_unknown_runtime,
- openaxiom_gcl_runtime,
- openaxiom_sbcl_runtime,
- openaxiom_clisp_runtime,
- openaxiom_ecl_runtime,
- openaxiom_clozure_runtime,
- openaxiom_bemol_runtime
-} openaxiom_runtime;
+ openaxiom_gcl_runtime, /* GCL-based runtime */
+ openaxiom_sbcl_runtime, /* SBCL-based runtime */
+ openaxiom_clisp_runtime, /* CLISP-based runtime */
+ openaxiom_ecl_runtime, /* ECL-based runtime */
+ openaxiom_clozure_runtime, /* Clozure CL-based runtime */
+ openaxiom_bemol_runtime /* Bemol-based runtime */
+};
/* A description of external command to be executed. */
-typedef struct openaxiom_command {
+struct openaxiom_command {
openaxiom_process core; /* arguments for actual executable. */
char** rt_argv; /* arguments to the base RT, if any. */
int rt_argc; /* number of such arguments. */
const char* root_dir; /* path to the OpenAxiom system. */
-} openaxiom_command;
+};
const char* openaxiom_get_systemdir(int argc, char*[]);
const char* openaxiom_make_path_for(const char*, openaxiom_driver);
@@ -87,9 +83,4 @@ openaxiom_driver
openaxiom_preprocess_arguments(openaxiom_command*, int, char**);
-
-#ifdef __cplusplus
-}
-#endif
-
#endif /* OPENAXIOM_UTILS_INCLUDED */