pike.git / src / builtin.cmod

version» Context lines:

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");