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.49 1998/11/22 11:03:10 hubbe Exp $"); + RCSID("$Id: pike_types.c,v 1.50 1999/02/10 21:46:48 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:80:    }    if(b_markers[e])    {    free_string(b_markers[e]);    b_markers[e]=0;    }    }   }      #ifdef PIKE_DEBUG - static void CHECK_TYPE(struct pike_string *s) + void check_type_string(struct pike_string *s)   {    if(debug_findstring(s) != s)    fatal("Type string not shared.\n");       if(type_length(s->str) != s->len)    {    stupid_describe_type(s->str,s->len);    fatal("Length of type is wrong. (should be %d, is %d)\n",type_length(s->str),s->len);    }   } - #else - #define CHECK_TYPE(X) +    #endif      void init_types(void)   {    string_type_string=parse_type("string");    int_type_string=parse_type("int");    object_type_string=parse_type("object");    program_type_string=parse_type("program");    float_type_string=parse_type("float");    mixed_type_string=parse_type("mixed");
pike.git/src/pike_types.c:260:    default:    push_type(c);    }    }    type_stack_reverse();   }      void push_finished_type(struct pike_string *type)   {    int e; -  CHECK_TYPE(type); +  check_type_string(type);    for(e=type->len-1;e>=0;e--) push_type(type->str[e]);   }      void push_finished_type_backwards(struct pike_string *type)   {    int e; -  CHECK_TYPE(type); +  check_type_string(type);    MEMCPY(type_stackp, type->str, type->len);    type_stackp+=type->len;   }      struct pike_string *debug_pop_unfinished_type(void)   {    int len,e;    struct pike_string *s;    len=pop_stack_mark();    s=begin_shared_string(len);    type_stackp-=len;    MEMCPY(s->str, type_stackp, len);    reverse(s->str, len, 1);    s=end_shared_string(s); -  CHECK_TYPE(s); +  check_type_string(s);    return s;   }      struct pike_string *debug_pop_type(void)   {    struct pike_string *s;    s=pop_unfinished_type();    type_stack_mark();    return s;   }
pike.git/src/pike_types.c:1263:    push_type(T_MIXED);    return 1;    }    }    return 0;   }         int match_types(struct pike_string *a,struct pike_string *b)   { -  CHECK_TYPE(a); -  CHECK_TYPE(b); +  check_type_string(a); +  check_type_string(b);    clear_markers();    return 0!=low_match_types(a->str, b->str,0);   }         #ifdef DEBUG_MALLOC   #define low_index_type(X,Y) ((struct pike_string *)debug_malloc_touch(debug_low_index_type((X),(Y))))   #else   #define low_index_type debug_low_index_type   #endif
pike.git/src/pike_types.c:1453:       default:    return 0;    }   }      int check_indexing(struct pike_string *type,    struct pike_string *index_type,    node *n)   { -  CHECK_TYPE(type); -  CHECK_TYPE(index_type); +  check_type_string(type); +  check_type_string(index_type);       return low_check_indexing(type->str, index_type->str, n);   }      static int low_count_arguments(char *q)   {    int num,num2;       switch(EXTRACT_UCHAR(q++))    {
pike.git/src/pike_types.c:1502:    return num;    }   }      /* Count the number of arguments for a funciton type.    * return -1-n if the function can take number of arguments    * >= n (varargs)    */   int count_arguments(struct pike_string *s)   { -  CHECK_TYPE(s); +  check_type_string(s);       return low_count_arguments(s->str);   }      struct pike_string *check_call(struct pike_string *args,    struct pike_string *type)   { -  CHECK_TYPE(args); -  CHECK_TYPE(type); +  check_type_string(args); +  check_type_string(type);    clear_markers();    type_stack_mark();    max_correct_args=0;       if(low_get_return_type(type->str,args->str))    {    return pop_unfinished_type();    }else{    pop_stack_mark();    return 0;    }   }      INT32 get_max_args(struct pike_string *type)   {    INT32 ret,tmp=max_correct_args; -  CHECK_TYPE(type); +  check_type_string(type);    clear_markers();    type=check_call(function_type_string, type);    if(type) free_string(type);    ret=max_correct_args;    max_correct_args=tmp;    return tmp;   }      struct pike_string *get_type_of_svalue(struct svalue *s)   {