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.47 1998/10/28 03:17:23 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.48 1998/11/06 03:08:01 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"
pike.git/src/pike_types.c:118:    any_type_string=parse_type("void|mixed");   }      static int type_length(char *t)   {    char *q=t;   one_more_type:    switch(EXTRACT_UCHAR(t++))    {    default: -  fatal("error in type string.\n"); +  fatal("error in type string %d.\n",EXTRACT_UCHAR(t-1));    /*NOTREACHED*/       break;       case T_ASSIGN:    t++;    goto one_more_type;       case T_FUNCTION:    while(EXTRACT_UCHAR(t)!=T_MANY) t+=type_length(t); /* skip arguments */
pike.git/src/pike_types.c:303:      struct pike_string *debug_compiler_pop_type(void)   {    extern int num_parse_error;    if(num_parse_error)    {    /* This could be fixed to check if the type    * is correct and then return it, I just didn't feel    * like writing the checking code today. / Hubbe    */ -  pop_stack_mark(); +  type_stack_pop_to_mark();    type_stack_mark();    reference_shared_string(mixed_type_string);    return mixed_type_string;    }else{    struct pike_string *s;    s=pop_unfinished_type();    type_stack_mark();    return s;    }   }
pike.git/src/pike_types.c:603:    }   }      /* 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_string *parse_type(char *s)   { +  struct pike_string *ret; + #ifdef DEBUG +  unsigned char *ts=type_stackp; +  unsigned char **ptms=pike_type_mark_stackp; + #endif    type_stack_mark();    internal_parse_type(&s);       if( *s )    fatal("Extra junk at end of type definition.\n");    -  return pop_unfinished_type(); +  ret=pop_unfinished_type(); +  + #ifdef DEBUG +  if(ts!=type_stackp || ptms!=pike_type_mark_stackp) +  fatal("Type stack whacked in parse_type.\n"); + #endif +  +  return ret;   }      #ifdef DEBUG   void stupid_describe_type(char *a,INT32 len)   {    INT32 e;    for(e=0;e<len;e++)    {    if(e) printf(" ");    switch(EXTRACT_UCHAR(a+e))
pike.git/src/pike_types.c:1315:    return mixed_type_string;    }    }    }    }    }    default:    reference_shared_string(mixed_type_string);    return mixed_type_string;    +  case T_VOID: +  case T_FLOAT: +  case T_INT: +  return 0; +     case T_OR:    {    struct pike_string *a,*b; -  type_stack_mark(); +     a=low_index_type(t,n);    t+=type_length(t);    b=low_index_type(t,n);    if(!b) return a;    if(!a) return b;    type_stack_mark();    medium_or_pike_types(a,b);    free_string(a);    free_string(b);    return pop_unfinished_type();