Commit 50da3bc9 authored by Liam Healy's avatar Liam Healy

Fix C argument expansion bug; correct sorting name

Avoid numbers and lists in carg-symbs in expand-defmfun-plain via
c-arguments.  This permits C argument lists with literal constants
(such as the integer 1 in sorting.lisp) to work.  Fix a duplicated
name in sorting.lisp, #'sort-index was #'sort-vector-index.
parent bc22f75c
;; Macro for defining GSL functions.
;; Liam Healy 2008-04-16 20:49:50EDT defmfun.lisp
;; Time-stamp: <2008-08-07 21:09:31EDT defmfun.lisp>
;; Time-stamp: <2008-08-09 18:52:21EDT defmfun.lisp>
;; $Id$
(in-package :gsl)
......@@ -451,13 +451,14 @@
(defun c-arguments (c-arguments)
"Find the arguments passed to the C function. This is a poor
quality code walker, but is sufficient for actual usage of defmfun."
(mapcan (lambda (s)
(let ((val (st-symbol s)))
(if (listp val)
;; walk only a top-level function call
(copy-list (rest val))
(list val))))
(remove :mode c-arguments)))
(remove-duplicates
(mapcan (lambda (s)
(let ((val (st-symbol s)))
(if (listp val)
;; walk only a top-level function call
(remove-if-not #'symbolp (rest val))
(list val))))
(remove :mode c-arguments))))
(defun expand-defmfun-plain (name arglist gsl-name c-arguments key-args)
"The main function for expansion of defmfun."
......
;; Sorting
;; Liam Healy, Fri Apr 14 2006 - 20:20
;; Time-stamp: <2008-07-15 23:00:29EDT sorting.lisp>
;; Time-stamp: <2008-08-09 18:34:29EDT sorting.lisp>
;; $Id$
(in-package :gsl)
......@@ -58,6 +58,7 @@
;;; gives an error:
;;;(defmfun msort ((v vector) &optional (stride 1))
(defmfun msort ((v vector))
("gsl_sort" :type)
(((c-pointer v) :pointer) (1 sizet) ((dim0 v) sizet))
......@@ -79,7 +80,7 @@
:documentation ; FDL
"Sort the elements of the vector v into ascending numerical order.")
(defmfun sort-vector-index ((permutation permutation) (vector vector))
(defmfun sort-index ((permutation permutation) (vector vector))
("gsl_sort" :type "_index")
(((mpointer permutation) :pointer)
((c-pointer vector) :pointer)
......
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