0.8.9.39:
authorRudi Schlatte <rudi@constantly.at>
Wed, 14 Apr 2004 08:55:42 +0000 (08:55 +0000)
committerRudi Schlatte <rudi@constantly.at>
Wed, 14 Apr 2004 08:55:42 +0000 (08:55 +0000)
Documentation changes:

* Document run-program

* Create docstrings from contrib modules (see MODULES in Makefile)

  ... include some docstrings in sb-rotate-byte and sb-md5
      documentation to test it.

  ... unloadable contrib modules break docstring generation for now ...

* Frob docstrings slightly: convert SYMBOL-LOOKALIKES to
  @code{symbol-lookalikes}, or @var{symbol-lookalikes} if they're part
  of the arglist.

  ... written in a slightly roundabout (line-based) way that will be
      useful for detecting common itemization / table formatting
      idioms in sbcl's docstrings.

  ... Bug fix: don't downcase docstrings.

contrib/sb-aclrepl/sb-aclrepl.texinfo
contrib/sb-md5/sb-md5.texinfo
contrib/sb-rotate-byte/sb-rotate-byte.texinfo
doc/manual/Makefile
doc/manual/beyond-ansi.texinfo
doc/manual/contrib-modules.texinfo
doc/manual/docstrings.lisp
doc/manual/make-tempfiles.sh
version.lisp-expr

index ef7b1e4..07eb17b 100644 (file)
@@ -7,11 +7,6 @@ The @code{sb-aclrepl} module offers an AllegroCL style Read-Eval-Print
 Loop for SBCL. An AllegroCL style inspector is integrated. Adding an
 AllegroCL style debugger is planned.
 
-@menu
-* Usage::                       
-@end menu
-
-@node Usage
 @subsection Usage
 
 To start @code{sb-aclrepl} as your read-eval-print loop, put the form
@@ -21,6 +16,8 @@ To start @code{sb-aclrepl} as your read-eval-print loop, put the form
 
 in your @file{~/.sbclrc} initialization file.
 
+@subsection Example Initialization
+
 Here's a longer example of a @file{~/.sbclrc} file that shows off
 some of the features of @code{sb-aclrepl}:
 
index 59858b2..5de3f57 100644 (file)
@@ -5,7 +5,11 @@
 The @code{sb-md5} module implements the RFC1321 MD5 Message Digest
 Algorithm.
 
-@comment entry points / docstrings
+@include fun-sb-md5-md5sum-file.texinfo
+
+@include fun-sb-md5-md5sum-sequence.texinfo
+
+@include fun-sb-md5-md5sum-stream.texinfo
 
 @subsection Credits
 
index d599c0d..ff908d1 100644 (file)
@@ -15,4 +15,4 @@ Bitwise rotation is a component of various cryptographic or hashing
 algorithms: MD5, SHA-1, etc.; often these algorithms are specified on
 32-bit rings.  [cite cite cite].
 
-@comment would like to include ROTATE-BYTE's docstring
+@include fun-sb-rotate-byte-rotate-byte.texinfo
index cf0b565..6e1e201 100644 (file)
@@ -12,8 +12,11 @@ HTMLDIR=$(basename $(ROOTFILE))
 # DOCSTRINGDIR has to end with a slash or you lose (it's passed to
 # Lisp's `pathname' function).
 DOCSTRINGDIR="docstrings/"
-# List of package names that documentation will be created for.
-PACKAGES=":COMMON-LISP :SB-ALIEN :SB-DEBUG :SB-EXT :SB-GRAY :SB-MOP :SB-PROFILE :SB-THREAD"
+# List of contrib modules that docstring docs will be created for.
+# FIXME: should check test-passed and not load them.
+MODULES=':sb-md5 :sb-rotate-byte'
+# List of package names that docstring docs will be created for.
+PACKAGES=":COMMON-LISP :SB-ALIEN :SB-DEBUG :SB-EXT :SB-GRAY :SB-MOP :SB-PROFILE :SB-THREAD :SB-MD5 :SB-ROTATE-BYTE"
 
 
 ifeq ($(MAKEINFO),)
@@ -77,7 +80,7 @@ contrib-modules.texinfo: tempfiles-stamp
 docstrings: tempfiles-stamp
 
 tempfiles-stamp:
-       DOCSTRINGDIR=$(DOCSTRINGDIR) sh make-tempfiles.sh
+       DOCSTRINGDIR=$(DOCSTRINGDIR) PACKAGES=$(PACKAGES) MODULES=$(MODULES) sh make-tempfiles.sh
        touch tempfiles-stamp
 
 
index 424217b..82d824f 100644 (file)
@@ -123,6 +123,7 @@ it still has quite a few.
 * Customization Hooks for Users::  
 * Tools To Help Developers::    
 * Interface To Low-Level SBCL Implementation::  
+* Stale Extensions::            
 * Efficiency Hacks::            
 @end menu
 
@@ -342,20 +343,28 @@ the @code{inspect} prompt.
 
 SBCL has the ability to save its state as a file for later
 execution. This functionality is important for its bootstrapping
