pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:2994:
*/ PIKEFUN void create( int|void size ) { struct Buffer_struct *str = THIS; init_string_builder_alloc(&str->str, str->initial = size ? MINIMUM(size->u.integer, 1 ) : 256 , 0); } /*! @decl string _sprintf( int flag, mapping flags ) *! It is possible to @[sprintf] a String.Buffer object
-
*! as @tt{%s@} just as if it
was
a string.
+
*! as @tt{%s@} just as if it
were
a string.
*/ PIKEFUN string _sprintf( int flag, mapping flags ) { switch( flag ) { case 'O': { struct pike_string *res; struct Buffer_struct *str = THIS; push_text( "Buffer(%d /* %d */)" );
pike.git/src/builtin.cmod:3141:
break; } string_build_mkspace(&str->str, 0, str->str.known_shift = len); } low_set_index(str->str.s,index,ch); push_int(ch); } /*! @decl Buffer `+( string|Buffer what ) */
-
PIKEFUN
object
`+( string|Buffer what )
+
PIKEFUN
Buffer
`+( string|Buffer what )
rawtype tFunc(tOr(tString, tObjIs_BUFFER), tObjIs_BUFFER); { struct Buffer_struct *str = THIS, *str2; struct object *res = fast_clone_object( Buffer_program ); str2 = OBJ2_BUFFER( res ); str2->initial = str->initial; init_string_builder_copy (&str2->str, &str->str); if( (Pike_fp->current_object->flags & OBJECT_CLEAR_ON_EXIT) ) res->flags |= OBJECT_CLEAR_ON_EXIT; apply( res, "add", 1 ); RETURN res; } /*! @decl Buffer `+=( string|Buffer what ) */
-
PIKEFUN
object
`+=( string|Buffer what )
+
PIKEFUN
Buffer
`+=( string|Buffer what )
rawtype tFunc(tOr(tString, tObjIs_BUFFER), tObjIs_BUFFER); { f_Buffer_add( 1 ); REF_RETURN Pike_fp->current_object; } static struct pike_string*getotherstr(struct svalue*other,unsigned stricttype) { switch(TYPEOF(*other)) {
pike.git/src/builtin.cmod:3179:
return other->u.string; case PIKE_T_OBJECT: if (other->u.object->prog == Buffer_program) return OBJ2_BUFFER(other->u.object)->str.s; } if(stricttype) Pike_error("Unsupported types in comparison.\n"); return 0; }
-
/*! @decl
Buffer
`==( mixed other )
+
/*! @decl
int(0..1)
`==( mixed other )
*! *! Is able to compare directly with strings and other Buffers. */ PIKEFUN int(0..1) `==( mixed other ) rawtype tFunc(tMixed, tInt01); { struct pike_string *a; RETURN ((a = getotherstr(other,0)) ? !my_quick_strcmp(THIS->str.s, a) : 0); }
-
/*! @decl
Buffer
`<( mixed other )
+
/*! @decl
int(0..1)
`<( mixed other )
*! *! Is able to compare directly with strings and other Buffers. */ PIKEFUN int(0..1) `<( mixed other ) rawtype tFunc(tMixed, tInt01); { RETURN my_quick_strcmp(THIS->str.s, getotherstr(other,1))<0; }
-
/*! @decl
Buffer
`>( mixed other )
+
/*! @decl
int(0..1)
`>( mixed other )
*! *! Is able to compare directly with strings and other Buffers. */ PIKEFUN int(0..1) `>( mixed other ) rawtype tFunc(tMixed, tInt01); { RETURN my_quick_strcmp(THIS->str.s, getotherstr(other,1))>0; } /*! @decl int addat(int(0..) pos, string|Buffer ... data)
pike.git/src/builtin.cmod:3307:
*/ PIKEFUN int add( string|Buffer ... arg1 ) rawtype tFuncV(tNone, tOr(tString, tObjIs_BUFFER), tIntPos); { struct Buffer_struct *str = THIS; push_int(str->str.s->len); stack_revroll(++args); f_Buffer_addat(args); }
-
/*! @decl void putchar(int
c
)
-
*! Appends the character @[
c
] at the end of the string.
+
/*! @decl void putchar(int
ch
)
+
*! Appends the character @[
ch
] at the end of the string.
*/
-
PIKEFUN void putchar(int
c
) {
+
PIKEFUN void putchar(int
ch
) {
struct Buffer_struct *str = THIS;
-
string_builder_putchar(&str->str,
c
);
+
string_builder_putchar(&str->str,
ch
);
} /*! @decl int sprintf(strict_sprintf_format format, sprintf_args ... args) *! Appends the output from @[sprintf] at the end of the string. *! Returns the resulting size of the String.Buffer. */ PIKEFUN int sprintf(mixed ... arguments) rawtype tFuncV(tAttr("strict_sprintf_format", tOr(tStr, tObj)), tAttr("sprintf_args", tMix), tStr);
pike.git/src/builtin.cmod:3445:
if( (Pike_fp->current_object->flags & OBJECT_CLEAR_ON_EXIT) ) res->flags |= OBJECT_CLEAR_ON_EXIT; push_object(res); } else push_undefined(); } /*! @decl void clear() *!
-
*! Empty the buffer, and
don't
care about
the old content.
+
*! Empty the buffer, and
discard
the old content.
*! *! @seealso *! @[get()], @[cut()] */ PIKEFUN void clear() { struct Buffer_struct *str = THIS; reset_string_builder(&str->str); }