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.752 2008/09/03 14:46:13 mast Exp $ + || $Id: program.c,v 1.753 2008/09/04 11:36:45 grubba 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:1945:    p->flags |= PROGRAM_OPTIMIZED;    make_program_executable(p);   }      /* internal function to make the index-table */   static int program_identifier_index_compare(int a, int b,    const struct program *p)   {    size_t val_a = PTR_TO_INT (ID_FROM_INT(p, a)->name);    size_t val_b = PTR_TO_INT (ID_FROM_INT(p, b)->name); -  return val_a < val_b ? -1 : (val_a == val_b ? 0 : 1); +  return val_a < val_b ? -1 : (val_a == val_b ? (a < b? -1:(a != b)) : 1);   }      #define CMP(X,Y) program_identifier_index_compare(*(X), *(Y), prog)   #define EXTRA_ARGS , struct program *prog   #define XARGS , prog   #define ID fsort_program_identifier_index   #define TYPE unsigned short   #include "fsort_template.h"   #undef TYPE   #undef ID
pike.git/src/program.c:2230:    fun->name);    }    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);    +  /* Take care of duplicates in the identifier index table; +  * this can happen eg when the overloading definition is +  * before an inherit being overloaded. This happens for +  * eg the default master object. +  */ +  if (p->num_identifier_index) { +  struct identifier *id = ID_FROM_INT(p, p->identifier_index[0]); +  for (e = i = 1; e < p->num_identifier_index; e++) { +  struct identifier *probe = ID_FROM_INT(p, p->identifier_index[e]); +  if (probe == id) { +  /* Duplicate. */ +  continue; +  } +  p->identifier_index[i++] = p->identifier_index[e]; +  id = probe; +  } +  p->num_identifier_index = i; +  }       p->flags |= PROGRAM_FIXED;       /* Yes, it is supposed to start at 1 /Hubbe */    for(i=1;i<NUM_LFUNS;i++) {    int id = p->lfuns[i] = low_find_lfun(p, i);    }       /* Set the PROGRAM_LIVE_OBJ flag by looking for destroy() and    * inherited PROGRAM_LIVE_OBJ flags. This is done at fixation time
pike.git/src/program.c:3029: Inside #if defined(PIKE_DEBUG)
   indent, "", file->str, line);    free_string (file);    } else {    fprintf (stderr, "%*s Cfun: %p\n",    indent, "", id->func.c_fun);    }    }       fprintf(stderr, "\n"    "%*sIdentifier index table:\n" -  "%*s ####: Index\n", +  "%*s ####: Index\tName\n",    indent, "", indent, "");    for (d = 0; d < p->num_identifier_index; d++) { -  fprintf(stderr, "%*s %4d: %5d\n", +  struct identifier *id = ID_FROM_INT(p, p->identifier_index[d]); +  fprintf(stderr, "%*s %4d: %5d\t%s\n",    indent, "", -  d, p->identifier_index[d]); +  d, p->identifier_index[d], +  id->name->size_shift ? "(wide)" : id->name->str);    }       fprintf(stderr, "\n"    "%*sInherit table:\n"    "%*s ####: Level prog_id id_level storage_offs "    "par_id par_offs par_obj_id id_ref_offs\n",    indent, "", indent, "");    for (d=0; d < p->num_inherits; d++) {    struct inherit *inh = p->inherits + d;   
pike.git/src/program.c:5586:    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_PROTECTED; +  flags |= ID_PROTECTED /* | ID_PRIVATE | ID_INLINE | ID_USED */;    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