Branch: Tag:

2016-01-26

2016-01-26 19:38:42 by Martin Nilsson <nilsson@fastmail.com>

SIMPLE_BAD_ARG_ERROR is only kept for compatibility, but we still had 500+ uses of it.

1522:    {    case T_PROGRAM:    case T_FUNCTION: -  SIMPLE_BAD_ARG_ERROR("`+", 1, +  SIMPLE_ARG_TYPE_ERROR("`+", 1,    "string|object|int|float|array|mapping|multiset");    }    bad_arg_error("`+", sp-args, args, 1,
2394:    default:    {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`-", 1, +  SIMPLE_ARG_TYPE_ERROR("`-", 1,    "int|float|string|mapping|multiset|array|object");    }    }
2554:    struct program *p = program_from_svalue(sp - 2);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`&", 1, "type"); +  SIMPLE_ARG_TYPE_ERROR("`&", 1, "type");    }    type_stack_mark();    push_object_type(0, p->id);
2567:    if (!p)    {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`&", 2, "type"); +  SIMPLE_ARG_TYPE_ERROR("`&", 2, "type");    }    type_stack_mark();    push_object_type(0, p->id);
2612:    default:    {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`&", 2, "mapping"); +  SIMPLE_ARG_TYPE_ERROR("`&", 2, "mapping");    }    }    else    {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`&", 2, get_name_of_type(TYPEOF(sp[-2]))); +  SIMPLE_ARG_TYPE_ERROR("`&", 2, get_name_of_type(TYPEOF(sp[-2])));    }    }   
2687:    p = program_from_svalue(sp - 2);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`&", 1, "type"); +  SIMPLE_ARG_TYPE_ERROR("`&", 1, "type");    }    type_stack_mark();    push_object_type(0, p->id);
2696:    p = program_from_svalue(sp - 1);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`&", 2, "type"); +  SIMPLE_ARG_TYPE_ERROR("`&", 2, "type");    }    type_stack_mark();    push_object_type(0, p->id);
2896:    struct program *p = program_from_svalue(sp - 2);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`|", 1, "type"); +  SIMPLE_ARG_TYPE_ERROR("`|", 1, "type");    }    type_stack_mark();    push_object_type(0, p->id);
2907:    struct program *p = program_from_svalue(sp - 1);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`|", 2, "type"); +  SIMPLE_ARG_TYPE_ERROR("`|", 2, "type");    }    type_stack_mark();    push_object_type(0, p->id);
2916:    }    } else {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`|", 2, get_name_of_type(TYPEOF(sp[-2]))); +  SIMPLE_ARG_TYPE_ERROR("`|", 2, get_name_of_type(TYPEOF(sp[-2])));    }    }   
3000:    p = program_from_svalue(sp - 2);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`|", 1, "type"); +  SIMPLE_ARG_TYPE_ERROR("`|", 1, "type");    }    type_stack_mark();    push_object_type(0, p->id);
3009:    p = program_from_svalue(sp - 1);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`|", 2, "type"); +  SIMPLE_ARG_TYPE_ERROR("`|", 2, "type");    }    type_stack_mark();    push_object_type(0, p->id);
3152:    struct program *p = program_from_svalue(sp - 2);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`^", 1, "type"); +  SIMPLE_ARG_TYPE_ERROR("`^", 1, "type");    }    type_stack_mark();    push_object_type(0, p->id);
3163:    struct program *p = program_from_svalue(sp - 1);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`^", 2, "type"); +  SIMPLE_ARG_TYPE_ERROR("`^", 2, "type");    }    type_stack_mark();    push_object_type(0, p->id);
3172:    }    } else {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`^", 2, get_name_of_type(TYPEOF(sp[-2]))); +  SIMPLE_ARG_TYPE_ERROR("`^", 2, get_name_of_type(TYPEOF(sp[-2])));    }    }   
3229:    p = program_from_svalue(sp - 1);    if (!p) {    int args = 2; -  SIMPLE_BAD_ARG_ERROR("`^", 2, "type"); +  SIMPLE_ARG_TYPE_ERROR("`^", 2, "type");    }    type_stack_mark();    push_object_type(0, p->id);
3242:    if (!p) {    int args = 2;    stack_swap(); -  SIMPLE_BAD_ARG_ERROR("`^", 1, "type"); +  SIMPLE_ARG_TYPE_ERROR("`^", 1, "type");    }    type_stack_mark();    push_object_type(0, p->id);
3390:    goto call_lfun;       if ((TYPEOF(sp[-1]) != T_INT) || (sp[-1].u.integer < 0)) { -  SIMPLE_BAD_ARG_ERROR("`<<", 2, "int(0..)|object"); +  SIMPLE_ARG_TYPE_ERROR("`<<", 2, "int(0..)|object");    }       switch(TYPEOF(sp[-2])) {
3407:    return;       if(TYPEOF(sp[-2]) != T_INT) -  SIMPLE_BAD_ARG_ERROR("`<<", 1, "int|float|object"); -  SIMPLE_BAD_ARG_ERROR("`<<", 2, "int(0..)|object"); +  SIMPLE_ARG_TYPE_ERROR("`<<", 1, "int|float|object"); +  SIMPLE_ARG_TYPE_ERROR("`<<", 2, "int(0..)|object");    break;       case T_FLOAT:
3417:    return;       default: -  SIMPLE_BAD_ARG_ERROR("`<<", 1, "int|float|object"); +  SIMPLE_ARG_TYPE_ERROR("`<<", 1, "int|float|object");    break;    }   
3481:    if(call_lfun(LFUN_RSH, LFUN_RRSH))    return;    if(TYPEOF(sp[-2]) != T_INT) -  SIMPLE_BAD_ARG_ERROR("`>>", 1, "int|object"); -  SIMPLE_BAD_ARG_ERROR("`>>", 2, "int(0..)|object"); +  SIMPLE_ARG_TYPE_ERROR("`>>", 1, "int|object"); +  SIMPLE_ARG_TYPE_ERROR("`>>", 2, "int(0..)|object");    }       if ((TYPEOF(sp[-1]) != T_INT) || (sp[-1].u.integer < 0)) { -  SIMPLE_BAD_ARG_ERROR("`>>", 2, "int(0..)|object"); +  SIMPLE_ARG_TYPE_ERROR("`>>", 2, "int(0..)|object");    }       sp--;
3506:    sp[-1].u.float_number = ldexp(sp[-1].u.float_number, -sp->u.integer);    return;    default: -  SIMPLE_BAD_ARG_ERROR("`>>", 1, "int|float|object"); +  SIMPLE_ARG_TYPE_ERROR("`>>", 1, "int|float|object");    break;    }   
3574:    struct svalue *pos;    INT32 e;    if(sp[-1].u.integer < 0) -  SIMPLE_BAD_ARG_ERROR("`*", 2, "int(0..)"); +  SIMPLE_ARG_TYPE_ERROR("`*", 2, "int(0..)");    ret=allocate_array(sp[-2].u.array->size * sp[-1].u.integer);    pos=ret->item;    for(e=0;e<sp[-1].u.integer;e++,pos+=sp[-2].u.array->size)
3595:    struct svalue *pos;    ptrdiff_t asize, delta;    if(sp[-1].u.float_number < 0) -  SIMPLE_BAD_ARG_ERROR("`*", 2, "float(0..)"); +  SIMPLE_ARG_TYPE_ERROR("`*", 2, "float(0..)");       src = sp[-2].u.array;    delta = src->size;
3639:    ptrdiff_t len, delta;       if(sp[-1].u.float_number < 0) -  SIMPLE_BAD_ARG_ERROR("`*", 2, "float(0..)"); +  SIMPLE_ARG_TYPE_ERROR("`*", 2, "float(0..)");    src = sp[-2].u.string;    len = (ptrdiff_t)floor(src->len * sp[-1].u.float_number + 0.5);    ret = begin_wide_shared_string(len, src->size_shift);
3676:    INT_TYPE e;    ptrdiff_t len;    if(sp[-1].u.integer < 0) -  SIMPLE_BAD_ARG_ERROR("`*", 2, "int(0..)"); +  SIMPLE_ARG_TYPE_ERROR("`*", 2, "int(0..)");    ret=begin_wide_shared_string(sp[-2].u.string->len * sp[-1].u.integer,    sp[-2].u.string->size_shift);    pos=ret->str;