Am Donnerstag, 28. September 2006 12:47 schrieb Karl Forner:
I suppose that again it is a trivial question, but I did not manage to find
the answer by myself in the documentation.
So I want for example to call diretly the elements method on a
FixedBooleanArray
I tried
pmc.elements()
pmc.elements()
pmc._elements()
pmc.__elements()
But it did not work...
Exactly. Due to asymmetry of methods and vtables, the latter are not
accessible as methods. You have to use the equivalent opcode:
$I0 = elements ar_pmc
But you can code a PIR wrapper for it:
.namespace ['FixedBooleanArray']
.sub 'elements' :method
$I0 = elements self
.return ($I0)
.end
usable as:
$I0 = ar_pmc.'elements'()
In fact, what I really want to do, for debugging purposes, is to add a
custom method in the FixedBooleanArray.pmc (e.g get_allocated_size() ) and
be able to call it
from PIR test code.
As you need PMC internals for this, you'd have to add it to the .pmc itself
(temporarely):
METHOD INTVAL get_allocated_size() {
return PMC_int_val2(SELF); /* or whatever */
}
Thanks
Karl Forner
HTH,
leo