From cd6a85f815019d89cb0ff2112f2e5f846fedb82a Mon Sep 17 00:00:00 2001
From: Liam Healy <liam@thinkpad.local>
Date: Sun, 25 Jan 2009 10:40:32 -0500
Subject: [PATCH] Keyword arguments to defmobject

Change optional arguments to defmobject to keyword arguments, and add
:gsl-version argument that will create the maker function to signal an
error if the installed version of GSL is too old.
---
 basis-splines.lisp                            |   5 +-
 calculus/monte-carlo.lisp                     |  23 +--
 calculus/numerical-integration.lisp           |   7 +-
 chebyshev.lisp                                |   8 +-
 eigensystems.lisp                             |  22 ++-
 hankel.lisp                                   |   7 +-
 histogram/histogram.lisp                      |  11 +-
 histogram/probability-distribution.lisp       |  12 +-
 init/defmfun-single.lisp                      |   4 +-
 init/interface.lisp                           |  19 +-
 init/mobject.lisp                             | 163 +++++++++---------
 interpolation/interpolation.lisp              |  28 +--
 interpolation/lookup.lisp                     |   5 +-
 ordinary-differential-equations/control.lisp  |  10 +-
 .../evolution.lisp                            |   6 +-
 ordinary-differential-equations/stepping.lisp |   6 +-
 random/discrete.lisp                          |   5 +-
 random/generators.lisp                        |   9 +-
 random/quasi.lisp                             |   9 +-
 series-acceleration.lisp                      |   8 +-
 solve-minimize-fit/linear-least-squares.lisp  |   3 +-
 solve-minimize-fit/minimization-multi.lisp    |  15 +-
 solve-minimize-fit/minimization-one.lisp      |   8 +-
 .../nonlinear-least-squares.lisp              |  19 +-
 solve-minimize-fit/roots-multi.lisp           |  31 ++--
 solve-minimize-fit/roots-one.lisp             |  16 +-
 wavelet.lisp                                  |   8 +-
 27 files changed, 264 insertions(+), 203 deletions(-)

diff --git a/basis-splines.lisp b/basis-splines.lisp
index 60ac119e..f93aaf35 100644
--- a/basis-splines.lisp
+++ b/basis-splines.lisp
@@ -1,6 +1,6 @@
 ;; Basis splines.
 ;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp
