Skip to content
Snippets Groups Projects
Commit 2bf37cb3 authored by liam's avatar liam
Browse files

Improve docstring, rename keyword argument to be more sensible.

git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@2993 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent 84352788
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: Macros to interface GSL functions. ; description: Macros to interface GSL functions.
; date: Mon Mar 6 2006 - 22:35 ; date: Mon Mar 6 2006 - 22:35
; author: Liam M. Healy ; author: Liam M. Healy
; modified: Wed Mar 22 2006 - 10:08 ; modified: Wed Mar 22 2006 - 12:20
;******************************************************** ;********************************************************
(in-package :gsl) (in-package :gsl)
...@@ -112,9 +112,15 @@ and a scaling exponent e10, such that the value is val*10^e10." ...@@ -112,9 +112,15 @@ and a scaling exponent e10, such that the value is val*10^e10."
;;; New name? ;;; New name?
(defmacro defun-sf (defmacro defun-sf
(cl-name arguments gsl-name (cl-name arguments gsl-name
&key documentation return mode (return-code :check-status)) &key documentation return mode (c-return-value :error-code))
"Define a mathematical special function from GSL using the _e form "Define a CL function that provides an interface to a GSL function.
GSL function definition. If cl-name is :lambda, make a lambda." If cl-name is :lambda, make a lambda. Arguments:
arguments: a list of input arguments (symbol type) to the GSL function
gsl-name: the C function name, as a string
documentation: a string
return: a list of return types
mode: T or NIL, depending on whether gsl_mode is an argument
c-return-value: The C function returns an :error-code or :number-of-answers."
(let ((args (mapcar #'first arguments)) (let ((args (mapcar #'first arguments))
(return-symb-type (return-symb-type
(mapcar (lambda (typ) (mapcar (lambda (typ)
...@@ -144,10 +150,10 @@ and a scaling exponent e10, such that the value is val*10^e10." ...@@ -144,10 +150,10 @@ and a scaling exponent e10, such that the value is val*10^e10."
,@(when mode '(sf-mode mode)) ,@(when mode '(sf-mode mode))
,@(mapcan (lambda (r) `(:pointer ,(first r))) return-symb-type) ,@(mapcan (lambda (r) `(:pointer ,(first r))) return-symb-type)
:int))) :int)))
,@(if (eq return-code :check-status) ,@(if (eq c-return-value :error-code)
`((check-gsl-status status `(,',cl-name ,,@args)))) `((check-gsl-status status `(,',cl-name ,,@args))))
(values (values
,@(if (eq return-code :number-of-answers) ,@(if (eq c-return-value :number-of-answers)
(mapcan (mapcan
(lambda (decl seq) (lambda (decl seq)
`((when (> status ,seq) ,@(pick-result decl)))) `((when (> status ,seq) ,@(pick-result decl))))
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: Polynomials ; description: Polynomials
; date: Tue Mar 21 2006 - 18:33 ; date: Tue Mar 21 2006 - 18:33
; author: Liam M. Healy ; author: Liam M. Healy
; modified: Wed Mar 22 2006 - 10:23 ; modified: Wed Mar 22 2006 - 12:10
;******************************************************** ;********************************************************
;;; $Id: $ ;;; $Id: $
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
Two values are always returned; if the roots are not real, these Two values are always returned; if the roots are not real, these
values are NIL." values are NIL."
:return (:double :double) :return (:double :double)
:return-code :number-of-answers) :c-return-value :number-of-answers)
(defun-sf solve-quadratic-complex ((a :double) (b :double) (c :double)) (defun-sf solve-quadratic-complex ((a :double) (b :double) (c :double))
"gsl_poly_complex_solve_quadratic" "gsl_poly_complex_solve_quadratic"
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
Two values are always returned; if a root does not exist, the Two values are always returned; if a root does not exist, the
value returned will be NIL." value returned will be NIL."
:return (gsl-complex gsl-complex) :return (gsl-complex gsl-complex)
:return-code :number-of-answers) :c-return-value :number-of-answers)
;;;;**************************************************************************** ;;;;****************************************************************************
;;;; Cubic Equations ;;;; Cubic Equations
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
in ascending order. Three values are always returned; in ascending order. Three values are always returned;
if a root is not real, the value returned for it will be NIL." if a root is not real, the value returned for it will be NIL."
:return (:double :double :double) :return (:double :double :double)
:return-code :number-of-answers) :c-return-value :number-of-answers)
(defun-sf solve-cubic-complex ((a :double) (b :double) (c :double)) (defun-sf solve-cubic-complex ((a :double) (b :double) (c :double))
"gsl_poly_complex_solve_cubic" "gsl_poly_complex_solve_cubic"
...@@ -160,4 +160,4 @@ ...@@ -160,4 +160,4 @@
with a leading coefficient of unity. Three values are always returned; with a leading coefficient of unity. Three values are always returned;
if a root does not exist, the value returned for it will be NIL." if a root does not exist, the value returned for it will be NIL."
:return (gsl-complex gsl-complex gsl-complex) :return (gsl-complex gsl-complex gsl-complex)
:return-code :number-of-answers) :c-return-value :number-of-answers)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment