Commit ea9a2156 authored by Liam Healy's avatar Liam Healy

Added slot 'funcallables to 'callback-included

The callback-included objects now have a slot 'funcallables which is
set by a function #'make-funcallables-for-object which is used by
make-reinitialize-instance.  This required swapping the order of
:callback-object and :before in body-expand, which shouldn't affect
anything else.  New name #'make-funcallable-form renamed from
#'make-funcallable to clarfiy distinction with
#'make-funcallables-for-object.  Eliminated select-dynamic-values.
parent 09ce32be
;; The mobject that defines callbacks
;; Liam Healy 2009-03-14 11:20:03EDT callback-included.lisp
;; Time-stamp: <2009-03-28 23:05:30EDT callback-included.lisp>
;; Time-stamp: <2009-03-29 09:52:12EDT callback-included.lisp>
;; $Id: $
(in-package :gsl)
......@@ -18,8 +18,12 @@
:documentation "The names in the GSL struct for dimensions.")
:initarg :functions :reader functions :initform nil
:documentation "The names of the function(s) defined by defmcallback.
:documentation "The user functions as function designators.
These should correspond in order to the structure-slot-name list.")
:initarg :funcallables :reader funcallables :initform nil
:documentation "The function objects that will be called by
the callbacks.")
:initarg :scalarsp :reader scalarsp :initform t
:documentation "Whether the function expect to be passed and return
......@@ -54,17 +58,6 @@
;;;; For making mobjects
(defun select-dynamic-values (object n)
(nth n (functions object))
(nth n (parse-callback-static (callbacks object) 'functions))
(scalarsp object)
(dimensions object))
;;; This is expanded in defmfun to set the dynamic variables.
(defun callback-set-dynamic (callback-object arglist)
"Make a form to set the dynamic variable defining callbacks."
......@@ -75,4 +68,4 @@
(number-of-callbacks (get-callbacks-for-class class))))
for n from 0
append `(,symb (select-dynamic-values ,callback-object ,n))))))
append `(,symb (nth ,n (funcallables ,callback-object)))))))
;; Helpers that define a single GSL function interface
;; Liam Healy 2009-01-07 22:02:20EST defmfun-single.lisp
;; Time-stamp: <2009-03-22 15:40:17EDT defmfun-single.lisp>
;; Time-stamp: <2009-03-29 10:11:26EDT defmfun-single.lisp>
;; $Id: $
(in-package :gsl)
......@@ -186,8 +186,8 @@
callback-dynamic (first callback-dynamic-variables))
(when callback-object (callback-set-dynamic callback-object arglist))
(when callback-object (callback-set-dynamic callback-object arglist)))
,@(callback-set-slots callbacks callback-dynamic-variables)
(let ((,cret-name
;; Generate a lambda that calls the user function; will be called by callback.
;; Liam Healy
;; Time-stamp: <2009-03-28 23:39:28EDT funcallable.lisp>
;; Time-stamp: <2009-03-29 10:00:03EDT funcallable.lisp>
;; $Id$
(in-package :gsl)
......@@ -120,7 +120,7 @@
;;;; Create a lambda form suitable for call by defmcallback
(defun make-funcallable (user-function fnspec scalarsp dimension-values)
(defun make-funcallable-form (user-function fnspec scalarsp dimension-values)
"Define a wrapper function to interface GSL with the user's function.
scalarsp will be either T or NIL, depending on whether the user function
expects and returns scalars, and dimension-values should be a list
......@@ -167,3 +167,15 @@
;; If it isn't either of these things, return what the
;; function returned.
(otherwise nil)))))
(defun make-funcallables-for-object (object)
"Make compiled functions for the object that can be funcalled in the callback."
(slot-value object 'funcallables)
(lambda (fn fnspec)
(make-funcallable-form fn fnspec (scalarsp object) (dimensions object))))
(functions object)
(parse-callback-static (callbacks object) 'functions))))
;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2009-03-22 19:52:53EDT mobject.lisp>
;; Time-stamp: <2009-03-29 10:04:13EDT mobject.lisp>
;;; GSL objects are represented in GSLL as and instance of a 'mobject.
;;; The macro demobject takes care of defining the appropriate
......@@ -166,7 +166,9 @@
:return (object)
,@(when inputs `(:inputs ,inputs))
,@(when callbacks
((make-funcallables-for-object object))
(lambda ()
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