[comp.sys.att] KCL patches

alex@umbc3.UMD.EDU (Alex S. Crain) (01/03/89)

	Welp, I finally got around to fixing the known bugs in the port 
of KCL to the 3b1. The bugs are

	1) KCL can't read circular structures, repeat by

		>(defstruct a b)
		A

		>#0=#S(a b #0#)
	
		Error: #0# is undefined.
		Error signaled by SYSTEM:SHARP-S-READER.

		Broken at NIL.  Type :H for Help.
		>>

	2) printing bignums causes a value stack overflow, repeat by

		>123123123123123123123

		Error: Value Stack Overflow.
		Illegal instruction (core dumped)

Neither of these bugs in unique the the 3b1 port, although the latter is unique
to the 68000 assembly math code that the 3b1 was based on. The math pathes fix
both version of the code.

	following are diffs for 5 files:
		lsp/defstruct.lsp	}
		lsp/defstruct.c		} structure read
		lsp/iolib.lsp		}      bug
		lsp/iolib.c		}

		c/earith.c		  bignum bug

the patches to the .c files in the lsp directory fix the compiled lisp code,
so you don't have to recompile the sources (there probably isn't enough memory
anyway) so be sure to touch the .c .h and .data files for defstruct and iolib
so that the makefile won't invoke the lisp compiler.

					:alex
Alex Crain
Systems Programmer			alex@umbc3.umd.edu
Univ Md Baltimore County		nerwin!alex@umbc3.umd.edu

------------------------- snip, snip, snip -----------------------------------
*** defstruct.c	Sun Dec 25 23:23:05 1988
--- defstruct.c~	Thu Dec 29 19:51:41 1988
***************
*** 1328,1337
  	vs_top=sup;
  T648:;
  	base[4]= base[0];
! 	base[5]= Ct;
! 	base[6]= Cnil;
! 	base[7]= Ct;
! 	vs_top=(vs_base=base+4)+4;
  	Lread();
  	vs_top=sup;
  	base[3]= vs_base[0];

--- 1328,1334 -----
  	vs_top=sup;
  T648:;
  	base[4]= base[0];
! 	vs_top=(vs_base=base+4)+1
  	Lread();
  	vs_top=sup;
  	base[3]= vs_base[0];
*** iolib.c	Thu Dec 29 19:26:04 1988
--- iolib.c~	Thu Dec 29 19:23:38 1988
***************
*** 528,537
  	vs_top=sup;
  T171:;
  	base[4]= base[0];
! 	base[5]= Ct;
! 	base[6]= Cnil;
! 	base[7]= Ct;
! 	vs_top=(vs_base=base+4)+4;
  	Lread();
  	vs_top=sup;
  	base[3]= vs_base[0];

--- 528,534 -----
  	vs_top=sup;
  T171:;
  	base[4]= base[0];
! 	vs_top=(vs_base=base+4)+1;
  	Lread();
  	vs_top=sup;
  	base[3]= vs_base[0];
*** earith.c	Fri Dec 23 22:01:12 1988
--- earith.c~	Fri Dec 23 00:49:44 1988
***************
*** 510,516
  	asm("	addq.l	&1,%d2");
  	asm("	mov.w	&31,%d3");
  	asm("label2:	sub.l	%d0,%d1");
! 	asm("	bcc	label1");
  	asm("	add.l	%d0,%d1");
  	asm("label1:	roxl.l	&1,%d2");
  	asm("	roxl.l	&1,%d1");

--- 510,516 -----
  	asm("	addq.l	&1,%d2");
  	asm("	mov.w	&31,%d3");
  	asm("label2:	sub.l	%d0,%d1");
! 	asm("	bcs	label1");
  	asm("	add.l	%d0,%d1");
  	asm("label1:	roxl.l	&1,%d2");
  	asm("	roxl.l	&1,%d1");


*** defstruct.lsp	Mon Jan  2 18:53:04 1989
--- defstruct.lsp~	Mon Jan  2 18:48:12 1989
***************
*** 548,554
    (declare (ignore subchar))
    (when (and arg (null *read-suppress*))
          (error "An extra argument was supplied for the #S readmacro."))
!   (let ((l (read stream t nil t)))
      (unless (get (car l) 'is-a-structure)
              (error "~S is not a structure." (car l)))
      ;; Intern keywords in the keyword package.

--- 548,554 -----
    (declare (ignore subchar))
    (when (and arg (null *read-suppress*))
          (error "An extra argument was supplied for the #S readmacro."))
!   (let ((l (read stream)))
      (unless (get (car l) 'is-a-structure)
              (error "~S is not a structure." (car l)))
      ;; Intern keywords in the keyword package.
*** iolib.lsp	Mon Jan  2 18:52:43 1989
--- iolib.lsp~	Mon Jan  2 18:48:19 1989
***************
*** 126,132
  
  (defun sharp-a-reader (stream subchar arg)
    (declare (ignore subchar))
!   (let ((initial-contents (read stream t nil t)))
      (if *read-suppress*
          nil
          (do ((i 0 (1+ i))

--- 126,132 -----
  
  (defun sharp-a-reader (stream subchar arg)
    (declare (ignore subchar))
!   (let ((initial-contents (read stream)))
      (if *read-suppress*
          nil
          (do ((i 0 (1+ i))
-- 
					:alex
Alex Crain
Systems Programmer			alex@umbc3.umd.edu
Univ Md Baltimore County		nerwin!alex@umbc3.umd.edu