pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*\   ||| This file is part of Pike. For copyright information see COPYRIGHT.   ||| Pike is distributed under GPL, LGPL and MPL. See the file COPYING   ||| for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: pike_types.c,v 1.194 2002/08/15 14:49:24 marcus Exp $"); + RCSID("$Id: pike_types.c,v 1.195 2002/09/12 13:15:49 marcus 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"
pike.git/src/pike_types.c:161:   }         #define TWOT(X,Y) (((X) << 8)+(Y))      static int low_pike_types_le(struct pike_type *a, struct pike_type *b,    int array_cnt, unsigned int flags);   static int low_check_indexing(struct pike_type *type,    struct pike_type *index_type,    node *n); - static void internal_parse_type(char **s); + static void internal_parse_type(const char **s);      /*    * New and improved type representation system.    *    * This representation is new in Pike 7.3.    *    * Node: Car: Cdr:    * ---------------------------------------------    * SCOPE num vars (int) type    * ASSIGN variable (int) type
pike.git/src/pike_types.c:827:    Pike_fatal("pop_unfinished_type(): Unexpected len: %d\n", len);    }       TYPE_STACK_DEBUG("pop_unfinished_type");       return *(Pike_compiler->type_stackp--);   }      /******/    - static void internal_parse_typeA(char **_s) + static void internal_parse_typeA(const char **_s)   {    char buf[80];    unsigned int len; -  unsigned char **s = (unsigned char **)_s; +  const unsigned char **s = (const unsigned char **)_s;       while(ISSPACE(**s)) ++*s;       len=0;    for(len=0;isidchar(EXTRACT_UCHAR(s[0]+len));len++)    {    if(len>=sizeof(buf)) Pike_error("Buffer overflow in parse_type\n");    buf[len] = s[0][len];    }    buf[len]=0;
pike.git/src/pike_types.c:859:       case 'i':    if(!strcmp(buf,"int"))    {    while(ISSPACE(**s)) ++*s;    if(**s=='(')    {    INT32 min,max;    ++*s;    while(ISSPACE(**s)) ++*s; -  min=STRTOL((char *)*s,(char **)s,0); +  min=STRTOL((const char *)*s,(char **)s,0);    while(ISSPACE(**s)) ++*s;    if(s[0][0]=='.' && s[0][1]=='.')    s[0]+=2;    else    Pike_error("Missing .. in integer type.\n");       while(ISSPACE(**s)) ++*s; -  max=STRTOL((char *)*s,(char **)s,0); +  max=STRTOL((const char *)*s,(char **)s,0);    while(ISSPACE(**s)) ++*s;       if(**s != ')') Pike_error("Missing ')' in integer range.\n");    ++*s;    push_int_type(min, max);    }else{    push_int_type(MIN_INT32, MAX_INT32);    }    break;    }
pike.git/src/pike_types.c:1122:       default:    bad_type:    Pike_error("Couldn't parse type. (%s)\n",buf);    }       while(ISSPACE(**s)) ++*s;   }       - static void internal_parse_typeB(char **s) + static void internal_parse_typeB(const char **s)   { -  while(ISSPACE(**((unsigned char **)s))) ++*s; +  while(ISSPACE(**((const unsigned char **)s))) ++*s;    switch(**s)    {    case '!':    ++*s;    internal_parse_typeB(s);    push_type(T_NOT);    break;       case '(':    ++*s;    internal_parse_type(s); -  while(ISSPACE(**((unsigned char **)s))) ++*s; +  while(ISSPACE(**((const unsigned char **)s))) ++*s;    if(**s != ')') Pike_error("Expecting ')'.\n");    ++*s;    break;       default:       internal_parse_typeA(s);    }   }    - static void internal_parse_typeCC(char **s) + static void internal_parse_typeCC(const char **s)   {    internal_parse_typeB(s);    -  while(ISSPACE(**((unsigned char **)s))) ++*s; +  while(ISSPACE(**((const unsigned char **)s))) ++*s;       while(**s == '*')    {    ++*s; -  while(ISSPACE(**((unsigned char **)s))) ++*s; +  while(ISSPACE(**((const unsigned char **)s))) ++*s;    push_type(T_ARRAY);    }   }    - static void internal_parse_typeC(char **s) + static void internal_parse_typeC(const char **s)   {    internal_parse_typeCC(s);       if(**s == '&')    {    ++*s;    internal_parse_typeC(s);    push_reverse_type(T_AND);    }   }    - static void internal_parse_type(char **s) + static void internal_parse_type(const char **s)   {    internal_parse_typeC(s);       while(**s == '|')    {    ++*s;    internal_parse_typeC(s);    push_type(T_OR);    }   }      /* This function is used when adding simul efuns so that    * the types for the functions can be easily stored in strings.    * It takes a string on the exact same format as Pike and returns a type    * struct.    */ - struct pike_type *parse_type(char *s) + struct pike_type *parse_type(const char *s)   {    struct pike_type *ret;   #ifdef PIKE_DEBUG    struct pike_type **ts=Pike_compiler->type_stackp;    struct pike_type ***ptms=Pike_compiler->pike_type_mark_stackp;   #endif       /* fprintf(stderr, "parse_type(\"%s\")...\n", s); */       TYPE_STACK_DEBUG("parse_type");