pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*- -  * $Id: builtin.cmod,v 1.43 2001/06/20 01:13:00 per Exp $ +  * $Id: builtin.cmod,v 1.44 2001/06/20 13:01:57 grubba Exp $    */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:884:    *! @seealso    *! @[catch()], @[throw()]    */   PMOD_EXPORT   PIKEFUN array(mixed) backtrace()    efun;    optflags OPT_EXTERNAL_DEPEND;   {    struct pike_frame *f;    int size = 0; +  struct array *res = NULL;       for (f = Pike_fp; f; f = f->next) { -  +  size++; +  } +  +  res = allocate_array_no_init(size, 0); +  push_array(res); +  +  for (f = Pike_fp; f && size; f = f->next) {    struct object *o = low_clone(backtrace_frame_program);    struct backtrace_frame_struct *bf;       call_c_initializers(o);    -  +  size--; +  +  res->item[size].u.object = o; +  res->item[size].type = PIKE_T_OBJECT; +  res->item[size].subtype = 0; +     bf = OBJ2_BACKTRACE_FRAME(o);       if ((bf->prog = f->context.prog)) {    add_ref(bf->prog);    bf->pc = f->pc;    }       if ((bf->fun.u.object = f->current_object) &&    (bf->fun.u.object->prog)) {    add_ref(bf->fun.u.object);
pike.git/src/builtin.cmod:920:    INT32 numargs = DO_NOT_WARN((INT32) MINIMUM(f->num_args,    Pike_sp - f->locals));       numargs = MAXIMUM(numargs, 0);       if (numargs) {    bf->args = allocate_array_no_init(numargs, 0);    assign_svalues_no_free(bf->args->item, f->locals, numargs, BIT_MIXED);    }    } -  -  push_object(o); -  size++; +     } -  -  f_aggregate(size); -  f_reverse(1); +  /* NOTE: res has already been pushed on the stack. */   }      #define INITIAL_BUF_LEN 4096      /*! @module String    */      PIKECLASS Buffer   /*! @class Buffer    *! A buffer, used for building strings. It's