I was wondering if it is possible to call "setprop" from within the init function from a PMC. I want all PMC's of a particular type to have some property. so:
void init { /* do init stuff */ /* create a keystring, called "keystring" */ /* create some value, in this case also a string: "valuestring" */
/* looked up prototype in "include/parrot/vtables.h", not sure about 2nd argument */
On Thu, 15 May 2003 15:39:19 +0300, Nick Kostirya wrote: >For successful building parrot under Win32 need define snprintf as _snprintf >into longopt.c file.
Unfortunately, this exact change was submitted earlier this week (by me), and contested; Brent Dax thinks that Parrot_snprintf should be used instead. The longopt author, Luke Palmer, did not disagree. See: http://bugs6.perl.org/rt2/Ticket/Display.html?id=22174 Ticket #22174 [PATCH] snprintf link errors on Win32
Later today, I will submit a patch to match Brent's request. If he and Luke raise no objection, I will commit it, otherwise I will commit the original patch until we work out a better solution.
In perl.perl6.internals, you wrote: > I was wondering if it is possible to call "setprop" from within the init = > function from a PMC. > I want all PMC's of a particular type to have some property.
Should be no problem. When C<init> gets called on a newly created PMC everything is already in place. The only thing to worry about is loosing the newly created PMC due to infant mortality. So placing the call between Parrot_DOD_block / _unblock is probably necessary.
In perl.perl6.internals, you wrote: > SELF->vtable->setprop(INTERP, SELF, (PMC *)keystring, (PMC = > *)valuestring);
Ah hoppala:
> This will compile, but when I "getprop" in PASM, it won't run. So, I'm = > doing something wrong.=20
Third parameter is a real STRING (the key), last is a PMC in your case a PerlString - the value. No casts necessary/allowed. Please have a look at default.pmc and the property tests.
I wouldn't assume that I knew what I was doing ;-) These days, i think something with Parrot_sprintf would be the way to go.. I'm pretty out of touch though.
--Josh
At 15:39 on 05/15/2003 +0300, "Nick Kostirya" <n...@han.kherson.ua> wrote: