pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || 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: builtin_functions.c,v 1.455 2003/02/01 15:37:22 mast Exp $ + || $Id: builtin_functions.c,v 1.456 2003/02/04 17:32:19 mast Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.455 2003/02/01 15:37:22 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.456 2003/02/04 17:32:19 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:7504:   PMOD_EXPORT void f_function_defined(INT32 args)   {    check_all_args("Function.defined",args,BIT_FUNCTION, 0);       if(Pike_sp[-args].subtype != FUNCTION_BUILTIN &&    Pike_sp[-args].u.object->prog)    {    struct program *p = Pike_sp[-args].u.object->prog;    int func = Pike_sp[-args].subtype;    struct identifier *id; +  INT32 line; +  struct pike_string *file = NULL;       if (p == pike_trampoline_program) {    struct pike_trampoline *t =    (struct pike_trampoline *) Pike_sp[-args].u.object->storage;    if (t->frame->current_object->prog) {    p = t->frame->current_object->prog;    func = t->func;    }    }       id=ID_FROM_INT(p, func);    if(IDENTIFIER_IS_PIKE_FUNCTION( id->identifier_flags ) &&    id->func.offset != -1) -  +  file = low_get_line(p->program + id->func.offset, p, &line); +  else +  /* The program line is better than nothing for C functions. */ +  file = low_get_program_line (p, &line); +  +  if (file)    { -  INT32 line = 0; -  struct pike_string *tmp = low_get_line(p->program + id->func.offset, p, &line); -  if (tmp) -  { +     pop_n_elems(args); -  -  push_string(tmp); +  if (line) { +  push_string(file);    push_constant_text(":");    push_int(line);    f_add(3); -  +  } +  else +  push_string (file);    return;    }    } -  } +        pop_n_elems(args);    push_int(0);      }      /*! @endmodule Function    */      void init_builtin_efuns(void)