pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:445:
} if( post_sum ) { push_text(")"); f_add(3); } } PIKEFUN mixed cast( string to )
+
flags ID_PROTECTED;
{
-
struct pike_string *s_string, *s_int;
-
MAKE_CONST_STRING(s_int, "int");
-
MAKE_CONST_STRING(s_string, "string");
-
if( to ==
s
_int )
+
if( to ==
literal
_int
_string
)
{ f_TM_unix_time(0); return; }
-
if( to ==
s
_string )
+
if( to ==
literal
_string
_string
)
{ f_TM_asctime(0); return; }
-
Pike
_
error
(
"Does
not
know
how
to
cast
to
%s\n",
to->str
);
+
pop
_
stack
(
);
+
push_undefined(
);
} /*! @decl string zone *! *! The timezone of this structure */ PIKEFUN string `zone() { FIX_THIS(); if( GET_ZONE(&(THIS->t)) ) push_text( GET_ZONE(&(THIS->t)) );
pike.git/src/builtin.cmod:3067:
} pop_n_elems( args ); push_undefined(); } /*! @decl mixed cast( string type ) *! It is possible to cast a String.Buffer object to *! a @expr{string@} and an @expr{int@}. */ PIKEFUN mixed cast( string type )
+
flags ID_PROTECTED;
{
-
struct pike_string *string_t;
-
struct pike_string *int_t;
-
MAKE_CONST_STRING( string_t, "string" );
-
MAKE_CONST_STRING( int_t, "int" );
-
-
if( type == string_
t
)
+
if( type ==
literal_
string_
string
)
{
-
pop_
n_elems
(
args
);
+
pop_
stack
();
if( Pike_fp->current_object->refs != 1 ) f_Buffer_get_copy( 0 ); else f_Buffer_get( 0 ); return; }
-
if( type == int_
t
)
+
if( type ==
literal_
int_
string
)
{ struct Buffer_struct *str = THIS; pop_stack(); if( Pike_fp->current_object->refs != 1 ) f_Buffer_get_copy( 0 ); else f_Buffer_get( 0 ); o_cast_to_int( ); return; }
-
Pike
_
error
(
"Cannot
cast
to
%S\n",
type
);
+
+
pop
_
stack
(
);
+
push_undefined(
);
} /*! @decl String.Buffer `+( string|String.Buffer what ) */ PIKEFUN object `+( 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 );
pike.git/src/builtin.cmod:5486:
} /*! @decl mixed cast(string type) *! *! Cast the lists. @expr{array@} and @expr{object@} are the only *! supported types. */ PIKEFUN mixed cast(string type) flags ID_PROTECTED; {
-
if (
type
==
MK_STRING("array"))
{
-
pop
_
n
_
elems(args
)
;
+
pop_stack();
/*
type
as
at
least one more reference. */
+
if
(type
==
literal
_
array
_
string
)
apply_current(f_List_cq__values_fun_num, 0);
-
}
else if (type ==
MK
_
STRING("
object
")) {
-
pop
_
n_elems(args
)
;
+
else if (type ==
literal
_object_
string
)
ref_push_object(Pike_fp->current_object);
-
}
else
{
-
Pike
_
error
(
"Cannot cast to %o.\n", Pike_sp-1
);
+
else
+
push
_
undefined
();
}
-
}
+
/*! @decl mixed `[](mixed key) */ PIKEFUN mixed `[](mixed key) flags ID_PROTECTED; { struct pike_list_node *node; INT_TYPE n; if (TYPEOF(*key) != PIKE_T_INT) SIMPLE_BAD_ARG_ERROR("`[]", 1, "int");