home *** CD-ROM | disk | FTP | other *** search
- #include <useful.h>
- #include <funclist.h>
-
- VERSIONID("$Header: funclist.c,v 2.0 89/12/24 00:56:22 eric Exp $");
-
- /*
- ** FUNCLIST_ADD -- add a function specification to a function list
- **
- ** Parameters:
- ** flh -- the address of a pointer to a function list. Note
- ** that this must be a FUNCLIST **.
- ** func -- the function to add to the list.
- ** arg -- the first argument to the function.
- **
- ** Returns:
- ** none.
- **
- ** Side Effects:
- ** The indicated function is added to the function list
- ** for later invocation by funclist_call.
- **
- ** Author:
- ** Eric Allman
- ** University of California, Berkeley
- */
-
- VOID
- funclist_add(flh, func, arg)
- FUNCLIST **flh;
- VOID (*func)();
- ARBPTR arg;
- {
- register FUNCLIST *fl;
-
- fl = (FUNCLIST *) ckalloc(sizeof *fl);
- fl->_fl_func = func;
- fl->_fl_arg = arg;
- fl->_fl_next = *flh;
- *flh = fl;
- }
- /*
- ** FUNCLIST_CALL -- call all the functions on a function list.
- **
- ** Parameters:
- ** fl -- the function list to call. Unlike funclist_add,
- ** this should not be an indirect pointer.
- ** arg -- the second argument to the functions.
- **
- ** Returns:
- ** none.
- **
- ** Side Effects:
- ** As implied by the function list.
- */
-
- VOID
- funclist_call(fl, arg)
- register FUNCLIST *fl;
- ARBPTR arg;
- {
- while (fl != FUNCLISTNULL)
- {
- (*fl->_fl_func)(fl->_fl_arg, arg);
- fl = fl->_fl_next;
- }
- }
-