pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*-   || 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.cmod,v 1.216 2008/06/28 22:05:01 mast Exp $ + || $Id: builtin.cmod,v 1.217 2008/06/29 12:37:10 nilsson Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin.cmod:1400:   /*! @class BacktraceFrame    */      PIKECLASS backtrace_frame   {    PIKEVAR mixed fun;    PIKEVAR array args;       /* These are cleared when filename and lineno has been initialized    * from them. */ -  PIKEVAR program prog flags ID_STATIC|ID_PRIVATE; +  PIKEVAR program prog flags ID_PROTECTED|ID_PRIVATE;    CVAR PIKE_OPCODE_T *pc;       /* These two are considered to be uninitialized from prog, pc and    * fun as long as lineno == -1. */    CVAR struct pike_string *filename;    CVAR INT32 lineno;       INIT    {    THIS->pc = NULL;
pike.git/src/builtin.cmod:2183:    *! are given to the create method as a @i{from@} and @i{to@} array    *! and are then analyzed. The @expr{`()@} is then called with a    *! string and the replace rules in the Replace object will be    *! applied. The Replace object is used internally by the Pike    *! optimizer and need not be used manually.    */   PIKECLASS multi_string_replace   {    CVAR struct replace_many_context ctx;    /* NOTE: from and to are only kept for _encode()'s use. */ -  PIKEVAR array from flags ID_STATIC; -  PIKEVAR array to flags ID_STATIC; +  PIKEVAR array from flags ID_PROTECTED; +  PIKEVAR array to flags ID_PROTECTED;       /*! @decl void create(array(string)|mapping(string:string)|void from, @    *! array(string)|string|void to)    */    PIKEFUN void create(array(string)|mapping(string:string)|void from_arg,    array(string)|string|void to_arg)    {    if (THIS->from) {    free_array(THIS->from);    THIS->from = NULL;
pike.git/src/builtin.cmod:2340:    *! a string, with just one replace string. The replace strings are    *! given to the create method as a @i{from@} and @i{tom@} string and    *! are then analyzed. The @expr{`()@} is then called with a string    *! and the replace rule in the Replace object will be applied. The    *! Replace object is used internally by the Pike optimizer and need    *! not be used manually.    */   PIKECLASS single_string_replace   {    CVAR SearchMojt mojt; -  PIKEVAR string del flags ID_STATIC|ID_PRIVATE; -  PIKEVAR string to flags ID_STATIC|ID_PRIVATE; +  PIKEVAR string del flags ID_PROTECTED|ID_PRIVATE; +  PIKEVAR string to flags ID_PROTECTED|ID_PRIVATE;       EXTRA    { -  MAP_VARIABLE ("o", tObj, ID_STATIC|ID_PRIVATE, +  MAP_VARIABLE ("o", tObj, ID_PROTECTED|ID_PRIVATE,    single_string_replace_storage_offset +    OFFSETOF (single_string_replace_struct, mojt.container),    T_OBJECT);    }       /*! @decl void create(string|void from, string|void to)    *!    *! @note    *! May be called with either zero or two arguments.    */
pike.git/src/builtin.cmod:2522:   /*! @class Bootstring    *!    *! This class implements the "Bootstring" string transcoder described in    *! @url{ftp://ftp.rfc-editor.org/in-notes/rfc3492.txt@}.    */   PIKECLASS bootstring   {    CVAR INT_TYPE base, tmin, tmax, skew, damp;    CVAR INT_TYPE initial_bias, initial_n;    CVAR p_wchar2 delim; -  PIKEVAR string digits flags ID_STATIC|ID_PRIVATE; +  PIKEVAR string digits flags ID_PROTECTED|ID_PRIVATE;       static INT_TYPE bootstring_cp_to_digit(p_wchar2 ch)    {    ptrdiff_t digit = THIS->digits->len;    PCHARP digits = MKPCHARP_STR( THIS->digits );    while (digit>=0)    if (INDEX_PCHARP( digits, digit ) == ch)    return digit;    else    --digit;
pike.git/src/builtin.cmod:2747:    *! @param delim    *! The "basic" code point used as the delimiter.    *! @param digits    *! The "basic" code points used as digits. The length of the string    *! should be the same as the base parameter.    */    PIKEFUN void create( int base, int tmin, int tmax,    int skew, int damp,    int initial_bias, int initial_n,    int delim, string digits ) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    struct bootstring_struct *bs = THIS;    if (base<2)    Pike_error("Bogus base\n");    if (tmin<0 || tmax<tmin || base-1<tmax)    Pike_error("Parameters violate 0 <= tmin <= tmax <= base-1\n");    if (skew < 1)    Pike_error("Parameters violate skew >= 1\n");    if (damp < 2)    Pike_error("Parameters violate damp >= 2\n");
pike.git/src/builtin.cmod:3326:    PIKEFUN int(0..1) is_empty()    {    push_int(!THIS->head->next);    }       /*! @decl int(0..) _sizeof()    *!    *! Returns the number of elements in the list.    */    PIKEFUN int(0..) _sizeof() -  flags ID_STATIC; +  flags ID_PROTECTED;    {    push_int(THIS->num_elems);    }       /*! @decl string _sprintf(int c, mapping(string:mixed)|void attr)    *!    *! Describe the list.    *!    *! @seealso    *! @[sprintf()], @[lfun::_sprintf()]    */    PIKEFUN string _sprintf(int c, mapping(string:mixed)|void attr) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    if (!THIS->num_elems) {    push_constant_text("ADT.List(/* empty */)");    } else if (c == 'O') {    struct pike_list_node *node = THIS->head;    if (THIS->num_elems == 1) {    push_constant_text("ADT.List(/* 1 element */\n");    } else {    push_constant_text("ADT.List(/* %d elements */\n");    push_int(THIS->num_elems);
pike.git/src/builtin.cmod:3487:    }       /*! @decl void create(mixed ... values)    *!    *! Create a new @[List], and initialize it with @[values].    *!    *! @fixme    *! Ought to reset the @[List] if called multiple times.    */    PIKEFUN void create(mixed ... values) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    /* FIXME: Reset the list? */    apply_current(f_List_append_fun_num, args);    }       /*! @class _get_iterator    *!    *! @[Iterator] that loops over the @[List].    */    PIKECLASS _get_iterator    program_flags PROGRAM_USES_PARENT; -  flags ID_STATIC; +  flags ID_PROTECTED;    {    CVAR struct pike_list_node *cur;    CVAR INT32 ind; /* Not meaningful, but requred by the API. */       /* NOTE: cur may never refer to an unlinked node.    * cur may however refer to a detached node, or to sentinels.    */       static struct List_struct *List__get_iterator_find_parent()    {
pike.git/src/builtin.cmod:3652:    Pike_fatal("Partially detached node.\n");    }   #endif /* PIKE_DEBUG */    /* Detached node. */    gc_recurse_svalues(&THIS->cur->val, 1);    gc_recurse_list_node_tree_forward(THIS->cur->next, THIS->cur->prev);    gc_recurse_list_node_tree_backward(THIS->cur->next, THIS->cur->prev);    }       PIKEFUN int(0..1) `!() -  flags ID_STATIC; +  flags ID_PROTECTED;    {    pop_n_elems(args);    push_int(!THIS->cur->next || !THIS->cur->prev);    }       PIKEFUN int(0..) index()    {    pop_n_elems(args);    if (THIS->cur->next && THIS->cur->prev) {    push_int(THIS->ind);