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.92 1999/12/13 12:08:12 mast Exp $"); + RCSID("$Id: pike_types.c,v 1.93 1999/12/13 21:42:29 grubba 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:69:   struct pike_string *function_type_string;   struct pike_string *object_type_string;   struct pike_string *program_type_string;   struct pike_string *array_type_string;   struct pike_string *multiset_type_string;   struct pike_string *mapping_type_string;   struct pike_string *mixed_type_string;   struct pike_string *void_type_string;   struct pike_string *zero_type_string;   struct pike_string *any_type_string; + struct pike_string *weak_type_string; /* array|mapping|multiset */      static struct pike_string *a_markers[10],*b_markers[10];      static void clear_markers(void)   {    unsigned int e;    for(e=0;e<NELEM(a_markers);e++)    {    if(a_markers[e])    {
pike.git/src/pike_types.c:119:    program_type_string = CONSTTYPE(tPrg);    float_type_string = CONSTTYPE(tFloat);    mixed_type_string=CONSTTYPE(tMix);    array_type_string=CONSTTYPE(tArray);    multiset_type_string=CONSTTYPE(tMultiset);    mapping_type_string=CONSTTYPE(tMapping);    function_type_string=CONSTTYPE(tFunction);    void_type_string=CONSTTYPE(tVoid);    zero_type_string=CONSTTYPE(tZero);    any_type_string=CONSTTYPE(tOr(tVoid,tMix)); +  weak_type_string=CONSTTYPE(tOr3(tArray,tMultiset,tMapping));   }      static int 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));
pike.git/src/pike_types.c:2956:    case T_FUNCTION:    if(s->subtype == FUNCTION_BUILTIN)    {    ret=s->u.efun->type;    }else{    struct program *p;       p=s->u.object->prog;    if(!p)    { -  ret=int_type_string; +  ret=zero_type_string;    }else{    ret=ID_FROM_INT(p,s->subtype)->type;    }    }    reference_shared_string(ret);    return ret;    -  +  case T_MULTISET:    case T_ARRAY: -  type_stack_mark(); -  push_type(T_MIXED); -  push_type(T_ARRAY); -  return pop_unfinished_type(); +  { +  struct pike_string *arg_type; + #if 0 +  struct array *a; +  int i;    -  case T_MULTISET: +  if (s->type == T_MULTISET) { +  a = s->u.multiset->ind; +  } else { +  a = s->u.array; +  } +  /* FIXME: Circular structures? */ +  copy_shared_string(arg_type, zero_type_string); +  for (i = 0; i < a->size; i++) { +  struct pike_string *tmp1 = get_type_of_svalue(a->item+i); +  struct pike_string *tmp2 = or_pike_types(arg_type, tmp1, 1); +  free_string(arg_type); +  free_string(tmp1); +  arg_type = tmp2; +  } + #else /* !0 */ +  copy_shared_string(arg_type, mixed_type_string); + #endif /* 0 */    type_stack_mark(); -  push_type(T_MIXED); -  push_type(T_MULTISET); +  push_unfinished_type(arg_type->str); +  free_string(arg_type); +  push_type(s->type);    return pop_unfinished_type(); -  +  }    -  +     case T_MAPPING:    type_stack_mark();    push_type(T_MIXED);    push_type(T_MIXED);    push_type(T_MAPPING);    return pop_unfinished_type();       case T_OBJECT:    type_stack_mark();    if(s->u.object->prog)
pike.git/src/pike_types.c:3002: Inside #if defined(AUTO_BIGNUM)
   push_type(T_INT);    }    else   #endif    {    push_type_int(s->u.object->prog->id);    push_type(1);    push_type(T_OBJECT);    }    }else{ -  push_type_int(0); -  push_type(0); -  push_type(T_OBJECT); +  /* Destructed object */ +  push_type(T_ZERO);    }    return pop_unfinished_type();       case T_INT:    if(s->u.integer)    {    type_stack_mark();    /* Fixme, check that the integer is in range of MIN_INT32 .. MAX_INT32!    */    push_type_int(s->u.integer);
pike.git/src/pike_types.c:3088:    free_string(function_type_string);    free_string(object_type_string);    free_string(program_type_string);    free_string(array_type_string);    free_string(multiset_type_string);    free_string(mapping_type_string);    free_string(mixed_type_string);    free_string(void_type_string);    free_string(zero_type_string);    free_string(any_type_string); +  free_string(weak_type_string);   }         int type_may_overload(char *type, int lfun)   {    switch(EXTRACT_UCHAR(type++))    {    case T_ASSIGN:    return type_may_overload(type+1,lfun);