This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: G-Wrap [Re: Foreign function interface generators.]


>>>>> "C" == Clifford Beshers <beshers@cs.columbia.edu> writes:

    C> I did find another small inconsistency.

    C> In your proposed new-constant, the order is: (symbol,) value,
    C> type.  In your propose new-function, the order for parameters
    C> is: type, value.

    C> It seems to me these should be ordered either (value, type) or
    C> (type, value), but not both.

In all the functions, I want to first indicate what is being defined
and then how it is defined, so that is why new-constant and new-type
declarations look like this:

 (new-type 'VEC "VEC"  "VEC_print"  "v_free"  "VEC_eq") ;; vector type
 (new-constant 'VNULL  "NULL" 'VEC)  ;; null-vector

In new-function, the idea for the parameter list is that I want it to
look more like the C function declaration's parameter list.  So to
export a symbol 'eig-dsyev bound to a wrapper which calls the
C-function
  void eig_dsyev(MAT* A, MAT* Z, VEC* w),
we use
  (new-function 'eig-dsyev
	        'void "eig_dsyev" '((MAT A) (MAT Z) (VEC w))
	        "Calculates eigenvalues Z and eigenvectors w of real
symmetric matrix A")

The parameter names are actually
 not in the previously-released versions of
new-function in G-Wrap because they are not actually needed for 
exporting the function.  However, I added them for the sake of
internal documentation and readability.

Does this explanation seem reasonable?
 -Chris