FUNCLIST

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

funclist_add, funclist_call - manipulate lists of function pointers  

SYNOPSIS

#include <funclist.h>

void funclist_add(flp, func, arg1)
FUNCLIST **flp;
void (*func)(void *, void *);
void *arg1;

void funclist_call(fl, arg2)
FUNCLIST *fl;
void *arg2;  

DESCRIPTION

A function list is a linked list of function pointers that can be invoked at some future time. These are often used to handle exceptional conditions in generic library routines. The implementation is not particularly efficient; these are intended primarily to allow flexible recovery from relatively rare error conditions.

Function lists are declared using:

       FUNCLIST *FuncListHead = FUNCLISTNULL;

Functions are added to the list using:

       funclist_add(&FuncListHead, &func, arg1)

where ``func'' is the name of the function to be invoked. The arg1 argument is passed as the first parameter to the function when it is called, and is otherwise uninterpreted.

Function lists are invoked using:

       funclist_call(FuncListHead, arg2)

Functions are invoked in the opposite order of their addition to the function list. Each function is called as:

       func(arg1, arg2);

That is, the first argument is from the addition to the list, and the second is from the invocation.  

BUGS

There should be some way to remove functions from the list.  

AUTHOR

Eric Allman, University of California, Berkeley.


 

Index

NAME
SYNOPSIS
DESCRIPTION
BUGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 10:08:09 GMT, December 12, 2024