Branch: Tag:

1998-04-17

1998-04-17 05:08:02 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

ERROR -> PIKE_ERROR

Rev: src/array.c:1.32
Rev: src/array.h:1.13
Rev: src/builtin_functions.c:1.100
Rev: src/error.h:1.18
Rev: src/interpret.c:1.79
Rev: src/operators.c:1.32

5:   \*/   #include <math.h>   #include "global.h" - RCSID("$Id: operators.c,v 1.31 1998/04/10 17:41:22 grubba Exp $"); + RCSID("$Id: operators.c,v 1.32 1998/04/17 05:08:02 hubbe Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"
32:    switch(args) \    { \    case 0: case 1: \ -  ERROR(NAME, "Too few arguments\n", sp, args); \ +  PIKE_ERROR(NAME, "Too few arguments\n", sp, args); \    case 2: \    i=FUN (sp-2,sp-1); \    pop_n_elems(2); \
62:      #define CALL_OPERATOR(OP, args) \    if(!sp[-args].u.object->prog) \ -  ERROR(lfun_names[OP], "Called in destructed object.\n", sp, args); \ +  PIKE_ERROR(lfun_names[OP], "Called in destructed object.\n", sp, args); \    if(FIND_LFUN(sp[-args].u.object->prog,OP) == -1) \ -  ERROR(lfun_names[OP], "Operator not in object.\n", sp, args); \ +  PIKE_ERROR(lfun_names[OP], "Operator not in object.\n", sp, args); \    apply_lfun(sp[-args].u.object, OP, args-1); \    free_svalue(sp-2); \    sp[-2]=sp[-1]; \
84:    default:    if(!args)    { -  ERROR("`+", "Too few arguments\n", sp, args); +  PIKE_ERROR("`+", "Too few arguments\n", sp, args);    }else{    if(types & BIT_OBJECT)    {
130:    {    case T_PROGRAM:    case T_FUNCTION: -  ERROR("`+", "Bad argument 1\n", sp, args); +  PIKE_ERROR("`+", "Bad argument 1\n", sp, args);    } -  ERROR("`+", "Incompatible types\n", sp, args); +  PIKE_ERROR("`+", "Incompatible types\n", sp, args);    return; /* compiler hint */       case BIT_STRING:
436:    {    if(call_lfun(LFUN_SUBTRACT, LFUN_RSUBTRACT))    return; -  ERROR("`-", "Subtract on different types.\n", sp, 2); +  PIKE_ERROR("`-", "Subtract on different types.\n", sp, 2);    }       switch(sp[-2].type)
499:    }       default: -  ERROR("`-", "Bad argument 1.\n", sp, 2); +  PIKE_ERROR("`-", "Bad argument 1.\n", sp, 2);    }   }   
507:   {    switch(args)    { -  case 0: ERROR("`-", "Too few arguments.\n", sp, 0); +  case 0: PIKE_ERROR("`-", "Too few arguments.\n", sp, 0);    case 1: o_negate(); break;    case 2: o_subtract(); break;    default:
550:    if(call_lfun(LFUN_AND, LFUN_RAND))    return;    -  ERROR("`&", "Bitwise and on different types.\n", sp, 2); +  PIKE_ERROR("`&", "Bitwise and on different types.\n", sp, 2);    }       switch(sp[-2].type)
597:       len = sp[-2].u.string->len;    if (len != sp[-1].u.string->len) -  ERROR("`&", "Bitwise AND on strings of different lengths.\n", sp, 2); +  PIKE_ERROR("`&", "Bitwise AND on strings of different lengths.\n", sp, 2);    s = begin_shared_string(len);    for (i=0; i<len; i++)    s->str[i] = sp[-2].u.string->str[i] & sp[-1].u.string->str[i];
606:    return;    }    default: -  ERROR("`&", "Bitwise and on illegal type.\n", sp, 2); +  PIKE_ERROR("`&", "Bitwise and on illegal type.\n", sp, 2);    }   }   
652:   {    switch(args)    { -  case 0: ERROR("`&", "Too few arguments.\n", sp, 0); +  case 0: PIKE_ERROR("`&", "Too few arguments.\n", sp, 0);    case 1: return;    case 2: o_and(); return;    default:
690:    if(call_lfun(LFUN_OR, LFUN_ROR))    return;    -  ERROR("`|", "Bitwise or on different types.\n", sp, 2); +  PIKE_ERROR("`|", "Bitwise or on different types.\n", sp, 2);    }       switch(sp[-2].type)
738:       len = sp[-2].u.string->len;    if (len != sp[-1].u.string->len) -  ERROR("`|", "Bitwise OR on strings of different lengths.\n", sp, 2); +  PIKE_ERROR("`|", "Bitwise OR on strings of different lengths.\n", sp, 2);    s = begin_shared_string(len);    for (i=0; i<len; i++)    s->str[i] = sp[-2].u.string->str[i] | sp[-1].u.string->str[i];
748:    }       default: -  ERROR("`|", "Bitwise or on illegal type.\n", sp, 2); +  PIKE_ERROR("`|", "Bitwise or on illegal type.\n", sp, 2);    }   }   
756:   {    switch(args)    { -  case 0: ERROR("`|", "Too few arguments.\n", sp, 0); +  case 0: PIKE_ERROR("`|", "Too few arguments.\n", sp, 0);    case 1: return;    case 2: o_or(); return;    default:
794:    {    if(call_lfun(LFUN_XOR, LFUN_RXOR))    return; -  ERROR("`^", "Bitwise XOR on different types.\n", sp, 2); +  PIKE_ERROR("`^", "Bitwise XOR on different types.\n", sp, 2);    }       switch(sp[-2].type)
842:       len = sp[-2].u.string->len;    if (len != sp[-1].u.string->len) -  ERROR("`^", "Bitwise XOR on strings of different lengths.\n", sp, 2); +  PIKE_ERROR("`^", "Bitwise XOR on strings of different lengths.\n", sp, 2);    s = begin_shared_string(len);    for (i=0; i<len; i++)    s->str[i] = sp[-2].u.string->str[i] ^ sp[-1].u.string->str[i];
852:    }       default: -  ERROR("`^", "Bitwise XOR on illegal type.\n", sp, 2); +  PIKE_ERROR("`^", "Bitwise XOR on illegal type.\n", sp, 2);    }   }   
860:   {    switch(args)    { -  case 0: ERROR("`^", "Too few arguments.\n", sp, 0); +  case 0: PIKE_ERROR("`^", "Too few arguments.\n", sp, 0);    case 1: return;    case 2: o_xor(); return;    default:
899:    return;       if(sp[-2].type != T_INT) -  ERROR("`<<", "Bad argument 1.\n", sp, 2); -  ERROR("`<<", "Bad argument 2.\n", sp, 2); +  PIKE_ERROR("`<<", "Bad argument 1.\n", sp, 2); +  PIKE_ERROR("`<<", "Bad argument 2.\n", sp, 2);    }    sp--;    sp[-1].u.integer = sp[-1].u.integer << sp->u.integer;
909:   void f_lsh(INT32 args)   {    if(args != 2) -  ERROR("`<<", "Bad number of args.\n", sp, args); +  PIKE_ERROR("`<<", "Bad number of args.\n", sp, args);    o_lsh();   }   
931:    if(call_lfun(LFUN_RSH, LFUN_RRSH))    return;    if(sp[-2].type != T_INT) -  ERROR("`>>", "Bad argument 1.\n", sp, 2); -  ERROR("`>>", "Bad argument 2.\n", sp, 2); +  PIKE_ERROR("`>>", "Bad argument 1.\n", sp, 2); +  PIKE_ERROR("`>>", "Bad argument 2.\n", sp, 2);    }    sp--;    sp[-1].u.integer = sp[-1].u.integer >> sp->u.integer;
941:   void f_rsh(INT32 args)   {    if(args != 2) -  ERROR("`>>", "Bad number of args.\n", sp, args); +  PIKE_ERROR("`>>", "Bad number of args.\n", sp, args);    o_rsh();   }   
968:    struct svalue *pos;    INT32 e;    if(sp[-1].u.integer < 0) -  ERROR("`*", "Cannot multiply array by negative number.\n", sp, 2); +  PIKE_ERROR("`*", "Cannot multiply array by negative number.\n", sp, 2);    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)
987:    char *pos;    INT32 e;    if(sp[-1].u.integer < 0) -  ERROR("`*", "Cannot multiply string by negative number.\n", sp, 2); +  PIKE_ERROR("`*", "Cannot multiply string by negative number.\n", sp, 2);    ret=begin_shared_string(sp[-2].u.string->len * sp[-1].u.integer);    pos=ret->str;    for(e=0;e<sp[-1].u.integer;e++,pos+=sp[-2].u.string->len)
1044:    if(call_lfun(LFUN_MULTIPLY, LFUN_RMULTIPLY))    return;    -  ERROR("`*", "Bad arguments.\n", sp, 2); +  PIKE_ERROR("`*", "Bad arguments.\n", sp, 2);    }   }   
1052:   {    switch(args)    { -  case 0: ERROR("`*", "Too few arguments.\n", sp, 0); +  case 0: PIKE_ERROR("`*", "Too few arguments.\n", sp, 0);    case 1: return;    case 2: o_multiply(); return;    default:
1100:       len=sp[-1].u.integer;    if(!len) -  ERROR("`/", "Division by zero.\n", sp, 2); +  PIKE_ERROR("`/", "Division by zero.\n", sp, 2);       if(len<0)    {
1131:       len=sp[-1].u.float_number;    if(len==0.0) -  ERROR("`/", "Division by zero.\n", sp, 2); +  PIKE_ERROR("`/", "Division by zero.\n", sp, 2);       if(len<0)    {
1186:       len=sp[-1].u.integer;    if(!len) -  ERROR("`/", "Division by zero.\n", sp, 2); +  PIKE_ERROR("`/", "Division by zero.\n", sp, 2);       if(len<0)    {
1219:       len=sp[-1].u.float_number;    if(len==0.0) -  ERROR("`/", "Division by zero.\n", sp, 2); +  PIKE_ERROR("`/", "Division by zero.\n", sp, 2);       if(len<0)    {
1265:    }    }    -  ERROR("`/", "Division on different types.\n", sp, 2); +  PIKE_ERROR("`/", "Division on different types.\n", sp, 2);    }       switch(sp[-2].type)
1296:       case T_FLOAT:    if(sp[-1].u.float_number == 0.0) -  ERROR("`/", "Division by zero.\n", sp, 2); +  PIKE_ERROR("`/", "Division by zero.\n", sp, 2);    sp--;    sp[-1].u.float_number /= sp[0].u.float_number;    return;
1305:    {    INT32 tmp;    if (sp[-1].u.integer == 0) -  ERROR("`/", "Division by zero\n", sp, 2); +  PIKE_ERROR("`/", "Division by zero\n", sp, 2);    sp--;       tmp=sp[-1].u.integer/sp[0].u.integer;
1319:    }       default: -  ERROR("`/", "Bad argument 1.\n", sp, 2); +  PIKE_ERROR("`/", "Bad argument 1.\n", sp, 2);    }   }   
1328:    switch(args)    {    case 0: -  case 1: ERROR("`/", "Too few arguments to `/\n", sp, args); +  case 1: PIKE_ERROR("`/", "Too few arguments to `/\n", sp, args);    case 2: o_divide(); break;    default:    {
1371:    struct pike_string *s=sp[-2].u.string;    INT32 tmp,base;    if(!sp[-1].u.integer) -  ERROR("`%", "Modulo by zero.\n", sp, 2); +  PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2);       tmp=sp[-1].u.integer;    if(tmp<0)
1394:    struct array *a=sp[-2].u.array;    INT32 tmp,base;    if(!sp[-1].u.integer) -  ERROR("`%", "Modulo by zero.\n", sp, 2); +  PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2);       tmp=sp[-1].u.integer;    if(tmp<0)
1413:    }    }    -  ERROR("`%", "Modulo on different types.\n", sp, 2); +  PIKE_ERROR("`%", "Modulo on different types.\n", sp, 2);    }       switch(sp[-2].type)
1426:    {    FLOAT_TYPE foo;    if(sp[-1].u.float_number == 0.0) -  ERROR("`%", "Modulo by zero.\n", sp, 2); +  PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2);    sp--;    foo=sp[-1].u.float_number / sp[0].u.float_number;    foo=sp[-1].u.float_number - sp[0].u.float_number * floor(foo);
1434:    return;    }    case T_INT: -  if (sp[-1].u.integer == 0) ERROR("`%", "Modulo by zero.\n", sp, 2); +  if (sp[-1].u.integer == 0) PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2);    sp--;    if(sp[-1].u.integer>=0)    {
1455:    return;       default: -  ERROR("`%", "Bad argument 1.\n", sp, 2); +  PIKE_ERROR("`%", "Bad argument 1.\n", sp, 2);    }   }      void f_mod(INT32 args)   {    if(args != 2) -  ERROR("`%", "Bad number of args\n", sp, args); +  PIKE_ERROR("`%", "Bad number of args\n", sp, args);    o_mod();   }   
1506:      void f_not(INT32 args)   { -  if(args != 1) ERROR("`!", "Bad number of args.\n", sp, args); +  if(args != 1) PIKE_ERROR("`!", "Bad number of args.\n", sp, args);    o_not();   }   
1552:    }       default: -  ERROR("`~", "Bad argument.\n", sp, 1); +  PIKE_ERROR("`~", "Bad argument.\n", sp, 1);    }   }      void f_compl(INT32 args)   { -  if(args != 1) ERROR("`~", "Bad number of args.\n", sp, args); +  if(args != 1) PIKE_ERROR("`~", "Bad number of args.\n", sp, args);    o_compl();   }   
1590:    return;       default: -  ERROR("`-", "Bad argument to unary minus.\n", sp, 1); +  PIKE_ERROR("`-", "Bad argument to unary minus.\n", sp, 1);    }   }   
1605:    }       if(sp[-2].type != T_INT) -  ERROR("`[]", "Bad argument 2 to [ .. ]\n", sp, 3); +  PIKE_ERROR("`[]", "Bad argument 2 to [ .. ]\n", sp, 3);       if(sp[-1].type != T_INT) -  ERROR("`[]", "Bad argument 3 to [ .. ]\n", sp, 3); +  PIKE_ERROR("`[]", "Bad argument 3 to [ .. ]\n", sp, 3);       from=sp[-2].u.integer;    if(from<0) from=0;
1656:    }       default: -  ERROR("`[]", "[ .. ] on non-scalar type.\n", sp, 3); +  PIKE_ERROR("`[]", "[ .. ] on non-scalar type.\n", sp, 3);    }   }   
1666:    {    case 0:    case 1: -  ERROR("`[]", "Too few arguments.\n", sp, args); +  PIKE_ERROR("`[]", "Too few arguments.\n", sp, args);    break;    case 2:    if(sp[-1].type==T_STRING) sp[-1].subtype=0;
1676:    o_range();    break;    default: -  ERROR("`[]", "Too many arguments.\n", sp, args); +  PIKE_ERROR("`[]", "Too many arguments.\n", sp, args);    }   }   
1686:    {    case 0:    case 1: -  ERROR("`->", "Too few arguments.\n", sp, args); +  PIKE_ERROR("`->", "Too few arguments.\n", sp, args);    break;    case 2:    if(sp[-1].type==T_STRING)
1694:    o_index();    break;    default: -  ERROR("`->", "Too many arguments.\n", sp, args); +  PIKE_ERROR("`->", "Too many arguments.\n", sp, args);    }   }   
1702:   {    INT32 tmp;    if(args<1) -  ERROR("sizeof", "Too few arguments.\n", sp, args); +  PIKE_ERROR("sizeof", "Too few arguments.\n", sp, args);       tmp=pike_sizeof(sp-args);