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.193 2002/08/14 16:27:01 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.194 2002/08/15 14:49:24 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:287: Inside #if defined(PIKE_DEBUG)
   case T_STRING:    case T_MIXED:    case T_VOID:    case T_ZERO:    case PIKE_T_UNKNOWN:    case T_INT:    case T_OBJECT:    break;       default: -  fatal("free_type(): Unhandled type-node: %d\n", type); +  Pike_fatal("free_type(): Unhandled type-node: %d\n", type);    break;   #endif /* PIKE_DEBUG */    }    }   }      /* Flags used as flag_method: */   #define PT_COPY_CAR 1   #define PT_COPY_CDR 2   #define PT_COPY_BOTH 3
pike.git/src/pike_types.c:371: Inside #if defined(PIKE_DEBUG)
   case T_STRING:    case T_MIXED:    case T_VOID:    case T_ZERO:    case PIKE_T_UNKNOWN:    case T_INT:    case T_OBJECT:    break;       default: -  fatal("mk_type(): Unhandled type-node: %d\n", type); +  Pike_fatal("mk_type(): Unhandled type-node: %d\n", type);    break;   #endif /* PIKE_DEBUG */    }    add_ref((struct pike_type *)debug_malloc_pass(t));    return t;    }    }       debug_malloc_pass(t = alloc_pike_type());   
pike.git/src/pike_types.c:457: Inside #if defined(DEBUG_MALLOC)
   case T_STRING:    case T_MIXED:    case T_VOID:    case T_ZERO:    case PIKE_T_UNKNOWN:    case T_INT:    case T_OBJECT:    break;       default: -  fatal("mk_type(): Unhandled type-node: %d\n", type); +  Pike_fatal("mk_type(): Unhandled type-node: %d\n", type);    break;    }   #endif /* DEBUG_MALLOC */       return t;   }      #ifdef DEBUG_MALLOC   #define mk_type(T,CAR,CDR,FLAG) ((struct pike_type *)debug_malloc_pass(debug_mk_type(T,CAR,CDR,FLAG)))   #else /* !DEBUG_MALLOC */
