0.8.16.6:
[sbcl.git] / src / code / package.lisp
index 7f67aa6..66c9242 100644 (file)
 ;;;   the entry is unused. If it is one, then it is deleted.
 ;;;   Double-hashing is used for collision resolution.
 
-(sb!xc:deftype hash-vector () '(simple-array (unsigned-byte 8) (*)))
+(def!type hash-vector () '(simple-array (unsigned-byte 8) (*)))
 
-(sb!xc:defstruct (package-hashtable
-                   (:constructor %make-package-hashtable
-                                 (table hash size &aux (free size)))
-                   (:copier nil))
+(def!struct (package-hashtable
+            (:constructor %make-package-hashtable
+                          (table hash size &aux (free size)))
+            (:copier nil))
   ;; The g-vector of symbols.
   (table (missing-arg) :type simple-vector)
   ;; The i-vector of pname hash values.
@@ -73,7 +73,7 @@
   #!+sb-doc
   "the standard structure for the description of a package"
   ;; the name of the package, or NIL for a deleted package
-  (%name nil :type (or simple-string null))
+  (%name nil :type (or simple-base-string null))
   ;; nickname strings
   (%nicknames () :type list)
   ;; packages used by this package
   ;; shadowing symbols
   (%shadowing-symbols () :type list)
   ;; documentation string for this package
-  (doc-string nil :type (or simple-string null)))
+  (doc-string nil :type (or simple-base-string null))
+  ;; package locking
+  #!+sb-package-locks
+  (lock nil :type boolean)
+  #!+sb-package-locks
+  (%implementation-packages nil :type list))
 \f
 ;;;; iteration macros
 
   "DO-SYMBOLS (VAR [PACKAGE [RESULT-FORM]]) {DECLARATION}* {TAG | FORM}*
    Executes the FORMs at least once for each symbol accessible in the given
    PACKAGE with VAR bound to the current symbol."
-  (multiple-value-bind (body decls) (parse-body body-decls nil)
+  (multiple-value-bind (body decls)
+      (parse-body body-decls :doc-string-allowed nil)
     (let ((flet-name (gensym "DO-SYMBOLS-")))
       `(block nil
         (flet ((,flet-name (,var)
   "DO-EXTERNAL-SYMBOLS (VAR [PACKAGE [RESULT-FORM]]) {DECL}* {TAG | FORM}*
    Executes the FORMs once for each external symbol in the given PACKAGE with
    VAR bound to the current symbol."
-  (multiple-value-bind (body decls) (parse-body body-decls nil)
+  (multiple-value-bind (body decls)
+      (parse-body body-decls :doc-string-allowed nil)
     (let ((flet-name (gensym "DO-SYMBOLS-")))
       `(block nil
         (flet ((,flet-name (,var)
   "DO-ALL-SYMBOLS (VAR [RESULT-FORM]) {DECLARATION}* {TAG | FORM}*
    Executes the FORMs once for each symbol in every package with VAR bound
    to the current symbol."
-  (multiple-value-bind (body decls) (parse-body body-decls nil)
+  (multiple-value-bind (body decls)
+      (parse-body body-decls :doc-string-allowed nil)
     (let ((flet-name (gensym "DO-SYMBOLS-")))
       `(block nil
         (flet ((,flet-name (,var)
              (error 'simple-program-error
                     :format-control
                     "At least one of :INTERNAL, :EXTERNAL, or ~
-                     :INHERITED must be supplied."))
+                      :INHERITED must be supplied."))
           ,(dolist (symbol symbol-types)
              (unless (member symbol '(:internal :external :inherited))
                (error 'program-error
                                                  (car ,',packages)))
                                              :inherited)))))
                              (setf ,',counter
-                                   (position-if #',',inherited-symbol-p
-                                                (the hash-vector
-                                                  ,',hash-vector)
-                                                :start (if ,',counter
-                                                           (1+ ,',counter)
-                                                           0))))
+                                   (when ,',hash-vector
+                                     (position-if #',',inherited-symbol-p
+                                                  (the hash-vector
+                                                    ,',hash-vector)
+                                                  :start (if ,',counter
+                                                             (1+ ,',counter)
+                                                             0)))))
                            (cond (,',counter
                                   (return-from
                                    ,',BLOCK