3/17/72 - JONL - THE MAJOR NEW FEATURE OF LISP 229W IS THE USAGE OF THE DISPLAY SLAVE THAT IRA, JERRY LERMAN AND I HAVE BEEN WORKING ON. SINCE THE DESCRIPTION OF ITS USAGE IT QUITE LENGTHY, IT IS RESERVED FOR LAST IN THIS NOTE. FLOATING POINT OUTPUT IS NOW MUCH MORE READABLE - LISP HAS IMPROVED CONVERSION ROUTINES THAT ACTUALLY ROUND TO 8. SIGNIFICANT DECIMAL DIGITS, RATHER THAN TRUNCATING AS MOST OTHER PDP10 SYSTEMS PROGRAMS DO [THAT IS WHY .1 PRINTS OUT AT YOU AS 0.09999999]. ALSO, CALCULATION OF POWER-OF-TEN MULTIPLIERS IS DONE IN DOUBLE-PRECISION FLOATING-POINT TO INSURE THAT THE READ-IN PHASE GETS THE BEST 27.-BIT APPROXIMATION TO THE MANTISSA OF THE NUMBER, AND THAT THE PRINT-OUT PHASE DOES NOT LOSE ANY BITS IN THE NORMALIZATION PHASE: NORMALIZES TO INTERVAL [1.0 10.0) ALL FLOATING POINT NUMBERS EXCEPT THOSE IN THE RANGE (.099999999 99999999.5], AND WHEN NORMALIZED PRINTS THE EXPONENT PRECEEDED BY "E". AN EXPANDED FORM THE MULTIPLE-INDEX DO HAS BEEN ADDED TO THE SYSTEM (DO INDEXLIST (ENDTEST RETURNVALUE) DOBODY) THE ITEMS OF AN INDEXLIST MAY BE OF FORMS: (X XINIT XSTEPPER) WHERE X IS INITIALIZED TO XINIT AND MODIFIED AFTER EACH PASS THROUGH DOBODY BY (SETQ X XSTEPPER) (X XINIT) X IS INITIALIZED TO XINIT, AND MAY BE USED LIKE A PROG VAR (X) LIKE (X NIL) AN ALTERNATE FORM FOR (ENDTEST RETURNVALUE) IS (ENDTEST), WHICH IS TAKEN TO BE (ENDTEST NIL). CAREFUL ABOUT PARENTHESES - AN ENDTEST OF (NULL X) IN THIS ABBREVIATED FORMAT WOULD LOOK LIKE, FOR EXAMPLE, (DO ((X LONGLIST (CDR X)) (N 5 (SUB1 N)) (FLAG)) ((NULL L)) (COND ((EQ (CAR L) 'FOO) (SETQ FLAG T)) (((EQ (CAR L) 'BAR) (SETQ FLAG N)))) (INFORM (CAR L) FLAG) (INFORM 'GAG FLAG)) THE ORIGINAL DO FORMAT - (DO X XINIT XSTEPPER ENDTEST DOBODY) - IS STILL APPLICABLE, AND FOR THE NEXT FEW WEEKS, THE COMPLR WILL NOT HANDLE THE NEW MULTIPLE FORMAT. *********** THIRD DO FORMAT INSTALLED 10/15/73 ********* BACKTRACE NOW WORKS MUCH BETTER, AND OMITS ALL THAT GARBAGE, OFTEN SEEN WHEN AN ERROR OCCURS, ABOUT THE *RSET EXPR. THE FORMAT IS ALSO A LITTLE DIFFERENT IN THAT AN ENTRY TO FUNCTION FOO WILL BE PRINTED OUT AS FOO_ AND IF BAR IS CALLING FUNCTION FOO, THE PRINT-OUT WILL BE FOO_BAR. IN GENERAL, PROGS AND CONDS ARE NO LONGER LISTED TWICE FOR EACH ENTRY. REMINDER! BACKTRACE IS NOT AUTOMATICALLY INVOKED UPON AN ERROR, SO THE BEST WAY TO USE IT IS TO HAVE THE *RSET SWITCH SET TO T, AND WHEN AN ERROR OCCURS, DO (BAKTRACE). IF YOUR ERROR IS BEING CAUGHT AN STOPPED BY AN ERRSET, TRY SETTING USER INTERRUPT NUMBER 4, WHICH WILL BE EXECUTED JUST AS AN ERROR IS BEING CAUGHT BY AN ERRSET. TYPICAL USAGE WOULD BE (SSTATUS INTERR 4 '(LAMBDA (FOO) (BREAK ERSTBREAK T))) SPEAKING OF USER INTERRUPTS, NUMBER 9. WILL SERVICE A WRONG NUMBER OF ARGUMENTS CAUGHT BY THE INTERPRETER.(CONTRARY TO A PREVIOUS NOTE, THE FUNCTION CALLED WHEN AN ERROR CAUSES RESTORATION TO TOP LEVEL, I.E., THE *RSET FUNCTION, IS STORED IN INTERRUPT NUMBER 19.) AS ARGUMENT IT WILL BE HANDED A TWO-LIST INDICATING THE FUNCTION ABOUT TO BE APPLIED AND THE ARGUMENTS ACTUALLY PASSED ALONG, AND THE LAMBDA LIST OF THE FUNCTION. FOR EXAMPLE ((FOO V1 V2 ) (X Y Z)) SHOWS THAT FOO WAS BEING CALLED AND THE VALUES [REPEAT! VALUES] OF THE ARGUMENTS TO FOO WERE V1 AND V2; ALSO, THE LAMBDA LIST OF FOO IS (X Y Z) [CURRENTLY, THE INTERPRETER DOES NOT CATCH CALLS TO SUBRS WHERE THE NUMBER OF ARGUMENTS IS WRONG]. SINCE A TYPICAL SERVICE FUNCTION MIGHT BE (LAMBDA (ARGLOSS) (BREAK WNA T)), THE USER, AFTER INSPECTING ARGLOSS, MIGHT TYPE (RETURN '((FOO 'V1 'V2 35.))) REMEMBERING THAT BREAK, UPON READING A RETURN, WILL ITSELF RETURN THAT VALUE. AS BEFORE, IF THE SERVICE FUNCTION RETURNS A NON-NIL VALUE, IT IS PRESUMED TO BE A LIST OF THE CORRECTED FORM; IN THIS CASE, THE EVALUATION OF (FOO . . .) WILL BE RESTARTED AND REPLACED BY (FOO 'V1 'V2 35.) THE FAMOUS PSEUDO VIDISSECTOR IS WORKING WELL, AND IS INITIALIZED BY (SSTATUS FTV FN1 FN2 DEV USR), IN ORDER TO USE THAT FILE OF CANNED VIDI SCENES. NVFIX AND NVID WILL THEN OBTAIN THEIR VALUES FROM THERE RATHER THAN FROM THE REAL VIDISSECTOR. GIVING NVFIX A NEGATIVE FIRST ARGUMENT WILL ALLOW ACCESS OF CERTAIN HEADER INFORMATION STORED WITH THE PICTURE ARRAY, THE SECOND ARGUMENT SPECIFYING WHICH: (NVFIX -1 0) => (XLL . YLL) (NVFIX -1 1) => (XUR . YUR) (NVFIX -1 2) => (DCO . CONF) ASK JERRY LERMAN FOR MORE INFORMATION IF YOU ARE INTERESTED. TYPEP IS A NEW SUBR THAT RETURNS ONE OF LIST FIXNUM FLONUM BIGNUM PNAME RANDOM DEPENDING UPON WHAT THE TYPE OF THE ARGUMENT IS; NIL IS OF TYPE PNAME AS WELL AS TYPE LIST, SO IT IS ARBITRARILY GIVEN TYPE PNAME HERE; ANY DOTTED PAIR, AND NOT JUST PROPER LISTS, IS GIVEN VALUE LIST. MAKNUM IS NOW AN LSUBR, WITH (MAKNUM FOO) BEING EQUIVALENT TO (MAKNUM FOO 'FIXNUM) (SSTATUS DIVOV T) WILL ENABLE A DIVIDE OVERFLO IN THE FUNCTION QUOTIENT TO RETURN THE NUMERATOR WITH ITS MAGNITUDE INCREASED BY ONE (RATHER THAN CREATING AN ARITHMETIC OVERFLOW ERROR). MORE REMINDERS OF THINGS ALREADY KNOWN: (1) IF AN ITEM IN A LIST TO MAKNAM OR READLIST IS A NUMBER INSTEAD OF A PNAME-TYPE ATOM, IT IS TREATED AS THE SINGLE CHARACTER ATOM WHOSE ASCII CHARACTER VALUE IS THAT NUMBER. THUS (READLIST '(101 102)) RETURNS AB . (2) INFINITE PRECISION FIXNUM ARITHMETIC WORKS WELL IN BNLISP - SOME HAVE SUGGESTED MAKING THIS THE STANDARD LISP. IF ANYONE OBJECTS TO THE EXTRA BLOCK OF PURE CODE THAT THIS WOULD REQUIRE, OR TO THE LOSS OF ERROR MESSAGES ON ARITHMETIC OVERFLOWS, OR TO THE EPSILON TIME LOSS REQUIRED FOR ADDITIONAL INTERPRETATION, PLEASE LEAVE ME A NOTE [DO :MAIL JONL I OBJECT ETC.<CONTROL-C>] PERHAPS IT IS REDUNDANT TO SAY, BUT CODE COMPILED BY THE UPCOMING FAST-NUMBER COMPILER WILL NOT MAKE USE OF THE INFINITE PRECISION SUBROUTINES. INSTEAD WE AIM ONLY FOR ONE-HALF FORTRAN SPEED ON FORTRAN-LIKE PROBLEMS ENCODED IN MACLISP. PLANS FOR THE FUTURE: SUPER-FAST ARRAY ACCESSING, LIKE FORTRAN ALMOST, AND THE EXTENSION OF THE FAST-NUMBER COMPLR TO HANDLE THEM. A COMPATIBLE VERSION OF MACLISP [EXCEPT FOR UNUSUAL I/O DEVICES] LIVES ON THE BBN TENEX SYSTEM; SOME GROUP AT UNIV. OF MICH. HAS IMPLEMENTED A MACLISP ON A 360. WORK IS AFOOT TO OBTAIN A COMPATIBLE MACLISP ON MULTICS [THEY SAY, TOO, THAT WORK IS AFOOT TO MAKE MULTICS COMPATIBLE WITH REAL TIME]. THE VERSION RUNNING ON THE MATHLAB SYSTEM MAY BE THE FIRST TO HAVE A DYNAMICALLY EXPANDABLE FREE STORAGE, BUT THIS IS MANY MONTHS IN THE FUTURE. IN ORDER TO USE THE SLAVE, IT IS NECESSARY TO HAVE AVAILABLE THE PDP6. SOON WE WILL HAVE A VERSION THAT WILL ALSO RUN ON THE 10 UNDER ITS, AT PERHAPS SOME DEGRADATION IN PERFORMANCE (BOTH OF THE SLAVE AND ITS). THE PDP6 SHOULD BE IN THE RUNNING STATE, AND IF SIMPLY HITTING THE START SWITCH DOESN'T KEEP THE RUN LIGHT ON, DEPOSIT ZEROS INTO LOCATIONS 40 AND 41 AND START UP AT 40 THE REMAINDER OF THIS DESCRIPTION OF LISP FUNCTIONS FOR THE NEW PDP6 DISPLAY SLAVE USES THE FOLLOWING CONVENTIONS: X, Y ARE ASSUMED TO BE INTEGER ARGUMENTS TO LINE DRAWING, POINT INSERTING, AND OTHER SUCH FUNCTIONS N IS A FIXED-POINT NUMERICAL ARGUMENT DESCRIBED UNDER PARTICULAR FUNCTIONS ITEM IS ASSUMED TO BE THE NUMERICAL INDEX OF SOME DISPLAY SLAVE ITEM. IT IS A QUANTITY SUCH AS IS RETURNED BY DISCREATE. BRITE EACH ITEM HAS A BRIGHTNESS LEVEL ASSOCIATED WITH IT, RANGEING BETWEEN 1 AND 8. DEFAULT VALUE = 8. SCALE EACH ITEM HAS A SCALE, OR MAGNIFICATION, FACTOR ASSOCIATED WITH IT, RANGEING BETWEEN 1 AND 4. DEFAULT, AND NORMAL, IS 1; 2 DOUBLES THE LENGTH OF DRAWN LINES AND TEXT, 3 QUADRUPLES AND 4 MULTIPLYS BY 8. TEXT LOOKS MUCH NICER IF IT IS DRAWN WITH A LITTLE MAGNIFICATION; GENERALLY 2 IS APPROPRIATE. FLAG IS AN INDICATOR TELLING WHETHER A GIVEN ACTION IS TO BE DONE [ON NON-NIL] OR UNDONE BSL IS EITHER NIL, IN WHICH CASE THERE IS NO CHANGE, OR IS A LIST LIKE (BRITE SCALE) INDICATING A SETTING OF LEVELS FOR A GIVEN ACTION 121. A WELL-KNOWN INTEGER, EASILY RECOGNIZED TO BE THE SQUARE OF THE FIFTH PRIME, BUT NOT SO EASILY SEEN AS SUCH WHEN EXPRESSED IN OCTAL AS 171 - THUS WE USE OCTAL NOTATION EXCEPT WHEN THE STRING OF DIGITS IS FOLLOWED BY A . EACH ITEM HAS ASSOCIATED WITH IT VARIABLES DETERMINING THE BRIGHTNESS, SCALE, AND VISIBILITY OF POINT AND LINE INSERTION REQUESTS; LIKE THE LOGO TURTLE, WE THINK OF THE ITEM AS HAVING A PEN WHICH CAN BE "DOWN" SO THAT A LINE IS VISIBLE WHEN THE TURTLE IS REQUESTED TO GO FROM ONE PLACE TO ANOTHER, OR "UP" SO THAT NO MARK IS SEEN. FOR THE COMMANDS TO AFFECT BRIGHTNESS, SCALE, OR THE PENUP STATUS, 0 GENERALLY MEANS NO CHANGE. COMMANDS WHICH TAKE AN OPTIONAL BSL ARGUMENT - NAMELY DISAPOINT, DISCUSS, AND DISALINE - WILL TREAT IT AS A TEMPORARY SETTING FOR THESE VALUES, AND UPON EXIT WILL RESTORE THESE VARIABLES TO THEIR VALUES PRIOR TO THE CALL. SIMILARLY, THE OPTIONAL PENUP ARGUMENT TO DISALINE IS TREATED AS TEMPORARY. ARGUMENTS THAT ARE INTENDED TO SPECIFY LOCATIONS ON THE 340 SCREEN FOR THE FUNCTIONS DISALINE, DISAPOINT, AND DISCUSS, ARE INTERPRETED IN ONE OF FOUR WAYS DEPENDING ON THE SETTING OF THE SLAVE VARIABLE "ASTATE": 0 RELATIVE MODE - THE POINT SPECIFIED IS IN RELATION TO THE HOME OF THE ITEM ON WHICH THE COMMAND IS ACTING. 1 ABSOLUTE MODE - X AND Y ARE DIRECTLY INTERPRETED IN THE CO-ORDINATES OF THE 340 SCREEN, MOD 1024., WITH THE LOWER-LEFT CORNER BEING [0,0] 2 INCREMENTAL MODE - THE POINT SPECIFIED IS IN RELATION TO THE CURRENT POSITION OF THE PEN OF THE ITEM ON WHICH THE COMMAND IS ACTING. 3 POLAR MODE - LIKE INCREMENTAL, BUT THE ARGUMENTS, WHICH MUST BE FLOATING POINT, ARE CONSIDERED AS THE RADIUS AND ANGLE FOR A POLAR COORDINATE SYSTEM CENTERED ABOUT THE CURRENT PENPOSITION (WITH ZERO DEGREES BEING HORIZONTAL TO THE RIGHT). TO EMPHASIZE THE ASTATE MAPPING OF THESE ARGUMENTS, WE WILL WRITE ASTATE[X,Y] TO MEAN THE POINT SPECIFIED BY X AND Y. N.B.: FUNCTIONS LIKE DISCREATE, DISLOCATE, AND DISMOTION, WHICH PLACE FOR AN ITEM'S HOME IN SOME SPECIFIED LOCATION, ALWAYS INTERPRET THE SPECIFICATION IN ABSOLUTE MODE. TYPICAL CALLS FUNCTION TYPE EXPLANATION (DISCREATE X Y) LSUBR CREATE A DISPLAY ITEM WITH HOME AT (DISCREATE) [X,Y] ON THE 340 SCREEN. DEFAULT OPTION IS TO PLACE HOME AT [0,0] IF X AND Y NOT GIVEN. RETURNS ITEM NUMBER OF NEWLY CREATED ITEM. (DISINI) LSUBR SEIZE AND INITIALIZE SLAVE. IF USER ALREADY HAS SLAVE, THEN REINITIALIZE, AND SET ASTATE TO GIVEN ARGUMENT. ALWAYS RETURNS PREVIOUS VALUE OF ASTATE, BUT NO ARG GIVEN, OR ARG NOT AMONG 0,1,2,3 MAKES NO CHANGE IN ASTATE. INITIAL ASTATE = 0. (DISPLAY ITEM FLAG) SUBR ITEM ON OR OFF DISPLAY - I.E. MAKE VISIBLE ON SCREEN OR NOT. DISCREATE, DISCOPY, AND DISGOBBLE PLACE THEIR ITEMS ON DISPLAY, EVEN WHEN NULL. WHEN OFF DISPLAY, THE ITEM IS STILL REMEMBERED BY THE SLAVE UNTIL FLUSHED (DISFLUSH) LSUBR NO ARG GIVEN MEANS FLUSH WHOLE SLAVE (DISFLUSH ITEM1 . . . ITEMN) OTHERWISE SIMPLY KILL ITEMS. (DISLOCATE ITEM X Y) SUBR MOVE ITEM'S HOME TO LOCATION [X,Y] (DISBLINK ITEM FLAG) SUBR SELF EXPLANATORY (DISCOPY ITEM) SUBR MAKE A COPY OF ITEM, AS A NEW ITEM WITH HOME AT SAME LOCATION. RETURN NEW ITEM NUMBER. (DISMARK ITEM N) SUBR IF N=0, REMOVE MARKER FROM ITEM. IF N<0, INSERT STANDARD MARKER IF N> , USE ITEM WITH #N AS MARKER (DISCRIBE ITEM) SUBR GET LIST OF (XHOME,YHOME,XPENPOS, YPENPOS,BRITE,SCALE,PENUP,MARKER) FROM ITEM (DISCHANGE ITEM BRITE SCALE) SUBR BRITE AND SCALE ARE INCREMENTS TO BE ADDED TO THE PARTS OF ITEM (DISLINK ITEM1 ITEM2 FLAG) SUBR LINK OR UNLINK ITEM1 TO ITEM2 ITEM2 IS THE "INFERIOR" OF ITEM1, AND WILL BE DISLOCATED, DCHANGED, DISBLINKED, AND DISPLAYED AS A SUBPART OF ITEM1 WHENEVER THESE OPERATIONS ARE PERFORMED ON ITEM1. (DISLIST) LSUBR RETURN LIST OF ALL ITEMS ON DISPLAY (DISLIST ITEM) RETURN LIST OF ALL INFERIORS OF ITEM (DISET ITEM N BSL) SUBR SETS THE DEFAULT VALUES FOR PENUP, BIRGHTNESS, AND SCALE PARAMETERS FOR THE ITEM. IF N IS -1, PUT PEN DOWN; IF +1, LIFT UP PEN; IF 0, LEAVE PEN ALONE. SET BRITE AND SCALE FROM BSL [FOR MEANING OF BSL, SEE CONVENTIONS DISCUSSED ABOVE] WHEN CREATED, THE ITEM'S DEFAULTS ARE: PEN IS DOWN, BRIGHTNESS IS 8., AND SCALE IS 1. (DISALINE ITEM X Y) (DISALINE ITEM X Y N) (DISALINE ITEM X Y BSL) (DISALINE ITEM X Y BSL N) LSUBR SET PENUP AND BSL AS INDICATED BY N AND BSL (SEE DISET ABOVE), THEN GO FROM CURRENT PEN POSITION TO ASTATE[X,Y], LEAVING A VISIBLE LINE ONLY IF THE PEN IS DOWN, AND THEN RESTORE THE PENUP AND BSL PARAMETERS (DISAPOINT ITEM X Y) (DISAPOINT ITEM X Y BSL) LSUBR DISPLAY A POINT AT ASTATE[X,Y]. DOES AFFECT ITEM'S PENUP OR BSL PARAMETERS (DISCUSS ITEM X Y TEXT) (DISCUSS ITEM X Y TEXT BSL) LSUBR THE CHARACTERS OF THE VALUE OF TEXT ARE INSERTED, AS IF PRINC'ED, INTO THE INTO ITEM BEGINNING AT POINT ASTATE[X,Y]. NO CHANGE IN ITEM'S PENUP AND BSL PARAMETERS. (DISMOTION ITEM X Y SPD) SUBR CAUSES ITEM TO BE SLOWLY DISLOCATED SO THAT IT'S HOME IS AT [X,Y]. IF EITHER X OR Y IS NEGATIVE THEN PLACES ITEM UNDER CONTROL OF SPACE WAR CONSOLE 1. THE BUTTON RETURNS CONTROL TO THE TTY. SPD IS AN INVERSE MEASURE OF THE SPEED AT WHICH THE ITEM WILL MOVE. SPD = 0 IS MAXIMUM. NOTE WELL: ALTHOUGH THE SPACE-WAR CONSOLE CONTROL WILL WORK FOR ANY DISPLAY ITEM, THE AUTOMATIC SLOW MOTION WILL CURRENTLY WORK ONLY FOR ITEMS CONSISTING SOLELY OF LINES DRAWN BY DISALINE. (DISGORGE ITEM) SUBR CREATES A (GENSYM'D) LISP ARRAY AND FILLS IT WITH THE 340 CODE FROM ITEM. (DISGOBBLE ARRAYNAM) SUBR TAKES THE ENTRIES OF THE LISP ARRAY ARRAYNAM AND CREATES A DISPLAY SLAVE ITEM WITH THOSE ENTRIES. EXAMPLES A SUBROUTINE TO DRAW A LIGHT BOX WITH A MEDIUM POINT INSIDE IT AT THE CENTER OF THE SCREEN, RETURNING A DESCRIPTION OF THE SLAVE ITEM: ((LAMBDA (OASTATE B) (DISALINE B -100 -100 1) ;GO TO LOWER-LEFT CORNER (DISET B 0 (LIST 3 BOXSCL)) ;GLOBAL VARIABLE FOR SCALE, ;NO CHANGE TO PENUP STATUS (DISALINE B 0 200) (DISALINE B 200 0) ;SEE HOW EASY IT IS IN (DISALINE B 0 -200) ;INCREMENTAL MODE! (DISALINE B -200 0) (DISINI 0) ;BUT EASIER TO PUT IN POINT (DISAPOINT B 0 0 '(6 0)) ;IN RELATIVE MODE. NOTE THAT ;SCALE IS NOT USED HERE (DISINI OASTATE) ;RESTORE ASTATE (DISCRIBE B)) (DISINI 2) (DISCREATE 1000 1000)) ;CREATES B, HOME AT CENTER TO ADD SOME TEXT ON THE TOP OF THE BOX, ASSUMING ASTATE=0 AND THAT B'S VALUE IS THE NUMBER OF THE ABOVE ITEM: (DISCUSS B -200 207 '(HERE IS THE BOX - SEE THE BOX) '(6 2)) TO MOVE THE BOX B RIGHT 100 UNITS: (SETQ FOO (DISCRIBE B)) (SETQ FOO (LIST (CAR FOO) (CADR FOO))) (DISLOCATE B (+ 100 (CAR FOO)) (CADR FOO)) TO PUT A CROSS WHERE THE PEN IS NOW, AND SOME TEXT WHERE IT USED TO BE BEFORE THE MOVE: (DISMARK B -1) (DISCUSS B (CADDR FOO) (CADDDR FOO) '(TURTLE SLEPT HERE)) TO BRIGHTEN UP THE BOX AND POINT [BUT THE TEXT "(TURTLE SLEPT HERE)" WAS ALREADY IN BRIGHTEST MODE, SO IT REMAINS UNCHANGED]: (DISCHANGE B 2 0) TO FLUSH THE BOX: (DISFLUSH B) TO FLUSH ALL ITEMS ON THE LIST L: (APPLY 'DISFLUSH L) TO GIVE UP THE SLAVE: (DISFLUSH)