pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:7473:   #endif    return 1;    }    return 0;   }      int program_index_no_free(struct svalue *to, struct svalue *what,    struct svalue *ind)   {    int e; -  struct pike_string *s; +     struct object *parent = NULL;    struct svalue *sub = NULL;    struct program *p;    struct identifier *id;    int parent_identifier = -1;       if (TYPEOF(*what) == T_PROGRAM) {    p = what->u.program;    } else if ((TYPEOF(*what) == T_FUNCTION) &&    (SUBTYPEOF(*what) != FUNCTION_BUILTIN) &&
pike.git/src/program.c:7500:    p = sub->u.program;    parent_identifier = SUBTYPEOF(*what);    } else {    /* Not a program. */    return 0;    }    if (TYPEOF(*ind) != T_STRING) {    Pike_error("Can't index a program with a %s (expected string)\n",    get_name_of_type(TYPEOF(*ind)));    } -  s = ind->u.string; -  e=find_shared_string_identifier(s, p); +  e=find_shared_string_identifier(ind->u.string, p);    if(e!=-1)    {    if (low_program_index_no_free(to, p, e, parent, parent_identifier))    return 1;    }       SET_SVAL(*to, T_INT, NUMBER_UNDEFINED, integer, 0);    return 1;   }   
pike.git/src/program.c:11887:         /**    * @return Returns 1 if a implements b.    */   static int low_implements(struct program *a, struct program *b)   {    DECLARE_CYCLIC();    int e;    int ret = 1; -  struct pike_string *s=findstring("__INIT"); +        if (BEGIN_CYCLIC(a, b)) {    END_CYCLIC();    return 1; /* Tentatively ok, */    }    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_PROTECTED|ID_HIDDEN|ID_VARIANT))    continue; /* Skip protected & hidden */    bid = ID_FROM_INT(b,e); -  if(s == bid->name) continue; /* Skip __INIT */ +  if(lfun_strings[LFUN___INIT] == 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 0    fprintf(stderr, "Missing identifier \"%s\"\n", bid->name->str);   #endif /* 0 */    ret = 0;    break;    }
pike.git/src/program.c:11977:   }      /**    * @return Returns 1 if a is compatible with b.    */   static int low_is_compatible(struct program *a, struct program *b)   {    DECLARE_CYCLIC();    int e;    int ret = 1; -  struct pike_string *s=findstring("__INIT"); +        if (BEGIN_CYCLIC(a, b)) {    END_CYCLIC();    return 1;    }    SET_CYCLIC_RET(1);       /* Optimize the loop somewhat */    if (a->num_identifier_references < b->num_identifier_references) {    struct program *tmp = a;
pike.git/src/program.c:12002:    for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid;    int i;    if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN|ID_VARIANT))    continue; /* Skip protected & hidden */       /* FIXME: What if they aren't protected & hidden in a? */       bid = ID_FROM_INT(b,e); -  if(s == bid->name) continue; /* Skip __INIT */ +  if(lfun_strings[LFUN___INIT] == bid->name) continue; /* Skip __INIT */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    continue; /* It's ok... */    }       /* Note: Uses weaker check for constant integers. */    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 0
pike.git/src/program.c:12087:    return is_compatible_cache[hval].ret;   }      /**    * Explains why a is not compatible with b.    */   void yyexplain_not_compatible(int severity_level,    struct program *a, struct program *b)   {    int e; -  struct pike_string *s=findstring("__INIT"); +     int res = 1;    INT_TYPE a_line = 0;    INT_TYPE b_line = 0;    struct pike_string *a_file;    struct pike_string *b_file;    DECLARE_CYCLIC();       /* Optimize the loop somewhat */    if (a->num_identifier_references < b->num_identifier_references) {    struct program *tmp = a;
pike.git/src/program.c:12121:    for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid;    int i;    if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN|ID_VARIANT))    continue; /* Skip protected & hidden */       /* FIXME: What if they aren't protected & hidden in a? */       bid = ID_FROM_INT(b,e); -  if(s == bid->name) continue; /* Skip __INIT */ +  if(lfun_strings[LFUN___INIT] == bid->name) continue; /* Skip __INIT */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    continue; /* It's ok... */    }       /* Note: Uses weaker check for constant integers. */    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)) {    INT_TYPE aid_line = a_line;
pike.git/src/program.c:12159:    return;   }      /**    * Explains why a does not implement b.    */   void yyexplain_not_implements(int severity_level,    struct program *a, struct program *b)   {    int e; -  struct pike_string *s=findstring("__INIT"); +     INT_TYPE a_line = 0;    INT_TYPE b_line = 0;    struct pike_string *a_file;    struct pike_string *b_file;    DECLARE_CYCLIC();       if (BEGIN_CYCLIC(a, b)) {    END_CYCLIC();    return;    }
pike.git/src/program.c:12182:    a_file = get_program_line(a, &a_line);    b_file = get_program_line(b, &b_line);       for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid;    int i;    if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN|ID_VARIANT))    continue; /* Skip protected & hidden */    bid = ID_FROM_INT(b,e); -  if(s == bid->name) continue; /* Skip __INIT */ +  if(lfun_strings[LFUN___INIT] == bid->name) continue; /* Skip __INIT */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    INT_TYPE bid_line = b_line;    struct pike_string *bid_file;    if (b->identifier_references[e].id_flags & (ID_OPTIONAL))    continue; /* It's ok... */    bid_file = get_identifier_line(b, e, &bid_line);    if (!bid_file) bid_file = b_file;    yytype_report(severity_level,    bid_file, bid_line, bid->type,
pike.git/src/program.c:12235:      /* FIXME: Code duplication of yyexplain_not_compatible() above! */   /**    * Explains why a is not compatible with b.    */   void string_builder_explain_not_compatible(struct string_builder *s,    struct program *a,    struct program *b)   {    int e; -  struct pike_string *init_string = 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;    }   
pike.git/src/program.c:12262:    for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid;    int i;    if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN|ID_VARIANT))    continue; /* Skip protected & hidden */       /* FIXME: What if they aren't protected & hidden in a? */       bid = ID_FROM_INT(b,e); -  if(init_string == bid->name) continue; /* Skip __INIT */ +  if(lfun_strings[LFUN___INIT] == bid->name) continue; /* Skip __INIT */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    continue; /* It's ok... */    }       /* Note: Uses weaker check for constant integers. */    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)) {    ref_push_program(a);
pike.git/src/program.c:12301:      /* FIXME: code duplication of yyexplain_not_implements() above! */   /**    * Explains why a does not implement b.    */   void string_builder_explain_not_implements(struct string_builder *s,    struct program *a,    struct program *b)   {    int e; -  struct pike_string *init_string = 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_PROTECTED|ID_HIDDEN|ID_VARIANT))    continue; /* Skip protected & hidden */    bid = ID_FROM_INT(b,e); -  if(init_string == bid->name) continue; /* Skip __INIT */ +  if(lfun_strings[LFUN___INIT] == 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... */    ref_push_type_value(bid->type);    string_builder_sprintf(s,    "Missing identifier %O %S.\n",    Pike_sp-1, bid->name);    pop_stack();    continue;