diff --git a/src/builtin.cmod b/src/builtin.cmod index e66432331e7608d100c823aea972de0645d005cb..9d24ad6f7d363ccba07f867aa072e6c59911675d 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -20,6 +20,7 @@ #include "cyclic.h" #include "bignum.h" #include "main.h" +#include "operators.h" PIKEFUN array column(array tmp, mixed val) @@ -145,6 +146,35 @@ PIKEFUN int program_inherits(program p, program p2) RETURN !!low_get_storage(p2,p); } +PIKEFUN string program_defined(program p) + errname Program.defined; + optflags OPT_TRY_OPTIMIZE; +{ + if(p && p->num_linenumbers) + { + char *tmp; + INT32 line; + if((tmp=get_line(p->program, p, &line))) + { + struct pike_string *tmp2; + tmp2=make_shared_string(tmp); + pop_n_elems(args); + + push_string(tmp2); + if(line > 1) + { + push_constant_text(":"); + push_int(line); + f_add(3); + } + return; + } + } + + pop_n_elems(args); + push_int(0); +} + PIKEFUN int string_width(string s) errname String.width; optflags OPT_TRY_OPTIMIZE; diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 082bb88b847ffbf157e81eaf6cf2e96d65583d12..1354f4a716c2c6d2b251b606296ecda836871c17 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.278 2000/05/25 20:08:55 hubbe Exp $"); +RCSID("$Id: builtin_functions.c,v 1.279 2000/05/25 22:30:02 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -5483,36 +5483,6 @@ void f_inherit_list(INT32 args) } -void f_program_defined(INT32 args) -{ - struct program *p; - get_all_args("Program.defined",args,"%p",&p); - - if(p && p->num_linenumbers) - { - char *tmp; - INT32 line; - if((tmp=get_line(p->program, p, &line))) - { - struct pike_string *tmp2; - tmp2=make_shared_string(tmp); - pop_n_elems(args); - - push_string(tmp2); - if(line > 1) - { - push_constant_text(":"); - push_int(line); - f_add(3); - } - return; - } - } - - pop_n_elems(args); - push_int(0); -} - void f_function_defined(INT32 args) { check_all_args("Function.defined",args,BIT_FUNCTION, 0);