# New Ticket Created by Josef Höök # Please include the string: [perl #15890] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=15890 >
Lets try send this mail again .. ----- In pmc.c i've added a function that calls for init_pmc() vtable function. ----- /Josef -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/32449/26788/bc1b90/pmc.patch
--- ../parrot.key.orig/pmc.c Thu Jul 18 00:37:54 2002 +++ pmc.c Thu Jul 18 15:32:20 2002 @@ -96,6 +96,41 @@ return pmc; } +PMC * +pmc_new_sized_pmc(struct Parrot_Interp *interpreter, + INTVAL base_type, PMC *p) +{ + PMC *pmc = new_pmc_header(interpreter); + + if (!pmc) { + internal_exception(ALLOCATION_ERROR, + "Parrot VM: PMC allocation failed!\n"); + return NULL; + } + + /* Ensure the PMC survives DOD during this function */ + pmc->flags |= PMC_immune_FLAG; + + pmc->vtable = &(Parrot_base_vtables[base_type]); + + if (!pmc->vtable || !pmc->vtable->init_pmc) { + /* This is usually because you either didn't call init_world early + * enough or you added a new PMC class without adding + * Parrot_(classname)_class_init to init_world. */ + PANIC("Null vtable used"); + return NULL; + } + + /* Call init_pmc with correct pmc */ + pmc->vtable->init_pmc(interpreter, pmc, p); + + /* Let the caller track this PMC */ + pmc->flags &= ~PMC_immune_FLAG; + return pmc; +} + + + /* * Local variables: * c-indentation-style: bsd --- ../parrot.key.orig/include/parrot/pmc.h Thu Jul 18 00:37:54 2002 +++ include/parrot/pmc.h Thu Jul 18 15:36:28 2002 @@ -122,6 +122,9 @@ PMC *pmc_new(struct Parrot_Interp *interpreter, INTVAL base_type); PMC *pmc_new_sized(struct Parrot_Interp *interpreter, INTVAL base_type, INTVAL size); +PMC *pmc_new_sized_pmc(struct Parrot_Interp *interpreter, INTVAL base_type, + PMC *p); + #endif