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.522 2003/09/03 17:55:59 mast Exp $ + || $Id: program.c,v 1.523 2003/09/04 15:02:02 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.522 2003/09/03 17:55:59 mast Exp $"); + RCSID("$Id: program.c,v 1.523 2003/09/04 15:02:02 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:143:    "``>>",    "``*",    "``/",    "``%",    "`+=",    "_is_type",    "_sprintf",    "_equal",    "_m_delete",    "_get_iterator", +  /* NOTE: After this point there are only fake lfuns. */ +  "_search",   };      struct pike_string *lfun_strings[NELEM(lfun_names)];      static struct mapping *lfun_ids;      /* mapping(string:type) */   static struct mapping *lfun_types;      static char *raw_lfun_types[] = {
pike.git/src/program.c:197:    tFuncV(tZero,tVoid,tMix), /* "``>>", */    tFuncV(tNone,tZero,tMix), /* "``*", */    tFuncV(tNone,tZero,tMix), /* "``/", */    tFuncV(tNone,tZero,tMix), /* "``%", */    tFuncV(tZero,tVoid,tMix), /* "`+=", */    tFuncV(tStr,tVoid,tInt), /* "_is_type", */    tFuncV(tInt tOr(tMap(tStr,tInt),tVoid),tVoid,tStr), /* "_sprintf", */    tFuncV(tMix,tVoid,tInt), /* "_equal", */    tFuncV(tZero,tVoid,tMix), /* "_m_delete", */    tFuncV(tNone,tVoid,tObj), /* "_get_iterator", */ +  /* NOTE: After this point there are only fake lfuns. */ +  tFuncV(tZero tOr(tZero, tVoid), tVoid, tMix), /* "_search", */   };      /*! @namespace lfun::    *!    *! Callback functions used to overload various builtin functions.    *!    *! The functions can be grouped into a few sets:    *!    *! @ul    *! @item
pike.git/src/program.c:251:    *! @item    *! Other binary operator overloading.    *!    *! @[`[]()], @[`[]=()], @[`->()],    *! @[`->=()], @[`+=()], @[`()()]    *!    *! @item    *! Overloading of other builtin functions.    *!    *! @[_is_type()], @[_sprintf()], @[_m_delete()], -  *! @[_get_iterator()] +  *! @[_get_iterator()], @[_search()]    *! @endul    *!    *! @note    *! Although these functions are called from outside the object    *! they exist in, they will still be used even if they are    *! declared @expr{static@}. It is infact recommended to declare    *! them @expr{static@}, since that will hinder them being used    *! for other purposes.    *!    *! @seealso
pike.git/src/program.c:834:   /*! @decl Iterator lfun::_get_iterator()    *!    *! Iterator creation callback. The returned @[Iterator] instance    *! works as a cursor that references a specific item contained (in    *! some arbitrary sense) in this one.    *!    *! @seealso    *! @[Iterator], @[get_iterator], @[predef::foreach()]    */    + /*! @decl mixed lfun::_search(mixed needle, mixed|void start) +  *! +  *! Search callback. +  *! +  *! @seealso +  *! @[predef::search()] +  */ +    /*! @endnamespace    */      /*! @class MasterObject    */      /*! @decl void unregister(program p)    *!    *! Unregister a program that was only partially compiled.    *!
pike.git/src/program.c:6634:    struct svalue val;    struct svalue id;    init_program_blocks();       MAKE_CONST_STRING(this_program_string,"this_program");    MAKE_CONST_STRING(this_string,"this");    MAKE_CONST_STRING(UNDEFINED_string,"UNDEFINED");       lfun_ids = allocate_mapping(NUM_LFUNS);    lfun_types = allocate_mapping(NUM_LFUNS); -  for (i=0; i < NUM_LFUNS; i++) { +  for (i=0; i < NELEM(lfun_names); i++) {    lfun_strings[i] = make_shared_string(lfun_names[i]);       id.type = T_INT;    id.u.integer = i;    key.type = T_STRING;    key.u.string = lfun_strings[i];    mapping_insert(lfun_ids, &key, &id);       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,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);
pike.git/src/program.c:6697:    debug_malloc_touch(placeholder_object);    }   }      void cleanup_program(void)   {    int e;       free_mapping(lfun_types);    free_mapping(lfun_ids); -  for (e=0; e < NUM_LFUNS; e++) { +  for (e=0; e < NELEM(lfun_names); e++) {    free_string(lfun_strings[e]);    }   #ifdef FIND_FUNCTION_HASHSIZE    for(e=0;e<FIND_FUNCTION_HASHSIZE;e++)    {    if(cache[e].name)    {    free_string(cache[e].name);    cache[e].name=0;    }