-;; Time-stamp: <2008-12-26 18:25:41EST basis-splines.lisp>
+;; Time-stamp: <2009-01-25 10:11:48EST basis-splines.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -11,7 +11,8 @@
 
 (defmobject basis-spline "gsl_bspline"
   ((order sizet) (number-of-breakpoints sizet))
-  "basis spline"			; FDL
+  "basis spline"
+  :documentation			; FDL
   "Allocate a workspace for computing B-splines. The number of
    breakpoints is given by number-of-breakpoints.  This leads to n =
    nbreak + k - 2 basis functions where k = order. Cubic B-splines are
diff --git a/calculus/monte-carlo.lisp b/calculus/monte-carlo.lisp
index 754ca015..e7f902f4 100644
--- a/calculus/monte-carlo.lisp
+++ b/calculus/monte-carlo.lisp
@@ -1,6 +1,6 @@
 ;; Monte Carlo Integration
 ;; Liam Healy Sat Feb  3 2007 - 17:42
-;; Time-stamp: <2009-01-24 19:32:18EST monte-carlo.lisp>
+;; Time-stamp: <2009-01-25 10:21:38EST monte-carlo.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -17,10 +17,11 @@
 (defmobject monte-carlo-plain
     "gsl_monte_plain"
   ((dim sizet))
-  "plain Monte Carlo integration"				; FDL
+  "plain Monte Carlo integration"
+  :documentation			; FDL
   "Make and initialize a workspace for Monte Carlo integration in dim dimensions."
-  "init"
-  nil)
+  :initialize-suffix "init"
+  :initialize-args nil)
 
 (cffi:defcstruct plain-state
   (dim sizet)
@@ -59,12 +60,13 @@
 (defmobject monte-carlo-miser
     "gsl_monte_miser"
   ((dim sizet))
-  "miser Monte Carlo integration"				; FDL
+  "miser Monte Carlo integration"
+  :documentation			; FDL
   "Make and initialize a workspace for Monte Carlo integration in
    dim dimensions.  The workspace is used to maintain
    the state of the integration."
-  "init"
-  nil)
+  :initialize-suffix "init"
+  :initialize-args nil)
 
 (cffi:defcstruct miser-state
   (min-calls sizet)
@@ -133,12 +135,13 @@
 (defmobject monte-carlo-vegas
     "gsl_monte_vegas"
   ((dim sizet))
-  "vegas Monte Carlo integration"				; FDL
+  "vegas Monte Carlo integration"
+  :documentation			; FDL
   "Make and initialize a workspace for Monte Carlo integration in
    dim dimensions.  The workspace is used to maintain
    the state of the integration.  Returns a pointer to vegas-state."
-  "init"
-  nil)
+  :initialize-suffix "init"
+  :initialize-args nil)
 
 (cffi:defcstruct vegas-state
   ;; grid 
diff --git a/calculus/numerical-integration.lisp b/calculus/numerical-integration.lisp
index d9888385..44401443 100644
--- a/calculus/numerical-integration.lisp
+++ b/calculus/numerical-integration.lisp
@@ -1,6 +1,6 @@
 ;; Numerical integration
 ;; Liam Healy, Wed Jul  5 2006 - 23:14
-;; Time-stamp: <2009-01-24 14:48:39EST numerical-integration.lisp>
+;; Time-stamp: <2009-01-25 10:16:31EST numerical-integration.lisp>
 ;; $Id$
 
 ;;; To do: QAWS, QAWO, QAWF, more tests
@@ -40,9 +40,10 @@
 
 (defmobject integration-workspace
     "gsl_integration_workspace" ((size sizet))
-    "integration workspace"		; FDL
+    "integration workspace"
+    :documentation			; FDL
     "Make a workspace sufficient to hold n double
-  precision intervals, their integration results and error estimates.")
+     precision intervals, their integration results and error estimates.")
 
 (cffi:defcenum integrate-method
   :gauss15 :gauss21 :gauss31
diff --git a/chebyshev.lisp b/chebyshev.lisp
index 8fde442b..67b551cc 100644
--- a/chebyshev.lisp
+++ b/chebyshev.lisp
@@ -1,6 +1,6 @@
 ;; Chebyshev Approximations
 ;; Liam Healy Sat Nov 17 2007 - 20:36
-;; Time-stamp: <2009-01-24 12:56:27EST chebyshev.lisp>
+;; Time-stamp: <2009-01-25 10:12:45EST chebyshev.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -13,9 +13,11 @@
 
 (defmobject chebyshev "gsl_cheb"
   ((order sizet))
-  "Chebyshev series"			; FDL
+  "Chebyshev series"
+  :documentation			; FDL
   "Make a Chebyshev series of specified order."
-  "init"
+  :initialize-suffix "init"
+  :initialize-args
   ((function :pointer) (lower-limit :double) (upper-limit :double)))
 
 ;;;;****************************************************************************
diff --git a/eigensystems.lisp b/eigensystems.lisp
index fe04c8f0..cdd47f0f 100644
--- a/eigensystems.lisp
+++ b/eigensystems.lisp
@@ -1,6 +1,6 @@
 ;; Eigenvectors and eigenvalues
 ;; Liam Healy, Sun May 21 2006 - 19:52
-;; Time-stamp: <2009-01-12 10:22:00EST eigensystems.lisp>
+;; Time-stamp: <2009-01-25 10:37:09EST eigensystems.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -17,15 +17,17 @@
 
 (defmobject eigen-symm
     "gsl_eigen_symm" ((n sizet))
-    "symmetric eigenvalue workspace"	; FDL
+    "symmetric eigenvalue workspace"
+    :documentation			; FDL
     "Make a workspace for computing eigenvalues of
   n-by-n real symmetric matrices.  The size of the workspace
   is O(2n).")
 
-;; V 1.9
 (defmobject eigen-nonsymm
     "gsl_eigen_nonsymm" ((n sizet))
-    "non-symmetric eigenvalue workspace"	; FDL
+    "non-symmetric eigenvalue workspace"
+    :gsl-version (1 9)
+    :documentation			; FDL
     "Make a workspace for computing eigenvalues of
   n-by-n real non-symmetric matrices.  The size of the workspace
   is O(2n).")
@@ -41,15 +43,17 @@
 
 (defmobject eigen-symmv
     "gsl_eigen_symmv" ((n sizet))
-    "symmetric eigensystem workspace"	; FDL
+    "symmetric eigensystem workspace"
+    :documentation			; FDL
     "Make a workspace for computing eigenvalues and
   eigenvectors of n-by-n real symmetric matrices.  The size of
   the workspace is O(4n).")
 
-;; V 1.9
 (defmobject eigen-nonsymmv
     "gsl_eigen_nonsymmv" ((n sizet))
-    "non-symmetric eigenvalue workspace"	; FDL
+    "non-symmetric eigenvalue workspace"
+    :gsl-version (1 9)
+    :documentation			; FDL
     "Make a workspace for computing for computing eigenvalues and
     eigenvectors of n-by-n real nonsymmetric matrices. The size of the
     workspace is O(5n).")
@@ -57,13 +61,15 @@
 (defmobject eigen-herm
     "gsl_eigen_herm" ((n sizet))
     "Hermitian eigenvalue workspace"	; FDL
+    :documentation			; FDL
     "Make a workspace for computing eigenvalues of
   n-by-n complex Hermitian matrices.  The size of the workspace
   is O(3n).")
 
 (defmobject eigen-hermv
     "gsl_eigen_hermv" ((n sizet))
-    "Hermitian eigensystem workspace"	; FDL
+    "Hermitian eigensystem workspace"
+    :documentation			; FDL
     "Make a workspace for computing eigenvalues and
   eigenvectors of n-by-n complex hermitian matrices.  The size of
   the workspace is O(5n).")
diff --git a/hankel.lisp b/hankel.lisp
index 6a4ba84f..d26a6ebe 100644
--- a/hankel.lisp
+++ b/hankel.lisp
@@ -1,6 +1,6 @@
 ;; Discrete Hankel Transforms.
 ;; Liam Healy, Sat Dec  8 2007 - 16:50
-;; Time-stamp: <2008-12-26 18:46:20EST hankel.lisp>
+;; Time-stamp: <2009-01-25 10:00:41EST hankel.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -14,10 +14,11 @@
 (defmobject hankel "gsl_dht"
   ((size sizet))
   "discrete Hankel Transform"
+  :documentation
   "Allocate a Discrete Hankel transform object of the given size and
    optionally initialize the transform for the given values of nu and x."
-  "init"
-  ((nu :double) (xmax :double)))
+  :initialize-suffix "init"
+  :initialize-args ((nu :double) (xmax :double)))
 
 (defmfun apply-hankel (hankel array-in array-out)
   "gsl_dht_apply"
diff --git a/histogram/histogram.lisp b/histogram/histogram.lisp
index 280a2b8d..8de44e90 100644
--- a/histogram/histogram.lisp
+++ b/histogram/histogram.lisp
@@ -1,6 +1,6 @@
 ;; The histogram structure
 ;; Liam Healy, Mon Jan  1 2007 - 11:32
-;; Time-stamp: <2009-01-11 22:40:23EST histogram.lisp>
+;; Time-stamp: <2009-01-25 10:03:15EST histogram.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -14,16 +14,15 @@
     "gsl_histogram"
   ((number-of-bins sizet))
   "one-dimensional histogram, including bin boundaries and bin contents."
-  NIL
-  "set_ranges"
-  (((c-pointer ranges) :pointer) ((dim0 ranges) sizet)))
+  :initialize-suffix "set_ranges"
+  :initialize-args (((c-pointer ranges) :pointer) ((dim0 ranges) sizet)))
 
 (defmobject histogram2d
     "gsl_histogram2d"
   ((number-of-bins-x sizet) (number-of-bins-y sizet))
   "two-dimensional histogram, including bin boundaries and bin contents."
-  NIL
-  "set_ranges"
+  :initialize-suffix "set_ranges"
+  :initialize-args
   (((c-pointer x-ranges) :pointer) ((dim0 x-ranges) sizet)
    ((c-pointer y-ranges) :pointer) ((dim0 y-ranges) sizet)))
 
diff --git a/histogram/probability-distribution.lisp b/histogram/probability-distribution.lisp
index ba39115d..a831fa7f 100644
--- a/histogram/probability-distribution.lisp
+++ b/histogram/probability-distribution.lisp
@@ -1,6 +1,6 @@
 ;; Histogram probability distribution.
 ;; Liam Healy, Mon Jan  1 2007 - 17:51
-;; Time-stamp: <2008-12-26 18:38:41EST probability-distribution.lisp>
+;; Time-stamp: <2009-01-25 10:04:23EST probability-distribution.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -12,23 +12,25 @@
     "gsl_histogram_pdf"
   ((number-of-bins sizet))
   "one-dimensional histogram PDF"
+  :documentation
   "Optionally initialize the probability distribution pdf with the contents
    of the histogram.  If any of the bins are negative then an
    input-domain error is signalled because a probability distribution
    cannot contain negative values."
-  "init"
-  (((mpointer histogram) :pointer)))
+  :initialize-suffix "init"
+  :initialize-args (((mpointer histogram) :pointer)))
 
 (defmobject histogram2d-pdf
     "gsl_histogram2d_pdf"
   ((number-of-bins-x sizet) (number-of-bins-y sizet))
   "two-dimensional histogram PDF"
+  :documentation
   "Optionally initialize the probability distribution pdf with the contents
    of the histogram.  If any of the bins are negative then an
    input-domain error is signalled because a probability distribution
    cannot contain negative values."
-  "init"
-  (((mpointer histogram) :pointer)))
+  :initialize-suffix "init"
+  :initialize-args (((mpointer histogram) :pointer)))
 
 (export 'sample)
 (defgeneric sample (pdf value)
diff --git a/init/defmfun-single.lisp b/init/defmfun-single.lisp
index a229c240..7a2d2259 100644
--- a/init/defmfun-single.lisp
+++ b/init/defmfun-single.lisp
@@ -1,6 +1,6 @@
 ;; Helpers that define a single GSL function interface
 ;; Liam Healy 2009-01-07 22:02:20EST defmfun-single.lisp
-;; Time-stamp: <2009-01-15 22:27:56EST defmfun-single.lisp>
+;; Time-stamp: <2009-01-25 10:37:13EST defmfun-single.lisp>
 ;; $Id: $
 
 (in-package :gsl)
@@ -81,7 +81,7 @@
 	      qualifier gsl-version &allow-other-keys)
       key-args
     (declare (ignorable inputs outputs)) ; workaround for compiler errors that don't see it's used
-    (if (or (not gsl-version) (apply 'have-at-least-gsl-version gsl-version))
+    (if (have-at-least-gsl-version gsl-version)
 	`(,definition
 	     ,@(when (and name (not (defgeneric-method-p name)))
 		     (list name))
diff --git a/init/interface.lisp b/init/interface.lisp
index c8bdf828..5fd9ea26 100644
--- a/init/interface.lisp
+++ b/init/interface.lisp
@@ -1,6 +1,6 @@
 ;; Macros to interface GSL functions, including definitions necessary for defmfun.
 ;; Liam Healy 
-;; Time-stamp: <2009-01-06 18:49:56EST interface.lisp>
+;; Time-stamp: <2009-01-25 10:30:39EST interface.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -143,13 +143,14 @@
 (map-name '*gsl-version* "gsl_version")
 (export '*gsl-version*)
 
-(defun have-at-least-gsl-version (major minor)
+(defun have-at-least-gsl-version (major-minor)
   "The GSL version currently running is at least the specified
   major/minor version."
-  (let* ((sep-pos (position #\. *gsl-version*))
-	 (my-major
-	  (read-from-string *gsl-version* nil nil :end sep-pos))
-	 (my-minor
-	  (read-from-string *gsl-version* nil nil :start (1+ sep-pos))))
-    (and (>= my-major major)
-	 (>= my-minor minor))))
+  (or (null major-minor)
+      (let* ((sep-pos (position #\. *gsl-version*))
+	     (my-major
+	      (read-from-string *gsl-version* nil nil :end sep-pos))
+	     (my-minor
+	      (read-from-string *gsl-version* nil nil :start (1+ sep-pos))))
+	(and (>= my-major (first major-minor))
+	     (>= my-minor (second major-minor))))))
diff --git a/init/mobject.lisp b/init/mobject.lisp
index 091a93e1..70f29281 100644
--- a/init/mobject.lisp
+++ b/init/mobject.lisp
@@ -1,6 +1,6 @@
 ;; Definition of GSL objects and ways to use them.
 ;; Liam Healy, Sun Dec  3 2006 - 10:21
-;; Time-stamp: <2009-01-21 22:38:01EST mobject.lisp>
+;; Time-stamp: <2009-01-25 10:35:08EST mobject.lisp>
 ;; $Id$
 
 ;;; GSL objects are represented in GSLL as and instance of a 'mobject.
@@ -22,8 +22,8 @@
 
 (defmacro defmobject
     (class prefix allocation-args description 
-     &optional docstring initialize-suffix initialize-args arglists-function
-     inputs)
+     &key documentation initialize-suffix initialize-args arglists-function
+     inputs gsl-version)
   "Define the class, the allocate, initialize-instance and
    reinitialize-instance methods, and the make-* function for the GSL object."
   ;; If prefix is a list, the first is the actual prefix, and the
@@ -40,82 +40,89 @@
 	 (cl-initialize-args
 	  (variables-used-in-c-arguments initialize-args))
 	 (realprefix (if (listp prefix) (first prefix) prefix)))
-    `(progn
-       (defclass ,class (mobject)
-	 ()
-	 (:documentation
-	  ,(format nil "The GSL representation of the ~a." description)))
-
-       (defmfun allocate ((object ,class) &key ,@cl-alloc-args)
-	 ,(if (listp prefix) (second prefix) (format nil "~a_alloc" prefix))
-	 ,allocation-args
-	 ,@(if (and (listp prefix) (third prefix))
-	       `(:inputs ,(third prefix)))
-	 :definition :method
-	 :c-return :pointer
-	 :index ,maker)
-
-       (defmethod initialize-instance :after
-	   ((object ,class) &key mpointer ,@(union cl-alloc-args cl-initialize-args))
-	 ,@(let ((not-alloc (set-difference cl-initialize-args cl-alloc-args)))
-		(when not-alloc)
-		`((declare (ignore ,@not-alloc))))
-	 (unless mpointer
-	   (setf mpointer
-		 (allocate object ,@(symbol-keyword-symbol cl-alloc-args))
-		 (slot-value object 'mpointer) mpointer))
-	 (tg:finalize object
-		      (lambda ()
-			(cffi:foreign-funcall
-			 ,(format nil "~a_free" realprefix)
-			 :pointer mpointer :void))))
-
-       ,@(when initialize-suffix
-	       `((defmfun reinitialize-instance
-		     ((object ,class) &key ,@cl-initialize-args)
-		   ,(format nil "~a_~a" realprefix
-			    (if (listp initialize-suffix)
-				(first initialize-suffix)
-				initialize-suffix))
-		   (((mpointer object) :pointer) ,@initialize-args)
-		   :definition :method
-		   :qualifier :after
-		   ,@(when (listp initialize-suffix)
-			   `(:c-return ,(second initialize-suffix)))
-		   :return (object)
-		   ,@(when inputs `(:inputs ,inputs))
-		   :export nil
-		   :index (reinitialize-instance ,class))))
-
-       (export ',maker)
-       (defun ,maker
-	   ,(if arglists
-		(first arglists)
-		`(,@cl-alloc-args
-		  ,@(when initialize-args
-			  (append
-			   (list '&optional
-				 (list (first cl-initialize-args) nil settingp))
-			   (rest cl-initialize-args)))))
-	 ,(format nil "Create the GSL object representing a ~a (class ~a).~@[~&~a~]"
-		  description class docstring)
-	 (let ((object
-		(make-instance
-		 ',class
-		 ,@(if arglists
-		       (second arglists)
-		       (symbol-keyword-symbol cl-alloc-args)))))
-	   ;; There is an initialization step
+    (if (have-at-least-gsl-version gsl-version)
+	`(progn
+	   (defclass ,class (mobject)
+	     ()
+	     (:documentation
+	      ,(format nil "The GSL representation of the ~a." description)))
+
+	   (defmfun allocate ((object ,class) &key ,@cl-alloc-args)
+	     ,(if (listp prefix) (second prefix) (format nil "~a_alloc" prefix))
+	     ,allocation-args
+	     ,@(if (and (listp prefix) (third prefix))
+		   `(:inputs ,(third prefix)))
+	     :definition :method
+	     :c-return :pointer
+	     :index ,maker)
+
+	   (defmethod initialize-instance :after
+	       ((object ,class) &key mpointer ,@(union cl-alloc-args cl-initialize-args))
+	     ,@(let ((not-alloc (set-difference cl-initialize-args cl-alloc-args)))
+		    (when not-alloc)
+		    `((declare (ignore ,@not-alloc))))
+	     (unless mpointer
+	       (setf mpointer
+		     (allocate object ,@(symbol-keyword-symbol cl-alloc-args))
+		     (slot-value object 'mpointer) mpointer))
+	     (tg:finalize object
+			  (lambda ()
+			    (cffi:foreign-funcall
+			     ,(format nil "~a_free" realprefix)
+			     :pointer mpointer :void))))
+
 	   ,@(when initialize-suffix
-		   (if initialize-args	; with arguments
-		       `((when ,settingp
-			   (reinitialize-instance
-			    object
-			    ,@(if arglists
-				  (third arglists)
-				  (symbol-keyword-symbol cl-initialize-args)))))
-		       '((reinitialize-instance object)))) ; without arguments
-	   object)))))
+		   `((defmfun reinitialize-instance
+			 ((object ,class) &key ,@cl-initialize-args)
+		       ,(format nil "~a_~a" realprefix
+				(if (listp initialize-suffix)
+				    (first initialize-suffix)
+				    initialize-suffix))
+		       (((mpointer object) :pointer) ,@initialize-args)
+		       :definition :method
+		       :qualifier :after
+		       ,@(when (listp initialize-suffix)
+			       `(:c-return ,(second initialize-suffix)))
+		       :return (object)
+		       ,@(when inputs `(:inputs ,inputs))
+		       :export nil
+		       :index (reinitialize-instance ,class))))
+
+	   (export ',maker)
+	   (defun ,maker
+	       ,(if arglists
+		    (first arglists)
+		    `(,@cl-alloc-args
+		      ,@(when initialize-args
+			      (append
+			       (list '&optional
+				     (list (first cl-initialize-args) nil settingp))
+			       (rest cl-initialize-args)))))
+	     ,(format
+	       nil "Create the GSL object representing a ~a (class ~a).~@[~&~a~]"
+	       description class documentation)
+	     (let ((object
+		    (make-instance
+		     ',class
+		     ,@(if arglists
+			   (second arglists)
+			   (symbol-keyword-symbol cl-alloc-args)))))
+	       ;; There is an initialization step
+	       ,@(when initialize-suffix
+		       (if initialize-args ; with arguments
+			   `((when ,settingp
+			       (reinitialize-instance
+				object
+				,@(if arglists
+				      (third arglists)
+				      (symbol-keyword-symbol cl-initialize-args)))))
+			   '((reinitialize-instance object)))) ; without arguments
+	       object)))
+	`(defun ,maker (&rest args)
+	   (declare (ignore args))
+	   (error 'obsolete-gsl-version
+		  :name ',class :gsl-name ,realprefix
+		  :gsl-version ',gsl-version)))))
 
 (defun symbol-keyword-symbol (symbol)
   (if (listp symbol)
diff --git a/interpolation/interpolation.lisp b/interpolation/interpolation.lisp
index 232cebb4..dd8ea340 100644
--- a/interpolation/interpolation.lisp
+++ b/interpolation/interpolation.lisp
@@ -1,6 +1,6 @@
 ;; Interpolation allocation, initialization, and freeing.
 ;; Liam Healy, Sun Nov  4 2007 - 17:24
-;; Time-stamp: <2008-12-26 18:19:19EST interpolation.lisp>
+;; Time-stamp: <2009-01-25 10:14:30EST interpolation.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -12,27 +12,33 @@
 ;;; so they need not be supplied on each call.
 (defmobject interpolation "gsl_interp"
   ((type :pointer) (size sizet))
-  "interpolation"			; FDL
+  "interpolation"
+  :documentation			; FDL
   "Make an interpolation object of type for size data-points,
    and optionally initialize the interpolation object interp for the
   data (xa,ya) where xa and ya are vectors.  The interpolation object does not save
   the data arrays xa and ya and only stores the static state
   computed from the data.  The xa data array is always assumed to be
   strictly ordered; the behavior for other arrangements is not defined."
-  "init"
+  :initialize-suffix "init"
+  :initialize-args
   (((c-pointer xa) :pointer) ((c-pointer ya) :pointer) ((dim0 xa) sizet))
+  :arglists-function
   (lambda (set)
-  `((type &optional xa-or-size (ya nil ,set))
-    (:type type :size (if ,set (dim0 ya) xa-or-size))
-    (:xa xa-or-size :ya ya))))
+    `((type &optional xa-or-size (ya nil ,set))
+      (:type type :size (if ,set (dim0 ya) xa-or-size))
+      (:xa xa-or-size :ya ya))))
 
 (defmobject spline "gsl_spline"
   ((type :pointer) (size sizet))
-  "spline"			; FDL
+  "spline"
+  :documentation			; FDL
   "Make an interpolation object of type for size data-points."
-  "init"
+  :initialize-suffix "init"
+  :initialize-args
   (((c-pointer xa) :pointer) ((c-pointer ya) :pointer) ((dim0 xa) sizet))
+  :arglists-function
   (lambda (set)
-  `((type &optional xa-or-size (ya nil ,set))
-    (:type type :size (if ,set (dim0 ya) xa-or-size))
-    (:xa xa-or-size :ya ya))))
+    `((type &optional xa-or-size (ya nil ,set))
+      (:type type :size (if ,set (dim0 ya) xa-or-size))
+      (:xa xa-or-size :ya ya))))
diff --git a/interpolation/lookup.lisp b/interpolation/lookup.lisp
index a98e739f..ba60d725 100644
--- a/interpolation/lookup.lisp
+++ b/interpolation/lookup.lisp
@@ -1,13 +1,14 @@
 ;; Index lookup and acceleration
 ;; Liam Healy, Sun Nov  4 2007 - 18:09
-;; Time-stamp: <2008-12-26 16:41:21EST lookup.lisp>
+;; Time-stamp: <2009-01-25 10:14:47EST lookup.lisp>
 ;; $Id$
 
 (in-package :gsl)
 
 (defmobject acceleration "gsl_interp_accel"
   ()
-  "acceleration for interpolation"			; FDL
+  "acceleration for interpolation"
+  :documentation			; FDL
   "Make an accelerator object, which is a
    kind of iterator for interpolation lookups.  It tracks the state of
    lookups, thus allowing for application of various acceleration
diff --git a/ordinary-differential-equations/control.lisp b/ordinary-differential-equations/control.lisp
index 95c31666..5cc0d4c3 100644
--- a/ordinary-differential-equations/control.lisp
+++ b/ordinary-differential-equations/control.lisp
@@ -1,10 +1,18 @@
 ;; Adaptive step-size control
 ;; Liam Healy 2008-02-17 17:30:04EST control.lisp
-;; Time-stamp: <2009-01-20 19:39:08EST control.lisp>
+;; Time-stamp: <2009-01-25 10:01:56EST control.lisp>
 ;; $Id$
 
 (in-package :gsl)
 
+#|
+(defmobject standard-control ("gsl_odeiv_control_standard" "new")
+  ((absolute-error :double) (relative-error :double)
+   (y-scaling :double) (dydt-scaling :double))
+  "standard control for ordinary differential equations"
+  "")
+|#
+
 (defmfun new-standard-control (absolute-error relative-error y-scaling dydt-scaling)
   "gsl_odeiv_control_standard_new"
   ((absolute-error :double) (relative-error :double)
diff --git a/ordinary-differential-equations/evolution.lisp b/ordinary-differential-equations/evolution.lisp
index 5f74af88..5fcb3502 100644
--- a/ordinary-differential-equations/evolution.lisp
+++ b/ordinary-differential-equations/evolution.lisp
@@ -1,6 +1,6 @@
 ;; Evolution functions for ODE integration.
 ;; Liam Healy, Sun Sep 30 2007 - 14:31
-;; Time-stamp: <2009-01-20 22:42:27EST evolution.lisp>
+;; Time-stamp: <2009-01-25 10:00:41EST evolution.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -8,8 +8,10 @@
 (defmobject ode-evolution "gsl_odeiv_evolve"
   ((dimensions sizet))
   "evolution for ordinary differential equations"
+  :documentation
   "Make an object to advance the ODE solution."
-  "reset" nil)
+  :initialize-suffix "reset"
+  :initialize-args nil)
 
 (defmfun apply-evolution
     (evolve control step dydt time max-time step-size y)
diff --git a/ordinary-differential-equations/stepping.lisp b/ordinary-differential-equations/stepping.lisp
index 53537981..c5f38ce0 100644
--- a/ordinary-differential-equations/stepping.lisp
+++ b/ordinary-differential-equations/stepping.lisp
@@ -1,6 +1,6 @@
 ;; Stepping functions for ODE systems.
 ;; Liam Healy, Mon Sep 24 2007 - 21:33
-;; Time-stamp: <2009-01-20 19:09:55EST stepping.lisp>
+;; Time-stamp: <2009-01-25 10:00:40EST stepping.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -8,12 +8,14 @@
 (defmobject ode-stepper "gsl_odeiv_step"
   ((type :pointer) (dimensions sizet))
   "stepper for ordinary differential equations"
+  :documentation
   "Make a stepper for ordinary differential equations.  The type is
    one of the GSL-supplied types defined in stepping.lisp, and
    dimensions is the number of dependent variables.  This instance
    should be reinitialized whenever the next use of it will not be a
    continuation of a previous step."
-  "reset" nil)
+  :initialize-suffix "reset"
+  :initialize-args nil)
 
 (defmfun name ((object ode-stepper))
   "gsl_odeiv_step_name"
diff --git a/random/discrete.lisp b/random/discrete.lisp
index e61fe71c..bffe943b 100644
--- a/random/discrete.lisp
+++ b/random/discrete.lisp
@@ -1,6 +1,6 @@
 ;; Discrete random variables
 ;; Liam Healy, Sat Nov 11 2006 - 21:51
-;; Time-stamp: <2008-12-29 22:33:10EST discrete.lisp>
+;; Time-stamp: <2009-01-25 09:54:54EST discrete.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -10,7 +10,8 @@
 (defmobject discrete-random
     ("gsl_ran_discrete" "gsl_ran_discrete_preproc" (probabilities))
   (((dim0 probabilities) sizet) ((c-pointer probabilities) :pointer))
-  "lookup table for the discrete random number generator" ; FDL
+  "lookup table for the discrete random number generator"
+  :documentation			; FDL
   "Make a structure that contains the lookup
   table for the discrete random number generator.  The array probabilities contains
   the probabilities of the discrete events; these array elements must all be 
diff --git a/random/generators.lisp b/random/generators.lisp
index a068776d..6eb6eea1 100644
--- a/random/generators.lisp
+++ b/random/generators.lisp
@@ -1,6 +1,6 @@
 ;; Generators of random numbers.
 ;; Liam Healy, Sat Jul 15 2006 - 14:43
-;; Time-stamp: <2009-01-11 23:01:36EST generators.lisp>
+;; Time-stamp: <2009-01-25 09:57:17EST generators.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -14,7 +14,8 @@
 (defmobject random-number-generator
     "gsl_rng"
   ((rng-type :pointer))
-  "random number generator"		; FDL
+  "random number generator"
+  :documentation			; FDL
   "Make and optionally initialize (or `seed') the random number
    generator of the specified type.  If the generator is seeded with
    the same value of s on two different runs, the same stream of
@@ -25,8 +26,8 @@
    For example, the original Fortran source code for the *ranlux*
    generator used a seed of 314159265, and so choosing s equal to zero
    reproduces this when using *ranlux*."
-  ("set" :void)
-  ((value :ulong)))
+  :initialize-suffix ("set" :void)
+  :initialize-args ((value :ulong)))
 
 ;;;;****************************************************************************
 ;;;; Seed
diff --git a/random/quasi.lisp b/random/quasi.lisp
index 37a016e8..39732139 100644
--- a/random/quasi.lisp
+++ b/random/quasi.lisp
@@ -1,6 +1,6 @@
 ;; Quasi-random sequences in arbitrary dimensions.
 ;; Liam Healy, Sun Jul 16 2006 - 15:54
-;; Time-stamp: <2009-01-11 23:02:11EST quasi.lisp>
+;; Time-stamp: <2009-01-25 09:57:03EST quasi.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -10,12 +10,13 @@
 (defmobject quasi-random-number-generator
     "gsl_qrng"
   ((rng-type :pointer) (dimension :uint))
-  "quasi random number generator"		; FDL
+  "quasi random number generator"
+  :documentation			; FDL
   "Make and optionally initialize the generator q to its starting point.
    Note that quasi-random sequences do not use a seed and always produce
    the same set of values."
-  ("init" :void)
-  nil)
+  :initialize-suffix ("init" :void)
+  :initialize-args nil)
 
 (defmfun qrng-get (generator return-vector)
   "gsl_qrng_get"
diff --git a/series-acceleration.lisp b/series-acceleration.lisp
index f479ac0b..6474bb6a 100644
--- a/series-acceleration.lisp
+++ b/series-acceleration.lisp
@@ -1,6 +1,6 @@
 ;; Series acceleration.
 ;; Liam Healy, Wed Nov 21 2007 - 18:41
-;; Time-stamp: <2009-01-21 22:48:11EST series-acceleration.lisp>
+;; Time-stamp: <2009-01-25 10:12:17EST series-acceleration.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -28,7 +28,8 @@
 
 (defmobject levin "gsl_sum_levin_u"
   ((order sizet))
-  "Levin u-transform"			; FDL
+  "Levin u-transform"
+  :documentation			; FDL
   "Make a workspace for a Levin u-transform of n
    terms.  The size of the workspace is O(2n^2 + 3n).")
 
@@ -53,7 +54,8 @@
 
 (defmobject levin-truncated "gsl_sum_levin_utrunc"
   ((order sizet))
-  "truncated Levin u-transform"			; FDL
+  "truncated Levin u-transform"
+  :documentation			; FDL
   "Make a workspace for a Levin u-transform of n
    terms, without error estimation.  The size of the workspace is
    O(3n).")
diff --git a/solve-minimize-fit/linear-least-squares.lisp b/solve-minimize-fit/linear-least-squares.lisp
index 095a04ee..823c1ae9 100644
--- a/solve-minimize-fit/linear-least-squares.lisp
+++ b/solve-minimize-fit/linear-least-squares.lisp
@@ -1,6 +1,6 @@
 ;; Linear least squares, or linear regression
 ;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp>
-;; Time-stamp: <2009-01-24 09:24:25EST linear-least-squares.lisp>
+;; Time-stamp: <2009-01-25 10:08:22EST linear-least-squares.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -135,6 +135,7 @@
     "gsl_multifit_linear"
   ((number-of-observations sizet) (number-of-parameters sizet))
   "multi-dimensional root solver with function only"
+  :documentation
   "Make a workspace for a multidimensional linear least-squares fit.")
 
 (defun size-array (array-or-size)
diff --git a/solve-minimize-fit/minimization-multi.lisp b/solve-minimize-fit/minimization-multi.lisp
index c74d3c3e..5a2f6c17 100644
--- a/solve-minimize-fit/minimization-multi.lisp
+++ b/solve-minimize-fit/minimization-multi.lisp
@@ -1,6 +1,6 @@
 ;; Multivariate minimization.
 ;; Liam Healy  <Tue Jan  8 2008 - 21:28>
-;; Time-stamp: <2009-01-24 16:58:00EST minimization-multi.lisp>
+;; Time-stamp: <2009-01-25 10:09:46EST minimization-multi.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -57,21 +57,23 @@
 (defmobject multi-dimensional-minimizer-f
     "gsl_multimin_fminimizer"
   ((type :pointer) (dimension sizet))
-  "multi-dimensional minimizer with function only" ; FDL
+  "multi-dimensional minimizer with function only"
+  :documentation			; FDL
   "Make an instance of a minimizer of the given for an function of the
    given dimensions.  Optionally initialize the minimizer to minimize
    the function starting from the initial point.  The size of the
    initial trial steps is given in vector step-size. The precise
    meaning of this parameter depends on the method used."
-  "set"
-  ;; Could have one fewer argument: dimension=(dim0 initial)
+  :initialize-suffix "set"
+  :initialize-args ;; Could have one fewer argument: dimension=(dim0 initial)
   ((function :pointer) ((mpointer initial) :pointer)
    ((mpointer step-size) :pointer)))
 
 (defmobject multi-dimensional-minimizer-fdf
     "gsl_multimin_fdfminimizer"
   ((type :pointer) (dimension sizet))
-  "multi-dimensional minimizer with function and derivative" ; FDL
+  "multi-dimensional minimizer with function and derivative"
+  :documentation			; FDL
   "Make an instance of a derivative-based minimizer of the given for
    an function of the given dimensions.  Optionally initialize the
    minimizer to minimize the function starting from the initial point.
@@ -82,7 +84,8 @@
    gradient of the function g is orthogonal to the current search
    direction p to a relative accuracy of tolerance, where dot(p,g) <
    tol |p| |g|."
-  "set"
+  :initialize-suffix "set"
+  :initialize-args
   ;; Could have one fewer argument: dimension=(dim0 initial)
   ((function-derivative :pointer) ((mpointer initial) :pointer)
    (step-size :double) (tolerance :double)))
diff --git a/solve-minimize-fit/minimization-one.lisp b/solve-minimize-fit/minimization-one.lisp
index 978c3a84..bb1c6445 100644
--- a/solve-minimize-fit/minimization-one.lisp
+++ b/solve-minimize-fit/minimization-one.lisp
@@ -1,6 +1,6 @@
 ;; Univariate minimization
 ;; Liam Healy Tue Jan  8 2008 - 21:02
-;; Time-stamp: <2009-01-24 14:46:49EST minimization-one.lisp>
+;; Time-stamp: <2009-01-25 10:07:59EST minimization-one.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -15,11 +15,13 @@
 (defmobject one-dimensional-minimizer
     "gsl_min_fminimizer"
   ((type :pointer))
-  "one-dimensional minimizer" ; FDL
+  "one-dimensional minimizer"
+  :documentation			; FDL
   "Make an instance of a minimizer of the given type.  Optionally
    set to use the function and the initial search interval [lower,
    upper], with a guess for the location of the minimum."
-  "set"					; should use set_with_values?
+  :initialize-suffix "set"		; should use set_with_values?
+  :initialize-args
   ((function :pointer) (minimum :double) (lower :double) (upper :double)))
 
 (defmfun set-fminimizer-with-values
diff --git a/solve-minimize-fit/nonlinear-least-squares.lisp b/solve-minimize-fit/nonlinear-least-squares.lisp
index d6fc385c..7f2aa954 100644
--- a/solve-minimize-fit/nonlinear-least-squares.lisp
+++ b/solve-minimize-fit/nonlinear-least-squares.lisp
@@ -1,6 +1,6 @@
 ;; Nonlinear least squares fitting.
 ;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp
-;; Time-stamp: <2009-01-24 16:58:11EST nonlinear-least-squares.lisp>
+;; Time-stamp: <2009-01-25 10:11:21EST nonlinear-least-squares.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -16,10 +16,11 @@
 
 (defmobject nonlinear-ffit "gsl_multifit_fsolver"
   ((solver-type :pointer) (number-of-observations sizet) (number-of-parameters sizet))
-  "nonlinear least squares fit with function only"			; FDL
+  "nonlinear least squares fit with function only"
+  :documentation			; FDL
   "The number of observations must be greater than or equal to parameters."
-  "set"
-  ((function :pointer) ((mpointer initial-guess) :pointer)))
+  :initialize-suffix "set"
+  :initialize-args ((function :pointer) ((mpointer initial-guess) :pointer)))
 
 (defmfun name ((solver nonlinear-ffit))
   "gsl_multifit_fsolver_name"
@@ -34,12 +35,14 @@
 ;;;;****************************************************************************
 
 (defmobject nonlinear-fdffit "gsl_multifit_fdfsolver"
-  ((solver-type :pointer) (number-of-observations sizet) (number-of-parameters sizet))
-  "nonlinear least squares fit with function and derivative"			; FDL
+  ((solver-type :pointer) (number-of-observations sizet)
+   (number-of-parameters sizet))
+  "nonlinear least squares fit with function and derivative"
+  :documentation			; FDL
   "The number of observations must be greater than or
    equal to parameters."
-  "set"
-  ((function :pointer) ((mpointer initial-guess) :pointer)))
+  :initialize-suffix "set"
+  :initialize-args ((function :pointer) ((mpointer initial-guess) :pointer)))
 
 (defmfun name ((solver nonlinear-fdffit))
   "gsl_multifit_fdfsolver_name"
diff --git a/solve-minimize-fit/roots-multi.lisp b/solve-minimize-fit/roots-multi.lisp
index 03041775..1a861673 100644
--- a/solve-minimize-fit/roots-multi.lisp
+++ b/solve-minimize-fit/roots-multi.lisp
@@ -1,6 +1,6 @@
 ;;; Multivariate roots.                
 ;;; Liam Healy 2008-01-12 12:49:08
-;;; Time-stamp: <2009-01-24 20:09:17EST roots-multi.lisp>
+;;; Time-stamp: <2009-01-25 10:06:14EST roots-multi.lisp>
 ;;; $Id$
 
 (in-package :gsl)
@@ -19,37 +19,42 @@
 
 (defmobject multi-dimensional-root-solver-f "gsl_multiroot_fsolver"
   ((type :pointer) (dimension sizet))
-  "multi-dimensional root solver with function only"			; FDL
+  "multi-dimensional root solver with function only"
+  :documentation			; FDL
   "Make an instance of a solver of the type specified for a system of
    the specified number of dimensions.  Optionally
    set or reset an existing solver to use the function and the
    initial guess gsl-vector."
-  "set"
-  ((function :pointer) ((mpointer initial) :pointer))
+  :initialize-suffix "set"
+  :initialize-args ((function :pointer) ((mpointer initial) :pointer))
+  :arglists-function
   (lambda (set)
-  `((type &optional function-or-dimension (initial nil ,set))
-    (:type type
-     :dimension
-     (if ,set (dim0 initial) function-or-dimension))
-    (:function function-or-dimension :initial initial)))
-  (initial))
+    `((type &optional function-or-dimension (initial nil ,set))
+      (:type type
+	     :dimension
+	     (if ,set (dim0 initial) function-or-dimension))
+      (:function function-or-dimension :initial initial)))
+  :inputs (initial))
 
 (defmobject multi-dimensional-root-solver-fdf "gsl_multiroot_fdfsolver"
   ((type :pointer) (dimension sizet))
-  "multi-dimensional root solver with function and derivative"			; FDL
+  "multi-dimensional root solver with function and derivative"
+  :documentation			; FDL
   "Make an instance of a derivative solver of the type specified for
    a system of the specified number of dimensions.  Optionally
    set or reset an existing solver to use the function and derivative
    (fdf) and the initial guess."
-  "set"
+  :initialize-suffix "set"
+  :initialize-args
   ((function-derivative :pointer) ((mpointer initial) :pointer))
+  :arglists-function
   (lambda (set)
   `((type &optional function-or-dimension (initial nil ,set))
     (:type type
      :dimension
      (if ,set (dim0 initial) function-or-dimension))
     (:function-derivative function-or-dimension :initial initial)))
-  (initial))
+  :inputs (initial))
 
 (defmfun name ((solver multi-dimensional-root-solver-f))
   "gsl_multiroot_fsolver_name"
diff --git a/solve-minimize-fit/roots-one.lisp b/solve-minimize-fit/roots-one.lisp
index 044516c8..105ef266 100644
--- a/solve-minimize-fit/roots-one.lisp
+++ b/solve-minimize-fit/roots-one.lisp
@@ -1,6 +1,6 @@
 ;; One-dimensional root solver.
 ;; Liam Healy 
-;; Time-stamp: <2009-01-24 15:08:14EST roots-one.lisp>
+;; Time-stamp: <2009-01-25 10:10:24EST roots-one.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -13,17 +13,15 @@
 
 (defmobject one-dimensional-root-solver-f "gsl_root_fsolver"
   ((type :pointer))
-  "one-dimensional root solver with function only"			; FDL
-  ""
-  "set"
-  ((function :pointer) (lower :double) (upper :double)))
+  "one-dimensional root solver with function only"
+  :initialize-suffix "set"
+  :initialize-args ((function :pointer) (lower :double) (upper :double)))
 
 (defmobject one-dimensional-root-solver-fdf "gsl_root_fdfsolver"
   ((type :pointer))
-  "one-dimensional root solver with function and derivative"			; FDL
-  ""
-  "set"
-  ((function-derivative :pointer) (root-guess :double)))
+  "one-dimensional root solver with function and derivative"
+  :initialize-suffix "set"
+  :initialize-args ((function-derivative :pointer) (root-guess :double)))
 
 (defmfun name ((solver one-dimensional-root-solver-f))
   "gsl_root_fsolver_name"
diff --git a/wavelet.lisp b/wavelet.lisp
index 899f45ac..53c7ce1a 100644
--- a/wavelet.lisp
+++ b/wavelet.lisp
@@ -1,6 +1,6 @@
 ;; Wavelet transforms.
 ;; Liam Healy, Mon Nov 26 2007 - 20:43
-;; Time-stamp: <2008-12-26 18:48:14EST wavelet.lisp>
+;; Time-stamp: <2009-01-25 09:58:21EST wavelet.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -23,7 +23,8 @@
 
 (defmobject wavelet "gsl_wavelet"
   ((type :pointer) (member sizet))
-  "wavelet"				; FDL
+  "wavelet"
+  :documentation			; FDL
   "Make and initialize a wavelet object of type 'type.  The
    parameter 'member selects the specific member of the wavelet
    family.  A memory-allocation-failure error indicates either
@@ -74,7 +75,8 @@
 (defmobject wavelet-workspace
   "gsl_wavelet_workspace"
   ((size sizet))
-  "wavelet workspace"				; FDL
+  "wavelet workspace"
+  :documentation			; FDL
   "Make a workspace for the discrete wavelet transform.
    To perform a one-dimensional transform on size elements, a workspace
    of size size must be provided.  For two-dimensional transforms of
-- 
GitLab