Re: Functions for embedders to override

[email protected] (Dan Sugalski) Mon, 9 Aug 2004 18:07:00 -0400
Newsgroups perl.perl6.internals,perl.ponie.dev
Message-ID <a0611040dbd3da5b5c150@[172.24.18.98]>
At 5:44 PM -0400 8/9/04, Matt Fowles wrote:
>Dan~
>
>
>On Mon, 9 Aug 2004 17:22:18 -0400, Dan Sugalski <[email protected]> wrote:
>>  At 12:04 PM -0400 8/9/04, Dan Sugalski wrote:
>>  >Since we're running into Ponie issues with this, which means we'll
>>  >run into Apache issues as well as any number of other systems....
>>  >
>>  >When Parrot's being embedded I can see the following functions
>>  >needing overriding by the embedder:
>>  >
>>  >*) Memory: malloc, realloc, calloc, free
>>  >*) Signals: handler register, Handler un-register, signal raise, alarm set
>>  >*) Files: Open, close, seek, tell, read, write. (Possibly asynchronously)
>>
>>  And we want to add exiting to that list. Which presents some
>>  interesting issues we need to think about, since we probably need to
>>  throw an exit exception instead.
>>
>
>Would having a table of function pointers for these various functions
>be an appropriate solution, or does that have issues that I am not
>seeing?  We could then initialize them ourselves at startup (even
>using different allocaters based on commandline switches) and then
>provide routines to set these later (if someone wanted to do it that
>way).

A global table of functions is an excellent way to go about this, and 
what we should do ourselves internally. Having a:

   Parrot_Override_Function(INTVAL funcnum, (wacky function pointer 
cast)funcptr)

entry in the embedding API wouldn't be out of order either, I think.
-- 
				Dan

--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[email protected]                         have teddy bears and even
                                       teddy bears get drunk