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.25 1997/08/30 18:35:51 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.26 1997/09/29 00:57:55 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:976:    case T_AND:    return low_index_type(t+type_length(t),n);       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(low_match_types(string_type_string->str,CDR(n)->type->str,0)) +  { +  struct pike_string *a=low_index_type(t,n); +  if(!a)    return make_shared_binary_string(t, type_length(t)); -  +  +  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 make_shared_binary_string(t, type_length(t));    } -  +  } + }      struct pike_string *index_type(struct pike_string *type, node *n)   {    struct pike_string *t;    t=low_index_type(type->str,n);    if(!t) copy_shared_string(t,mixed_type_string);    return t;   }      static int low_check_indexing(char *type, char *index_type, node *n)
pike.git/src/pike_types.c:1005:    return low_check_indexing(type,index_type,n) ||    low_check_indexing(type+type_length(type),index_type,n);       case T_AND:    return low_check_indexing(type,index_type,n) &&    low_check_indexing(type+type_length(type),index_type,n);       case T_NOT:    return !low_check_indexing(type,index_type,n);    -  case T_STRING: +     case T_ARRAY: -  +  if(low_match_types(string_type_string->str, index_type,0) && +  low_check_indexing(type, index_type,n)) +  return 1; +  +  case T_STRING:    return !!low_match_types(int_type_string->str, index_type,0);       case T_OBJECT:    {    struct program *p=id_to_program(EXTRACT_INT(type));    if(p)    {    if(n->token == F_ARROW)    {    if(p->lfuns[LFUN_ARROW] != -1 || p->lfuns[LFUN_ASSIGN_ARROW] != -1)