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.519 2003/08/20 21:42:35 grubba Exp $ + || $Id: program.c,v 1.520 2003/08/21 15:56:36 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.519 2003/08/20 21:42:35 grubba Exp $"); + RCSID("$Id: program.c,v 1.520 2003/08/21 15:56:36 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:1010: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG   static void debug_add_to_identifiers (struct identifier id)   {    if (d_flag) {    int i;    for (i = 0; i < Pike_compiler->new_program->num_identifiers; i++)    if (Pike_compiler->new_program->identifiers[i].name == id.name) {    dump_program_tables (Pike_compiler->new_program, 0);    Pike_fatal ("Adding identifier twice, old at %d.\n", i);    } +  if (Pike_compiler->new_program->id == 65600) { +  fprintf(stderr, "Adding \"%s\"\n", +  id.name?id.name->str:"NULL");    } -  +  }    add_to_identifiers (id);   }   #else   #define debug_add_to_identifiers(ARG) add_to_identifiers(ARG)   #endif      void add_relocated_int_to_program(INT32 i)   {    add_to_relocations(Pike_compiler->new_program->num_program);    ins_int(i, (void (*)(char))add_to_program);
pike.git/src/program.c:3587:   {    struct program *p;    struct identifier *i;    INT32 numid=-1, offset=0;       if(!n)    {    yyerror("Unable to inherit");    return;    } +     switch(n->token)    {    case F_IDENTIFIER:    p=Pike_compiler->new_program;    offset=0;    numid=n->u.id.number;    goto continue_inherit;       case F_EXTERNAL:    {
pike.git/src/program.c:4038: Inside #if 0
   zero.u.integer = 0;    c = &zero;    }   #endif      #ifdef PIKE_DEBUG    if(name!=debug_findstring(name))    Pike_fatal("define_constant on nonshared string.\n");   #endif    +  n = isidentifier(name); +     do {    if(   #if 1    c &&   #endif    c->type == T_FUNCTION &&    c->subtype != FUNCTION_BUILTIN &&    c->u.object->prog)    {    struct reference *idref = PTR_FROM_INT(c->u.object->prog, c->subtype);    struct program *p = PROG_FROM_PTR(c->u.object->prog, idref);    struct identifier *id = p->identifiers + idref->identifier_offset;    if(c->u.object->prog == Pike_compiler->new_program) { -  +  /* Alias for a symbol in the current program. +  */    if(IDENTIFIER_IS_CONSTANT(id->identifier_flags) && -  id->func.offset != -1) -  { +  id->func.offset != -1) {    c=& p->constants[id->func.offset].sval;    } -  else if (IDENTIFIER_IS_FUNCTION(id->identifier_flags) && -  !idref->inherit_offset) -  { +  else if (IDENTIFIER_IS_FUNCTION(id->identifier_flags) { +  if (!idref->inherit_offset) { +  /* Alias for a function defined in this program. */ +  /* FIXME: Does this work for forward references? */    return define_function(name,    id->type,    flags,    id->identifier_flags | IDENTIFIER_ALIAS,    & id->func,    id->opt_flags); -  +  } else if (Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE) { +  /* Alias for a function defined in an inherited program. */ +  yyerror("Aliasing of inherited functions not supported yet."); +  return define_function(name, +  id->type, +  flags, +  id->identifier_flags | IDENTIFIER_ALIAS, +  NULL, +  id->opt_flags); +  } else { +  /* First pass. +  * Make a prototype for now. +  */ +  return define_function(name, +  id->type, +  flags, +  id->identifier_flags | IDENTIFIER_ALIAS, +  NULL, +  id->opt_flags);    } -  +  } else if (IDENTIFIER_IS_VARIABLE(id->identifier_flags)) { +  yyerror("Attempt to make a constant of a variable."); +  c = NULL;    }    } -  +  }       if(   #if 1    c &&   #endif    !svalues_are_constant(c,1,BIT_MIXED,0))    yyerror("Constant values may not have references to this.");       }while(0);    -  n = isidentifier(name); -  +     if(Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE)    {    if(n==-1   #if 1    || !c   #endif    )    {    yyerror("Pass2: Constant disappeared!");    }else{