[Code] Passing function pointers

From: Mark Crichton (mmarker@expert.cc.purdue.edu)
Date: 10/24/96


but I've forgotten.

   I'm messing with the event queue code found on the ftp site.  It jogged my 
memory into the rather wild way of using a pointer to call a function, but I
noticed that the EVENT() was somewhat limited to only sending set values
(the ptr to ch, the pointer to vict, and a pointer to some info)

   What I would like to do is to allow the add_queue take the variables time,
*function, and a varying number of parameters, so *function could be things
ranging from pulse violence to, (assume I'm sick) a system function call
like select(), which has a LOT of parameters.
   I *KNOW* I'm asking for possible problems with this, but I'd like to know
how it's done.  I know functions like printf() do things like this, but I
don't have libc code lying around for an example :)  Also, am I only limited
to functions in my code for the (*func)(ch, vict, info) trick, or could I
call external functions like select() and what not (note: I wouldn't do 
something as braindead as call select() every tick, but select() was used as
an example of a func that takes a good number of parameters)

Thnaks,
Mark "I'm sick in the head, don't hold it against me" Crichton

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST