THURSDAY  JAN 06,1977  FM+1D.23H.52M.11S.   LISP 1252  - GLS -

WELL, FOLKS, JONL HAS GONE TO IBM FOR SEVERAL MOONS, AND I AM WORKING
ON MY THESIS THIS SEMESTER (DUE IN MAY), SO DON'T EXPECT TO GET
NEW FEATURES IMPLEMENTED WITH BLINDING SPEED.  I WILL DO MY BEST TO
FIX ANY BUGS THAT CROP UP (IN PARTICULAR, I BELIEVE I HAVE FIXED
THE NEFARIOUS FASLOAD BUG OF VERSION 1251).  MOST OF THE ITEMS
BELOW ARE NOT BRAND NEW, BUT JUST THINGS THAT DIDN'T WORK UNTIL NOW
OR WERE NEVER DOCUMENTED PROPERLY.

AS USUAL, NUMBERS=ALL LISPS, LETTERS=NEWIO ONLY.

[1] PRINC NOW NO LONGER AUTO-TERPRI'S BEFORE ATOMS.
[2] NEW "EVALSHUNT" HACK FOR PECULIAR FORMS.
[3] GC NOW MARKS HUNKS MORE SPACE-EFFICIENTLY.
[4] HOW TO DEFINE NEW EDITOR COMMANDS.

[A] NEW FUNCTION: +TYO
[B] SEEING GC STATISTICS IN THE WHO-LINE.
----------------------------------------------------------------
[1] PRINC NOW NO LONGER ATTEMPTS TO GET IN A TERPRI BEFORE AN
    ATOM IF NECESSARY.  (IT DOES, HOWEVER, PROVIDE A TERPRI ON
    REACHING THE LINEL UNLESS OTHERWISE OVERRIDDEN BY THE VALUE OF
    TERPRI OR BY (SSTATUS TERPRI ...).)  PRIN1 CONTINUES TO PUT
    IN AUTO-TERPRI'S BEFORE ATOMS.

[2] WHEN EVAL COMES UPON A FORM WHOSE CAR IS NON-ATOMIC AND
    WHOSE CAAR IS NOT LAMBDA, FUNARG, OR LABEL, AND IF THE
    VALUE OF THE ATOM EVAL IS NON-NIL, THEN THIS VALUE
    SHOULD BE A FUNCTION OF ONE ARGUMENT, AND IT IS CALLED ON THE
    FORM.  IT IS THE RESPONSIBILITY OF THE FUNCTION TO EVALUATE THE
    FORM AND DELIVER AN APPROPRIATE VALUE.  THIS IS KNOWN AS THE
    "EVALSHUNT" KLUDGE.

[3] GC NOW TAKES MUCH LESS PDL TO MARK HUNKS.  IF YOU HAVE GOTTEN
    PDL OVERFLOW DURING GC WHILE USING HUNKS, THIS SHOULD ALLEVIATE
    YOUR PROBLEM.

