pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:3344:    PIKEFUN string(0..255) read_hstring( int(0..8) bytes )    {    LONGEST len;    len = io_read_number( THIS, bytes );    if( len >= 0 )    io_read_and_push_string( THIS, len );    else    push_int(0);    }    -  /*! @decl string(8bit) read_hbuffer( int n ) -  *! @decl string(8bit) read_hbuffer( int n, bool copy ) +  /*! @decl IOBuffer read_hbuffer( int n ) +  *! @decl IOBuffer read_hbuffer( int n, bool copy )    *!    *! Same as @[read_hstring], but returns the result as an IOBuffer.    *! -  *! No data is copied unless @[copy] is specified and true, the new buffer -  *! points into the old one. +  *! No data is copied unless @[copy] is specified and true, the +  *! new buffer points into the old one.    *!    *! @note -  *! As long as the subbuffer exists no data can be added to the main buffer. +  *! As long as the subbuffer exists no data can be added to the +  *! main buffer.    *!    *! Usually this is OK, since it often represents something that    *! should be parsed before the next whatever is extracted from    *! the buffer, but do take care.    *!    *! If you need to unlink the new buffer after it has been    *! created, call @[trim] in it.    */    PIKEFUN IOBuffer read_hbuffer( int(0..8) bytes, int|void copy )    {
pike.git/src/builtin.cmod:3375:    int do_copy = 0;    if( copy )    do_copy = copy->u.integer;    pop_n_elems(args);    if( len >= 0 )    io_read_and_push_buffer( THIS, len, do_copy );    else    push_int(0);    }    -  /*! @decl string(8bit) read_buffer( int n ) -  *! @decl string(8bit) read_buffer( int n, bool copy ) +  /*! @decl IOBuffer read_buffer( int n ) +  *! @decl IOBuffer read_buffer( int n, bool copy )    *!    *! Same as @[read], but returns the result as an IOBuffer.    *! -  *! No data is copied unless @[copy] is specified and true, the new buffer -  *! points into the old one. +  *! No data is copied unless @[copy] is specified and true, the +  *! new buffer points into the old one.    *!    *! @note -  *! As long as the subbuffer exists no data can be added to the main buffer. +  *! As long as the subbuffer exists no data can be added to the +  *! main buffer.    *!    *! Usually this is OK, since it often represents something that    *! should be parsed before the next whatever is extracted from    *! the buffer, but do take care.    */    PIKEFUN IOBuffer read_buffer( int bytes, int|void copy )    {    int do_copy = 0;    if( copy )    do_copy = copy->u.integer;
pike.git/src/builtin.cmod:3414:    *! intermediate string is created.    */    PIKEFUN int sprintf(mixed ... ignored)    rawtype tFuncV(tAttr("strict_sprintf_format", tOr(tStr, tObj)),    tAttr("sprintf_args", tMix), tStr);    {    ONERROR _e;    struct string_builder tmp;    init_string_builder(&tmp,0);    SET_ONERROR(_e, free_string_builder, &tmp); -  low_f_sprintf(args,0, &tmp ); +  low_f_sprintf(args, 0, &tmp );    if( tmp.s->size_shift )    Pike_error("IOBuffer only handles 8bit data\n");    io_append( THIS, tmp.s->str, tmp.s->len ); -  +  pop_n_elems(args); +  push_int(tmp.s->len);    CALL_AND_UNSET_ONERROR(_e);    }       /*! @decl void clear()    *!    *! Clear the buffer.    */ -  PIKEFUN int(0..) clear( ) +  PIKEFUN void clear()    {    IOBuffer *io = THIS;    io->offset = io->len = 0;    }       /*! @decl void trim()    *!    *! Frees unused memory.    *!    *! Note that calling this function excessively will slow things
pike.git/src/builtin.cmod:3615:    flags ID_PROTECTED;    {    IOBuffer *this = THIS;    if( this->buffer )    Pike_error("Can not initialize twice.\n");    this->buffer = xalloc(4096-32);    this->allocated = 4096-32;    this->malloced = 1;    }    -  +     INIT {    IOBuffer *this = THIS;    memset( this, 0, sizeof(IOBuffer));    }       EXIT {    IOBuffer *this = THIS;    if( this->sub )    {    free_object( this->sub );