.\"determine whether or not a given variable is a function pointer
.DT
functionp
$MUDNAME$ driver help
functionp

.SH Name
.SI 5
functionp() - determine whether or not a given variable is a function pointer
.EI

.SH Synopsis
.SI 5
int functionp( mixed arg );
.EI

.SH Description
.SP 5 5
Return nonzero if `arg' is a function pointer and zero (0) otherwise.
Function pointers are variables of type 'function' as indicated in the
documentation for the type 'function', for example:
.EP

.SI 5
f = (: call_other, obj, func :);
.EI

.SP 5 5
The return value indicates the type of function pointer using the
values given in the driver include file <drvier/function.h>.
.EP

.SO 10 15 15
	FP_LOCAL	lfun pointer
	FP_EFUN efun pointer
	FP_SIMUL	simul pointer
	FP_FUNCTIONAL	functional
.EO

.SI 5
These values are bit values; the following flags may be added as well:
.EI

.SO 10 20 -35
	FP_HAS_ARGUMENTS	arguments were included in the definition
	FP_OWNER_DESTED the owner of this function pointer has been destructed
	FP_NOT_BINDABLE it isn't possible to rebind this function pointer
.EO

.SI 5
To test if a function variable is an efun pointer:

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

to test if it is an efun or simul_efun:

if (functionp(f) & (FP_EFUN | FP_SIMUL)) ...

Try (very hard) to call the function:

if (functionp(f) & FP_OWNER_DESTED) {
   if (functionp(f) & FP_NOT_BINDABLE)
       error("Function could not be rebound.\n");
   f = bind(f, this_object());
}
evaluate(f);
.EI

.SH See also
.SI 5
mapp(), stringp(), pointerp(), objectp(), intp(), bufferp(), floatp(),
nullp(), undefinedp(), errorp(), bind(), function
.EI
