On Tue, May 03, 2005 at 10:35:50AM -0700, chromatic wrote:
> On Tue, 2005-05-03 at 14:48 +0100, Nicholas Clark wrote:
> 
> > > And should they eventually even be autogenerated ;)
> > Now, that bit I agree with. A task for someone who likes writing perl?
> 
> I like writing Perl.  Where can I find the source information, where
> should I write it, and how should it look?

I don't know the full spec for the task. What I do know is that there are many
vtable methods, defined in vtable.tbl, accessible via Parrot::Vtable, and for
all the appropriate ones, a C wrapper would be useful. Currently they're
prototyped in include/parrot/extend.h and defined in src/extend.c.  Those two
files also contain prototypes and definitions for some other non-vtable
functions useful to extenders. I assume that if the C wrappers are
autogenerated, then than would mean a new 100% autogenerated header file
#included by "parrot/extend.h", and a new C file, leaving just the other
non-vtable functions in the existing 2 files.

I don't know what the list of appropriate functions to wrap is. I assume that
Leo/Chip can make a definitive criteria, but I'm guessing that it could be
most vtable methods except for the MMD ones, given what Leo has already
said.

For example, vtable.tbl defines:

INTVAL get_integer_keyed_int(INTVAL key)

The C code that wrap this is:

/*

=item C<Parrot_Int
Parrot_PMC_get_intval_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
                             Parrot_Int key)>

Return the keyed, signed integer value of the value in the PMC.

=cut

*/

Parrot_Int Parrot_PMC_get_intval_intkey(Parrot_INTERP interp, Parrot_PMC pmc, 
Parrot_Int key) {
    Parrot_Int retval;
    PARROT_CALLIN_START(interp);
    retval = VTABLE_get_integer_keyed_int(interp, pmc, key);
    PARROT_CALLIN_END(interp);
    return retval;
}


and looks like it can be autogenerated fairly easily from the parameter types
and return type declared in vtable.tbl, *except* for that choice of
name. Should we be regularising the C wrappers to have the same names as the
vtable entries?
ie s/Parrot_PMC_get_intval_intkey/Parrot_PMC_get_integer_keyed_int/
and similarly for quite a few other functions in extend.c?

Nicholas Clark

Reply via email to