Commit 4608e81e authored by liam's avatar liam
Browse files

Fix with-data to generate calloc, set-wrap needed an eval-when.

Combination example now works.


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3024 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent ae60f34e
......@@ -3,7 +3,7 @@
; description: Combinations
; date: Sun Mar 26 2006 - 11:51
; author: Liam M. Healy
; modified: Thu Apr 6 2006 - 18:21
; modified: Thu Apr 6 2006 - 22:44
;********************************************************
;;; $Id: $
......@@ -124,38 +124,19 @@
;;;;****************************************************************************
#|
(loop for i from 0 below 4
;;; This is the example in the GSL manual, but we do not use
;;; the C streams for output, rather we use gsl-aref.
(loop for i from 0 to 4
do
(with-data (comb combination (4 i))
(with-data (comb combination (4 i) t)
(loop repeat 20
while (combination-next comb)
do
(format t "~&{")
(loop for j below (combination-size comb) do
(princ (gsl-aref comb j)))
(princ "}"))))
int
main (void)
{
gsl_combination * c;
size_t i;
printf ("All subsets of {0,1,2,3} by size:\n") ;
for (i = 0; i <= 4; i++)
{
c = gsl_combination_calloc (4, i);
do
{
printf ("{");
gsl_combination_fprintf (stdout, c, " %u");
printf (" }\n");
}
while (gsl_combination_next (c) == GSL_SUCCESS);
gsl_combination_free (c);
}
return 0;
}
do
(princ "{")
(loop for j below (combination-size comb) do
(princ (gsl-aref comb j)))
(princ "}")
while (combination-next comb))))
{}{0}{1}{2}{3}{01}{02}{03}{12}{13}{23}{012}{013}{023}{123}{0123}
|#
......@@ -3,7 +3,7 @@
; description: Using GSL storage.
; date: Sun Mar 26 2006 - 16:32
; author: Liam M. Healy
; modified: Wed Apr 5 2006 - 17:20
; modified: Thu Apr 6 2006 - 22:45
;********************************************************
;;; $Id: $
......@@ -97,7 +97,7 @@
(intern (format nil "GSL-~a-~a" type action))))
(let ((ptr (gensym "PTR")))
`(let* ((,ptr
(,(if zero (cl-name 'alloc) (cl-name 'alloc))
(,(if zero (cl-name 'calloc) (cl-name 'alloc))
,@(if (listp size) size (list size))))
(,symbol
(make-instance ',(intern (format nil "GSL-~a" type))
......
......@@ -3,7 +3,7 @@
; description: Macros to interface GSL functions.
; date: Mon Mar 6 2006 - 22:35
; author: Liam M. Healy
; modified: Wed Apr 5 2006 - 22:52
; modified: Thu Apr 6 2006 - 22:08
;********************************************************
(in-package :gsl)
......@@ -170,7 +170,8 @@ and a scaling exponent e10, such that the value is val*10^e10."
"An alist of type and wrap function for values to and from C.")
(defmacro add-wrap-type (type function)
`(setf *wrap-types* (acons ',type ,function *wrap-types*)))
`(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *wrap-types* (acons ',type ,function *wrap-types*))))
(defun wrap-arg (spec)
"Wrap the symbol with a form that has been specified for
......
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