pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:2243:    } else {    my_strcat("object(implements ");    }    /* We need to save the global buffer, in case id_to_program()    * starts running Pike code. */    save_buffer(&save_buf);    SET_ONERROR(err, restore_buffer, &save_buf);    s.u.program = id_to_program(CDR_TO_INT(t));    CALL_AND_UNSET_ONERROR(err);    if (s.u.program) { -  s.type = T_PROGRAM; -  s.subtype = 0; +  SET_SVAL_TYPE(s, T_PROGRAM); +  SET_SVAL_SUBTYPE(s, 0);    describe_svalue(&s, 0, NULL);    my_strcat(")");    } else {    char buffer[100];    sprintf(buffer,"%"PRINTPTRDIFFT"d)",    CDR_TO_INT(t));    my_strcat(buffer);    }    }else{    my_strcat("object");
pike.git/src/pike_types.c:3938:    if (!c) {    a = a->cdr;    goto recurse;    }    if (!low_pike_types_le(a->cdr, b, array_cnt, flags)) return 0;    ref_push_string((struct pike_string *)a->car);    ref_push_type_value(a->cdr);    ref_push_type_value(b);    safe_apply_current2(PC_POP_TYPE_ATTRIBUTE_FUN_NUM, 3,    "pop_type_attribute"); -  if ((Pike_sp[-1].type == T_INT) && -  (Pike_sp[-1].subtype == NUMBER_NUMBER) && +  if ((TYPEOF(Pike_sp[-1]) == T_INT) && +  (SUBTYPEOF(Pike_sp[-1]) == NUMBER_NUMBER) &&    (!Pike_sp[-1].u.integer)) {    pop_stack();    return 0;    }    pop_stack();    return 1;       case T_NOT:    if (b->type == T_NOT) {    struct pike_type *tmp = a->car;
pike.git/src/pike_types.c:4113:    if (!c) {    b = b->cdr;    goto recurse;    }    if (!low_pike_types_le(a, b->cdr, array_cnt, flags)) return 0;    ref_push_string((struct pike_string *)b->car);    ref_push_type_value(a);    ref_push_type_value(b->cdr);    safe_apply_current2(PC_PUSH_TYPE_ATTRIBUTE_FUN_NUM, 3,    "push_type_attribute"); -  if ((Pike_sp[-1].type == T_INT) && -  (Pike_sp[-1].subtype == NUMBER_NUMBER) && +  if ((TYPEOF(Pike_sp[-1]) == T_INT) && +  (SUBTYPEOF(Pike_sp[-1]) == NUMBER_NUMBER) &&    (!Pike_sp[-1].u.integer)) {    pop_stack();    return 0;    }    pop_stack();    return 1;    case PIKE_T_SCOPE:   #ifdef TYPE_GROUPING    flags |= LE_B_GROUPED;   #endif
pike.git/src/pike_types.c:4811:    struct pike_type *ret = new_get_return_type(tmp, 0);    free_type(tmp);    if (ret) return ret;    }       /* Invalid type for lfun::`[](). */    add_ref(mixed_type_string);    return mixed_type_string;    }    } -  if(CDR(n)->token == F_CONSTANT && CDR(n)->u.sval.type==T_STRING) +  if(CDR(n)->token == F_CONSTANT && TYPEOF(CDR(n)->u.sval) == T_STRING)    {    i = find_shared_string_identifier(CDR(n)->u.sval.u.string, p);    if(i==-1)    {    add_ref(mixed_type_string);    return mixed_type_string;    }else{    add_ref(ID_FROM_INT(p, i)->type);    return ID_FROM_INT(p, i)->type;    }
pike.git/src/pike_types.c:6041:       case PIKE_T_ATTRIBUTE:    res = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);    if (!res) return NULL;    if (c) {    ref_push_string((struct pike_string *)fun_type->car);    ref_push_type_value(fun_type->cdr);    ref_push_type_value(arg_type);    safe_apply_current2(PC_APPLY_TYPE_ATTRIBUTE_FUN_NUM, 3,    "apply_type_attribute"); -  if ((Pike_sp[-1].type == T_INT) && -  (Pike_sp[-1].subtype == NUMBER_NUMBER) && +  if ((TYPEOF(Pike_sp[-1]) == T_INT) && +  (SUBTYPEOF(Pike_sp[-1]) == NUMBER_NUMBER) &&    (!Pike_sp[-1].u.integer)) {    pop_stack();    free_type(res);    return NULL;    }    pop_stack();    }    type_stack_mark();    push_finished_type(res);    push_type_attribute((struct pike_string *)fun_type->car);
pike.git/src/pike_types.c:6288:       if (tmp2->type == PIKE_T_ATTRIBUTE) {    struct compilation *c = MAYBE_THIS_COMPILATION;    if (c) {    /* Perform extra argument checking based on the attribute. */    ref_push_string((struct pike_string *)tmp2->car);    push_svalue(sval);    ref_push_type_value(tmp2->cdr);    ref_push_type_value(res);    safe_apply_current(PC_APPLY_ATTRIBUTE_CONSTANT_FUN_NUM, 4); -  if (Pike_sp[-1].type == PIKE_T_TYPE) { +  if (TYPEOF(Pike_sp[-1]) == PIKE_T_TYPE) {    type_stack_mark();    push_finished_type(Pike_sp[-1].u.type);    push_finished_type(res);    push_type(T_AND);    free_type(res);    res = pop_unfinished_type();    }    pop_stack();    }    }
pike.git/src/pike_types.c:6498:    goto loop;       case PIKE_T_ATTRIBUTE:    tmp = new_get_return_type(fun_type->cdr, flags);    if (!tmp) break;    if (c) {    ref_push_string((struct pike_string *)fun_type->car);    ref_push_type_value(fun_type->cdr);    safe_apply_current2(PC_APPLY_TYPE_ATTRIBUTE_FUN_NUM, 2,    "apply_type_attribute"); -  if ((Pike_sp[-1].type == T_INT) && -  (Pike_sp[-1].subtype == NUMBER_NUMBER) && +  if ((TYPEOF(Pike_sp[-1]) == T_INT) && +  (SUBTYPEOF(Pike_sp[-1]) == NUMBER_NUMBER) &&    (!Pike_sp[-1].u.integer)) {    free_type(tmp);    pop_stack();    break;    }    pop_stack();    }    type_stack_mark();    push_finished_type(tmp);    push_type_attribute((struct pike_string *)fun_type->car);
pike.git/src/pike_types.c:6987:       if (args->token == F_CONSTANT) {    sval = &args->u.sval;    }      #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, " Checking argument #%d... ", *argno);    simple_describe_type(args->type);    if (sval) { -  fprintf(stderr, "\n Constant of type %s", get_name_of_type(sval->type)); +  fprintf(stderr, "\n Constant of type %s", +  get_name_of_type(TYPEOF(*sval)));    }    fprintf(stderr, "\n fun_type: ");    simple_describe_type(fun_type);    }   #endif /* PIKE_DEBUG */       if (TEST_COMPAT(7, 6)) {    /* Attempt to reduce strictness to Pike 7.6 levels. */    flags |= CALL_7_6;    }
pike.git/src/pike_types.c:7184:   /* This error is bogus /Hubbe    Pike_fatal("zzap_function_return() called with unexpected value: %d\n",    EXTRACT_UCHAR(a));   */    return NULL;   }      struct pike_type *get_type_of_svalue(const struct svalue *s)   {    struct pike_type *ret; -  switch(s->type) +  switch(TYPEOF(*s))    {    case T_FUNCTION: -  if(s->subtype == FUNCTION_BUILTIN) +  if(SUBTYPEOF(*s) == FUNCTION_BUILTIN)    {    copy_pike_type(ret, s->u.efun->type);    }else{    struct program *p;       p=s->u.object->prog;    if(!p)    {    copy_pike_type(ret, zero_type_string);    } else if (p == pike_trampoline_program) {    struct pike_trampoline *t =    (struct pike_trampoline *) s->u.object->storage;    if ((p = t->frame->current_object->prog)) {    copy_pike_type(ret, ID_FROM_INT(p, t->func)->type);    } else {    copy_pike_type(ret, zero_type_string);    }    } else { -  copy_pike_type(ret, ID_FROM_INT(p,s->subtype)->type); +  copy_pike_type(ret, ID_FROM_INT(p,SUBTYPEOF(*s))->type);    }    }    return ret;       case T_ARRAY:    {    struct array *a = s->u.array;       type_stack_mark();   #if 0
pike.git/src/pike_types.c:7376:    push_int_type(0, (1<<(8 << s->u.string->size_shift)) - 1);    }    } else {    push_type(T_ZERO);    }    push_type(T_STRING);    return pop_unfinished_type();       default:    type_stack_mark(); -  push_type(s->type); +  push_type(TYPEOF(*s));    return pop_unfinished_type();    }   }         static struct pike_type *low_object_type_to_program_type(struct pike_type *obj_t)   {    struct pike_type *res = NULL;    struct pike_type *sub;    struct svalue sval;
pike.git/src/pike_types.c:7407:    if (res) {    struct pike_type *tmp = or_pike_types(res, sub, 1);    free_type(res);    free_type(sub);    res = tmp;    } else {    res = sub;    }    obj_t = obj_t->cdr;    } -  sval.type = T_PROGRAM; +  SET_SVAL_TYPE(sval, T_PROGRAM);    if ((obj_t->type != T_OBJECT) ||    (!(id = CDR_TO_INT(obj_t))) ||    (!(sval.u.program = id_to_program(id))) ||    (!(sub = get_type_of_svalue(&sval)))) {    if (res) {    free_type(res);    }    return NULL;    }    /* FIXME: obj_t->car should propagate to the return-type in sub. */