pike.git/src/pike_types.c:486:      #endif /* PIKE_DEBUG */      struct pike_type *type_stack[PIKE_TYPE_STACK_SIZE];   struct pike_type **pike_type_mark_stack[PIKE_TYPE_STACK_SIZE/4];      ptrdiff_t pop_stack_mark(void)   {    Pike_compiler->pike_type_mark_stackp--;    if(Pike_compiler->pike_type_mark_stackp<pike_type_mark_stack) -  fatal("Type mark stack underflow\n"); +  Pike_fatal("Type mark stack underflow\n");       TYPE_STACK_DEBUG("pop_stack_mark");       return Pike_compiler->type_stackp - *Pike_compiler->pike_type_mark_stackp;   }      void type_stack_pop_to_mark(void)   {    pop_stack_mark();    while(Pike_compiler->type_stackp > *Pike_compiler->pike_type_mark_stackp) {
pike.git/src/pike_types.c:546:    PT_COPY_CDR);       TYPE_STACK_DEBUG("push_scope_type");   }      void debug_push_assign_type(int marker)   {    marker -= '0';   #ifdef PIKE_DEBUG    if ((marker < 0) || (marker > 9)) { -  fatal("Bad assign marker: %ld\n", marker); +  Pike_fatal("Bad assign marker: %ld\n", marker);    }   #endif /* PIKE_DEBUG */       *Pike_compiler->type_stackp = mk_type(T_ASSIGN,    (void *)(ptrdiff_t)marker,    *Pike_compiler->type_stackp,    PT_COPY_CDR);    TYPE_STACK_DEBUG("push_assign_type");   }   
pike.git/src/pike_types.c:613:    PT_COPY_CAR);    break;       case T_SCOPE:    case T_ASSIGN:    case T_INT:    case T_OBJECT:    case PIKE_T_NAME:    default:    /* Should not occurr. */ -  fatal("Unsupported argument to push_type().\n"); +  Pike_fatal("Unsupported argument to push_type().\n");    break;       case T_FLOAT:    case T_STRING:    case T_MIXED:    case T_VOID:    case T_ZERO:    case PIKE_T_UNKNOWN:    /* Leaf type. */    *(++Pike_compiler->type_stackp) = mk_type(type, NULL, NULL, 0);
pike.git/src/pike_types.c:649:    }       TYPE_STACK_DEBUG("push_type");   }      /* Pop one level of types. This is the inverse of push_type() */   void debug_pop_type_stack(unsigned INT16 expected)   {    struct pike_type *top;    if(Pike_compiler->type_stackp<type_stack) -  fatal("Type stack underflow\n"); +  Pike_fatal("Type stack underflow\n");       top = *(Pike_compiler->type_stackp);    /* Special case... */    if (top->type == T_MIXED) return; /* Probably due to an earlier error */       Pike_compiler->type_stackp--;   #ifdef PIKE_DEBUG    if ((top->type != expected) && (top->type != PIKE_T_NAME)) { -  fatal("Unexpected type on stack: %d (expected %d)\n", top->type, expected); +  Pike_fatal("Unexpected type on stack: %d (expected %d)\n", top->type, expected);    }   #endif /* PIKE_DEBUG */    /* OPTIMIZE: It looks like this function is always called with    * expected == T_ARRAY.    */    switch(top->type) {    case T_FUNCTION:    case T_MANY:    case T_TUPLE:    case T_MAPPING:
pike.git/src/pike_types.c:817:    return ret;   }      struct pike_type *debug_pop_unfinished_type(void)   {    ptrdiff_t len;       len = pop_stack_mark();       if (len != 1) { -  fatal("pop_unfinished_type(): Unexpected len: %d\n", len); +  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)
pike.git/src/pike_types.c:1206:   #endif       /* fprintf(stderr, "parse_type(\"%s\")...\n", s); */       TYPE_STACK_DEBUG("parse_type");       type_stack_mark();    internal_parse_type(&s);       if( *s ) -  fatal("Extra junk at end of type definition.\n"); +  Pike_fatal("Extra junk at end of type definition.\n");       ret=pop_unfinished_type();      #ifdef PIKE_DEBUG    if(ts!=Pike_compiler->type_stackp || ptms!=Pike_compiler->pike_type_mark_stackp) -  fatal("Type stack whacked in parse_type.\n"); +  Pike_fatal("Type stack whacked in parse_type.\n");   #endif       return ret;   }      #ifdef PIKE_DEBUG   /* FIXME: */   void stupid_describe_type_string(char *a, ptrdiff_t len)   {    ptrdiff_t e;
pike.git/src/pike_types.c:2190:       case T_ASSIGN:    ret = low_match_types(a->cdr, b, flags);    if(ret && (b->type != T_VOID))    {    int m = (ptrdiff_t)a->car;    struct pike_type *tmp;      #ifdef PIKE_DEBUG    if ((m < 0) || (m > 9)) { -  fatal("marker out of range: %d\n", m); +  Pike_fatal("marker out of range: %d\n", m);    }   #endif /* PIKE_DEBUG */       type_stack_mark();    push_finished_type_with_markers(b, b_markers);    tmp = pop_unfinished_type();       type_stack_mark();    low_or_pike_types(a_markers[m], tmp, 0);    if(a_markers[m]) free_type(a_markers[m]);
pike.git/src/pike_types.c:2221: Inside #if defined(PIKE_TYPE_DEBUG)
   my_putchar((char)(m+'0'));    my_strcat("]=");    my_describe_type(a_markers[m]);    my_strcat("\n");    fprintf(stderr,"%s",(s=simple_free_buf()));    free(s);    }   #endif   #ifdef PIKE_DEBUG    if((ptrdiff_t)a_markers[m]->type == m+'0') -  fatal("Cyclic type!\n"); +  Pike_fatal("Cyclic type!\n");   #endif    }    return ret;       case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = a->type - '0';    if(a_markers[m])    {   #ifdef PIKE_DEBUG    if(a_markers[m]->type == a->type) -  fatal("Cyclic type!\n"); +  Pike_fatal("Cyclic type!\n");    if(a_markers[m]->type == T_OR &&    a_markers[m]->car->type == a->type) -  fatal("Cyclic type!\n"); +  Pike_fatal("Cyclic type!\n");   #endif    return low_match_types(a_markers[m], b, flags);    }    else    return low_match_types(mixed_type_string, b, flags);    }    }       switch(b->type)    {
pike.git/src/pike_types.c:2307: Inside #if defined(PIKE_TYPE_DEBUG)
   my_putchar((char)(m+'0'));    my_strcat("]=");    my_describe_type(b_markers[m]);    my_strcat("\n");    fprintf(stderr,"%s",(s=simple_free_buf()));    free(s);    }   #endif   #ifdef PIKE_DEBUG    if((ptrdiff_t)b_markers[m]->type == m+'0') -  fatal("Cyclic type!\n"); +  Pike_fatal("Cyclic type!\n");   #endif    }    return ret;       case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = b->type - '0';    if(b_markers[m])    {   #ifdef PIKE_DEBUG    if(b_markers[m]->type == b->type) -  fatal("Cyclic type!\n"); +  Pike_fatal("Cyclic type!\n");   #endif    return low_match_types(a, b_markers[m], flags);    }    else    return low_match_types(a, mixed_type_string, flags);    }    }       /* 'mixed' matches anything */   
