<HEAD> <TITLE> functionp - determine whether or not a given variable is a function pointer </TITLE> </HEAD> <BODY BACKGROUND=http://www.imaginary.com/~beek/gifs/bg.jpg TEXT=#000000 ALINK=#FFFF00 VLINK=#550000 LINK=#000099> <center> <H1> functionp - determine whether or not a given variable is a function pointer </H1> </center> <p> <b> int functionp( mixed arg ); </b> <p> 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: <p> f = (: call_other, obj, func :); <p> The return value indicates the type of function pointer using the values given in the driver include file "include/function.h". <p> <DL> <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_LOCAL - lfun pointer <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_EFUN - efun pointer <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_SIMUL - simul pointer <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_FUNCTIONAL - functional </DL> <p> These values are bit values; the following flags may be added as well: <p> <DL> <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_HAS_ARGUMENTS - arguments were included in the definition <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_OWNER_DESTED - the owner of this function pointer has been destructed <DT> <IMG SRC = http://www.imaginary.com/Graphics/Whiteball.gif> FP_NOT_BINDABLE - it isn't possible to rebind this function pointer </DL> <p> To test if a function variable is an efun pointer: <p> if (functionp(f) & FP_EFUN) ... <p> to test if it is an efun or simul_efun: <p> if (functionp(f) & (FP_EFUN | FP_SIMUL)) ... <p> Try (very hard) to call the function: <p> <pre> 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); </pre> <p> <HR> <ADDRESS> <A HREF=http://wagner.princeton.edu/~tim> Tim Hollebeek </A> <p> <A HREF="http://www.imaginary.com/~beek/"> Beek </A>@ZorkMUD, Lima Bean, IdeaExchange, TMI-2, and elsewhere </ADDRESS>