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.209 2008/06/23 16:03:23 mast Exp $ + || $Id: builtin.cmod,v 1.210 2008/06/23 16:49:40 mast 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:2162:    MEMSET( str, 0, sizeof( *str ) );    }       EXIT    gc_trivial;    {    struct Buffer_struct *str = THIS;    if( str->str.s )    free_string_builder( &str->str );    } +  +  GC_RECURSE +  { +  if (mc_count_bytes (Pike_fp->current_object) && THIS->str.s) +  mc_counted_bytes += THIS->str.malloced;    } -  + }      /*! @endclass    */      /*! @class Replace    *!    *! This is a "compiled" version of the @[replace] function applied on    *! a string, with more than one replace string. The replace strings    *! 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
pike.git/src/builtin.cmod:2338:    *! 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; -  CVAR struct pike_string *del; -  CVAR struct pike_string *to; +  PIKEVAR string del flags ID_STATIC|ID_PRIVATE; +  PIKEVAR string to flags ID_STATIC|ID_PRIVATE;       EXTRA    {    MAP_VARIABLE ("o", tObj, ID_STATIC|ID_PRIVATE,    single_string_replace_storage_offset +    OFFSETOF (single_string_replace_struct, mojt.container),    T_OBJECT);    }    -  INIT +  /*! @decl void create(string|void from, string|void to) +  *! +  *! @note +  *! May be called with either zero or two arguments. +  */ +  PIKEFUN void create(string|void del, string|void to)    { -  THIS->del = NULL; -  THIS->to = NULL; -  } -  -  EXIT -  gc_trivial; -  { +     if (THIS->del) {    free_string(THIS->del);    THIS->del = NULL;    }    if (THIS->to) {    free_string(THIS->to);    THIS->to = NULL;    } -  } +     -  /*! @decl void create(string|void from, string|void to) -  *! -  *! @note -  *! May be called with either zero or two arguments. -  */ -  PIKEFUN void create(string|void del, string|void to) -  { -  /* Clean up... */ -  exit_single_string_replace_struct(); -  +     if (!del) return;       if (!to) {    SIMPLE_BAD_ARG_ERROR("String.SingleReplace->create", 2, "string");    }       if (del == to) {    /* No-op... */    return;    }
pike.git/src/builtin.cmod:3244:    * o Pop tail    * o Join    * o Copy segment    * o Detach segment (requires new iterator implementation)    * o Iterator copy    * o _equal() for iterators and lists.    * o _values(), _search(), cast()    * o _sizeof()?, _indices()??    * o Support for reverse(), filter() and map().    * o Initialization from array. +  * o Support for Pike.count_memory.    */       INIT    {    THIS->tail = NULL;    THIS->head = TAIL_SENTINEL(THIS);    THIS->tail_pred = HEAD_SENTINEL(THIS);    THIS->head_sentinel_refs = THIS->tail_sentinel_refs = 2;    THIS->num_elems = 0;    }
pike.git/src/builtin.cmod:3315:       /* Called at gc_mark time */    GC_RECURSE    {    struct pike_list_node *node = THIS->head;    struct pike_list_node *next;    while ((next = node->next)) {    gc_recurse_svalues(&node->val, 1);    node = next;    } +  /* FIXME: mc_count_bytes */    }       /*! @decl int(0..1) is_empty()    *!    *! Check if the list is empty.    *!    *! @returns    *! Returns @expr{1@} if the list is empty,    *! and @expr{0@} (zero) if there are elements in the list.    */