pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: pike_types.c,v 1.142 2000/11/25 16:55:27 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.143 2000/12/01 08:09:52 hubbe Exp $");   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"   #include "constants.h"   #include "object.h"   #include "multiset.h"   #include "mapping.h"   #include "pike_macros.h" - #include "error.h" + #include "pike_error.h"   #include "las.h"   #include "language.h"   #include "lex.h"   #include "pike_memory.h"   #include "bignum.h"   #include "main.h"   #include "opcodes.h"      /* #define PIKE_TYPE_DEBUG */   
pike.git/src/pike_types.c:141:    tFuncV(tNone,tZero,tOr(tMix,tVoid))));   }      static ptrdiff_t type_length(char *t)   {    char *q=t;   one_more_type:    switch(EXTRACT_UCHAR(t++))    {    default: -  fatal("error in type string %d.\n",EXTRACT_UCHAR(t-1)); +  fatal("Pike_error in type string %d.\n",EXTRACT_UCHAR(t-1));    /*NOTREACHED*/       break;       case T_SCOPE:    case T_ASSIGN:    t++;    goto one_more_type;       case T_FUNCTION:
pike.git/src/pike_types.c:382:   {    char buf[80];    unsigned int len;    unsigned char **s = (unsigned char **)_s;       while(ISSPACE(**s)) ++*s;       len=0;    for(len=0;isidchar(EXTRACT_UCHAR(s[0]+len));len++)    { -  if(len>=sizeof(buf)) error("Buffer overflow in parse_type\n"); +  if(len>=sizeof(buf)) Pike_error("Buffer overflow in parse_type\n");    buf[len] = s[0][len];    }    buf[len]=0;    *s += len;       switch(buf[0])    {    case 'z':    if(!strcmp(buf,"zero")) { push_type(T_ZERO); break; }    goto bad_type;
pike.git/src/pike_types.c:408:    if(**s=='(')    {    INT32 min,max;    ++*s;    while(ISSPACE(**s)) ++*s;    min=STRTOL((char *)*s,(char **)s,0);    while(ISSPACE(**s)) ++*s;    if(s[0][0]=='.' && s[0][1]=='.')    s[0]+=2;    else -  error("Missing .. in integer type.\n"); +  Pike_error("Missing .. in integer type.\n");       while(ISSPACE(**s)) ++*s;    max=STRTOL((char *)*s,(char **)s,0);    while(ISSPACE(**s)) ++*s;    -  if(**s != ')') error("Missing ')' in integer range.\n"); +  if(**s != ')') Pike_error("Missing ')' in integer range.\n");    ++*s;    push_type_int(max);    push_type_int(min);    }else{    push_type_int(MAX_INT32);    push_type_int(MIN_INT32);    }    push_type(T_INT);    break;    }
pike.git/src/pike_types.c:462:    ++*s;    while(ISSPACE(**s)) ++*s;    }    else if(s[0][0]=='.' && s[0][1]=='.' && s[0][2]=='.')    {    type_stack_reverse();    push_type(T_MANY);    type_stack_reverse();    *s+=3;    while(ISSPACE(**s)) ++*s; -  if(**s != ':') error("Missing ':' after ... in function type.\n"); +  if(**s != ':') Pike_error("Missing ':' after ... in function type.\n");    break;    }    pop_stack_mark();    pop_stack_mark();    }    ++*s;    type_stack_mark();    internal_parse_type(_s); /* return type */    type_stack_reverse(); -  if(**s != ')') error("Missing ')' in function type.\n"); +  if(**s != ')') Pike_error("Missing ')' in function type.\n");    ++*s;    type_stack_reverse();    }else{    push_type(T_VOID);    push_type(T_MIXED);    push_type(T_OR);    push_type(T_VOID);    push_type(T_ZERO);    push_type(T_OR);    push_type(T_MANY);
pike.git/src/pike_types.c:525:    if (!strcmp(buf,"tuple"))    {    while(ISSPACE(**s)) ++*s;    if(**s == '(')    {    type_stack_mark();    ++*s;    type_stack_mark();    internal_parse_type(_s);    type_stack_reverse(); -  if(**s != ',') error("Expecting ','.\n"); +  if(**s != ',') Pike_error("Expecting ','.\n");    ++*s;    type_stack_mark();    internal_parse_type(_s);    type_stack_reverse(); -  if(**s != ')') error("Expecting ')'.\n"); +  if(**s != ')') Pike_error("Expecting ')'.\n");    ++*s;    type_stack_reverse();    }else{    push_type(T_MIXED);    push_type(T_MIXED);    }    push_type(T_TUPLE);    break;    }    if(!strcmp(buf,"type")) { push_type(T_TYPE); break; }
pike.git/src/pike_types.c:555:    if(!strcmp(buf,"mapping"))    {    while(ISSPACE(**s)) ++*s;    if(**s == '(')    {    type_stack_mark();    ++*s;    type_stack_mark();    internal_parse_type(_s);    type_stack_reverse(); -  if(**s != ':') error("Expecting ':'.\n"); +  if(**s != ':') Pike_error("Expecting ':'.\n");    ++*s;    type_stack_mark();    internal_parse_type(_s);    type_stack_reverse(); -  if(**s != ')') error("Expecting ')'.\n"); +  if(**s != ')') Pike_error("Expecting ')'.\n");    ++*s;    type_stack_reverse();    }else{    push_type(T_MIXED);    push_type(T_MIXED);    }    push_type(T_MAPPING);    break;    }    if(!strcmp(buf,"multiset"))    {    while(ISSPACE(**s)) ++*s;    if(**s == '(')    {    ++*s;    internal_parse_type(_s); -  if(**s != ')') error("Expecting ')'.\n"); +  if(**s != ')') Pike_error("Expecting ')'.\n");    ++*s;    }else{    push_type(T_MIXED);    }    push_type(T_MULTISET);    break;    }    goto bad_type;       case 'u':
pike.git/src/pike_types.c:599:    goto bad_type;       case 'a':    if(!strcmp(buf,"array"))    {    while(ISSPACE(**s)) ++*s;    if(**s == '(')    {    ++*s;    internal_parse_type(_s); -  if(**s != ')') error("Expecting ')'.\n"); +  if(**s != ')') Pike_error("Expecting ')'.\n");    ++*s;    }else{    push_type(T_MIXED);    }    push_type(T_ARRAY);    break;    }    goto bad_type;       case '0':
pike.git/src/pike_types.c:636:    push_type(buf[0]);    push_type(T_ASSIGN);    }else{    push_type(buf[0]);    }    break;    }       default:    bad_type: -  error("Couldn't parse type. (%s)\n",buf); +  Pike_error("Couldn't parse type. (%s)\n",buf);    }       while(ISSPACE(**s)) ++*s;   }         static void internal_parse_typeB(char **s)   {    while(ISSPACE(**((unsigned char **)s))) ++*s;    switch(**s)
pike.git/src/pike_types.c:658:    case '!':    ++*s;    internal_parse_typeB(s);    push_type(T_NOT);    break;       case '(':    ++*s;    internal_parse_type(s);    while(ISSPACE(**((unsigned char **)s))) ++*s; -  if(**s != ')') error("Expecting ')'.\n"); +  if(**s != ')') Pike_error("Expecting ')'.\n");    ++*s;    break;       default:       internal_parse_typeA(s);    }   }      static void internal_parse_typeCC(char **s)
pike.git/src/pike_types.c:1943:    case T_FLOAT:    case T_STRING:    case T_TYPE:    case T_PROGRAM:    case T_ZERO:    case T_VOID:    case T_MIXED:    break;       default: -  fatal("error in type string.\n"); +  fatal("Pike_error in type string.\n");    }    return ret;   }      /*    * Flags used by pike_types_le()    */   #define LE_WEAK_OBJECTS 1 /* Perform weaker checking of objects. */      
pike.git/src/pike_types.c:2460:    case T_FLOAT:    case T_STRING:    case T_TYPE:    case T_PROGRAM:    case T_ZERO:    case T_VOID:    case T_MIXED:    break;       default: -  fatal("error in type string.\n"); +  fatal("Pike_error in type string.\n");    }    return 1;   }      /*    * Check the function parameters.    * Note: The difference between this function, and pike_types_le()    * is the more lenient check for T_OR, and the handling of T_ARRAY.    */   int strict_check_call(char *fun_type, char *arg_type)
pike.git/src/pike_types.c:3166:    push_type(T_FUNCTION);    return pop_unfinished_type();       case T_ARRAY:    return zzap_function_return(a+1,id);       case T_MIXED:    /* I wonder when this occurrs, but apparently it does... */    return zzap_function_return(tFuncV(tVoid,tOr(tMix,tVoid),tObj), id);    } - /* This error is bogus /Hubbe + /* This Pike_error is bogus /Hubbe    fatal("zzap_function_return() called with unexpected value: %d\n",    EXTRACT_UCHAR(a));   */    return NULL;   }      struct pike_string *get_type_of_svalue(struct svalue *s)   {    struct pike_string *ret;    switch(s->type)