pike.git / src / program.c

version» Context lines:

pike.git/src/program.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: program.c,v 1.466 2002/12/18 20:36:00 grubba Exp $ + || $Id: program.c,v 1.467 2003/02/01 15:37:23 mast Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.466 2002/12/18 20:36:00 grubba Exp $"); + RCSID("$Id: program.c,v 1.467 2003/02/01 15:37:23 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "language.h"   #include "lex.h"   #include "pike_macros.h"   #include "fsort.h"
pike.git/src/program.c:6014:   {    pop_n_elems(args);    if (!THIS->frame || !THIS->frame->current_object ||    !THIS->frame->current_object->prog) {    push_int(1);    } else {    push_int(0);    }   }    + static void sprintf_trampoline (INT32 args) + { +  dynbuf_string str; +  +  if (!args || sp[-args].type != T_INT || sp[-args].u.integer != 'O' || +  !THIS->frame || !THIS->frame->current_object) { +  pop_n_elems (args); +  push_int (0); +  return; +  } +  pop_n_elems (args); +  +  ref_push_object (THIS->frame->current_object); +  sp[-1].type = T_FUNCTION; +  sp[-1].subtype = THIS->func; +  init_buf(); +  describe_svalue (sp - 1, 0, 0); +  str = complex_free_buf(); +  pop_stack(); +  push_string (make_shared_binary_string (str.str, str.len)); +  free (str.str); + } +    static void init_trampoline(struct object *o)   {    THIS->frame=0;   }      static void exit_trampoline(struct object *o)   {    if(THIS->frame)    {    free_pike_scope(THIS->frame);
pike.git/src/program.c:6118:       val.type = T_TYPE;    val.u.type = make_pike_type(raw_lfun_types[i]);    mapping_insert(lfun_types, &key, &val);    free_type(val.u.type);    }    start_new_program();    debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);    ADD_STORAGE(struct pike_trampoline); -  add_function("`()",apply_trampoline,"function(mixed...:mixed)",0); -  add_function("`!",not_trampoline,"function(:int)",0); +  ADD_FUNCTION("`()",apply_trampoline,tFunction,0); +  ADD_FUNCTION("`!",not_trampoline,tFunc(tVoid,tInt),0); +  ADD_FUNCTION("_sprintf", sprintf_trampoline, +  tFunc(tInt tOr(tMapping,tVoid),tStr), 0);    set_init_callback(init_trampoline);    set_exit_callback(exit_trampoline);    set_gc_check_callback(gc_check_trampoline);    set_gc_recurse_callback(gc_recurse_trampoline);    debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);    pike_trampoline_program=end_program();       {    struct svalue s;
pike.git/src/program.c:6351: Inside #if defined(GC2) and #if defined(PIKE_DEBUG)
      for(e=0;e<(int)p->num_identifiers;e++)    {    debug_gc_check(p->identifiers[e].name, T_PROGRAM, p);    debug_gc_check(p->identifiers[e].type, T_PROGRAM, p);    }    }   #endif   }    - #ifdef PIKE_DEBUG +    unsigned gc_touch_all_programs(void)   {    unsigned n = 0;    struct program *p;    struct program_state *ps;    if (first_program && first_program->prev)    Pike_fatal("Error in program link list.\n");    for (p = first_program; p; p = p->next) {    debug_gc_touch(p);    n++;    if (p->next && p->next->prev != p)    Pike_fatal("Error in program link list.\n");    }    return n;   } - #endif +       void gc_check_all_programs(void)   {    struct program *p;    for(p=first_program;p;p=p->next) gc_check_program(p);   }      void gc_mark_all_programs(void)   {    gc_mark_program_pos = gc_internal_program;