pike.git/src/pike_types.c:2595:    flags & ~(A_EXACT|B_EXACT))) return 0;       case T_FLOAT:    case T_STRING:    case T_ZERO:    case T_VOID:    case T_MIXED:    break;       default: -  fatal("Error in type string.\n"); +  Pike_fatal("Error in type string.\n");    }    return ret;   }      /*    * Check the partial ordering relation.    *    * mixed    *    * int float string program function object
pike.git/src/pike_types.c:3133:    goto recurse;       case T_FLOAT:    case T_STRING:    case T_ZERO:    case T_VOID:    case T_MIXED:    break;       default: -  fatal("Error in type string.\n"); +  Pike_fatal("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(struct pike_type *fun_type,
pike.git/src/pike_types.c:4096:    /* FIXME: */    type_stack_mark();    push_object_type(1, id);    push_type(T_VOID);    push_type(T_MIXED);    push_type(T_OR);    push_type(T_MANY);    return pop_unfinished_type();    }   /* This error is bogus /Hubbe -  fatal("zzap_function_return() called with unexpected value: %d\n", +  Pike_fatal("zzap_function_return() called with unexpected value: %d\n",    EXTRACT_UCHAR(a));   */    return NULL;   }      struct pike_type *get_type_of_svalue(struct svalue *s)   {    struct pike_type *ret;    switch(s->type)    {
pike.git/src/pike_types.c:4426:   static struct pike_type *debug_low_make_pike_type(unsigned char *type_string,    unsigned char **cont)   {    unsigned INT32 type;    struct pike_type *tmp;       switch(type = *type_string) {    case T_SCOPE:    case T_ASSIGN:    if ((type_string[1] < '0') || (type_string[1] > '9')) { -  fatal("low_make_pike_type(): Bad marker: %d\n", type_string[1]); +  Pike_fatal("low_make_pike_type(): Bad marker: %d\n", type_string[1]);    }    return mk_type(type, (void *)(ptrdiff_t)(type_string[1] - '0'),    low_make_pike_type(type_string+2, cont), PT_COPY_CDR);    case T_FUNCTION:    /* Multiple ordered values. */    /* FIXME: */    return low_make_function_type(type_string+1, cont);    case T_TUPLE:    case T_MAPPING:    case PIKE_T_RING:
pike.git/src/pike_types.c:4490:    case T_INT:    *cont = type_string + 9; /* 2*sizeof(INT32) + 1 */    return mk_type(T_INT,    (void *)(ptrdiff_t)extract_type_int(type_string+1),    (void *)(ptrdiff_t)extract_type_int(type_string+5), 0);    case T_OBJECT:    *cont = type_string + 6; /* 1 + sizeof(INT32) + 1 */    return mk_type(T_OBJECT, (void *)(ptrdiff_t)(type_string[1]),    (void *)(ptrdiff_t)extract_type_int(type_string+2), 0);    default: -  fatal("compile_type_string(): Error in type string %d.\n", type); +  Pike_fatal("compile_type_string(): Error in type string %d.\n", type);    /* NOT_REACHED */    break;    }    /* NOT_REACHED */    return NULL;   }      /* Make a pike-type from a serialized (old-style) type. */   struct pike_type *debug_make_pike_type(const char *serialized_type)   {
pike.git/src/pike_types.c:4557:    goto again;       case T_PROGRAM:    case T_TYPE:    case T_INT:    case T_FLOAT:    case T_STRING:    case T_VOID:    return 1;    default: -  fatal("pike_type_allow_premature_toss: Unknown type code (%d)\n", +  Pike_fatal("pike_type_allow_premature_toss: Unknown type code (%d)\n",    ((unsigned char *)type)[-1]);    /* NOT_REACHED */    return 0;    }   }      static void low_type_to_string(struct pike_type *t)   {    recurse:    switch(t->type) {