pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #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"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:1196:    my_strcat(function->name->str);    do_trace_call(args);    }       Pike_fp = new_frame;      #ifdef PROFILING    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    new_frame->self_time_base=function->total_time;   #endif   #endif       tailrecurse=-1;    switch(function->identifier_flags & (IDENTIFIER_FUNCTION | IDENTIFIER_CONSTANT))    {
pike.git/src/interpret.c:1275: Inside #if defined(PIKE_DEBUG)
   if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_KILL)    fatal("Pike code called within gc.\n");   #endif       debug_malloc_touch(Pike_fp);    pc=new_frame->context.prog->program + function->func.offset;       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;       /* adjust arguments on stack */    if(args < num_args) /* push zeros */    {    clear_svalues_undefined(Pike_sp, num_args-args);    Pike_sp += num_args-args;    args += num_args-args;    }
pike.git/src/interpret.c:1302:    {    /* pop excessive */    pop_n_elems(args - num_args);    args=num_args;    }    }       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;    new_frame->mark_sp_base=Pike_mark_sp;    check_threads_etc();    new_frame->pc=pc;    return 1;    }    }   #ifdef PROFILING
pike.git/src/interpret.c:1630:         PMOD_EXPORT void safe_apply(struct object *o, char *fun ,INT32 args)   {   #ifdef PIKE_DEBUG    if(!o->prog) fatal("Apply safe on destructed object.\n");   #endif    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    if(fun < 0 || fun >= NUM_LFUNS)    fatal("Apply lfun on illegal value!\n");   #endif    if(!o->prog)    PIKE_ERROR("destructed object", "Apply on destructed object.\n", Pike_sp, args);       apply_low(o, (int)FIND_LFUN(o->prog,fun), args);