pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:1067:    ID_FROM_INT(Pike_fp->current_program, Pike_fp->fun)->name;    if ((!name->size_shift) && (name->len < 100))    fname = name->str;    }       t1 = describe_type(type);    SET_ONERROR(tmp1, do_free_string, t1);       free_type(sval_type);    -  bad_arg_error(NULL, NULL, 1, 1, t1->str, Pike_sp-1, +  bad_arg_error(NULL, -1, 1, t1->str, Pike_sp-1,    "%s(): Soft cast failed.\n%S",    fname, s.s);       UNREACHABLE(CALL_AND_UNSET_ONERROR(tmp1));    UNREACHABLE(CALL_AND_UNSET_ONERROR(tmp0));    }   }      #define COMPARISON(ID,NAME,FUN) \   PMOD_EXPORT void ID(INT32 args) \
pike.git/src/operators.c:2193:    else    m=merge_mapping_array_ordered(Pike_sp[-2].u.mapping,    Pike_sp[-1].u.array,    PIKE_ARRAY_OP_SUB);    pop_n_elems(2);    push_mapping(m);    return;    }    }    -  bad_arg_error("`-", NULL, 2, 2, get_name_of_type(TYPEOF(Pike_sp[-2])), +  bad_arg_error("`-", 2, 2, get_name_of_type(TYPEOF(Pike_sp[-2])),    Pike_sp-1, "Subtract on different types.\n");    }       switch(TYPEOF(Pike_sp[-2]))    {    case T_OBJECT:    if(!call_lfun(LFUN_SUBTRACT, LFUN_RSUBTRACT))    PIKE_ERROR("`-", "Subtract on objects without `- operator.\n", Pike_sp, 2);    return;   
pike.git/src/operators.c:4447:    push_type_value(pop_unfinished_type());    }    break;       case T_STRING:    {    struct pike_string *s;    ptrdiff_t len, i;       if(Pike_sp[-1].u.string->size_shift) { -  bad_arg_error("`~", NULL, 1, 1, "string(0)", Pike_sp-1, +  bad_arg_error("`~", 1, 1, "string(0)", Pike_sp-1,    "Expected 8-bit string.\n");    }       len = Pike_sp[-1].u.string->len;    s = begin_shared_string(len);    for (i=0; i<len; i++)    s->str[i] = ~ Pike_sp[-1].u.string->str[i];    pop_n_elems(1);    push_string(end_shared_string(s));    break;
pike.git/src/operators.c:4728:    high = bound_types & RANGE_HIGH_OPEN ? Pike_sp : Pike_sp - 1;    low = bound_types & RANGE_LOW_OPEN ? high : high - 1;    ind = low - 1;       switch (TYPEOF(*ind)) {    case T_OBJECT: {    struct object *o = ind->u.object;    int f;    if (!o->prog)    bad_arg_error (range_func_name (bound_types), -  NULL, Pike_sp - ind, 1, "object", ind, +  Pike_sp - ind, 1, "object", ind,    "Cannot call `[..] in destructed object.\n");       if ((f = FIND_LFUN(o->prog->inherits[SUBTYPEOF(*ind)].prog,    LFUN_RANGE)) != -1) {    struct svalue h;    if (!(bound_types & RANGE_HIGH_OPEN)) {    move_svalue (&h, high);    Pike_sp = high;    }   
pike.git/src/operators.c:4769:    }       apply_low (o, f, 4);    stack_pop_keep_top();    }       else    switch (call_old_range_lfun (bound_types, o, low, high)) {    case 1:    bad_arg_error (range_func_name (bound_types), -  NULL, Pike_sp - ind, 1, "object", ind, +  Pike_sp - ind, 1, "object", ind,    "Object got neither `[..] nor `[].\n");    break;    case 2:    bad_arg_error (range_func_name (bound_types), -  NULL, Pike_sp - ind, 1, "object", ind, +  Pike_sp - ind, 1, "object", ind,    "Object got no `[..] and there is no _sizeof to "    "translate the from-the-end index to use `[].\n");    break;    case 3:    bad_arg_error (range_func_name (bound_types), -  NULL, 3, 1, "object", ind, +  3, 1, "object", ind,    "Cannot call `[..] in destructed object.\n");    break;    default:    free_svalue (ind);    move_svalue (ind, Pike_sp - 1);    /* low and high have lost their refs in call_old_range_lfun. */    Pike_sp = ind + 1;    break;    }       break;    }       case T_STRING:    case T_ARRAY: {    INT_TYPE l=0, h=0;    if (!(bound_types & RANGE_LOW_OPEN)) {    if (TYPEOF(*low) != T_INT)    bad_arg_error (range_func_name (bound_types), -  NULL, Pike_sp - ind, 2, "int", low, +  Pike_sp - ind, 2, "int", low,    "Bad lower bound. Expected int, got %s.\n",    get_name_of_type (TYPEOF(*low)));    l = low->u.integer;    }    if (!(bound_types & RANGE_HIGH_OPEN)) {    if (TYPEOF(*high) != T_INT)    bad_arg_error (range_func_name (bound_types), -  NULL, Pike_sp - ind, high - ind + 1, "int", high, +  Pike_sp - ind, high - ind + 1, "int", high,    "Bad upper bound. Expected int, got %s.\n",    get_name_of_type (TYPEOF(*high)));    h = high->u.integer;    }       /* Can pop off the bounds without fuzz since they're simple integers. */    Pike_sp = ind + 1;       string_or_array_range (bound_types, ind, l, h);    break;    }       default:    bad_arg_error (range_func_name (bound_types), -  NULL, Pike_sp - ind, 1, "string|array|object", ind, +  Pike_sp - ind, 1, "string|array|object", ind,    "Cannot use [..] on a %s. Expected string, array or object.\n",    get_name_of_type (TYPEOF(*ind)));    }   }      /*! @decl mixed `[..](object arg, mixed start, int start_type, mixed end, int end_type)    *! @decl string `[..](string arg, int start, int start_type, int end, int end_type)    *! @decl array `[..](array arg, int start, int start_type, int end, int end_type)    *!    *! Extracts a subrange.