-process, and is also provided as an extension to the user. See the
-documentation string for @code{sb-ext:save-lisp-and-die} for more
-information.
+process, and is also provided as an extension to the user.  Note that
+foreign libraries loaded via @code{load-1-foreign} don't survive this
+process; a core should not be saved in this case.
 
-@quotation
-Note: SBCL has inherited from CMUCL various hooks to allow the user to
+@emph{FIXME: what should be done for foreign libraries?}
+
+@emph{FIXME: document load-1-foreign somewhere}
+
+@include fun-sb-ext-save-lisp-and-die.texinfo
+
+
+@node Stale Extensions
+@comment  node-name,  next,  previous,  up
+@subsection Stale Extensions
+
+SBCL has inherited from CMUCL various hooks to allow the user to
 tweak and monitor the garbage collection process. These are somewhat
 stale code, and their interface might need to be cleaned up. If you
 have urgent need of them, look at the code in @file{src/code/gc.lisp}
 and bring it up on the developers' mailing list.
-@end quotation
 
-@quotation
-Note: SBCL has various hooks inherited from CMUCL, like
+SBCL has various hooks inherited from CMUCL, like
 @code{sb-ext:float-denormalized-p}, to allow a program to take
 advantage of IEEE floating point arithmetic properties which aren't
 conveniently or efficiently expressible using the ANSI standard. These
@@ -365,7 +374,6 @@ infinities (because it wasn't in the ANSI spec and it didn't occur to
 me that it was in the IEEE spec). If you need this stuff, take a look
 at the code and bring it up on the developers' mailing
 list.
-@end quotation
 
 
 @node  Efficiency Hacks
index 322eeab..d135cc2 100644 (file)
@@ -2,4 +2,10 @@
 @comment  node-name,  next,  previous,  up
 @chapter Contributed Modules
 
+SBCL comes with a number of modules that are not part of the core
+system.  These are loaded via @code{(require :@var{modulename})}
+(@pxref{fun-common-lisp-require}).  This section contains
+documentation (or pointers to documentation) for the contributed
+modules.
+
 @include contrib-doc-list.texi-temp
index a1cd645..edd7351 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- lisp -*-
+;;; -*- lisp -*-
 
 ;;;; A docstring extractor for the sbcl manual.  Creates
 ;;;; @include-ready documentation from the docstrings of exported
 (defvar *texinfo-escaped-chars* "@{}"
   "Characters that must be escaped with #\@ for Texinfo.")
 
