(> SPEED DEBUG). (This is an incompatible change because there are
programs which relied on the old CMU-CL-style behavior to optimize
away their unbounded recursion which will now die of stack overflow.)
+ * new syntactic sugar for the Unix command line: --load foo.bar is now
+ an alternate notation for --eval '(load "foo.bar")'.
* bug fixes:
** The system now hunts for the C variable "environ" in a more
devious way, to avoid segfaults when the C library version
differs between compile time and run time. (thanks to Christophe
Rhodes)
+ ** INTEGER-valued CATCH tags now work. (thanks to Alexey Dejneka)
* several changes related to debugging:
** suppression of tail recursion, as noted above
** The default implementation of TRACE has changed. :ENCAPSULATE T
More than one --eval option can be used, and all will be executed, in
the order they appear on the command line.
.TP 3
+.B --load <filename>
+This is equivalent to --eval '(load "<filename>")'. The special
+syntax is intended to reduce quoting headaches when invoking SBCL
+from shell scripts.
+.TP 3
.B --noprint
When ordinarily the toplevel "read-eval-print loop" would be executed,
execute a "read-eval loop" instead, i.e. don't print a prompt and
# "lisp -noinit -batch"
# to use an existing CMU CL binary as a cross-compilation host
# when you have weird things in your .cmucl-init file
+# Someday CLISP should work
+# "clisp"
+# but as of sbcl-0.7.1.17, it still doesn't. (SBCL's fault: too much
+# unportable code!)
#
# FIXME: Make a more sophisticated command line parser, probably
# accepting "sh make.sh --xc-host foolisp" instead of the
(let ((sysinit nil) ; value of --sysinit option
(userinit nil) ; value of --userinit option
- (reversed-evals nil) ; values of --eval options, in reverse order
+ (reversed-evals nil) ; values of --eval options, in reverse order; and
+ ; also --load options, translated into --eval
(noprint nil) ; Has a --noprint option been seen?
- (noprogrammer nil) ; Has a --noprogammer option been seen?
+ (noprogrammer nil) ; Has a --noprogrammer option been seen?
(options (rest *posix-argv*))) ; skipping program name
(/show0 "done with outer LET in TOPLEVEL-INIT")
;; READ an --eval string). Make sure that they're handled
;; reasonably. Also, perhaps all errors while parsing the command
;; line should cause the system to QUIT, instead of trying to go
- ;; into the Lisp debugger.
+ ;; into the Lisp debugger, since trying to go into the debugger
+ ;; gets into various annoying issues of where we should go after
+ ;; the user tries to return from the debugger.
;; Parse command line options.
(loop while options do
eval-as-string))
(t
(push eval reversed-evals)))))))
+ ((string= option "--load")
+ (pop-option)
+ (push `(load ,(pop-option)) reversed-evals))
((string= option "--noprint")
(pop-option)
(setf noprint t))
(setf *debugger-hook* 'noprogrammer-debugger-hook-fun
*debug-io* *error-output*))
- ;; FIXME: Verify that errors in init files and/or --eval operations
- ;; lead to reasonable behavior.
-
;; Handle initialization files.
(/show0 "handling initialization files in TOPLEVEL-INIT")
(flet (;; If any of POSSIBLE-INIT-FILE-NAMES names a real file,
(let* ((sbcl-home (posix-getenv "SBCL_HOME"))
(sysinit-truename (if sbcl-home
(probe-init-files sysinit
- (concatenate
- 'string
- sbcl-home
- "/sbclrc"))
+ (concatenate 'string
+ sbcl-home
+ "/sbclrc"))
(probe-init-files sysinit
"/etc/sbclrc"
"/usr/local/etc/sbclrc")))
(error "The HOME environment variable is unbound, ~
so user init file can't be found.")))
(userinit-truename (probe-init-files userinit
- (concatenate
- 'string
- user-home
- "/.sbclrc"))))
+ (concatenate 'string
+ user-home
+ "/.sbclrc"))))
;; We wrap all the pre-REPL user/system customized startup code
;; in a restart.
;; Unix environment errors, e.g. a missing file or a typo on
;; the Unix command line, and you don't need to get into Lisp
;; to debug them, you should just start over and do it right
- ;; at the Unix level. Errors below here are usually errors in
- ;; user Lisp code, and it might be helpful to let the user
- ;; reach the REPL in order to help figure out what's going on.)
+ ;; at the Unix level. Errors below here are generally errors
+ ;; in user Lisp code, and it might be helpful to let the user
+ ;; reach the REPL in order to help figure out what's going
+ ;; on.)
(restart-case
- (flet ((process-init-file (truename)
- (when truename
- (unless (load truename)
- (error "~S was not successfully loaded." truename))
- (flush-standard-output-streams))))
- (process-init-file sysinit-truename)
- (process-init-file userinit-truename)
+ (progn
+ (flet ((process-init-file (truename)
+ (when truename
+ (unless (load truename)
+ (error "~S was not successfully loaded." truename))
+ (flush-standard-output-streams))))
+ (process-init-file sysinit-truename)
+ (process-init-file userinit-truename))
;; Process --eval options.
(/show0 "handling --eval options in TOPLEVEL-INIT")
;;; out the full names. Or even define them in DEF EVEN-FIXNUM-LOWTAG
;;; style so searches like 'def.*even-fixnum-lowtag' can find them.
-;;; tags for the main low-level types, to be stored in the low three
-;;; bits to identify the type of a machine word
+;;; Tags for the main low-level types are stored in the low three
+;;; bits to identify the type of a machine word. Certain constraints
+;;; apply:
+;;; * EVEN-FIXNUM-LOWTAG and ODD-FIXNUM-LOWTAG must be 0 and 4: code
+;;; which shifts left two places to convert raw integers to tagged
+;;; fixnums is ubiquitous.
+;;; * LIST-POINTER-LOWTAG + 4 = OTHER-POINTER-LOWTAG: NIL is both a
+;;; cons and a symbol (at the same address) and depends on this.
+;;; See the definition of SYMBOL in objdef.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
;; The EVAL-WHEN is necessary (at least for Lispworks), because the
;; second DEFENUM uses the value of OTHER-IMMEDIATE-0-LOWTAG, which is
(define-primitive-object (symbol :lowtag other-pointer-lowtag
:widetag symbol-header-widetag
#!-x86 :alloc-trans #!-x86 make-symbol)
+
+ ;; Beware when changing this definition. NIL-the-symbol is defined
+ ;; using this layout, and NIL-the-end-of-list-marker is the cons
+ ;; ( NIL . NIL ), living in the first two slots of NIL-the-symbol
+ ;; (conses have no header). Careful selection of lowtags ensures
+ ;; that the same pointer can be used for both purposes:
+ ;; OTHER-POINTER-LOWTAG is 7, LIST-POINTER-LOWTAG is 3, so if you
+ ;; subtract 3 from (sb-kernel:get-lisp-obj-address 'NIL) you get the
+ ;; first data slot, and if you subtract 7 you get a symbol header.
+
(value :set-trans %set-symbol-value
- :init :unbound)
- #!+x86 (hash)
+ :init :unbound) ;also the CAR of NIL-as-end-of-list
+ (hash) ;the CDR of NIL-as-end-of-list
+
(plist :ref-trans symbol-plist
:set-trans %set-symbol-plist
:init :null)
--- /dev/null
+;;;; miscellaneous tests of symbol properties
+
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; While most of SBCL is derived from the CMU CL system, the test
+;;;; files (like this one) were written from scratch after the fork
+;;;; from CMU CL.
+;;;;
+;;;; This software is in the public domain and is provided with
+;;;; absolutely no warranty. See the COPYING and CREDITS files for
+;;;; more information.
+
+(in-package "CL-USER")
+
+(defun test-symbol (symbol)
+ (setf (symbol-plist symbol) nil)
+ (setf (get symbol 'foo) '(my list))
+ (setf (get symbol 'bar) 10)
+ (setf (get symbol 'baz) t)
+ (assert (eql (get symbol 'bar) 10))
+ (assert (= (length (symbol-plist symbol)) 6))
+ (remprop symbol 'foo)
+ (assert (not (get symbol 'foo))))
+(mapc #'test-symbol '(foo :keyword || t nil))
+;;; In early 0.7 versions on non-x86 ports, setting the property list
+;;; of 'NIL would trash (CDR NIL), due to a screwup in the low-level
+;;; layout of SYMBOL. (There are several low-level punnish tricks used
+;;; to make NIL work both as a cons and as a symbol without requiring
+;;; a lot of conditional branching at runtime.)
+(defparameter *nil-that-the-compiler-cannot-constant-fold* nil)
+(assert (not (car *nil-that-the-compiler-cannot-constant-fold*)))
+(assert (not (cdr *nil-that-the-compiler-cannot-constant-fold*)))
+
+;;; success
+(quit :unix-status 104)