>>>>> "Hildo" == Hildo Biersma <[EMAIL PROTECTED]> writes:
Hildo> I'm looking at writing Parrot support for a vendor library: IBM MQ Hildo> (Message Queueing, aka "MQSeries", aka "WebSphere MQ"). The current Hildo> perl module (which I maintain) uses XS code and Parrot's NCI should Hildo> simplify this a lot. Hildo> I have two questions though: This thread got side-track with perl5 issues, so let me ask again: - Are there any examples of creating a PMC class that maps to a C structure, with the PMC class (in C) setting defaults and adding accessor methods? - How do I define a class with constant values that are accessible to other classes? E.g. I want to be able to use constants like this pseudo-code: OpenOptions.Flags = WMQ.MQC.MQOO_READ_ONLY where MQOO_READ_ONLY is a typed constant that lives in the WMQ.MQC class. Hildo> - MQ has some data structures that are a tad too complex to use Hildo> Parrot's UnManagedStruct and ManagedStruct. In addition, the C Hildo> structures need to be initialized with a non-zero default from an Hildo> IBM header file, so there needs to be C code. Hildo> Does anyone have code examples of how to create a PMC class that Hildo> maps to external C structure definitions and how to use such a PMC Hildo> class with NCI code? Hildo> - MQ has constants. Thousands of them. In the perl module, these get Hildo> mapped to perl XS subroutines (which bloats the symbol table no Hildo> end). For parrot, I'd prefer to use two big hash tables of the type Hildo> name => PMC with (value, kind, description) Hildo> value => name (for reason codes only) Hildo> What's the best way to create a big hash table in parrot? I have Hildo> an existing perl script to parse the IBM MQ header files and generate Hildo> perl source code, so generating parrot code is not the issue - Hildo> really, it's what the best structure in parrot is. Hildo> I'd prefer to optimize for smallest data structure size, and am Hildo> willing to take a minor hit at lookup time; looking up constants is Hildo> not performance-critical.