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.727 2008/06/28 21:50:10 mast Exp $ + || $Id: program.c,v 1.728 2008/06/29 12:37:10 nilsson Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:2204:    }    }    if(found_better!=-1)    continue;    }    if (IDENTIFIER_IS_PIKE_FUNCTION(fun->identifier_flags) &&    (fun->func.offset == -1) && (funp->id_flags & ID_INLINE)) {    my_yyerror("Missing definition for local function %S.",    fun->name);    } -  if (funp->id_flags & ID_STATIC) continue; +  if (funp->id_flags & ID_PROTECTED) continue;    add_to_identifier_index(i);    }    fsort_program_identifier_index(p->identifier_index,    p->identifier_index +    p->num_identifier_index - 1,    p);          p->flags |= PROGRAM_FIXED;   
pike.git/src/program.c:3454:    */       if(Pike_compiler->init_node)    {    Pike_compiler->compiler_frame->current_function_number = -2;    e=dooptcode(s,    mknode(F_COMMA_EXPR,    Pike_compiler->init_node,    mknode(F_RETURN,mkintnode(0),0)),    function_type_string, -  ID_STATIC); +  ID_PROTECTED);    Pike_compiler->init_node=0;    } else if (finish == 2) {    /* Called from decode_value(). */    e = low_find_lfun(Pike_compiler->new_program, LFUN___INIT);    }else{    e=-1;    }    Pike_compiler->new_program->lfuns[LFUN___INIT]=e;       pop_compiler_frame(); /* Pop __INIT local variables */
pike.git/src/program.c:5541:    id->func.gs_info.setter = -1;       getter_setter = &id->func.gs_info.getter + is_setter;    }    /* NOTE: The function needs to have the same PRIVATE/INLINE    * behaviour as the variable for overloading to behave    * as expected.    *    * FIXME: Force PRIVATE?    */ -  flags |= ID_STATIC; +  flags |= ID_PROTECTED;    free_type(symbol_type);    free_string(symbol);    }    }       if(IDENTIFIER_IS_C_FUNCTION(function_flags))    Pike_compiler->new_program->flags |= PROGRAM_HAS_C_METHODS;       if (Pike_compiler->compiler_pass == 1) {    /* Mark the type as tentative by setting the runtime-type
pike.git/src/program.c:5788: Inside #if 0
     int add_ext_ref(struct program_state *state, struct program *target, int i)   {    struct reference ref, *r;    int j;    if (state->new_program == target) return i;    i = add_ext_ref(state->previous, target, i);    for (r = state->new_program->identifier_references, j = 0;    j < state->new_program->num_identifier_references;    j++, r++) { -  if (((r->id_flags & (ID_PARENT_REF|ID_STATIC|ID_PRIVATE|ID_HIDDEN)) == -  ID_PARENT_REF|ID_STATIC|ID_PRIVATE|ID_HIDDEN) && +  if (((r->id_flags & (ID_PARENT_REF|ID_PROTECTED|ID_PRIVATE|ID_HIDDEN)) == +  ID_PARENT_REF|ID_PROTECTED|ID_PRIVATE|ID_HIDDEN) &&    (r->identifier_offset == i) &&    (!(r->inherit_offset))) {    return j;    }    } -  ref.id_flags = ID_PARENT_REF|ID_STATIC|ID_PRIVATE|ID_HIDDEN; +  ref.id_flags = ID_PARENT_REF|ID_PROTECTED|ID_PRIVATE|ID_HIDDEN;    ref.identifier_offset = i;    ref.inherit_offset = 0;    add_to_identifier_references(ref);    state->new_program->flags |= PROGRAM_USES_PARENT | PROGRAM_NEEDS_PARENT;    return j;   }      #endif /* 0 */      /* Identifier lookup
pike.git/src/program.c:5888:   #endif /* PIKE_DEBUG */       id = -1;    depth = 0;    last_inh = prog->num_inherits;    i = (int)prog->num_identifier_references;    while(i--)    {    funp = prog->identifier_references + i;    if(funp->id_flags & ID_HIDDEN) continue; -  if(funp->id_flags & ID_STATIC) +  if(funp->id_flags & ID_PROTECTED)    if(!(flags & SEE_STATIC))    continue;    fun = ID_FROM_PTR(prog, funp);    /* if(fun->func.offset == -1) continue; * Prototype */    if(!is_same_string(fun->name,name)) continue;    if(funp->id_flags & ID_INHERITED)    {    struct inherit *inh = INHERIT_FROM_PTR(prog, funp);    if ((funp->id_flags & ID_PRIVATE) && !(flags & SEE_PRIVATE)) continue;    if (!depth || (depth > inh->inherit_level)) {
pike.git/src/program.c:6147:    */      struct array *program_indices(struct program *p)   {    int e;    int n = 0;    struct array *res;    for (e = p->num_identifier_references; e--; ) {    struct identifier *id;    if (p->identifier_references[e].id_flags & -  (ID_HIDDEN|ID_STATIC|ID_PRIVATE)) { +  (ID_HIDDEN|ID_PROTECTED|ID_PRIVATE)) {    continue;    }    id = ID_FROM_INT(p, e);    if (IDENTIFIER_IS_ALIAS(id->identifier_flags)) {    /* FIXME!    */    continue;    } else if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    if (id->func.offset >= 0) {    struct program *p2 = PROG_FROM_INT(p, e);
pike.git/src/program.c:6186:   }      struct array *program_values(struct program *p)   {    int e;    int n = 0;    struct array *res;    for(e = p->num_identifier_references; e--; ) {    struct identifier *id;    if (p->identifier_references[e].id_flags & -  (ID_HIDDEN|ID_STATIC|ID_PRIVATE)) { +  (ID_HIDDEN|ID_PROTECTED|ID_PRIVATE)) {    continue;    }    id = ID_FROM_INT(p, e);    if (IDENTIFIER_IS_ALIAS(id->identifier_flags)) {    /* FIXME!    */    continue;    } else if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    if (id->func.offset >= 0) {    struct program *p2 = PROG_FROM_INT(p, e);
pike.git/src/program.c:9095:    ADD_FUNCTION("compile", f_compilation_compile,    tFunc(tNone, tPrg(tObj)), 0);       ADD_FUNCTION("resolv", f_compilation_resolv,    tFunc(tStr tStr tObj, tMix), 0);       ADD_FUNCTION("create", f_compilation_create,    tFunc(tOr(tStr, tVoid) tOr(tObj, tVoid)    tOr(tInt, tVoid) tOr(tInt, tVoid)    tOr(tPrg(tObj), tVoid) tOr(tObj, tVoid), tVoid), -  ID_STATIC); +  ID_PROTECTED);       ADD_FUNCTION("get_compilation_handler",    f_compilation_get_compilation_handler,    tFunc(tInt tInt, tObj), 0);       ADD_FUNCTION("get_default_module", f_compilation_get_default_module,    tFunc(tNone, tOr(tMap(tStr, tMix), tObj)), 0);       ADD_FUNCTION("change_compiler_compatibility",    f_compilation_change_compiler_compatibility,
pike.git/src/program.c:9126:       ADD_FUNCTION("apply_type_attribute", f_compilation_apply_type_attribute,    tFunc(tStr tType(tMix) tOr(tType(tMix), tVoid), tInt01), 0);       ADD_FUNCTION("apply_attribute_constant",    f_compilation_apply_attribute_constant,    tFunc(tStr tMix tType(tMix) tType(tFunction),    tType(tFunction)), 0);       ADD_FUNCTION("_sprintf", f_compilation__sprintf, -  tFunc(tInt tOr(tMap(tStr, tMix), tVoid), tStr), ID_STATIC); +  tFunc(tInt tOr(tMap(tStr, tMix), tVoid), tStr), ID_PROTECTED);       start_new_program();       ADD_STORAGE(struct program_state);    Pike_compiler->new_program->event_handler = program_state_event_handler;    Pike_compiler->new_program->flags |=    PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT|PROGRAM_HAS_C_METHODS;       /* Alias for report above. */    low_define_alias(NULL, NULL, 0, 1, PC_REPORT_FUN_NUM);
pike.git/src/program.c:10336:      /* returns 1 if a implements b */   static int low_implements(struct program *a, struct program *b)   {    int e;    struct pike_string *s=findstring("__INIT");    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)) +  if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN))    continue; /* Skip protected & 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 0    fprintf(stderr, "Missing identifier \"%s\"\n", bid->name->str);   #endif /* 0 */
pike.git/src/program.c:10417:    if (a->num_identifier_references < b->num_identifier_references) {    struct program *tmp = a;    a = b;    b = tmp;    }       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)) +  if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN))    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 */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    continue; /* It's ok... */    }
pike.git/src/program.c:10539:    }    SET_CYCLIC_RET(1);       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_STATIC|ID_HIDDEN)) +  if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN))    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 */    i = find_shared_string_identifier(bid->name,a);    if (i == -1) {    continue; /* It's ok... */    }
pike.git/src/program.c:10601:    }    SET_CYCLIC_RET(1);       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_STATIC|ID_HIDDEN)) +  if (b->identifier_references[e].id_flags & (ID_PROTECTED|ID_HIDDEN))    continue; /* Skip protected & 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) {    INT32 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, i, &bid_line);