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.79 2000/08/16 10:49:19 grubba Exp $"); + RCSID("$Id: docode.c,v 1.80 2000/08/24 04:04:40 hubbe 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:295:    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; +  struct program_state *state = Pike_compiler;    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(level) +  {    if(flags & WANT_LVALUE)    {    emit2(F_EXTERNAL_LVALUE, n->u.integer.b, level);    return 2;    }else{    emit2(F_EXTERNAL, n->u.integer.b, level);    return 1;    } -  +  }else{ +  if(flags & WANT_LVALUE) +  { +  emit1(F_GLOBAL_LVALUE, n->u.integer.b); +  return 2; +  }else{ +  if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(state->new_program,n->u.integer.b)->identifier_flags)) +  { +  emit1(F_LFUN, n->u.integer.b); +  }else{ +  emit1(F_GLOBAL, n->u.integer.b);    } -  +  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:501:    find_local_frame(CDR(n)->u.integer.b)->max_number_of_locals)    yyerror("Illegal to use local variable here.");       if(CDR(n)->u.integer.b) goto normal_assign;       code_expression(CAR(n), 0, "RHS");    emit1(flags & DO_POP ? F_ASSIGN_LOCAL_AND_POP:F_ASSIGN_LOCAL,    CDR(n)->u.integer.a );    break;    +  /* FIXME: Make special case for F_EXTERNAL */    case F_IDENTIFIER:    if(!IDENTIFIER_IS_VARIABLE( ID_FROM_INT(Pike_compiler->new_program, CDR(n)->u.id.number)->identifier_flags))    {    yyerror("Cannot assign functions or constants.\n");    }else{    code_expression(CAR(n), 0, "RHS");    emit1(flags & DO_POP ? F_ASSIGN_GLOBAL_AND_POP:F_ASSIGN_GLOBAL,    CDR(n)->u.id.number);    }    break;
pike.git/src/docode.c:824:    emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1));       return 1;    }    else if(CAR(n)->token == F_IDENTIFIER &&    IDENTIFIER_IS_FUNCTION(ID_FROM_INT(Pike_compiler->new_program,    CAR(n)->u.id.number)->identifier_flags))    {    return do_lfun_call(CAR(n)->u.id.number,CDR(n));    } +  else if(CAR(n)->token == F_EXTERNAL && +  CAR(n)->u.integer.a == Pike_compiler->new_program->id && +  IDENTIFIER_IS_FUNCTION(ID_FROM_INT(Pike_compiler->new_program, +  CAR(n)->u.integer.b)->identifier_flags)) +  { +  return do_lfun_call(CAR(n)->u.integer.b,CDR(n)); +  }    else    {    struct pike_string *tmp;    struct efun *fun;    node *foo;       emit0(F_MARK);    do_docode(CAR(n),0);    do_docode(CDR(n),0);   
pike.git/src/docode.c:1235:    {    emit1(F_LFUN,n->u.sval.subtype);    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) +  for(o=Pike_compiler->fake_object;o!=n->u.sval.u.object;o=o->parent)    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)