-(defun texinfoify (string-designator)
+(defun texinfoify (string-designator &optional (downcase-p t))
   "Return 'string-designator' with characters in
-  *texinfo-escaped-chars* escaped with #\@"
-  (let ((name (string string-designator)))
-    (nstring-downcase
-     (with-output-to-string (s)
-       (loop for char across name
+  *texinfo-escaped-chars* escaped with #\@.  Optionally downcase
+  the result."
+  (let ((result (with-output-to-string (s)
+       (loop for char across (string string-designator)
           when (find char *texinfo-escaped-chars*)
           do (write-char #\@ s)
-          do (write-char char s))))))
+          do (write-char char s)))))
+    (if downcase-p (nstring-downcase result) result)))
+
+(defvar *symbol-characters* "ABCDEFGHIJKLMNOPQRSTUVWXYZ*:-+"
+  "List of characters that make up symbols in a docstring.")
+
+(defvar *symbol-delimiters* " ,.!?")
+
+(defun locate-symbols (line)
+  "Return a list of index pairs of symbol-like parts of LINE."
+  (do ((result nil)
+       (begin nil)
+       (maybe-begin t)
+       (i 0 (1+ i)))
+      ((= i (length line))
+       (when begin (push (list begin i) result))
+       (nreverse result))
+    (cond
+      ((and begin (find (char line i) *symbol-delimiters*))
+       ;; symbol end; remember it if it's not "A" or "I"
+       (when (or (> i (1+ begin)) (not (member (char line begin) '(#\A #\I))))
+         (push (list begin i) result))
+       (setf begin nil
+             maybe-begin t))
+      ((and begin (not (find (char line i) *symbol-characters*)))
+       ;; Not a symbol: abort
+       (setf begin nil))
+      ((and maybe-begin (not begin) (find (char line i) *symbol-characters*))
+       ;; potential symbol begin at this position
+       (setf begin i
+             maybe-begin nil))
+      ((find (char line i) *symbol-delimiters*)
+       ;; potential symbol begin after this position
+       (setf maybe-begin t)))))
+
+(defun all-symbols (list)
+  (cond ((or (null list) (numberp list)) nil)
+        ((atom list) (list list))
+        (t (append (all-symbols (car list)) (all-symbols (cdr list))))))
+
+(defun frob-docstring (docstring symbol-arglist)
+  "Try to guess as much formatting for a raw docstring as possible."
+  ;; Per-line processing is not necessary now, but it will be when we
+  ;; attempt itemize / table auto-detection in docstrings
+  (with-output-to-string (result)
+    (let ((arglist-symbols (all-symbols symbol-arglist)))
+      (with-input-from-string (s (texinfoify docstring nil))
+        (loop for line = (read-line s nil nil)
+           while line
+           do (let ((last 0))
+                (dolist (symbol-index (locate-symbols line))
+                  (write-string (subseq line last (first symbol-index)) result)
+                  (let ((symbol-name (apply #'subseq line symbol-index)))
+                    (format result (if (member symbol-name arglist-symbols
+                                               :test #'string=)
+                                       "@var{~A}"
+                                       "@code{~A}")
+                            (string-downcase symbol-name)))
+                  (setf last (second symbol-index)))
+                (write-line (subseq line last) result)))))))
 
 ;;; Begin, rest and end of definition.
 
              (package "package")
              (setf "setf-expander")
              (structure "struct")
-             (type (let ((class (find-class symbol nil))))
+             (type (let ((class (find-class symbol nil)))
                     (etypecase class
                       (structure-class "struct")
                       (standard-class "class")
     (package "@defvr Package")
     (setf "@deffn {Setf Expander}")
     (structure "@deftp Structure")
-    (type (let ((class (find-class symbol nil))))
-           (etypecase class
-             (structure-class "@deftp Structure")
-             (standard-class "@deftp Class")
-             (sb-pcl::condition-class "@deftp Condition")
-             ((or built-in-class null) "@deftp Type"))))
+    (type (let ((class (find-class symbol nil)))
+            (etypecase class
+              (structure-class "@deftp Structure")
+              (standard-class "@deftp Class")
+              (sb-pcl::condition-class "@deftp Condition")
+              ((or built-in-class null) "@deftp Type"))))
     (variable (if (constantp symbol)
                   "@defvr Constant"
                   "@defvr Variable"))))
 (defun texinfoify-arglist-part (part)
   (with-output-to-string (s)
     (etypecase part
-      (string (prin1 (texinfoify part) s))
+      (string (prin1 (texinfoify part nil) s))
       (number (prin1 part s))
       (symbol
        (if (member part *arglist-keywords*)
 (defun def-arglist (symbol kind)
   (case kind
     (function
-     (format nil "~{~A~^ ~}" (mapcar #'texinfoify-arglist-part
-                                     (argument-list symbol))))))
+     (format nil "~{~A~^ ~}" 
+             (mapcar #'texinfoify-arglist-part (argument-list symbol))))))
 
 (defun def-end (symbol kind)
   (declare (ignore symbol))
   (ecase kind
     ((compiler-macro function method-combination setf) "@end deffn")
     ((package variable) "@end defvr")
-    ((structure type) "@end deftp"))
-  )
+    ((structure type) "@end deftp")))
 
 (defun make-info-file (package &optional filename)
   "Create a file containing all available documentation for the
                       (texinfoify symbol)
                       (def-arglist symbol kind)
                       (def-index symbol kind)
-                      (texinfoify docstring)
+                      (frob-docstring docstring (argument-list symbol))
                       (def-end symbol kind))))
     filename))
 
                       (texinfoify symbol)
                       (def-arglist symbol kind)
                       (def-index symbol kind)
-                      (texinfoify docstring)
+                      (frob-docstring docstring (ignore-errors (argument-list symbol)))
                       (def-end symbol kind)))))
     directory))
index d0ce05c..629e68c 100644 (file)
@@ -28,12 +28,16 @@ fi
 # Makefile.
 DOCSTRINGDIR="${DOCSTRINGDIR:-docstrings/}"
 
+# List of contrib modules that docstring docs will be created for.
+# This is normally set from Makefile.
+#MODULES="${MODULES:-sb-md5 :sb-rotate-byte}"
+
 # List of package names that documentation will be created for.  This
 # is normally set from Makefile.
-PACKAGES="${PACKAGES:-:COMMON-LISP :SB-ALIEN :SB-DEBUG :SB-EXT :SB-GRAY :SB-MOP :SB-PROFILE :SB-THREAD}"
+#PACKAGES="${PACKAGES:-:COMMON-LISP :SB-ALIEN :SB-DEBUG :SB-EXT :SB-GRAY :SB-MOP :SB-PROFILE :SB-THREAD}"
 
 echo /creating docstring snippets from SBCL=\'$SBCL\' for packages \'$PACKAGES\'
-echo "(progn (load \"docstrings.lisp\") (docstrings-to-texinfo \"$DOCSTRINGDIR\" $PACKAGES) (sb-ext:quit))" | $SBCL --noinform --sysinit /dev/null --userinit /dev/null --noprint --disable-debugger
+echo "(progn (load \"docstrings.lisp\") (dolist (module (quote ($MODULES))) (require module)) (docstrings-to-texinfo \"$DOCSTRINGDIR\" $PACKAGES) (sb-ext:quit))" | $SBCL --noinform --sysinit /dev/null --userinit /dev/null --noprint --disable-debugger
 
 echo /creating contrib-docs.texi-temp
 echo "(load \"create-contrib-doc-list.lisp\")" | $SBCL --noinform --sysinit /dev/null --userinit /dev/null --noprint --disable-debugger
index adb5777..f2a8fb9 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.9.38"
+"0.8.9.39"