Re: [q-lang-users] Memory management in libqint
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-06-12 19:28:09
|
John Cowan wrote: > Ah, excellent. Please add this note to the next release of qint.h. Done (in cvs). > The only remaining point of doubt is whether the argv array itself > (as opposed to its strings) in execv(x) belongs to Q. No, they belong to the caller. > Chicken is 8-bit by default, but has a UTF-8 egg that changes all > internal strings to UTF-8. I'm not sure how to handle this yet; > I may simply say that the UTF-8 egg is a prerequisite for the Q egg. Well, if you can check whether that UTF-8 "egg" is loaded (what a funny name for a module ;-) then you can omit the conversion if so. > Bignums are also an issue: Chicken has none by default but does have > a "full numeric tower" egg that uses MPZ. I have to figure out how > to determine the proper representation of a Chicken number in order > to pass it to Q properly. In that case you should be able to check what kind of integer you have in Chicken? Then just pass it as an mpz_t if it already is one (don't forget to copy it since mpz_t objects become owned by Q when you pass them to qmkmpz). When decoding a Q integer, you should convert to the smallest type able to represent the number (i.e., first try qisuint [if there's a separate unsigned integer type in Chicken], then qisint and finally qismpz). If the number is only representable as a bignum but the bignum "egg" hasn't been loaded in Chicken, then you must either give up or convert it to something which fits into a machine integer (take the lowest limb or something). 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 |