Leopold Toetsch wrote:
Klaas-Jan Stol wrote:
hi,
I'm currently trying to check out the NCI. As my Lua compiler only
uses PMCs (and not I/N/S registers), calling C functions will only be
done with PMCs.
I couldn't find info on this matter: suppose I have this string PMC,
how can I access the actual string in it?
so, when calling:
void print_pmc(void *PMC)
{
// how to access the string in P?
}
If it's a stringish PMC, then STRING *s = VTABLE_get_string(INTERP,
p); will do it.
The C code is just in a .c file, it's not like a PMC or something. So, I
don't think I can use "INTERP", or VTABLE_get_string() at all. Or should
I link to parrotlib.a or something?
Is there some public API for accessing the fields in a PMC (for standard
PMCs, so accessing the intval for the Integer PMC and its decendents,
floatval for Float PMC, stringval for String PMCs, etc) ?
You might also consider switching to branches/leo-ctx5. The new
calling conventions do auto-conversion betwen PMCs and I/S/N in both
directions for NCI too.
Forgive my ignorance, but I don't really understand. I'm only using
PMCs, no I/S/N values. Why would using these auto-conversions be
interesting?
Btw, I also got this leo-ctx5 branch, compiled it, and run it from the
directory where my lua stuff is, like this:
$ ../leo-ctx5/parrot a.pir
it says:
PackFile_FixupTable_unpack: Unknown fixup type 1953066601!
PackFile_unpack segment 'FIXUP_luaglobals.pir' failed
Segmentation fault
I got this branch by doing this: (was not sure about the command, but I
considered this most probable)
svn checkout http://svn.perl.org/parrot/branches/leo-ctx5
Any idea what's wrong and causing the error?
klaas-jan