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. - || $Id: pike_types.c,v 1.312 2007/10/02 16:54:31 grubba Exp $ + || $Id: pike_types.c,v 1.313 2007/11/03 20:06:31 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:211:   /*    * New and improved type representation system.    *    * This representation is new in Pike 7.3.    *    * Node: Car: Cdr:    * ---------------------------------------------    * SCOPE num vars (int) type    * ASSIGN variable (int) type    * NAME name (string) type -  * ATTRIBUTE name (string) type +  * ATTRIBUTE name (string) type Added in 7.7.    * FUNCTION type FUNCTION|MANY    * MANY many type return type -  * RING type type -  * TUPLE type type +  * RING type type Reserved. +  * TUPLE type type Reserved.    * MAPPING index type value type    * OR type (not OR) type    * AND type type    * ARRAY type -    * MULTISET type -    * NOT type -    * '0'-'9' - -    * FLOAT - -    * STRING ZERO, INT or OR - Range added in 7.7    * TYPE type -
pike.git/src/pike_types.c:2875:    if (val >= 0) t2 = n2;    on_stack = 1;    }    on_stack = pop_stack_mark();    while (on_stack > 1) {    push_reverse_joiner_type(T_OR);    on_stack--;    }    }    else { -  int val = lower_or_pike_types(t1, t2, zero_implied, 0); +  int val; +  type_stack_mark(); +  val = lower_or_pike_types(t1, t2, zero_implied, 0);    if (val < 0) { -  push_finished_type(t2); -  push_reverse_joiner_type(T_OR); +  lower_or_pike_types(NULL, t2, zero_implied, 1);    } else if (val > 0) { -  push_finished_type(t1); +  lower_or_pike_types(t1, NULL, zero_implied, 1); +  } else { +  pop_stack_mark(); +  return; +  } +  for (val = pop_stack_mark(); val > 1; val--) {    push_reverse_joiner_type(T_OR);    }    }   }      struct pike_type *or_pike_types(struct pike_type *a,    struct pike_type *b,    int zero_implied)   {    struct pike_type *res;
pike.git/src/pike_types.c:5745:    while(fun_type->type == PIKE_T_ARRAY) {    array_cnt++;    fun_type = fun_type->car;    }       switch(fun_type->type) {    case T_SCOPE:    /* FIXME: Save and restore the corresponding marker set. */    case T_ASSIGN:    case PIKE_T_NAME: -  case PIKE_T_ATTRIBUTE: +     fun_type = fun_type->cdr;    goto loop;    -  +  case PIKE_T_ATTRIBUTE: +  res = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS); +  type_stack_mark(); +  push_finished_type(res); +  push_type_attribute((struct pike_string *)fun_type->car); +  free_type(res); +  return pop_unfinished_type();       case T_OR:    res = lower_new_check_call(fun_type->car, arg_type, flags, sval CHECK_CALL_ARGS);    if (!res) {    res = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);    break;    }    tmp = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);    if (!tmp) break;    res = or_pike_types(tmp2 = res, tmp, 1);
pike.git/src/pike_types.c:7088: Inside #if 0
   if(!(implements_a && implements_b &&    type_a->str[0]==T_OBJECT &&    type_b->str[0]==T_OBJECT))   #endif /* 0 */    {    struct pike_string *s1, *s2;    s1 = describe_type(type_a);    s2 = describe_type(type_b);    if(flags & YYTE_IS_WARNING)    { -  yywarning("Expected: %s",s1->str); -  yywarning("Got : %s",s2->str); +  yywarning("Expected: %S", s1); +  yywarning("Got : %S", s2);    }else{    my_yyerror("Expected: %S", s1);    my_yyerror("Got : %S", s2);    }    free_string(s1);    free_string(s2);    }       /* Protect against circularities. */    if (BEGIN_CYCLIC(type_a, type_b)) {