Stephane Le Cornec <coleste@videotron.ca> writes:
At 10:56 AM -0500 1/10/08, Joel J. Adamson wrote:
Dear Gambit List,
I have a set of datatypes defined with c-define-type based on the GNU Scientific Library. The Gambit-C manual says "For type checking on the Scheme side..." to use the TAG function of the type definition as in
(c-define-type gsl-matrix* (pointer gsl-matrix "gsl-matrix*"))
IIRC, you only use the tag if you multiple c-define-type that are equivalent.
(c-define-type type1* (pointer type1 #f) (c-define-type type2* (pointer type2 "type") (c-define-type type3* (pointer type3 "type")
Here all 3 types are exchangeable.
Good to know. The difference I noted was that if I leave off the tag, I get the C name "gsl_matrix*" in the external representation of the pointer. If I use the tag, I can make it the more lispy "gsl-matrix*" or "gsl-matrix-pointer". Is that not a compelling reason to use it? In other words, is it a waste to do it except in the case you outlined?
What is the best way to use this to define a boolean test (e.g. gsl-matrix*?) for this type? [...] NULL converts to #f, if that's what you're asking.
That was not specifically my question, but it certainly points me in the right direction ;) Phrased in those terms I'm looking for a C procedure (macro?) that returns NULL for only the type I'm querying, i.e. returns anything other than NULL for the intialized datatype. I'll think about this some more. Thanks, Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.