diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index db47be1e007d704a844785806b7d5ae27c41e4e3..1f007174c418e11986a7777555745fade3a6b8b3 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.282 2000/06/20 03:26:16 hubbe Exp $");
+RCSID("$Id: builtin_functions.c,v 1.283 2000/06/24 00:48:12 hubbe Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -1456,7 +1456,7 @@ node *fix_this_object_type(node *n)
 {
   free_string(n->type);
   type_stack_mark();
-  push_type_int(new_program->id);
+  push_type_int(Pike_compiler->new_program->id);
   /*  push_type(1);   We are rather sure that we contain ourselves... */
   push_type(0);		/* But it did not work yet, so... */
   push_type(T_OBJECT);
diff --git a/src/compilation.h b/src/compilation.h
index 65d2b280e3cfd35fab068fa8544ff4adab83b35a..9a67a34fb63261d02ae983434512affbf969fb2a 100644
--- a/src/compilation.h
+++ b/src/compilation.h
@@ -1,5 +1,5 @@
 /*
- * $Id: compilation.h,v 1.14 1999/12/29 21:11:38 mast Exp $
+ * $Id: compilation.h,v 1.15 2000/06/24 00:48:13 hubbe Exp $
  *
  * Compilator state push / pop operator construction file
  *
@@ -28,65 +28,82 @@
 #endif
 
 #ifdef STRUCT
-#define IMEMBER(X,Y) X Y ;
-#define DMEMBER(X,Y) X Y ;
-#define STACKMEMBER(X,Y) X Y ;
-#define IMEMBER2(X,Y,Z) X Y Z ;
-#define ZMEMBER(X,Y) X Y ;
-#define ZMEMBER2(X,Y,Z) X Y Z ;
+#define IMEMBER(X,Y,Z) X Y ;
+#define DMEMBER(X,Y,Z) X Y ;
+#define STACKMEMBER(X,Y,Z) X Y ;
+#define IMEMBER2(X,Y,Z,Q) X Y Z ;
+#define ZMEMBER(X,Y,Z) X Y ;
+#define ZMEMBER2(X,Y,Z,Q) X Y Z ;
 #define SNAME(X,Y) struct X { struct X *previous;
 #define SEND };
 #endif
 
-#ifdef DECLARE
-#define IMEMBER(X,Y)
-#define DMEMBER(X,Y)
-#define STACKMEMBER(X,Y)
-#define IMEMBER2(X,Y,Z)
-#define ZMEMBER(X,Y)
-#define ZMEMBER2(X,Y,Z)
-#define SNAME(X,Y) static struct X * Y = 0;
+#ifdef EXTERN
+#define IMEMBER(X,Y,Z)
+#define DMEMBER(X,Y,Z)
+#define STACKMEMBER(X,Y,z)
+#define IMEMBER2(X,Y,Z,Q)
+#define ZMEMBER(X,Y,Z)
+#define ZMEMBER2(X,Y,Z,Q)
+#define SNAME(X,Y) extern struct X * Y;
 #define SEND
 #endif
 
+#ifdef DECLARE
+#define IMEMBER(X,Y,Z) Z,
+#define DMEMBER(X,Y,Z) Z,
+#define STACKMEMBER(X,Y,Z) Z,
+#define IMEMBER2(X,Y,Z,Q) Q,
+#define ZMEMBER(X,Y,Z) Z,
+#define ZMEMBER2(X,Y,Z,Q) Q,
+#define SNAME(X,Y) \
+  extern struct X PIKE_CONCAT(Y,_base); \
+  struct X * Y = & PIKE_CONCAT(Y,_base); \
+  struct X PIKE_CONCAT(Y,_base) = { 0, 
+#define SEND };
+#endif
+
 #ifdef PUSH
-#define IMEMBER(X,Y) MEMCPY((char *)&(oLd->Y), (char *)&(Y), sizeof(Y));
-#define DMEMBER(X,Y) IMEMBER(X,Y)
-#define STACKMEMBER(X,Y) (oLd->Y=Y);
-#define IMEMBER2(X,Y,Z) IMEMBER(X,Y)
-#define ZMEMBER(X,Y) MEMCPY((char *)&(oLd->Y), (char *)&(Y), sizeof(Y)); \
-                     MEMSET((char *)&(Y), 0, sizeof(Y));
-#define ZMEMBER2(X,Y,Z) ZMEMBER(X,Y)
+#define IMEMBER(X,Y,Z) MEMCPY((char *)&(nEw->Y), (char *)&(Pike_compiler->Y), sizeof(nEw->Y));
+#define DMEMBER(X,Y,Z) IMEMBER(X,Y)
+#define STACKMEMBER(X,Y,Z) (nEw->Y=Pike_compiler->Y);
+#define IMEMBER2(X,Y,Z,Q) IMEMBER(X,Y)
+#define ZMEMBER(X,Y,Z) MEMSET((char *)&(nEw->Y), 0, sizeof(nEw->Y));
+#define ZMEMBER2(X,Y,Z,Q) ZMEMBER(X,Y)
 #define SNAME(X,Y) { \
-      struct X *oLd; \
-      oLd=ALLOC_STRUCT(X); \
-      oLd->previous=Y; Y=oLd;
-#define SEND }
+      struct X *nEw; \
+      nEw=ALLOC_STRUCT(X); \
+      nEw->previous=Pike_compiler;
+#define SEND \
+      Pike_compiler=nEw; \
+      }
 
 #endif
 
 
 #ifdef POP
-#define IMEMBER(X,Y) MEMCPY((char *)&(Y), (char *)&(oLd->Y), sizeof(Y));
-#define IMEMBER2(X,Y,Z) IMEMBER(X,Y)
-#define ZMEMBER(X,Y) MEMCPY((char *)&(Y), (char *)&(oLd->Y), sizeof(Y));
-#define ZMEMBER2(X,Y,Z) ZMEMBER(X,Y)
+#define IMEMBER(X,Y,Z) 
+#define IMEMBER2(X,Y,Z,Q) IMEMBER(X,Y)
+#define ZMEMBER(X,Y,Z) 
+#define ZMEMBER2(X,Y,Z,Q) ZMEMBER(X,Y)
 
-#define DMEMBER(X,Y) DO_DEBUG_CODE( \
-    if(MEMCMP((char *)&(Y), (char *)&(oLd->Y), sizeof(Y))) \
+#define DMEMBER(X,Y,Z) DO_DEBUG_CODE( \
+    if(MEMCMP((char *)&(Pike_compiler->Y), (char *)&(oLd->Y), sizeof(oLd->Y))) \
       fatal("Variable " #Y " became whacked during compilation.\n"); ) \
   IMEMBER(X,Y)
 
-#define STACKMEMBER(X,Y) DO_DEBUG_CODE( \
-    if(Y < oLd->Y) \
-      fatal("Stack " #Y " shrunk %d steps compilation, currently: %p.\n",oLd->Y - Y,Y); ) \
-  Y=oLd->Y;
+#define STACKMEMBER(X,Y,Z) DO_DEBUG_CODE( \
+    if(Pike_compiler->Y < oLd->Y) \
+      fatal("Stack " #Y " shrunk %d steps compilation, currently: %p.\n",oLd->Y - Pike_compiler->Y,Pike_compiler->Y); )
 
 #define SNAME(X,Y) { \
-      struct X *oLd; \
-      oLd=Y; Y=oLd->previous;
-#define SEND free((char *)oLd); \
+      struct X *oLd=Pike_compiler->previous;
+
+#define SEND \
+     free((char *)Pike_compiler); \
+     Pike_compiler=oLd; \
     }
+
 #define PCODE(X) X
 #else
 #define PCODE(X)
@@ -94,31 +111,31 @@
 
 
 #ifdef PIKE_DEBUG
-#define STRMEMBER(X,Y) \
-  PCODE(if(X) fatal("Variable %s not deallocated properly.\n",Y);) \
-  ZMEMBER(struct pike_string *,X)
+#define STRMEMBER(X,Y,Z) \
+  PCODE(if(Pike_compiler->X) fatal("Variable %s not deallocated properly.\n",Y);) \
+  ZMEMBER(struct pike_string *,X,Z)
 #else
-#define STRMEMBER(X,Y) \
-  ZMEMBER(struct pike_string *,X)
+#define STRMEMBER(X,Y,Z) \
+  ZMEMBER(struct pike_string *,X,Z)
 #endif
 
-  SNAME(program_state,previous_program_state)
-  ZMEMBER(INT32,last_line)
-  STRMEMBER(last_file,"last_file")
-  ZMEMBER(struct object *,fake_object)
-  ZMEMBER(struct program *,new_program)
-  ZMEMBER(struct program *,malloc_size_program)
-  ZMEMBER(node *,init_node)
-  ZMEMBER(INT32,last_pc)
-  ZMEMBER(int,num_parse_error)
-  ZMEMBER(struct compiler_frame *,compiler_frame)
-  ZMEMBER(INT32,num_used_modules)
-  IMEMBER(int,compiler_pass)
-  ZMEMBER(int,local_class_counter)
-  ZMEMBER(int,catch_level)
-  ZMEMBER(struct mapping *,module_index_cache)
-  STACKMEMBER(unsigned char *,type_stackp)
-  STACKMEMBER(unsigned char **,pike_type_mark_stackp)
+  SNAME(program_state,Pike_compiler)
+  ZMEMBER(INT32,last_line,0)
+  STRMEMBER(last_file,"last_file",0)
+  ZMEMBER(struct object *,fake_object,0)
+  ZMEMBER(struct program *,new_program,0)
+  ZMEMBER(struct program *,malloc_size_program,0)
+  ZMEMBER(node *,init_node,0)
+  ZMEMBER(INT32,last_pc,0)
+  ZMEMBER(int,num_parse_error,0)
+  ZMEMBER(struct compiler_frame *,compiler_frame,0)
+  ZMEMBER(INT32,num_used_modules,0)
+  IMEMBER(int,compiler_pass,0)
+  ZMEMBER(int,local_class_counter,0)
+  ZMEMBER(int,catch_level,0)
+  ZMEMBER(struct mapping *,module_index_cache,0)
+  STACKMEMBER(unsigned char *,type_stackp,type_stack)
+  STACKMEMBER(unsigned char **,pike_type_mark_stackp,pike_type_mark_stack)
   SEND
 
 #undef PCODE
@@ -132,6 +149,7 @@
 #undef SEND
 #undef STACKMEMBER
 
+#undef EXTERN
 #undef STRUCT
 #undef PUSH
 #undef POP
diff --git a/src/docode.c b/src/docode.c
index d6c47d7714c8715fa74989635937a6c73dadfe03..9556d1c46ddf14bea9b2972f0ee021e039debb64 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: docode.c,v 1.73 2000/05/11 14:09:45 grubba Exp $");
+RCSID("$Id: docode.c,v 1.74 2000/06/24 00:48:13 hubbe Exp $");
 #include "las.h"
 #include "program.h"
 #include "pike_types.h"
@@ -40,12 +40,12 @@ static struct pike_string *current_switch_type = NULL;
 
 void upd_int(int offset, INT32 tmp)
 {
-  MEMCPY(new_program->program+offset, (char *)&tmp,sizeof(tmp));
+  MEMCPY(Pike_compiler->new_program->program+offset, (char *)&tmp,sizeof(tmp));
 }
 
 INT32 read_int(int offset)
 {
-  return EXTRACT_INT(new_program->program+offset);
+  return EXTRACT_INT(Pike_compiler->new_program->program+offset);
 }
 
 int store_linenumbers=1;
@@ -196,7 +196,7 @@ static INT32 count_cases(node *n)
 
 static inline struct compiler_frame *find_local_frame(INT32 depth)
 {
-  struct compiler_frame *f=compiler_frame;
+  struct compiler_frame *f=Pike_compiler->compiler_frame;
   while(--depth>=0) f=f->previous;
   return f;
 }
@@ -204,24 +204,24 @@ static inline struct compiler_frame *find_local_frame(INT32 depth)
 int do_lfun_call(int id,node *args)
 {
 #if 1
-  if(id == compiler_frame->current_function_number)
+  if(id == Pike_compiler->compiler_frame->current_function_number)
   {
     int n=count_args(args);
-    if(n == compiler_frame->num_args)
+    if(n == Pike_compiler->compiler_frame->num_args)
     {
-      if(compiler_frame->is_inline)
+      if(Pike_compiler->compiler_frame->is_inline)
       {
 	emit0(F_MARK);
 	do_docode(args,0);
-	compiler_frame->recur_label=do_jump(F_RECUR,
-					    compiler_frame->recur_label);
+	Pike_compiler->compiler_frame->recur_label=do_jump(F_RECUR,
+					    Pike_compiler->compiler_frame->recur_label);
 	return 1;
       }else{
 	emit0(F_MARK);
 	do_docode(args,0);
 	emit1(F_COND_RECUR,id);
-	compiler_frame->recur_label=do_jump(F_POINTER,
-					    compiler_frame->recur_label);
+	Pike_compiler->compiler_frame->recur_label=do_jump(F_POINTER,
+					    Pike_compiler->compiler_frame->recur_label);
 	return 1;
       }
     }
@@ -494,7 +494,7 @@ static int do_docode2(node *n,int flags)
 	break;
 
       case F_IDENTIFIER:
-	if(!IDENTIFIER_IS_VARIABLE( ID_FROM_INT(new_program, CDR(n)->u.id.number)->identifier_flags))
+	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{
@@ -796,7 +796,7 @@ static int do_docode2(node *n,int flags)
 
 	  return 1;
 	}else{
-	  if(CAR(n)->u.sval.u.object == fake_object)
+	  if(CAR(n)->u.sval.u.object == Pike_compiler->fake_object)
 	    return do_lfun_call(CAR(n)->u.sval.subtype,CDR(n));
        	}
       }
@@ -811,7 +811,7 @@ static int do_docode2(node *n,int flags)
       return 1;
     }
     else if(CAR(n)->token == F_IDENTIFIER &&
-	    IDENTIFIER_IS_FUNCTION(ID_FROM_INT(new_program,
+	    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));
@@ -920,7 +920,7 @@ static int do_docode2(node *n,int flags)
     f_aggregate(cases);
     order=get_switch_order(sp[-1].u.array);
 
-    if (!num_parse_error) {
+    if (!Pike_compiler->num_parse_error) {
       /* Check for cases inside a range */
       for(e=0; e<cases-1; e++)
       {
@@ -999,7 +999,7 @@ static int do_docode2(node *n,int flags)
 	}
       }
 
-      if (!num_parse_error) {
+      if (!Pike_compiler->num_parse_error) {
 	tmp1=eval_low(lower);
 	if(tmp1<1)
 	{
@@ -1033,7 +1033,7 @@ static int do_docode2(node *n,int flags)
 	    current_switch_jumptable[current_switch_case-1];
 	  current_switch_case++;
 
-	  if (!num_parse_error) {
+	  if (!Pike_compiler->num_parse_error) {
 	    tmp1=eval_low(CDR(n));
 	    if(tmp1<1)
 	    {
@@ -1215,7 +1215,7 @@ static int do_docode2(node *n,int flags)
     case T_FUNCTION:
       if(n->u.sval.subtype!=FUNCTION_BUILTIN)
       {
-	if(n->u.sval.u.object == fake_object)
+	if(n->u.sval.u.object == Pike_compiler->fake_object)
 	{
 	  emit1(F_LFUN,n->u.sval.subtype);
 	  return 1;
@@ -1226,10 +1226,10 @@ static int do_docode2(node *n,int flags)
 	  int x=0;
 	  struct object *o;
 	  
-	  for(o=fake_object->parent;o!=n->u.sval.u.object;o=o->parent)
+	  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);
-	  new_program->flags |= PROGRAM_USES_PARENT;
+	  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT;
 	  return 1;
 	}
       }
@@ -1293,7 +1293,7 @@ static int do_docode2(node *n,int flags)
       return 1;
 
   case F_IDENTIFIER:
-    if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(new_program, n->u.id.number)->identifier_flags))
+    if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(Pike_compiler->new_program, n->u.id.number)->identifier_flags))
     {
       if(flags & WANT_LVALUE)
       {
@@ -1326,21 +1326,21 @@ void do_code_block(node *n)
   init_bytecode();
   label_no=1;
 
-  emit1(F_BYTE,compiler_frame->max_number_of_locals);
-  emit1(F_BYTE,compiler_frame->num_args);
+  emit1(F_BYTE,Pike_compiler->compiler_frame->max_number_of_locals);
+  emit1(F_BYTE,Pike_compiler->compiler_frame->num_args);
   emit0(F_START_FUNCTION);
   emit1(F_LABEL,0);
-  if(new_program->identifier_references[compiler_frame->
+  if(Pike_compiler->new_program->identifier_references[Pike_compiler->compiler_frame->
 				       current_function_number].id_flags &
      ID_INLINE)
   {
-    compiler_frame->recur_label=0;
-    compiler_frame->is_inline=1;
+    Pike_compiler->compiler_frame->recur_label=0;
+    Pike_compiler->compiler_frame->is_inline=1;
   }
 
   DO_CODE_BLOCK(n);
 
-  if(compiler_frame->recur_label > 0)
+  if(Pike_compiler->compiler_frame->recur_label > 0)
   {
 #ifdef PIKE_DEBUG
     if(l_flag)
@@ -1349,14 +1349,14 @@ void do_code_block(node *n)
     }
 #endif
     /* generate code again, but this time it is inline */
-    compiler_frame->is_inline=1;
+    Pike_compiler->compiler_frame->is_inline=1;
 
     /* This is a no-op, but prevents optimizer to delete the bytes below */
     emit1(F_LABEL,-1);
-    emit1(F_BYTE,compiler_frame->max_number_of_locals);
-    emit1(F_BYTE,compiler_frame->num_args);
+    emit1(F_BYTE,Pike_compiler->compiler_frame->max_number_of_locals);
+    emit1(F_BYTE,Pike_compiler->compiler_frame->num_args);
     emit0(F_START_FUNCTION);
-    emit1(F_LABEL,compiler_frame->recur_label);
+    emit1(F_LABEL,Pike_compiler->compiler_frame->recur_label);
     DO_CODE_BLOCK(n);
   }
   assemble();
diff --git a/src/encode.c b/src/encode.c
index e2cfe05de63a91a3bf919d6aad58215e55112c6d..c85e6fae0ae2e193891430bde9183265db6b1510 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -25,7 +25,7 @@
 #include "version.h"
 #include "bignum.h"
 
-RCSID("$Id: encode.c,v 1.59 2000/06/10 11:52:43 mast Exp $");
+RCSID("$Id: encode.c,v 1.60 2000/06/24 00:48:13 hubbe Exp $");
 
 /* #define ENCODE_DEBUG */
 
@@ -854,28 +854,28 @@ static void restore_type_stack(unsigned char *old_stackp)
 {
 #if 0
   fprintf(stderr, "Restoring type-stack: %p => %p\n",
-	  type_stackp, old_stackp);
+	  Pike_compiler->type_stackp, old_stackp);
 #endif /* 0 */
 #ifdef PIKE_DEBUG
-  if (old_stackp > type_stackp) {
+  if (old_stackp > Pike_compiler->type_stackp) {
     fatal("type stack out of sync!\n");
   }
 #endif /* PIKE_DEBUG */
-  type_stackp = old_stackp;
+  Pike_compiler->type_stackp = old_stackp;
 }
 
 static void restore_type_mark(unsigned char **old_type_mark_stackp)
 {
 #if 0
   fprintf(stderr, "Restoring type-mark: %p => %p\n",
-	  pike_type_mark_stackp, old_type_mark_stackp);
+	  Pike_compiler->pike_type_mark_stackp, old_type_mark_stackp);
 #endif /* 0 */
 #ifdef PIKE_DEBUG
-  if (old_type_mark_stackp > pike_type_mark_stackp) {
+  if (old_type_mark_stackp > Pike_compiler->pike_type_mark_stackp) {
     fatal("type mark_stack out of sync!\n");
   }
 #endif /* PIKE_DEBUG */
-  pike_type_mark_stackp = old_type_mark_stackp;
+  Pike_compiler->pike_type_mark_stackp = old_type_mark_stackp;
 }
 
 static void low_decode_type(struct decode_data *data)
@@ -886,8 +886,8 @@ static void low_decode_type(struct decode_data *data)
   ONERROR err1;
   ONERROR err2;
 
-  SET_ONERROR(err1, restore_type_stack, type_stackp);
-  SET_ONERROR(err2, restore_type_mark, pike_type_mark_stackp);
+  SET_ONERROR(err1, restore_type_stack, Pike_compiler->type_stackp);
+  SET_ONERROR(err2, restore_type_mark, Pike_compiler->pike_type_mark_stackp);
 
 one_more_type:
   tmp = GETC();
@@ -1475,8 +1475,8 @@ static void decode_value2(struct decode_data *data)
 
 	  debug_malloc_touch(dat);
 
-	  SET_ONERROR(err1, restore_type_stack, type_stackp);
-	  SET_ONERROR(err2, restore_type_mark, pike_type_mark_stackp);
+	  SET_ONERROR(err1, restore_type_stack, Pike_compiler->type_stackp);
+	  SET_ONERROR(err2, restore_type_mark, Pike_compiler->pike_type_mark_stackp);
 
 	  for(d=0;d<p->num_identifiers;d++)
 	  {
@@ -1509,12 +1509,12 @@ static void decode_value2(struct decode_data *data)
 	  debug_malloc_touch(dat);
 
 	  {
-	    struct program *new_program_save=new_program;
-	    new_program=p;
+	    struct program *new_program_save=Pike_compiler->new_program;
+	    Pike_compiler->new_program=p;
 	    fsort((void *)p->identifier_index,
 		  p->num_identifier_index,
 		  sizeof(unsigned short),(fsortfun)program_function_index_compare);
-	    new_program=new_program_save;
+	    Pike_compiler->new_program=new_program_save;
 	  }
 	  p->flags &=~ PROGRAM_AVOID_CHECK;
 	  p->flags |= PROGRAM_FINISHED;
diff --git a/src/language.yacc b/src/language.yacc
index ab9ca298d764fc7189ae24288db987c118410ca2..9a270918251666d72e7f80eaf9ca924e655666f5 100644
--- a/src/language.yacc
+++ b/src/language.yacc
@@ -109,7 +109,7 @@
 /* This is the grammar definition of Pike. */
 
 #include "global.h"
-RCSID("$Id: language.yacc,v 1.190 2000/06/22 17:31:39 grubba Exp $");
+RCSID("$Id: language.yacc,v 1.191 2000/06/24 00:48:13 hubbe Exp $");
 #ifdef HAVE_MEMORY_H
 #include <memory.h>
 #endif
@@ -402,10 +402,10 @@ program_ref: low_program_ref
       
 inheritance: modifiers TOK_INHERIT low_program_ref optional_rename_inherit ';'
   {
-    if (($1 & ID_EXTERN) && (compiler_pass == 1)) {
+    if (($1 & ID_EXTERN) && (Pike_compiler->compiler_pass == 1)) {
       yywarning("Extern declared inherit.");
     }
-    if(!(new_program->flags & PROGRAM_PASS_1_DONE))
+    if(!(Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE))
     {
       struct pike_string *s=sp[-1].u.string;
       if($4) s=$4->u.sval.u.string;
@@ -474,22 +474,22 @@ constant_name: TOK_IDENTIFIER '=' safe_expr0
     /* This can be made more lenient in the future */
 
     /* Ugly hack to make sure that $3 is optimized */
-    tmp=compiler_pass;
+    tmp=Pike_compiler->compiler_pass;
     $3=mknode(F_COMMA_EXPR,$3,0);
-    compiler_pass=tmp;
+    Pike_compiler->compiler_pass=tmp;
 
-    if ((current_modifiers & ID_EXTERN) && (compiler_pass == 1)) {
+    if ((current_modifiers & ID_EXTERN) && (Pike_compiler->compiler_pass == 1)) {
       yywarning("Extern declared constant.");
     }
 
     if(!is_const($3))
     {
-      if(compiler_pass==2)
+      if(Pike_compiler->compiler_pass==2)
 	yyerror("Constant definition is not constant.");
       else
 	add_constant($1->u.sval.u.string, 0, current_modifiers & ~ID_EXTERN);
     } else {
-      if(!num_parse_error)
+      if(!Pike_compiler->num_parse_error)
       {
 	tmp=eval_low($3);
 	if(tmp < 1)
@@ -539,9 +539,9 @@ type_or_error: simple_type
 #ifdef PIKE_DEBUG
     check_type_string(check_node_hash($1)->u.sval.u.string);
 #endif /* PIKE_DEBUG */
-    if(compiler_frame->current_type)
-      free_string(compiler_frame->current_type); 
-    copy_shared_string(compiler_frame->current_type,$1->u.sval.u.string);
+    if(Pike_compiler->compiler_frame->current_type)
+      free_string(Pike_compiler->compiler_frame->current_type); 
+    copy_shared_string(Pike_compiler->compiler_frame->current_type,$1->u.sval.u.string);
     free_node($1);
   }
   ;
@@ -577,15 +577,15 @@ push_compiler_frame0: /* empty */
   {
     push_compiler_frame(SCOPE_LOCAL);
 
-    if(!compiler_frame->previous ||
-       !compiler_frame->previous->current_type)
+    if(!Pike_compiler->compiler_frame->previous ||
+       !Pike_compiler->compiler_frame->previous->current_type)
     {
       yyerror("Internal compiler fault.");
-      copy_shared_string(compiler_frame->current_type,
+      copy_shared_string(Pike_compiler->compiler_frame->current_type,
 			 mixed_type_string);
     }else{
-      copy_shared_string(compiler_frame->current_type,
-			 compiler_frame->previous->current_type);
+      copy_shared_string(Pike_compiler->compiler_frame->current_type,
+			 Pike_compiler->compiler_frame->previous->current_type);
     }
   }
   ;
@@ -595,22 +595,22 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
   {
     int e;
     /* construct the function type */
-    push_finished_type(compiler_frame->current_type);
-    if ($3 && (compiler_pass == 2)) {
+    push_finished_type(Pike_compiler->compiler_frame->current_type);
+    if ($3 && (Pike_compiler->compiler_pass == 2)) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     while(--$3>=0) push_type(T_ARRAY);
     
-    if(compiler_frame->current_return_type)
-      free_string(compiler_frame->current_return_type);
-    compiler_frame->current_return_type=compiler_pop_type();
+    if(Pike_compiler->compiler_frame->current_return_type)
+      free_string(Pike_compiler->compiler_frame->current_return_type);
+    Pike_compiler->compiler_frame->current_return_type=compiler_pop_type();
     
-    push_finished_type(compiler_frame->current_return_type);
+    push_finished_type(Pike_compiler->compiler_frame->current_return_type);
     
     e=$7-1;
     if(varargs)
     {
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
       e--;
       varargs=0;
       pop_type_stack();
@@ -620,7 +620,7 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
     push_type(T_MANY);
     for(; e>=0; e--)
     {
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
     }
     push_type(T_FUNCTION);
 
@@ -630,12 +630,12 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
       free_string(s);
     }
 
-/*    if(compiler_pass==1) */
+/*    if(Pike_compiler->compiler_pass==1) */
     {
       /* FIXME:
        * set current_function_number for local functions as well
        */
-      compiler_frame->current_function_number=
+      Pike_compiler->compiler_frame->current_function_number=
 	define_function(check_node_hash($4)->u.sval.u.string,
 			check_node_hash($<n>$)->u.sval.u.string,
 			$1 & (~ID_EXTERN),
@@ -657,21 +657,21 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
 #endif /* PIKE_DEBUG */
       lex.current_line = $8->line_number;
 
-      if (($1 & ID_EXTERN) && (compiler_pass == 1)) {
+      if (($1 & ID_EXTERN) && (Pike_compiler->compiler_pass == 1)) {
 	yywarning("Extern declared function definition.");
       }
 
       for(e=0; e<$7; e++)
       {
-	if(!compiler_frame->variable[e].name ||
-	   !compiler_frame->variable[e].name->len)
+	if(!Pike_compiler->compiler_frame->variable[e].name ||
+	   !Pike_compiler->compiler_frame->variable[e].name->len)
 	{
 	  my_yyerror("Missing name for argument %d.",e);
 	} else {
 	  /* FIXME: Should probably use some other flag. */
 	  if ((runtime_options & RUNTIME_CHECK_TYPES) &&
-	      (compiler_pass == 2) &&
-	      (compiler_frame->variable[e].type != mixed_type_string)) {
+	      (Pike_compiler->compiler_pass == 2) &&
+	      (Pike_compiler->compiler_frame->variable[e].type != mixed_type_string)) {
 	    node *local_node;
 
 	    /* fprintf(stderr, "Creating soft cast node for local #%d\n", e);*/
@@ -686,7 +686,7 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
 
 	    check_args =
 	      mknode(F_COMMA_EXPR, check_args,
-		     mksoftcastnode(compiler_frame->variable[e].type,
+		     mksoftcastnode(Pike_compiler->compiler_frame->variable[e].type,
 				    local_node));
 	  }
 	}
@@ -710,8 +710,8 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
       if(recoveries && sp-evaluator_stack < recoveries->sp)
 	fatal("Stack error (underflow)\n");
 
-      if(compiler_pass == 1 && f!=compiler_frame->current_function_number)
-	fatal("define_function screwed up! %d != %d\n",f,compiler_frame->current_function_number);
+      if(Pike_compiler->compiler_pass == 1 && f!=Pike_compiler->compiler_frame->current_function_number)
+	fatal("define_function screwed up! %d != %d\n",f,Pike_compiler->compiler_frame->current_function_number);
 #endif
     }
     pop_compiler_frame();
@@ -748,7 +748,7 @@ def: modifiers type_or_error optional_stars TOK_IDENTIFIER push_compiler_frame0
   {
     reset_type_stack();
     yyerrok;
-/*     if(num_parse_error>5) YYACCEPT; */
+/*     if(Pike_compiler->num_parse_error>5) YYACCEPT; */
   }
   | error '}'
   {
@@ -935,7 +935,7 @@ type6: type | identifier_type ;
   
 type: type '*'
   {
-    if (compiler_pass == 2) {
+    if (Pike_compiler->compiler_pass == 2) {
        yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     push_type(T_ARRAY);
@@ -945,7 +945,7 @@ type: type '*'
 
 type7: type7 '*'
   {
-    if (compiler_pass == 2) {
+    if (Pike_compiler->compiler_pass == 2) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     push_type(T_ARRAY);
@@ -1024,7 +1024,7 @@ identifier_type: idents
 	  break;
       
       default:
-	if (compiler_pass!=1)
+	if (Pike_compiler->compiler_pass!=1)
 	  yyerror("Illegal program identifier.");
 	pop_stack();
 	push_int(0);
@@ -1144,7 +1144,7 @@ opt_object_type:  /* Empty */ { push_type_int(0); push_type(0); }
     {
       push_type_int(p->id);
     }else{
-      if (compiler_pass!=1) {
+      if (Pike_compiler->compiler_pass!=1) {
 	if ((sp[-2].type == T_STRING) && (sp[-2].u.string->len > 0) &&
 	    (sp[-2].u.string->len < 256)) {
 	  my_yyerror("Not a valid program specifier: '%s'",
@@ -1176,7 +1176,7 @@ opt_function_type: '('
 	/* function_type_list ends with a comma, or is empty.
 	 * FIXME: Should this be a syntax error or not?
 	 */
-	if (compiler_pass == 1) {
+	if (Pike_compiler->compiler_pass == 1) {
 	  yyerror("Missing type before ... .");
 	}
 	type_stack_reverse();
@@ -1258,8 +1258,8 @@ name_list: new_name
 new_name: optional_stars TOK_IDENTIFIER
   {
     struct pike_string *type;
-    push_finished_type(compiler_frame->current_type);
-    if ($1 && (compiler_pass == 2)) {
+    push_finished_type(Pike_compiler->compiler_frame->current_type);
+    if ($1 && (Pike_compiler->compiler_pass == 2)) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     while($1--) push_type(T_ARRAY);
@@ -1272,13 +1272,13 @@ new_name: optional_stars TOK_IDENTIFIER
   | optional_stars TOK_IDENTIFIER '='
   {
     struct pike_string *type;
-    push_finished_type(compiler_frame->current_type);
-    if ($1 && (compiler_pass == 2)) {
+    push_finished_type(Pike_compiler->compiler_frame->current_type);
+    if ($1 && (Pike_compiler->compiler_pass == 2)) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     while($1--) push_type(T_ARRAY);
     type=compiler_pop_type();
-    if ((current_modifiers & ID_EXTERN) && (compiler_pass == 1)) {
+    if ((current_modifiers & ID_EXTERN) && (Pike_compiler->compiler_pass == 1)) {
       yywarning("Extern declared variable has initializer.");
     }
     $<number>$=define_variable($2->u.sval.u.string, type,
@@ -1287,7 +1287,7 @@ new_name: optional_stars TOK_IDENTIFIER
   }
   expr0
   {
-    init_node=mknode(F_COMMA_EXPR,init_node,
+    Pike_compiler->init_node=mknode(F_COMMA_EXPR,Pike_compiler->init_node,
 		     mkcastnode(void_type_string,
 				mknode(F_ASSIGN,$5,
 				       mkidentifiernode($<number>4))));
@@ -1312,7 +1312,7 @@ new_name: optional_stars TOK_IDENTIFIER
 new_local_name: optional_stars TOK_IDENTIFIER
   {    
     push_finished_type($<n>0->u.sval.u.string);
-    if ($1 && (compiler_pass == 2)) {
+    if ($1 && (Pike_compiler->compiler_pass == 2)) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     while($1--) push_type(T_ARRAY);
@@ -1324,7 +1324,7 @@ new_local_name: optional_stars TOK_IDENTIFIER
   | optional_stars TOK_IDENTIFIER '=' expr0 
   {
     push_finished_type($<n>0->u.sval.u.string);
-    if ($1 && (compiler_pass == 2)) {
+    if ($1 && (Pike_compiler->compiler_pass == 2)) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     while($1--) push_type(T_ARRAY);
@@ -1372,12 +1372,12 @@ new_local_name2: TOK_IDENTIFIER
 
 block:'{'
   {
-    $<number>1=num_used_modules;
-    $<number>$=compiler_frame->current_number_of_locals;
+    $<number>1=Pike_compiler->num_used_modules;
+    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;
   } 
   statements end_block
   {
-    unuse_modules(num_used_modules - $<number>1);
+    unuse_modules(Pike_compiler->num_used_modules - $<number>1);
     pop_local_variables($<number>2);
     $$=$3;
   }
@@ -1463,10 +1463,10 @@ push_compiler_frame1: /* empty */
 
 lambda: TOK_LAMBDA push_compiler_frame1
   {
-    debug_malloc_touch(compiler_frame->current_return_type);
-    if(compiler_frame->current_return_type)
-      free_string(compiler_frame->current_return_type);
-    copy_shared_string(compiler_frame->current_return_type,any_type_string);
+    debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);
+    if(Pike_compiler->compiler_frame->current_return_type)
+      free_string(Pike_compiler->compiler_frame->current_return_type);
+    copy_shared_string(Pike_compiler->compiler_frame->current_return_type,any_type_string);
   }
   func_args failsafe_block
   {
@@ -1488,7 +1488,7 @@ lambda: TOK_LAMBDA push_compiler_frame1
     e=$4-1;
     if(varargs)
     {
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
       e--;
       varargs=0;
       pop_type_stack();
@@ -1497,20 +1497,20 @@ lambda: TOK_LAMBDA push_compiler_frame1
     }
     push_type(T_MANY);
     for(; e>=0; e--)
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
     
     push_type(T_FUNCTION);
     
     type=compiler_pop_type();
 
     sprintf(buf,"__lambda_%ld_%ld",
-	    (long)new_program->id,
-	    (long)(local_class_counter++ & 0xffffffff)); /* OSF/1 cc bug. */
+	    (long)Pike_compiler->new_program->id,
+	    (long)(Pike_compiler->local_class_counter++ & 0xffffffff)); /* OSF/1 cc bug. */
     name=make_shared_string(buf);
 
 #ifdef LAMBDA_DEBUG
     fprintf(stderr, "%d: LAMBDA: %s 0x%08lx 0x%08lx\n",
-	    compiler_pass, buf, (long)new_program->id, local_class_counter-1);
+	    Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1);
 #endif /* LAMBDA_DEBUG */
     
     f=dooptcode(name,
@@ -1518,7 +1518,7 @@ lambda: TOK_LAMBDA push_compiler_frame1
 		type,
 		ID_STATIC | ID_PRIVATE | ID_INLINE);
 
-    if(compiler_frame->lexical_scope & SCOPE_SCOPED) {
+    if(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPED) {
       $$ = mktrampolinenode(f);
     } else {
       $$ = mkidentifiernode(f);
@@ -1541,20 +1541,20 @@ local_function: TOK_IDENTIFIER push_compiler_frame1 func_args
     node *n;
     struct identifier *i=0;
 
-    debug_malloc_touch(compiler_frame->current_return_type);
-    if(compiler_frame->current_return_type)
-      free_string(compiler_frame->current_return_type);
-    copy_shared_string(compiler_frame->current_return_type,
+    debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);
+    if(Pike_compiler->compiler_frame->current_return_type)
+      free_string(Pike_compiler->compiler_frame->current_return_type);
+    copy_shared_string(Pike_compiler->compiler_frame->current_return_type,
 		       $<n>0->u.sval.u.string);
 
 
     /***/
-    push_finished_type(compiler_frame->current_return_type);
+    push_finished_type(Pike_compiler->compiler_frame->current_return_type);
     
     e=$3-1;
     if(varargs)
     {
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
       e--;
       varargs=0;
       pop_type_stack();
@@ -1563,7 +1563,7 @@ local_function: TOK_IDENTIFIER push_compiler_frame1 func_args
     }
     push_type(T_MANY);
     for(; e>=0; e--)
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
     
     push_type(T_FUNCTION);
     
@@ -1571,12 +1571,12 @@ local_function: TOK_IDENTIFIER push_compiler_frame1 func_args
     /***/
 
     sprintf(buf,"__lambda_%ld_%ld",
-	    (long)new_program->id,
-	    (long)(local_class_counter++ & 0xffffffff)); /* OSF/1 cc bug. */
+	    (long)Pike_compiler->new_program->id,
+	    (long)(Pike_compiler->local_class_counter++ & 0xffffffff)); /* OSF/1 cc bug. */
 
 #ifdef LAMBDA_DEBUG
     fprintf(stderr, "%d: LAMBDA: %s 0x%08lx 0x%08lx\n",
-	    compiler_pass, buf, (long)new_program->id, local_class_counter-1);
+	    Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1);
 #endif /* LAMBDA_DEBUG */
 
     name=make_shared_string(buf);
@@ -1588,13 +1588,13 @@ local_function: TOK_IDENTIFIER push_compiler_frame1 func_args
 		       0);
     n=0;
 #if 0
-    if(compiler_pass > 1 &&
-       (i=ID_FROM_INT(new_program, id)))
+    if(Pike_compiler->compiler_pass > 1 &&
+       (i=ID_FROM_INT(Pike_compiler->new_program, id)))
       if(!(i->identifier_flags & IDENTIFIER_SCOPED))
 	n = mkidentifiernode(id);
 #endif
 
-    low_add_local_name(compiler_frame->previous,
+    low_add_local_name(Pike_compiler->compiler_frame->previous,
 		       $1->u.sval.u.string, type, n);
 
     $<number>$=id;
@@ -1603,7 +1603,7 @@ local_function: TOK_IDENTIFIER push_compiler_frame1 func_args
   failsafe_block
   {
     int localid;
-    struct identifier *i=ID_FROM_INT(new_program, $<number>4);
+    struct identifier *i=ID_FROM_INT(Pike_compiler->new_program, $<number>4);
 
     $5=mknode(F_COMMA_EXPR,$5,mknode(F_RETURN,mkintnode(0),0));
 
@@ -1621,12 +1621,12 @@ local_function: TOK_IDENTIFIER push_compiler_frame1 func_args
      *           this has to be fixed.
      */
 
-    localid=compiler_frame->current_number_of_locals-1;
-    if(compiler_frame->variable[localid].def)
+    localid=Pike_compiler->compiler_frame->current_number_of_locals-1;
+    if(Pike_compiler->compiler_frame->variable[localid].def)
     {
-      $$=copy_node(compiler_frame->variable[localid].def);
+      $$=copy_node(Pike_compiler->compiler_frame->variable[localid].def);
     }else{
-      if(compiler_frame->lexical_scope & SCOPE_SCOPE_USED)
+      if(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED)
       {
 	$$ = mknode(F_ASSIGN, mktrampolinenode($<number>3),
 		    mklocalnode(localid,0));
@@ -1652,25 +1652,25 @@ local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args
     struct identifier *i=0;
 
     /***/
-    debug_malloc_touch(compiler_frame->current_return_type);
+    debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);
     
     push_finished_type($<n>0->u.sval.u.string);
-    if ($1 && (compiler_pass == 2)) {
+    if ($1 && (Pike_compiler->compiler_pass == 2)) {
       yywarning("The *-syntax in types is obsolete. Use array instead.");
     }
     while($1--) push_type(T_ARRAY);
 
-    if(compiler_frame->current_return_type)
-      free_string(compiler_frame->current_return_type);
-    compiler_frame->current_return_type=compiler_pop_type();
+    if(Pike_compiler->compiler_frame->current_return_type)
+      free_string(Pike_compiler->compiler_frame->current_return_type);
+    Pike_compiler->compiler_frame->current_return_type=compiler_pop_type();
 
     /***/
-    push_finished_type(compiler_frame->current_return_type);
+    push_finished_type(Pike_compiler->compiler_frame->current_return_type);
     
     e=$4-1;
     if(varargs)
     {
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
       e--;
       varargs=0;
       pop_type_stack();
@@ -1679,7 +1679,7 @@ local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args
     }
     push_type(T_MANY);
     for(; e>=0; e--)
-      push_finished_type(compiler_frame->variable[e].type);
+      push_finished_type(Pike_compiler->compiler_frame->variable[e].type);
     
     push_type(T_FUNCTION);
     
@@ -1688,12 +1688,12 @@ local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args
 
 
     sprintf(buf,"__lambda_%ld_%ld",
-	    (long)new_program->id,
-	    (long)(local_class_counter++ & 0xffffffff)); /* OSF/1 cc bug. */
+	    (long)Pike_compiler->new_program->id,
+	    (long)(Pike_compiler->local_class_counter++ & 0xffffffff)); /* OSF/1 cc bug. */
 
 #ifdef LAMBDA_DEBUG
     fprintf(stderr, "%d: LAMBDA: %s 0x%08lx 0x%08lx\n",
-	    compiler_pass, buf, (long)new_program->id, local_class_counter-1);
+	    Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1);
 #endif /* LAMBDA_DEBUG */
 
     name=make_shared_string(buf);
@@ -1706,13 +1706,13 @@ local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args
 		       0);
     n=0;
 #if 0
-    if(compiler_pass > 1 &&
-       (i=ID_FROM_INT(new_program, id)))
+    if(Pike_compiler->compiler_pass > 1 &&
+       (i=ID_FROM_INT(Pike_compiler->new_program, id)))
       if(!(i->identifier_flags & IDENTIFIER_SCOPED))
 	n = mkidentifiernode(id);
 #endif
 
-    low_add_local_name(compiler_frame->previous,
+    low_add_local_name(Pike_compiler->compiler_frame->previous,
 		       $2->u.sval.u.string, type, n);
     $<number>$=id;
     free_string(name);
@@ -1720,7 +1720,7 @@ local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args
   failsafe_block
   {
     int localid;
-    struct identifier *i=ID_FROM_INT(new_program, $<number>5);
+    struct identifier *i=ID_FROM_INT(Pike_compiler->new_program, $<number>5);
 
     debug_malloc_touch($6);
     $6=mknode(F_COMMA_EXPR,$6,mknode(F_RETURN,mkintnode(0),0));
@@ -1740,12 +1740,12 @@ local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args
      *           this has to be fixed.
      */
 
-    localid=compiler_frame->current_number_of_locals-1;
-    if(compiler_frame->variable[localid].def)
+    localid=Pike_compiler->compiler_frame->current_number_of_locals-1;
+    if(Pike_compiler->compiler_frame->variable[localid].def)
     {
-      $$=copy_node(compiler_frame->variable[localid].def);
+      $$=copy_node(Pike_compiler->compiler_frame->variable[localid].def);
     }else{
-      if(compiler_frame->lexical_scope & SCOPE_SCOPE_USED)
+      if(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED)
       {
         $$ = mknode(F_ASSIGN, mktrampolinenode($<number>5),
 	  mklocalnode(localid,0));
@@ -1775,20 +1775,20 @@ failsafe_program: '{' program end_block
 class: modifiers TOK_CLASS optional_identifier
   {
     extern int num_parse_error;
-    int num_errors=num_parse_error;
+    int num_errors=Pike_compiler->num_parse_error;
     if(!$3)
     {
       struct pike_string *s;
       char buffer[42];
-      sprintf(buffer,"__class_%ld_%ld",(long)new_program->id,
-	      local_class_counter++);
+      sprintf(buffer,"__class_%ld_%ld",(long)Pike_compiler->new_program->id,
+	      Pike_compiler->local_class_counter++);
       s=make_shared_string(buffer);
       $3=mkstrnode(s);
       free_string(s);
       $1|=ID_STATIC | ID_PRIVATE | ID_INLINE;
     }
     /* fprintf(stderr, "LANGUAGE.YACC: CLASS start\n"); */
-    if(compiler_pass==1)
+    if(Pike_compiler->compiler_pass==1)
     {
       if ($1 & ID_EXTERN) {
 	yywarning("Extern declared class definition.");
@@ -1799,27 +1799,27 @@ class: modifiers TOK_CLASS optional_identifier
       if(lex.current_file)
       {
 	store_linenumber(lex.current_line, lex.current_file);
-	debug_malloc_name(new_program, lex.current_file->str,
+	debug_malloc_name(Pike_compiler->new_program, lex.current_file->str,
 			  lex.current_line);
       }
     }else{
       int i;
       struct program *p;
       struct identifier *id;
-      int tmp=compiler_pass;
+      int tmp=Pike_compiler->compiler_pass;
       i=isidentifier($3->u.sval.u.string);
       if(i<0)
       {
-	low_start_new_program(new_program,0,
+	low_start_new_program(Pike_compiler->new_program,0,
 			      $1,
 			      &$<number>$);
 	yyerror("Pass 2: program not defined!");
       }else{
-	id=ID_FROM_INT(new_program, i);
+	id=ID_FROM_INT(Pike_compiler->new_program, i);
 	if(IDENTIFIER_IS_CONSTANT(id->identifier_flags))
 	{
 	  struct svalue *s;
-	  s=&PROG_FROM_INT(new_program,i)->constants[id->func.offset].sval;
+	  s=&PROG_FROM_INT(Pike_compiler->new_program,i)->constants[id->func.offset].sval;
 	  if(s->type==T_PROGRAM)
 	  {
 	    low_start_new_program(s->u.program,
@@ -1828,25 +1828,25 @@ class: modifiers TOK_CLASS optional_identifier
 				  &$<number>$);
 	  }else{
 	    yyerror("Pass 2: constant redefined!");
-	    low_start_new_program(new_program, 0,
+	    low_start_new_program(Pike_compiler->new_program, 0,
 				  $1,
 				  &$<number>$);
 	  }
 	}else{
 	  yyerror("Pass 2: class constant no longer constant!");
-	  low_start_new_program(new_program, 0,
+	  low_start_new_program(Pike_compiler->new_program, 0,
 				$1,
 				&$<number>$);
 	}
       }
-      compiler_pass=tmp;
+      Pike_compiler->compiler_pass=tmp;
     }
-    num_parse_error=num_errors; /* Kluge to prevent gazillion error messages */
+    Pike_compiler->num_parse_error=num_errors; /* Kluge to prevent gazillion error messages */
   }
   failsafe_program
   {
     struct program *p;
-    if(compiler_pass == 1)
+    if(Pike_compiler->compiler_pass == 1)
       p=end_first_pass(0);
     else
       p=end_first_pass(1);
@@ -1868,7 +1868,7 @@ class: modifiers TOK_CLASS optional_identifier
 
 cond: TOK_IF
   {
-    $<number>$=compiler_frame->current_number_of_locals;
+    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;
   }
   '(' safe_comma_expr end_cond statement optional_else_part
   {
@@ -1904,7 +1904,7 @@ safe_expr0: expr0
 
 foreach: TOK_FOREACH
   {
-    $<number>$=compiler_frame->current_number_of_locals;
+    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;
   }
   '(' expr0 ',' safe_lvalue end_cond statement
   {
@@ -1949,7 +1949,7 @@ expected_semicolon: ';'
 
 for: TOK_FOR
   {
-    $<number>$=compiler_frame->current_number_of_locals;
+    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;
   }
   '(' unused expected_semicolon for_expr expected_semicolon unused end_cond
   statement
@@ -1966,7 +1966,7 @@ for: TOK_FOR
 
 while:  TOK_WHILE
   {
-    $<number>$=compiler_frame->current_number_of_locals;
+    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;
   }
   '(' safe_comma_expr end_cond statement
   {
@@ -1984,7 +1984,7 @@ for_expr: /* EMPTY */ { $$=mkintnode(1); }
 
 switch:	TOK_SWITCH
   {
-    $<number>$=compiler_frame->current_number_of_locals;
+    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;
   }
   '(' safe_comma_expr end_cond statement
   {
@@ -2026,7 +2026,7 @@ expected_colon: ':'
 
 return: TOK_RETURN
   {
-    if(!match_types(compiler_frame->current_return_type,
+    if(!match_types(Pike_compiler->compiler_frame->current_return_type,
 		    void_type_string))
     {
       yyerror("Must return a value for a non-void function.");
@@ -2275,20 +2275,20 @@ idents2: idents
     copy_shared_string(last_identifier, $3->u.sval.u.string);
 
     if (((i = find_shared_string_identifier(last_identifier,
-					    new_program)) >= 0) ||
+					    Pike_compiler->new_program)) >= 0) ||
 	((i = really_low_find_shared_string_identifier(last_identifier,
-						       new_program,
+						       Pike_compiler->new_program,
 						       SEE_STATIC|
 						       SEE_PRIVATE)) >= 0)) {
-      if (!(new_program->identifier_references[i].id_flags & ID_HIDDEN)) {
+      if (!(Pike_compiler->new_program->identifier_references[i].id_flags & ID_HIDDEN)) {
 	/* We need to generate a new reference. */
 	int d;
-	struct reference funp = new_program->identifier_references[i];
+	struct reference funp = Pike_compiler->new_program->identifier_references[i];
 	funp.id_flags |= ID_HIDDEN;
 	i = -1;
-	for(d = 0; d < (int)new_program->num_identifier_references; d++) {
+	for(d = 0; d < (int)Pike_compiler->new_program->num_identifier_references; d++) {
 	  struct reference *fp;
-	  fp = new_program->identifier_references + d;
+	  fp = Pike_compiler->new_program->identifier_references + d;
 
 	  if(!MEMCMP((char *)fp,(char *)&funp,sizeof funp)) {
 	    i = d;
@@ -2297,13 +2297,13 @@ idents2: idents
 	}
 	if (i < 0) {
 	  add_to_identifier_references(funp);
-	  i = new_program->num_identifier_references - 1;
+	  i = Pike_compiler->new_program->num_identifier_references - 1;
 	}
       }
       $$ = mkidentifiernode(i);
     } else {
-      if (!num_parse_error) {
-	if (compiler_pass == 2) {
+      if (!Pike_compiler->num_parse_error) {
+	if (Pike_compiler->compiler_pass == 2) {
 	  my_yyerror("'%s' not defined in local scope.", last_identifier->str);
 	  $$ = 0;
 	} else {
@@ -2358,7 +2358,7 @@ idents: low_idents
 inherit_specifier: TOK_IDENTIFIER TOK_COLON_COLON
   {
     /* FIXME: The following doesn't work...
-    struct program *p = find_named_inherit(new_program, $1->u.sval.u.string);
+    struct program *p = find_named_inherit(Pike_compiler->new_program, $1->u.sval.u.string);
 
     if (!p) {
       my_yyerror("No such inherit \"%s\".", $1->u.sval.u.string->str);
@@ -2411,9 +2411,9 @@ low_idents: TOK_IDENTIFIER
     }else if((i=isidentifier(last_identifier))>=0){
       $$=mkidentifiernode(i);
     }else if(!($$=find_module_identifier(last_identifier,1))){
-      if(!num_parse_error)
+      if(!Pike_compiler->num_parse_error)
       {
-	if(compiler_pass==2)
+	if(Pike_compiler->compiler_pass==2)
 	{
 	  my_yyerror("'%s' undefined.", last_identifier->str);
 	  $$=0;
@@ -2477,9 +2477,9 @@ low_idents: TOK_IDENTIFIER
     copy_shared_string(last_identifier, $2->u.sval.u.string);
 
     $$=0;
-    for(e=1;e<(int)new_program->num_inherits;e++)
+    for(e=1;e<(int)Pike_compiler->new_program->num_inherits;e++)
     {
-      if(new_program->inherits[e].inherit_level!=1) continue;
+      if(Pike_compiler->new_program->inherits[e].inherit_level!=1) continue;
       i=low_reference_inherited_identifier(0,e,$2->u.sval.u.string,SEE_STATIC);
       if(i==-1) continue;
       if($$)
@@ -2586,12 +2586,12 @@ catch_arg: '(' comma_expr ')'  { $$=$2; }
 
 catch: TOK_CATCH
      {
-       catch_level++;
+       Pike_compiler->catch_level++;
      }
      catch_arg
      {
        $$=mknode(F_CATCH,$3,NULL);
-       catch_level--;
+       Pike_compiler->catch_level--;
      }
      ;
 
@@ -2804,8 +2804,8 @@ void yyerror(char *str)
     fatal("Stack error (underflow)\n");
 #endif
 
-  if (num_parse_error > 10) return;
-  num_parse_error++;
+  if (Pike_compiler->num_parse_error > 10) return;
+  Pike_compiler->num_parse_error++;
   cumulative_parse_error++;
 
   if ((error_handler && error_handler->prog) || get_master())
@@ -2860,7 +2860,7 @@ int low_add_local_name(struct compiler_frame *frame,
     check_type_string(type);
 #endif /* PIKE_DEBUG */
     if (pike_types_le(type, void_type_string)) {
-      if (compiler_pass != 1) {
+      if (Pike_compiler->compiler_pass != 1) {
 	yywarning("Declaring local variable with type void "
 		  "(converted to type zero).");
       }
@@ -2890,7 +2890,7 @@ int add_local_name(struct pike_string *str,
 		   struct pike_string *type,
 		   node *def)
 {
-  return low_add_local_name(compiler_frame,
+  return low_add_local_name(Pike_compiler->compiler_frame,
 			    str,
 			    type,
 			    def);
@@ -2900,8 +2900,8 @@ int add_local_name(struct pike_string *str,
 int islocal(struct pike_string *str)
 {
   int e;
-  for(e=compiler_frame->current_number_of_locals-1;e>=0;e--)
-    if(compiler_frame->variable[e].name==str)
+  for(e=Pike_compiler->compiler_frame->current_number_of_locals-1;e>=0;e--)
+    if(Pike_compiler->compiler_frame->variable[e].name==str)
       return e;
   return -1;
 }
@@ -2910,7 +2910,7 @@ int islocal(struct pike_string *str)
 static node *lexical_islocal(struct pike_string *str)
 {
   int e,depth=0;
-  struct compiler_frame *f=compiler_frame;
+  struct compiler_frame *f=Pike_compiler->compiler_frame;
   
   while(1)
   {
@@ -2918,7 +2918,7 @@ static node *lexical_islocal(struct pike_string *str)
     {
       if(f->variable[e].name==str)
       {
-	struct compiler_frame *q=compiler_frame;
+	struct compiler_frame *q=Pike_compiler->compiler_frame;
 	if(f->variable[e].def)
 	  return copy_node(f->variable[e].def);
 	while(q!=f) 
diff --git a/src/las.c b/src/las.c
index 1949e74d50e42cff4b44f2da424f15fafb71f46b..adb85d31101f8a290deced19a0df00f4ea98d191 100644
--- a/src/las.c
+++ b/src/las.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: las.c,v 1.179 2000/05/11 14:09:45 grubba Exp $");
+RCSID("$Id: las.c,v 1.180 2000/06/24 00:48:13 hubbe Exp $");
 
 #include "language.h"
 #include "interpret.h"
@@ -40,8 +40,6 @@ static node *eval(node *);
 static void optimize(node *n);
 static node *localopt(node *n);
 
-node *init_node = 0;
-int num_parse_error;
 int cumulative_parse_error=0;
 extern char *get_type_name(int);
 
@@ -347,7 +345,7 @@ static node *freeze_node(node *orig)
 
 void free_all_nodes(void)
 {
-  if(!compiler_frame)
+  if(!Pike_compiler->compiler_frame)
   {
     node *tmp;
     struct node_s_block *tmp2;
@@ -679,7 +677,7 @@ node *debug_mknode(short token, node *a, node *b)
     verify_shared_strings_tables();
 #endif
 
-  if(!num_parse_error && compiler_pass==2)
+  if(!Pike_compiler->num_parse_error && Pike_compiler->compiler_pass==2)
   {
     check_tree(res,0);
     optimize(res);
@@ -799,7 +797,7 @@ node *debug_mklocalnode(int var, int depth)
   node *res = mkemptynode();
   res->token = F_LOCAL;
 
-  f=compiler_frame;
+  f=Pike_compiler->compiler_frame;
   for(e=0;e<depth;e++) f=f->previous;
   copy_shared_string(res->type, f->variable[var].type);
 
@@ -829,10 +827,10 @@ node *debug_mkidentifiernode(int i)
 {
   node *res = mkemptynode();
   res->token = F_IDENTIFIER;
-  copy_shared_string(res->type, ID_FROM_INT(new_program, i)->type);
+  copy_shared_string(res->type, ID_FROM_INT(Pike_compiler->new_program, i)->type);
 
   /* FIXME */
-  if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(new_program, i)->identifier_flags))
+  if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(Pike_compiler->new_program, i)->identifier_flags))
   {
     res->node_info = OPT_EXTERNAL_DEPEND;
   }else{
@@ -845,7 +843,7 @@ node *debug_mkidentifiernode(int i)
 #endif
   res->u.id.number = i;
 #ifdef SHARED_NODES
-  res->u.id.prog = new_program;
+  res->u.id.prog = Pike_compiler->new_program;
 #endif /* SHARED_NODES */
 
   res = freeze_node(res);
@@ -858,10 +856,10 @@ node *debug_mktrampolinenode(int i)
 {
   node *res = mkemptynode();
   res->token = F_TRAMPOLINE;
-  copy_shared_string(res->type, ID_FROM_INT(new_program, i)->type);
+  copy_shared_string(res->type, ID_FROM_INT(Pike_compiler->new_program, i)->type);
 
   /* FIXME */
-  if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(new_program, i)->identifier_flags))
+  if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(Pike_compiler->new_program, i)->identifier_flags))
   {
     res->node_info = OPT_EXTERNAL_DEPEND;
   }else{
@@ -874,7 +872,7 @@ node *debug_mktrampolinenode(int i)
 #endif
   res->u.id.number = i;
 #ifdef SHARED_NODES
-  res->u.id.prog = new_program;
+  res->u.id.prog = Pike_compiler->new_program;
 #endif /* SHARED_NODES */
 
   res = freeze_node(res);
@@ -909,7 +907,7 @@ node *debug_mkexternalnode(int level,
   res->u.integer.b = i;
 
   /* Bzot-i-zot */
-  new_program->flags |= PROGRAM_USES_PARENT;
+  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT;
 
   return freeze_node(res);
 }
@@ -966,7 +964,7 @@ node *debug_mksoftcastnode(struct pike_string *type,node *n)
   }
 #endif /* PIKE_DEBUG */
 
-  if (compiler_pass == 2) {
+  if (Pike_compiler->compiler_pass == 2) {
     if (type == void_type_string) {
       yywarning("Soft cast to void.");
       return mknode(F_POP_VALUE, n, 0);
@@ -1045,7 +1043,7 @@ void resolv_constant(node *n)
       break;
 
     case F_IDENTIFIER:
-      p=new_program;
+      p=Pike_compiler->new_program;
       numid=n->u.id.number;
       break;
 
@@ -1062,7 +1060,7 @@ void resolv_constant(node *n)
       return;
 
     case F_UNDEFINED:
-      if(compiler_pass==2) {
+      if(Pike_compiler->compiler_pass==2) {
 	/* FIXME: Ought to have the name of the identifier in the message. */
 	yyerror("Expected constant, got undefined identifier");
       }
@@ -1110,7 +1108,7 @@ void resolv_constant(node *n)
       {
 	push_svalue(&PROG_FROM_INT(p, numid)->constants[i->func.offset].sval);
       }else{
-	if(compiler_pass!=1)
+	if(Pike_compiler->compiler_pass!=1)
 	  yyerror("Constant is not defined yet.");
 	push_int(0);
       }
@@ -1140,7 +1138,7 @@ void resolv_class(node *n)
       break;
 
     default:
-      if (compiler_pass!=1)
+      if (Pike_compiler->compiler_pass!=1)
 	yyerror("Illegal program identifier");
       pop_stack();
       push_int(0);
@@ -1164,7 +1162,7 @@ void resolv_program(node *n)
 	break;
       
     default:
-      if (compiler_pass!=1)
+      if (Pike_compiler->compiler_pass!=1)
 	yyerror("Illegal program identifier");
       pop_stack();
       push_int(0);
@@ -1203,7 +1201,7 @@ node *index_node(node *n, char *node_name, struct pike_string *id)
     switch(sp[-1].type)
     {
     case T_INT:
-      if(!num_parse_error) {
+      if(!Pike_compiler->num_parse_error) {
 	if (node_name) {
 	  my_yyerror("Failed to index module '%s' with '%s' "
 		     "(module doesn't exist?)",
@@ -1371,7 +1369,7 @@ node *debug_mksvaluenode(struct svalue *s)
     return make_node_from_mapping(s->u.mapping);
 
   case T_OBJECT:
-    if(s->u.object == fake_object)
+    if(s->u.object == Pike_compiler->fake_object)
     {
       return mkefuncallnode("this_object", 0);
     }
@@ -1380,7 +1378,7 @@ node *debug_mksvaluenode(struct svalue *s)
       int x=0;
       struct object *o;
       node *n=mkefuncallnode("this_object", 0);
-      for(o=fake_object;o!=s->u.object;o=o->parent)
+      for(o=Pike_compiler->fake_object;o!=s->u.object;o=o->parent)
       {
 	n=mkefuncallnode("function_object",
 			 mkefuncallnode("object_program",n));
@@ -1393,14 +1391,14 @@ node *debug_mksvaluenode(struct svalue *s)
   {
     if(s->subtype != FUNCTION_BUILTIN)
     {
-      if(s->u.object == fake_object)
+      if(s->u.object == Pike_compiler->fake_object)
 	return mkidentifiernode(s->subtype);
 
       if(s->u.object->next == s->u.object)
       {
 	int x=0;
 	struct object *o;
-	for(o=fake_object->parent;o!=s->u.object;o=o->parent) x++;
+	for(o=Pike_compiler->fake_object->parent;o!=s->u.object;o=o->parent) x++;
 	return mkexternalnode(x, s->subtype,
 			      ID_FROM_INT(o->prog, s->subtype));
 
@@ -1667,17 +1665,17 @@ static void low_print_tree(node *foo,int needlval)
 
   case F_IDENTIFIER:
     if(needlval) fputc('&', stderr);
-    if (new_program) {
-      fprintf(stderr, "%s",ID_FROM_INT(new_program, foo->u.id.number)->name->str);
+    if (Pike_compiler->new_program) {
+      fprintf(stderr, "%s",ID_FROM_INT(Pike_compiler->new_program, foo->u.id.number)->name->str);
     } else {
       fprintf(stderr, "unknown identifier");
     }
     break;
 
   case F_TRAMPOLINE:
-    if (new_program) {
+    if (Pike_compiler->new_program) {
       fprintf(stderr, "trampoline<%s>",
-	      ID_FROM_INT(new_program, foo->u.id.number)->name->str);
+	      ID_FROM_INT(Pike_compiler->new_program, foo->u.id.number)->name->str);
     } else {
       fprintf(stderr, "trampoline<unknown identifier>");
     }
@@ -2273,7 +2271,7 @@ void fix_type_field(node *n)
       type_a=CAR(n)->type;
       type_b=CDR(n)->type;
       if(!check_indexing(type_a, type_b, n))
-	if(!catch_level)
+	if(!Pike_compiler->catch_level)
 	  my_yyerror("Indexing on illegal type.");
       n->type=index_type(type_a, type_b,n);
     }
@@ -2319,7 +2317,7 @@ void fix_type_field(node *n)
       case F_TRAMPOLINE:
 #endif
       case F_IDENTIFIER:
-	name=ID_FROM_INT(new_program, CAR(n)->u.id.number)->name->str;
+	name=ID_FROM_INT(Pike_compiler->new_program, CAR(n)->u.id.number)->name->str;
 	break;
 
 	case F_ARROW:
@@ -2449,24 +2447,24 @@ void fix_type_field(node *n)
 #endif /* SHARED_NODES */
 	break;
       }
-    } else if(compiler_frame && compiler_frame->current_return_type) {
-      if (!pike_types_le(CAR(n)->type, compiler_frame->current_return_type) &&
+    } else if(Pike_compiler->compiler_frame && Pike_compiler->compiler_frame->current_return_type) {
+      if (!pike_types_le(CAR(n)->type, Pike_compiler->compiler_frame->current_return_type) &&
 	    !(
-	      compiler_frame->current_return_type==void_type_string &&
+	      Pike_compiler->compiler_frame->current_return_type==void_type_string &&
 	      CAR(n)->token == F_CONSTANT &&
 	      IS_ZERO(& CAR(n)->u.sval)
 	      )
 	  ) {
-	if (!match_types(compiler_frame->current_return_type,CAR(n)->type))
+	if (!match_types(Pike_compiler->compiler_frame->current_return_type,CAR(n)->type))
 	{
 	  yyerror("Wrong return type.");
-	  yyexplain_nonmatching_types(compiler_frame->current_return_type,
+	  yyexplain_nonmatching_types(Pike_compiler->compiler_frame->current_return_type,
 				      CAR(n)->type,0);
 	}
 	else if (lex.pragmas & ID_STRICT_TYPES)
 	{
 	  yytype_error("Return type mismatch.",
-		       compiler_frame->current_return_type,
+		       Pike_compiler->compiler_frame->current_return_type,
 		       CAR(n)->type,
 		       YYTE_IS_WARNING);
 	}
@@ -3612,10 +3610,10 @@ int eval_low(node *n)
   }
 #endif
 
-  if(num_parse_error) return -1; 
+  if(Pike_compiler->num_parse_error) return -1; 
 
-  num_strings=new_program->num_strings;
-  num_constants=new_program->num_constants;
+  num_strings=Pike_compiler->new_program->num_strings;
+  num_constants=Pike_compiler->new_program->num_constants;
   jump=PC;
 
   store_linenumbers=0;
@@ -3624,7 +3622,7 @@ int eval_low(node *n)
   store_linenumbers=1;
 
   ret=-1;
-  if(!num_parse_error)
+  if(!Pike_compiler->num_parse_error)
   {
     struct callback *tmp_callback;
     struct timer_oflo foo;
@@ -3637,10 +3635,10 @@ int eval_low(node *n)
 				 check_evaluation_time,
 				 (void *)&foo,0);
 				 
-    if(apply_low_safe_and_stupid(fake_object, jump))
+    if(apply_low_safe_and_stupid(Pike_compiler->fake_object, jump))
     {
       /* Generate error message */
-      if(!catch_level)
+      if(!Pike_compiler->catch_level)
       {
         if(throw_value.type == T_ARRAY && throw_value.u.array->size)
         {
@@ -3679,19 +3677,19 @@ int eval_low(node *n)
     remove_callback(tmp_callback);
   }
 
-  while(new_program->num_strings > num_strings)
+  while(Pike_compiler->new_program->num_strings > num_strings)
   {
-    new_program->num_strings--;
-    free_string(new_program->strings[new_program->num_strings]);
+    Pike_compiler->new_program->num_strings--;
+    free_string(Pike_compiler->new_program->strings[Pike_compiler->new_program->num_strings]);
   }
 
-  while(new_program->num_constants > num_constants)
+  while(Pike_compiler->new_program->num_constants > num_constants)
   {
     struct program_constant *p_const;
 
-    new_program->num_constants--;
+    Pike_compiler->new_program->num_constants--;
 
-    p_const = new_program->constants + new_program->num_constants;
+    p_const = Pike_compiler->new_program->constants + Pike_compiler->new_program->num_constants;
 
     free_svalue(&p_const->sval);
     if (p_const->name) {
@@ -3700,7 +3698,7 @@ int eval_low(node *n)
     }
   }
 
-  new_program->num_program=jump;
+  Pike_compiler->new_program->num_program=jump;
 
   return ret;
 }
@@ -3722,13 +3720,13 @@ static node *eval(node *n)
     break;
 
   case 0:
-    if(catch_level) return n;
+    if(Pike_compiler->catch_level) return n;
     free_node(n);
     n=0;
     break;
 
   case 1:
-    if(catch_level && IS_ZERO(sp-1))
+    if(Pike_compiler->catch_level && IS_ZERO(sp-1))
     {
       pop_stack();
       return n;
@@ -3883,13 +3881,13 @@ int dooptcode(struct pike_string *name,
     vargs=0;
   }
 
-  if(compiler_frame->lexical_scope & SCOPE_SCOPED)
+  if(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPED)
     vargs|=IDENTIFIER_SCOPED;
 
-  if(compiler_frame->lexical_scope & SCOPE_SCOPE_USED)
+  if(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED)
     vargs|=IDENTIFIER_SCOPE_USED;
 
-  if(compiler_pass==1)
+  if(Pike_compiler->compiler_pass==1)
   {
     tmp.offset=-1;
 #ifdef PIKE_DEBUG
@@ -3937,7 +3935,7 @@ int dooptcode(struct pike_string *name,
     }
 
     tmp.offset=PC;
-    compiler_frame->num_args=args;
+    Pike_compiler->compiler_frame->num_args=args;
   
 #ifdef PIKE_DEBUG
     if(a_flag > 2)
@@ -3946,7 +3944,7 @@ int dooptcode(struct pike_string *name,
       print_tree(check_node_hash(n));
     }
 #endif
-    if(!num_parse_error)
+    if(!Pike_compiler->num_parse_error)
     {
       extern int remove_clear_locals;
       remove_clear_locals=args;
diff --git a/src/las.h b/src/las.h
index 1839a5a57775fb656d41eb14c3d28722230d8d28..b4ba37b84fa8b74be1c375ee8259d4cec622d05b 100644
--- a/src/las.h
+++ b/src/las.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: las.h,v 1.38 2000/05/17 19:30:14 grubba Exp $
+ * $Id: las.h,v 1.39 2000/06/24 00:48:13 hubbe Exp $
  */
 #ifndef LAS_H
 #define LAS_H
@@ -31,10 +31,7 @@ int islocal(struct pike_string *str);
 int verify_declared(struct pike_string *str);
 
 
-extern node *init_node;
-extern int num_parse_error;
 extern int cumulative_parse_error;
-extern struct compiler_frame *compiler_frame;
 
 struct local_variable
 {
@@ -249,9 +246,9 @@ void resolv_program(node *n);
 #define GAUGE_RUSAGE_INDEX 0
 
 #define add_to_mem_block(N,Data,Size) low_my_binary_strcat(Data,Size,areas+N)
-#define IDENTIFIERP(i) (new_program->identifier_references+(i))
-#define INHERIT(i) (new_program->inherits+(i))
-#define PC (new_program->num_program)
+#define IDENTIFIERP(i) (Pike_compiler->new_program->identifier_references+(i))
+#define INHERIT(i) (Pike_compiler->new_program->inherits+(i))
+#define PC (Pike_compiler->new_program->num_program)
 
 #ifndef PIKE_DEBUG
 #define check_tree(X,Y)
diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c
index d15e2e74f5d08e0b9bff7222c543775aa7d1a32c..a6043800e43412b27f57cf44bad5247459c1c08b 100644
--- a/src/modules/Gmp/mpz_glue.c
+++ b/src/modules/Gmp/mpz_glue.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: mpz_glue.c,v 1.77 2000/06/09 16:57:19 noring Exp $");
+RCSID("$Id: mpz_glue.c,v 1.78 2000/06/24 00:48:26 hubbe Exp $");
 #include "gmp_machine.h"
 
 #if defined(HAVE_GMP2_GMP_H) && defined(HAVE_LIBGMP2)
@@ -1551,8 +1551,8 @@ void pike_module_init(void)
     /* magic /Hubbe
      * This seems to break more than it fixes though... /Hubbe
      */
-    free_string(ID_FROM_INT(new_program, id)->type);
-    ID_FROM_INT(new_program, id)->type=CONSTTYPE(tOr(tFunc(tOr5(tVoid,tStr,tInt,tFlt,tObj),tInt),tFunc(tStr tInt,tInt)));
+    free_string(ID_FROM_INT(Pike_compiler->new_program, id)->type);
+    ID_FROM_INT(Pike_compiler->new_program, id)->type=CONSTTYPE(tOr(tFunc(tOr5(tVoid,tStr,tInt,tFlt,tObj),tInt),tFunc(tStr tInt,tInt)));
 #endif
   }
 #endif
diff --git a/src/modules/Parser/parser.c b/src/modules/Parser/parser.c
index 825f06f907e24d045a4f19c97ab113d27c10651e..cb012a3e3cb6b54f3ccd609aa2702d05b2baa68a 100644
--- a/src/modules/Parser/parser.c
+++ b/src/modules/Parser/parser.c
@@ -1,7 +1,7 @@
 #include "global.h"
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: parser.c,v 1.6 2000/05/24 01:21:38 hubbe Exp $");
+RCSID("$Id: parser.c,v 1.7 2000/06/24 00:48:31 hubbe Exp $");
 #include "pike_macros.h"
 #include "interpret.h"
 #include "program.h"
@@ -165,7 +165,7 @@ void pike_module_init(void)
    for (i=0; i<(int)NELEM(initclass); i++)
    {
       start_new_program();
-      if (initclass[i].id) new_program->id = initclass[i].id;
+      if (initclass[i].id) Pike_compiler->new_program->id = initclass[i].id;
 
 #ifdef DEBUG
       fprintf(stderr,"Parser: initiating class \"Parser.%s\"...\n",
diff --git a/src/object.c b/src/object.c
index fb5dfcb12a73e689bead56f2981708bd50bdedbf..9cce07686b22bbd25b0045badb0918a86e7793cc 100644
--- a/src/object.c
+++ b/src/object.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: object.c,v 1.126 2000/06/23 06:17:58 hubbe Exp $");
+RCSID("$Id: object.c,v 1.127 2000/06/24 00:48:13 hubbe Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -1642,7 +1642,7 @@ void check_object_context(struct object *o,
 			  char *current_storage)
 {
   int q;
-  if(o == fake_object) return;
+  if(o == Pike_compiler->fake_object) return;
   if( ! o->prog ) return; /* Variables are already freed */
 
   for(q=0;q<(int)context_prog->num_variable_index;q++)
@@ -1674,7 +1674,7 @@ void check_object(struct object *o)
   debug_malloc_touch(o);
   debug_malloc_touch(o->storage);
 
-  if(o == fake_object) return;
+  if(o == Pike_compiler->fake_object) return;
 
   if(o->next && o->next->prev !=o)
   {
diff --git a/src/object.h b/src/object.h
index ce0646d4ca88a0885a3419873c79bc66e3ea36d4..56ce772429e5d1ea20812d3faf2ac753e184eee5 100644
--- a/src/object.h
+++ b/src/object.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: object.h,v 1.47 2000/06/23 06:17:58 hubbe Exp $
+ * $Id: object.h,v 1.48 2000/06/24 00:48:13 hubbe Exp $
  */
 #ifndef OBJECT_H
 #define OBJECT_H
@@ -53,6 +53,7 @@ extern struct program *magic_set_index_program;
 
 #include "block_alloc_h.h"
 /* Prototypes begin here */
+BLOCK_ALLOC(object, 511)
 struct object *low_clone(struct program *p);
 void call_c_initializers(struct object *o);
 void do_free_object(struct object *o);
diff --git a/src/pike_types.c b/src/pike_types.c
index d1c9b265173b2896ae091207fb31f2a145e0f128..da86ded49c9c39d7d33326c73f8d1b8653557f61 100644
--- a/src/pike_types.c
+++ b/src/pike_types.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: pike_types.c,v 1.130 2000/05/11 14:09:46 grubba Exp $");
+RCSID("$Id: pike_types.c,v 1.131 2000/06/24 00:48:13 hubbe Exp $");
 #include <ctype.h>
 #include "svalue.h"
 #include "pike_types.h"
@@ -205,32 +205,30 @@ one_more_type:
 
 
 unsigned char type_stack[PIKE_TYPE_STACK_SIZE];
-unsigned char *type_stackp=type_stack;
 unsigned char *pike_type_mark_stack[PIKE_TYPE_STACK_SIZE/4];
-unsigned char **pike_type_mark_stackp=pike_type_mark_stack;
 
 
 INT32 pop_stack_mark(void)
 { 
-  pike_type_mark_stackp--;
-  if(pike_type_mark_stackp<pike_type_mark_stack)
+  Pike_compiler->pike_type_mark_stackp--;
+  if(Pike_compiler->pike_type_mark_stackp<pike_type_mark_stack)
     fatal("Type mark stack underflow\n");
 
-  return type_stackp - *pike_type_mark_stackp;
+  return Pike_compiler->type_stackp - *Pike_compiler->pike_type_mark_stackp;
 }
 
 void pop_type_stack(void)
 { 
-  type_stackp--;
-  if(type_stackp<type_stack)
+  Pike_compiler->type_stackp--;
+  if(Pike_compiler->type_stackp<type_stack)
     fatal("Type stack underflow\n");
 }
 
 void type_stack_pop_to_mark(void)
 {
-  type_stackp-=pop_stack_mark();
+  Pike_compiler->type_stackp-=pop_stack_mark();
 #ifdef PIKE_DEBUG
-  if(type_stackp<type_stack)
+  if(Pike_compiler->type_stackp<type_stack)
     fatal("Type stack underflow\n");
 #endif
 }
@@ -239,7 +237,7 @@ void type_stack_reverse(void)
 {
   INT32 a;
   a=pop_stack_mark();
-  reverse((char *)(type_stackp-a),a,1);
+  reverse((char *)(Pike_compiler->type_stackp-a),a,1);
 }
 
 void push_type_int(INT32 i)
@@ -330,8 +328,8 @@ void push_finished_type_backwards(struct pike_string *type)
 {
   int e;
   check_type_string(type);
-  MEMCPY(type_stackp, type->str, type->len);
-  type_stackp+=type->len;
+  MEMCPY(Pike_compiler->type_stackp, type->str, type->len);
+  Pike_compiler->type_stackp+=type->len;
 }
 
 struct pike_string *debug_pop_unfinished_type(void)
@@ -340,8 +338,8 @@ struct pike_string *debug_pop_unfinished_type(void)
   struct pike_string *s;
   len=pop_stack_mark();
   s=begin_shared_string(len);
-  type_stackp-=len;
-  MEMCPY(s->str, type_stackp, len);
+  Pike_compiler->type_stackp-=len;
+  MEMCPY(s->str, Pike_compiler->type_stackp, len);
   reverse(s->str, len, 1);
   s=end_shared_string(s);
   check_type_string(s);
@@ -358,8 +356,7 @@ struct pike_string *debug_pop_type(void)
 
 struct pike_string *debug_compiler_pop_type(void)
 {
-  extern int num_parse_error;
-  if(num_parse_error)
+  if(Pike_compiler->num_parse_error)
   {
     /* This could be fixed to check if the type
      * is correct and then return it, I just didn't feel
@@ -734,8 +731,8 @@ struct pike_string *parse_type(char *s)
 {
   struct pike_string *ret;
 #ifdef PIKE_DEBUG
-  unsigned char *ts=type_stackp;
-  unsigned char **ptms=pike_type_mark_stackp;
+  unsigned char *ts=Pike_compiler->type_stackp;
+  unsigned char **ptms=Pike_compiler->pike_type_mark_stackp;
 #endif
   type_stack_mark();
   internal_parse_type(&s);
@@ -746,7 +743,7 @@ struct pike_string *parse_type(char *s)
   ret=pop_unfinished_type();
 
 #ifdef PIKE_DEBUG
-  if(ts!=type_stackp || ptms!=pike_type_mark_stackp)
+  if(ts!=Pike_compiler->type_stackp || ptms!=Pike_compiler->pike_type_mark_stackp)
     fatal("Type stack whacked in parse_type.\n");
 #endif
 
diff --git a/src/pike_types.h b/src/pike_types.h
index 4eb04d5b4562638f0686ac00a300dd7c19833517..3012cb8a49700c886abe29bea1807beac294a0ba 100644
--- a/src/pike_types.h
+++ b/src/pike_types.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: pike_types.h,v 1.38 2000/03/20 21:00:04 hubbe Exp $
+ * $Id: pike_types.h,v 1.39 2000/06/24 00:48:13 hubbe Exp $
  */
 #ifndef PIKE_TYPES_H
 #define PIKE_TYPES_H
@@ -59,9 +59,7 @@ typedef struct node_s node;
 #define PIKE_TYPE_STACK_SIZE 100000
 
 extern unsigned char type_stack[PIKE_TYPE_STACK_SIZE];
-extern unsigned char *type_stackp;
 extern unsigned char *pike_type_mark_stack[PIKE_TYPE_STACK_SIZE/4];
-extern unsigned char **pike_type_mark_stackp;
 
 extern int max_correct_args;
 extern struct pike_string *string_type_string;
@@ -95,31 +93,31 @@ extern struct pike_string *weak_type_string;
 
 /* Hmm, these will cause fatals if they fail... */
 #define push_type(X) do {				\
-  if(type_stackp >= type_stack + sizeof(type_stack))	\
+  if(Pike_compiler->type_stackp >= type_stack + sizeof(type_stack))	\
     yyerror("Type stack overflow.");			\
   else {						\
-    *type_stackp=(X);					\
-    type_stackp++;					\
+    *Pike_compiler->type_stackp=(X);					\
+    Pike_compiler->type_stackp++;					\
   }							\
 } while(0)
 
 #define unsafe_push_type(X) do {			\
-  *type_stackp=(X);					\
-  type_stackp++;					\
+  *Pike_compiler->type_stackp=(X);					\
+  Pike_compiler->type_stackp++;					\
 } while(0)
 
 #define type_stack_mark() do {				\
-  if(pike_type_mark_stackp >= pike_type_mark_stack + NELEM(pike_type_mark_stack))	\
+  if(Pike_compiler->pike_type_mark_stackp >= pike_type_mark_stack + NELEM(pike_type_mark_stack))	\
     yyerror("Type mark stack overflow.");		\
   else {						\
-    *pike_type_mark_stackp=type_stackp;				\
-    pike_type_mark_stackp++;					\
+    *Pike_compiler->pike_type_mark_stackp=Pike_compiler->type_stackp;				\
+    Pike_compiler->pike_type_mark_stackp++;					\
   }							\
 } while(0)
 
 #define unsafe_type_stack_mark() do {				\
-  *pike_type_mark_stackp=type_stackp;				\
-  pike_type_mark_stackp++;					\
+  *Pike_compiler->pike_type_mark_stackp=Pike_compiler->type_stackp;				\
+  Pike_compiler->pike_type_mark_stackp++;					\
 } while(0)
 
 #define reset_type_stack() do {			\
@@ -233,7 +231,7 @@ struct pike_string *make_pike_type(char *t);
   unsafe_type_stack_mark();						\
 } while (0)
 #define DTYPE_END(TYPESTR) do {						\
-  if(type_stackp >= type_stack + sizeof(type_stack))			\
+  if(Pike_compiler->type_stackp >= type_stack + sizeof(type_stack))			\
     fatal("Type stack overflow.");					\
   type_stack_reverse();							\
   (TYPESTR)=pop_unfinished_type();					\
diff --git a/src/program.c b/src/program.c
index 48e7d9202d166b1bffec9ddd5d0a2eecfaa16839..d38a7da4479d0fb70936671228f020e20afafcaa 100644
--- a/src/program.c
+++ b/src/program.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: program.c,v 1.242 2000/06/23 06:17:58 hubbe Exp $");
+RCSID("$Id: program.c,v 1.243 2000/06/24 00:48:13 hubbe Exp $");
 #include "program.h"
 #include "object.h"
 #include "dynamic_buffer.h"
@@ -56,13 +56,9 @@ RCSID("$Id: program.c,v 1.242 2000/06/23 06:17:58 hubbe Exp $");
 #define FIND_FUNCTION_HASHSIZE 4711
 
 
-#define STRUCT
-#include "compilation.h"
-
 #define DECLARE
 #include "compilation.h"
 
-
 struct pike_string *this_program_string=0;
 
 char *lfun_names[] = {
@@ -161,26 +157,14 @@ static char *raw_lfun_types[] = {
 struct program *first_program = 0;
 static int current_program_id=0x10000;
 
-struct program *new_program=0;
-struct object *fake_object=0;
-struct program *malloc_size_program=0;
 struct object *error_handler=0;
 
 struct program *gc_internal_program = 0;
 static struct program *gc_mark_program_pos = 0;
 
-int compiler_pass;
 int compilation_depth;
-long local_class_counter;
-int catch_level;
-struct compiler_frame *compiler_frame=0;
-static INT32 last_line = 0;
-static INT32 last_pc = 0;
-static struct pike_string *last_file = 0;
 dynamic_buffer used_modules;
-INT32 num_used_modules;
 static struct mapping *resolve_cache=0;
-static struct mapping *module_index_cache=0;
 
 int get_small_number(char **q);
 
@@ -188,9 +172,9 @@ int get_small_number(char **q);
 
 #ifdef PIKE_DEBUG
 #define CHECK_FOO(NUMTYPE,TYPE,NAME)				\
-  if(malloc_size_program-> PIKE_CONCAT(num_,NAME) < new_program-> PIKE_CONCAT(num_,NAME))	\
-    fatal("new_program->num_" #NAME " is out of order\n");	\
-  if(new_program->flags & PROGRAM_OPTIMIZED)			\
+  if(Pike_compiler->malloc_size_program-> PIKE_CONCAT(num_,NAME) < Pike_compiler->new_program-> PIKE_CONCAT(num_,NAME))	\
+    fatal("Pike_compiler->new_program->num_" #NAME " is out of order\n");	\
+  if(Pike_compiler->new_program->flags & PROGRAM_OPTIMIZED)			\
     fatal("Tried to reallocate fixed program.\n")
 
 #else
@@ -198,40 +182,28 @@ int get_small_number(char **q);
 #endif
 
 #define FOO(NUMTYPE,TYPE,NAME)						\
-void PIKE_CONCAT(add_to_,NAME) (TYPE ARG) {				\
-  CHECK_FOO(NUMTYPE,TYPE,NAME);						\
-  if(malloc_size_program->PIKE_CONCAT(num_,NAME) ==			\
-     new_program->PIKE_CONCAT(num_,NAME)) {				\
+void PIKE_CONCAT(low_add_to_,NAME) (struct program_state *state,	\
+                                    TYPE ARG) {				\
+  if(state->malloc_size_program->PIKE_CONCAT(num_,NAME) ==		\
+     state->new_program->PIKE_CONCAT(num_,NAME)) {			\
     void *tmp;								\
-    malloc_size_program->PIKE_CONCAT(num_,NAME) *= 2;			\
-    malloc_size_program->PIKE_CONCAT(num_,NAME)++;			\
-    tmp=realloc((char *)new_program->NAME,				\
+    state->malloc_size_program->PIKE_CONCAT(num_,NAME) *= 2;		\
+    state->malloc_size_program->PIKE_CONCAT(num_,NAME)++;		\
+    tmp=realloc((char *)state->new_program->NAME,			\
                 sizeof(TYPE) *						\
-		malloc_size_program->PIKE_CONCAT(num_,NAME));		\
+		state->malloc_size_program->				\
+                    PIKE_CONCAT(num_,NAME));				\
     if(!tmp) fatal("Out of memory.\n");					\
-    new_program->NAME=tmp;						\
+    state->new_program->NAME=tmp;					\
   }									\
-  new_program->NAME[new_program->PIKE_CONCAT(num_,NAME)++]=(ARG);	\
+  state->new_program->							\
+    NAME[state->new_program->PIKE_CONCAT(num_,NAME)++]=(ARG);		\
+}									\
+void PIKE_CONCAT(add_to_,NAME) (TYPE ARG) {				\
+  CHECK_FOO(NUMTYPE,TYPE,NAME);						\
+  PIKE_CONCAT(low_add_to_,NAME) ( Pike_compiler, ARG );			\
 }
 
-#include "program_areas.h"
-
-#define FOO(NUMTYPE,TYPE,NAME)							\
-void PIKE_CONCAT(low_add_to_,NAME) (struct program_state *state,		\
-                                    TYPE ARG) {					\
-  if(state->malloc_size_program->PIKE_CONCAT(num_,NAME) ==			\
-     state->new_program->PIKE_CONCAT(num_,NAME)) {				\
-    void *tmp;									\
-    state->malloc_size_program->PIKE_CONCAT(num_,NAME) *= 2;			\
-    state->malloc_size_program->PIKE_CONCAT(num_,NAME)++;			\
-    tmp=realloc((char *)state->new_program->NAME,				\
-                sizeof(TYPE) *							\
-		state->malloc_size_program->PIKE_CONCAT(num_,NAME));		\
-    if(!tmp) fatal("Out of memory.\n");						\
-    state->new_program->NAME=tmp;						\
-  }										\
-  state->new_program->NAME[state->new_program->PIKE_CONCAT(num_,NAME)++]=(ARG);	\
-}
 
 #include "program_areas.h"
 
@@ -252,14 +224,14 @@ void use_module(struct svalue *s)
 {
   if( (1<<s->type) & (BIT_MAPPING | BIT_OBJECT | BIT_PROGRAM))
   {
-    num_used_modules++;
+    Pike_compiler->num_used_modules++;
     assign_svalue_no_free((struct svalue *)
 			  low_make_buf_space(sizeof(struct svalue),
 					     &used_modules), s);
-    if(module_index_cache)
+    if(Pike_compiler->module_index_cache)
     {
-      free_mapping(module_index_cache);
-      module_index_cache=0;
+      free_mapping(Pike_compiler->module_index_cache);
+      Pike_compiler->module_index_cache=0;
     }
   }else{
     yyerror("Module is neither mapping nor object");
@@ -273,15 +245,15 @@ void unuse_modules(INT32 howmany)
   if(howmany *sizeof(struct svalue) > used_modules.s.len)
     fatal("Unusing too many modules.\n");
 #endif
-  num_used_modules-=howmany;
+  Pike_compiler->num_used_modules-=howmany;
   low_make_buf_space(-sizeof(struct svalue)*howmany, &used_modules);
   free_svalues((struct svalue *)low_make_buf_space(0, &used_modules),
 	       howmany,
 	       BIT_MAPPING | BIT_OBJECT | BIT_PROGRAM);
-  if(module_index_cache)
+  if(Pike_compiler->module_index_cache)
   {
-    free_mapping(module_index_cache);
-    module_index_cache=0;
+    free_mapping(Pike_compiler->module_index_cache);
+    Pike_compiler->module_index_cache=0;
   }
 }
 
@@ -360,13 +332,13 @@ struct node_s *find_module_identifier(struct pike_string *ident,
     (used_modules.s.str + used_modules.s.len);
 
   if((ret=index_modules(ident,
-			&module_index_cache,
-			num_used_modules,
+			&Pike_compiler->module_index_cache,
+			Pike_compiler->num_used_modules,
 			modules))) return ret;
-  modules-=num_used_modules;
+  modules-=Pike_compiler->num_used_modules;
 
   {
-    struct program_state *p=previous_program_state;
+    struct program_state *p=Pike_compiler->previous;
     int n;
     for(n=0;n<compilation_depth;n++,p=p->previous)
     {
@@ -383,7 +355,7 @@ struct node_s *find_module_identifier(struct pike_string *ident,
 	  return mkexternalnode(n, i, id);
 	}
       }
-
+      
       if((ret=index_modules(ident,
 			    &p->module_index_cache,
 			    p->num_used_modules,
@@ -400,7 +372,7 @@ struct node_s *find_module_identifier(struct pike_string *ident,
   if (ident == this_program_string) {
     struct svalue s;
     s.type=T_PROGRAM;
-    s.u.program=new_program;
+    s.u.program=Pike_compiler->new_program;
     return mkconstantsvaluenode(&s);
   }
 
@@ -416,7 +388,7 @@ struct node_s *find_module_identifier(struct pike_string *ident,
     }
   }
 
-  if(!num_parse_error && get_master())
+  if(!Pike_compiler->num_parse_error && get_master())
   {
     DECLARE_CYCLIC();
     node *ret=0;
@@ -440,7 +412,7 @@ struct node_s *find_module_identifier(struct pike_string *ident,
 
       if(throw_value.type == T_STRING)
       {
-	if(compiler_pass==2)
+	if(Pike_compiler->compiler_pass==2)
 	  my_yyerror("%s",throw_value.u.string->str);
       }
       else
@@ -463,10 +435,11 @@ struct node_s *find_module_identifier(struct pike_string *ident,
   return 0;
 }
 
+/* Fixme: allow level=0 to return the current level */
 struct program *parent_compilation(int level)
 {
   int n;
-  struct program_state *p=previous_program_state;
+  struct program_state *p=Pike_compiler->previous;
   for(n=0;n<level;n++)
   {
     if(n>=compilation_depth) return 0;
@@ -546,8 +519,8 @@ void optimize_program(struct program *p)
 int program_function_index_compare(const void *a,const void *b)
 {
   return
-    my_order_strcmp(ID_FROM_INT(new_program, *(unsigned short *)a)->name,
-		    ID_FROM_INT(new_program, *(unsigned short *)b)->name);
+    my_order_strcmp(ID_FROM_INT(Pike_compiler->new_program, *(unsigned short *)a)->name,
+		    ID_FROM_INT(Pike_compiler->new_program, *(unsigned short *)b)->name);
 }
 
 #ifdef PIKE_DEBUG
@@ -577,34 +550,34 @@ char *find_program_name(struct program *p, INT32 *line)
 void fixate_program(void)
 {
   INT32 i,e,t;
-  if(new_program->flags & PROGRAM_FIXED) return;
+  if(Pike_compiler->new_program->flags & PROGRAM_FIXED) return;
 #ifdef PIKE_DEBUG
-  if(new_program->flags & PROGRAM_OPTIMIZED)
+  if(Pike_compiler->new_program->flags & PROGRAM_OPTIMIZED)
     fatal("Cannot fixate optimized program\n");
 #endif
 
   /* Ok, sort for binsearch */
-  for(e=i=0;i<(int)new_program->num_identifier_references;i++)
+  for(e=i=0;i<(int)Pike_compiler->new_program->num_identifier_references;i++)
   {
     struct reference *funp;
     struct identifier *fun;
-    funp=new_program->identifier_references+i;
+    funp=Pike_compiler->new_program->identifier_references+i;
     if(funp->id_flags & (ID_HIDDEN|ID_STATIC)) continue;
     if(funp->id_flags & ID_INHERITED)
     {
       if(funp->id_flags & ID_PRIVATE) continue;
-      fun=ID_FROM_PTR(new_program, funp);
+      fun=ID_FROM_PTR(Pike_compiler->new_program, funp);
 /*	  if(fun->func.offset == -1) continue; * prototype */
 
       /* check for multiple definitions */
-      for(t=i+1;t>=0 && t<(int)new_program->num_identifier_references;t++)
+      for(t=i+1;t>=0 && t<(int)Pike_compiler->new_program->num_identifier_references;t++)
       {
 	struct reference *funpb;
 	struct identifier *funb;
 
-	funpb=new_program->identifier_references+t;
+	funpb=Pike_compiler->new_program->identifier_references+t;
 	if(funpb->id_flags & (ID_HIDDEN|ID_STATIC)) continue;
-	funb=ID_FROM_PTR(new_program,funpb);
+	funb=ID_FROM_PTR(Pike_compiler->new_program,funpb);
 	/* if(funb->func.offset == -1) continue; * prototype */
 	if(fun->name==funb->name) t=-10;
       }
@@ -612,17 +585,17 @@ void fixate_program(void)
     }
     add_to_identifier_index(i);
   }
-  fsort((void *)new_program->identifier_index,
-	new_program->num_identifier_index,
+  fsort((void *)Pike_compiler->new_program->identifier_index,
+	Pike_compiler->new_program->num_identifier_index,
 	sizeof(unsigned short),(fsortfun)program_function_index_compare);
 
 
   /* Yes, it is supposed to start at 1  /Hubbe */
   for(i=1;i<NUM_LFUNS;i++) {
-    new_program->lfuns[i] = low_find_lfun(new_program, i);
+    Pike_compiler->new_program->lfuns[i] = low_find_lfun(Pike_compiler->new_program, i);
   }
 
-  new_program->flags |= PROGRAM_FIXED;
+  Pike_compiler->new_program->flags |= PROGRAM_FIXED;
 
 #ifdef DEBUG_MALLOC
   {
@@ -638,16 +611,16 @@ void fixate_program(void)
     {
       m=dmalloc_alloc_mmap( DBSTR(lex.current_file), lex.current_line);
     }
-    else if( (tmp=find_program_name(new_program, &line)) )
+    else if( (tmp=find_program_name(Pike_compiler->new_program, &line)) )
     {
       m=dmalloc_alloc_mmap( tmp, line);
     }else{
-      m=dmalloc_alloc_mmap( "program id", new_program->id);
+      m=dmalloc_alloc_mmap( "program id", Pike_compiler->new_program->id);
     }
 
-    for(e=0;e<new_program->num_inherits;e++)
+    for(e=0;e<Pike_compiler->new_program->num_inherits;e++)
     {
-      struct inherit *i=new_program->inherits+e;
+      struct inherit *i=Pike_compiler->new_program->inherits+e;
       char *tmp;
       char buffer[50];
 
@@ -681,7 +654,7 @@ void fixate_program(void)
 			     0,0);
 
     }
-    dmalloc_set_mmap_template(new_program, m);
+    dmalloc_set_mmap_template(Pike_compiler->new_program, m);
   }
 #endif
 }
@@ -735,7 +708,7 @@ void low_start_new_program(struct program *p,
   compilation_depth++;
 
   CDFPRINTF((stderr, "th(%ld) low_start_new_program() pass=%d: compilation_depth:%d\n",
-	     (long)th_self(),compilation_depth,compiler_pass));
+	     (long)th_self(),compilation_depth,Pike_compiler->compiler_pass));
 
   tmp.type=T_PROGRAM;
   if(!p)
@@ -756,7 +729,7 @@ void low_start_new_program(struct program *p,
       id=isidentifier(name);
       if (id < 0)
 	fatal("Program constant disappeared in second pass.\n");
-      i=ID_FROM_INT(new_program, id);
+      i=ID_FROM_INT(Pike_compiler->new_program, id);
       free_string(i->type);
       i->type=get_type_of_svalue(&tmp);
     }
@@ -769,9 +742,9 @@ void low_start_new_program(struct program *p,
 #define PUSH
 #include "compilation.h"
 
-  compiler_pass=e;
+  Pike_compiler->compiler_pass=e;
 
-  num_used_modules=0;
+  Pike_compiler->num_used_modules=0;
 
   if(p && (p->flags & PROGRAM_FINISHED))
   {
@@ -779,75 +752,75 @@ void low_start_new_program(struct program *p,
     p=0;
   }
 
-  malloc_size_program = ALLOC_STRUCT(program);
+  Pike_compiler->malloc_size_program = ALLOC_STRUCT(program);
 #ifdef PIKE_DEBUG
-  fake_object=alloc_object();
-  fake_object->storage=(char *)xalloc(256 * sizeof(struct svalue));
+  Pike_compiler->fake_object=alloc_object();
+  Pike_compiler->fake_object->storage=(char *)xalloc(256 * sizeof(struct svalue));
   /* Stipple to find illegal accesses */
-  MEMSET(fake_object->storage,0x55,256*sizeof(struct svalue));
+  MEMSET(Pike_compiler->fake_object->storage,0x55,256*sizeof(struct svalue));
 #else
-  fake_object=ALLOC_STRUCT(object);
-  fake_object->storage=0;
+  Pike_compiler->fake_object=ALLOC_STRUCT(object);
+  Pike_compiler->fake_object->storage=0;
 #endif
-  GC_ALLOC(fake_object);
-
-  fake_object->next=fake_object;
-  fake_object->prev=fake_object;
-  fake_object->refs=1;
-  fake_object->parent=0;
-  fake_object->parent_identifier=0;
-  fake_object->prog=p;
+  GC_ALLOC(Pike_compiler->fake_object);
+
+  Pike_compiler->fake_object->next=Pike_compiler->fake_object;
+  Pike_compiler->fake_object->prev=Pike_compiler->fake_object;
+  Pike_compiler->fake_object->refs=1;
+  Pike_compiler->fake_object->parent=0;
+  Pike_compiler->fake_object->parent_identifier=0;
+  Pike_compiler->fake_object->prog=p;
   add_ref(p);
 
 #ifdef PIKE_DEBUG
-  fake_object->program_id=p->id;
+  Pike_compiler->fake_object->program_id=p->id;
 #endif
 
 #ifdef PIKE_SECURITY
-  fake_object->prot=0;
+  Pike_compiler->fake_object->prot=0;
 #endif
 
-  debug_malloc_touch(fake_object);
-  debug_malloc_touch(fake_object->storage);
+  debug_malloc_touch(Pike_compiler->fake_object);
+  debug_malloc_touch(Pike_compiler->fake_object->storage);
 
   if(name)
   {
-    if((fake_object->parent=previous_program_state->fake_object))
-      add_ref(fake_object->parent);
-    fake_object->parent_identifier=id;
+    if((Pike_compiler->fake_object->parent=Pike_compiler->previous->fake_object))
+      add_ref(Pike_compiler->fake_object->parent);
+    Pike_compiler->fake_object->parent_identifier=id;
   }
 
-  new_program=p;
+  Pike_compiler->new_program=p;
 
 #ifdef PROGRAM_BUILD_DEBUG
   if (name) {
     fprintf (stderr, "%.*sstarting program %d (pass=%d): ",
-	     compilation_depth, "                ", new_program->id, compiler_pass);
+	     compilation_depth, "                ", Pike_compiler->new_program->id, Pike_compiler->compiler_pass);
     push_string (name);
     print_svalue (stderr, --sp);
     putc ('\n', stderr);
   }
   else
     fprintf (stderr, "%.*sstarting program %d (pass=%d)\n",
-	     compilation_depth, "                ", new_program->id, compiler_pass);
+	     compilation_depth, "                ", Pike_compiler->new_program->id, Pike_compiler->compiler_pass);
 #endif
 
-  debug_malloc_touch(fake_object);
-  debug_malloc_touch(fake_object->storage);
+  debug_malloc_touch(Pike_compiler->fake_object);
+  debug_malloc_touch(Pike_compiler->fake_object->storage);
 
-  if(new_program->program)
+  if(Pike_compiler->new_program->program)
   {
 #define FOO(NUMTYPE,TYPE,NAME) \
-    malloc_size_program->PIKE_CONCAT(num_,NAME)=new_program->PIKE_CONCAT(num_,NAME);
+    Pike_compiler->malloc_size_program->PIKE_CONCAT(num_,NAME)=Pike_compiler->new_program->PIKE_CONCAT(num_,NAME);
 #include "program_areas.h"
 
 
     {
       INT32 line=0, off=0;
       char *file=0;
-      char *cnt=new_program->linenumbers;
+      char *cnt=Pike_compiler->new_program->linenumbers;
 
-      while(cnt < new_program->linenumbers + new_program->num_linenumbers)
+      while(cnt < Pike_compiler->new_program->linenumbers + Pike_compiler->new_program->num_linenumbers)
       {
 	if(*cnt == 127)
 	{
@@ -857,12 +830,12 @@ void low_start_new_program(struct program *p,
 	off+=get_small_number(&cnt);
 	line+=get_small_number(&cnt);
       }
-      last_line=line;
-      last_pc=off;
+      Pike_compiler->last_line=line;
+      Pike_compiler->last_pc=off;
       if(file)
       {
-	if(last_file) free_string(last_file);
-	last_file=make_shared_string(file);
+	if(Pike_compiler->last_file) free_string(Pike_compiler->last_file);
+	Pike_compiler->last_file=make_shared_string(file);
       }
     }
 
@@ -872,11 +845,11 @@ void low_start_new_program(struct program *p,
 
 #define START_SIZE 64
 #define FOO(NUMTYPE,TYPE,NAME) \
-    malloc_size_program->PIKE_CONCAT(num_,NAME)=START_SIZE; \
-    new_program->NAME=(TYPE *)xalloc(sizeof(TYPE) * START_SIZE);
+    Pike_compiler->malloc_size_program->PIKE_CONCAT(num_,NAME)=START_SIZE; \
+    Pike_compiler->new_program->NAME=(TYPE *)xalloc(sizeof(TYPE) * START_SIZE);
 #include "program_areas.h"
 
-    i.prog=new_program;
+    i.prog=Pike_compiler->new_program;
     i.identifier_level=0;
     i.storage_offset=0;
     i.inherit_level=0;
@@ -888,14 +861,14 @@ void low_start_new_program(struct program *p,
   }
 
 
-  init_node=0;
-  num_parse_error=0;
+  Pike_compiler->init_node=0;
+  Pike_compiler->num_parse_error=0;
 
   push_compiler_frame(0);
-  add_ref(compiler_frame->current_return_type=void_type_string);
+  add_ref(Pike_compiler->compiler_frame->current_return_type=void_type_string);
 
-  debug_malloc_touch(fake_object);
-  debug_malloc_touch(fake_object->storage);
+  debug_malloc_touch(Pike_compiler->fake_object);
+  debug_malloc_touch(Pike_compiler->fake_object->storage);
 }
 
 void debug_start_new_program(PROGRAM_LINE_ARGS)
@@ -910,7 +883,7 @@ void debug_start_new_program(PROGRAM_LINE_ARGS)
     struct pike_string *s=make_shared_string(file);
     store_linenumber(line,s);
     free_string(s);
-    debug_malloc_name(new_program, file, line);
+    debug_malloc_name(Pike_compiler->new_program, file, line);
   }
 #endif
 }
@@ -1056,39 +1029,39 @@ void dump_program_desc(struct program *p)
 
 static void toss_compilation_resources(void)
 {
-  if(fake_object)
+  if(Pike_compiler->fake_object)
   {
-    free_program(fake_object->prog);
-    fake_object->prog=0;
-    free_object(fake_object);
-    fake_object=0;
+    free_program(Pike_compiler->fake_object->prog);
+    Pike_compiler->fake_object->prog=0;
+    free_object(Pike_compiler->fake_object);
+    Pike_compiler->fake_object=0;
   }
 
-  free_program(new_program);
-  new_program=0;
+  free_program(Pike_compiler->new_program);
+  Pike_compiler->new_program=0;
 
-  if(malloc_size_program)
+  if(Pike_compiler->malloc_size_program)
     {
-      dmfree((char *)malloc_size_program);
-      malloc_size_program=0;
+      dmfree((char *)Pike_compiler->malloc_size_program);
+      Pike_compiler->malloc_size_program=0;
     }
 
-  if(module_index_cache)
+  if(Pike_compiler->module_index_cache)
   {
-    free_mapping(module_index_cache);
-    module_index_cache=0;
+    free_mapping(Pike_compiler->module_index_cache);
+    Pike_compiler->module_index_cache=0;
   }
 
-  while(compiler_frame)
+  while(Pike_compiler->compiler_frame)
     pop_compiler_frame();
 
-  if(last_file)
+  if(Pike_compiler->last_file)
   {
-    free_string(last_file);
-    last_file=0;
+    free_string(Pike_compiler->last_file);
+    Pike_compiler->last_file=0;
   }
 
-  unuse_modules(num_used_modules);
+  unuse_modules(Pike_compiler->num_used_modules);
 }
 
 int sizeof_variable(int run_time_type)
@@ -1282,24 +1255,24 @@ struct program *end_first_pass(int finish)
   struct program *prog;
   struct pike_string *s;
 
-  debug_malloc_touch(fake_object);
-  debug_malloc_touch(fake_object->storage);
+  debug_malloc_touch(Pike_compiler->fake_object);
+  debug_malloc_touch(Pike_compiler->fake_object->storage);
 
   MAKE_CONSTANT_SHARED_STRING(s,"__INIT");
 
 
   /* Collect references to inherited __INIT functions */
-  for(e=new_program->num_inherits-1;e;e--)
+  for(e=Pike_compiler->new_program->num_inherits-1;e;e--)
   {
     int id;
-    if(new_program->inherits[e].inherit_level!=1) continue;
+    if(Pike_compiler->new_program->inherits[e].inherit_level!=1) continue;
     id=low_reference_inherited_identifier(0, e, s, SEE_STATIC);
     if(id!=-1)
     {
-      init_node=mknode(F_COMMA_EXPR,
+      Pike_compiler->init_node=mknode(F_COMMA_EXPR,
 		       mkcastnode(void_type_string,
 				  mkapplynode(mkidentifiernode(id),0)),
-		       init_node);
+		       Pike_compiler->init_node);
     }
   }
 
@@ -1308,29 +1281,29 @@ struct program *end_first_pass(int finish)
    * to initialize.
    */
 
-  if(init_node)
+  if(Pike_compiler->init_node)
   {
     union idptr tmp;
     e=dooptcode(s,
 		mknode(F_COMMA_EXPR,
-		       init_node,mknode(F_RETURN,mkintnode(0),0)),
+		       Pike_compiler->init_node,mknode(F_RETURN,mkintnode(0),0)),
 		function_type_string,
 		ID_STATIC);
-    init_node=0;
+    Pike_compiler->init_node=0;
   }else{
     e=-1;
   }
-  new_program->lfuns[LFUN___INIT]=e;
+  Pike_compiler->new_program->lfuns[LFUN___INIT]=e;
 
   free_string(s);
 
   pop_compiler_frame(); /* Pop __INIT local variables */
 
-  if(num_parse_error > 0)
+  if(Pike_compiler->num_parse_error > 0)
   {
     prog=0;
   }else{
-    prog=new_program;
+    prog=Pike_compiler->new_program;
     add_ref(prog);
 
 #ifdef PIKE_DEBUG
@@ -1339,29 +1312,29 @@ struct program *end_first_pass(int finish)
       dump_program_desc(prog);
 #endif
 
-    new_program->flags |= PROGRAM_PASS_1_DONE;
+    Pike_compiler->new_program->flags |= PROGRAM_PASS_1_DONE;
 
     if(finish)
     {
       fixate_program();
-      optimize_program(new_program);
-      new_program->flags |= PROGRAM_FINISHED;
+      optimize_program(Pike_compiler->new_program);
+      Pike_compiler->new_program->flags |= PROGRAM_FINISHED;
     }
 
   }
 
 #ifdef PROGRAM_BUILD_DEBUG
   fprintf (stderr, "%.*sfinishing program %d (pass=%d)\n",
-	   compilation_depth, "                ", new_program->id, compiler_pass);
+	   compilation_depth, "                ", Pike_compiler->new_program->id, Pike_compiler->compiler_pass);
 #endif
 
   toss_compilation_resources();
 
   CDFPRINTF((stderr,
-	     "th(%ld),end_first_pass(): compilation_depth:%d, compiler_pass:%d\n",
-	     (long)th_self(), compilation_depth, compiler_pass));
+	     "th(%ld),end_first_pass(): compilation_depth:%d, Pike_compiler->compiler_pass:%d\n",
+	     (long)th_self(), compilation_depth, Pike_compiler->compiler_pass));
 
-  if(!compiler_frame && (compiler_pass==2 || !prog) && resolve_cache)
+  if(!Pike_compiler->compiler_frame && (Pike_compiler->compiler_pass==2 || !prog) && resolve_cache)
   {
     free_mapping(dmalloc_touch(struct mapping *, resolve_cache));
     resolve_cache=0;
@@ -1403,7 +1376,7 @@ SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo_orig)
   long offset;
   int modulo;
 
-  if(!size) return new_program->storage_needed;
+  if(!size) return Pike_compiler->new_program->storage_needed;
 
 #ifdef PIKE_DEBUG
   if(alignment <=0 || (alignment & (alignment-1)) || alignment > 256)
@@ -1411,10 +1384,10 @@ SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo_orig)
 #endif
   modulo=( modulo_orig /* +OFFSETOF(object,storage) */ ) % alignment;
 
-  offset=DO_ALIGN(new_program->storage_needed-modulo,alignment)+modulo;
+  offset=DO_ALIGN(Pike_compiler->new_program->storage_needed-modulo,alignment)+modulo;
 
-  if(!new_program->storage_needed) {
-    /* Shouldn't new_program->storage_needed be set here?
+  if(!Pike_compiler->new_program->storage_needed) {
+    /* Shouldn't Pike_compiler->new_program->storage_needed be set here?
      * Otherwise the debug code below ought to be trigged.
      * But since it isn't, I guess this is dead code?
      *	/grubba 1999-09-28
@@ -1432,14 +1405,14 @@ SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo_orig)
      * Oops, seems I read the test below the wrong way around.
      *	/grubba 1999-09-29
      */
-    new_program->inherits[0].storage_offset=offset;
+    Pike_compiler->new_program->inherits[0].storage_offset=offset;
   }
 
-  if(new_program->alignment_needed<alignment)
-    new_program->alignment_needed=alignment;
+  if(Pike_compiler->new_program->alignment_needed<alignment)
+    Pike_compiler->new_program->alignment_needed=alignment;
 
 #ifdef PIKE_DEBUG
-  if(offset < new_program->storage_needed)
+  if(offset < Pike_compiler->new_program->storage_needed)
     fatal("add_storage failed horribly!\n");
 
   if( (offset /* + OFFSETOF(object,storage) */ - modulo_orig ) % alignment )
@@ -1452,7 +1425,7 @@ SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo_orig)
 
 #endif
 
-  new_program->storage_needed = offset + size;
+  Pike_compiler->new_program->storage_needed = offset + size;
 
   return (SIZE_T) offset;
 }
@@ -1464,7 +1437,7 @@ SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo_orig)
  */
 void set_init_callback(void (*init)(struct object *))
 {
-  new_program->init=init;
+  Pike_compiler->new_program->init=init;
 }
 
 /*
@@ -1473,7 +1446,7 @@ void set_init_callback(void (*init)(struct object *))
  */
 void set_exit_callback(void (*exit)(struct object *))
 {
-  new_program->exit=exit;
+  Pike_compiler->new_program->exit=exit;
 }
 
 /*
@@ -1490,7 +1463,7 @@ void set_exit_callback(void (*exit)(struct object *))
  */
 void set_gc_recurse_callback(void (*m)(struct object *))
 {
-  new_program->gc_recurse_func=m;
+  Pike_compiler->new_program->gc_recurse_func=m;
 }
 
 /*
@@ -1506,7 +1479,7 @@ void set_gc_recurse_callback(void (*m)(struct object *))
  */
 void set_gc_check_callback(void (*m)(struct object *))
 {
-  new_program->gc_check_func=m;
+  Pike_compiler->new_program->gc_check_func=m;
 }
 
 int low_reference_inherited_identifier(struct program_state *q,
@@ -1514,7 +1487,7 @@ int low_reference_inherited_identifier(struct program_state *q,
 				       struct pike_string *name,
 				       int flags)
 {
-  struct program *np=q?q->new_program:new_program;
+  struct program *np=(q?q:Pike_compiler)->new_program;
   struct reference funp;
   struct program *p;
   int i,d;
@@ -1557,7 +1530,7 @@ node *reference_inherited_identifier(struct pike_string *super_name,
 				   struct pike_string *function_name)
 {
   int n,e,id;
-  struct program_state *state=previous_program_state;
+  struct program_state *state=Pike_compiler->previous;
 
   struct program *p;
 
@@ -1567,7 +1540,7 @@ node *reference_inherited_identifier(struct pike_string *super_name,
     fatal("reference_inherited_function on nonshared string.\n");
 #endif
 
-  p=new_program;
+  p=Pike_compiler->new_program;
 
   for(e=p->num_inherits-1;e>0;e--)
   {
@@ -1639,9 +1612,9 @@ node *reference_inherited_identifier(struct pike_string *super_name,
 
 void rename_last_inherit(struct pike_string *n)
 {
-  if(new_program->inherits[new_program->num_inherits].name)
-    free_string(new_program->inherits[new_program->num_inherits].name);
-  copy_shared_string(new_program->inherits[new_program->num_inherits].name,
+  if(Pike_compiler->new_program->inherits[Pike_compiler->new_program->num_inherits].name)
+    free_string(Pike_compiler->new_program->inherits[Pike_compiler->new_program->num_inherits].name);
+  copy_shared_string(Pike_compiler->new_program->inherits[Pike_compiler->new_program->num_inherits].name,
 		     n);
 }
 
@@ -1685,7 +1658,7 @@ void low_inherit(struct program *p,
     return;
   }
 
-  inherit_offset = new_program->num_inherits;
+  inherit_offset = Pike_compiler->new_program->num_inherits;
 
   /* alignment magic */
   storage_offset=p->inherits[0].storage_offset % p->alignment_needed;
@@ -1700,7 +1673,7 @@ void low_inherit(struct program *p,
   {
     inherit=p->inherits[e];
     add_ref(inherit.prog);
-    inherit.identifier_level += new_program->num_identifier_references;
+    inherit.identifier_level += Pike_compiler->new_program->num_identifier_references;
     inherit.storage_offset += storage_offset;
     inherit.inherit_level ++;
     if(!e)
@@ -1710,10 +1683,10 @@ void low_inherit(struct program *p,
 	if(parent->next == parent)
 	{
 	  struct object *o;
-	  for(o=fake_object->parent;o!=parent;o=o->parent)
+	  for(o=Pike_compiler->fake_object->parent;o!=parent;o=o->parent)
 	  {
 #ifdef PIKE_DEBUG
-	    if(!o) fatal("low_inherit with odd fake_object as parent!\n");
+	    if(!o) fatal("low_inherit with odd Pike_compiler->fake_object as parent!\n");
 #endif
 	    inherit.parent_offset++;
 	  }
@@ -1803,7 +1776,7 @@ void low_inherit(struct program *p,
     {
       int n;
       n = isidentifier(name);
-      if (n != -1 && ID_FROM_INT(new_program,n)->func.offset != -1)
+      if (n != -1 && ID_FROM_INT(Pike_compiler->new_program,n)->func.offset != -1)
 	my_yyerror("Illegal to redefine 'nomask' function/variable \"%s\"",name->str);
     }
 
@@ -1848,7 +1821,7 @@ void compiler_do_inherit(node *n,
   switch(n->token)
   {
     case F_IDENTIFIER:
-      p=new_program;
+      p=Pike_compiler->new_program;
       offset=0;
       numid=n->u.id.number;
       goto continue_inherit;
@@ -1932,11 +1905,11 @@ void simple_do_inherit(struct pike_string *s,
 int isidentifier(struct pike_string *s)
 {
   INT32 e;
-  for(e=new_program->num_identifier_references-1;e>=0;e--)
+  for(e=Pike_compiler->new_program->num_identifier_references-1;e>=0;e--)
   {
-    if(new_program->identifier_references[e].id_flags & ID_HIDDEN) continue;
+    if(Pike_compiler->new_program->identifier_references[e].id_flags & ID_HIDDEN) continue;
 
-    if(ID_FROM_INT(new_program, e)->name == s)
+    if(ID_FROM_INT(Pike_compiler->new_program, e)->name == s)
       return e;
   }
   return -1;
@@ -1955,10 +1928,10 @@ int low_define_variable(struct pike_string *name,
   struct reference ref;
 
 #ifdef PIKE_DEBUG
-  if(new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
+  if(Pike_compiler->new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
     fatal("Attempting to add variable to fixed program\n");
 
-  if(compiler_pass==2)
+  if(Pike_compiler->compiler_pass==2)
     fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n"
 	  "Added identifier: \"%s\"\n", name->str);
 #endif
@@ -1967,7 +1940,7 @@ int low_define_variable(struct pike_string *name,
   copy_shared_string(dummy.type, type);
   dummy.identifier_flags = 0;
   dummy.run_time_type=run_time_type;
-  dummy.func.offset=offset - new_program->inherits[0].storage_offset;
+  dummy.func.offset=offset - Pike_compiler->new_program->inherits[0].storage_offset;
 #ifdef PROFILING
   dummy.self_time=0;
   dummy.num_calls=0;
@@ -1975,14 +1948,14 @@ int low_define_variable(struct pike_string *name,
 #endif
 
   ref.id_flags=flags;
-  ref.identifier_offset=new_program->num_identifiers;
+  ref.identifier_offset=Pike_compiler->new_program->num_identifiers;
   ref.inherit_offset=0;
 
   add_to_variable_index(ref.identifier_offset);
 
   add_to_identifiers(dummy);
 
-  n=new_program->num_identifier_references;
+  n=Pike_compiler->new_program->num_identifier_references;
   add_to_identifier_references(ref);
 
   return n;
@@ -1999,7 +1972,7 @@ int map_variable(char *name,
 
 #ifdef PROGRAM_BUILD_DEBUG
   fprintf (stderr, "%.*sdefining variable (pass=%d): %s %s\n",
-	   compilation_depth, "                ", compiler_pass, type, name);
+	   compilation_depth, "                ", Pike_compiler->compiler_pass, type, name);
 #endif
 
   n=make_shared_string(name);
@@ -2023,7 +1996,7 @@ int quick_map_variable(char *name,
 
 #ifdef PROGRAM_BUILD_DEBUG
   fprintf (stderr, "%.*sdefining variable (pass=%d): %s %s\n",
-	   compilation_depth, "                ", compiler_pass, type, name);
+	   compilation_depth, "                ", Pike_compiler->compiler_pass, type, name);
 #endif
 
   n=make_shared_binary_string(name,name_length);
@@ -2050,7 +2023,7 @@ int define_variable(struct pike_string *name,
   {
     struct pike_string *d = describe_type (type);
     fprintf (stderr, "%.*sdefining variable (pass=%d): %s ",
-	     compilation_depth, "                ", compiler_pass, d->str);
+	     compilation_depth, "                ", Pike_compiler->compiler_pass, d->str);
     free_string (d);
     push_string (name);
     print_svalue (stderr, --sp);
@@ -2063,13 +2036,13 @@ int define_variable(struct pike_string *name,
 
   n = isidentifier(name);
 
-  if(new_program->flags & PROGRAM_PASS_1_DONE)
+  if(Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE)
   {
     if(n==-1)
       yyerror("Pass2: Variable disappeared!");
     else {
       struct identifier *id;
-      id=ID_FROM_INT(new_program,n);
+      id=ID_FROM_INT(Pike_compiler->new_program,n);
       free_string(id->type);
       copy_shared_string(id->type, type);
       return n;
@@ -2077,14 +2050,14 @@ int define_variable(struct pike_string *name,
   }
 
 #ifdef PIKE_DEBUG
-  if(new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
+  if(Pike_compiler->new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
     fatal("Attempting to add variable to fixed program\n");
 #endif
 
   if(n != -1)
   {
     /* not inherited */
-    if(new_program->identifier_references[n].inherit_offset == 0)
+    if(Pike_compiler->new_program->identifier_references[n].inherit_offset == 0)
     {
       if (!((IDENTIFIERP(n)->id_flags | flags) & ID_EXTERN)) {
 	my_yyerror("Identifier '%s' defined twice.",name->str);
@@ -2101,15 +2074,15 @@ int define_variable(struct pike_string *name,
 	my_yyerror("Illegal to redefine 'nomask/final' "
 		   "variable/functions \"%s\"", name->str);
 
-      if(!(IDENTIFIERP(n)->id_flags & ID_INLINE) || compiler_pass!=1)
+      if(!(IDENTIFIERP(n)->id_flags & ID_INLINE) || Pike_compiler->compiler_pass!=1)
       {
- 	if(!match_types(ID_FROM_INT(new_program, n)->type, type))
+ 	if(!match_types(ID_FROM_INT(Pike_compiler->new_program, n)->type, type))
  	  my_yyerror("Illegal to redefine inherited variable "
  		     "with different type.");
 
 	
 
-	if(!IDENTIFIER_IS_VARIABLE(ID_FROM_INT(new_program, n)->
+	if(!IDENTIFIER_IS_VARIABLE(ID_FROM_INT(Pike_compiler->new_program, n)->
 				   identifier_flags))
 	{
 	  my_yyerror("Illegal to redefine inherited variable "
@@ -2180,13 +2153,13 @@ int add_constant(struct pike_string *name,
       struct pike_string *t = get_type_of_svalue (c);
       struct pike_string *d = describe_type (t);
       fprintf (stderr, "%.*sdefining constant (pass=%d): %s ",
-	       compilation_depth, "                ", compiler_pass, d->str);
+	       compilation_depth, "                ", Pike_compiler->compiler_pass, d->str);
       free_string (t);
       free_string (d);
     }
     else
       fprintf (stderr, "%.*sdeclaring constant (pass=%d): ",
-	       compilation_depth, "                ", compiler_pass);
+	       compilation_depth, "                ", Pike_compiler->compiler_pass);
     push_string (name);
     print_svalue (stderr, --sp);
     putc ('\n', stderr);
@@ -2213,18 +2186,18 @@ int add_constant(struct pike_string *name,
    * /Hubbe
    */
 
-  if(new_program->flags & PROGRAM_PASS_1_DONE)
+  if(Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE)
   {
     if(n==-1)
     {
       yyerror("Pass2: Constant disappeared!");
     }else{
       struct identifier *id;
-      id=ID_FROM_INT(new_program,n);
+      id=ID_FROM_INT(Pike_compiler->new_program,n);
       if(id->func.offset>=0)
       {
 	struct pike_string *s;
-	struct svalue *c=&PROG_FROM_INT(new_program,n)->
+	struct svalue *c=&PROG_FROM_INT(Pike_compiler->new_program,n)->
 	  constants[id->func.offset].sval;
 	s=get_type_of_svalue(c);
 	free_string(id->type);
@@ -2244,10 +2217,10 @@ int add_constant(struct pike_string *name,
   }
 
 #ifdef PIKE_DEBUG
-  if(new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
+  if(Pike_compiler->new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
     fatal("Attempting to add constant to fixed program\n");
 
-  if(compiler_pass==2)
+  if(Pike_compiler->compiler_pass==2)
     fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n");
 #endif
 
@@ -2267,7 +2240,7 @@ int add_constant(struct pike_string *name,
   }
 
   ref.id_flags=flags;
-  ref.identifier_offset=new_program->num_identifiers;
+  ref.identifier_offset=Pike_compiler->new_program->num_identifiers;
   ref.inherit_offset=0;
 
 #ifdef PROFILING
@@ -2284,7 +2257,7 @@ int add_constant(struct pike_string *name,
       my_yyerror("Illegal to redefine 'nomask' identifier \"%s\"", name->str);
 
     /* not inherited */
-    if(new_program->identifier_references[n].inherit_offset == 0)
+    if(Pike_compiler->new_program->identifier_references[n].inherit_offset == 0)
     {
       my_yyerror("Identifier '%s' defined twice.",name->str);
       return n;
@@ -2293,12 +2266,12 @@ int add_constant(struct pike_string *name,
     if(!(IDENTIFIERP(n)->id_flags & ID_INLINE))
     {
       /* override */
-      new_program->identifier_references[n]=ref;
+      Pike_compiler->new_program->identifier_references[n]=ref;
 
       return n;
     }
   }
-  n=new_program->num_identifier_references;
+  n=Pike_compiler->new_program->num_identifier_references;
   add_to_identifier_references(ref);
 
   return n;
@@ -2449,7 +2422,7 @@ INT32 define_function(struct pike_string *name,
   {
     struct pike_string *d = describe_type (type);
     fprintf (stderr, "%.*sdefining function (pass=%d): %s ",
-	     compilation_depth, "                ", compiler_pass, d->str);
+	     compilation_depth, "                ", Pike_compiler->compiler_pass, d->str);
     free_string (d);
     push_string (name);
     print_svalue (stderr, --sp);
@@ -2481,7 +2454,7 @@ INT32 define_function(struct pike_string *name,
   }
 
   if(function_flags & IDENTIFIER_C_FUNCTION)
-    new_program->flags |= PROGRAM_HAS_C_METHODS;
+    Pike_compiler->new_program->flags |= PROGRAM_HAS_C_METHODS;
 
   i=isidentifier(name);
 
@@ -2489,8 +2462,8 @@ INT32 define_function(struct pike_string *name,
   {
     /* already defined */
 
-    funp=ID_FROM_INT(new_program, i);
-    ref=new_program->identifier_references[i];
+    funp=ID_FROM_INT(Pike_compiler->new_program, i);
+    ref=Pike_compiler->new_program->identifier_references[i];
 
     if(ref.inherit_offset == 0) /* not inherited */
     {
@@ -2547,21 +2520,21 @@ INT32 define_function(struct pike_string *name,
 
       fun.identifier_flags=function_flags;
       if(function_flags & IDENTIFIER_C_FUNCTION)
-	new_program->flags |= PROGRAM_HAS_C_METHODS;
+	Pike_compiler->new_program->flags |= PROGRAM_HAS_C_METHODS;
 
       if(func)
 	fun.func = *func;
       else
 	fun.func.offset = -1;
 
-      ref.identifier_offset=new_program->num_identifiers;
+      ref.identifier_offset=Pike_compiler->new_program->num_identifiers;
       add_to_identifiers(fun);
     }
 
     ref.inherit_offset = 0;
     ref.id_flags = flags;
 #if 0
-    new_program->identifier_references[i]=ref;
+    Pike_compiler->new_program->identifier_references[i]=ref;
 #else
     {
       int z;
@@ -2571,26 +2544,26 @@ INT32 define_function(struct pike_string *name,
        * /Hubbe
        */
 
-      for(z=0;z<new_program->num_identifier_references;z++)
+      for(z=0;z<Pike_compiler->new_program->num_identifier_references;z++)
       {
 	/* Do zapp hidden identifiers */
-	if(new_program->identifier_references[z].id_flags & ID_HIDDEN)
+	if(Pike_compiler->new_program->identifier_references[z].id_flags & ID_HIDDEN)
 	  continue;
 
 	/* Do not zapp inline ('local') identifiers */
-	if(new_program->identifier_references[z].inherit_offset &&
-	   (new_program->identifier_references[z].id_flags & ID_INLINE))
+	if(Pike_compiler->new_program->identifier_references[z].inherit_offset &&
+	   (Pike_compiler->new_program->identifier_references[z].id_flags & ID_INLINE))
           continue;
 
 	/* Do not zapp functions with the wrong name... */
-	if(ID_FROM_INT(new_program, z)->name != name)
+	if(ID_FROM_INT(Pike_compiler->new_program, z)->name != name)
 	  continue;
 
-	new_program->identifier_references[z]=ref;
+	Pike_compiler->new_program->identifier_references[z]=ref;
       }
 
 #ifdef PIKE_DEBUG
-      if(MEMCMP(new_program->identifier_references+i, &ref,sizeof(ref)))
+      if(MEMCMP(Pike_compiler->new_program->identifier_references+i, &ref,sizeof(ref)))
 	fatal("New function overloading algorithm failed!\n");
 #endif
 
@@ -2602,7 +2575,7 @@ make_a_new_def:
 
 
 #ifdef PIKE_DEBUG
-  if(compiler_pass==2)
+  if(Pike_compiler->compiler_pass==2)
     fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n");
 #endif
 
@@ -2619,7 +2592,7 @@ make_a_new_def:
   else
     fun.func.offset = -1;
 
-  i=new_program->num_identifiers;
+  i=Pike_compiler->new_program->num_identifiers;
 
   add_to_identifiers(fun);
 
@@ -2627,7 +2600,7 @@ make_a_new_def:
   ref.identifier_offset = i;
   ref.inherit_offset = 0;
 
-  i=new_program->num_identifier_references;
+  i=Pike_compiler->new_program->num_identifier_references;
   add_to_identifier_references(ref);
 
   return i;
@@ -2811,8 +2784,8 @@ int store_prog_string(struct pike_string *str)
 {
   unsigned int i;
 
-  for (i=0;i<new_program->num_strings;i++)
-    if (new_program->strings[i] == str)
+  for (i=0;i<Pike_compiler->new_program->num_strings;i++)
+    if (Pike_compiler->new_program->strings[i] == str)
       return i;
 
   reference_shared_string(str);
@@ -2848,9 +2821,9 @@ int store_constant(struct svalue *foo,
     UNSETJMP(tmp2);
     return store_constant(&zero, equal, constant_name);
   }else{
-    for(e=0;e<new_program->num_constants;e++)
+    for(e=0;e<Pike_compiler->new_program->num_constants;e++)
     {
-      struct program_constant *c= new_program->constants+e;
+      struct program_constant *c= Pike_compiler->new_program->constants+e;
       if((equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo)) &&
 	 c->name == constant_name)
       {
@@ -2990,12 +2963,12 @@ int get_small_number(char **q)
 
 void start_line_numbering(void)
 {
-  if(last_file)
+  if(Pike_compiler->last_file)
   {
-    free_string(last_file);
-    last_file=0;
+    free_string(Pike_compiler->last_file);
+    Pike_compiler->last_file=0;
   }
-  last_pc=last_line=0;
+  Pike_compiler->last_pc=Pike_compiler->last_line=0;
 }
 
 static void insert_small_number(INT32 a)
@@ -3020,9 +2993,9 @@ void store_linenumber(INT32 current_line, struct pike_string *current_file)
   {
     INT32 line=0, off=0;
     char *file=0;
-    char *cnt=new_program->linenumbers;
+    char *cnt=Pike_compiler->new_program->linenumbers;
 
-    while(cnt < new_program->linenumbers + new_program->num_linenumbers)
+    while(cnt < Pike_compiler->new_program->linenumbers + Pike_compiler->new_program->num_linenumbers)
     {
       if(*cnt == 127)
       {
@@ -3033,37 +3006,37 @@ void store_linenumber(INT32 current_line, struct pike_string *current_file)
       line+=get_small_number(&cnt);
     }
 
-    if(last_line != line ||
-       last_pc != off ||
-       (last_file && file && strcmp(last_file->str, file)))
+    if(Pike_compiler->last_line != line ||
+       Pike_compiler->last_pc != off ||
+       (Pike_compiler->last_file && file && strcmp(Pike_compiler->last_file->str, file)))
     {
       fatal("Line numbering out of whack\n"
 	    "    (line: %d ?= %d)!\n"
 	    "    (  pc: %d ?= %d)!\n"
 	    "    (file: %s ?= %s)!\n",
-	    last_line, line,
-	    last_pc, off,
-	    last_file?last_file->str:"N/A",
+	    Pike_compiler->last_line, line,
+	    Pike_compiler->last_pc, off,
+	    Pike_compiler->last_file?Pike_compiler->last_file->str:"N/A",
 	    file?file:"N/A");
     }
   }
 #endif
-  if(last_line!=current_line || last_file != current_file)
+  if(Pike_compiler->last_line!=current_line || Pike_compiler->last_file != current_file)
   {
-    if(last_file != current_file)
+    if(Pike_compiler->last_file != current_file)
     {
       char *tmp;
-      if(last_file) free_string(last_file);
+      if(Pike_compiler->last_file) free_string(Pike_compiler->last_file);
       add_to_linenumbers(127);
       for(tmp=current_file->str; *tmp; tmp++)
 	add_to_linenumbers(*tmp);
       add_to_linenumbers(0);
-      copy_shared_string(last_file, current_file);
+      copy_shared_string(Pike_compiler->last_file, current_file);
     }
-    insert_small_number(PC-last_pc);
-    insert_small_number(current_line-last_line);
-    last_line=current_line;
-    last_pc=PC;
+    insert_small_number(PC-Pike_compiler->last_pc);
+    insert_small_number(current_line-Pike_compiler->last_line);
+    Pike_compiler->last_line=current_line;
+    Pike_compiler->last_pc=PC;
   }
 }
 
@@ -3082,7 +3055,7 @@ char *get_line(unsigned char *pc,struct program *prog,INT32 *linep)
   if (prog == 0) return "Unkown program";
   offset = pc - prog->program;
 
-  if(prog == new_program)
+  if(prog == Pike_compiler->new_program)
   {
     linep[0]=0;
     return "Optimizer";
@@ -3154,7 +3127,7 @@ struct program *compile(struct pike_string *prog,
   int saved_threads_disabled;
   struct object *saved_handler = error_handler;
   dynamic_buffer used_modules_save = used_modules;
-  INT32 num_used_modules_save = num_used_modules;
+  INT32 num_used_modules_save = Pike_compiler->num_used_modules;
   extern void yyparse(void);
   struct mapping *resolve_cache_save = resolve_cache;
   resolve_cache = 0;
@@ -3184,7 +3157,7 @@ struct program *compile(struct pike_string *prog,
   SET_ONERROR(tmp, fatal_on_error,"Compiler exited with longjump!\n");
 #endif
 
-  num_used_modules=0;
+  Pike_compiler->num_used_modules=0;
 
   save_lex=lex;
 
@@ -3224,14 +3197,14 @@ struct program *compile(struct pike_string *prog,
 
 #ifdef DEBUG_MALLOC
     if(strcmp(lex.current_file->str,"-") || lex.current_line!=1)
-      debug_malloc_name(new_program, lex.current_file->str, lex.current_line);
+      debug_malloc_name(Pike_compiler->new_program, lex.current_file->str, lex.current_line);
 #endif
   }
   compilation_depth=0;
 
 /*  start_line_numbering(); */
 
-  compiler_pass=1;
+  Pike_compiler->compiler_pass=1;
   lex.pos=prog->str;
 
   CDFPRINTF((stderr, "compile(): First pass\n"));
@@ -3252,7 +3225,7 @@ struct program *compile(struct pike_string *prog,
     low_start_new_program(p,0,0,0);
     free_program(p);
     p=0;
-    compiler_pass=2;
+    Pike_compiler->compiler_pass=2;
     lex.pos=prog->str;
 
     use_module(sp-1);
@@ -3289,14 +3262,14 @@ struct program *compile(struct pike_string *prog,
 
 /*  unuse_modules(1); */
 #ifdef PIKE_DEBUG
-  if(num_used_modules)
+  if(Pike_compiler->num_used_modules)
     fatal("Failed to pop modules properly.\n");
 #endif
 
   toss_buffer(&used_modules);
   compilation_depth=save_depth;
   used_modules = used_modules_save;
-  num_used_modules = num_used_modules_save ;
+  Pike_compiler->num_used_modules = num_used_modules_save ;
   error_handler = saved_handler;
 #ifdef PIKE_DEBUG
   if (resolve_cache) fatal("resolve_cache not freed at end of compilation.\n");
@@ -3480,16 +3453,16 @@ void init_program(void)
     free_string(key.u.string);
   }
   start_new_program();
-  debug_malloc_touch(fake_object);
-  debug_malloc_touch(fake_object->storage);
+  debug_malloc_touch(Pike_compiler->fake_object);
+  debug_malloc_touch(Pike_compiler->fake_object->storage);
   ADD_STORAGE(struct pike_trampoline);
   add_function("`()",apply_trampoline,"function(mixed...:mixed)",0);
   set_init_callback(init_trampoline);
   set_exit_callback(exit_trampoline);
   set_gc_check_callback(gc_check_trampoline);
   set_gc_recurse_callback(gc_recurse_trampoline);
-  debug_malloc_touch(fake_object);
-  debug_malloc_touch(fake_object->storage);
+  debug_malloc_touch(Pike_compiler->fake_object);
+  debug_malloc_touch(Pike_compiler->fake_object->storage);
   pike_trampoline_program=end_program();
 }
 
@@ -3693,8 +3666,8 @@ unsigned gc_touch_all_programs(void)
   }
   /* Count the fake objects. They're not part of the gc, but they're
    * still counted by the gc. */
-  if (fake_object) n++;
-  for (ps = previous_program_state; ps; ps = ps->previous)
+  if (Pike_compiler->fake_object) n++;
+  for (ps = Pike_compiler->previous; ps; ps = ps->previous)
     if (ps->fake_object) n++;
   return n;
 }
@@ -3800,29 +3773,29 @@ void push_compiler_frame(int lexical_scope)
 {
   struct compiler_frame *f;
   f=ALLOC_STRUCT(compiler_frame);
+  f->previous=Pike_compiler->compiler_frame;
   f->lexical_scope=lexical_scope;
   f->current_type=0;
   f->current_return_type=0;
   f->current_number_of_locals=0;
   f->max_number_of_locals=0;
-  f->previous=compiler_frame;
   f->current_function_number=-2; /* no function */
   f->recur_label=-1;
   f->is_inline=0;
   f->num_args=-1;
-  compiler_frame=f;
+  Pike_compiler->compiler_frame=f;
 }
 
 void pop_local_variables(int level)
 {
-  while(compiler_frame->current_number_of_locals > level)
+  while(Pike_compiler->compiler_frame->current_number_of_locals > level)
   {
     int e;
-    e=--(compiler_frame->current_number_of_locals);
-    free_string(compiler_frame->variable[e].name);
-    free_string(compiler_frame->variable[e].type);
-    if(compiler_frame->variable[e].def)
-      free_node(compiler_frame->variable[e].def);
+    e=--(Pike_compiler->compiler_frame->current_number_of_locals);
+    free_string(Pike_compiler->compiler_frame->variable[e].name);
+    free_string(Pike_compiler->compiler_frame->variable[e].type);
+    if(Pike_compiler->compiler_frame->variable[e].def)
+      free_node(Pike_compiler->compiler_frame->variable[e].def);
   }
 }
 
@@ -3831,7 +3804,7 @@ void pop_compiler_frame(void)
 {
   struct compiler_frame *f;
   int e;
-  f=compiler_frame;
+  f=Pike_compiler->compiler_frame;
 #ifdef PIKE_DEBUG
   if(!f)
     fatal("Popping out of compiler frames\n");
@@ -3844,7 +3817,7 @@ void pop_compiler_frame(void)
   if(f->current_return_type)
     free_string(f->current_return_type);
 
-  compiler_frame=f->previous;
+  Pike_compiler->compiler_frame=f->previous;
   dmfree((char *)f);
 }
 
@@ -4006,7 +3979,7 @@ void yywarning(char *fmt, ...) ATTRIBUTE((format(printf,1,2)))
    * This has the additional benefit of making it easier to
    * visually locate the actual error message.
    */
-  if (num_parse_error) return;
+  if (Pike_compiler->num_parse_error) return;
 
   va_start(args,fmt);
   VSPRINTF(buf, fmt, args);
diff --git a/src/program.h b/src/program.h
index 9d61a5e04ced8894e6de955775c7c97fb833f1f8..826e4d68d00df6d4efbec4ce07a4e701a14a9221 100644
--- a/src/program.h
+++ b/src/program.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: program.h,v 1.91 2000/06/10 11:52:44 mast Exp $
+ * $Id: program.h,v 1.92 2000/06/24 00:48:13 hubbe Exp $
  */
 #ifndef PROGRAM_H
 #define PROGRAM_H
@@ -17,6 +17,14 @@
 #include "svalue.h"
 #include "time_stuff.h"
 
+
+#define STRUCT
+#include "compilation.h"
+
+#define EXTERN
+#include "compilation.h"
+
+
 #ifdef PIKE_DEBUG
 #define PROGRAM_LINE_ARGS int line, char *file
 #else
@@ -296,13 +304,7 @@ struct program
 
 extern struct object *error_handler;
 
-extern struct object *fake_object;
-extern struct program *new_program;
 extern struct program *first_program;
-extern int compiler_pass;
-extern long local_class_counter;
-extern int catch_level;
-extern INT32 num_used_modules;
 extern struct program *pike_trampoline_program;
 extern struct program *gc_internal_program;
 
@@ -518,12 +520,12 @@ void *parent_storage(int depth);
 
 #define START_NEW_PROGRAM_ID(ID) do { \
   start_new_program();  \
-  new_program->id=PIKE_CONCAT3(PROG_,ID,_ID); \
+  Pike_compiler->new_program->id=PIKE_CONCAT3(PROG_,ID,_ID); \
  }while(0)
 
 #ifdef DEBUG_MALLOC
 #define end_program() ((struct program *)debug_malloc_pass(debug_end_program()))
-#define end_class(NAME, FLAGS) (debug_malloc_touch(new_program), debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS))
+#define end_class(NAME, FLAGS) (debug_malloc_touch(Pike_compiler->new_program), debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS))
 #else
 #define end_class(NAME,FLAGS) debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS)
 #define end_program debug_end_program
@@ -541,5 +543,11 @@ void *parent_storage(int depth);
 #define gc_cycle_check_program_weak(X) \
   enqueue_lifo(&gc_mark_queue, (queue_call) real_gc_cycle_check_program_weak, (X))
 
+/* This can be used for backwards compatibility
+ *  (if added to program.h in Pike 0.6 and Pike 7.0
+ * -Hubbe
+ */
+#define Pike_new_program Pike_compiler->new_program
+
 
 #endif /* PROGRAM_H */
diff --git a/src/threads.c b/src/threads.c
index 1c02c7ef20209aba6822c93b6c869b1c6f0e9859..a387a95c09484300cca8668198c102c91dbf0fd6 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.129 2000/06/10 11:52:44 mast Exp $");
+RCSID("$Id: threads.c,v 1.130 2000/06/24 00:48:13 hubbe Exp $");
 
 int num_threads = 1;
 int threads_disabled = 0;
@@ -1231,7 +1231,7 @@ void th_init(void)
 	       mutex_key_offset + OFFSETOF(key_storage, owner), T_OBJECT);
   set_init_callback(init_mutex_key_obj);
   set_exit_callback(exit_mutex_key_obj);
-  mutex_key=new_program;
+  mutex_key=Pike_compiler->new_program;
   add_ref(mutex_key);
   end_class("mutex_key", 0);
   mutex_key->flags|=PROGRAM_DESTRUCT_IMMEDIATE;
@@ -1270,7 +1270,7 @@ void th_init(void)
     START_NEW_PROGRAM_ID(THREAD_DISABLE_THREADS);
     set_init_callback(init_threads_disable);
     set_exit_callback(exit_threads_disable);
-    tmp = new_program;
+    tmp = Pike_compiler->new_program;
     add_ref(tmp);
     end_class("threads_disabled", 0);
     tmp->flags|=PROGRAM_DESTRUCT_IMMEDIATE;
@@ -1284,7 +1284,7 @@ void th_init(void)
   ADD_FUNCTION("get",f_thread_local_get,tFunc(tNone,tMix),0);
   /* function(mixed:mixed) */
   ADD_FUNCTION("set",f_thread_local_set,tFunc(tMix,tMix),0);
-  thread_local_prog=new_program;
+  thread_local_prog=Pike_compiler->new_program;
   add_ref(thread_local_prog);
   end_class("thread_local", 0);
   if(!thread_local_prog)
@@ -1308,7 +1308,7 @@ void th_init(void)
   set_gc_check_callback(thread_was_checked);
   set_init_callback(init_thread_obj);
   set_exit_callback(exit_thread_obj);
-  thread_id_prog=new_program;
+  thread_id_prog=Pike_compiler->new_program;
   thread_id_prog->flags |= PROGRAM_NO_EXPLICIT_DESTRUCT;
   add_ref(thread_id_prog);
   end_class("thread_id", 0);