X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-extensions.lisp;h=6a95f383c55c6f99d70d766eb7e2ce667e0a1302;hb=bfe145acc01eb7a43790173db4f08610ae9cb07a;hp=065f5694c562075dccc16aecd91c82ea2450a674;hpb=c41cb4c87eae7b04f844dca5f7edb5086c5d2d68;p=sbcl.git diff --git a/src/code/early-extensions.lisp b/src/code/early-extensions.lisp index 065f569..6a95f38 100644 --- a/src/code/early-extensions.lisp +++ b/src/code/early-extensions.lisp @@ -798,27 +798,10 @@ (defun %failed-aver (expr-as-string) (bug "~@" expr-as-string)) -;;; We need a definition of BUG here for the host compiler to be able -;;; to deal with BUGs in sbcl. This should never affect an end-user, -;;; who will pick up the definition that signals a CONDITION of -;;; condition-class BUG; however, this is not defined on the host -;;; lisp, but for the target. SBCL developers sometimes trigger BUGs -;;; in their efforts, and it is useful to get the details of the BUG -;;; rather than an undefined function error. - CSR, 2002-04-12 -#+sb-xc-host (defun bug (format-control &rest format-arguments) - (error 'simple-error - :format-control "~@< ~? ~:@_~?~:>" - :format-arguments `(,format-control - ,format-arguments - "~@.~:@>" - ()))) + (error 'bug + :format-control format-control + :format-arguments format-arguments)) (defmacro enforce-type (value type) (once-only ((value value)) @@ -1097,7 +1080,7 @@ which can be found at .~:@>" (let ((it ,test)) (declare (ignorable it)),@body) (acond ,@rest)))))) -;;; (binding* ({(name initial-value [flag])}*) body) +;;; (binding* ({(names initial-value [flag])}*) body) ;;; FLAG may be NIL or :EXIT-IF-NULL ;;; ;;; This form unites LET*, MULTIPLE-VALUE-BIND and AWHEN. @@ -1115,7 +1098,15 @@ which can be found at .~:@>" (symbol (values (list names) nil)) (list - (values names nil))) + (collect ((new-names) (ignorable)) + (dolist (name names) + (when (eq name nil) + (setq name (gensym)) + (ignorable name)) + (new-names name)) + (values (new-names) + (when (ignorable) + `((declare (ignorable ,@(ignorable))))))))) (setq form `(multiple-value-bind ,names ,initial-value ,@declarations @@ -1138,3 +1129,31 @@ which can be found at .~:@>" (defun promise-ready-p (promise) (or (not (consp promise)) (car promise))) + +;;; toplevel helper +(defmacro with-rebound-io-syntax (&body body) + `(%with-rebound-io-syntax (lambda () ,@body))) + +(defun %with-rebound-io-syntax (function) + (declare (type function function)) + (let ((*package* *package*) + (*print-array* *print-array*) + (*print-base* *print-base*) + (*print-case* *print-case*) + (*print-circle* *print-circle*) + (*print-escape* *print-escape*) + (*print-gensym* *print-gensym*) + (*print-length* *print-length*) + (*print-level* *print-level*) + (*print-lines* *print-lines*) + (*print-miser-width* *print-miser-width*) + (*print-pretty* *print-pretty*) + (*print-radix* *print-radix*) + (*print-readably* *print-readably*) + (*print-right-margin* *print-right-margin*) + (*read-base* *read-base*) + (*read-default-float-format* *read-default-float-format*) + (*read-eval* *read-eval*) + (*read-suppress* *read-suppress*) + (*readtable* *readtable*)) + (funcall function)))