Re: NO!!!!

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

Wellll.... you can do this *sort* of thing already in Euphoria.

----------------
global constant Kerror_BadFunc = -1,
                Kerror_BadParms = -2

global constant Kwin_main = 1,
                Kmessagebox = 2,
                Kmenu = 3

sequence doit doit = {}


global procedure setdoit(integer idx, integer rid)
-- Use this to establish a creation routine.
-- 'idx' is the code for the type of thing being created.
-- 'rid' is the routine_id that will do the creation.

    if idx > length(doit) then
        doit &= repeat(-1, idx - length(doit))
    end if
    doit[idx] = rid

end procedure

-- Create a main window.
function win_main(sequence parms)
 -- do winmain stuff here
 return(whatever)
end function

-- Create a menu
function menu(sequence parms)
-- do main menu here
return(whatever)
end function

-- Create a message box
function messagebox(sequence parms)
-- make a message box here
return("yeas, it's done","this is where")
end function

-- Launch the requested creation function.
global function create(integer createwhat, sequence parms)
    integer rc

    rc = Kerror_BadFuncId
    if    (createwhat <= length(doit))
      and (createwhat > 0)
      and doit[createwhat] >= 0
    then
       rc = call_func(doit[createwhat], {parms} )
    end if

    return rc
end function

-- Set up some internal creation functions.
setdoit(Kwin_main,   routine_id("win_main") )
setdoit(Kmenu,       routine_id("menu") )
setdoit(Kmessagebox, routine_id("messagebox") )
------------------

Using a scheme like this means that you can define your own private creation
routine and then just set the "doit" value and calling create(), just like
the built-in controls. You can even override the built-in creation routines
this way.

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, February 10, 2001 9:38 AM
Subject: Re: NO!!!!


> On 9 Feb 2001, at 13:34, tone.skoda at SIOL.NET wrote:
>
> > Win32Lib isn't designed to be fast when it will become very big.
> > For example: Everything you create in Win32Lib goes thru
> > create() function. What if some day there would be
> > 1000 different things that could be created?
> > Then that create() function would become slower, let's not
> > even talk about WndProc where every message is processed -
> > 1000 ifs would make it slower.
>
> That where the execution of vars, and not needing to predeclare things,
would be most
> handy.
>
> ************************
> global function create(sequence createwhat)
> goto createwhat
> if error return("no such function","errorcode") end if
>
> :win_main
>  -- do winmain stuff here
>  return(whatever)
>
> :menu
> -- do main menu here
> return(whatever)
>
> :messagebox
> -- make a message box here
> return("yeas, it's done","this is where")
>
> end function
> *************************
>
> The interpreter or compiler could optimise so the targets are pre-munged,
and it's an
> machine code compare to get to the targets, very fast. But then, Robert is
against
> executing variables, goto's, and premunging.
>
> Kat
>
>
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu