Re: [pure-lang-users] C macros
Status: Beta
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-08-26 00:53:02
|
Eddie Rucker wrote: > Great. MACROS :) Better yet: HYGIENIC macros. :-P I'm falling asleep at the keyboard (past 2:30am over here), will reply to your questions in more detail tomorrow. Just some quick remarks: - You can make a C function fail, but only if it returns an expr* (pure_expr* on the C side), then you can just return a null pointer. So you need to provide a wrapper for the GSL function which returns a real pure_expr*, that's probably not what you want I guess. But for hard error conditions like alloc failure it would be ok to just throw a Pure exception, no? - I'd eventually like the GSL matrices to be some kind of native type in Pure if possible. For the time being, I'd suggest to wrap them up in a Pure constructor (matrix p or something like that where p is the pointer to the GSL struct or whatever it is). - Accessing the fields of a struct through pointers in Pure is possible (see the stuff at the end of primitives.pure), but probably non-portable. You'd probably need some getter/setter functions in your wrapper to do that in a safe way. G'night, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |