diff options
Diffstat (limited to 'src/lisp')
-rw-r--r-- | src/lisp/ChangeLog | 11 | ||||
-rw-r--r-- | src/lisp/Makefile.in | 14 | ||||
-rw-r--r-- | src/lisp/Makefile.pamphlet | 14 | ||||
-rw-r--r-- | src/lisp/core.lisp.in | 55 |
4 files changed, 75 insertions, 19 deletions
diff --git a/src/lisp/ChangeLog b/src/lisp/ChangeLog index 10c3a1ee..14dc4c84 100644 --- a/src/lisp/ChangeLog +++ b/src/lisp/ChangeLog @@ -1,3 +1,14 @@ +2007-10-10 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * core.lisp.in (|%systemOptions|): New. + (|%systemArguments|): Likewise. + (|$systemInstallationDirectory|): Likewise. + (|$sysOpts|): Likewise. + (|$sysArgs|): Likewise. + (|handleCommandLine|): Tidy. + (|printUsage|): Update. + * Makefile.pamphlet (core.lisp): Instantiate here. + 2007-09-24 Gabriel Dos Reis <gdr@cs.tamu.edu> * core.lisp.in (|handleCommandLine|): Return truthvalue on success. diff --git a/src/lisp/Makefile.in b/src/lisp/Makefile.in index d24514e0..870a838d 100644 --- a/src/lisp/Makefile.in +++ b/src/lisp/Makefile.in @@ -79,9 +79,19 @@ base-lisp$(EXEEXT): core.$(FASLEXT) $(eval_flags) '(load "core")' \ $(eval_flags) '(|AxiomCore|::|link| "$@" (quote nil) (function |AxiomCore|::|topLevel|))' + +axiom_optimize_options = @axiom_optimize_options@ + +edit = sed \ + -e 's|@open_axiom_installdir[@]|$(open_axiom_installdir)|g' \ + -e 's|@axiom_optimize_options[@]|$(axiom_optimize_options)|g' \ + -e 's|@host[@]|$(host)|g' \ + -e 's|@build[@]|$(build)|g' \ + -e 's|@target[@]|$(target)|g' + core.lisp: $(srcdir)/core.lisp.in - cd $(top_builddir) && \ - $(SHELL) ./config.status src/lisp/core.lisp + $(edit) $< > $@.tmp + $(top_srcdir)/config/move-if-change $@.tmp $@ core.$(FASLEXT): core.lisp $(AXIOM_LISP) $(quiet_flags) \ diff --git a/src/lisp/Makefile.pamphlet b/src/lisp/Makefile.pamphlet index aaef2495..76809b71 100644 --- a/src/lisp/Makefile.pamphlet +++ b/src/lisp/Makefile.pamphlet @@ -66,9 +66,19 @@ base-lisp$(EXEEXT): core.$(FASLEXT) $(eval_flags) '(load "core")' \ $(eval_flags) '(|AxiomCore|::|link| "$@" (quote nil) (function |AxiomCore|::|topLevel|))' + +axiom_optimize_options = @axiom_optimize_options@ + +edit = sed \ + -e 's|@open_axiom_installdir[@]|$(open_axiom_installdir)|g' \ + -e 's|@axiom_optimize_options[@]|$(axiom_optimize_options)|g' \ + -e 's|@host[@]|$(host)|g' \ + -e 's|@build[@]|$(build)|g' \ + -e 's|@target[@]|$(target)|g' + core.lisp: $(srcdir)/core.lisp.in - cd $(top_builddir) && \ - $(SHELL) ./config.status src/lisp/core.lisp + $(edit) $< > $@.tmp + $(top_srcdir)/config/move-if-change $@.tmp $@ core.$(FASLEXT): core.lisp $(AXIOM_LISP) $(quiet_flags) \ diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in index 1cdf990c..3a5ef1ee 100644 --- a/src/lisp/core.lisp.in +++ b/src/lisp/core.lisp.in @@ -62,11 +62,15 @@ "warn" "%hasFeature" + "%systemOptions" + "%systemArguments" "$hostPlatform" "$buildPlatform" "$targetPlatform" + "$systemInstallationDirectory" + "getCommandLineArguments" "processCommandLine" "handleCommandLine" @@ -96,6 +100,12 @@ (defconstant |$buildPlatform| "@build@") (defconstant |$targetPlatform| "@target@") +;; The directory that contains the final installation directory, as +;; specified at configuration time (or in exoteric cases, as overriden +;; on the Make command line). +(defconstant |$systemInstallationDirectory| + "@open_axiom_installdir@/") + ;; Lisp compiler optimization settings. (proclaim '(optimize @axiom_optimize_options@)) @@ -144,6 +154,8 @@ ;; Ideally we want to handle ;; --help: just print a help menu and exit ;; --version: Print version information and exit +;; --system=<dir>: specify <dir> as the root directory +;; --sysalg=<dir>: specify <dir> as directory containing algebras ;; --compile: boot or lisp files ;; --translate: boot files ;; --make: boot, lisp, or fasl files @@ -349,6 +361,16 @@ ;; ;; -*- Command Line Arguments -*- + +(defparameter |$sysOpts| nil) +(defparameter |$sysArgs| nil) + +(defun |%systemOptions| () + |$sysOpts|) + +(defun |%systemArguments| () + |$sysArgs|) + ;; ;; Ideally, we would just like to have a traditional command line ;; passing mechanism from the shell to the application. That @@ -445,7 +467,7 @@ (defun |handleCommandLine| (prog-name options args) (when (or options args) - (dolist (opt options t) + (dolist (opt options nil) (cond ((eq (car opt) (|Option| "help")) ; print help, get out of here (|helpHandler| prog-name)) @@ -460,7 +482,8 @@ (opt-name (car opt)) (request (cons opt-name file-type))) (unless (|handleRequest| prog-name request options f) - (return nil))))) + (return nil)))) + (return t)) ;; In general, nothing is to be done for option value ;; specification. However, some specifications may require @@ -482,16 +505,18 @@ ;; ;; Print help screen -(defun |printUsage|(prog-name) +(defun |printUsage| (prog-name) (write-line "usage:") (write-line - (concatenate 'string prog-name " -- options [files]")) + (concatenate 'string prog-name " -- [options] [files]")) (write-line "option:") - (write-line " --help print this message") - (write-line " --compile compile file") - (write-line " --output=OUT set output file to OUT") - (write-line " --load-directory=DIR use DIR as search path for modules") - (write-line " --make create an executable")) + (write-line " --help print this message") + (write-line " --system=<dir> set <dir> to the root directory of running system") + (write-line " --sysalg=<dir> set <dir> to the algebra directory of running system") + (write-line " --compile compile file") + (write-line " --output=<out> set output file to <out>") + (write-line " --load-directory=<dir> use <dir> as search path for modules") + (write-line " --make create an executable")) (defun |helpHandler|(prog-name) (|printUsage| prog-name) @@ -633,13 +658,13 @@ ;; a filename. (multiple-value-bind (options args) (|processCommandLine| (cdr command-args) nil) + + (setq |$sysOpts| options) + (setq |$sysArgs| args) - ;; Push into the system's preferred namespace. Ideally, this should - ;; be run of initialization code if needed. However, a curiously - ;; nasty bug in GCL prevents us from expressing the natural semantics - ;; in a clean way. - (when (boundp '|$sysScope|) - (setq *package* (find-package (symbol-value '|$sysScope|)))) + ;; Run the system-specific initialization. + (when (fboundp '|%sysInit|) + (funcall '|%sysInit|)) (when (|handleCommandLine| (car command-args) options args) (|coreQuit| (if (> (|errorCount|) 0) 1 0)))))) |