Uri Guttman <[EMAIL PROTECTED]> wrote:

>        settimer Pevent, Idelay_seconds, Iinterval_seconds[, Pcallback,
>        Puserdata]

> so now all you have is two signatures (for float or integer seconds).

No. Above C<setttimer> definition expands to 8 different functions for
INTVAL arguments only:

  Parrot_settimer_p_i_i
  Parrot_settimer_p_i_i_p_p
  Parrot_settimer_p_i_ic
  Parrot_settimer_p_i_ic_p_p
  Parrot_settimer_p_ic_i
  Parrot_settimer_p_ic_i_p_p
  Parrot_settimer_p_ic_ic
  Parrot_settimer_p_ic_ic_p_p

When you use NULL PMCs for the optional arguments there are still 4.

This is "one" opcode only for one specific event. When we start creating
opcodes for each possible event, we'll have tons of additional opcodes.
This is really not needed.

This is the current and working code to program a timer:

    new P1, .Array
    set P1, 8
    set P1[0], .PARROT_TIMER_NSEC
    set P1[1], 0.2
    set P1[2], .PARROT_TIMER_HANDLER
    find_global P2, "_timer_sub"
    set P1[3], P2
    set P1[4], .PARROT_TIMER_REPEAT
    set P1[5], 2
    set P1[6], .PARROT_TIMER_RUNNING
    set P1[7], 1

    new P0, .Timer, P1

This doesn't use any additional opcodes and is compliant with:
$ perldoc -F docs/pdds/pdd02_vtables.pod
/init_pmc

This scheme is expandable too. The parameters that an event might need
aren't limited and permutations don't hurt.

> uri

leo

Reply via email to