[net.sources] vc bug fix

afs@bunkerb.UUCP (Andrew F. Seirup) (01/18/85)

   This is the first of three context diff postings.  Each is on a different
file and for a different purpose, so it made sense to keep them separate.

   The following context diff fixes a bug that effected the ^J command (copy
row).  If a region expression was copied, the bounds of the region would get
garbage values, which might or might not cause a core dump on evaluation.

   By the way, when you've got vc reasonably bug free, you might want to 
remove '-g' from the CFLAGS variable in the makefile, so you're not carrying
around the debugging symbol table (big) in the final executable.


Andrew Seirup - Bunker Ramo, Trumbull CT - (203)386-2086 
uucp address:  {decvax|ittvax}!bunker!afs


*** interp.c	Fri Jan 18 09:06:04 1985
--- interp.new	Thu Jan 17 15:04:44 1985
***************
*** 362,368
      if (e==0) ret = 0;
      else {
  	ret = (struct enode *) malloc (sizeof (struct enode));
! 	*ret = *e;
  	switch (ret->op) {
  	case 'v':
  		ret->e.v = lookat (ret->e.v->row+Rdelta, ret->e.v->col+Cdelta);

--- 362,368 -----
      if (e==0) ret = 0;
      else {
  	ret = (struct enode *) malloc (sizeof (struct enode));
! 	ret->op = e->op;
  	switch (ret->op) {
  	case 'v':
  		ret->e.v = lookat (e->e.v->row+Rdelta, e->e.v->col+Cdelta);
***************
*** 365,371
  	*ret = *e;
  	switch (ret->op) {
  	case 'v':
! 		ret->e.v = lookat (ret->e.v->row+Rdelta, ret->e.v->col+Cdelta);
  		break;
  	case 'k':
  		break;

--- 365,371 -----
  	ret->op = e->op;
  	switch (ret->op) {
  	case 'v':
! 		ret->e.v = lookat (e->e.v->row+Rdelta, e->e.v->col+Cdelta);
  		break;
  	case 'k':
  		break;
***************
*** 370,376
  	case 'k':
  		break;
  	case 'f':
! 		ret->e.o.right = copye (ret->e.o.right,0,0);
  		break;
  	default:
  		ret->e.o.right = copye (ret->e.o.right,Rdelta,Cdelta);

--- 370,376 -----
  	case 'k':
  		break;
  	case 'f':
! 		ret->e.o.right = copye (e->e.o.right,0,0);
  		break;
  	case O_REDUCE('+'):
  		(struct ent *) ret->e.o.left =
***************
*** 372,377
  	case 'f':
  		ret->e.o.right = copye (ret->e.o.right,0,0);
  		break;
  	default:
  		ret->e.o.right = copye (ret->e.o.right,Rdelta,Cdelta);
  		ret->e.o.left = copye (ret->e.o.left,Rdelta,Cdelta);

--- 372,391 -----
  	case 'f':
  		ret->e.o.right = copye (e->e.o.right,0,0);
  		break;
+ 	case O_REDUCE('+'):
+ 		(struct ent *) ret->e.o.left =
+ 				(struct ent *) malloc (sizeof (struct ent));
+ 		(struct ent *) ret->e.o.right =
+ 				(struct ent *) malloc (sizeof (struct ent));
+ 		((struct ent *) ret->e.o.left) -> row =
+ 				((struct ent *) e->e.o.left) -> row + Rdelta;
+ 		((struct ent *) ret->e.o.left) -> col =
+ 				((struct ent *) e->e.o.left) -> col + Cdelta;
+ 		((struct ent *) ret->e.o.right) -> row =
+ 				((struct ent *) e->e.o.right) -> row + Rdelta;
+ 		((struct ent *) ret->e.o.right) -> col =
+ 				((struct ent *) e->e.o.right) -> col + Cdelta;
+ 		break;
  	default:
  		ret->e.o.right = copye (e->e.o.right,Rdelta,Cdelta);
  		ret->e.o.left = copye (e->e.o.left,Rdelta,Cdelta);
***************
*** 373,380
  		ret->e.o.right = copye (ret->e.o.right,0,0);
  		break;
  	default:
! 		ret->e.o.right = copye (ret->e.o.right,Rdelta,Cdelta);
! 		ret->e.o.left = copye (ret->e.o.left,Rdelta,Cdelta);
  		break;
  	}
      }

--- 387,394 -----
  				((struct ent *) e->e.o.right) -> col + Cdelta;
  		break;
  	default:
! 		ret->e.o.right = copye (e->e.o.right,Rdelta,Cdelta);
! 		ret->e.o.left = copye (e->e.o.left,Rdelta,Cdelta);
  		break;
  	}
      }