/*
* fp.c
*
* define functions for functionpointers
*
* (C) Frank Schmidt, Jesus@NorseMUD
*
*/
/* test if <var> is a function */
static int functionp(mixed var) {
if (arrayp(var) && ::sizeof(var) == 2 && stringp(_FUNC(var))) {
switch (typeof(_OB(var))) {
case T_OBJECT:
case T_STRING:
return 1;
}
}
return 0;
}
/* call a functionpointer with some arguments */
static varargs mixed call_fp(mixed fp, mixed args...) {
if (functionp(fp))
return __call_other(_OB(fp), _FUNC(fp), args...);
error("Illegal argument 1 to function call_fp(), needs functionpointer.");
return 0;
}