pike.git/
src/
interpret.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-06-08
2001-06-08 16:25:48 by Henrik Grubbström (Grubba) <grubba@grubba.org>
c3805affb1d6cb436b76216c48d1866cb91a09de (
35
lines) (+
29
/-
6
)
[
Show
|
Annotate
]
Branch:
7.9
Added safe_apply_handler().
Rev: src/interpret.c:1.202
Rev: src/interpret.h:1.87
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: interpret.c,v 1.
201
2001/06/08
12
:
23
:
01
mast
Exp $");
+
RCSID("$Id: interpret.c,v 1.
202
2001/06/08
16
:
25
:
48
grubba
Exp $");
#include "interpret.h" #include "object.h" #include "program.h"
1203:
function->num_calls++; #endif
-
if(function->func.offset == -1)
+
if(function->func.offset == -1)
{
generic_error(NULL, Pike_sp, args, "Calling undefined function.\n");
-
+
}
#ifdef PROFILING #ifdef HAVE_GETHRTIME
1282:
num_locals=EXTRACT_UCHAR(pc++); num_args=EXTRACT_UCHAR(pc++);
+
#ifdef PIKE_DEBUG
+
if(num_locals < num_args)
+
fatal("Wrong number of arguments or locals in function def.\n"
+
"num_locals: %d < num_args: %d\n",
+
num_locals, num_args);
+
#endif
+
if(function->identifier_flags & IDENTIFIER_SCOPE_USED) new_frame->expendible+=num_locals;
1309:
if(num_locals > args) clear_svalues(Pike_sp, num_locals - args); Pike_sp += num_locals - args;
-
#ifdef PIKE_DEBUG
-
if(num_locals < num_args)
-
fatal("Wrong number of arguments or locals in function def.\n");
-
#endif
+
new_frame->num_locals=num_locals; new_frame->num_args=num_args; new_frame->save_mark_sp=Pike_mark_sp;
1637:
safe_apply_low(o, find_identifier(fun, o->prog), args); }
+
PMOD_EXPORT void safe_apply_handler(const char *fun,
+
struct object *handler,
+
struct object *compat,
+
INT32 args)
+
{
+
int i;
+
if (handler &&
+
(i = find_identifier(fun, handler->prog)) != -1) {
+
safe_apply_low(handler, i, args);
+
} else if (compat &&
+
(i = find_identifier(fun, compat->prog)) != -1) {
+
safe_apply_low(compat, i, args);
+
} else {
+
SAFE_APPLY_MASTER(fun, args);
+
}
+
}
+
PMOD_EXPORT void apply_lfun(struct object *o, int fun, int args) { #ifdef PIKE_DEBUG