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.465 2002/12/01 18:39:07 mast Exp $ + || $Id: program.c,v 1.466 2002/12/08 15:57:07 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.465 2002/12/01 18:39:07 mast Exp $"); + RCSID("$Id: program.c,v 1.466 2002/12/08 15:57:07 grubba 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:745:    *! @item    *! @[index()] should return the current index.    *! @item    *! @[value()] should return the current value.    *! @enddl    *!    *! @seealso    *! @[Iterator], @[foreach()]    */    + /*! @class MasterObject +  */ +  + /*! @decl void unregister(program p) +  *! +  *! Unregister a program that was only partially compiled. +  *! +  *! Called by @[compile()] to clean up references to partially compiled +  *! programs. +  *! +  *! @param p +  *! Partially compiled program that should no longer be referenced. +  *! +  *! @fixme +  *! Shouldn't this function be in the compilation handler? +  */ +  + /*! @endclass +  */ +  + /*! @class CompilationHandler +  */ +  + /*! @decl mapping(string:mixed)|object get_default_module() +  *! +  *! Returns the default module from which global symbols will +  *! be fetched. +  *! +  *! @returns +  *! Returns the default module, or @tt{0@} (zero). +  *! +  *! If @tt{0@} (zero) is returned the compiler use the mapping +  *! returned by @[all_constants()] as fallback. +  *! +  *! @seealso +  *! @[get_predefines()] +  */ +  + /*! @decl void compile_warning(string filename, int line, string msg) +  *! +  *! Called by @[compile()] to report warnings. +  *! +  *! @param filename +  *! File which triggered the warning. +  *! +  *! @param line +  *! Line which triggered the warning. +  *! +  *! @param msg +  *! Warning message. +  *! +  *! @seealso +  *! @[compile_error()] +  */ +  + /*! @endclass +  */ +    struct program *first_program = 0;   static int current_program_id = PROG_DYNAMIC_ID_START;      struct program *null_program=0;      struct object *error_handler=0;   struct object *compat_handler=0;      struct program *gc_internal_program = 0;   static struct program *gc_mark_program_pos = 0;
pike.git/src/program.c:1290:    make_program_executable(p);    return; /* We are out of memory, but we don't care! */    }       size=0;      #define FOO(NUMTYPE,TYPE,NAME) \    size=DO_ALIGN(size, ALIGNOF(TYPE)); \    MEMCPY(data+size,p->NAME,p->PIKE_CONCAT(num_,NAME)*sizeof(p->NAME[0])); \    PIKE_CONCAT(RELOCATE_,NAME)(p, (TYPE *)(data+size)); \ -  dmfree((char *)p->NAME); \ +  dmfree(p->NAME); \    p->NAME=(TYPE *)(data+size); \    size+=p->PIKE_CONCAT(num_,NAME)*sizeof(p->NAME[0]);   #include "program_areas.h"       p->total_size=size + sizeof(struct program);       p->flags |= PROGRAM_OPTIMIZED;    make_program_executable(p);   }   
pike.git/src/program.c:1653:    Pike_compiler->num_used_modules=0;       if(p && (p->flags & PROGRAM_FINISHED))    {    yyerror("Pass2: Program already done");    p=0;    }       Pike_compiler->malloc_size_program = ALLOC_STRUCT(program);    Pike_compiler->fake_object=alloc_object(); +    #ifdef PIKE_DEBUG    Pike_compiler->fake_object->storage=(char *)xalloc(256 * sizeof(struct svalue));    /* Stipple to find illegal accesses */    MEMSET(Pike_compiler->fake_object->storage,0x55,256*sizeof(struct svalue));   #else    Pike_compiler->fake_object->storage=(char *)malloc(sizeof(struct parent_info));   #endif    /* Can't use GC_ALLOC on fake objects, but still it's good to know    * that they never take over a stale gc marker. */    if (Pike_in_gc) remove_marker(Pike_compiler->fake_object);
pike.git/src/program.c:5699:    }    }       /* We have to notify the master object that    * a previous compile() actually failed, even    * if we did not know it at the time    */    CDFPRINTF((stderr, "th(%ld) %p unregistering failed delayed compile.\n",    (long) th_self(), p));    ref_push_program(p); +  /* FIXME: Shouldn't the compilation handler be used here? */    SAFE_APPLY_MASTER("unregister",1);    pop_stack();      #ifdef PIKE_DEBUG    if (p->refs > 1) {    /* Other programs can have indexed out constants from p, which    * might be broken themselves and/or keep references to p    * through the parent pointer. We should find all those other    * programs and invalidate them too, but how can that be done?    * The whole delayed compilation thingie is icky icky icky... :P