>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:
> I'm pondering, once again, more things with the Postgres interface. In > this case I need to pass in arrays of ints (and floats, I suppose) and > arrays of char pointers. My first thought is to have a new type that > converts an Array (or something like it) to a C array, either of ints > or char pointers. That'd solve my problem quite nicely. But... that > begs the question--is it going too far? Is this the sort of stuff that > ought to have custom C interfaces for, rather than adding in Yet More > Types to the NCI interface? that would solve a current xs problem now. i had to custom write a c int array to (or from, i forget) to perl array as swig didn't have direct support for it. so having builtin conversions (both ways) for at least c arrays of int/float/char* to/from perl would be nice. and it would make it easier to run swig on such beasts as well. now, a hash to/from c is a horse of a different color. what would the c look like? a linked list of pairs of char*? a double length array of char* with each pair being a key/value (this would be similar to converting an array)? two arrays of char*, one for keys and one for values? and values can be anything so those char* need to be void*. and in p6 keys can be anything so that means void * for that. and do we have to pass the types of the key/values for each pair as well? that is needed if you want to convert them to/from the proper scalar types. and converting from c whatever to a p6 hash would only work if you had the data in some format that is supported by this interface. the main point being that there should be some standard ways to integrate c and perl data via nci. it won't cover all possible things but enough common ones so we don't have to reinvent that wheel each time. and array (and basic hashes) are common enough to deserve support. we do want to make interfacing to c to be a breeze and not the pain it is now. just opening a jumbo can o'worms for your holiday meal. :) uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org