aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-02-10 04:48:39 +0000
committerdos-reis <gdr@axiomatics.org>2008-02-10 04:48:39 +0000
commit6b365f926f1f0430c34498392e1dddbff126bc48 (patch)
treebdbc548cea2b0968863d9695bbdfc1732b16c3c5
parent06e82157a75ebb6f14dae6a76a9e3a2b883b2c7a (diff)
downloadopen-axiom-6b365f926f1f0430c34498392e1dddbff126bc48.tar.gz
Add support for batch processing.
-rw-r--r--ChangeLog7
-rw-r--r--Makefile.in4
-rw-r--r--Makefile.pamphlet4
-rw-r--r--config/axiom-c-macros.h.in3
-rwxr-xr-xconfigure23
-rw-r--r--configure.ac5
-rw-r--r--configure.ac.pamphlet5
-rw-r--r--src/ChangeLog62
-rw-r--r--src/Makefile.in2
-rw-r--r--src/Makefile.pamphlet2
-rw-r--r--src/driver/Makefile.in15
-rw-r--r--src/driver/main.c163
-rw-r--r--src/driver/utils.c281
-rw-r--r--src/driver/utils.h79
-rw-r--r--src/include/sman.H137
-rw-r--r--src/interp/Makefile.in11
-rw-r--r--src/interp/Makefile.pamphlet18
-rw-r--r--src/interp/bookvol5.pamphlet1544
-rw-r--r--src/interp/debug.lisp2
-rw-r--r--src/interp/diagnostics.boot1
-rw-r--r--src/interp/i-map.boot7
-rw-r--r--src/interp/i-syscmd.boot27
-rw-r--r--src/interp/i-toplev.boot8
-rw-r--r--src/interp/incl.boot15
-rw-r--r--src/interp/msgdb.boot7
-rw-r--r--src/interp/obey.lisp4
-rw-r--r--src/interp/patches.lisp2
-rw-r--r--src/interp/slam.boot3
-rw-r--r--src/interp/spad.lisp1
-rw-r--r--src/interp/sys-driver.boot159
-rw-r--r--src/interp/sys-utility.boot17
-rw-r--r--src/interp/util.lisp16
-rw-r--r--src/interp/vmlisp.lisp6
-rw-r--r--src/sman/Makefile.in7
-rw-r--r--src/sman/sman.c77
35 files changed, 787 insertions, 1837 deletions
diff --git a/ChangeLog b/ChangeLog
index 15a18f8c..82b41a36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ Add support for batch processing.
+ * configure.ac.pamphlet (OPENAXIOM_BASE_RTS): Define.
+ * Makefile.pamphlet (install): Tidy.
+ * config/axiom-c-macros.h.in: New.
+
2008-01-21 Gabriel Dos Reis <gdr@cs.tamu.edu>
* config/var-def.mk (LDF): Include -lm.
diff --git a/Makefile.in b/Makefile.in
index 3a13a37f..2a33363d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -99,9 +99,9 @@ install:
@echo Installing OpenAxiom in $(prefix)
@$(mkinstalldirs) "$(DESTDIR)$(open_axiom_installdir)"
cp -pr "$(builddir)"/$(target)/* "$(DESTDIR)$(open_axiom_installdir)"
- rm -f "$(bindir)"/axiom
+ rm -f "$(bindir)"/open-axiom
@$(mkinstalldirs) "$(bindir)"
- $(INSTALL_PROGRAM) src/driver/axiom$(EXEEXT) "$(bindir)"
+ $(INSTALL_PROGRAM) src/driver/open-axiom$(EXEEXT) "$(bindir)"
@echo OpenAxiom installation finished.
.PHONY: check
diff --git a/Makefile.pamphlet b/Makefile.pamphlet
index 7f55b280..c3a14132 100644
--- a/Makefile.pamphlet
+++ b/Makefile.pamphlet
@@ -565,9 +565,9 @@ install:
@echo Installing OpenAxiom in $(prefix)
@$(mkinstalldirs) "$(DESTDIR)$(open_axiom_installdir)"
cp -pr "$(builddir)"/$(target)/* "$(DESTDIR)$(open_axiom_installdir)"
- rm -f "$(bindir)"/axiom
+ rm -f "$(bindir)"/open-axiom
@$(mkinstalldirs) "$(bindir)"
- $(INSTALL_PROGRAM) src/driver/axiom$(EXEEXT) "$(bindir)"
+ $(INSTALL_PROGRAM) src/driver/open-axiom$(EXEEXT) "$(bindir)"
@echo OpenAxiom installation finished.
@
diff --git a/config/axiom-c-macros.h.in b/config/axiom-c-macros.h.in
index a2ab84a5..df1e525b 100644
--- a/config/axiom-c-macros.h.in
+++ b/config/axiom-c-macros.h.in
@@ -92,6 +92,9 @@
/* MS */
#undef MSYSplatform
+/* The kind of base runtime system for this build. */
+#undef OPENAXIOM_BASE_RTS
+
/* Extension of executable file. */
#undef OPENAXIOM_EXEEXT
diff --git a/configure b/configure
index 0ddec395..ff55faf6 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for OpenAxiom 1.2.0-2008-02-04.
+# Generated by GNU Autoconf 2.60 for OpenAxiom 1.2.0-2008-02-09.
#
# Report bugs to <open-axiom-bugs@lists.sf.net>.
#
@@ -713,8 +713,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='OpenAxiom'
PACKAGE_TARNAME='openaxiom'
-PACKAGE_VERSION='1.2.0-2008-02-04'
-PACKAGE_STRING='OpenAxiom 1.2.0-2008-02-04'
+PACKAGE_VERSION='1.2.0-2008-02-09'
+PACKAGE_STRING='OpenAxiom 1.2.0-2008-02-09'
PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net'
ac_unique_file="src/Makefile.pamphlet"
@@ -1387,7 +1387,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures OpenAxiom 1.2.0-2008-02-04 to adapt to many kinds of systems.
+\`configure' configures OpenAxiom 1.2.0-2008-02-09 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1457,7 +1457,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of OpenAxiom 1.2.0-2008-02-04:";;
+ short | recursive ) echo "Configuration of OpenAxiom 1.2.0-2008-02-09:";;
esac
cat <<\_ACEOF
@@ -1561,7 +1561,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-OpenAxiom configure 1.2.0-2008-02-04
+OpenAxiom configure 1.2.0-2008-02-09
generated by GNU Autoconf 2.60
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1575,7 +1575,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by OpenAxiom $as_me 1.2.0-2008-02-04, which was
+It was created by OpenAxiom $as_me 1.2.0-2008-02-09, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
@@ -20710,6 +20710,11 @@ esac
+cat >>confdefs.h <<_ACEOF
+#define OPENAXIOM_BASE_RTS openaxiom_${axiom_lisp_flavor}_runtime
+_ACEOF
+
+
## The following is a horrible to arrange for GCL to successfully
## rebuild symbol tables with "rsym" on Windows platform. It should
## go away as soon as GCL upstream is fixed.
@@ -25225,7 +25230,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by OpenAxiom $as_me 1.2.0-2008-02-04, which was
+This file was extended by OpenAxiom $as_me 1.2.0-2008-02-09, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -25274,7 +25279,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-OpenAxiom config.status 1.2.0-2008-02-04
+OpenAxiom config.status 1.2.0-2008-02-09
configured by $0, generated by GNU Autoconf 2.60,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 2b210d1b..82fb2bee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
sinclude(config/open-axiom.m4)
sinclude(config/aclocal.m4)
-AC_INIT([OpenAxiom], [1.2.0-2008-02-04],
+AC_INIT([OpenAxiom], [1.2.0-2008-02-09],
[open-axiom-bugs@lists.sf.net])
AC_CONFIG_AUX_DIR(config)
@@ -241,6 +241,9 @@ case $axiom_include_gcl,$axiom_lisp in
esac
AC_SUBST(axiom_include_gcl)
AC_SUBST(axiom_lisp_flavor)
+AC_DEFINE_UNQUOTED([OPENAXIOM_BASE_RTS],
+ [openaxiom_${axiom_lisp_flavor}_runtime],
+ [The kind of base runtime system for this build.])
## The following is a horrible to arrange for GCL to successfully
## rebuild symbol tables with "rsym" on Windows platform. It should
diff --git a/configure.ac.pamphlet b/configure.ac.pamphlet
index 762a42bf..11711408 100644
--- a/configure.ac.pamphlet
+++ b/configure.ac.pamphlet
@@ -872,6 +872,9 @@ case $axiom_include_gcl,$axiom_lisp in
esac
AC_SUBST(axiom_include_gcl)
AC_SUBST(axiom_lisp_flavor)
+AC_DEFINE_UNQUOTED([OPENAXIOM_BASE_RTS],
+ [openaxiom_${axiom_lisp_flavor}_runtime],
+ [The kind of base runtime system for this build.])
## The following is a horrible to arrange for GCL to successfully
## rebuild symbol tables with "rsym" on Windows platform. It should
@@ -1019,7 +1022,7 @@ information:
<<Autoconf init>>=
sinclude(config/open-axiom.m4)
sinclude(config/aclocal.m4)
-AC_INIT([OpenAxiom], [1.2.0-2008-02-04],
+AC_INIT([OpenAxiom], [1.2.0-2008-02-09],
[open-axiom-bugs@lists.sf.net])
@
diff --git a/src/ChangeLog b/src/ChangeLog
index 2e2ba3e9..c718ec7e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,65 @@
+2008-02-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ Add support for batch processing.
+ * sman/sman.c (process_arguments): Now take an argument for
+ openaxiom_command. Don't support '-ws', '-comp', '-grprog',
+ '-clefprog', '-clientprog' anymore.
+ (process_options): Take one more arguments.
+ (main): Excute the Core if in batch mode.
+ * sman/Makefile.in (sman_objects): Add driver/utils.lo.
+ (%.lo): Look up headers in src/driver too.
+ * interp/sys-utility.boot (RECLAIM): Define here.
+ (makeAbsoluteFilename): Likewise.
+ * interp/sys-driver.boot ($openServerIfTrue): Define here.
+ ($SpadServer): Likewise.
+ (AxiomCore::%sysInit): Tidy.
+ (loadExposureGroupData): Define here.
+ (REROOT): Likewise.
+ (initMemoryConfig): Likewise.
+ (RESTART): Likewise.
+ (SPAD-SAVE): Likewise.
+ (SET-RESTART-HOOK): Likewise.
+ (executeSpadScript): New. Install as driver.
+ * interp/obey.lisp (OBEY): Use makeAbsoluteFilename.
+ * interp/patches.lisp (save-system): Likewise.
+ * interp/util.lisp: Likewise.
+ * interp/vmlisp.lisp: Likewise.
+ * interp/msgdb.boot: Have mssage throwers countError.
+ * interp/incl.boot ($inputLineNumber): New.
+ (incClassify): Use it. Recognize the magic number.
+ (incLude1): Ignore line with magic number.
+ * interp/i-toplev.boot (statisticsInitialization): Define here.
+ * interp/i-syscmd.boot ($options): Define.
+ ($historyDirectory): Likewise.
+ ($HiFiAccess): Likewise.
+ (history): Tidy.
+ (initHist): Likewise.
+ (initHistList): Likewise.
+ (historySpad2Cmd): Likewise.
+ (setHistoryCore): Likewise.
+ (restoreHistory): Likewise.
+ ($reportUndo): Define.
+ (diffAlist): Tidy.
+ * interp/diagnostics.boot (BUMPERRORCOUNT): Use countError.
+ * interp/debug.lisp (/D-2): Use makeAbsoluteFilename.
+ * interp/Makefile.pamphlet (OBJS): Remove bookvol5.$(FASLEXT).
+ (makeint.lisp): Don't require bookvol5.$(FASLEXT). Don't load it.
+ (bookvol5.$(FASLEXT)): Remove rule.
+ (bookvol5.pamphlet): Remove.
+ * include/sman.H1: Fold content into sman/sman.c. Remove.
+ * driver/main.c (OPENAXIOM_CORE_EXECUTABLE): Move to utils.c
+ (OPENAXIOM_SMAN_EXECUTABLE): Likewise.
+ (OPENAXIOM_CORE_PATH): Likewise.
+ (OPENAXIOM_SMAN_PATH): Likewise.
+ (get_systemdir): Rename to openaxiom_get_systemdir; move to
+ utils.c.
+ (make_path_for): Rename openaxiom_make_path_for; move to utils.c
+ (main): Simplify.
+ * driver/utils.c: New.
+ * driver/utils.h: Likewise.
+ * driver/Makefile.in: Rename axiom to open-axiom.
+ * Makefile.pamphlet (all-sman): Now require all-driver.
+
2008-02-04 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/Makefile.pamphlet (OBJS): Include sys-utility.$(FASLEXT).
diff --git a/src/Makefile.in b/src/Makefile.in
index 4ba18c17..51061c49 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -22,7 +22,7 @@ all-driver:
all-clef: all-lib
@$(mkinstalldirs) $(axiom_target_bindir)
cd clef && ${MAKE}
-all-sman: all-lib
+all-sman: all-lib all-driver
$(mkinstalldirs) $(axiom_target_bindir)
$(mkinstalldirs) $(axiom_target_libdir)
cd sman && ${MAKE}
diff --git a/src/Makefile.pamphlet b/src/Makefile.pamphlet
index f2f86358..2e6240a3 100644
--- a/src/Makefile.pamphlet
+++ b/src/Makefile.pamphlet
@@ -65,7 +65,7 @@ all-clef: all-lib
Superman (\Tool{sman}) is the master process that runs all of the other
processes including \Tool{axiom}, \Tool{clef}, nagman, graphics, and hyperdoc
<<smandir>>=
-all-sman: all-lib
+all-sman: all-lib all-driver
$(mkinstalldirs) $(axiom_target_bindir)
$(mkinstalldirs) $(axiom_target_libdir)
cd sman && ${MAKE}
diff --git a/src/driver/Makefile.in b/src/driver/Makefile.in
index 0a1ba801..f64cfab0 100644
--- a/src/driver/Makefile.in
+++ b/src/driver/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, Gabriel Dos Reis.
+# Copyright (C) 2007-2008, Gabriel Dos Reis.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -30,11 +30,11 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-bin_PROGRAMS = axiom$(EXEEXT)
+bin_PROGRAMS = open-axiom$(EXEEXT)
-axiom_SOURCES = main.c
+open_axiom_SOURCES = main.c utils.c
-axiom_objects = $(axiom_SOURCES:.c=.lo)
+open_axiom_objects = $(open_axiom_SOURCES:.c=.lo)
.PHONY: all all-ax all-driver
@@ -55,8 +55,11 @@ stamp: $(bin_PROGRAMS)
-DOPENAXIOM_ROOT_DIRECTORY="\"$(open_axiom_installdir)\"" \
$(axiom_includes) $<
-axiom$(EXEEXT): $(axiom_objects)
- $(LINK) -o $@ $<
+utils.lo: utils.h
+main.lo: utils.h
+
+open-axiom$(EXEEXT): $(open_axiom_objects)
+ $(LINK) -o $@ $(open_axiom_objects)
mostlyclean-local:
@rm -f $(axiom_objects)
diff --git a/src/driver/main.c b/src/driver/main.c
index 313f9115..82e51384 100644
--- a/src/driver/main.c
+++ b/src/driver/main.c
@@ -37,57 +37,11 @@
as the seesion manager. */
-#include "axiom-c-macros.h"
+#include "utils.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef __WIN32__
-# include <windows.h>
-#endif
-
-/* The basename of the file holding the OpenAxiom core executable. */
-#define OPENAXIOM_CORE_EXECUTABLE \
- "AXIOMsys" OPENAXIOM_EXEEXT
-
-/* The basename of the file holding the session manager executable. */
-#define OPENAXIOM_SMAN_EXECUTABLE \
- "sman" OPENAXIOM_EXEEXT
-
-/* Path to the OpenAxiom executable core, relative to
- OPENAXIOM_ROOT_DIRECTORY, or to the system root directory as specified
- on command line. */
-#define OPENAXIOM_CORE_PATH \
- "/bin/" OPENAXIOM_CORE_EXECUTABLE
-
-/* Path to the session manager, relative to OPENAXIOM_ROOT_DIRECTORY,
- or to the system root directory as specified on command line. */
-#define OPENAXIOM_SMAN_PATH \
- "/bin/" OPENAXIOM_SMAN_EXECUTABLE
-
-/* Return a path to the running system, either as specified on command
- line through --system=, or as specified at configuration time. */
-static const char*
-get_systemdir(int argc, char* argv[])
-{
- int i;
-
- /* Root directory specified on command line takes precedence
- over location specified at configuration time. */
- for (i = 1; i < argc; ++i)
- if (strcmp("--", argv[i]) == 0)
- break;
- else if (strncmp("--system=", argv[i], sizeof("--system=") - 1) == 0) {
- return argv[i] + sizeof ("--system=") - 1;
- }
-
- /* Command line did not change the system location to use.
- Return what was computed at configuration time. */
- return OPENAXIOM_ROOT_DIRECTORY;
-}
#define OPENAXIOM_GLOBAL_ENV "AXIOM"
@@ -114,106 +68,33 @@ publish_systemdir(const char* dir)
}
-/* Return a path for PROG specified as a relative path to PREFIX. */
-static const char*
-make_path_for(const char* prefix, const char* prog)
-{
- const int prefix_length = strlen(prefix);
- char* execpath = (char*) malloc(prefix_length + strlen(prog) + 1);
- strcpy(execpath, prefix);
- strcpy(execpath + prefix_length, prog);
- return execpath;
-}
-
-
int
main(int argc, char* argv[])
{
- const char* root_dir = get_systemdir(argc, argv);
- const char* execpath =
- make_path_for(root_dir,
- OPENAXIOM_USE_SMAN ?
- OPENAXIOM_SMAN_PATH : OPENAXIOM_CORE_PATH);
-#ifdef __WIN32__
- char* command_line;
- int cur = strlen(argv[0]);
- int command_line_length = 0;
- int i;
- PROCESS_INFORMATION procInfo;
- STARTUPINFO startupInfo = { 0 };
- DWORD status; /* Exit code for this program masqueraded as
- the child created below. */
-
- command_line_length += cur;
- for (i = 1; i < argc; ++i)
- command_line_length += 1 /* blank char as separator */
- + strlen(argv[i]); /* room for each argument */
-
- /* Don't forget room for the doubledash string. */
- command_line_length += sizeof("--") - 1;
-
- command_line = (char*) malloc(command_line_length + 1);
-
- strcpy(command_line, argv[0]);
- command_line[cur++] = ' ';
-
- /* Now start arguments to the core executable. */
- command_line[cur++] = '-';
- command_line[cur++] = '-';
-
- /* Concatenate the arguments into a single string. */
- for (i = 1; i < argc; ++i) {
- const int arg_length = strlen(argv[i]);
- command_line[cur++] = ' ';
- /* Note that strcpy will terminate `command_line' with a NUL
- character, and since the next iteration will write the
- blank precisely where the NUL character is, the whole command
- line string will be a proper C-style string when the loop
- normally exits. */
- strcpy(command_line + cur, argv[i]);
- cur += arg_length;
- }
-
- publish_systemdir(root_dir);
- if(CreateProcess(/* lpApplicationName */ execpath,
- /* lpCommandLine */ command_line,
- /* lpProcessAttributes */ NULL,
- /* lpThreadAttributes */ NULL,
- /* bInheritHandles */ TRUE,
- /* dwCreationFlags */ 0,
- /* lpEnvironment */ NULL,
- /* lpCurrentDirectory */ NULL,
- /* lpstartupInfo */ &startupInfo,
- /* lpProcessInformation */ &procInfo) == 0) {
- fprintf(stderr, GetLastError());
+ openaxiom_command command = { };
+ openaxiom_driver driver =
+ openaxiom_preprocess_arguments(&command, argc, argv);
+
+ switch (driver) {
+ case openaxiom_core_driver:
+ case openaxiom_script_driver:
+ case openaxiom_compiler_driver:
+ return openaxiom_execute_core(&command, driver);
+
+ case openaxiom_sman_driver:
+ break;
+
+ default:
abort();
}
- WaitForSingleObject(procInfo.hProcess, INFINITE);
- GetExitCodeProcess(procInfo.hProcess, &status);
- CloseHandle(procInfo.hThread);
- CloseHandle(procInfo.hProcess);
- return status;
-
+
+#ifdef __WIN32__
+ /* Should not happen on MS platforms. */
+ abort();
#else /* __WIN32__ */
- int i;
- char** args = (char**) malloc(sizeof (char*) * (argc + 2));
- publish_systemdir(root_dir);
-
- /* Pretend that we are still running the OpenAxiom driver, even if
- it is actually the session manager or the core executable running.
- We don't want to expose implementation details to users. */
- args[0] = argv[0];
- /* If we are running the core executable, we need to insert a
- doubledash to indicate beginning of arguments. The session manager
- does not need that temporary necessary obfuscation, and will
- be confused. */
- if (!OPENAXIOM_USE_SMAN)
- args[1] = "--";
- for (i = 1; i < argc; ++i)
- args[i + !OPENAXIOM_USE_SMAN] = argv[i];
- args[argc + !OPENAXIOM_USE_SMAN] = NULL;
-
- execv(execpath, args);
+ publish_systemdir(command.root_dir);
+ execv(openaxiom_make_path_for(command.root_dir, openaxiom_sman_driver),
+ argv);
perror(strerror(errno));
return -1;
#endif /* __WIN32__ */
diff --git a/src/driver/utils.c b/src/driver/utils.c
new file mode 100644
index 00000000..04148015
--- /dev/null
+++ b/src/driver/utils.c
@@ -0,0 +1,281 @@
+/*
+ Copyright (C) 2008, Gabriel Dos Reis.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of The Numerical ALgorithms Group Ltd. nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "axiom-c-macros.h"
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "utils.h"
+#include <stdio.h>
+
+/* The basename of the file holding the OpenAxiom core executable. */
+#define OPENAXIOM_CORE_EXECUTABLE \
+ "AXIOMsys" OPENAXIOM_EXEEXT
+
+/* The basename of the file holding the session manager executable. */
+#define OPENAXIOM_SMAN_EXECUTABLE \
+ "sman" OPENAXIOM_EXEEXT
+
+/* Path to the OpenAxiom executable core, relative to
+ OPENAXIOM_ROOT_DIRECTORY, or to the system root directory as specified
+ on command line. */
+#define OPENAXIOM_CORE_PATH \
+ "/bin/" OPENAXIOM_CORE_EXECUTABLE
+
+/* Path to the session manager, relative to OPENAXIOM_ROOT_DIRECTORY,
+ or to the system root directory as specified on command line. */
+#define OPENAXIOM_SMAN_PATH \
+ "/bin/" OPENAXIOM_SMAN_EXECUTABLE
+
+/* Name of the entry point for Lisp-based OpenAxiom. */
+#define OPENAXIOM_LISP_CORE_ENTRY_POINT \
+ "|AxiomCore|::|topLevel|"
+
+
+/* Return a path to the running system, either as specified on command
+ line through --system=, or as specified at configuration time. */
+const char*
+openaxiom_get_systemdir(int argc, char* argv[])
+{
+ int i;
+
+ /* Root directory specified on command line takes precedence
+ over location specified at configuration time. */
+ for (i = 1; i < argc; ++i)
+ if (strcmp("--", argv[i]) == 0)
+ break;
+ else if (strncmp("--system=", argv[i], sizeof("--system=") - 1) == 0) {
+ return argv[i] + sizeof ("--system=") - 1;
+ }
+
+ /* Command line did not change the system location to use.
+ Return what was computed at configuration time. */
+ return OPENAXIOM_ROOT_DIRECTORY;
+}
+
+/* Return the path to `driver'. */
+static const char*
+get_driver_name(openaxiom_driver driver)
+{
+ switch (driver) {
+ case openaxiom_sman_driver:
+ return OPENAXIOM_SMAN_PATH;
+
+ case openaxiom_script_driver:
+ case openaxiom_compiler_driver:
+ case openaxiom_core_driver:
+ return OPENAXIOM_CORE_PATH;
+
+ default:
+ abort();
+ }
+}
+
+
+/* Return a path for PROG specified as a relative path to PREFIX. */
+const char*
+openaxiom_make_path_for(const char* prefix, openaxiom_driver driver)
+{
+ const int prefix_length = strlen(prefix);
+ const char* prog = get_driver_name(driver);
+ char* execpath = (char*) malloc(prefix_length + strlen(prog) + 1);
+ strcpy(execpath, prefix);
+ strcpy(execpath + prefix_length, prog);
+ return execpath;
+}
+
+/* Build arguments, if any, to be supplied to the runtime system
+ of `driver'. */
+void
+openaxiom_build_rts_options(openaxiom_command* command,
+ openaxiom_driver driver)
+{
+ switch (driver) {
+ case openaxiom_sman_driver:
+ case openaxiom_unknown_driver:
+ break;
+
+ case openaxiom_core_driver:
+ break;
+
+ case openaxiom_compiler_driver:
+ 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*));
+ command->rt_argv[0] = "-batch";
+ command->rt_argv[1] = "-eval";
+ command->rt_argv[2] = "(" OPENAXIOM_LISP_CORE_ENTRY_POINT ")";
+ break;
+
+ default:
+ abort();
+ }
+ break;
+
+ default:
+ abort();
+ }
+}
+
+#ifdef __WIN32__
+# define OPENAXIOM_DEFAULT_DRIVER openaxiom_core_driver
+#elif OPENAXIOM_USE_SMAN
+# define OPENAXIOM_DEFAULT_DRIVER openaxiom_sman_driver
+#else
+# define OPENAXIOM_DEFAULT_DRIVER openaxiom_unknown_driver
+#endif
+
+
+/* Determine driver to be used for executing `command'. */
+openaxiom_driver
+openaxiom_preprocess_arguments(openaxiom_command* command,
+ int argc, char** argv)
+{
+ int i;
+ openaxiom_driver driver = OPENAXIOM_DEFAULT_DRIVER;
+
+ command->core_argc = argc;
+ command->core_argv = argv;
+ command->root_dir = openaxiom_get_systemdir(argc, argv);
+ for (i = 1; i < argc; ++i)
+ if (strcmp(argv[i], "--script") == 0)
+ driver = openaxiom_script_driver;
+ else if(strcmp(argv[i], "--compile") == 0)
+ driver = openaxiom_compiler_driver;
+
+ openaxiom_build_rts_options(command, driver);
+ return driver;
+}
+
+
+
+
+/* Execute the Core Executable as described by `command'. On
+ POSIX systems, this is a non-return function on success.
+ See execv(). */
+int
+openaxiom_execute_core(const openaxiom_command* command,
+ openaxiom_driver driver)
+{
+ const char* execpath =
+ openaxiom_make_path_for(command->root_dir, driver);
+#ifdef __WIN32__
+ char* command_line;
+ int cur = strlen(command->core_argv[0]);
+ int command_line_length = 0;
+ int i;
+ PROCESS_INFORMATION procInfo;
+ STARTUPINFO startupInfo = { 0 };
+ DWORD status; /* Exit code for this program masqueraded as
+ the child created below. */
+
+ /* How long is the final command line for the MS system? */
+ command_line_length += cur;
+ for (i = 0; i < comand->rt_argc; ++i)
+ command_line_length += 1 /* blank char as separator */
+ + strlen(command->rt_argv[i]); /* room for each argument */
+ /* Don't forget room for the doubledash string. */
+ command_line_length += sizeof("--") - 1;
+ /* And arguments to the actual command. */
+ for (i = 1; i < comand->core_argc; ++i)
+ command_line_length += 1 + strlen(command->core_argv[i]);
+
+ /* Now, build the actual command line. This is done by
+ concatenating the arguments into a single string. */
+ command_line = (char*) malloc(command_line_length + 1);
+ strcpy(command_line, command->core_argv[0]);
+ command_line[cur++] = ' ';
+ for (i = 0; i < command->rt_argc; ++i) {
+ const int arg_length = strlen(command->rt_argv[i]);
+ command_line[cur++] = ' ';
+ /* Note that strcpy will terminate `command_line' with a NUL
+ character, and since the next iteration will write the
+ blank precisely where the NUL character is, the whole command
+ line string will be a proper C-style string when the loop
+ normally exits. */
+ strcpy(command_line + cur, command->rt_argv[i]);
+ cur += arg_length;
+ }
+ command_line[cur++] = '-'; /* start arguments to the core executable. */
+ command_line[cur++] = '-';
+ for (i = 1; i < command->core_argc; ++i) {
+ const int arg_length = strlen(command->core_argv[i]);
+ command_line[cur++] = ' ';
+ strcpy(command_line + cur, command->core_argv[i]);
+ cur += arg_length;
+ }
+
+ if(CreateProcess(/* lpApplicationName */ execpath,
+ /* lpCommandLine */ command_line,
+ /* lpProcessAttributes */ NULL,
+ /* lpThreadAttributes */ NULL,
+ /* bInheritHandles */ TRUE,
+ /* dwCreationFlags */ 0,
+ /* lpEnvironment */ NULL,
+ /* lpCurrentDirectory */ NULL,
+ /* lpstartupInfo */ &startupInfo,
+ /* lpProcessInformation */ &procInfo) == 0) {
+ fprintf(stderr, GetLastError());
+ abort();
+ }
+ WaitForSingleObject(procInfo.hProcess, INFINITE);
+ GetExitCodeProcess(procInfo.hProcess, &status);
+ CloseHandle(procInfo.hThread);
+ CloseHandle(procInfo.hProcess);
+ return status;
+
+#else /* __WIN32__ */
+ int i;
+ char** args = (char**)
+ malloc(sizeof (char*) * (command->rt_argc + command->core_argc + 2));
+ args[0] = command->core_argv[0];
+ for (i = 0; i < command->rt_argc; ++i)
+ args[i + 1] = command->rt_argv[i];
+ if (command->core_argc > 1) {
+ /* Insert a doubledash to indicate beginning of arguments. */
+ args[command->rt_argc + 1] = "--";
+ for (i = 1; i < command->core_argc; ++i)
+ args[command->rt_argc + i + 1] = command->core_argv[i];
+ args[command->rt_argc + command->core_argc + 1] = NULL;
+ }
+ else
+ args[command->rt_argc + command->core_argc] = NULL;
+
+ execv(execpath, args);
+ perror(strerror(errno));
+ return -1;
+#endif /* __WIN32__ */
+}
diff --git a/src/driver/utils.h b/src/driver/utils.h
new file mode 100644
index 00000000..41d7c345
--- /dev/null
+++ b/src/driver/utils.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (C) 2008, Gabriel Dos Reis.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of The Numerical ALgorithms Group Ltd. nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef OPENAXIOM_UTILS_INCLUDED
+#define OPENAXIOM_UTILS_INCLUDED
+
+#include "axiom-c-macros.h"
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef __WIN32__
+# include <windows.h>
+#endif
+
+/* A list of drivers for OpenAxiom. */
+typedef enum openaxiom_driver {
+ openaxiom_unknown_driver,
+ openaxiom_sman_driver,
+ openaxiom_core_driver,
+ openaxiom_script_driver,
+ openaxiom_compiler_driver
+} openaxiom_driver;
+
+/* A list of runtime support systems for OpenAxiom. */
+typedef enum openaxiom_runtime {
+ openaxiom_unknown_runtime,
+ openaxiom_gcl_runtime,
+ openaxiom_sbcl_runtime,
+ openaxiom_clisp_runtime,
+ openaxiom_ecl_runtime,
+ openaxiom_bemol_runtime
+} openaxiom_runtime;
+
+/* A description of external command to be executed. */
+typedef struct openaxiom_command {
+ char** core_argv; /* arguments for the actual executable. */
+ int core_argc; /* number of such arguments. */
+ 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);
+
+int openaxiom_execute_core(const openaxiom_command*, openaxiom_driver);
+void openaxiom_build_rts_options(openaxiom_command*, openaxiom_driver);
+
+#endif /* OPENAXIOM_UTILS_INCLUDED */
diff --git a/src/include/sman.H1 b/src/include/sman.H1
deleted file mode 100644
index 96452899..00000000
--- a/src/include/sman.H1
+++ /dev/null
@@ -1,37 +0,0 @@
-extern int main(int argc , char * argv[] , char * envp[]);
-#ifdef _SMAN_C
-static void process_arguments(int argc , char * * argv);
-static int should_I_clef(void);
-static int in_X(void);
-static void set_up_defaults(void);
-static void process_options(int argc , char * * argv);
-static void death_handler(int sig);
-static void nagman_handler(int sig);
-static void sman_catch_signals(void);
-static void fix_env(char * * envp , int spadnum);
-static void init_term_io(void);
-static char * strPrefix(char * prefix , char * s);
-static void check_spad_proc(char * file , char * prefix);
-static void clean_up_old_sockets(void);
-static SpadProcess * fork_you(int death_action);
-static void exec_command_env(char * command , char * * env);
-static SpadProcess * spawn_of_hell(char * command , int death_action);
-static void start_the_spadclient(void);
-static void start_the_local_spadclient(void);
-static void start_the_nagman(void);
-static void start_the_session_manager(void);
-static void start_the_hypertex(void);
-static void start_the_graphics(void);
-static void fork_Axiom(void);
-static void start_the_Axiom(char * * envp);
-static void clean_up_sockets(void);
-static void clean_hypertex_socket(void);
-static void read_from_spad_io(int ptcNum);
-static void read_from_manager(int ptcNum);
-static void manage_spad_io(int ptcNum);
-static void init_spad_process_list(void);
-static SpadProcess * find_child(int proc_id);
-static void kill_all_children(void);
-static void clean_up_terminal(void);
-static void monitor_children(void);
-#endif
diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in
index 2f372312..1ccb76b5 100644
--- a/src/interp/Makefile.in
+++ b/src/interp/Makefile.in
@@ -41,7 +41,7 @@ OBJS= vmlisp.$(FASLEXT) hash.$(FASLEXT) \
i-object.$(FASLEXT) \
i-code.$(FASLEXT) i-coerce.$(FASLEXT) \
i-coerfn.$(FASLEXT) i-eval.$(FASLEXT) \
- i-funsel.$(FASLEXT) bookvol5.$(FASLEXT) \
+ i-funsel.$(FASLEXT) \
i-intern.$(FASLEXT) i-map.$(FASLEXT) \
i-output.$(FASLEXT) i-resolv.$(FASLEXT) \
i-spec1.$(FASLEXT) \
@@ -192,7 +192,7 @@ clean-local: mostlyclean-local
distclean-local: clean-local
-makeint.lisp: ${OBJS} bookvol5.$(FASLEXT) util.$(FASLEXT) \
+makeint.lisp: ${OBJS} util.$(FASLEXT) \
nocompil.$(FASLEXT) \
sys-driver.$(FASLEXT) \
${OUTINTERP} obey.$(FASLEXT) \
@@ -212,7 +212,6 @@ makeint.lisp: ${OBJS} bookvol5.$(FASLEXT) util.$(FASLEXT) \
@ echo '(|importModule| "hash")' >> makeint.lisp
@ echo '(gbc t)' >> makeint.lisp
@ echo '(|importModule| "nocompil")' >> makeint.lisp
- @ echo '(|importModule| "bookvol5")' >> makeint.lisp
@ echo '(|importModule| "util")' >> makeint.lisp
@ echo '(in-package "BOOT")' >> makeint.lisp
@ touch ${TIMESTAMP}
@@ -719,9 +718,6 @@ nocompil.$(FASLEXT): nocompil.lisp boot-pkg.$(FASLEXT)
util.$(FASLEXT): util.lisp parsing.$(FASLEXT)
$(BOOTSYS) -- --compile --output=$@ --load-directory=. $<
-bookvol5.$(FASLEXT): bookvol5.lisp boot-pkg.$(FASLEXT)
- $(BOOTSYS) -- --compile --output=$@ --load-directory=. $<
-
fname.$(FASLEXT): fname.lisp macros.$(FASLEXT)
$(BOOTSYS) -- --compile --output=$@ --load-directory=. $<
@@ -767,9 +763,6 @@ vmlisp.$(FASLEXT): vmlisp.lisp boot-pkg.$(FASLEXT)
boot-pkg.$(FASLEXT): boot-pkg.lisp
$(BOOTSYS) -- --compile --output=$@ $<
-bookvol5.lisp: $(srcdir)/bookvol5.pamphlet
- @ echo 298 making $@ from $<
- $(axiom_build_document) --tangle=Interpreter --output=$@ $<
../algebra/warm.data: $(srcdir)/Makefile.pamphlet
@ echo 2 building warm.data
$(axiom_build_document) --tangle=warm.data --output=$@ $<
diff --git a/src/interp/Makefile.pamphlet b/src/interp/Makefile.pamphlet
index e4385f67..23192b9c 100644
--- a/src/interp/Makefile.pamphlet
+++ b/src/interp/Makefile.pamphlet
@@ -132,7 +132,7 @@ OBJS= vmlisp.$(FASLEXT) hash.$(FASLEXT) \
i-object.$(FASLEXT) \
i-code.$(FASLEXT) i-coerce.$(FASLEXT) \
i-coerfn.$(FASLEXT) i-eval.$(FASLEXT) \
- i-funsel.$(FASLEXT) bookvol5.$(FASLEXT) \
+ i-funsel.$(FASLEXT) \
i-intern.$(FASLEXT) i-map.$(FASLEXT) \
i-output.$(FASLEXT) i-resolv.$(FASLEXT) \
i-spec1.$(FASLEXT) \
@@ -409,7 +409,7 @@ should not be set here just because we happen to save an GCL-based image.
Doing otherwise causes havoc.
<<savesys>>=
-makeint.lisp: ${OBJS} bookvol5.$(FASLEXT) util.$(FASLEXT) \
+makeint.lisp: ${OBJS} util.$(FASLEXT) \
nocompil.$(FASLEXT) \
sys-driver.$(FASLEXT) \
${OUTINTERP} obey.$(FASLEXT) \
@@ -429,7 +429,6 @@ makeint.lisp: ${OBJS} bookvol5.$(FASLEXT) util.$(FASLEXT) \
@ echo '(|importModule| "hash")' >> makeint.lisp
@ echo '(gbc t)' >> makeint.lisp
@ echo '(|importModule| "nocompil")' >> makeint.lisp
- @ echo '(|importModule| "bookvol5")' >> makeint.lisp
@ echo '(|importModule| "util")' >> makeint.lisp
@ echo '(in-package "BOOT")' >> makeint.lisp
@ touch ${TIMESTAMP}
@@ -483,15 +482,6 @@ $(axiom_build_texdir)/diagrams.tex: $(axiom_src_docdir)/diagrams.tex
$(INSTALL_DATA) $< $@
@
-\subsection{bookvol5.lsp}
-
-
-<<bookvol5.lisp>>=
-bookvol5.lisp: $(srcdir)/bookvol5.pamphlet
- @ echo 298 making $@ from $<
- $(axiom_build_document) --tangle=Interpreter --output=$@ $<
-@
-
\section{The databases}
\begin{verbatim}
@@ -1042,9 +1032,6 @@ nocompil.$(FASLEXT): nocompil.lisp boot-pkg.$(FASLEXT)
util.$(FASLEXT): util.lisp parsing.$(FASLEXT)
$(BOOTSYS) -- --compile --output=$@ --load-directory=. $<
-bookvol5.$(FASLEXT): bookvol5.lisp boot-pkg.$(FASLEXT)
- $(BOOTSYS) -- --compile --output=$@ --load-directory=. $<
-
fname.$(FASLEXT): fname.lisp macros.$(FASLEXT)
$(BOOTSYS) -- --compile --output=$@ --load-directory=. $<
@@ -1090,7 +1077,6 @@ vmlisp.$(FASLEXT): vmlisp.lisp boot-pkg.$(FASLEXT)
boot-pkg.$(FASLEXT): boot-pkg.lisp
$(BOOTSYS) -- --compile --output=$@ $<
-<<bookvol5.lisp>>
<<warm.data.stanza>>
buildom.$(FASLEXT): buildom.boot sys-macros.$(FASLEXT)
diff --git a/src/interp/bookvol5.pamphlet b/src/interp/bookvol5.pamphlet
deleted file mode 100644
index 6c7e2898..00000000
--- a/src/interp/bookvol5.pamphlet
+++ /dev/null
@@ -1,1544 +0,0 @@
-%% Oh Emacs, this is a -*- Lisp -*- file despite apperance.
-\documentclass{book}
-\usepackage{axiom}
-\usepackage{graphicx}
-% struggle with latex figure-floating behavior
-\renewcommand\floatpagefraction{.9}
-\renewcommand\topfraction{.9}
-\renewcommand\bottomfraction{.9}
-\renewcommand\textfraction{.1}
-\setcounter{totalnumber}{50}
-\setcounter{topnumber}{50}
-\setcounter{bottomnumber}{50}
-
-\begin{document}
-\begin{titlepage}
-\center{\includegraphics{ps/axiomFront.ps}}
-\vskip 0.1in
-\includegraphics{ps/bluebayou.ps}\\
-\vskip 0.1in
-{\Huge{The 30 Year Horizon}}
-\vskip 0.1in
-$$
-\begin{array}{lll}
-Manuel\ Bronstein & William\ Burge & Timothy\ Daly \\
-James\ Davenport & Michael\ Dewar & Martin\ Dunstan \\
-Albrecht\ Fortenbacher & Patrizia\ Gianni & Johannes\ Grabmeier \\
-Jocelyn\ Guidry & Richard\ Jenks & Larry\ Lambe \\
-Michael\ Monagan & Scott\ Morrison & William\ Sit \\
-Jonathan\ Steinbach & Robert\ Sutor & Barry\ Trager \\
-Stephen\ Watt & Jim\ Wen & Clifton\ Williamson
-\end{array}
-$$
-\center{\large{VOLUME 5: THE AXIOM INTERPRETER}}
-\end{titlepage}
-\pagenumbering{roman}
-\begin{verbatim}
-The Blue Bayou image Copyright (c) 2004 Jocelyn Guidry
-
-Portions Copyright (c) 2004 Martin Dunstan
-
-Portions Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
-All rights reserved.
-
-This book and the Axiom software is licensed as follows:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of The Numerical ALgorithms Group Ltd. nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-\end{verbatim}
-\tableofcontents
-\vfill
-\eject
-\setlength{\parindent}{0em}
-\setlength{\parskip}{1ex}
-{\Large{\bf New Foreword}}
-\vskip .25in
-
-On October 1, 2001 Axiom was withdrawn from the market and ended
-life as a commercial product.
-On September 3, 2002 Axiom was released under the Modified BSD
-license, including this document.
-On August 27, 2003 Axiom was released as free and open source
-software available for download from the Free Software Foundation's
-website, Savannah.
-
-Work on Axiom has had the generous support of the Center for
-Algorithms and Interactive Scientific Computation (CAISS) at
-City College of New York. Special thanks go to Dr. Gilbert
-Baumslag for his support of the long term goal.
-
-The online version of this documentation is roughly 1000 pages.
-In order to make printed versions we've broken it up into three
-volumes. The first volume is tutorial in nature. The second volume
-is for programmers. The third volume is reference material. We've
-also added a fourth volume for developers. All of these changes
-represent an experiment in print-on-demand delivery of documentation.
-Time will tell whether the experiment succeeded.
-
-Axiom has been in existence for over thirty years. It is estimated to
-contain about three hundred man-years of research and has, as of
-September 3, 2003, 143 people listed in the credits. All of these
-people have contributed directly or indirectly to making Axiom
-available. Axiom is being passed to the next generation. I'm looking
-forward to future milestones.
-
-With that in mind I've introduced the theme of the ``30 year horizon''.
-We must invent the tools that support the Computational Mathematician
-working 30 years from now. How will research be done when every bit of
-mathematical knowledge is online and instantly available? What happens
-when we scale Axiom by a factor of 100, giving us 1.1 million domains?
-How can we integrate theory with code? How will we integrate theorems
-and proofs of the mathematics with space-time complexity proofs and
-running code? What visualization tools are needed? How do we support
-the conceptual structures and semantics of mathematics in effective
-ways? How do we support results from the sciences? How do we teach
-the next generation to be effective Computational Mathematicians?
-
-The ``30 year horizon'' is much nearer than it appears.
-
-\vskip .25in
-%\noindent
-Tim Daly\\
-CAISS, City College of New York\\
-November 10, 2003 ((iHy))
-\vfill
-\eject
-\pagenumbering{arabic}
-\setcounter{chapter}{0} % Chapter 1
-\chapter{The Interpreter}
-\section{Star Global Variables}
-\begin{tabular}{lll}
-NAME & SET & USE \\
-*eof* & ncTopLevel & \\
-*features* & & restart \\
-*package* & & restart \\
-*standard-input* & & ncIntLoop \\
-*standard-output* & & ncIntLoop \\
-*top-level-hook* & set-restart-hook & \\
-\end{tabular}
-
-\subsection{*eof*}
-The [[*eof*]] variable is set to [[NIL]] in [[ncTopLevel]].
-\subsection{*features*}
-The [[*features*]] variable from common lisp is tested for the presence
-of the [[:unix]] keyword. Apparently this controls the use of Saturn,
-a previous Axiom frontend. The Saturn frontend was never released as
-open source and so this test and the associated variables are probably
-not used.
-
-\subsection{*package*}
-The [[*package*]] variable, from common lisp, is set in [[restart]]
-to the [[BOOT]] package where the intepreter lives.
-\subsection{*standard-input*}
-The [[*standard-input*]] common lisp variable is used to set the
-[[curinstream]] variable in [[ncIntLoop]].
-
-This variable is an argument to [[serverReadLine]] in
-the [[intloopReadConsole]] function.
-
-\subsection{*standard-output*}
-The [[*standard-output*]] common lisp variable is used to set the
-[[curoutstream]] variable in [[ncIntLoop]].
-
-\subsection{*top-level-hook*}
-The [[*top-level-hook*]] common lisp variable contains the name of
-a function to invoke when an image is started. In our case it is
-called [[restart]]. This is the entry point to the Axiom interpreter.
-
-\section{Dollar Global Variables}
-\begin{tabular}{lll}
-NAME & SET & USE \\
-\$boot & ncTopLevel & \\
-coerceFailure & & runspad \\
-curinstream & ncIntLoop & \\
-curoutstream & ncIntLoop & \\
-\$current-directory & restart & \\
- & reroot & \\
-\$currentLine & restart & removeUndoLines \\
-\$dalymode & & intloopReadConsole \\
-\$defaultMsgDatabaseName & reroot & \\
-\$directory-list & reroot & \\
-\$displayStartMsgs & & restart \\
-\$e & ncTopLevel & \\
-\$erMsgToss & SpadInterpretStream & \\
-\$fn & SpadInterpretStream & \\
-\$frameRecord & initvars & \\
- & clearFrame & \\
- & undoSteps & undoSteps \\
- & recordFrame & recordFrame \\
-\$HiFiAccess & initHist & historySpad2Cmd \\
- & historySpad2Cmd & \\
- & & setHistoryCore \\
-\$HistList & initHist & \\
-\$HistListAct & initHist & \\
-\$HistListLen & initHistList & \\
-\$HistRecord & initHistList & \\
-\$historyDirectory & & makeHistFileName \\
- & & makeHistFileName \\
-\$historyFileType & initvars & histInputFileName \\
-\$inclAssertions & SpadInterpretStream & \\
-\$inLispVM & spad & \\
-\$InteractiveFrame & restart & ncTopLevel \\
- & undo & recordFrame \\
- & undoSteps & undoSteps \\
- & & reportUndo \\
-\$InteractiveMode & ncTopLevel & \\
-\$internalHistoryTable & initvars & \\
-\$interpreterFrameName & initializeInterpreterFrameRing & \\
-\$interpreterFrameRing & initializeInterpreterFrameRing & \\
-\$InitialModemapFrame & & makeInitialModemapFrame \\
-\$intRestart & & intloop \\
-\$intTopLevel & intloop & \\
-\$IOindex & restart & historySpad2Cmd \\
- & removeUndoLines & undoCount \\
-\$lastPos & SpadInterpretStream & \\
-\$libQuiet & SpadInterpretStream & \\
-\$library-directory-list & reroot & \\
-\$msgDatabaseName & reroot * \\
-\$ncMsgList & SpadInterpretStream & \\
-\$newcompErrorCount & SpadInterpretStream & \\
-\$newspad & ncTopLevel & \\
-\$nopos & & SpadInterpretStream \\
-\$okToExecuteMachineCode & SpadInterpretStream & \\
-\$oldHistoryFileName & initvars & oldHistFileName \\
-\$openServerIfTrue & restart & restart \\
- & spad-save & \\
- & initvars & \\
-\$options & & history \\
- & historySpad2Cmd & historySpad2Cmd \\
- & & undo \\
-\$previousBindings & initvars & \\
- & clearFrame & \\
- & recordFrame & recordFrame \\
-\$printLoadMsgs & restart & \\
-\$PrintCompilerMessageIfTrue & spad & \\
-\$promptMsg & SpadInterpretStream & \\
-\$relative-directory-list & & reroot \\
-\$relative-library-directory-list & & reroot \\
-\$reportUndo & initvars & diffAlist \\
-\$shoeReadLineFunction & SpadInterpretStream & \\
-\$spad & ncTopLevel & \\
-\$SpadServer & restart & \\
-\$SpadServerName & initvars & restart \\
-\$systemCommandFunction & SpadInterpretStream & \\
-top\_level & & runspad \\
-\$quitTag & & runspad \\
-\$useInternalHistoryTable & initvars & initHist \\
- & setHistoryCore & setHistoryCore \\
-\$undoFlag & initvars & recordFrame \\
-\end{tabular}
-
-\subsection{\$boot}
-The [[$boot]] variable is set to [[NIL]] in [[ncTopLevel]].
-
-\subsection{coerceFailure}
-The [[coerceFailure]] symbol is a catch tag used in [[runspad]]
-to catch an exit from [[ncTopLevel]].
-
-\subsection{curinstream}
-The [[curinstream]] variable is set to the value of the
-[[*standard-input*]] common lisp
-variable in [[ncIntLoop]]. While not using the
-``dollar'' convention this variable is still ``global''.
-
-\subsection{curinstream}
-The [[curoutstream]] variable is set to the value of the
-[[*standard-output*]] common lisp variable in [[ncIntLoop]].
-While not using the ``dollar'' convention this variable is still ``global''.
-
-\subsection{\$currentLine}
-The [[$currentLine]] line is set to [[NIL]] in [[restart]].
-It is used in [[removeUndoLines]] in the undo mechanism.
-
-\subsection{\$dalymode}
-The [[$dalymode]] variable is used in a case statement in
-[[intloopReadConsole]]. This variable can be set to any non-nil
-value. When not nil the interpreter will send any line that begins
-with an ``[[(]]'' to be sent to the underlying lisp. This is useful
-for debugging Axiom. The normal value of this variable is [[NIL]].
-
-This variable was created as an alternative to prefixing every lisp
-command with [[)lisp]]. When doing a lot of debugging this is tedious
-and error prone. This variable was created to shortcut that process.
-Clearly it breaks some semantics of the language accepted by the
-interpreter as parens are used for grouping expressions.
-
-\subsection{\$defaultMsgDatabaseName}
-The [[$defaultMsgDatabaseName]] is the absolute path to the
-[[s2-us.msgs]] file which contains all of the english language
-messages output by the system.
-
-\subsection{\$directory-list}
-The [[$directory-list]] is a list of absolute directory names.
-These names are made absolute by mapping the [[make-absolute-filename]]
-over the variable [[$relative-directory-list]].
-
-\subsection{\$displayStartMsgs}
-The [[$displayStartMsgs]] variable is used in [[restart]] but is not
-set so this is likely a bug.
-
-\subsection{\$e}
-The [[$e]] variable is set to the value of
-[[$InteractiveFrame]] which is set in [[restart]] to the value of the
-call to the [[makeInitialModemapFrame]] function. This function simply
-returns a copy of the variable [[$InitialModemapFrame]].
-
-Thus [[$e]] is a copy of the variable [[$InitialModemapFrame]].
-
-This variable is used in the undo mechanism.
-
-\subsection{\$erMsgToss}
-The [[$erMsgToss]] variable is set to [[NIL]] in [[SpadInterpretStream]].
-
-\subsection{\$fn}
-The [[$fn]] variable is set in [[SpadInterpretStream]]. It is set to
-the second argument which is a list. It appears that this list has the
-same structure as an argument to the LispVM [[rdefiostream]] function.
-
-\subsection{\$frameRecord}
-[[$frameRecord = [delta1, delta2,... ] ]] where
-[[delta(i)]] contains changes in the ``backwards'' direction.
-Each [[delta(i)]] has the form [[((var . proplist)...)]] where
-proplist denotes an ordinary proplist. For example, an entry
-of the form [[((x (value) (mode (Integer)))...)]] indicates that
-to undo 1 step, [[x]]'s value is cleared and its mode should be set
-to [[(Integer)]].
-
-A [[delta(i)]] of the form [[(systemCommand . delta)]] is a special
-delta indicating changes due to system commands executed between
-the last command and the current command. By recording these deltas
-separately, it is possible to undo to either BEFORE or AFTER
-the command. These special [[delta(i)]]s are given ONLY when a
-a system command is given which alters the environment.
-
-Note: [[recordFrame('system)]] is called before a command is executed, and
-[[recordFrame('normal)]] is called after (see processInteractive1).
-If no changes are found for former, no special entry is given.
-
-This is part of the undo mechanism.
-
-\subsection{\$HiFiAccess}
-The [[$HiFiAccess]] is set by [[initHist]] to [[T]]. It is a flag
-used by the history mechanism to record whether the history function
-is currently on. It can be reset by using the axiom
-command
-\begin{verbatim}
- )history off
-\end{verbatim}
-It appears that the name means ``History File Access''.
-
-The [[$HiFiAccess]] variable is used by [[historySpad2Cmd]] to check
-whether history is turned on. [[T]] means it is, [[NIL]] means it is not.
-
-\subsection{\$HistList}
-Thie [[$HistList]] variable is set by [[initHistList]] to an initial
-value of [[NIL]] elements. The last element of the list is smashed to
-point to the first element to make the list circular.
-This is a circular list of length [[$HistListLen]].
-
-\subsection{\$HistListAct}
-The [[$HistListAct]] variable is set by [[initHistList]] to [[0]].
-This variable holds the actual number of elements in the history list.
-This is the number of ``undoable'' steps.
-
-\subsection{\$HistListLen}
-The [[$HistListLen]] variable is set by [[initHistList]] to [[20]].
-This is the length of a circular list maintained in the variable
-[[$HistList]].
-
-\subsection{\$HistRecord}
-The [[$HistRecord]] variable is set by [[initHistList]] to [[NIL]].
-[[$HistRecord]] collects the input line, all variable bindings
-and the output of a step, before it is written to the file named by
-the function [[histFileName]].
-
-\subsection{\$historyFileType}
-The [[$historyFileType]] is set at load time by a call to
-[[initvars]] to a value of ``[[axh]]''. It appears that this
-is intended to be used as a filetype extension.
-It is part of the history mechanism. It is used in [[makeHistFileName]]
-as part of the history file name.
-
-\subsection{\$inclAssertions}
-The [[$inclAssertions]] is set
-in the function [[SpadInterpretStream]] to the list [[(aix |CommonLisp|)]]
-
-\subsection{\$internalHistoryTable}
-The [[$internalHistoryTable]] variable is set at load time by a call to
-[[initvars]] to a value of [[NIL]].
-It is part of the history mechanism.
-
-\subsection{\$interpreterFrameName}
-The [[$interpreterFrameName]] variable, set in
-[[initializeInterpreterFrameRing]] to the constant
-[[initial]] to indicate that this is the initial (default) frame.
-
-Frames are structures that capture all of the variables defined in a
-session. There can be multiple frames and the user can freely switch
-between them. Frames are kept in a ring data structure so you can
-move around the ring.
-
-\subsection{\$interpreterFrameRing}
-The [[$interpreterFrameRing]] is set to a pair whose car is set to
-the result of [[emptyInterpreterFrame]]
-
-\subsection{\$InitialModemapFrame}
-This variable is copied and returned by the function
-[[makeInitialModemapFrame]]. There is no initial value so this
-is probably a bug.
-
-\subsection{\$inLispVM}
-The [[$inLispVM]] is set to [[NIL]] in [[spad]]. LispVM is a
-non-common lisp that runs on IBM/370 mainframes. This is probably dead
-code. It appears that this list has the same structure as an argument
-to the LispVM [[rdefiostream]] function.
-
-\subsection{\$InteractiveFrame}
-The [[$InteractiveFrame]] is set in [[restart]] to the value of the
-call to the [[makeInitialModemapFrame]] function. This function simply
-returns a copy of the variable [[$InitialModemapFrame]]
-
-\subsection{\$InteractiveMode}
-The [[$InteractiveMode]] is set to [[T]] in [[ncTopLevel]].
-
-\subsection{\$intRestart}
-The [[$intRestart]] variable is used in [[intloop]] but has no value.
-This is probably a bug. While the variable's value is unchanged the
-system will continually reenter the [[SpadInterpretStream]] function.
-
-\subsection{\$intTopLevel}
-The [[$intTopLevel]] is a catch tag. Throwing to this tags which is
-caught in the [[intloop]] will
-restart the [[SpadInterpretStream]] function.
-
-\subsection{\$IOindex}
-The [[$IOindex]] index variable is set to [[1]] in [[restart]].
-This variable is used in the [[historySpad2Cmd]] function in the
-history mechanism. It is set in the [[removeUndoLines]] function
-in the undo mechanism.
-
-This is used in the undo mechanism in function [[undoCount]]
-to compute the number of undos. You can't undo more actions then
-have already happened.
-
-\subsection{\$lastPos}
-The [[$lastPos]] variable is set in [[SpadInterpretStream]]
-to the value of the [[$nopos]] variable.
-Since [[$nopos]] appears to have no value
-this is likely a bug.
-
-\subsection{\$libQuiet}
-The [[$libQuiet]] variable is set to the third argument of the
-[[SpadInterpretStream]] function. This is passed from [[intloop]]
-with the value of [[T]]. This variable appears to be intended to
-control the printing of library loading messages which would need
-to be suppressed if input was coming from a file.
-
-\subsection{\$library-directory-list}
-The [[$library-directory-list]] variable is set by [[reroot]] by
-mapping the function [[make-absolute-filename]] across the
-[[$relative-library-directory-list]] variable which is not yet set so this
-is probably a bug.
-
-\subsection{\$msgDatabaseName}
-The [[$msgDatabaseName]] is set to [[NIL]] in [[reroot]].
-
-\subsection{\$ncMsgList}
-The [[$ncMsgList]] is set to [[NIL]] in [[SpadInterpretStream]].
-
-\subsection{\$newcompErrorCount}
-The [[$newcompErrorCount]] is set to [[0]] in [[SpadInterpretStream]].
-
-\subsection{\$newspad}
-The [[$newspad]] is set to [[T]] in [[ncTopLevel]].
-
-\subsection{\$nopos}
-The [[$nopos]] variable is used in [[SpadInterpretStream]] but does
-not appear to have a value and is likely a bug.
-
-\subsection{\$oldHistoryFileName}
-The [[$oldHistoryFileName]] is set at load time by a call to
-[[initvars]] to a value of ``[[last]]''.
-It is part of the history mechanism. It is used in the function
-[[oldHistFileName]] and [[restoreHistory]].
-
-\subsection{\$okToExecuteMachineCode}
-The [[$okToExecuteMachineCode]] is set to [[T]] in [[SpadInterpretStream]].
-
-\subsection{\$options}
-The [[$options]] variable is tested by the [[history]] function.
-If it is [[NIL]] then output the message
-\begin{verbatim}
- You have not used the correct syntax for the history command.
- Issue )help history for more information.
-\end{verbatim}
-
-The [[$options]] variable is tested in the [[historySpad2Cmd]] function.
-It appears to record the options that were given to a spad command on
-the input line. The function [[selectOptionLC]] appears to take a list
-off options to scan.
-
-This variable is not yet set and is probably a bug.
-
-\subsection{\$previousBindings}
-The [[$previousBindings]] is a copy of the
-[[CAAR $InteractiveFrame]]. This is used to
-compute the [[delta(i)]]s stored in [[$frameRecord]].
-This is part of the undo mechanism.
-
-\subsection{\$PrintCompilerMessageIfTrue}
-The [[$PrintCompilerMessageIfTrue]] variable is set to [[NIL]] in [[spad]].
-
-\subsection{\$openServerIfTrue}
-The [[$openServerIfTrue]] is tested in [[restart]] before it has been
-set (and is thus a bug). It appears to control whether the interpreter
-will be used as an open server, probably for OpenMath use.
-
-If an open server is not requested then this variable to [[NIL]]
-
-\subsection{\$promptMsg}
-The [[$promptMsg]] variable is set to the constant [[S2CTP023]]. This
-constant points to a message in [[src/doc/msgs/s2-us.msgs]]. This message
-does nothing but print the argument value.
-
-\subsection{\$relative-directory-list}
-The [[$relative-directory-list]] is used in [[reroot]] to create
-[[$directory-list]] which is a list of absolute directory names.
-It is not yet set and is probably a bug.
-
-\subsection{\$relative-library-directory-list}
-The [[$relative-library-directory-list]] is used in [[reroot]] to create
-a list of absolute directory names from [[$library-directory-list]] (which is
-It is not yet set and is probably a bug).
-
-\subsection{\$reportUndo}
-The [[$reportUndo]] variable is used in [[diffAlist]]. It was not normally
-bound but has been set to [[T]] in [[initvars]]. If the variable is set
-to [[T]] then we call [[reportUndo]].
-
-It is part of the undo mechanism.
-
-\subsection{\$shoeReadLineFunction}
-The [[$shoeReadLineFunction]] is set in [[SpadInterpretStream]]
-to point to the
-[[serverReadLine]]
-
-\subsection{\$spad}
-The [[$spad]] variable is set to [[T]] in [[ncTopLevel]].
-
-\subsection{\$SpadServer}
-If an open server is not requested then this variable to [[T]].
-It has no value before this time (and is thus a bug).
-
-\subsection{\$SpadServerName}
-The [[$SpadServerName]] is passed to the [[openServer]] function, if the
-function exists.
-
-\subsection{\$systemCommandFunction}
-The [[$systemCommandFunction]] is set in [[SpadInterpretStream]]
-to point to the function
-[[InterpExecuteSpadSystemCommand]].
-
-\subsection{top\_level}
-The [[top\_level]] symbol is a catch tag used in [[runspad]]
-to catch an exit from [[ncTopLevel]].
-
-\subsection{\$quitTag}
-The [[$quitTag]] is used as a variable in a [[catch]] block.
-It appears that it can be thrown somewhere below [[ncTopLevel]].
-
-\subsection{\$useInternalHistoryTable}
-The [[$useInternalHistoryTable]] variable is set at load time by a call to
-[[initvars]] to a value of [[NIL]]. It is part of the history mechanism.
-
-\subsection{\$undoFlag}
-The [[$undoFlag]] is used in [[recordFrame]] to decide whether to do
-undo recording. It is initially set to [[T]] in [[initvars]].
-This is part of the undo mechanism.
-
-\chapter{Starting Axiom}
-Axiom starts by invoking a function value of the lisp symbol
-[[*top-level-hook*]]. The function invocation path to from this
-point until the prompt is approximates (skipping initializations):
-\begin{verbatim}
- lisp -> restart
- -> |spad|
- -> |runspad|
- -> |ncTopLevel|
- -> |ncIntLoop|
- -> |intloop|
- -> |SpadInterpretStream|
- -> |intloopReadConsole|
-\end{verbatim}
-The [[|intloopReadConsole|]] function does tail-recursive calls to
-itself (don't break this) and never exits.
-\section{Variables Used}
-\section{Data Structures}
-\section{Functions}
-\subsection{defun set-restart-hook}
-When a lisp image containing code is reloaded there is a hook to
-allow a function to be called. In our case it is the [[restart]]
-function which is the entry to the Axiom interpreter.
-<<defun set-restart-hook>>=
-(defun set-restart-hook ()
- #+KCL (setq system::*top-level-hook* 'restart)
- #+Lucid (setq boot::restart-hook 'restart)
- 'restart
- )
-
-@
-\subsection{defun restart}
-The restart function is the real root of the world. It sets up memory
-if we are working in a GCL/akcl version of the system. It sets the
-current package to be the ``BOOT'' package which is the standard
-package in which the interpreter runs.
-
-The [[compiler::*compile-verbose*]] flag has been set to nil globally.
-We do not want to know about the microsteps of GCL's compile facility.
-
-The [[compiler::*suppress-compiler-warnings*]] flag has been set to t.
-We do not care that certain generated variables are not used.
-
-The [[compiler::*suppress-compiler-notes*]] flag has been set to t.
-We do not care that tail recursion occurs.
-<<defun restart>>=
-(defun restart ()
-#+:akcl
- (init-memory-config :cons 500 :fixnum 200 :symbol 500 :package 8
- :array 400 :string 500 :cfun 100 :cpages 3000 :rpages 1000 :hole 2000)
-#+:akcl (setq compiler::*compile-verbose* nil)
-#+:akcl (setq compiler::*suppress-compiler-warnings* t)
-#+:akcl (setq compiler::*suppress-compiler-notes* t)
-#-:CCL
- (in-package "BOOT")
-
- ;; Do any command-line processing that may be needed
- (|AxiomCore|::|topLevel|)
- (reroot)
-#+:akcl (system:gbc-time 0)
-
- (when (and $openServerIfTrue (fboundp '|openServer|))
- (prog (os)
- (setq os (|openServer| $SpadServerName))
- (if (zerop os)
- (progn
- (setq $openServerIfTrue nil)
- (setq |$SpadServer| t)))))
- (setq |$IOindex| 1)
- (setq |$InteractiveFrame| (|makeInitialModemapFrame|))
- (|loadExposureGroupData|)
- (|statisticsInitialization|)
- (|initHist|)
- (|initializeInterpreterFrameRing|)
-
- (when |$displayStartMsgs|
- (|spadStartUpMsgs|))
- (setq |$currentLine| nil)
- (restart0)
- (|readSpadProfileIfThere|)
- (|spad|))
-
-@
-
-\subsection{defun SpadInterpretStream}
-The [[SpadInterpretStream]] function takes three arguments
-\begin{list}{}
-\item [[str]] This is passed as an argument to [[intloopReadConsole]]
-\item [[source]] This is the name of a source file but appears not
-to be used. It is set to the list [[(tim daly ?)]].
-\item [[interactive?]] If this is false then various messages are
-suppressed and input does not use piles. If this is true then the
-library loading routines might output messages and piles are expected
-on input (as from a file).
-\end{list}
-
-
-\section{Helper Functions}
-\subsection{defun reclaim}
-Call the garbage collector on various platforms.
-<<defun reclaim>>=
-#+abcl
-(defun reclaim () (ext::gc))
-#+:allegro
-(defun reclaim () (excl::gc t))
-#+:CCL
-(defun reclaim () (gc))
-#+clisp
-(defun reclaim () (#+lisp=cl ext::gc #-lisp=cl lisp::gc))
-#+(or :cmulisp :cmu)
-(defun reclaim () (ext:gc))
-#+cormanlisp
-(defun reclaim () (cl::gc))
-#+(OR IBCL KCL GCL)
-(defun reclaim () (si::gbc t))
-#+lispworks
-(defun reclaim () (hcl::normal-gc))
-#+Lucid
-(defun reclaim () (lcl::gc))
-#+sbcl
-(defun reclaim () (sb-ext::gc))
-@
-
-\subsection{defun init-memory-config}
-Austin-Kyoto Common Lisp (AKCL), now known as Gnu Common Lisp (GCL)
-requires some changes to the default memory setup to run Axiom efficently.
-This function performs those setup commands.
-<<defun init-memory-config>>=
-(defun init-memory-config (&key
- (cons 500)
- (fixnum 200)
- (symbol 500)
- (package 8)
- (array 400)
- (string 500)
- (cfun 100)
- (cpages 3000)
- (rpages 1000)
- (hole 2000) )
- ;; initialize AKCL memory allocation parameters
- #+:AKCL
- (progn
- (system:allocate 'cons cons)
- (system:allocate 'fixnum fixnum)
- (system:allocate 'symbol symbol)
- (system:allocate 'package package)
- (system:allocate 'array array)
- (system:allocate 'string string)
- (system:allocate 'cfun cfun)
- (system:allocate-contiguous-pages cpages)
- (system:allocate-relocatable-pages rpages)
- (system:set-hole-size hole))
- #-:AKCL
- nil)
-
-@
-
-\subsection{defun loadExposureGroupData}
-<<defun loadExposureGroupData>>=
-(defun |loadExposureGroupData| ()
- (cond
- ((load "./exposed" :verbose nil :if-does-not-exist nil)
- '|done|)
- ((load (concat (|systemRootDirectory|) "/algebra/exposed")
- :verbose nil :if-does-not-exist nil)
- '|done|)
- (t '|failed|) ))
-
-@
-\subsection{make-absolute-filename}
-Prefix a filename with the {\bf AXIOM} shell variable.
-<<defun make-absolute-filename>>=
-(defun make-absolute-filename (name)
- (concatenate 'string (|systemRootDirectory|) name))
-
-@
-
-\subsection{defun reroot}
-The reroot function is used to reset the important variables used by
-the system. The {\bf reroot} function will change the
-system to use a new root directory. Note that we have changed from the
-NAG distribution back to the original form. If you need the NAG
-version you can push {\bf :tpd} on the {\bf *features*} variable
-before compiling this file.
-<<defun reroot>>=
-(defun reroot ()
- (setq $directory-list
- (mapcar #'make-absolute-filename $relative-directory-list))
- (setq $library-directory-list
- (mapcar #'make-absolute-filename $relative-library-directory-list))
- (setq |$defaultMsgDatabaseName|
- (pathname (make-absolute-filename "/share/msgs/s2-us.msgs")))
- (setq |$msgDatabaseName| ()))
-
-@
-\subsection{defun statisticsInitialization}
-<<defun statisticsInitialization>>=
-(defun |statisticsInitialization| ()
- "initialize the garbage collection timer"
- #+:akcl (system:gbc-time 0)
- nil)
-
-@
-\chapter{The History Mechanism}
-\section{)history}
-\index{ugSysCmdhistory}
-
-\index{history}
-
-
-\par\noindent{\bf User Level Required:} interpreter
-
-\par\noindent{\bf Command Syntax:}
-\begin{list}{}
-\item{\tt )history )on}
-\item{\tt )history )off}
-\item{\tt )history )write} {\it historyInputFileName}
-\item{\tt )history )show [{\it n}] [both]}
-\item{\tt )history )save} {\it savedHistoryName}
-\item{\tt )history )restore} [{\it savedHistoryName}]
-\item{\tt )history )reset}
-\item{\tt )history )change} {\it n}
-\item{\tt )history )memory}
-\item{\tt )history )file}
-\item{\tt \%}
-\item{\tt \%\%({\it n})}
-\item{\tt )set history on | off}
-\end{list}
-
-\par\noindent{\bf Command Description:}
-
-The {\it history} facility within Axiom allows you to restore your
-environment to that of another session and recall previous
-computational results.
-Additional commands allow you to review previous
-input lines and to create an {\bf .input} file of the lines typed to
-\index{file!input}
-Axiom.
-
-Axiom saves your input and output if the history facility is
-turned on (which is the default).
-This information is saved if either of
-\begin{verbatim}
-)set history on
-)history )on
-\end{verbatim}
-has been issued.
-Issuing either
-\begin{verbatim}
-)set history off
-)history )off
-\end{verbatim}
-will discontinue the recording of information.
-\index{history )on}
-\index{set history on}
-\index{set history off}
-\index{history )off}
-
-Whether the facility is disabled or not,
-the value of {\tt \%} in Axiom always
-refers to the result of the last computation.
-If you have not yet entered anything,
-{\tt \%} evaluates to an object of type
-{\tt Variable('\%)}.
-The function {\tt \%\%} may be used to refer
-to other previous results if the history facility is enabled.
-In that case,
-{\tt \%\%(n)} is the output from step {\tt n} if {\tt n > 0}.
-If {\tt n < 0}, the step is computed relative to the current step.
-Thus {\tt \%\%(-1)} is also the previous step,
-{\tt \%\%(-2)}, is the step before that, and so on.
-If an invalid step number is given, Axiom will signal an error.
-
-The {\it environment} information can either be saved in a file or entirely in
-memory (the default).
-Each frame
-(\ref{ugSysCmdframe} on page~\pageref{ugSysCmdframe})
-has its own history database.
-When it is kept in a file, some of it may also be kept in memory for
-efficiency.
-When the information is saved in a file, the name of the file is
-of the form {\bf FRAME.axh} where ``{\bf FRAME}'' is the name of the
-current frame.
-The history file is placed in the current working directory
-(see \ref{ugSysCmdcd} on page~\pageref{ugSysCmdcd}).
-Note that these history database files are not text files (in fact,
-they are directories themselves), and so are not in human-readable
-format.
-
-The options to the {\tt )history} command are as follows:
-
-\begin{description}
-\item[{\tt )change} {\it n}]
-will set the number of steps that are saved in memory to {\it n}.
-This option only has effect when the history data is maintained in a
-file.
-If you have issued {\tt )history )memory} (or not changed the default)
-there is no need to use {\tt )history )change}.
-\index{history )change}
-
-\item[{\tt )on}]
-will start the recording of information.
-If the workspace is not empty, you will be asked to confirm this
-request.
-If you do so, the workspace will be cleared and history data will begin
-being saved.
-You can also turn the facility on by issuing {\tt )set history on}.
-
-\item[{\tt )off}]
-will stop the recording of information.
-The {\tt )history )show} command will not work after issuing this
-command.
-Note that this command may be issued to save time, as there is some
-performance penalty paid for saving the environment data.
-You can also turn the facility off by issuing {\tt )set history off}.
-
-\item[{\tt )file}]
-indicates that history data should be saved in an external file on disk.
-
-\item[{\tt )memory}]
-indicates that all history data should be kept in memory rather than
-saved in a file.
-Note that if you are computing with very large objects it may not be
-practical to kept this data in memory.
-
-\item[{\tt )reset}]
-will flush the internal list of the most recent workspace calculations
-so that the data structures may be garbage collected by the underlying
-Common Lisp system.
-Like {\tt )history )change}, this option only has real effect when
-history data is being saved in a file.
-
-\item[{\tt )restore} [{\it savedHistoryName}]]
-completely clears the environment and restores it to a saved session, if
-possible.
-The {\tt )save} option below allows you to save a session to a file
-with a given name. If you had issued
-{\tt )history )save jacobi}
-the command
-{\tt )history )restore jacobi}
-would clear the current workspace and load the contents of the named
-saved session. If no saved session name is specified, the system looks
-for a file called {\bf last.axh}.
-
-\item[{\tt )save} {\it savedHistoryName}]
-is used to save a snapshot of the environment in a file.
-This file is placed in the current working directory
-(see \ref{ugSysCmdcd} on page~\pageref{ugSysCmdcd}).
-Use {\tt )history )restore} to restore the environment to the state
-preserved in the file.
-This option also creates an input file containing all the lines of input
-since you created the workspace frame (for example, by starting your
-Axiom session) or last did a {\tt )clear all} or
-{\tt )clear completely}.
-
-\item[{\tt )show} [{\it n}] [{\tt both}]]
-can show previous input lines and output results.
-{\tt )show} will display up to twenty of the last input lines
-(fewer if you haven't typed in twenty lines).
-{\tt )show} {\it n} will display up to {\it n} of the last input lines.
-{\tt )show both} will display up to five of the last input lines and
-output results.
-{\tt )show} {\it n} {\tt both} will display up to {\it n} of the last
-input lines and output results.
-
-\item[{\tt )write} {\it historyInputFile}]
-creates an {\bf .input} file with the input lines typed since the start
-of the session/frame or the last {\tt )clear all} or {\tt )clear
-completely}.
-If {\it historyInputFileName} does not contain a period (``.'') in the filename,
-{\bf .input} is appended to it.
-For example,
-{\tt )history )write chaos}
-and
-{\tt )history )write chaos.input}
-both write the input lines to a file called {\bf chaos.input} in your
-current working directory.
-If you issued one or more {\tt )undo} commands,
-{\tt )history )write}
-eliminates all
-input lines backtracked over as a result of {\tt )undo}.
-You can edit this file and then use {\tt )read} to have Axiom process
-the contents.
-\end{description}
-
-\par\noindent{\bf Also See:}
-{\tt )frame} \index{ugSysCmdframe},
-{\tt )read} \index{ugSysCmdread},
-{\tt )set} \index{ugSysCmdset}, and
-{\tt )undo} \index{ugSysCmdundo}.
-
-
-History recording is done in two different ways:
-\begin{itemize}
-\item all changes in variable bindings (i.e. previous values) are
- written to [[$HistList]], which is a circular list
-\item all new bindings (including the binding to [[%]]) are written to a
- file called [[histFileName()]]
- one older session is accessible via the file [[$oldHistFileName()]]
-\end{itemize}
-
-\section{Variables Used}
-The following global variables are used:
-\begin{list}{}
-\item [[$HistList]], [[$HistListLen]] and [[$HistListAct]] which is the
- actual number of ``undoable'' steps)
-\item [[$HistRecord]] collects the input line, all variable bindings
- and the output of a step, before it is written to the file
- [[histFileName()]].
-\item [[$HiFiAccess]] is a flag, which is reset by [[)history )off]]
-\end{list}
-The result of step n can be accessed by [[%n]], which is translated
-into a call of [[fetchOutput(n)]]. The
-[[updateHist]] is called after every interpreter step. The
-[[putHist]] function records all changes in the environment to [[$HistList]]
- and [[$HistRecord]]
-
-\subsection{Initialized history variables}
-\begin{verbatim}
-\end{verbatim}
-
-<<initvars>>=
-(defvar |$historyDirectory| 'A "vm/370 filename disk component")
-(defvar |$HiFiAccess| t "t means turn on history mechanism")
-@
-
-\section{Data Structures}
-\section{Functions}
-
-\subsection{defun setHistoryCore}
-We [[case]] on the [[inCore]] argument value
-\begin{list}{}
-\item If history is already on and is kept in the same location as requested
-(file or memory) then complain.
-\item If history is not in use then start using the file or memory as
-requested. This is done by simply setting the [[$useInternalHistoryTable]]
-to the requested value, where [[T]] means use memory and [[NIL]] means
-use a file. We tell the user.
-\item If history should be in memory, that is [[inCore]] is not [[NIL]],
-and the history file already contains information we read the information
-from the file, store it in memory, and erase the history file. We modify
-[[$useInternalHistoryTable]] to [[T]] to indicate that we're maintining
-the history in memory and tell the user.
-\item Otherwise history must be on and in memory. We erase any old history
-file and then write the in-memory history to a new file
-\end{list}
-
-
-\section{History File Messages}
-<<History File Messages>>=
-S2IH0001
- You have not reached step %1b yet, and so its value cannot be
- supplied.
-S2IH0002
- Cannot supply value for step %1b because 1 is the first step.
-S2IH0003
- Step %1b has no value.
-S2IH0004
- The history facility is not on, so you cannot use %b %% %d .
-S2IH0006
- You have not used the correct syntax for the %b history %d command.
- Issue %b )help history %d for more information.
-S2IH0007
- The history facility is already on.
-S2IH0008
- The history facility is now on.
-S2IH0009
- Turning on the history facility will clear the contents of the
- workspace.
- Please enter %b y %d or %b yes %d if you really want to do this:
-S2IH0010
- The history facility is still off.
-S2IH0011
- The history facility is already off.
-S2IH0012
- The history facility is now off.
-S2IH0013
- The history facility is not on, so the .input file containing your user input
- cannot be created.
-S2IH0014
- Edit %b %1 %d to see the saved input lines.
-S2IH0015
- The argument %b n %d for %b )history )change n must be a nonnegative
- integer and your argument, %1b , is not one.
-S2IH0016
- The history facility is not on, so no information can be saved.
-S2IH0018
- The saved history file is %1b .
-S2IH0019
- There is no history file, so value of step %1b is
- undefined.
-S2IH0022
- No history information had been saved yet.
-S2IH0023
- %1b is not a valid filename for the history file.
-S2IH0024
- History information cannot be restored from %1b because the file does
- not exist.
-S2IH0025
- The workspace has been successfully restored from the history file
- %1b .
-S2IH0026
- The history facility command %1b cannot be performed because the
- history facility is not on.
-S2IH0027
- A value containing a %1b is being saved in a history file or a
- compiled input file INLIB. This type
- is not yet usable in other history operations. You might want to issue
- %b )history )off %d
-S2IH0029
- History information is already being maintained in an external file
- (and not in memory).
-S2IH0030
- History information is already being maintained in memory (and not
- in an external file).
-S2IH0031
- When the history facility is active, history information will be
- maintained in a file (and not in an internal table).
-S2IH0032
- When the history facility is active, history information will be
- maintained in memory (and not in an external file).
-S2IH0034
- Missing element in internal history table.
-S2IH0035
- Can't save the value of step number %1b. You can re-generate this value
- by running the input file %2b.
-S2IH0036
- The value specified cannot be saved to a file.
-S2IH0037
- You must specify a file name to the history save command
-S2IH0038
- You must specify a file name to the history write command
-@
-
-\chapter{The Frame Mechanism}
-\section{)frame}
-%\label{ugSysCmdframe}
-%\index{frame}
-\par\noindent{\bf Command Syntax:}
-\begin{list}{}
-\item{\tt )frame new {\it frameName}}
-\item{\tt )frame drop {\it [frameName]}}
-\item{\tt )frame next}
-\item{\tt )frame last}
-\item{\tt )frame names}
-\item{\tt )frame import {\it frameName} {\it [objectName1 [objectName2 ...]]}}
-\item{\tt )set message frame on | off}
-\item{\tt )set message prompt frame}
-\end{list}
-
-\par\noindent{\bf Command Description:}
-
-A {\it frame} can be thought of as a logical session within the
-physical session that you get when you start the system. You can
-have as many frames as you want, within the limits of your computer's
-storage, paging space, and so on.
-Each frame has its own {\it step number}, {\it environment} and {\it history.}
-You can have a variable named {\tt a} in one frame and it will
-have nothing to do with anything that might be called {\tt a} in
-any other frame.
-
-Some frames are created by the HyperDoc program and these can
-have pretty strange names, since they are generated automatically.
-\index{frame names}
-To find out the names
-of all frames, issue
-\begin{verbatim}
-)frame names
-\end{verbatim}
-It will indicate the name of the current frame.
-
-You create a new frame
-\index{frame new}
-``{\bf quark}'' by issuing
-\begin{verbatim}
-)frame new quark
-\end{verbatim}
-The history facility can be turned on by issuing either
-{\tt )set history on} or {\tt )history )on}.
-If the history facility is on and you are saving history information
-in a file rather than in the Axiom environment
-then a history file with filename {\bf quark.axh} will
-be created as you enter commands.
-If you wish to go back to what
-you were doing in the
-\index{frame next}
-``{\bf initial}'' frame, use
-\index{frame last}
-\begin{verbatim}
-)frame next
-\end{verbatim}
-or
-\begin{verbatim}
-)frame last
-\end{verbatim}
-to cycle through the ring of available frames to get back to
-``{\bf initial}''.
-
-If you want to throw
-away a frame (say ``{\bf quark}''), issue
-\begin{verbatim}
-)frame drop quark
-\end{verbatim}
-If you omit the name, the current frame is dropped.
-\index{frame drop}
-
-If you do use frames with the history facility on and writing to a file,
-you may want to delete some of the older history files.
-\index{file!history}
-These are directories, so you may want to issue a command like
-{\tt rm -r quark.axh} to the operating system.
-
-You can bring things from another frame by using
-\index{frame import}
-{\tt )frame import}.
-For example, to bring the {\tt f} and {\tt g} from the frame ``{\bf quark}''
-to the current frame, issue
-\begin{verbatim}
-)frame import quark f g
-\end{verbatim}
-If you want everything from the frame ``{\bf quark}'', issue
-\begin{verbatim}
-)frame import quark
-\end{verbatim}
-You will be asked to verify that you really want everything.
-
-There are two {\tt )set} flags
-\index{set message frame}
-to make it easier to tell where you are.
-\begin{verbatim}
-)set message frame on | off
-\end{verbatim}
-will print more messages about frames when it is set on.
-By default, it is off.
-\begin{verbatim}
-)set message prompt frame
-\end{verbatim}
-will give a prompt
-\index{set message prompt frame}
-that looks like
-\begin{verbatim}
-initial (1) ->
-\end{verbatim}
-\index{prompt!with frame name}
-when you start up. In this case, the frame name and step make up the
-prompt.
-
-\par\noindent{\bf Also See:}
-{\tt )history} \index{ugSysCmdhistory} and
-{\tt )set} \index{ugSysCmdset}.
-
-
-@
-\section{Variables Used}
-\section{Data Structures}
-\section{Functions}
-
-
-\section{Frame File Messages}
-<<Frame File Messages>>=
-S2IZ0016
- The %1b system command takes arguments but no options.
-S2IZ0017
- %1b is not a valid frame name
-S2IZ0018
- You must provide a name for the new frame.
-S2IZ0019
- You cannot use the name %1b for a new frame because an existing
- frame already has that name.
-S2IZ0020
- There is only one frame active and therefore that cannot be closed.
- Furthermore, the frame name you gave is not the name of the current frame.
- The current frame is called %1b .
-S2IZ0021
- The current frame is the only active one. Issue %b )clear all %d to
- clear its contents.
-S2IZ0022
- There is no frame called %1b and so your command cannot be
- processed.
-S2IZ0024
- The names of the existing frames are: %1 %l
- The current frame is the first one listed.
-S2IZ0073
- %b )frame import %d must be followed by the frame name. The names
- of objects in that frame can then optionally follow the frame name.
- For example,
- %ceon %b )frame import calculus %d %ceoff
- imports all objects in the %b calculus %d frame, and
- %ceon %b )frame import calculus epsilon delta %d %ceoff
- imports the objects named %b epsilon %d and %b delta %d from the
- frame %b calculus %d .
- Please note that if the current frame contained any information
- about objects with these names, then that information would be
- cleared before the import took place.
-S2IZ0074
- You cannot import anything from the frame %1b because that is not
- the name of an existing frame.
-S2IZ0075
- You cannot import from the current frame (nor is there a need!).
-S2IZ0076
- User verification required:
- do you really want to import everything from the frame %1b ?
- If so, please enter %b y %d or %b yes %d :
-S2IZ0077
- On your request, OpenAxiom will not import everything from frame %1b.
-S2IZ0078
- Import from frame %1b is complete. Please issue %b )display all %d
- if you wish to see the contents of the current frame.
-S2IZ0079
- OpenAxiom cannot import %1b from frame %2b because it cannot be found.
-@
-\chapter{The Undo Mechanism}
-\section{)undo}
-\index{ugSysCmdundo}
-
-\index{undo}
-
-
-\par\noindent{\bf User Level Required:} interpreter
-
-\par\noindent{\bf Command Syntax:}
-\begin{list}{}
-\item{\tt )undo}
-\item{\tt )undo} {\it integer}
-\item{\tt )undo} {\it integer [option]}
-\item{\tt )undo} {\tt )redo}
-\end{list}
-%
-where {\it option} is one of
-%
-\begin{list}{}
-\item{\tt )after}
-\item{\tt )before}
-\end{list}
-
-\par\noindent{\bf Command Description:}
-
-This command is used to
-restore the state of the user environment to an earlier
-point in the interactive session.
-The argument of an {\tt )undo} is an integer which must designate some
-step number in the interactive session.
-
-\begin{verbatim}
-)undo n
-)undo n )after
-\end{verbatim}
-These commands return the state of the interactive
-environment to that immediately after step {\tt n}.
-If {\tt n} is a positive number, then {\tt n} refers to step nummber
-{\tt n}. If {\tt n} is a negative number, it refers to the \tt n-th
-previous command (that is, undoes the effects of the last $-n$
-commands).
-
-A {\tt )clear all} resets the {\tt )undo} facility.
-Otherwise, an {\tt )undo} undoes the effect of {\tt )clear} with
-options {\tt properties}, {\tt value}, and {\tt mode}, and
-that of a previous {\tt undo}.
-If any such system commands are given between steps $n$ and
-$n + 1$ ($n > 0$), their effect is undone
-for {\tt )undo m} for any $0 < m \leq n$..
-
-The command {\tt )undo} is equivalent to {\tt )undo -1} (it undoes
-the effect of the previous user expression).
-The command {\tt )undo 0} undoes any of the above system commands
-issued since the last user expression.
-
-\begin{verbatim}
-)undo n )before
-\end{verbatim}
-This command returns the state of the interactive
-environment to that immediately before step {\tt n}.
-Any {\tt )undo} or {\tt )clear} system commands
-given before step {\tt n} will not be undone.
-
-\begin{verbatim}
-)undo )redo
-\end{verbatim}
-This command reads the file {\tt redo.input}.
-created by the last {\tt )undo} command.
-This file consists of all user input lines, excluding those
-backtracked over due to a previous {\tt )undo}.
-
-\par\noindent{\bf Also See:}
-{\tt )history} \index{ugSysCmdhistory}.
-The command {\tt )history )write} will eliminate the ``undone'' command
-lines of your program.
-\section{Variables Used}
-\section{Data Structures}
-[[$frameRecord = [delta1, delta2,... ] ]] where
-[[delta(i)]] contains changes in the ``backwards'' direction.
-Each [[delta(i)]] has the form [[((var . proplist)...)]] where
-proplist denotes an ordinary proplist. For example, an entry
-of the form [[((x (value) (mode (Integer)))...)]] indicates that
-to undo 1 step, [[x]]'s value is cleared and its mode should be set
-to [[(Integer)]].
-
-A [[delta(i)]] of the form [[(systemCommand . delta)]] is a special
-delta indicating changes due to system commands executed between
-the last command and the current command. By recording these deltas
-separately, it is possible to undo to either BEFORE or AFTER
-the command. These special [[delta(i)]]s are given ONLY when a
-a system command is given which alters the environment.
-
-Note: [[recordFrame('system)]] is called before a command is executed, and
-[[recordFrame('normal)]] is called after (see processInteractive1).
-If no changes are found for former, no special entry is given.
-
-The [[$previousBindings]] is a copy of the
-[[CAAR $InteractiveFrame]]. This is used to
-compute the [[delta(i)]]s stored in [[$frameRecord]].
-\section{Functions}
-\subsection{Initial Undo Variables}
-\begin{verbatim}
-\end{verbatim}
-<<initvars>>=
-(defvar |$reportUndo| nil "t means we report the steps undo takes")
-@
-
-
-\subsection{defun reportUndo}
-This function is enabled by setting [[|$reportUndo]] to a non-nil value.
-An example of the output generated is:
-\begin{verbatim}
-r := binary(22/7)
-
-
- ___
- (1) 11.001
- Type: BinaryExpansion
-Properties of % ::
- value was: NIL
- value is: ((|BinaryExpansion|) WRAPPED . #(1 (1 1) NIL (0 0 1)))
-Properties of r ::
- value was: NIL
- value is: ((|BinaryExpansion|) WRAPPED . #(1 (1 1) NIL (0 0 1)))
-
-\end{verbatim}
-
-
-\chapter{The Spad Server Mechanism}
-<<initvars>>=
-(defvar $openServerIfTrue t "t means try starting an open server")
-(defconstant $SpadServerName "/tmp/.d" "the name of the spad server socket")
-(defvar |$SpadServer| nil "t means Scratchpad acts as a remote server")
-
-@
-
-\chapter{Axiom Build-time Functions}
-\subsection{defun spad-save}
-The {\bf spad-save} function is just a cover function for more
-lisp system specific save functions. There is no standard name
-for saving a lisp image so we make one and conditionalize it
-at compile time.
-
-This function is passed the name of an image that will be saved.
-The saved image contains all of the loaded functions.
-
-This is used in the [[src/interp/Makefile.pamphlet]] in three places:
-\begin{list}{}
-\item creating depsys, an image for compiling axiom.
-
-Some of the Common Lisp code we compile uses macros which
-are assumed to be available at compile time. The {\bf DEPSYS}
-image is created to contain the compile time environment
-and saved. We pipe compile commands into this environment
-to compile from Common Lisp to machine dependent code.
-\begin{verbatim}
-DEPSYS= ${OBJ}/${SYS}/bin/depsys
-\end{verbatim}
-
-\item creating savesys, an image for running axiom.
-
-Once we've compile all of the Common Lisp files we fire up
-a clean lisp image called {\bf LOADSYS}, load all of the
-final executable code and save it out as {\bf SAVESYS}.
-The {\bf SAVESYS} image is copied to the [[${MNT}/${SYS}/bin]]
-subdirectory and becomes the axiom executable image.
-\begin{verbatim}
-LOADSYS= ${OBJ}/${SYS}/bin/lisp
-SAVESYS= ${OBJ}/${SYS}/bin/interpsys
-AXIOMSYS= ${MNT}/${SYS}/bin/AXIOMsys
-\end{verbatim}
-
-
-\item creating debugsys, an image with all interpreted functions loaded.
-
-Occasionally we need to really get into the system internals.
-The best way to do this is to run almost all of the lisp code
-interpreted rather than compiled (note that cfuns.lisp and sockio.lisp
-still need to be loaded in compiled form as they depend on the
-loader to link with lisp internals). This image is nothing more
-than a load of the file src/interp/debugsys.lisp.pamphlet. If
-you need to make test modifications you can add code to that
-file and it will show up here.
-\begin{verbatim}
-DEBUGSYS=${OBJ}/${SYS}/bin/debugsys
-\end{verbatim}
-\end{list}
-<<defun spad-save>>=
-(defun spad-save (save-file)
- (setq |$SpadServer| nil)
- (setq $openServerIfTrue t)
-#+:AKCL
- (system::save-system save-file)
-#+:allegro
- (if (fboundp 'boot::restart)
- (excl::dumplisp :name save-file :restart-function #'boot::restart)
- (excl::dumplisp :name save-file))
-#+Lucid
- (if (fboundp 'boot::restart)
- (sys::disksave save-file :restart-function #'boot::restart)
- (sys::disksave save-file))
-#+:CCL
- (preserve)
-)
-
-@
-
-\chapter{The Interpreter}
-<<Interpreter>>=
-(IMPORT-MODULE "vmlisp")
-(in-package "BOOT")
-<<initvars>>
-
-<<defun init-memory-config>>
-
-<<defun loadExposureGroupData>>
-
-<<defun make-absolute-filename>>
-
-<<defun reclaim>>
-
-<<defun reroot>>
-<<defun restart>>
-
-<<defun set-restart-hook>>
-<<defun spad-save>>
-<<defun statisticsInitialization>>
-
-@
-\chapter{Makefile.bookvol5}
-<<*>>=
-
-all: bookvol5
- @echo 0 done
-
-bookvol5: bookvol5.pamphlet
- ${TANGLE} -R"Interpreter" bookvol5.pamphlet >bookvol5.lisp
-
-remake:
- @echo 2 rebuilding the makefile
- @${TANGLE} bookvol5.pamphlet >Makefile.bookvol5
-
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/interp/debug.lisp b/src/interp/debug.lisp
index 3e3d28fb..dbf35df7 100644
--- a/src/interp/debug.lisp
+++ b/src/interp/debug.lisp
@@ -191,7 +191,7 @@
(LIST " editing file" '|%b| (|namestring| EDINFILE) '|%d|))
(OBEY
(STRCONC
- (make-absolute-filename "/lib/SPADEDFN ")
+ (|makeAbsoluteFilename| "/lib/SPADEDFN ")
(|namestring| EDINFILE)
" "
(STRINGIMAGE $LINENUMBER)))
diff --git a/src/interp/diagnostics.boot b/src/interp/diagnostics.boot
index 0432ede7..6d9496f8 100644
--- a/src/interp/diagnostics.boot
+++ b/src/interp/diagnostics.boot
@@ -47,6 +47,7 @@ import '"sys-globals"
++ precompilation, or semantics analysis errors.
BUMPERRORCOUNT kind ==
+ countError()
$InteractiveMode =>
index :=
kind = "syntax" => 0
diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot
index 0add6301..40b87f1f 100644
--- a/src/interp/i-map.boot
+++ b/src/interp/i-map.boot
@@ -710,9 +710,10 @@ genMapCode(op,body,sig,fnName,parms,isRecursive) ==
op0 :=
( n := isSharpVarWithNum op ) => STRCONC('"<argument ",object2String n,'">")
op
- if get(op,'isInterpreterRule,$e) then
- sayKeyedMsg("S2IM0014",[op0,(PAIRP sig =>prefix2String CAR sig;'"?")])
- else sayKeyedMsg("S2IM0015",[op0,formatSignature sig])
+ if $verboseInterprerter then
+ if $verboseInterprerter and get(op,'isInterpreterRule,$e) then
+ sayKeyedMsg("S2IM0014",[op0,(PAIRP sig =>prefix2String CAR sig;'"?")])
+ else sayKeyedMsg("S2IM0015",[op0,formatSignature sig])
$whereCacheList := [op,:$whereCacheList]
-- RSS: 6-21-94
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 07e58001..c738fda3 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -95,6 +95,8 @@ $localExposureData :=
--% Top level system command
+$options := nil
+
initializeSystemCommands() ==
l := $systemCommands
$SYSCOMMANDS := NIL
@@ -1408,6 +1410,12 @@ $internalHistoryTable := NIL
++ t means keep history in core
$useInternalHistoryTable := true
+++ vm/370 filename disk component
+$historyDirectory := "A"
+
+++ true means turn on history mechanism
+$HiFiAccess := true
+
history l ==
l or null $options => sayKeyedMsg("S2IH0006",NIL)
historySpad2Cmd()
@@ -1436,7 +1444,7 @@ initHist() ==
-- see if history directory is writable
histFileErase oldFile
if MAKE_-INPUT_-FILENAME newFile then $REPLACE(oldFile,newFile)
- $HiFiAccess:= 'T
+ $HiFiAccess:= true
initHistList()
initHistList() ==
@@ -1461,13 +1469,13 @@ historySpad2Cmd() ==
opt in '(on yes) =>
$HiFiAccess => sayKeyedMsg("S2IH0007",NIL)
$IOindex = 1 => -- haven't done anything yet
- $HiFiAccess:= 'T
+ $HiFiAccess:= true
initHistList()
sayKeyedMsg("S2IH0008",NIL)
x := UPCASE queryUserKeyedMsg("S2IH0009",NIL)
MEMQ(STRING2ID_-N(x,1),'(Y YES)) =>
histFileErase histFileName()
- $HiFiAccess:= 'T
+ $HiFiAccess:= true
$options := nil
clearSpad2Cmd '(all)
sayKeyedMsg("S2IH0008",NIL)
@@ -1475,7 +1483,7 @@ historySpad2Cmd() ==
sayKeyedMsg("S2IH0010",NIL)
opt in '(off no) =>
null $HiFiAccess => sayKeyedMsg("S2IH0011",NIL)
- $HiFiAccess:= NIL
+ $HiFiAccess:= false
disableHist()
sayKeyedMsg("S2IH0012",NIL)
opt = 'file => setHistoryCore NIL
@@ -1507,13 +1515,13 @@ setHistoryCore inCore ==
histFileErase histFileName()
$useInternalHistoryTable := true
sayKeyedMsg("S2IH0032",NIL)
- $HiFiAccess:= 'NIL
+ $HiFiAccess:= false
histFileErase histFileName()
str := RDEFIOSTREAM ['(MODE . OUTPUT),['FILE,:histFileName()]]
for [n,:rec] in reverse $internalHistoryTable repeat
SPADRWRITE(object2Identifier n,rec,str)
RSHUT str
- $HiFiAccess:= 'T
+ $HiFiAccess:= true
$internalHistoryTable := NIL
$useInternalHistoryTable := NIL
sayKeyedMsg("S2IH0031",NIL)
@@ -1722,7 +1730,7 @@ restoreHistory(fn) ==
_$FCOPY(restfile,curfile)
l:= LENGTH RKEYIDS curfile
- $HiFiAccess:= 'T
+ $HiFiAccess:= true
oldInternal := $useInternalHistoryTable
$useInternalHistoryTable := NIL
if oldInternal then $internalHistoryTable := NIL
@@ -2487,6 +2495,9 @@ processSynonymLine line ==
$undoFlag := true --Default setting for undo is "on"
+++ true means means we report the steps undo takes
+$reportUndo := false
+
undo(l) ==
--undo takes one option ")redo" which simply reads "redo.input",
@@ -2552,7 +2563,7 @@ diffAlist(new,old) ==
-- (2) if the new world has a proplist for that variable, it has
-- been handled by the first loop.
res := NREVERSE acc
- if BOUNDP '$reportUndo and $reportUndo then reportUndo res
+ if $reportUndo then reportUndo res
res
reportUndo acc ==
diff --git a/src/interp/i-toplev.boot b/src/interp/i-toplev.boot
index 27b0cc47..dd8332b5 100644
--- a/src/interp/i-toplev.boot
+++ b/src/interp/i-toplev.boot
@@ -57,6 +57,14 @@ $QuietCommand := NIL
$ProcessInteractiveValue := NIL
$HTCompanionWindowID := NIL
+++ initialize the garbage collection timer
+statisticsInitialization() ==
+)if %hasFeature KEYWORD::GCL
+ SYSTEM::GBC_-TIME 0
+)else
+ nil
+)endif
+
--% Starting the interpreter from LISP
spadpo() ==
diff --git a/src/interp/incl.boot b/src/interp/incl.boot
index 7757c9ad..f32878db 100644
--- a/src/interp/incl.boot
+++ b/src/interp/incl.boot
@@ -1,6 +1,6 @@
-- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
-- All rights reserved.
--- Copyright (C) 2007, Gabriel Dos Reis
+-- Copyright (C) 2007-2008, Gabriel Dos Reis
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -112,8 +112,13 @@ incCommands :=
'"elseif" , _
'"else" , _
'"endif" ]
-
+
+++ when non-nil, an integer that indicates the current line number.
+$inputLineNumber := nil
+
incClassify(s) ==
+ $inputLineNumber = 0 and incPrefix?('"#_!",0,s) =>
+ [true,0,'"magicNumber"]
not incCommand? s => [false,0, '""]
i := 1; n := #s
while i < n and s.i = char " " repeat i := i + 1
@@ -267,6 +272,7 @@ Rest s==>incLude (eb,CDR ss,lno,ufos,states)
incLude1 (:z) ==
[eb, ss, ln, ufos, states]:=z
+ $inputLineNumber := ln
lno := ln+1
state := states.0
@@ -385,7 +391,10 @@ incLude1 (:z) ==
StreamNil)
cons(xlOK(eb,str,lno,ufos.0),
incLude(eb,CDR ss,lno,ufos,rest states))
-
+
+ info.2 = '"magicNumber" =>
+ Rest s
+
cons(xlCmdBug(eb, str, lno,ufos), StreamNil)
--% Message handling for the source includer
diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot
index 215020e3..1ed386db 100644
--- a/src/interp/msgdb.boot
+++ b/src/interp/msgdb.boot
@@ -1,6 +1,6 @@
-- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
-- All rights reserved.
--- Copyright (C) 2007, Gabriel Dos Reis.
+-- Copyright (C) 2007-2008, Gabriel Dos Reis.
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -305,6 +305,7 @@ throwPatternMsg(key,args) ==
sayMSG '" "
if $testingSystem then sayMSG $testingErrorPrefix
sayPatternMsg(key,args)
+ countError()
spadThrow()
sayKeyedMsgAsTeX(key, args) ==
@@ -354,6 +355,7 @@ throwKeyedMsg1(key,args) ==
sayMSG '" "
if $testingSystem then sayMSG $testingErrorPrefix
sayKeyedMsg(key,args)
+ countError()
spadThrow()
throwListOfKeyedMsgs(descKey,descArgs,l) ==
@@ -368,6 +370,7 @@ throwListOfKeyedMsgs(descKey,descArgs,l) ==
for [key,args] in l for i in 1.. repeat
n := STRCONC(object2String i,'".")
sayKeyedMsg(key,[n,:args])
+ countError()
spadThrow()
-- breakKeyedMsg is like throwKeyedMsg except that the user is given
@@ -459,6 +462,7 @@ throwKeyedMsgFromDb(key,args,dbName) ==
sayMSG '" "
if $testingSystem then sayMSG $testingErrorPrefix
sayKeyedMsgFromDb(key,args,dbName)
+ countError()
spadThrow()
queryUserKeyedMsg(key,args) ==
@@ -558,6 +562,7 @@ throwKeyedMsgCannotCoerceWithValue(val,t1,t2) ==
null (val' := coerceInteractive(objNew(val,t1),$OutputForm)) =>
throwKeyedMsg("S2IC0002",[t1,t2])
val' := objValUnwrap(val')
+ countError()
throwKeyedMsg("S2IC0003",[t1,t2,val'])
--% Some Standard Message Printing Functions
diff --git a/src/interp/obey.lisp b/src/interp/obey.lisp
index 1cc2b720..f7973dec 100644
--- a/src/interp/obey.lisp
+++ b/src/interp/obey.lisp
@@ -1,6 +1,6 @@
;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
;; All rights reserved.
-;; Copyright (C) 2007, Gabriel Dos Reis.
+;; Copyright (C) 2007-2008, Gabriel Dos Reis.
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@
#+ (and :lucid :unix)
(defun OBEY (S)
- (system:run-aix-program (make-absolute-filename "/lib/obey")
+ (system:run-aix-program (|makeAbsoluteFilename| "/lib/obey")
:arguments (list "-c" S)))
#+ (and :lucid :unix)
diff --git a/src/interp/patches.lisp b/src/interp/patches.lisp
index 822b7b52..8a882005 100644
--- a/src/interp/patches.lisp
+++ b/src/interp/patches.lisp
@@ -203,7 +203,7 @@
(|resetWorkspaceVariables|))
(setq |$specialCharacters| |$plainRTspecialCharacters|)
- (load (make-absolute-filename "lib/interp/obey"))
+ (load (|makeAbsoluteFilename| "lib/interp/obey"))
(system:disksave filename :restart-function restart-hook :full-gc t))
#+:Lucid (define-function 'user::save-system #'boot::save-system)
(defun |undoINITIALIZE| () ())
diff --git a/src/interp/slam.boot b/src/interp/slam.boot
index 312dab36..0bc23423 100644
--- a/src/interp/slam.boot
+++ b/src/interp/slam.boot
@@ -241,7 +241,8 @@ compileRecurrenceRelation(op,nam,argl,junk,[body,sharpArg,n,:initCode]) ==
["ELT",["LIST",:initCode],["QSDIFFERENCE",n,sharpArg]]]
phrase5:= ['(QUOTE T),['recurrenceError,MKQ op,sharpArg]]
['PROGN,:preset,['COND,phrase1,phrase2,phrase3,phrase4,phrase5]]
- sayKeyedMsg("S2IX0001",[op])
+ if $verboseInterprerter then
+ sayKeyedMsg("S2IX0001",[op])
compileInteractive computeFunction
compileInteractive mainFunction
cacheType:= 'recurrence
diff --git a/src/interp/spad.lisp b/src/interp/spad.lisp
index 1ddb46dc..e8ceeec2 100644
--- a/src/interp/spad.lisp
+++ b/src/interp/spad.lisp
@@ -52,7 +52,6 @@
(defvar |$formalArgList| nil "checked in compSymbol")
(defvar |$newCompAtTopLevel| nil "if t uses new compiler")
(defvar |$doNotCompileJustPrint| nil "switch for compile")
-(defvar |$PrintCompilerMessageIfTrue| t)
(defvar |$Rep| '|$Rep| "should be bound to gensym? checked in coerce")
;; the following initialization of $ must not be a defvar
;; since that make $ special
diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot
index 8cc54fad..f2fe5d7f 100644
--- a/src/interp/sys-driver.boot
+++ b/src/interp/sys-driver.boot
@@ -1,6 +1,4 @@
--- Copyright (C) 2007 Gabriel Dos Reis
--- All rights reserved.
--- Copyright (C) 2007, Gabriel Dos Reis.
+-- Copyright (C) 2007-2008 Gabriel Dos Reis
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -41,11 +39,32 @@
import '"boot-pkg"
)package "BOOT"
+++ true means try starting an open server
+$openServerIfTrue := true
+
+++ the name of the spad server socket
+$SpadServerName == '"/tmp/.d"
+
+++ true means that the core executable acts as remote server.
+$SpadServer := false
+
+++ if true, then the interpreter informs about code generation, etc.
+$verboseInterprerter := true
+
+$PrintCompilerMessageIfTrue := true
+
+
+++ Initialization routine run by the core system before handing off
+++ to the interpreter or compiler.
+++ ??? This part is still in flux.
AxiomCore::%sysInit() ==
SETQ(_*PACKAGE_*, FIND_-PACKAGE '"BOOT")
+ initMemoryConfig()
+)if %hasFeature KEYWORD::GCL
+ SETQ(COMPILER::_*COMPILE_-VERBOSE_*,false)
+ SETQ(COMPILER::_*SUPPRESS_-COMPILER_-WARNINGS_*,true)
+ SETQ(COMPILER::_*SUPPRESS_-COMPILER_-NOTES_*,true)
+)endif
+++ Returns the root directory of the running system.
@@ -74,3 +93,137 @@ stdStreamIsTerminal fd ==
0
)endif
+
+++ Load list of exposed categories, domains, and packages.
+++ User-specified list takes precedence over system wide list.
+loadExposureGroupData() ==
+ LOAD('"./exposed", KEYWORD::VERBOSE,false,
+ KEYWORD::IF_-DOES_-NOT_-EXIST,nil) => "done"
+ LOAD(CONCAT(systemRootDirectory(),'"algebra/exposed"),
+ KEYWORD::VERBOSE,false,KEYWORD::IF_-DOES_-NOT_-EXIST,nil) => "done"
+ "failed"
+
+++
+REROOT: () -> %Thing
+REROOT() ==
+ $DIRECTORY_-LIST := MAPCAR(function makeAbsoluteFilename,
+ $RELATIVE_-DIRECTORY_-LIST)
+ $LIBRARY_-DIRECTORY_-LIST := MAPCAR(function makeAbsoluteFilename,
+ $RELATIVE_-LIBRARY_-DIRECTORY_-LIST)
+ $defaultMsgDatabaseName := PATHNAME
+ makeAbsoluteFilename '"share/msgs/s2-us.msgs"
+ $msgDatabaseName := nil
+
+initMemoryConfig: () -> %Thing
+initMemoryConfig() ==
+)if %hasFeature KEYWORD::GCL
+ SYSTEM::ALLOCATE("CONS",500)
+ SYSTEM::ALLOCATE("FIXNUM",200)
+ SYSTEM::ALLOCATE("SYMBOL",500)
+ SYSTEM::ALLOCATE("PACKAGE",3)
+ SYSTEM::ALLOCATE("ARRAY",400)
+ SYSTEM::ALLOCATE("STRING",500)
+ SYSTEM::ALLOCATE("CFUN",100)
+ SYSTEM::ALLOCATE_-CONTIGUOUS_-PAGES 3000
+ SYSTEM::ALLOCATE_-RELOCATABLE_-PAGES 1000
+ SYSTEM::SET_-HOLE_-SIZE 2000
+)else
+ nil
+)endif
+
+++
+RESTART() ==
+ IN_-PACKAGE '"BOOT" -- ??? is this still necessary?
+ -- ??? Ideally, we should not be calling AxiomCore::topLevel.
+ -- ??? Rather, we should be called by that function. Therefore
+ -- ??? it currently serves only for option processing and we cannot
+ -- ??? do any substantial work if we call from it.
+ AxiomCore::topLevel()
+ REROOT()
+)if %hasFeature KEYWORD::GCL
+ SYSTEM::GBC_-TIME 0
+)endif
+ if $openServerIfTrue and FBOUNDP "openServer" then
+ os := openServer $SpadServerName
+ if ZEROP os then
+ $openServerIfTrue := false
+ $SpadServer := true
+ $IOindex := 1
+ $InteractiveFrame := makeInitialModemapFrame()
+ loadExposureGroupData()
+ initHist()
+ initializeInterpreterFrameRing()
+ if $displayStartMsgs then
+ spadStartUpMsgs()
+ $currentLine := nil
+ RESTART0()
+ readSpadProfileIfThere()
+ spad()
+
+
+++ ??? Rework this
+SPAD_-SAVE(file) ==
+ SETQ($SpadServer,false)
+ SETQ($openServerIfTrue,true)
+)if %hasFeature KEYWORD::GCL
+ SYSTEM::SAVE_-SYSTEM file
+)else
+ fatalError '"don't know how to same image"
+)endif
+
+
+SET_-RESTART_-HOOK() ==
+)if %hasFeature KEYWORD::GCL
+ SETQ(SYSTEM::_*TOP_-LEVEL_-HOOK_*,"RESTART")
+)endif
+ "RESTART"
+
+++ execute Spad script
+executeSpadScript(progname,options,file) ==
+ REROOT()
+ $IOindex := 1
+ $InteractiveFrame := makeInitialModemapFrame()
+ loadExposureGroupData()
+ initHist()
+ initializeInterpreterFrameRing()
+ $currentLine := nil
+ RESTART0()
+ $BOOT := NIL
+ $NEWSPAD := true
+ $SPAD := true
+ -- $EchoLines := false
+ -- ECHO_-META : fluid := false
+ -- $verboseInterprerter := false
+ -- $ProcessInteractiveValue := true
+ CATCH($intCoerceFailure,
+ CATCH($intSpadReader,read [file]))
+ coreQuit (errorCount()> 0 => 1; 0)
+
+associateRequestWithFileType(Option '"script", '"input",
+ function executeSpadScript)
+
+++ compiler Spad Library File.
+compileSpadLibrary(progname,options,file) ==
+ REROOT()
+ $IOindex := 1
+ $InteractiveFrame := makeInitialModemapFrame()
+ loadExposureGroupData()
+ initHist()
+ initializeInterpreterFrameRing()
+ $currentLine := nil
+ RESTART0()
+ $BOOT := NIL
+ $NEWSPAD := true
+ $SPAD := true
+ $EchoLines := false
+ ECHO_-META : fluid := false
+ $verboseInterprerter := false
+ $ProcessInteractiveValue := true
+ CATCH($intTopLevel,
+ CATCH("SpadCompileItem",
+ CATCH($intSpadReader,compiler [file])))
+ coreQuit (errorCount()> 0 => 1; 0)
+
+associateRequestWithFileType(Option '"compile", '"spad",
+ function compileSpadLibrary)
+
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index 727721f0..ab20480b 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -115,3 +115,20 @@ rassoc(x,y) ==
x = rest first y => first first y
rassoc(x,rest y)
+++ Reclaim unreachable objects.
+RECLAIM() ==
+)if %hasFeature KEYWORD::GCL
+ SI::GBC true
+)elseif %hasFeature KEYWORD::SBCL
+ SB_-EXT::GC()
+)elseif %hasFeature KEYWORD::CLISP
+ EXT::GC()
+)else
+ fatalError '"don't know how to collect"
+)endif
+
+++
+makeAbsoluteFilename: %String -> %String
+makeAbsoluteFilename name ==
+ CONCATENATE("STRING",systemRootDirectory(),name)
+
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index ff9af38b..fe54e013 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -1,6 +1,6 @@
;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
;; All rights reserved.
-;; Copyright (C) 2007, Gabriel Dos Reis.
+;; Copyright (C) 2007-2008, Gabriel Dos Reis.
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,7 @@
(in-package "BOOT")
(export '($directory-list $current-directory reroot
- make-absolute-filename |$msgDatabaseName| |$defaultMsgDatabaseName|))
+ |makeAbsoluteFilename| |$msgDatabaseName| |$defaultMsgDatabaseName|))
(defun our-write-date (file) (and #+kcl (probe-file file)
(file-write-date file)))
@@ -254,7 +254,7 @@
(defun make-tags-file ()
#+:gcl (system:chdir "/tmp")
#-:gcl (obey (concatenate 'string "cd " "/tmp"))
- (obey (concat "etags " (make-absolute-filename "../../src/interp/*.lisp")))
+ (obey (concat "etags " (|makeAbsoluteFilename| "../../src/interp/*.lisp")))
(spadtags-from-directory "../../src/interp" "boot")
(obey "cat /tmp/boot.TAGS >> /tmp/TAGS"))
@@ -564,12 +564,6 @@
(defun build-interpsys (load-files translate-files asauto-files)
(reroot)
- #+:AKCL
- (init-memory-config :cons 500 :fixnum 200 :symbol 500 :package 8
- :array 400 :string 500 :cfun 100 :cpages 1000
- :rpages 1000 :hole 2000)
- #+:AKCL
- (setq compiler::*suppress-compiler-notes* t)
(mapcar #'|AxiomCore|::|importModule| load-files)
(|resetWorkspaceVariables|)
(|initHist|)
@@ -578,12 +572,10 @@
(interpopen)
(create-initializers)
(|start| :fin)
-#+:CCL
- (resethashtables)
(setq *load-verbose* nil)
(|setBootAutloadProperties| translate-functions translate-files)
(|setBootAutloadProperties| asauto-functions asauto-files)
- (setf (symbol-function 'boot::|addConsDB|) #'identity)
+ (setf (symbol-function '|addConsDB|) #'identity)
(resethashtables) ; the databases into core, then close the streams
)
diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp
index e422fa18..b70d317e 100644
--- a/src/interp/vmlisp.lisp
+++ b/src/interp/vmlisp.lisp
@@ -1,6 +1,6 @@
;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
;; All rights reserved.
-;; Copyright (C) 2007, Gabriel Dos Reis.
+;; Copyright (C) 2007-2008, Gabriel Dos Reis.
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
@@ -1919,11 +1919,11 @@
#+(and :Lucid (not :ibm/370))
(defun OBEY (S)
- (system::run-aix-program (make-absolute-filename "/lib/obey")
+ (system::run-aix-program (|makeAbsoluteFilename| "/lib/obey")
:arguments (list "-c" S)))
#+:cmulisp
(defun OBEY (S)
- (ext:run-program (make-absolute-filename "/lib/obey")
+ (ext:run-program (|makeAbsoluteFilename| "/lib/obey")
(list "-c" S) :input t :output t))
#+(OR IBCL KCL :CCL)
(defun OBEY (S) (SYSTEM S))
diff --git a/src/sman/Makefile.in b/src/sman/Makefile.in
index 23e8a9ea..d751da48 100644
--- a/src/sman/Makefile.in
+++ b/src/sman/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, Gabriel Dos Reis.
+# Copyright (C) 2007-2008, Gabriel Dos Reis.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,7 @@ spadclient_LDADD = $(libspad_la) @axiom_c_runtime_extra@
spadclient_DEPENDENCIES =
sman_SOURCES = sman.c
-sman_objects = $(sman_SOURCES:.c=.lo)
+sman_objects = $(sman_SOURCES:.c=.lo) $(top_builddir)/src/driver/utils.lo
sman_LDADD = $(libspad_la) @axiom_c_runtime_extra@
sman_DEPENDENCIES =
@@ -81,7 +81,8 @@ stamp: $(OUTLIB)/session$(EXEEXT) \
.PRECIOUS: %.lo %.obj
%.lo: %.c
- $(COMPILE) ${CCF} -o $@ $(axiom_includes) -I$(srcdir) $<
+ $(COMPILE) ${CCF} -o $@ $(axiom_includes) -I$(srcdir) \
+ -I$(top_srcdir)/src/driver $<
${OUTLIB}/session$(EXEEXT): $(session_objects) $(session_DEPENDENCIES)
$(LINK) -o $@ $(session_objects) $(session_LDADD) ${LDF}
diff --git a/src/sman/sman.c b/src/sman/sman.c
index 5241f542..6b68f76e 100644
--- a/src/sman/sman.c
+++ b/src/sman/sman.c
@@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _SMAN_C
+#include "axiom-c-macros.h"
#include <stdlib.h>
#include <unistd.h>
@@ -48,7 +48,6 @@
#include <sys/wait.h>
#include <signal.h>
-#include "axiom-c-macros.h"
#include "com.h"
#include "bsdsignal.h"
@@ -57,7 +56,40 @@
#include "bsdsignal.H1"
#include "sockio-c.H1"
#include "openpty.H1"
-#include "sman.H1"
+#include "utils.h"
+
+static void process_arguments(openaxiom_command*, int, char**);
+static int should_I_clef(void);
+static int in_X(void);
+static void set_up_defaults(void);
+static void process_options(openaxiom_command*, int, char**);
+static void death_handler(int);
+static void sman_catch_signals(void);
+static void fix_env(char** , int);
+static void init_term_io(void);
+static char* strPrefix(char* , char*);
+static void check_spad_proc(char* , char*);
+static void clean_up_old_sockets(void);
+static SpadProcess* fork_you(int);
+static void exec_command_env(char* , char**);
+static SpadProcess* spawn_of_hell(char* , int);
+static void start_the_spadclient(void);
+static void start_the_local_spadclient(void);
+static void start_the_session_manager(void);
+static void start_the_hypertex(void);
+static void start_the_graphics(void);
+static void fork_Axiom(void);
+static void start_the_Axiom(char**);
+static void clean_up_sockets(void);
+static void clean_hypertex_socket(void);
+static void read_from_spad_io(int);
+static void read_from_manager(int);
+static void manage_spad_io(int);
+static void init_spad_process_list(void);
+static SpadProcess* find_child(int);
+static void kill_all_children(void);
+static void clean_up_terminal(void);
+static void monitor_children(void);
char *ws_path; /* location of the core executable */
int start_clef; /* start clef under spad */
@@ -118,9 +150,10 @@ struct termios childbuf; /* terminal structure for user i/o */
int death_signal = 0;
static void
-process_arguments(int argc,char ** argv)
+process_arguments(openaxiom_command* command, int argc,char ** argv)
{
int arg;
+ int other = 0;
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-noclef") == 0)
start_clef = 0;
@@ -142,8 +175,6 @@ process_arguments(int argc,char ** argv)
start_local_spadclient = 0;
else if (strcmp(argv[arg], "-noiw") == 0)
start_spadclient = 0;
- else if (strcmp(argv[arg], "-ws") == 0)
- ws_path = argv[++arg];
else if (strcmp(argv[arg], "-comp") == 0)
ws_path = "$AXIOM/etc/images/comp";
else if (strcmp(argv[arg], "-nox") == 0)
@@ -154,33 +185,27 @@ process_arguments(int argc,char ** argv)
start_ht = 0;
start_graphics = 0;
}
- else if (strcmp(argv[arg], "-grprog") == 0)
- GraphicsProgram = argv[++arg];
- else if (strcmp(argv[arg], "-htprog") == 0)
- HypertexProgram = argv[++arg];
else if (strcmp(argv[arg], "-clefprog") == 0) {
strcpy(ClefCommandLine,argv[++arg]);
ClefProgram =
strcat(ClefCommandLine, " -f $AXIOM/lib/command.list -e ");
}
- else if (strcmp(argv[arg], "-sessionprog") == 0)
- SessionManagerProgram = argv[++arg];
- else if (strcmp(argv[arg], "-clientprog") == 0)
- SpadClientProgram = argv[++arg];
else if (strcmp(argv[arg], "-rm") == 0)
MakeRecordFile = argv[++arg];
else if (strcmp(argv[arg], "-rv") == 0)
VerifyRecordFile = argv[++arg];
else if (strcmp(argv[arg], "-paste") == 0)
PasteFile = argv[++arg];
- else {
- fprintf(stderr, "Usage: sman <-clef|-noclef> \
-<-gr|-nogr> <-ht|-noht> <-iw|-noiw> <-nox> <-comp> <-ws spad_workspace> \
-<-grprog path> <-htprog path> <-clefprog path> <-sessionprog path> \
-<-clientprog path>\n");
- exit(-1);
- }
+ else
+ argv[++other] = argv[arg];
}
+
+ if (other > 0)
+ ++other;
+
+ command->core_argv = argv;
+ command->core_argc = other;
+ argv[++other] = NULL;
}
static int
@@ -209,10 +234,10 @@ set_up_defaults(void)
}
static void
-process_options(int argc, char **argv)
+process_options(openaxiom_command* command, int argc, char **argv)
{
set_up_defaults();
- process_arguments(argc, argv);
+ process_arguments(command, argc, argv);
}
static void
@@ -717,9 +742,11 @@ monitor_children(void)
int
main(int argc, char *argv[],char *envp[])
{
- bsdSignal(SIGINT, SIG_IGN,RestartSystemCalls);
- process_options(argc, argv);
+ openaxiom_command command = { };
+ command.root_dir = openaxiom_get_systemdir(argc, argv);
+ process_options(&command, argc, argv);
+ bsdSignal(SIGINT, SIG_IGN,RestartSystemCalls);
init_term_io();
init_spad_process_list();
start_the_Axiom(envp);