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.226 2003/11/12 15:47:41 grubba Exp $ + || $Id: pike_types.c,v 1.227 2003/11/18 11:19:41 grubba Exp $   */      #include "global.h" - RCSID("$Id: pike_types.c,v 1.226 2003/11/12 15:47:41 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.227 2003/11/18 11:19:41 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:73:   PMOD_EXPORT struct pike_type *weak_type_string; /* array|mapping|multiset|function */      #ifdef DEBUG_MALLOC   struct pike_type_location *all_pike_type_locations = NULL;   #endif /* DEBUG_MALLOC */      static struct pike_type *a_markers[10], *b_markers[10];      static struct program *implements_a;   static struct program *implements_b; + static int implements_mode;      #ifdef PIKE_DEBUG   void TYPE_STACK_DEBUG(const char *fun)   {   #if 0    fprintf(stderr, "%25s(): stack_depth:%ld mark_stack_depth:%ld\n",    fun, (long)(Pike_compiler->type_stackp - type_stack),    (long)(Pike_compiler->pike_type_mark_stackp - pike_type_mark_stack));   #endif /* 0 */   }
pike.git/src/pike_types.c:2646:    /* object(* 0) matches any object */    if(!a->cdr || !b->cdr) break;       {    struct program *ap,*bp;    ap = id_to_program(CDR_TO_INT(a));    bp = id_to_program(CDR_TO_INT(b));       if(!ap || !bp) break;    +  implements_mode = 0;    if (!is_compatible(implements_a=ap,implements_b=bp))    return 0;    }    break;       case T_INT:    {    INT32 amin = CAR_TO_INT(a);    INT32 amax = CDR_TO_INT(a);   
pike.git/src/pike_types.c:3189:    */    {    struct program *ap = id_to_program(CDR_TO_INT(a));    struct program *bp = id_to_program(CDR_TO_INT(b));       if (!ap || !bp) {    /* Shouldn't happen... */    return 0;    }    if ((flags & LE_WEAK_OBJECTS) /* && (!a->car) */) { +  implements_mode = 0;    return is_compatible(implements_a=ap, implements_b=bp);    } -  +  implements_mode = 1;    return implements(implements_a=ap, implements_b=bp);    }    break;       case T_INT:    {    INT32 amin = CAR_TO_INT(a);    INT32 amax = CDR_TO_INT(a);       INT32 bmin = CAR_TO_INT(b);
pike.git/src/pike_types.c:4425:    }   }         void yyexplain_nonmatching_types(struct pike_type *type_a,    struct pike_type *type_b,    int flags)   {    implements_a=0;    implements_b=0; +  implements_mode=0;       match_types(type_a, type_b);      #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;
pike.git/src/pike_types.c:4449:    yywarning("Expected: %s",s1->str);    yywarning("Got : %s",s2->str);    }else{    my_yyerror("Expected: %s",s1->str);    my_yyerror("Got : %s",s2->str);    }    free_string(s1);    free_string(s2);    }    -  if(implements_a && implements_b) -  yyexplain_not_implements(implements_a,implements_b,flags); +  if(implements_a && implements_b) { +  if (implements_mode) { +  yyexplain_not_implements(implements_a, implements_b, flags); +  } else { +  yyexplain_not_compatible(implements_a, implements_b, flags);    } -  +  } + }         /******/      #ifdef DEBUG_MALLOC   #define low_make_pike_type(T,C) ((struct pike_type *)debug_malloc_pass(debug_low_make_pike_type(T,C)))   #define low_make_function_type(T,C) ((struct pike_type *)debug_malloc_pass(debug_low_make_function_type(T,C)))   #else /* !DEBUG_MALLOC */   #define low_make_pike_type debug_low_make_pike_type   #define low_make_function_type debug_low_make_function_type