*** 3.1.2/interpret.c	Wed Feb 19 17:47:32 1992
--- interpret.c	Wed Mar 18 02:36:58 1992
***************
*** 3737,3742 ****
--- 3737,3744 ----
      extern int num_error;
      struct control_stack *save_csp;
      int ix;
+     char * funname;
+     extern char* findstring PROT((char*));
  
      ob->time_of_ref = current_time;	/* Used by the swapper */
      /*
***************
*** 3766,3771 ****
--- 3768,3774 ----
      if (ob->flags & O_DESTRUCTED)
  	fatal("apply() on destructed object\n");
  #endif
+ 
      ix = ( progp->id_number ^ (int)fun ^ ( (int)fun >> 6 ) ) & 0x3f;
      if (cache_id[ix] == progp->id_number && !strcmp(cache_name[ix], fun) &&
  	(!cache_progp[ix] || cache_progp[ix] == ob->prog)) {
***************
*** 3832,3883 ****
  	    free(cache_name[ix]);
  	}
  	cache_id[ix] = progp->id_number;
!         for(pr=progp->functions; pr < progp->functions + progp->num_functions;
!             pr++)
!         {
!             eval_cost++;
!             if (pr->name == 0 ||
!                 pr->name[0] != fun[0] ||
!                 strcmp(pr->name, fun) != 0 ||
!                 (pr->type & TYPE_MOD_PRIVATE))
!             {
!                 continue;
!             }
!             if (pr->flags & NAME_UNDEFINED)
!                 continue;
!             /* Static functions may not be called from outside. */
!             if ((pr->type & (TYPE_MOD_STATIC|TYPE_MOD_PRIVATE)) &&
! 		current_object != ob)
  	    {
!                 continue;
! 	    }
! 	    /* The searched function is found */
! 	    cache_pr[ix] = pr;
! 	    cache_name[ix] = pr->name;
! 	    push_control_stack(pr);
! 	    csp->num_local_variables = num_arg;
! 	    current_prog = progp;
! 	    pr = setup_new_frame(pr);
! 	    cache_pr_inherited[ix] = pr;
! 	    cache_progp[ix] = current_prog;
! 	    cache_variable_index_offset[ix] = variable_index_offset;
! 	    cache_function_index_offset[ix] = function_index_offset;
  #ifdef OLD_PREVIOUS_OBJECT_BEHAVIOUR
!             if (current_object != ob)
  #endif
!                 previous_ob = current_object;
!             current_object = ob;
!             save_csp = csp;
!             eval_instruction(current_prog->program + pr->offset);
  #ifdef DEBUG
!             if (save_csp-1 != csp)
!                 fatal("Bad csp after execution in apply_low\n");
  #endif
!             /*
!              * Arguments and local variables are now removed. One
!              * resulting value is always returned on the stack.
!              */
!             return 1;
  	}
  	/* We have to mark a function not to be in the object */
  	cache_name[ix] = string_copy(fun);
--- 3835,3888 ----
  	    free(cache_name[ix]);
  	}
  	cache_id[ix] = progp->id_number;
! 	if (funname = findstring(fun)) { /* If the name is amongst strings */
! 	    for(pr=progp->functions; pr < progp->functions + progp->num_functions;
! 		pr++)
  	    {
! 		eval_cost++;
! 		if (pr->name == 0 ||
! 		    /* Comparing pointers ok with unique strings */
! 		    pr->name != funname || 
! 		    (pr->type & TYPE_MOD_PRIVATE))
! 		    {
! 			continue;
! 		    }
! 		if (pr->flags & NAME_UNDEFINED)
! 		    continue;
! 		/* Static functions may not be called from outside. */
! 		if ((pr->type & (TYPE_MOD_STATIC|TYPE_MOD_PRIVATE)) &&
! 		    current_object != ob)
! 		    {
! 			continue;
! 		    }
! 		/* The searched function is found */
! 		cache_pr[ix] = pr;
! 		cache_name[ix] = pr->name;
! 		push_control_stack(pr);
! 		csp->num_local_variables = num_arg;
! 		current_prog = progp;
! 		pr = setup_new_frame(pr);
! 		cache_pr_inherited[ix] = pr;
! 		cache_progp[ix] = current_prog;
! 		cache_variable_index_offset[ix] = variable_index_offset;
! 		cache_function_index_offset[ix] = function_index_offset;
  #ifdef OLD_PREVIOUS_OBJECT_BEHAVIOUR
! 		if (current_object != ob)
  #endif
! 		    previous_ob = current_object;
! 		current_object = ob;
! 		save_csp = csp;
! 		eval_instruction(current_prog->program + pr->offset);
  #ifdef DEBUG
! 		if (save_csp-1 != csp)
! 		    fatal("Bad csp after execution in apply_low\n");
  #endif
! 		/*
! 		 * Arguments and local variables are now removed. One
! 		 * resulting value is always returned on the stack.
! 		 */
! 		return 1;
! 	    }
  	}
  	/* We have to mark a function not to be in the object */
  	cache_name[ix] = string_copy(fun);
*** 3.1.2/postlang.y	Sun Feb 23 14:31:15 1992
--- postlang.y	Wed Mar 18 02:38:19 1992
***************
*** 1335,1350 ****
  {
      struct variable *vp;
      int offset;
  
!     for (offset=0;
! 	 offset < mem_block[A_VARIABLES].current_size;
! 	 offset += sizeof (struct variable)) {
! 	vp = (struct variable *)&mem_block[A_VARIABLES].block[offset];
! 	if (vp->flags & NAME_HIDDEN)
! 	    continue;
! 	if (strcmp(vp->name, str) == 0)
! 	    return offset / sizeof (struct variable);
!     }
      return -1;
  }
  
