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:705:    f_aggregate_mapping(0);    apply_low(x->u.object,    fun + p->inherits[SUBTYPEOF(*x)].identifier_level, 2);    if(TYPEOF(Pike_sp[-1]) == T_STRING)    {    stack_swap();    pop_stack();    return;    } else if (UNSAFE_IS_ZERO(Pike_sp-1)) {    pop_n_elems(2); -  push_constant_text("object"); +  ref_push_string(literal_object_string);    return;    } else {    Pike_error("Non-string returned from _sprintf()\n");    }    }    }    pop_stack();    switch(t)    { -  case T_ARRAY: push_constant_text("array"); break; -  case T_FLOAT: push_constant_text("float"); break; -  case T_FUNCTION: push_constant_text("function"); break; -  case T_INT: push_constant_text("int"); break; -  case T_MAPPING: push_constant_text("mapping"); break; -  case T_MULTISET: push_constant_text("multiset"); break; -  case T_OBJECT: push_constant_text("object"); break; -  case T_PROGRAM: push_constant_text("program"); break; -  case T_STRING: push_constant_text("string"); break; -  case T_TYPE: push_constant_text("type"); break; +  case T_ARRAY: ref_push_string(literal_array_string); break; +  case T_FLOAT: ref_push_string(literal_float_string); break; +  case T_FUNCTION: ref_push_string(literal_function_string); break; +  case T_INT: ref_push_string(literal_int_string); break; +  case T_MAPPING: ref_push_string(literal_mapping_string); break; +  case T_MULTISET: ref_push_string(literal_multiset_string); break; +  case T_OBJECT: ref_push_string(literal_object_string); break; +  case T_PROGRAM: ref_push_string(literal_program_string); break; +  case T_STRING: ref_push_string(literal_string_string); break; +  case T_TYPE: ref_push_string(literal_type_string); break;    case T_ZERO: push_constant_text("zero"); break;    case T_VOID: push_constant_text("void"); break;    /* The following are internal and shouldn't be applicable in normal use. */    case T_SVALUE_PTR: push_text("svalue_ptr"); break;    case T_OBJ_INDEX: push_text("obj_index"); break;    case T_MAPPING_DATA: push_text("mapping_data"); break;    case T_PIKE_FRAME: push_text("pike_frame"); break;    case T_MULTISET_DATA: push_text("multiset_data"); break;    default: push_text("unknown"); break;    }
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:5040:    node->next = node->prev = NULL;    node->refs = 1;    SET_SVAL(node->val, T_INT, NUMBER_UNDEFINED, integer, 0);    return node;   }      void count_memory_in_pike_list_nodes(size_t * n, size_t * s) {    ba_count_all(&pike_list_node_allocator, n, s);   }    - void free_all_pike_list_node_blocks() { + void free_all_pike_list_node_blocks(void) {    ba_destroy(&pike_list_node_allocator);   }      PMOD_EXPORT void free_list_node(struct pike_list_node *node)   {    if (!sub_ref(node)) {    if (node->prev) {    free_list_node(node->prev);    }    if (node->next) {
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");   
pike.git/src/builtin.cmod:6062:   }      /*! @endclass    */      /*! @endmodule    */      static struct object *val_module;    - static void get_val_module() + static void get_val_module(void)   {    assert (!val_module);    push_text ("Val");    APPLY_MASTER ("resolv", 1);    if (TYPEOF(Pike_sp[-1]) != T_OBJECT)    Pike_error ("\"Val\" didn't resolve to a module object.\n");    val_module = (--Pike_sp)->u.object;   }      /* Always do the lookup in the Val module dynamically to allow the