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.123 2000/02/29 22:57:46 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.124 2000/03/10 00:36:44 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:2737:    case T_STRING: /* always int */    case T_MULTISET: /* always int */    reference_shared_string(int_type_string);    return int_type_string;       case T_MAPPING:    t+=type_length(t);    return make_shared_binary_string(t, type_length(t));       case T_ARRAY: -  if(n && -  (CDR(n)->token == F_CONSTANT ? -  (CDR(n)->u.sval.type == T_STRING) : -  !!low_match_types(string_type_string->str,CDR(n)->type->str,0))) +     { -  struct pike_string *a=low_index_type(t,index_type,n); -  if(!a) -  return make_shared_binary_string(t, type_length(t)); +  struct pike_string *a;    -  +  if(low_pike_types_le(tString, index_type, 0, 0) && +  (a = low_index_type(t, tString, n))) { +  /* Possible to index the array with a string. */ +  if (low_match_types(tInt, index_type, 0)) { +  /* Also possible to index the array with an int. */    type_stack_mark();    push_finished_type(a);    free_string(a); -  push_type(T_ARRAY); -  if(low_match_types(int_type_string->str,CDR(n)->type->str,0)) -  { +     push_unfinished_type(t);    push_type(T_OR); -  } +     return pop_unfinished_type(); -  }else{ +  } +  return a; +  } +  if (low_match_types(tInt, index_type, 0)) { +  /* Possible to index the array with an int. */    return make_shared_binary_string(t, type_length(t));    } -  +  /* Bad index type. */ +  return 0;    }    } -  + }      struct pike_string *index_type(struct pike_string *type,    struct pike_string *index_type,    node *n)   {    struct pike_string *t;    clear_markers();    t=low_index_type(type->str,index_type->str,n);    if(!t) copy_shared_string(t,mixed_type_string);    return t;