pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:112:    *! Same as sprintf("%t",x);    *!    *! @seealso    *! @[sprintf()]    */   PMOD_EXPORT   PIKEFUN string basetype(mixed x)    efun;    optflags OPT_TRY_OPTIMIZE;   { -  int t=x->type; +  int t = TYPEOF(*x);    struct program *p; -  if(x->type == T_OBJECT && (p = x->u.object->prog)) +  if(t == T_OBJECT && (p = x->u.object->prog))    { -  ptrdiff_t fun = FIND_LFUN(p->inherits[x->subtype].prog, LFUN__SPRINTF); +  ptrdiff_t fun = FIND_LFUN(p->inherits[SUBTYPEOF(*x)].prog, LFUN__SPRINTF);    if(fun != -1)    {    push_int('t');    f_aggregate_mapping(0);    apply_low(x->u.object, -  fun + p->inherits[x->subtype].identifier_level, 2); -  if(Pike_sp[-1].type == T_STRING) +  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");    return;    } else {    Pike_error("Non-string returned from _sprintf()\n");
pike.git/src/builtin.cmod:178:    *! @seealso    *! @[sprintf()]    */   PMOD_EXPORT   PIKEFUN string int2char(int|object x)    efun;    optflags OPT_TRY_OPTIMIZE;   {    int c;    struct program *p; -  if(x->type == T_OBJECT && (p = x->u.object->prog)) +  if(TYPEOF(*x) == T_OBJECT && (p = x->u.object->prog))    { -  ptrdiff_t fun = FIND_LFUN(p->inherits[x->subtype].prog, LFUN__SPRINTF); +  ptrdiff_t fun = FIND_LFUN(p->inherits[SUBTYPEOF(*x)].prog, LFUN__SPRINTF);    if(fun != -1)    {    push_int('c');    f_aggregate_mapping(0);    apply_low(x->u.object, -  fun + p->inherits[x->subtype].identifier_level, 2); -  if(Pike_sp[-1].type == T_STRING) +  fun + p->inherits[SUBTYPEOF(*x)].identifier_level, 2); +  if(TYPEOF(Pike_sp[-1]) == T_STRING)    {    stack_swap();    pop_stack();    return;    }    Pike_error("Non-string returned from _sprintf()\n");    }    } -  if(x->type != T_INT) +  if(TYPEOF(*x) != T_INT)    SIMPLE_BAD_ARG_ERROR("int2char", 1, "int");       c=x->u.integer;       if(c>=0 && c<256)    {    struct pike_string *s;    s=begin_shared_string(1);    s->str[0]=c;    RETURN end_shared_string(s);
pike.git/src/builtin.cmod:235:   PIKEFUN string int2hex(int|object x)    efun;    optflags OPT_TRY_OPTIMIZE;   {    INT_TYPE c;    unsigned INT_TYPE n;    int len;    struct pike_string *s;    struct program *p;    -  if(x->type == T_OBJECT && (p = x->u.object->prog)) +  if(TYPEOF(*x) == T_OBJECT && (p = x->u.object->prog))    { -  ptrdiff_t fun = FIND_LFUN(p->inherits[x->subtype].prog, LFUN__SPRINTF); +  ptrdiff_t fun = FIND_LFUN(p->inherits[SUBTYPEOF(*x)].prog, LFUN__SPRINTF);    if(fun != -1)    {    push_int('x');    f_aggregate_mapping(0);    apply_low(x->u.object, -  fun + p->inherits[x->subtype].identifier_level, 2); -  if(Pike_sp[-1].type == T_STRING) +  fun + p->inherits[SUBTYPEOF(*x)].identifier_level, 2); +  if(TYPEOF(Pike_sp[-1]) == T_STRING)    {    stack_swap();    pop_stack();    return;    }    Pike_error("Non-string returned from _sprintf()\n");    }    } -  if(x->type != T_INT) +  if(TYPEOF(*x) != T_INT)    SIMPLE_BAD_ARG_ERROR("int2hex", 1, "int");       c=x->u.integer;       len=1;    if(c<0) {    len++;    n=(-c)&((unsigned INT_TYPE)(-1));    }else{    n=c;
pike.git/src/builtin.cmod:561:    CHECK_AND_SET; \    } \    else { \    GET; \    mapping_string_insert (params, str, &get); \    } \    } while (0)      #define HANDLE_FLOAT_FACTOR(NAME, VAR) \    HANDLE_PARAM (NAME, { \ -  if (set->type != T_FLOAT || \ +  if (TYPEOF(*set) != T_FLOAT || \    set->u.float_number < 0.0 || set->u.float_number > 1.0) \    SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1, \    "float between 0.0 and 1.0 for " NAME); \    VAR = DO_NOT_WARN ((double) set->u.float_number); \    }, { \ -  get.type = T_FLOAT; \ -  get.u.float_number = DO_NOT_WARN ((FLOAT_TYPE) VAR); \ +  SET_SVAL(get, T_FLOAT, 0, float_number, \ +  DO_NOT_WARN ((FLOAT_TYPE) VAR)); \    });       HANDLE_PARAM ("enabled", { -  if (set->type != T_INT || set->u.integer < -1 || set->u.integer > 1) +  if (TYPEOF(*set) != T_INT || set->u.integer < -1 || set->u.integer > 1)    SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1,    "integer in the range -1..1 for 'enabled'");    if (gc_enabled != set->u.integer) {    if (gc_enabled > 0)    gc_enabled = set->u.integer;    else {    gc_enabled = 1;    if (alloc_threshold == GC_MAX_ALLOC_THRESHOLD)    alloc_threshold = GC_MIN_ALLOC_THRESHOLD;    }    }    }, { -  get.type = T_INT; -  get.subtype = NUMBER_NUMBER; -  get.u.integer = gc_enabled; +  SET_SVAL(get, T_INT, NUMBER_NUMBER, integer, gc_enabled);    });    HANDLE_FLOAT_FACTOR ("garbage_ratio_low", gc_garbage_ratio_low);    HANDLE_FLOAT_FACTOR ("time_ratio", gc_time_ratio);    HANDLE_FLOAT_FACTOR ("garbage_ratio_high", gc_garbage_ratio_high);    HANDLE_FLOAT_FACTOR ("min_gc_time_ratio", gc_min_time_ratio);    HANDLE_FLOAT_FACTOR ("average_slowness", gc_average_slowness);      #undef HANDLE_PARAM   #undef HANDLE_FLOAT_FACTOR   
pike.git/src/builtin.cmod:1063:    *! @seealso    *! @[mappingp()]    */   PMOD_EXPORT   PIKEFUN mixed m_delete(object|mapping map, mixed index)    efun;    optflags OPT_SIDE_EFFECT;    rawtype tOr(tFunc(tMap(tSetvar(0,tMix),tSetvar(1,tMix)) tVar(0),tVar(1)),tFunc(tObj tMix,tMix))   {    struct program *p; -  if( map->type == T_MAPPING ) +  if( TYPEOF(*map) == T_MAPPING )    {    struct svalue s;    map_delete_no_free(map->u.mapping, index, &s);    pop_n_elems(args);    *Pike_sp=s;    Pike_sp++;    dmalloc_touch_svalue(Pike_sp-1);    } -  else if (map->type == T_OBJECT && (p = map->u.object->prog)) +  else if (TYPEOF(*map) == T_OBJECT && (p = map->u.object->prog))    { -  int id = FIND_LFUN(p->inherits[map->subtype].prog, LFUN__M_DELETE); +  int id = FIND_LFUN(p->inherits[SUBTYPEOF(*map)].prog, LFUN__M_DELETE);       if( id == -1 )    SIMPLE_BAD_ARG_ERROR("m_delete", 1, "object containing the _m_delete method");       apply_low(map->u.object, -  id + p->inherits[map->subtype].identifier_level, 1); +  id + p->inherits[SUBTYPEOF(*map)].identifier_level, 1);    stack_swap();    pop_stack();    } else {    SIMPLE_BAD_ARG_ERROR("m_delete", 1, "object|mapping");    }   }      /*! @decl int get_weak_flag(array|mapping|multiset m)    *!    *! Returns the weak flag settings for @[m]. It's a combination of
pike.git/src/builtin.cmod:1158:    *! (zero) will be returned.    *!    *! @seealso    *! @[function_object()]    */   PMOD_EXPORT   PIKEFUN string function_name(program|function func)    efun;    optflags OPT_TRY_OPTIMIZE;   { -  switch(func->type) +  switch(TYPEOF(*func))    {    default:    SIMPLE_BAD_ARG_ERROR("function_name", 1, "function|program");    return; /* NOTREACHED */       case PIKE_T_PROGRAM:    {    struct program *p=func->u.program;       if(p->parent)
pike.git/src/builtin.cmod:1203:    "Parent program info:\n",    func->u.program);    dump_program_tables(func->u.program->parent, 0);    }   #endif    }    break;    }       case PIKE_T_FUNCTION: -  if(func->subtype == FUNCTION_BUILTIN) break; +  if(SUBTYPEOF(*func) == FUNCTION_BUILTIN) break;    if(!func->u.object->prog)    bad_arg_error("function_name", Pike_sp-args, args, 1,    "function", Pike_sp-args,    "Destructed object.\n");    if(func->u.object->prog == pike_trampoline_program)    {    struct pike_trampoline *t;    t=((struct pike_trampoline *)func->u.object->storage);       if(t->frame->current_object->prog)    RETURN delambda(ID_FROM_INT(t->frame->current_object->prog,    t->func)->name);    }    -  RETURN delambda(ID_FROM_INT(func->u.object->prog, func->subtype)->name); +  RETURN delambda(ID_FROM_INT(func->u.object->prog, +  SUBTYPEOF(*func))->name);    }    pop_n_elems(args);    push_int(0);   }      /*! @decl object function_object(function f)    *!    *! Return the object the function @[f] is in.    *!    *! If @[f] is a global function defined in the runtime @expr{0@}
pike.git/src/builtin.cmod:1244:    *!    *! @seealso    *! @[function_name()], @[function_program()]    */   PMOD_EXPORT   PIKEFUN object function_object(function|program func)    efun;    optflags OPT_TRY_OPTIMIZE;    type function(function:object);   { -  switch(func->type) +  switch(TYPEOF(*func))    {    case PIKE_T_PROGRAM:    break;       case PIKE_T_FUNCTION: -  if(func->subtype == FUNCTION_BUILTIN) break; +  if(SUBTYPEOF(*func) == FUNCTION_BUILTIN) break;    if(func->u.object->prog == pike_trampoline_program)    {    struct object *o;    o=((struct pike_trampoline *)func->u.object->storage)->frame->current_object;    add_ref(o);    pop_n_elems(args);    push_object(o);    return;    } -  func->type=T_OBJECT; -  func->subtype = 0; +  SET_SVAL(*func, T_OBJECT, 0, object, func->u.object);    return;          default:    SIMPLE_BAD_ARG_ERROR("function_object",1,"function");    }    pop_n_elems(args);    push_int(0);   }   
pike.git/src/builtin.cmod:1287:    *! (zero) will be returned.    *!    *! @seealso    *! @[function_name()], @[function_object()]    */   PMOD_EXPORT   PIKEFUN program function_program(program|function func)    efun;    optflags OPT_TRY_OPTIMIZE;   { -  switch(func->type) +  switch(TYPEOF(*func))    {    case PIKE_T_PROGRAM:    {    struct program *p;    if(!(p=func->u.program->parent)) break;    add_ref(p);    free_program(func->u.program);    func->u.program=p;    return;    }       case PIKE_T_FUNCTION:    {    struct program *p; -  if(func->subtype == FUNCTION_BUILTIN) +  if(SUBTYPEOF(*func) == FUNCTION_BUILTIN)    p = func->u.efun->prog;    else    p = func->u.object->prog;    if(p == pike_trampoline_program)    {    p = ((struct pike_trampoline *)func->u.object->storage)->    frame->current_object->prog;    }    if (p) {    ref_push_program(p);
pike.git/src/builtin.cmod:1626:    if (putenv (putenv_str->str)) {    if (errno == ENOMEM)    SIMPLE_OUT_OF_MEMORY_ERROR ("putenv", 0);    else    Pike_error ("Error from putenv(3): %s\n", strerror (errno));    }      #ifdef __NT__    ref_push_string (var);    f_lower_case (1); -  assert (Pike_sp[-1].type == T_STRING); +  assert (TYPEOF(Pike_sp[-1]) == T_STRING);    env_alloc_var = Pike_sp[-1].u.string;    /* Let mega_apply pop. */   #else    env_alloc_var = var;   #endif       if (!env_allocs) env_allocs = allocate_mapping (4);       if (val)    /* Must keep the string passed to putenv allocated (and we    * assume no other entities are naughty enough to modify it). */    mapping_string_insert_string (env_allocs, env_alloc_var, putenv_str);    else {    struct svalue key; -  key.type = T_STRING; -  key.u.string = env_alloc_var; +  SET_SVAL(key, T_STRING, 0, string, env_alloc_var);    map_delete (env_allocs, &key);    }   #endif /* !USE_SETENV */   }      /*    * Backtrace handling.    */      /*! @module Pike
pike.git/src/builtin.cmod:1709:    {    push_svalue(&THIS->_fun);    }       PIKEFUN void `->fun=(mixed val)    {    /* FIXME: Should we allow this at all?    * Linenumber info etc won't match.    */   #ifdef PIKE_DEBUG -  if ((val->type == T_FUNCTION) && (val->subtype != FUNCTION_BUILTIN)) { +  if ((TYPEOF(*val) == T_FUNCTION) && (SUBTYPEOF(*val) != FUNCTION_BUILTIN)) {    assign_short_svalue((union anything *)&THIS->oprog,    (union anything *)&val->u.object->prog, T_PROGRAM);    }   #endif    assign_svalue(&THIS->_fun, val);    }       /*! @decl int(0..1) _is_type(string t)    *! This object claims to be an array for backward compatibility.    */
pike.git/src/builtin.cmod:1736:       static void fill_in_file_and_line()    {    struct pike_string *file = NULL;    assert (THIS->lineno == -1);       if (THIS->pc && THIS->prog) {    file = low_get_line(THIS->pc, THIS->prog, &THIS->lineno);    THIS->pc = NULL;    } -  else if (THIS->_fun.type == PIKE_T_FUNCTION) { +  else if (TYPEOF(THIS->_fun) == PIKE_T_FUNCTION) {   #ifdef PIKE_DEBUG    if (THIS->_fun.u.object->prog &&    THIS->_fun.u.object->prog != THIS->oprog) { -  struct identifier *id = ID_FROM_INT(THIS->oprog, THIS->_fun.subtype); +  struct identifier *id = ID_FROM_INT(THIS->oprog, SUBTYPEOF(THIS->_fun));    /* FIXME: Dump dmalloc info for the object? */    Pike_fatal("Lost track of function pointer! Function name was %s.\n",    id->name?id->name->str:"<no name>");    }   #endif -  file = low_get_function_line (THIS->_fun.u.object, THIS->_fun.subtype, +  file = low_get_function_line (THIS->_fun.u.object, SUBTYPEOF(THIS->_fun),    &THIS->lineno);    }    else if (THIS->prog) {    file = low_get_program_line (THIS->prog, &THIS->lineno);    }       if (file) {    if (!THIS->filename) THIS->filename = file;    else free_string (file);    }
pike.git/src/builtin.cmod:1788:       if (THIS->filename) {    ref_push_string(THIS->filename);    push_text(":");    push_int(THIS->lineno);    push_text(", ");    f_add(4);    } else {    push_text("Unknown file, ");    } -  if (THIS->_fun.type == PIKE_T_FUNCTION) { +  if (TYPEOF(THIS->_fun) == PIKE_T_FUNCTION) {    if (THIS->_fun.u.object->prog) {   #ifdef PIKE_DEBUG    if (THIS->_fun.u.object->prog != THIS->oprog) { -  struct identifier *id = ID_FROM_INT(THIS->oprog, THIS->_fun.subtype); +  struct identifier *id = +  ID_FROM_INT(THIS->oprog, SUBTYPEOF(THIS->_fun));    /* FIXME: Dump dmalloc info for the object? */    Pike_fatal("Lost track of function pointer! Function name was %s.\n",    id->name?id->name->str:"<no name>");    }   #endif    push_svalue(&THIS->_fun);    f_function_name(1);    push_text("(), ");    f_add(2);    } else {    free_svalue(&THIS->_fun); -  THIS->_fun.type = PIKE_T_INT; -  THIS->_fun.u.integer = 0; -  THIS->_fun.subtype = NUMBER_DESTRUCTED; +  SET_SVAL(THIS->_fun, PIKE_T_INT, NUMBER_DESTRUCTED, integer, 0);    push_text("destructed_function(), ");    }    } else {    push_text("destructed_function(), ");    }       if (THIS->args) {    push_text("Args: ");    push_int(THIS->args->size);    f_add(2);
pike.git/src/builtin.cmod:1859:       if (!end_or_none) {    if (index < 0) {    index_error("pike_frame->`[]", Pike_sp-args, args, NULL, Pike_sp-args,    "Indexing with negative index (%"PRINTPIKEINT"d)\n", index);    } else if (index >= numargs) {    index_error("pike_frame->`[]", Pike_sp-args, args, NULL, Pike_sp-args,    "Indexing with too large index (%"PRINTPIKEINT"d)\n", index);    }    } else { -  if (end_or_none->type != PIKE_T_INT) { +  if (TYPEOF(*end_or_none) != PIKE_T_INT) {    SIMPLE_BAD_ARG_ERROR("`[]",2,"int|void");    }    end = end_or_none->u.integer;    }       pop_n_elems(args);       if (end_or_none) {    if ((end < 0) || (end < index) || (index >= numargs)) {    f_aggregate(0);
pike.git/src/builtin.cmod:1944:    }       if (args > 2) {    pop_n_elems(args - 2);    args = 2;    }       switch(index) {    case 0: /* Filename */    if (THIS->lineno == -1) fill_in_file_and_line(); -  if (value->type != PIKE_T_STRING) { -  if ((value->type != PIKE_T_INT) || +  if (TYPEOF(*value) != PIKE_T_STRING) { +  if ((TYPEOF(*value) != PIKE_T_INT) ||    (value->u.integer)) {    SIMPLE_BAD_ARG_ERROR("backtrace_frame->`[]=", 2,    "string|int(0..0)");    }    if (THIS->filename) {    free_string(THIS->filename);    THIS->filename = NULL;    }    } else {    if (THIS->filename) {    free_string(THIS->filename);    THIS->filename = NULL;    }    copy_shared_string(THIS->filename, value->u.string);    }    break;       case 1: /* Linenumber */    if (THIS->lineno == -1) fill_in_file_and_line(); -  if (value->type != PIKE_T_INT) { +  if (TYPEOF(*value) != PIKE_T_INT) {    SIMPLE_BAD_ARG_ERROR("backtrace_frame->`[]=", 2, "int(1..)");    }    THIS->lineno = value->u.integer;    break;       case 2: /* Function */    if (THIS->lineno == -1) fill_in_file_and_line();    assign_svalue(&THIS->_fun, value);    break;    default: /* Arguments */
pike.git/src/builtin.cmod:2064:       for (f = i->frame_pointer; f && size; f = (of = f)->next) {    struct object *o = low_clone(backtrace_frame_program);    struct backtrace_frame_struct *bf;    struct identifier *function = NULL;       call_c_initializers(o);       size--;    -  res->item[size].u.object = o; -  res->item[size].type = PIKE_T_OBJECT; -  res->item[size].subtype = 0; +  SET_SVAL(res->item[size], PIKE_T_OBJECT, 0, object, o);       bf = OBJ2_BACKTRACE_FRAME(o);       if ((bf->prog = f->context->prog)) {    add_ref(bf->prog);    bf->pc = f->pc;    }    -  if ((bf->_fun.u.object = f->current_object) && -  (bf->_fun.u.object->prog)) { -  add_ref(bf->_fun.u.object); +  if (f->current_object && f->current_object->prog) { +  SET_SVAL(bf->_fun, PIKE_T_FUNCTION, +  CHECK_IDREF_RANGE(f->fun, f->current_object->prog), +  object, f->current_object); +  add_ref(f->current_object);   #ifdef PIKE_DEBUG    add_ref(bf->oprog = bf->_fun.u.object->prog);   #endif -  bf->_fun.subtype = CHECK_IDREF_RANGE(f->fun, f->current_object->prog); -  bf->_fun.type = PIKE_T_FUNCTION; +     function = ID_FROM_INT(f->current_object->prog, f->fun);    } else { -  bf->_fun.u.integer = 0; -  bf->_fun.subtype = NUMBER_DESTRUCTED; -  bf->_fun.type = PIKE_T_INT; +  SET_SVAL(bf->_fun, PIKE_T_INT, NUMBER_DESTRUCTED, integer, 0);    }       if (f->locals) {    INT32 numargs = DO_NOT_WARN((INT32) MINIMUM(f->num_args,    stack_top - f->locals));    INT32 varargs = 0;       if(of && of->locals) {    /* f->num_args can be too large, so this is necessary for some    * reason. I don't know why. /mast */    numargs = DO_NOT_WARN((INT32)MINIMUM(f->num_args,of->locals - f->locals));    }       numargs = MAXIMUM(numargs, 0);       /* Handle varargs... */    if (function && (function->identifier_flags & IDENTIFIER_VARARGS) &&    (f->locals + numargs < stack_top) && -  (f->locals[numargs].type == T_ARRAY)) { +  (TYPEOF(f->locals[numargs]) == T_ARRAY)) {    varargs = f->locals[numargs].u.array->size;    }       if (numargs + varargs) {    bf->args = allocate_array_no_init(numargs + varargs, 0);    bf->args->type_field =    assign_svalues_no_free(bf->args->item, f->locals, numargs, BIT_MIXED);    if (varargs) {    bf->args->type_field |=    assign_svalues_no_free(bf->args->item + numargs,
pike.git/src/builtin.cmod:2602:    free_array(THIS->to);    THIS->to = NULL;    }    if (THIS->ctx.v)    free_replace_many_context(&THIS->ctx);       if (!args) {    push_int(0);    return;    } -  if (from_arg && from_arg->type == T_MAPPING) { +  if (from_arg && TYPEOF(*from_arg) == T_MAPPING) {    if (to_arg) {    Pike_error("Bad number of arguments to create().\n");    }    THIS->from = mapping_indices(from_arg->u.mapping);    THIS->to = mapping_values(from_arg->u.mapping);    pop_n_elems(args);    args = 0;    } else {    /* FIXME: Why is from declared |void, when it isn't allowed    * to be void?    * /grubba 2004-09-02    *    * It probably has to do with the "if (!args)" above: It should    * be possible to create an empty instance. /mast    */    if (!from_arg || !to_arg) {    Pike_error("Bad number of arguments to create().\n");    }    pop_n_elems(args-2);    args = 2; -  if (from_arg->type != T_ARRAY) { +  if (TYPEOF(*from_arg) != T_ARRAY) {    SIMPLE_BAD_ARG_ERROR("Replace", 1,    "array(string)|mapping(string:string)");    } -  if (to_arg->type == T_STRING) { +  if (TYPEOF(*to_arg) == T_STRING) {    push_int(from_arg->u.array->size);    stack_swap();    f_allocate(2);    } -  if (to_arg->type != T_ARRAY) { +  if (TYPEOF(*to_arg) != T_ARRAY) {    SIMPLE_BAD_ARG_ERROR("Replace", 2, "array(string)|string");    }    if (from_arg->u.array->size != to_arg->u.array->size) {    Pike_error("Replace must have equal-sized from and to arrays.\n");    }    add_ref(THIS->from = from_arg->u.array);    add_ref(THIS->to = to_arg->u.array);    }       if (!THIS->from->size) {
pike.git/src/builtin.cmod:2890:    } else {    push_int(0);    }    }       /*! @decl void _decode(array(string)|int(0..0) encoded)    */    PIKEFUN void _decode(array(string)|int(0..0) encoded_)    {    INT32 i = 0; -  if (encoded_->type == PIKE_T_ARRAY) { +  if (TYPEOF(*encoded_) == PIKE_T_ARRAY) {    struct array *encoded = encoded_->u.array;       for (i=0; i < encoded->size; i++) {    push_svalue(encoded->item + i);    stack_swap();    }    }    pop_stack();       f_single_string_replace_create(i);
pike.git/src/builtin.cmod:3369:    struct svalue *real_args,    INT32 args)   {    INT32 x,e,tmp,size=0x7fffffff;    struct svalue *tmpargs=Pike_sp - args;    struct array *ret;    TYPE_FIELD types;       for(e=0;e<args;e++)    { -  if(real_args[e].type==T_OBJECT && +  if(TYPEOF(real_args[e]) == T_OBJECT &&    real_args[e].u.object->prog == automap_marker_program &&    OBJ2_AUTOMAP_MARKER(real_args[e].u.object)->depth >= d)    { -  if(tmpargs[e].type != T_ARRAY) +  if(TYPEOF(tmpargs[e]) != T_ARRAY)    index_error("__automap__",    Pike_sp-args,    args,    tmpargs,    NULL,    "Automap on non-array.\n");    tmp=tmpargs[e].u.array->size;    if(tmp < size)    size=tmp;    }
pike.git/src/builtin.cmod:3398:    Pike_fatal("No automap markers found in low_automap\n");   #endif       push_array(ret=allocate_array(size));    types = 0;       for(x=0;x<size;x++)    {    for(e=0;e<args;e++)    { -  if(real_args[e].type==T_OBJECT && +  if(TYPEOF(real_args[e]) == T_OBJECT &&    real_args[e].u.object->prog == automap_marker_program &&    OBJ2_AUTOMAP_MARKER(real_args[e].u.object)->depth >= d)    {   #ifdef PIKE_DEBUG    if(x >= tmpargs[e].u.array->size)    Pike_fatal("low_automap failed to determine size!\n");   #endif    push_svalue(ITEM(tmpargs[e].u.array)+x);    }else{    push_svalue(tmpargs+e);    }    }       if(d == depth)    apply_svalue(fun,args);    else    low_automap(d+1,depth,fun,real_args,args);    stack_pop_to_no_free (ITEM(ret) + x); -  types |= 1 << ITEM(ret)[x].type; +  types |= 1 << TYPEOF(ITEM(ret)[x]);    }    ret->type_field = types;    stack_unlink(args);   }         PIKEFUN array __automap__(mixed fun, mixed ... tmpargs)    efun;   {    int e,depth=-1;    check_stack(args);       for(e=0;e<args-1;e++)    { -  if(tmpargs[e].type==T_OBJECT && +  if(TYPEOF(tmpargs[e]) == T_OBJECT &&    tmpargs[e].u.object->prog == automap_marker_program)    {    int tmp=OBJ2_AUTOMAP_MARKER(tmpargs[e].u.object)->depth;    if(tmp > depth) depth=tmp;    ref_push_array(OBJ2_AUTOMAP_MARKER(tmpargs[e].u.object)->arg);    }else{    push_svalue(tmpargs+e);    }    }    check_stack(depth * (args+1));    low_automap(1,depth,fun,tmpargs,args-1);    stack_unlink(args);   }      /* Linked list stuff.    */   #undef INIT_BLOCK   #define INIT_BLOCK(NODE) do { \    (NODE)->next = (NODE)->prev = NULL; \    (NODE)->refs = 1; \ -  (NODE)->val.type = T_INT; \ -  (NODE)->val.subtype = NUMBER_UNDEFINED; \ -  (NODE)->val.u.integer = 0; \ +  SET_SVAL((NODE)->val, T_INT, NUMBER_UNDEFINED, \ +  integer, 0); \    } while(0)      #undef EXIT_BLOCK   #define EXIT_BLOCK(NODE) do { \    if ((NODE)->prev) { \    free_list_node((NODE)->prev); \    } \    if ((NODE)->next) { \    free_list_node((NODE)->next); \    } \
pike.git/src/builtin.cmod:3655:    *! @[object_variablep()]    */   PIKEFUN function(mixed:void) _get_setter(object o, string s)   {    struct program *p;    struct inherit *inh;    int f;    if (!(p = o->prog)) {    Pike_error("Indexing a destructed object.\n");    } -  inh = p->inherits + Pike_sp[-args].subtype; +  inh = p->inherits + SUBTYPEOF(Pike_sp[-args]);    p = inh->prog;    f = find_shared_string_identifier(s, p);    if ((f >= 0) &&    IDENTIFIER_IS_VARIABLE(ID_FROM_INT(p, f)->identifier_flags)) {    f += inh->identifier_level;    push_function(get_setter(o, f), f_Setter_cq__backtick_28_29_fun_num);    } else {    push_undefined();    }    stack_pop_n_elems_keep_top(args);
pike.git/src/builtin.cmod:3733:    PIKEFUN int __hash()    flags ID_PROTECTED;    {    pop_n_elems(args);    push_int(17);    }       PIKEFUN int `==(mixed other)    flags ID_PROTECTED;    { -  if (other->type != T_OBJECT) { +  if (TYPEOF(*other) != T_OBJECT) {    pop_stack();    push_int(0);    return;    }       /* Look for the is_val_null constant directly in the program of    * other, without going through its `[]. When this is called in a    * codec, other can be a completely arbitrary object which may not    * have a `[] that works in that context. */    push_int (0);    ref_push_program (other->u.object->prog);    push_constant_text("is_val_null");    if (program_index_no_free (Pike_sp - 3, Pike_sp - 2, Pike_sp - 1) && -  Pike_sp[-3].type == T_INT && Pike_sp[-3].u.integer) { +  TYPEOF(Pike_sp[-3]) == T_INT && Pike_sp[-3].u.integer) {    pop_n_elems (4);    push_int (1);    }    else {    pop_n_elems (4);    push_int (0);    }    }       /*! @decl string encode_json()
pike.git/src/builtin.cmod:3904:    *! This function is typically called via @[Serializer.serialize()].    */    PIKEFUN void _serialize(object o,    function(mixed, string, type:void) serializer)    flags ID_PROTECTED;    rawtype tFunc(tObj tFunc(tMix tStr tType(tMix), tVoid), tVoid);    {    if (o != Pike_fp->current_object) {    SIMPLE_BAD_ARG_ERROR("_serialize", 1, "this");    } -  low_serialize(Pike_sp[-args].subtype, serializer, 0, +  low_serialize(SUBTYPEOF(Pike_sp[-args]), serializer, 0,    f_Serializable_cq__serialize_variable_fun_num);    pop_n_elems(args);    push_int(0);    }       static void *find_program_from_object_type_cb(struct pike_type *t)    {    struct program *p;    if ((t->type != PIKE_T_OBJECT) || !t->cdr) return NULL;    p = id_to_program(CDR_TO_INT(t));
pike.git/src/builtin.cmod:4038:    */    PIKEFUN void _deserialize(object o,    function(function(mixed:void),    string, type: void) deserializer)    flags ID_PROTECTED;    rawtype tFunc(tObj tFunc(tFunc(tMix, tVoid) tStr tType(tMix), tVoid), tVoid);    {    if (o != Pike_fp->current_object) {    SIMPLE_BAD_ARG_ERROR("_serialize", 1, "this");    } -  low_serialize(Pike_sp[-args].subtype, deserializer, 1, +  low_serialize(SUBTYPEOF(Pike_sp[-args]), deserializer, 1,    f_Serializable_cq__deserialize_variable_fun_num);    pop_n_elems(args);    push_int(0);    }   }   /*! @endclass    */      /*! @decl void serialize(object o, @    *! function(mixed, string, type:void) serializer)
pike.git/src/builtin.cmod:4066:   PIKEFUN void serialize(object o,    function(mixed, string, type:void) serializer)    rawtype tFunc(tObj tFunc(tMix tStr tType(tMix), tVoid), tVoid);   {    struct inherit *inh;    struct program *p;    ptrdiff_t fun;    if (!(p = o->prog)) {    Pike_error("Indexing a destructed object.\n");    } -  inh = p->inherits + Pike_sp[-args].subtype; +  inh = p->inherits + SUBTYPEOF(Pike_sp[-args]);    p = inh->prog;    if ((fun = low_find_lfun(p, LFUN__SERIALIZE)) == -1) {    Pike_error("Serialization not supported by object.\n");    }    apply_low(o, fun + inh->identifier_level, args);   }      /*! @decl void deserialize(object o, @    *! function(function(mixed:void), @    *! string, type: void) deserializer)
pike.git/src/builtin.cmod:4095:    function(function(mixed:void),    string, type:void) deserializer)    rawtype tFunc(tObj tFunc(tFunc(tMix, tVoid) tStr tType(tMix), tVoid), tVoid);   {    struct inherit *inh;    struct program *p;    ptrdiff_t fun;    if (!(p = o->prog)) {    Pike_error("Indexing a destructed object.\n");    } -  inh = p->inherits + Pike_sp[-args].subtype; +  inh = p->inherits + SUBTYPEOF(Pike_sp[-args]);    p = inh->prog;    if ((fun = low_find_lfun(p, LFUN__DESERIALIZE)) == -1) {    Pike_error("Deserialization not supported by object.\n");    }    apply_low(o, fun + inh->identifier_level, args);   }      /*! @endmodule    */   
pike.git/src/builtin.cmod:4878:   /*! @endmodule    */      static struct object *val_module;      static void get_val_module()   {    assert (!val_module);    push_constant_text ("Val");    APPLY_MASTER ("resolv", 1); -  if (Pike_sp[-1].type != T_OBJECT) +  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    * values to be replaced. */   #define GET_VAL(NAME) \    PMOD_EXPORT struct object *PIKE_CONCAT (get_val_, NAME) (void) \    { \    struct svalue index, res; \    if (!val_module) get_val_module(); \ -  index.type = T_STRING; \ +  SET_SVAL(index, T_STRING, 0, string, NULL); \    MAKE_CONST_STRING (index.u.string, TOSTR (NAME)); \    object_index_no_free (&res, val_module, 0, &index); \ -  if (res.type != T_OBJECT) \ +  if (TYPEOF(res) != T_OBJECT) \    Pike_error ("\"Val." TOSTR (NAME) "\" didn't resolve to an object.\n"); \    return res.u.object; \    }      GET_VAL (true)   GET_VAL (false)   GET_VAL (null)      /* Kludge needed for the static null objects in the oracle module. It    * ought to be fixed to use dynamic lookup of them instead. */