[4] IF EDIT READS A COMMAND WHOSE NAME IS NOT RECOGNIZED, THEN IF THE
    ATOM OF THAT NAME HAS AN EDIT PROPERTY, THEN THAT PROPERTY SHOULD
    BE A FUNCTION.  IT WILL BE CALLED WITH THE REPEAT COUNT AS AN ARGUMENT
    (0 IS SUPPLIED IF NO ARGUMENT IS GIVEN).  THE FUNCTION MAY
    DO ANYTHING IT LIKES, BUT WILL PROBABLY WANT TO OPERATE ON THE
    FUNCTION BEING EDITED.  THE EDITOR'S CURSOR IS REPRESENTED BY
    TWO DATA STRUCTURES, THE "LEFT-LIST" AND THE "UP-LIST".
    THE FORMER SAYS HOW TO BACK UP AT THE CURRENT LEVEL OF LIST;
    THE LATTER SAYS HOW TO BACK UP A LEVEL OF LIST STRUCTURE.
    THE LEFT-LIST IS THE VALUE OF THE ATOM  (THREE ALTMODES),
    AND THE UP-LIST IS THE VALUE OF THE ATOM ^^^ (THREE UPARROWS OR
    CIRCUMFLEXES, ASCII 136).
    THE CAR OF THE LEFT-LIST IS THE LEVEL OF LIST STRUCTURE BEING
    EDITED; THE CURSOR IS CONSIDERED TO BE BEFORE THE CAAR
    OF THE LEFT-LIST.  THE CDR OF THE LEFT-LIST IS THE LEFT-LIST
    FOR THE PREVIOUS POINT IN THIS LEVEL OF LIST.  THE UP-LIST
    IS A STACK OF OLD LEFT-LISTS.
    THE FOLLOWING FUNCTIONS ARE USEFUL UTILITIES FOR BUILDING
    NEW EDITOR FUNCTIONS, AND ILLUSTRATE THE CORRECT WAY TO MANIPULATE
    THE LEFT-LIST AND UP-LIST.
	(DEFUN RIGHT () (AND (EDCAR) (SETQ  (CONS (CDAR ) ))))
	(DEFUN LEFT () (AND  (CDR ) (SETQ  (CDR ))))
	(DEFUN DOWN () (AND (EDCAAR)
			    (SETQ ^^^ (CONS  ^^^)  (NCONS (CAAR )))))
	(DEFUN UP () (AND ^^^ (CAR ^^^) (CDR ^^^)
			  (SETQ  (CAR ^^^) ^^^ (CDR ^^^))))
	(DEFUN YANK (FN)
	       ((LAMBDA (PL)
			(COND (PL (SETQ ^^^ NIL)
				  (SETQ  (NCONS PL)))
			      (T (PRINC '|??|))))
		(GETL FN EDIT)))
	(DEFUN SPLICE (IT)
	       (COND ((AND (LEFT) (EDCAR))
		      (RPLACD (CAR ) IT)
		      (RIGHT))
		     ((AND (UP) (EDCAR))
		      (RPLACA (CAR ) IT)
		      (DOWN))))
	(DEFUN KILL ()
	       (PROG2 NIL (CAAR )
		      (SPLICE (COND ((EDCAR) (CDAR )) (T (CAR ))))))
	(DEFUN INSERT (IT)
	       (SPLICE (CONS IT (AND  (CAR ))))
	       (RIGHT))

	(DEFUN EDCAR () (AND  (NOT (ATOM (CAR )))))
	(DEFUN EDCAAR () (AND (EDCAR) (NOT (ATOM (CAAR )))))

    NOTICE THAT LEFT AND RIGHT AND UP AND DOWN RETURN NIL
    IF THEY FAIL.  KILL RETURNS THE THING KILLED (THE STANDARD
    EDITOR COMMAND "K" PUTS THIS THING INTO THE VALUE CELL OF "".)
    AS TWO EXAMPLES OF NEW EDITOR COMMANDS, CONSIDER
    "XCH" (NOTE THAT NAMES OF EDITOR COMMANDS MUST BE THREE CHARACTERS OR
    FEWER), WHICH TRANSPOSES THE NEXT TWO ITEMS AFTER THE CURSOR,
    AND "BRY", WHICH BURIES THE NEXT THING IN <ARGUMENT> LEVELS
    OF LIST STRUCTURE.

	(DEFPROP XCH ED-EXCHANGE EDIT)
	(DEFUN ED-EXCHANGE (N)		       ;ARGUMENT IS IGNORED
	       (INSERT (PROG2 NIL (KILL) (RIGHT))))

	(DEFPROP BRY ED-BURY EDIT)
	(DEFUN ED-BURY (N)
	       (AND (EDCAR)
		    (DO ((I (MAX N 1) (- I 1)))
			((ZEROP I))
			(SPLICE (RPLACA (CAR ) (NCONS (CAAR )))))))

    I HAVE TESTED THESE DEFINITIONS AND THEY SEEM TO WORK.

[A] THE NEW FUNCTION +TYO OF TWO ARGUMENTS IS A SUPER-FAST TYO.
    THE FIRST ARGUMENT IS THE ASCII VALUE TO OUTPUT AND THE
    SECOND IS THE FILE TO OUTPUT IT ON.  THE ATOM "T" MAY NOT
    BE USED AS A SECOND ARGUMENT; INSTEAD OF (+TYO 43 T), SAY
    (+TYO 43 TYO) OR THE EQUIVALENT.  ALSO, THE SECOND ARGUMENT
    MUST BE A SINGLE FILE, NOT A LIST OF FILES.  THE +TYO FUNCTION
    DOES NO ARGUMENT CHECKING IF NOT IN *RSET MODE.
    IT DOES NOT ATTEMPT TO UPDATE THE CHARPOS OF THE FILE, OR
    SUPPLY AN AUTO-TERPRI FOR EXCEEDING THE LINEL.  IT DOES CHECK
    FOR NON-IMAGE-MODE TTY FILES AND IN THAT CASE CONVERT ^P AND ^C
    TO ^P P AND ^P Q.  IT ALSO UPDATES THE FILEPOS CORRECTLY.

[B] NEWIO HAS HAD FOR SOME TIME STATUS CALLS FOR MANIPULATING THE
    WHO-LINE; THESE WERE DESCRIBED PREVIOUSLY IN LISP ARCHIV.
    NOW A NEW STATUS CALL CONTROLS THE DISPLAY OF GC STATISTICS IN
    THE WHO-LINE.
	(STATUS GCWHO) RETURNS THE CURRENT GCWHO STATUS AS A FIXNUM.
	(SSTATUS GCWHO <N>) SETS THE STATUS TO THE FIXNUM <N>.
    RIGHT NOW ONLY THE 1 AND 2 BITS OF THE STATUS ARE SIGNIFICANT.
    1 MEANS THAT DURING A GC, THE WHO-LINE SHOULD BE ALTERED TO
    READ "GC:XXXXX" WHERE XXXXX IS THE REASON FOR THE GC.
    AT THE END OF THE GARBAGE COLLECTION THE WHO-LINE IS RESTORED.
    2 MEANS THAT AT THE END OF THE GC THE .WHO2 WORD SHOULD
    BE CLOBBERED WITH GC RUN TIME INFORMATION.  SPECIFICALLY,
    THE LEFT HALF GETS THE PERCENTAGE OF RUN TIME WHICH HAS BEEN
    SPENT IN GC, AND THE RIGHT HALF GETS THE GC RUN TIME IN FORTIETHS
    OF A SECOND.  IF THE FIRST TWO ARGUMENTS TO (SSTATUS WHO1 ...)
    ARE 52 OCTAL AND '%, THEN THESE STATISTICS WILL BE PRINTED
    IN THE FORM "NNN% HH:MM:DD.T", JUST LIKE THE STANDARD SYSTEM
    RUNTIME PERCENTAGE AND VALUE.  IN THIS WAY ONE CAN CONTINUOUSLY
    MONITOR GC RUN TIME STATISTICS.  THE 1 AND 2 BITS MAY BE USED
    TOGETHER (3) OR INDEPENDENTLY.  NOTE THAT WHILE USING THE 2 BIT
    THE .WHO3 VARIABLE IS STILL LEFT OVER FOR USE BY THE USER.
    THUS ONE MIGHT SAY:
	(SSTATUS WHO1 52 '% 166 0)
	(SSTATUS GCWHO 3)
	(SSTATUS WHO3 'QUUX)
    AND ONE WOULD NORMALLY SEE "43% 00:15:07.8 QUUX", BUT DURING
    A GC ONE WOULD SEE "GC:FIXNUM" OR WHATEVER.
    A NOTE FOR THOSE WHO USE SUSPEND:  IF THE SUSPENDED JOB IS DUMPED
    OUT AND LATER RELOADED, THE RUNTIME (MAINTAINED BY THE TIME-SHARING
    SYSTEM) WILL HAVE BEEN RESET, BUT NOT THE GCTIME, WHICH IS MAINTAINED
    BY LISP.  THEREFORE A ROUTINE WHICH DOES A SUSPEND SHOULD PERFORM
    (SSTATUS GCTIME 0) ON RETURN FROM THE SUSPEND IN ORDER TO MAKE
    THE WHO-LINE AND OTHER GC STATISTICS ACCURATE.