pike.git/
src/
interpret.c
Branch:
Tag:
Non-build tags
All tags
No tags
2003-07-30
2003-07-30 18:51:15 by Martin Stjernholm <mast@lysator.liu.se>
5cc20b699fe98c72be9c67d7fd62aa7488145025 (
30
lines) (+
23
/-
7
)
[
Show
|
Annotate
]
Branch:
7.9
Improved error checking for missing functions before calling them.
Rev: src/interpret.c:1.310
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: interpret.c,v 1.
309
2003/07/
18
09
:
58
:
42
grubba
Exp $
+
|| $Id: interpret.c,v 1.
310
2003/07/
30
18:
51
:
15
mast
Exp $
*/ #include "global.h"
-
RCSID("$Id: interpret.c,v 1.
309
2003/07/
18
09
:
58
:
42
grubba
Exp $");
+
RCSID("$Id: interpret.c,v 1.
310
2003/07/
30
18:
51
:
15
mast
Exp $");
#include "interpret.h" #include "object.h" #include "program.h"
1516:
break; }
-
call_lfun:
+
call_lfun:
{
+
int lfun;
#ifdef PIKE_DEBUG if(fun < 0 || fun >= NUM_LFUNS) Pike_fatal("Apply lfun on illegal value!\n"); #endif if(!o->prog) PIKE_ERROR("destructed object", "Apply on destructed object.\n", Pike_sp, args);
-
fun
= FIND_LFUN(o->prog, fun);
+
lfun
= FIND_LFUN(o->prog, fun);
+
if (lfun < 0)
+
Pike_error ("Cannot call undefined lfun %s.\n", lfun_names[fun]);
+
fun = lfun;
goto apply_low;
-
+
}
-
+
case APPLY_LOW: o = (struct object *)arg1; fun = PTR_TO_INT(arg2);
2043:
struct pike_string *fun, int args) {
-
apply_low(o,
find_shared_string_identifier(fun, o->prog), args);
+
int
id =
find_shared_string_identifier(fun, o->prog)
;
+
if (id >= 0)
+
apply_low(o
,
id,
args);
+
else
+
if (fun->size_shift)
+
Pike_error ("Cannot call unknown function.\n");
+
else
+
Pike_error ("Cannot call unknown function \"%s\".\n", fun->str);
} PMOD_EXPORT void apply(struct object *o, const char *fun, int args) {
-
apply_low(o,
find_identifier(fun, o->prog), args);
+
int
id =
find_identifier(fun, o->prog)
;
+
if (id >= 0)
+
apply_low(o
,
id,
args);
+
else
+
Pike_error ("Cannot call unknown function \"%s\".\n", fun);
}