Patch for Elk 1.2

Oliver Laumann net at opal.cs.tu-berlin.de
Wed Nov 14 03:48:13 AEST 1990


The following patch fixes two bugs in the implementation of the
fluid-let special form in Elk 1.2.  You can apply the patch by
invoking "patch -p patchfile" in the top level directory of the
Elk distribution.

--
    Oliver Laumann, Technical University of Berlin, Germany.
    pyramid!tub!net   net at TUB.BITNET   net at tub.cs.tu-berlin.de



*** /tmp/,RCSt1010213	Mon Nov 12 11:28:07 1990
--- src/cont.c	Mon Nov 12 11:26:56 1990
***************
*** 168,174
  }
  
  Do_Wind (w) Object w; {
!     Object b, sym, val;
  
      if (TYPE(w) == T_Pair) {
  	b = Lookup_Symbol (Car (w), 0);

--- 168,174 -----
  }
  
  Do_Wind (w) Object w; {
!     Object oldenv, b, tmp;
  
      if (TYPE(w) == T_Vector) {          /* fluid-let */
  	oldenv = The_Environment;
***************
*** 170,177
  Do_Wind (w) Object w; {
      Object b, sym, val;
  
!     if (TYPE(w) == T_Pair) {
! 	b = Lookup_Symbol (Car (w), 0);
  	if (Nullp (b))
  	    Panic ("fluid-let2");
  	sym = Car (b);

--- 170,179 -----
  Do_Wind (w) Object w; {
      Object oldenv, b, tmp;
  
!     if (TYPE(w) == T_Vector) {          /* fluid-let */
! 	oldenv = The_Environment;
! 	Switch_Environment (VECTOR(w)->data[1]);
! 	b = Lookup_Symbol (VECTOR(w)->data[0]);
  	if (Nullp (b))
  	    Panic ("fluid-let");
  	tmp = VECTOR(w)->data[2];
***************
*** 173,184
      if (TYPE(w) == T_Pair) {
  	b = Lookup_Symbol (Car (w), 0);
  	if (Nullp (b))
! 	    Panic ("fluid-let2");
! 	sym = Car (b);
! 	val = Cdr (w);
! 	Cdr (b) = val;
! 	SYMBOL(sym)->value = val;
!     } else {
  	(void)Funcall (w, Null, 0);
      }
  }

--- 175,188 -----
  	Switch_Environment (VECTOR(w)->data[1]);
  	b = Lookup_Symbol (VECTOR(w)->data[0]);
  	if (Nullp (b))
! 	    Panic ("fluid-let");
! 	tmp = VECTOR(w)->data[2];
! 	VECTOR(w)->data[2] = Cdr (b);
! 	Cdr (b) = tmp;
! 	SYMBOL(Car (b))->value = tmp;
! 	VECTOR(w)->data[1] = oldenv;
! 	Switch_Environment (oldenv);
!     } else {                            /* dynamic-wind */
  	(void)Funcall (w, Null, 0);
      }
  }
*** /tmp/,RCSt1010234	Mon Nov 12 11:28:27 1990
--- src/special.c	Mon Nov 12 11:27:11 1990
***************
*** 454,461
  	b = Lookup_Symbol (sym, 1);
  	Alloca (w, WIND*, sizeof (WIND));
  	{
! 	    Object in, out;
! 	    GC_Node2;
  
  	    in = out = Null;
  	    GC_Link2 (in, out);

--- 454,460 -----
  	b = Lookup_Symbol (sym, 1);
  	Alloca (w, WIND*, sizeof (WIND));
  	{
! 	    Object vec;
  
  	    vec = Make_Vector (3, Null);
  	    VECTOR(vec)->data[0] = sym;
***************
*** 457,468
  	    Object in, out;
  	    GC_Node2;
  
! 	    in = out = Null;
! 	    GC_Link2 (in, out);
! 	    in = Cons (sym, val);
! 	    out = Cons (sym, Cdr (b));
! 	    Add_Wind (w, in, out);
! 	    GC_Unlink;
  	}
  	Cdr (b) = val;
  	SYMBOL(sym)->value = val;

--- 456,466 -----
  	{
  	    Object vec;
  
! 	    vec = Make_Vector (3, Null);
! 	    VECTOR(vec)->data[0] = sym;
! 	    VECTOR(vec)->data[1] = The_Environment;
! 	    VECTOR(vec)->data[2] = Cdr (b);
! 	    Add_Wind (w, vec, vec);
  	}
  	Cdr (b) = val;
  	SYMBOL(sym)->value = val;
***************
*** 468,482
  	SYMBOL(sym)->value = val;
      }
      ret = Begin (Cdr (argl));
!     for (w = Last_Wind; w != last; w = w->prev) {
! 	b = Cdr (w->inout);
! 	sym = Car (b); val = Cdr (b);
! 	b = Lookup_Symbol (sym, 0);
! 	if (Nullp (b))
! 	    Panic ("fluid-let1");
! 	Cdr (b) = val;
! 	SYMBOL(sym)->value = val;
!     }
      if (Last_Wind = last)
  	last->next = 0;
      First_Wind = first;

--- 466,473 -----
  	SYMBOL(sym)->value = val;
      }
      ret = Begin (Cdr (argl));
!     for (w = Last_Wind; w != last; w = w->prev)
! 	Do_Wind (Car (w->inout));
      if (Last_Wind = last)
  	last->next = 0;
      First_Wind = first;



More information about the Comp.sources.bugs mailing list