LPC Library Functions: functionp

NAME

functionp() - determine whether or not a given variable is a function pointer, and if so what kind

SYNOPSIS

int functionp( mixed arg );

DESCRIPTION

functionp() returns nonzero if `arg' is a function pointer and zero (0) otherwise. The return value indicates the type of function pointer using the values given in the driver include file "include/function.h".

function pointer type     value
---------------------     -----
call_other                FP_CALL_OTHER
lfun                      FP_LOCAL
efun                      FP_EFUN
simul_efun                FP_SIMUL
functional                FP_FUNCTIONAL
In addition, the following values will be added in some cases:
(arguments provided)      FP_HAS_ARGUMENTS
(creator has been dested) FP_OWNER_DESTED
(not rebindable)          FP_NOT_BINDABLE
The last set of values are bit values and can be tested with bit operations. The value FP_MASK is provided for ignoring the bit values and testing the basic type of the function pointer.

Examples:

To test if a function variable is an efun pointer:

if ((functionp(f) & FP_MASK) == FP_EFUN) ...

To test if it has arguments:

if (functionp(f) & FP_HAS_ARGUMENTS) ...

SEE ALSO

mapp(), stringp(), pointerp(), objectp(), intp(), bufferp(), floatp(), nullp(), undefinedp(), errorp(), bind()

Page design by Frank Jacquette & Tim Hollebeek
Copyright (C) 1998 Tim Hollebeek & Frank Jacquette
Back to MudOS