--- 1335,1354 ----
  {
      struct variable *vp;
      int offset;
+     char * interned;
+     extern char* findstring PROT((char*));
  
!     if (interned = findstring(str)) /* Only search if amongst strings */
! 	for (offset=0;
! 	     offset < mem_block[A_VARIABLES].current_size;
! 	     offset += sizeof (struct variable)) {
! 	    vp = (struct variable *)&mem_block[A_VARIABLES].block[offset];
! 	    if (vp->flags & NAME_HIDDEN)
! 		continue;
! 	    /* Pointer comparison is possible since we use unique strings */
! 	    if (vp->name == interned)
! 		return offset / sizeof (struct variable);
! 	}
      return -1;
  }
  
*** 3.1.2/prelang.y	Sun Feb 23 14:17:36 1992
--- prelang.y	Wed Mar 18 02:40:57 1992
***************
*** 302,316 ****
  {
      int offset;
      struct function *funp;
  
!     for (offset = 0; offset < mem_block[A_FUNCTIONS].current_size;
! 	 offset += sizeof (struct function)) {
! 	funp = (struct function *)&mem_block[A_FUNCTIONS].block[offset];
! 	if (funp->flags & NAME_HIDDEN)
! 	    continue;
!         if (strcmp(funp->name, s) == 0)
! 	    return offset / sizeof (struct function);
!     }
      return -1;
  }
  
--- 302,320 ----
  {
      int offset;
      struct function *funp;
+     char *interned;
+     extern char * findstring PROT((char*));
  
!     if (interned = findstring(s)) /* Only search if amongst strings */
! 	for (offset = 0; offset < mem_block[A_FUNCTIONS].current_size;
! 	     offset += sizeof (struct function)) {
! 	    funp = (struct function *)&mem_block[A_FUNCTIONS].block[offset];
! 	    if (funp->flags & NAME_HIDDEN)
! 		continue;
! 	    /* Pointer comparison is possible since we use unique strings */
! 	    if (funp->name == interned) 
! 		return offset / sizeof (struct function);
! 	}
      return -1;
  }
  
***************
*** 367,372 ****
--- 371,378 ----
      struct inherit *ip;
      int num_inherits, super_length;
      char *real_name, *super_name = 0, *p;
+     char *interned;
+     extern char * findstring PROT((char*));
  
      real_name = funp->name;
      if (real_name[0] == ':')
***************
*** 379,407 ****
      num_inherits = mem_block[A_INHERITS].current_size /
  	sizeof (struct inherit);
      ip = (struct inherit *)mem_block[A_INHERITS].block;
!     for (; num_inherits > 0; ip++, num_inherits--) {
! 	if (super_name) {
! 	    int l = strlen(ip->prog->name);	/* Including .c */
! 	    if (l - 2 < super_length)
! 		continue;
! 	    if (strncmp(super_name, ip->prog->name + l - 2 - super_length,
! 			super_length) != 0)
! 		continue;
  	}
- 	for (i=0; i < ip->prog->num_functions; i++) {
- 	    if (ip->prog->functions[i].flags & (NAME_UNDEFINED|NAME_HIDDEN))
- 		continue;
- 	    if (strcmp(ip->prog->functions[i].name, real_name) != 0)
- 		continue;
- 	    funp->offset = ip - (struct inherit *)mem_block[A_INHERITS].block;
- 	    funp->flags = ip->prog->functions[i].flags | NAME_INHERITED;
- 	    funp->num_local = ip->prog->functions[i].num_local;
- 	    funp->num_arg = ip->prog->functions[i].num_arg;
- 	    funp->type = ip->prog->functions[i].type;
- 	    funp->function_index_offset = i;
- 	    return;
- 	}
-     }
      return;
  }
  
--- 385,415 ----
      num_inherits = mem_block[A_INHERITS].current_size /
  	sizeof (struct inherit);
      ip = (struct inherit *)mem_block[A_INHERITS].block;
!     if (interned = findstring(real_name)) /* Only search if amongst strings */
! 	for (; num_inherits > 0; ip++, num_inherits--) {
! 	    if (super_name) {
! 		int l = strlen(ip->prog->name);	/* Including .c */
! 		if (l - 2 < super_length)
! 		    continue;
! 		if (strncmp(super_name, ip->prog->name + l - 2 - super_length,
! 			    super_length) != 0)
! 		    continue;
! 	    }
! 	    for (i=0; i < ip->prog->num_functions; i++) {
! 		if (ip->prog->functions[i].flags & (NAME_UNDEFINED|NAME_HIDDEN))
! 		    continue;
! 		/* Pointer comparison possible since we use unique strings */
! 		if (ip->prog->functions[i].name != interned)
! 		    continue;
! 		funp->offset = ip - (struct inherit *)mem_block[A_INHERITS].block;
! 		funp->flags = ip->prog->functions[i].flags | NAME_INHERITED;
! 		funp->num_local = ip->prog->functions[i].num_local;
! 		funp->num_arg = ip->prog->functions[i].num_arg;
! 		funp->type = ip->prog->functions[i].type;
! 		funp->function_index_offset = i;
! 		return;
! 	    }
  	}
      return;
  }