0.8.21.50:
[sbcl.git] / src / code / early-extensions.lisp
index 6a95f38..13638c4 100644 (file)
 ;;;; various operations on names
 
 ;;; Is NAME a legal function name?
+(declaim (inline legal-fun-name-p))
 (defun legal-fun-name-p (name)
   (values (valid-function-name-p name)))
 
      (%failed-aver ,(format nil "~A" expr))))
 
 (defun %failed-aver (expr-as-string)
+  ;; hackish way to tell we're in a cold sbcl and output the
+  ;; message before signallign error, as it may be this is too
+  ;; early in the cold init.
+  (when (find-package "SB!C")
+    (fresh-line)
+    (write-line "failed AVER:")
+    (write-line expr-as-string)
+    (terpri))
   (bug "~@<failed AVER: ~2I~_~S~:>" expr-as-string))
 
 (defun bug (format-control &rest format-arguments)
        (*read-suppress* *read-suppress*)
        (*readtable* *readtable*))
     (funcall function)))
+
+;;; Bind a few "potentially dangerous" printer control variables to
+;;; safe values, respecting current values if possible.
+(defmacro with-sane-io-syntax (&body forms)
+  `(call-with-sane-io-syntax (lambda () ,@forms)))
+
+(defun call-with-sane-io-syntax (function)
+  (declare (type function function))
+  (macrolet ((true (sym)
+               `(and (boundp ',sym) ,sym)))
+    (let ((*print-readably* nil)
+          (*print-level* (or (true *print-level*) 6))
+          (*print-length* (or (true *print-length*) 12)))
+      (funcall function))))