Commit 5cff6c7a authored by Liam Healy's avatar Liam Healy

GSL objects: export make-* symbol, other fixes to defmobject

In the defmobject expansion, export the make-<class> symbol, include
keywords in call to make-instance, add a docstring.
parent ed5ce113
;; Definition of GSL objects and ways to use them. ;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21 ;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2008-12-14 23:15:01EST gsl-objects.lisp> ;; Time-stamp: <2008-12-15 18:21:19EST gsl-objects.lisp>
;; $Id$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
(cl-alloc-args (cl-alloc-args
(variables-used-in-c-arguments allocation-args)) (variables-used-in-c-arguments allocation-args))
(cl-initialize-args (cl-initialize-args
(variables-used-in-c-arguments initialize-args))) (variables-used-in-c-arguments initialize-args))
(settingp (make-symbol "SETTINGP")))
`(progn `(progn
(defclass ,class (gsl-object) (defclass ,class (gsl-object)
() ()
...@@ -49,21 +50,28 @@ ...@@ -49,21 +50,28 @@
:export nil :export nil
:index (reinitialize-instance ,class)) :index (reinitialize-instance ,class))
(export ',maker)
(defun ,maker (defun ,maker
(,@cl-alloc-args (,@cl-alloc-args
&optional &optional
,@(cons (list (first cl-initialize-args) nil 'settingp) ,@(cons (list (first cl-initialize-args) nil settingp)
(rest cl-initialize-args))) (rest cl-initialize-args)))
(let ((object (make-instance 'hankel size))) ,(format nil "Create the GSL object representing a ~a (class ~a)."
(when settingp description class)
(let ((object
(make-instance ',class ,@(symbol-keyword-symbol cl-alloc-args))))
(when ,settingp
(reinitialize-instance (reinitialize-instance
object object
,@(mapcan ,@(symbol-keyword-symbol cl-initialize-args)))
(lambda (sym)
(list (intern (symbol-name sym) :keyword) sym))
cl-initialize-args)))
object))))) object)))))
(defun symbol-keyword-symbol (symbol)
(if (listp symbol)
(mapcan #'symbol-keyword-symbol symbol)
(list (intern (symbol-name symbol) :keyword)
symbol)))
;;; To make-load-form ;;; To make-load-form
;;; (make-basis-spline (bspline-order bspline) (number-of-breakpoints bspline)) ;;; (make-basis-spline (bspline-order bspline) (number-of-breakpoints bspline))
;;; Then initialize by making a vector from (breakpoint i bspline) ;;; Then initialize by making a vector from (breakpoint i bspline)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment