routine_id() question

new topic     » topic index » view thread      » older message » newer message

The euphoria doc's state that 'routine_id()' is ideal for creating a case/switch
statement, I have to agree but I ran into a slight drawback trying to create the
the following switch.

Eu does'nt allow me to aquire a routine id for a built-in routine.
ie: i tried the following

constant
    --
    mempoke = routine_id("poke")    -- built-in eu routine
            & routine_id("poke2")   -- custom user routine
            & routine_id("poke3")   -- custom user routine
            & routine_id("poke4")   -- built-in eu routine

-- the built-in routines return -1 when passed to routine_id(). (invalid)
-- the idea was to use a switch routine like the following instead of the
   if...elsif...end if -- statements.

-- ie - just an example.
   procedure pokemem(atom addr, object data, integer bpp)
       call_proc(mempoke[bpp], {addr, data})
   end procedure


maybee routine_id() could be reworked to aquire a handler for a built-in
routine in the future. Just some food for thought.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu