pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: docode.c,v 1.75 2000/07/07 01:28:57 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.76 2000/07/12 12:38:40 grubba Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"   #include "pike_memory.h"
pike.git/src/docode.c:292:    switch(n->token)    {    case F_MAGIC_INDEX:    case F_MAGIC_SET_INDEX:    emit2(n->token,    n->u.node.b->u.sval.u.integer,    n->u.node.a->u.sval.u.integer);    return 1;       case F_EXTERNAL: +  { +  int level = 0; +  struct program_state *state = Pike_compiler->previous; +  while (state && (state->new_program->id != n->u.integer.a)) { +  state = state->previous; +  level++; +  } +  if (!state) { +  my_yyerror("Program parent %d lost during compiling.", n->u.integer.a); +  emit1(F_NUMBER,0); +  return 1; +  }    if(flags & WANT_LVALUE)    { -  emit2(F_EXTERNAL_LVALUE, n->u.integer.b,n->u.integer.a); +  emit2(F_EXTERNAL_LVALUE, n->u.integer.b, level);    return 2;    }else{ -  emit2(F_EXTERNAL, n->u.integer.b,n->u.integer.a); +  emit2(F_EXTERNAL, n->u.integer.b, level);    return 1;    } -  +  }    break;       case F_UNDEFINED:    yyerror("Undefined identifier");    emit1(F_NUMBER,0);    return 1;       case F_PUSH_ARRAY:    code_expression(CAR(n), 0, "`@");    emit0(F_PUSH_ARRAY);
pike.git/src/docode.c:1221:    return 1;    }       if(n->u.sval.u.object->next == n->u.sval.u.object)    {    int x=0;    struct object *o;       for(o=Pike_compiler->fake_object->parent;o!=n->u.sval.u.object;o=o->parent)    x++; -  emit2(F_EXTERNAL, n->u.sval.subtype,x); +  emit2(F_EXTERNAL, n->u.sval.subtype, x);    Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT;    return 1;    }    }      #ifdef PIKE_DEBUG    case T_OBJECT:    if(n->u.sval.u.object->next == n->u.sval.u.object)    fatal("Internal error: Pointer to parent cannot be a compile time constant!\n");   #endif