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.35 1998/04/06 03:51:54 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.36 1998/04/27 10:00:26 hubbe Exp $");   #include "las.h"   #include "program.h"   #include "language.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 "memory.h"   #include "svalue.h"   #include "main.h"   #include "lex.h"   #include "builtin_functions.h"   #include "peep.h"   #include "docode.h"   #include "operators.h"   #include "object.h"    -  + static int do_docode2(node *n,int flags); +    INT32 current_break=-1;   INT32 current_continue=-1;      static INT32 current_switch_case;   static INT32 current_switch_default;   static INT32 current_switch_values_on_stack;   static INT32 *current_switch_jumptable =0;      void upd_int(int offset, INT32 tmp)   {    MEMCPY(new_program->program+offset, (char *)&tmp,sizeof(tmp));   }      INT32 read_int(int offset)   {    return EXTRACT_INT(new_program->program+offset);   }      int store_linenumbers=1; -  - /* -  * A mechanism to remember addresses on a stack. -  */ - int comp_stackp; - INT32 comp_stack[COMPILER_STACK_SIZE]; -  - void push_address(void) - { -  if (comp_stackp >= COMPILER_STACK_SIZE) -  { -  yyerror("Compiler stack overflow"); -  comp_stackp++; -  return; -  } -  comp_stack[comp_stackp++] = PC; - } -  - void push_explicit(INT32 address) - { -  if (comp_stackp >= COMPILER_STACK_SIZE) -  { -  yyerror("Compiler stack overflow"); -  comp_stackp++; -  return; -  } -  comp_stack[comp_stackp++] = address; - } -  - INT32 pop_address(void) - { -  if (comp_stackp == 0) -  fatal("Compiler stack underflow.\n"); -  if (comp_stackp > COMPILER_STACK_SIZE) -  { -  --comp_stackp; -  return 0; -  } -  return comp_stack[--comp_stackp]; - } -  -  +    static int label_no=0;      int alloc_label(void) { return ++label_no; }      int do_jump(int token,INT32 lbl)   {    if(lbl==-1) lbl=alloc_label();    emit(token, lbl);    return lbl;   }    - static int do_docode2(node *n,int flags); -  +    #define ins_label(L) do_jump(F_LABEL, L)      void do_pop(int x)   {    switch(x)    {    case 0: return;    case 1: emit2(F_POP_VALUE); break;    default: emit(F_POP_N_ELEMS,x); break;    }
pike.git/src/docode.c:118:    int i;    int save_current_line=lex.current_line;    if(!n) return 0;    lex.current_line=n->line_number;    i=do_docode2(n, flags);       lex.current_line=save_current_line;    return i;   }    -  +    static int is_efun(node *n, c_fun fun)   {    return n && n->token == F_CONSTANT &&    n->u.sval.subtype == FUNCTION_BUILTIN &&    n->u.sval.u.efun->function == fun;   }      static void code_expression(node *n, int flags, char *err)   {    switch(do_docode(n, flags & ~ DO_POP))