Raymond Toy pushed to branch master at cmucl / cmucl
Commits: d9090138 by Raymond Toy at 2016-09-18T21:09:13-07:00 Fix #29: Update processing of command line
Several related changes here.
o If :process-command-line is NIL, *command-line-strings* and *command-line-application-arguments* weren't getting updated. They should get updated so that the resulting core can get updated command line options instead of using the values dumped with the core. The command line switch demons are still not run, as before. o Add a :quiet option as if -quiet were given.
- - - - - 3d18025d by Raymond Toy at 2016-10-01T17:45:23+00:00 Merge branch 'rtoy-29-process-command-line' into 'master'
Fix #29: Update processing of command line
Several related changes here.
- If `:process-command-line` is NIL, `*command-line-strings*` and `*command-line-application-arguments*` weren't getting updated. They should get updated so that the resulting core can get updated command line options instead of using the values dumped with the core. The command line switch demons are still not run, as before. - Add a `:quiet` option as if `-quiet` were given.
See merge request !13 - - - - -
3 changed files:
- src/code/commandline.lisp - src/code/save.lisp - src/i18n/locale/cmucl.pot
Changes:
===================================== src/code/commandline.lisp ===================================== --- a/src/code/commandline.lisp +++ b/src/code/commandline.lisp @@ -72,7 +72,7 @@ ;;;; Processing the command strings.
-(defun process-command-strings () +(defun process-command-strings (init-command-switches-p) (setq *command-line-words* nil) (setq *command-line-switches* nil) (let ((cmd-strings lisp::lisp-command-line-list) @@ -103,7 +103,7 @@ (return-from process-command-strings nil))
;; Set command line switches. - ;; + ;; (loop (unless str (return (setf *command-line-switches* @@ -119,14 +119,16 @@ (let (word-list) (loop (unless str - (push (make-cmd-switch switch value (nreverse word-list)) - *command-line-switches*) + (when init-command-switches-p + (push (make-cmd-switch switch value (nreverse word-list)) + *command-line-switches*)) (return nil)) (unless (zerop (length (the simple-string str))) (when (char= #- (schar str 0)) - (push (make-cmd-switch switch value (nreverse word-list)) - *command-line-switches*) + (when init-command-switches-p + (push (make-cmd-switch switch value (nreverse word-list)) + *command-line-switches*)) (when (and (= (length str) 2) (char= #- (schar str 1))) ;; Gather up everything after --, and exit. @@ -134,7 +136,7 @@ (setf str nil)) (return nil)) (push str word-list)) - (setq str (pop cmd-strings)))))))) + (setq str (pop cmd-strings)))))))))
(defun get-command-line-switch (sname) "Accepts the name of a switch as a string and returns the value of
===================================== src/code/save.lisp ===================================== --- a/src/code/save.lisp +++ b/src/code/save.lisp @@ -153,7 +153,8 @@ (process-command-line t) #+:executable (executable nil) - (batch-mode nil)) + (batch-mode nil) + (quiet nil)) "Saves a CMU Common Lisp core image in the file of the specified name. The following keywords are defined:
@@ -191,8 +192,10 @@
:process-command-line If true (the default), process command-line switches via the normal - mechanisms, otherwise ignore all switches (except those processed by the - C startup code). + mechanisms, otherwise ignore all switches (except those processed by + the C startup code). In either case, the command line switches are + saved in *COMMAND-LINE-STRINGS* and + *COMMAND-LINE-APPLICATION-ARGUMENTS*.
:executable If nil (the default), save-lisp will save using the traditional @@ -203,7 +206,14 @@ :batch-mode If nil (the default), then the presence of the -batch command-line switch will invoke batch-mode processing. If true, the produced core - will always be in batch-mode, regardless of any command-line switches." + will always be in batch-mode, regardless of any command-line switches. + + :quiet + If non-NIL, loading, compiling, and GC messages are suppressed. + This is equivalent to setting *load-verbose*, *compile-verbose*, + *compile-print*, *compile-progress*, *require-verbose*, and + *gc-verbose* all to NIL. If NIL (the default), the default + values of these variables are used."
(unless (probe-file (directory-namestring core-file-name)) (error 'simple-file-error @@ -240,8 +250,7 @@ (environment-init) (dolist (f *after-save-initializations*) (funcall f)) (intl::setlocale) - (when process-command-line - (ext::process-command-strings)) + (ext::process-command-strings process-command-line) (setf *editor-lisp-p* nil) (macrolet ((find-switch (name) `(find ,name *command-line-switches* @@ -249,7 +258,8 @@ :test #'(lambda (x y) (declare (simple-string x y)) (string-equal x y))))) - (when (and process-command-line (find-switch "quiet")) + (when (or quiet + (and process-command-line (find-switch "quiet"))) (setq *load-verbose* nil *compile-verbose* nil *compile-print* nil @@ -285,8 +295,9 @@ (ext::invoke-switch-demons *command-line-switches* *command-switch-demons*)) (when (and print-herald - (not (and process-command-line - (find-switch "quiet")))) + (not (or quiet + (and process-command-line + (find-switch "quiet"))))) ;; Don't print the herald if -quiet is given. (print-herald))))) (funcall init-function))
===================================== src/i18n/locale/cmucl.pot ===================================== --- a/src/i18n/locale/cmucl.pot +++ b/src/i18n/locale/cmucl.pot @@ -6713,8 +6713,10 @@ msgid "" "\n" " :process-command-line\n" " If true (the default), process command-line switches via the normal\n" -" mechanisms, otherwise ignore all switches (except those processed by the\n" -" C startup code).\n" +" mechanisms, otherwise ignore all switches (except those processed by\n" +" the C startup code). In either case, the command line switches are\n" +" saved in *COMMAND-LINE-STRINGS* and\n" +" *COMMAND-LINE-APPLICATION-ARGUMENTS*.\n" "\n" " :executable\n" " If nil (the default), save-lisp will save using the traditional\n" @@ -6725,7 +6727,14 @@ msgid "" " :batch-mode\n" " If nil (the default), then the presence of the -batch command-line\n" " switch will invoke batch-mode processing. If true, the produced core\n" -" will always be in batch-mode, regardless of any command-line switches." +" will always be in batch-mode, regardless of any command-line switches.\n" +"\n" +" :quiet\n" +" If non-NIL, loading, compiling, and GC messages are suppressed.\n" +" This is equivalent to setting *load-verbose*, *compile-verbose*,\n" +" *compile-print*, *compile-progress*, *require-verbose*, and\n" +" *gc-verbose* all to NIL. If NIL (the default), the default\n" +" values of these variables are used." msgstr ""
#: src/code/save.lisp
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/1b8f72ed832bba4c49187a0ee...