pike.git / src / program.c

version» Context lines:

pike.git/src/program.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: program.c,v 1.555 2004/03/02 11:51:14 grubba Exp $ + || $Id: program.c,v 1.556 2004/03/10 18:08:12 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.555 2004/03/02 11:51:14 grubba Exp $"); + RCSID("$Id: program.c,v 1.556 2004/03/10 18:08:12 grubba Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "language.h"   #include "lex.h"   #include "pike_macros.h"   #include "fsort.h"
pike.git/src/program.c:7739:    is_compatible_cache[hval].aid=aid;    is_compatible_cache[hval].bid=bid;    is_compatible_cache[hval].ret = 1; /* Tentatively compatible. */    is_compatible_cache[hval].ret = low_is_compatible(a,b);    /* NOTE: If low_is compatible() returns 0, the cache may have received    * some false positives. Those should be cleared.    */    return is_compatible_cache[hval].ret;   }    - /* Returns 1 if a is compatible with b */ - int yyexplain_not_compatible(struct program *a, struct program *b, int flags) + /* Explains why a is not compatible with b */ + void yyexplain_not_compatible(struct program *a, struct program *b, int flags)   {    int e;    struct pike_string *s=findstring("__INIT");    int res = 1; -  +  DECLARE_CYCLIC();       /* Optimize the loop somewhat */    if (a->num_identifier_references < b->num_identifier_references) {    struct program *tmp = a;    a = b;    b = tmp;    }    -  +  if (BEGIN_CYCLIC(a, b)) { +  END_CYCLIC(); +  return; +  } +  SET_CYCLIC_RET(1); +     for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid;    int i;    if (b->identifier_references[e].id_flags & (ID_STATIC|ID_HIDDEN))    continue; /* Skip static & hidden */       /* FIXME: What if they aren't static & hidden in a? */       bid = ID_FROM_INT(b,e);
pike.git/src/program.c:7780:    if(((bid->run_time_type != PIKE_T_INT) ||    (ID_FROM_INT(a, i)->run_time_type != PIKE_T_INT)) &&    !match_types(ID_FROM_INT(a,i)->type, bid->type)) {    if (flags & YYTE_IS_WARNING)    yywarning("Identifier \"%s\" is incompatible.",    bid->name->str);    else    my_yyerror("Identifier \"%s\" is incompatible.",    bid->name->str);    yytype_error(NULL, ID_FROM_INT(a,i)->type, bid->type, flags); -  res = 0; +     }    } -  return res; +  END_CYCLIC(); +  return;   }    - /* returns 1 if a implements b */ - int yyexplain_not_implements(struct program *a, struct program *b, int flags) + /* Explains why a does not implement b */ + void yyexplain_not_implements(struct program *a, struct program *b, int flags)   {    int e;    struct pike_string *s=findstring("__INIT"); -  +  DECLARE_CYCLIC(); +  +  if (BEGIN_CYCLIC(a, b)) { +  END_CYCLIC(); +  return; +  } +  SET_CYCLIC_RET(1); +     for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid;    int i;    if (b->identifier_references[e].id_flags & (ID_STATIC|ID_HIDDEN))    continue; /* Skip static & hidden */    bid = ID_FROM_INT(b,e);    if(s == bid->name) continue; /* Skip __INIT */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    if (b->identifier_references[e].id_flags & (ID_OPTIONAL))    continue; /* It's ok... */    if(flags & YYTE_IS_WARNING)    yywarning("Missing identifier \"%s\".", bid->name->str);    else    my_yyerror("Missing identifier \"%s\".", bid->name->str); -  return 0; +  continue;    }       if (!pike_types_le(bid->type, ID_FROM_INT(a, i)->type)) {    if(!match_types(ID_FROM_INT(a,i)->type, bid->type)) {    my_yyerror("Type of identifier \"%s\" does not match.",    bid->name->str);    yytype_error(NULL, ID_FROM_INT(a,i)->type, bid->type, 0);    } else {    yywarning("Type of identifier \"%s\" is not strictly compatible.",    bid->name->str);    yytype_error(NULL, ID_FROM_INT(a,i)->type, bid->type, YYTE_IS_WARNING);    } -  return 0; +  continue;    }    } -  return 1; +  END_CYCLIC();   }      PMOD_EXPORT void *parent_storage(int depth)   {    struct external_variable_context loc;    struct program *p;          loc.o=Pike_fp->current_object;    p=loc.o->prog;