On Tuesday 23 October 2007 12:32:21 Allison Randal wrote:

> You will need to bundle up the 'sub' argument in a hash (the low-level
> equivalent of named arguments like 'initial_sub'). So, using your
> existing init_pmc, it'll be something like:
>
>    void init_pmc(PMC* sub) {
>      PMC *classobj = Parrot_oo_get_class_str(INTERP,
>                           CONST_STRING(INTERP, "Parrot::Coroutine"));
>
>      if (!PMC_IS_NULL(classobj)) {
>          PMC *init_args = pmc_new(INTERP, enum_class_Hash);
>          VTABLE_set_pmc_keyed_str(INTERP, init_args,
>                              CONST_STRING(INTERP, "initial_sub"), sub);
>          PMC_pmc_val(SELF) = VTABLE_instantiate(INTERP,
>                                                 classobj, init_args);
>      }
>      else
>          real_exception(INTERP, NULL, E_Exception,
>                         "Parrot::Coroutine not found");
>
>    }

... except don't break CONST_STRING across lines, because apparently icc can't 
count and won't compile.

One might assume that being able to count is less of a burden than handling 
pointer math correctly, but I never took a compilers course so I could be 
misisng something.

-- c

Reply via email to