aboutsummaryrefslogtreecommitdiff
path: root/src/include/open-axiom.h
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-06-02 22:43:24 +0000
committerdos-reis <gdr@axiomatics.org>2011-06-02 22:43:24 +0000
commit761e0f5d002dc199db16b996aafa60d6df6afcd7 (patch)
tree93803c5c05f8b80a5b2c767f07d91a30d63f8f21 /src/include/open-axiom.h
parent10634545f2faf10699a1a8214ded2da3a6ea3d52 (diff)
downloadopen-axiom-761e0f5d002dc199db16b996aafa60d6df6afcd7.tar.gz
consolidate utility codes
Diffstat (limited to 'src/include/open-axiom.h')
-rw-r--r--src/include/open-axiom.h95
1 files changed, 88 insertions, 7 deletions
diff --git a/src/include/open-axiom.h b/src/include/open-axiom.h
index 33be7e97..e230a825 100644
--- a/src/include/open-axiom.h
+++ b/src/include/open-axiom.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007-2010, Gabriel Dos Reis.
+ Copyright (C) 2007-2011, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@
#ifndef OPENAXIOM_included
#define OPENAXIOM_included
+#include <vector>
+
#include "openaxiom-c-macros.h"
/* Annotation to request C calling convention */
@@ -66,12 +68,12 @@
# include <inttypes.h>
#endif
-/* The opaque datatype. */
-#ifdef __WIN32__
+#if defined(__WIN32__)
# include <windows.h>
#endif
-
-#include <unistd.h>
+#if defined(HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
/* Do we have graphics support? */
#ifdef X_DISPLAY_MISSING
@@ -116,7 +118,7 @@ namespace OpenAxiom {
}
/* Internal field separator character. */
-#ifdef __WIN32__
+#if defined(__WIN32__)
# define openaxiom_ifs ';'
#else
# define openaxiom_ifs ':'
@@ -136,7 +138,7 @@ namespace OpenAxiom {
static inline void
openaxiom_sleep(int n)
{
-#ifdef __WIN32__
+#if defined(__WIN32__)
Sleep(n * 1000);
#else
sleep(n);
@@ -147,6 +149,85 @@ namespace OpenAxiom {
OPENAXIOM_C_EXPORT int oa_spawn(Process*, SpawnFlags);
OPENAXIOM_C_EXPORT const char* oa_concatenate_string(const char*, const char*);
+ // ------------
+ // -- Driver --
+ // ------------
+ // A list of drivers for OpenAxiom.
+ enum Driver {
+ unknown_driver, // unknown driver
+ null_driver, // do nothing
+ config_driver, // print out configuration information
+ sman_driver, // start Superman as master process
+ gui_driver, // start the GUI interface
+ core_driver, // start the core system as master process
+ script_driver, // start the core system in script mode.
+ compiler_driver, // start the core system in compiler mode.
+ execute_driver, // Execute a command.
+ translator_driver, // Start the core system in translator mode.
+ linker_driver // start the core system in linking mode.
+ };
+
+ // -------------
+ // -- Runtime --
+ // -------------
+ // A list of runtime support systems for OpenAxiom.
+ enum Runtime {
+ unknown_runtime,
+ gcl_runtime, // GCL-based runtime
+ sbcl_runtime, // SBCL-based runtime
+ clisp_runtime, // CLISP-based runtime
+ ecl_runtime, // ECL-based runtime
+ clozure_runtime, // Clozure CL-based runtime
+ bemol_runtime, // Bemol-based runtime
+ polyml_runtome // Poly/ML abstract machine-based runtime
+ };
+
+ // ---------------
+ // -- Arguments --
+ // ---------------
+ // Command line arguments.
+ // When non empty, this vector really is of length one more than
+ // what size() reports, as it is always null-terminated, to comply
+ // with POSIX-style operating system requirements.
+ struct Arguments : std::vector<char*> {
+ explicit Arguments(int n = 0);
+ int size() const;
+ void allocate(int);
+ char* const* data() const;
+ };
+
+ // -------------
+ // -- Command --
+ // -------------
+ // A description of external command to be executed.
+ struct Command {
+ Process core; // arguments for actual executable.
+ Arguments rt_args; // arguments to the base RT, if any.
+ const char* root_dir; // path to the OpenAxiom system.
+ const char* exec_path; // path to the program to execute.
+ Command();
+ };
+
+ const char* get_systemdir(int argc, char*[]);
+ const char* make_path_for(const char*, Driver);
+
+ // Return a pointer the string value associated with an option.
+ const char* option_value(const Command*, const char*);
+
+ int execute_core(const Command*, Driver);
+ void build_rts_options(Command*, Driver);
+
+ Driver preprocess_arguments(Command*, int, char**);
+
+ // Return the length of an array literal.
+ template<typename T, int N>
+ inline int length(T(&)[N]) {
+ return N;
+ }
}
#endif /* OPENAXIOM_included */
+
+// Local Variables:
+// mode: c++
+// End: