FRIDAY APRIL 18,1975 FQ+9H.34M.47S. LISP 1049 - GLS - A NEW VERSION OF NEWIO IS UP! TRY IT, AND REPORT ANY LOSSES TO GLS, OR SAY :BUG NEWIO ... ^C TO DDT. BRIEF SYNOPSIS: [0] INCOMPATIBLE CHANGE!!! PRINT, PRIN1, AND PRINC TO GIVE OUT T [1] COMPILER RESETS GENSYM COUNTER [2] DEFUN MAY REMOVE THE EXPR-HASH PROPERTY [3] VERTICAL BAR AND EXCLAMATION POINT AS SYMBOL QUOTERS [4] NEW PECULIAR FUNCTION: SYSCALL [5] COMPILER ALLOWS DECLARES IN DO LOOPS [6] TECHNIQUE: AVOIDING NUMBER CONSING [7] EVALHOOK [8] NEW VERSION OF NEWIO OUT [A] TYIPEEK NOW IMPLEMENTED [B] ^Q TO ALLOC AND JCL WORK [C] (STATUS FILEMODE) [D] (STATUS TTYINT) [E] (STATUS TTYCONS) [F] (STATUS TTYSCAN) [G] RUBOUT [H] NEW INTERRUPT SYSTEM [I] VALUE OF AUTOLOAD IS THE AUTOLOAD FUNCTION [J] **MORE** INTERRUPTS [K] FASLOAD WITHIN FASLOAD [L] ^X FUNCTION FLUSHED - ^G REMAINS [M] FORCE IS FORCE-OUTPUT AGAIN [N] CLEAR-INPUT AND CLEAR-OUTPUT ---------------------------------------------------------------- [0] A GHOST OF THE PAST LOOMS UP. WHEN NCOMPLR WAS CREATED, WE MADE SOME DECISIONS THAT, FOR EFFICIENCY REASONS, REQUIRED TYO, PRINT, PRIN1, AND PRINC TO RETURN SOME PROVABLY NON-NUMERIC VALUE. GENERALLY, THIS MEANS SOME CONSTANT LIKE T OR NIL. TYO WAS CHANGED LONG AGO, BUT WE HAVE BEEN WAITING UNTIL THE LAST POSSIBLE MINUTE TO MAKE THE REQUISITE CHANGE TO THE PRINT SERIES. THE TIME HAS COME (AND WE HEAR VOICES OF WALRUSES); OUR SYMPATHIES GO OUT TO THOSE, WHO LIKE US, WILL HAVE TO EXPLORE THEIR CODE TO ACCOMODATE THIS INCOMPATIBLE CHANGE. HOWEVER, THIS CHANGE WILL NOT ACTUALLY TAKE EFFECT UNTIL AFTER MAY 19, 1975. IF THE ONLY USE YOUR EVER MADE OF THE VALUE OR PRINT WAS TO CONTINUE AN "AND", YOU NEED NOT WORRY. E.G. (AND (PRED X) (PRINC 'HERE/ WE/ ARE/ ) (PRINT X) (PRINT Y)) WILL STILL WORK ESSENTIALLY THE SAME. BE WARNED ALSO! THE OLD COMPLR IS ESSENTIALLY DEAD; THERE WILL BE A FUNERAL FOR IT SOON. NCOMPLR IS NOW QUITE A BIT MORE BUG-FREE THAN THE OLD COMPLR, AND AFTER COMPLR'S DEMISE, SYS:TS COMPLR WILL LINK TO SYS:TS NCOMPLR. [1] NOTE THAT THE COMPILER USES THE GENSYM FUNCTION FOR GENERATING LAP TAGS, AND RESETS THE GENSYM COUNTER AT THE BEGINNING OF EACH FUNCTION. THEREFORE GENSYM IS NOT A RELIABLE WAY TO GENERATE UNIQUE ATOMS FOR USE BY MACROS IF YOU PLAN TO INTERN THEM (UNINTERNED, THE NAME DOESN'T MATTER, OF COURSE). SORRY ABOUT THAT. [2] DEFUN WILL REMOVE THE EXPR-HASH PROPERTY FROM AN ATOM IF IN EXPR-HASH MODE (DEFUN = T) AND IT INSTALLS A NEW PROPERTY. THIS IS TO PREVENT LOSSES SUCH AS RE-INSTALLING THE OLD DEFINITION NOT WORKING. [3] VERTICAL BAR (ASCII CODE 174) NOW INITIALLY HAS A READ-MACRO PROPERTY WHICH CAUSES IT TO GOBBLE UP CHARACTERS UNTIL THE NEXT VERTICAL BAR, AND MAKE AN INTERNED ATOMIC SYMBOL OUT OF IT. IT IS THUS ANOTHER WAY TO QUOTE CHARACTERS IN ATOMIC SYMBOLS. TO GET A VERTICAL BAR OR CARRIAGE RETURN OR SLASH INTO SUCH A CONSTRUCT, USE SLASH. EXAMPLE: |A /| WILL GOBBLE CHARS UNTIL THE NEXT /| NOT PRECEDED BY //| IS THE ATOMIC SYMBOL WITH THE PRINT NAME: "A | WILL GOBBLE CHARS UNTIL THE NEXT | NOT PRECEDED BY /" THE CARRIAGE RETURN ISN(T PART OF THE PRINT NAME BECAUSE IT HAD NO / IN FRONT OF IT. THIS IS SO AN AUTOMATIC TERPRI FORCED BY THE LINEL WON'T SCREW THINGS UP. AS A CONCESSION TO DATAPOINT LOSERS, EXCLAMATION POINT PRESENTLY HAS A SIMLAR PROPERTY. HOWEVER, LOSERS ARE ADVISED NOT TO PUT ! IN THEIR FILES, AS VERTICAL BAR IS THE "OFFICIAL" ONE. USERS OF CONNIVER ON DATAPOINTS HAVE A PROBLEM -- TOUGH NOOGIES. EVENTUALLY PRIN1 WILL HAVE SOME SMARTS ABOUT OUTPUTTING VERTICAL BARS. IN NEWIO, THE RUBOUT PROCESSOR IS CLEVER ABOUT VERTICAL BARS, BUT NOT IN OLDIO -- BEWARE. [4] THE FUNCTION SYSCALL TAKES FROM TWO TO TEN ARGUMENTS. THEY ARE: (1) N, THE NUMBER OF OUTPUT RESULTS DESIRED (A FIXNUM FROM 0 TO 8); THE RETURN VALUE OF SYSCALL WILL THUS BE A LIST OF N FIXNUMS. OPTIONALLY, THE "CONTROL" BITS "C" MAY BE SPECIFIED BY GIVING AS FIRST ARG N + LSH[C;18.] (2) NAME OF SYSTEM CALL (ATOMIC SYMBOL). (3-10) INPUT ARGUMENTS (FIXNUMS). THE SPECIFIED ITS SYSTEM CALL IS PERFORMED AND A LIST OF THE RESULTS ARE RETURNED AS FIXNUMS. IF AN ERROR OCCURS, A FIXNUM (THE ERROR CODE) IS RETURNED INSTEAD OF THE LIST OF RESULTS. NO COMPENSATION IS MADE FOR SYSTEM CALLS THAT TAKE CHANNEL NUMEBSR, AOBJN POINTERS, CLOBBER THEIR INPUT ARGS, ETC. BEWARE! EXAMPLE: (SYSCALL 6 'CNSGET 2) WILL RETURN A LIST OF SIX FIXNUMS DESCRIBING THE TTY (OLDIO OPENS THE TTY ON CHANNEL 2 -- NEWIO USERS, BEWARE!!!). [5] THE COMPILER NOW ALLOWS LOCAL DECLARATIONS TO BE PUT IN DO LOOPS IN THE SAME WAY THEY MAY BE IN LAMBDAS AND PROGS. EXAMPLE, TO FIND THE INDEX OF THE FIRST "FOO" IN THE LIST X: (DO ((N 0 (1+ N)) (L X (CDR L))) ((NULL L) -1) (DECLARE (FIXNUM N)) (AND (EQ (CAR L) 'FOO) (RETURN N))) [6] PROGRAMMING TECHNIQUE: YOU MAY FIND YOUR FUNCTIONS DOING AN INORDINATE AMOUNT OF NUMBER CONSING EVEN AFTER USING NCOMPLR. IF SO, CONSIDER WHETHER ANY OF YOUR FUNCTIONS, WHICH ARE NOT DECLARED TO BE FIXNUM OR FLONUM FUNCTIONS ARE NEEDLESSLY RETURNING NUMERICAL RESULTS. E.G., (DEFUN BAR (X Y N M) (COND ((MUMBLE X Y) (PRINC '/ANSWERS/ ARE:) (PRIN1 N) (PRINC '/ ) (PRIN1 M) (TERPRI))) N) ;RANDOM RETURN VALUE IF BAR IS INDEED USED PRIMARILY FOR EFFECT, THERE IS NO REASON TO RETURN A NUMERICAL VALUE, WHICH WILL USUALLY CAUSE NCOMPLR TO OUTPUT A NUMBER-CONS CALL. SOMETIMES, RETURNING A NUMERICAL RESULT MAY BE PARTIALLY HIDDEN FROM YOUR EYE, AS IN THE CASE OF FEEDING AN ARG TO A FUNCTION SUCH AS STORE, WHICH RETURNS ONE OF ITS INPUT ARGS AS RESULTANT VALUE E.G., (DEFUN FOO (J N) (STORE (MY-FIXNUM-ARRAY N) J)) THIS WILL STORE THE FIXNUM J INTO SLOT N, AND IT WILL ALSO RETURN J. UNLESS YOU REALLY NEED FOO TO RETURN J, YOU SHOULD WRITE (DEFUN FOO (J N) (STORE (MY-FIXNUM-ARRAY N) J) NIL) AND LET NIL BE RETURNED. THIS APPLIES TO ANY FUNCTION WHOSE LAST ACTION WILL PRODUCE A NUMERICAL VALUE, AND WHOSE PURPOSE IS PRIMARILY TO PERFORM SOME SIDE-EFFECT. [7] AT LONG LAST, HERE IS SOME (MINIMAL) DOCUMENTATION ON THE INFAMOUS EVALHOOK FEATURE! THE EVALHOOK FEATURE WAS INVENTED SO THAT A DYNAMIC SINGLE-STEP TRACER COULD BE WRITTEN. USING THE EVALHOOK FEATURE IS A BLACK ART, SO READ ON, BUT CAREFULLY. THERE EXIST BOTH A FUNCTION AND A VARIABLE CALLED "EVALHOOK". THERE IS ALSO A (SSTATUS EVALHOOK). ((STATUS EVALHOOK) EXISTS BUT DOES NOT RETURN ANYTHING MEANINGFUL AT ALL.) THE SEMANTICS OF THE VARIABLE EVALHOOK ARE AS FOLLOWS: WHENEVER THE FUNCTION EVAL IS ENTERED, WHETHER FROM WITHIN THE SYSTEM OR BY EXPLICIT INVOCATION BY THE USER, THEN IF THE VALUE OF THE VARIABLE EVALHOOK IS NON-NIL, AND *RSET IS NON-NIL, AND (SSTATUS EVALHOOK T) HAS BEEN DONE, THEN EVAL DOES NOT EVALUATE ITS ARGUMENT. INSTEAD IT ASSUMES THAT THE VALUE OF THE VARIABLE EVALHOOK IS A FUNCTION OF ONE ARGUMENT. IT FETCHES THIS FUNCTION, LAMBDA-BINDS EVALHOOK TO NIL, AND CALLS THE FUNCTION WITH THE ARGUMENT TO EVAL. THIS FUNCTION THEN HAS THE RESPONSIBILITY FOR EVALUATING THE FORM AND RETURNING A RESULT. THIS RESULT BECOMES THE RESULT OF THE ORIGINAL CALL TO EVAL. IT IS EVIDENT THAT SUCH A FUNCTION CAN DO OTHER THINGS BESIDES EVALUATE THE FORM; E.G. IT CAN PRINT TRACE INFORMATION. THE REASON THAT EVALHOOK IS BOUND BACK TO NIL BEFORE CALLING THE HOOK FUNCTION IS BECAUSE THE HOOK FUNCTION MAY BE INTERPRETED, AND WE WANT TO AVOID INFINITE RECURSION. THERE IS A PROBLEM, THOUGH: HOW CAN THE HOOK FUNCTION EVALUATE ITS ARGUMENT ONCE IT HAS PRINTED STUFF OUT? IF IT JUST CALLS EVAL BACK AGAIN, THEN THE VARIABLE EVALHOOK WILL BE NIL, AND THE HOOK FUNCTION WILL NOT GET CALLED FOR THE RECURSIVE CALLS ON EVAL. IF IT SETQ'S EVALHOOK TO THE HOOK FUNCTION AND THEN CALLS EVAL, THE HOOK FUNCTION WILL GET CALLED BACK WITH THE SAME THING. FOR THIS REASON THERE IS AN EVALHOOK FUNCTION. THE EVALHOOK FUNCTION CALLS EVAL WITH ITS FIRST ARGUMENT, AFTER BINDING THE VARIABLE EVALHOOK TO ITS LAST ARGUMENT, AND BYPASSING THE HOOK FUNCTION CHECK IN EVAL. IF THAT ALL WENT BY TOO FAST, TAKE A LOOK AT THESE DEFINITIONS IN LISP: (DECLARE (SPECIAL *RSET EVALHOOK)) (DEFUN EVAL N (OR (= N 1) (= N 2) (ERROR '|WRONG NUMBER OF ARGS TO LSUBR| (CONS 'EVAL (LISTIFY N)) 'WRNG-NO-ARGS)) (AND (= N 2) (HACK-FAKE-ALIST (ARG 2))) (COND ((AND EVALHOOK *RSET (SSTATUS-EVALHOOK-T-WAS-DONE-P)) ((LAMBDA (EVALHOOK) (FUNCALL EVALHOOK (ARG 1))) NIL)) (T (+INTERNAL-EVAL (ARG 1))))) (DEFUN EVALHOOK N (OR (= N 2) (= N 3) (ERROR '|WRONG NUMBER OF ARGS TO LSUBR| (CONS 'EVALHOOK (LISTIFY N)) 'WRNG-NO-ARGS)) (AND (= N 3) ;SECOND ARG OF 3 IS ALIST (HACK-FAKE-ALIST (ARG 2))) ((LAMBDA (EVALHOOK) (+INTERNAL-EVAL (ARG 1))) (ARG N))) THE REASON THAT BOTH (*RSET T) AND (SSTATUS EVALHOOK T) MUST BE DONE IS FOR REASONS OF EFFICIENCY (SIGH). HERE IS AN EXAMPLE OF THE USAGE OF EVALHOOK: (DEFUN HOOK FEXPR (X) ;CALLED AS (HOOK <FORM>) ((LAMBDA (*RSET EVALHOOK) (PROG2 (SSTATUS EVALHOOK T) ;MAGIC SSTATUS (EVAL (CAR X)) ;EVALUATE FORM (SSTATUS EVALHOOK NIL))) ;MORE MAGIC T 'HOOK-FUNCTION)) ;THE HOOK FUNCTION (DEFUN HOOK-FUNCTION (F) (TERPRI) ;PRINT PRETTY MESSAGE FOR INPUT (PRINC '|FORM: |) (PRIN1 F) ((LAMBDA (V) ;V GETS VALUE OF FORM (TERPRI) ;PRETTY OUTPUT MESSAGE (PRINC '|VALUE: |) (PRIN1 V)) (EVALHOOK F 'HOOK-FUNCTION))) ;THIS IS HOW TO EVAL THE FORM ; SO AS TO HOOK SUB-FORMS THUS FOR SOMETHING LIKE (HOOK (CONS (CAR '(A . B)) 'C)) THE FOLLOWING OUTPUT MIGHT BE SEEN: FORM: (CONS (CAR (QUOTE (A . B))) (QUOTE C)) FORM: (CAR (QUOTE (A . B))) FORM: (QUOTE (A . B)) VALUE: (A . B) FORM: (QUOTE C) VALUE: C VALUE: ((A . B) . C) ((A . B) . C) NATURALLY, ONE CAN DREAM UP INFINITELY HAIRY THINGS TO DO WITH THIS, SUCH AS INTERACTIVE TRACING AND BREAKING, INDENTED OUTPUT, ETC. [8] A NEW VERSION OF NEWIO IS OUT! HERE FOLLOWS A COPY OF .INFO.;NEWIO STUFF, WHICH HAS BEEN UPDATED TO ACCOUNT FOR ALL THE CHANGES MENTIONED IN THE SYNOPSIS. NEWIO NEWIO NEWIO NEWIO NEWIO NEWIO NEWIO NEWIO NEWIO NEWIO ---------------------------------------------------------------- THINGS OF NOTE NOT YET IMPLEMENTED: ---------------------------------------------------------------- [1] FILEPOS NOT YET IMPLEMENTED. [2] ALLFILES NOT YET IMPLEMENTED. [3] MOBY I/O DOES NOT YET WORK UNDER NEW I/O. ---------------------------------------------------------------- NEW FUNCTIONS: ---------------------------------------------------------------- (^G) SIGNALS A ^G QUIT; IT REPLACES (IOC G). (IN <FILE>) READS IN A FIXNUM FROM A BINARY INPUT FILE AND RETURNS IT. TO GET A BINARY FILE, SEE THE NEW OPEN FUNCTION. (OUT <FILE> <FIXNUM>) OUTPUTS THE FIXNUM TO THE BINARY FILE AND RETURNS T. (TRUENAME <FILE>) GIVES THE "TRUE NAME" OF THE FILE, AS OPPOSED TO THE FILE NAMES USED TO OPEN IT. THIS IS THE NAME FOUND AFTER TRANSLATIONS AND LINKS, ETC. (IT IS THE NAME RETURNED BY A .RCHST ON THE FILE'S CHANNEL.) ECHOFILES IS A VARIABLE WHICH, IF NON-NIL, SHOULD BE A LIST OF OUTPUT FILES. THESE OUTPUT FILES RECEIVE EVERY CHARACTER SEEN AS INPUT BY TYI (AND FUNCTIONS WHICH USE TYI, SUCH AS READ). IF A FILE IS A MEMBER OF BOTH THE ECHOFILES AND OUTFILES LISTS, IT WILL BE A "DRIBBLE FILE", RECORDING BOTH INPUT AND OUTPUT. NOTE THAT THE FUNCTION WHICH PRE-SCANS TTY INPUT AND PERFORMS RUBOUT PROCESSING LAMBDA-BINDS ECHOFILES TO NIL, SO YOU WON'T SEE RUBBED-OUT CHARACTERS. (OPEN <FILE> <MODELIST>) OPENS A FILE AND RETURNS A CORRESPONDING FILE OBJECT. IT IS ACTUALLY AN LSUBR OF ZERO TO TWO ARGUMENTS. THE <FILE> DEFAULTS TO THE CURRENT DEFAULT FILE NAMES. THE <MODELIST> DEFAULTS TO NIL. IF <FILE> IS A NAMELIST OR NAMESTRING, A NEW FILE ARRAY IS CREATED. IF <FILE> IS A FILE ARRAY ALREADY, IT IS CLOSED AND RE-OPENED IN THE SPECIFIED MODE; ITS FORMER MODES SERVE AS THE DEFAULTS FOR THE <MODELIST>. THE <MODELIST> DETERMINES A LARGE NUMBER OF ATTRIBUTES FOR OPENING THE FILE. FOR EACH ATTRIBUTE THERE ARE TWO OR MORE MUTUALLY EXCLUSIVE VALUES WHICH MAY BE SPECIFIED AS FOLLOWS. VALUES MARKED BY A * ARE THOSE USED AS DEFAULTS WHEN THE <FILE> IS A NAMELIST OR NAMESTRING. IF THE <MODELIST> IS AN ATOM, IT IS THE SAME AS SPECIFYING THE LIST OF THAT ONE ATOM. DIRECTION: * IN INPUT FILE * READ SAME AS "IN" OUT OUTPUT FILE PRINT SAME AS "OUT" APPEND OUTPUT, APPENDED TO EXISTING FILE DATA MODE: * ASCII FILE IS A STREAM OF ASCII CHARACTERS. SYSTEM-DEPENDENT TRANSFORMATIONS MAY OCCUR, SUCH AS SUPPLYING LF AFTER CR, OR BEING CAREFUL WITH OUTPUT OF ^P, OR MULTICS ESCAPE CONVENTIONS. FIXNUM FILE IS A STREAM OF FIXNUMS. THIS IS FOR DEALING WITH FILES THOUGHT OF AS "BINARY" RATHER THAN "CHARACTER". IMAGE FILE IS A STREAM OF ASCII CHARACTERS. ABSOLUTELY NO TRANSFORMATIONS ARE MADE. DEVICE TYPE: * DSK STANDARD KIND OF FILE. TTY CONSOLE. IN PARTICULAR, ONLY TTY INPUT FILES HAVE INTERRUPT CHARACTER FUNCTIONS ASSOCIATED WITH THEM. BUFFERING MODE: * BLOCK DATA IS BUFFERED. SINGLE DATA IS UNBUFFERED. IF THE DEVICE TYPE IS TTY, THE DEFAULT IS SINGLE INSTEAD OF BLOCK ON ITS. ECHO MODE: ECHO OPENS OUTPUT TTY IN ECHO AREA (ITS ONLY). SOME OF THESE VALUES ARE OF COURSE SYSTEM-DEPENDENT. YOUR LOCAL LISP SYSTEM WILL ATTEMPT TO DO THE RIGHT THING, HOWEVER, IN ANY CASE. IF THE OPTIONS LIST IS INVALID IN ANY WAY, OPEN MAY EITHER GIVE A WRNG-TYPE-ARGS ERROR, OR BLITHELY ASSUME A CORRECTED VALUE FOR AN ATTRIBUTE. IN GENERAL, ERRORS SHOULD OCCUR ONLY FOR TRULY CONFLICTING SPECIFICATIONS. ON THE OTHER HAND, SPECIFYING BLOCK MODE FOR A DEVICE THAT THE SYSTEM WANTS TO HANDLE ONLY IN CHARACTER MODE MAY JUST GO AHEAD AND USE CHARACTER MODE. (OPENI X) == (OPEN X 'READ) (OPENO X) == (OPEN X 'PRINT) (OPENA X) == (OPEN X 'APPEND) (RUBOUT <CHAR> <FILE>) ATTEMPTS TO RUB OUT ONE CHARACTER. <CHAR> SHOULD BE A FIXNUM BETWEEN 0 AND 177 (AN ASCII VALUE). <FILE> SHOULD BE A TTY OUTPUT FILE; IF OMITTED, T IS ASSUMED. IF IT IS NOT POSSIBLE TO RUB OUT THE CHARACTER CORRECTLY, RUBOUT WILL RETURN NIL INSTEAD OF T; IT IS UP TO THE CALLER TO DO SOMETHING ABOUT THIS CASE. CHARACTERS WHICH CANNOT CORRECTLY BE RUBBED OUT INCLUDE TAB AND CARRIAGE RETURN. IF THE OUTPUT TTY CAN DO CURSOR POSITIONING AND SELECTIVE RASURE, THEN THE CHARACTER IS RUBBED OUT BY ERASING IT FROM THE SCREEN AND BACKING UP THE CURSOR; OTHERWISE, THE CHARACTER IS PRINTED ON THE TTY (RUBOUT ECHO). (SSTATUS TTYSCAN <FUNCTION> <FILE>) SETS UP A TTY PRE-SCAN FUNCTION FOR <FILE>, WHICH MUST BE A TTY INPUT FILE. IF <FILE> IS OMITTED, T IS ASSUMED. THE <FUNCTION> SHOULD ACCEPT THREE ARGUMENTS: (1) THE FILE TO DO PRE-SCANNING FOR. (2) THE INPUT FUNCTION TO PRE-SCAN FOR. POSSIBILITIES ARE READ, TYI, READLINE, EDIT, AND PERHAPS OTHERS. (3) THE NUMBER OF HANGING LEFT PARENTHESES, AS A FIXNUM (MEANINGFUL ONLY IF ARGUMENT 2 IS 'READ). IT IS THE RESPONSIBILITY OF THE PRE-SCAN FUNCTION TO READ IN SOME CHARACTERS FROM THE FILE HANDED TO IT AS ITS FIRST ARGUMENT, AND TO RETURN A LIST OF FIXNUMS BETWEEN 0 AND 177 OCTAL. TYPICALLY THE PRE-SCAN FUNCTION WILL PROVIDE FOR RUBOUT PROCESSING, ETC. IF THE PRE-SCAN FUNCTION RETURNS NIL, AN END-OF-FILE WILL BE SIGNALED FOR THE TTY INPUT FILE. THIS IS A WAY TO SIGNAL OVER-RUBOUT. (THE INITIAL LISP SYSTEM PROVIDES FOR THE INITIAL TTY INPUT FILE A PRE-SCAN FUNCTION WHICH DOES STANDARD RUBOUT PROCESSING.) (STATUS TTYSCAN <FILE>) NATURALLY RETURNS THE PRE-SCAN FUNCTION FOR <FILE> (T IF <FILE> IS OMITTED). ---------------------------------------------------------------- THINGS WHICH HAVE CHANGED FROM OLD I/O AND NOT IN THE MANUAL: ---------------------------------------------------------------- IN NEW I/O FILES ARE SPECIFIED BY MEANS OF NAMESTRINGS AND NAMELISTS AS DOCUMENTED IN THE MANUAL. THERE IS FURTHERMORE A COMPATIBILITY FEATURE WHICH ALLOWS OLD I/O 4-LISTS TO BE USED INTERCHANGEABLY WITH NEW I/O NAMELISTS. IF THE CAR OF A PUTATIVE NAMELIST IS ATOMIC, THEN IT IS ASSUMED TO BE AN OLD I/O 4-LIST. FINALLY, NEW I/O ON THE PDP-10 KNOWS MOST STANDARD DEVICE NAMES; IF IT SEES A NAME WHERE A DEVICE BELONGS, AND IT IS NOT ONE OF THE STANDARD DEVICE NAMES, AND NO SNAME WAS SUPPLIED, THEN THE NAME IS TAKEN TO BE THE SNAME, AND * IS SUPPLIED FOR THE DEVICE. ALL THESE COMPATIBILITY FEATURES ARE FOR THE PDP-10 ONLY! EXAMPLES: THESE ARE ALL EQUIVALENT AS FILE NAMES: (FOO BAR * GLS) (FOO BAR GLS) ((GLS) FOO BAR) ((* GLS) FOO BAR) THE ARGUMENT TO AN OLD I/O FUNCTION IS ONE OF THESE LISTS; THUS ONE MAY SAY EQUIVALENTLY: (UREAD FOO > * GLS) (UREAD FOO > DSK GLS) ;IF YOUR DEFAULT DEV IS DSK: (UREAD FOO) ;IF YOUR DEFAULT IS DSK:GLS; ; BECAUSE UREAD SUPPLIES > (UREAD (GLS) FOO) ;IF YOUR DEFAULT DEV IS DSK: (UREAD (DSK GLS) FOO) (UREAD (DSK GLS) FOO >) HERE ARE DEFINITIONS OF THE OLD I/O FUNCTIONS IN TERMS OF THE NEW ONES. THEY MAY BE TAKEN QUITE LITERALLY. (DEFUN UREAD FEXPR (FILENAME) (UCLOSE) ((LAMBDA (FILE) (EOFFN FILE (FUNCTION (LAMBDA (EOFFILE EOFVAL) (SETQ UREAD NIL)))) (INPUSH (SETQ UREAD FILE)) (CAR (DEFAULTF FILE))) (OPEN (*UGREAT FILENAME) 'IN))) (DEFUN UCLOSE FEXPR (X) (COND (UREAD (AND (EQ UREAD INFILE) (INPUSH -1)) (CLOSE (PROG2 NIL UREAD (SETQ UREAD NIL)))) (T NIL))) (DEFUN UWRITE FEXPR (DEVDIR) (OR DEVDIR (SETQ DEVDIR (CAR (DEFAULTF NIL)))) (*UWRITE (CONS DEVDIR (COND ((STATUS FEATURE DEC10) (CONS (STATUS JNAME) '(OUT))) ((STATUS FEATURE ITS) '(.LISP. OUTPUT)))) 'OUT (LIST DEVDIR))) (DEFUN UAPPEND FEXPR (FILENAME) (PROG2 (SETQ FILENAME (*UGREAT FILENAME)) (*UWRITE FILENAME 'APPEND FILENAME) (RENAME UWRITE (COND ((STATUS FEATURE DEC10) (CONS (STATUS JNAME) '(OUT))) ((STATUS FEATURE ITS) '(/.LISP/. APPEND)))))) (DEFUN *UWRITE (NAME MODE NEWDEFAULT) ;INTERNAL ROUTINE (COND (UWRITE (SETQ OUTFILES (DELQ UWRITE OUTFILES)) (CLOSE UWRITE) (SETQ UWRITE NIL))) ((LAMBDA (FILE) (SETQ OUTFILES (CONS (SETQ UWRITE FILE) OUTFILES)) (CAR (DEFAULTF NEWDEFAULT))) (OPEN NAME MODE))) (DEFUN UFILE FEXPR (SHORTNAME) (COND ((NULL UWRITE) (ERROR 'NO/ UWRITE/ FILE (CONS 'UFILE SHORTNAME) 'IO-LOSSAGE)) (T (PROG2 NIL (CAR (DEFAULTF (RENAME UWRITE (*UGREAT SHORTNAME)))) (SETQ OUTFILES (DELQ UWRITE OUTFILES)) (CLOSE UWRITE) (SETQ UWRITE NIL))))) (DEFUN CRUNIT FEXPR (DEVDIR) (CAR (DEFAULTF (AND DEVDIR (LIST DEVDIR))))) (DEFUN *UGREAT (NAME) ;INTERNAL ROUTINE (MERGEF (MERGEF NAME (COND ((STATUS FEATURE DEC10) '(* . LSP)) ((STATUS FEATURE ITS) '(* . >)))) NIL)) (DEFUN UPROBE FEXPR (FILENAME) (SETQ FILENAME (MERGEF (*UGREAT FILENAME) NIL)) (AND (PROBEF FILENAME) FILENAME)) (DEFUN UKILL FEXPR (FILENAME) (DEFAULTF (DELETEF FILENAME)))) CURSORPOS MAY TAKE AN EXTRA ARGUMENT TO DETERMINE WHICH OUTPUT TTY TO DO THE CURSOR POSITIONING ON. IF THE LAST ARGUMENT CAN BE TAKEN TO BE A TTY, IT IS. ONE INCOMPATIBILITY IS THAT (CURSORPOS 'T) NOW MEANS GET THE COORDINATES OF TTY "T" RATHER THAN GO TO THE TOP OF THE SCREEN. TO GO TO THE TOP OF THE SCREEN FOR THE DEFAULT TTY, USE (CURSORPOS 'TOP) OR (CURSORPOS 124) OR (CURSORPOS 'T T). LISTEN SIMILARLY TAKES AN OPTIONAL ARGUMENT TELLING WHICH INPUT TTY TO LISTEN TO. NOTE THAT (LISTEN T) IS NOT QUITE THE SAME AS (LISTEN); THE LATTER MERELY RETURNS THE RESULT OF A .LISTEN, WHILE THE FORMER ACCOUNTS FOR BUFFERED-UP CHARACTERS WITHIN LISP. TYIPEEK NOW TAKES UP TO THREE ARGUMENTS. THE FIRST ARGUMENT IS AS IN OLD I/O; IT SPECIFIES THE KIND OF PEEKING. A FIRST ARGUMENT OF NIL IS THE SAME AS NO ARGUMENT AT ALL, EXCEPT THAT YOU NEED IT TO GET IN THE OTHER TWO ARGUMENTS. THESE EXTRA ARGUMENTS ARE AS FOR READ, NAMELY A FILE AND/OR EOF VALUE (WHICH SHOULD BE A FIXNUM). AN INCOMPATIBLE CHANGE IS THAT TYIPEEK BY DEFAULT RETURNS -1 INSTEAD OF 3 AT END OF FILE AND NEWIO. (STATUS FILEMODE <FILE>) RETURNS A DOTTED PAIR WHOSE CAR IS A LIST OF VALID OPTIONS TO THE OPEN FUNCTION, DESCRIBING THE ATTRIBUTES OF THE FILE, AND WHOSE CDR IS A LIST OF SEMI-SYSTEM-DEPENDENT SYMBOLS DESCRIBING ATTRIBUTES WHICH CANNOT BE FED TO OPEN. AMONG THESE ATTRIBUTES ARE: RUBOUT THIS TTY CAN SELECTIVELY ERASE. SAIL THIS TTY HAS THE SAIL CHARACTER SET. CURSORPOS THIS TTY CAN DO CURSOR POSITIONING. (SSTATUS TTYCONS <TTY1> <TTY2>) EFFECTIVELY BINDS TWO TTY FILES INTO A SINGLE CONSOLE. ONE OF THE TTY'S SHOULD BE AN INPUT TTY, AND THE OTHER AN OUTPUT TTY. INITIALLY THE SYSTEM PERFORMS (SSTATUS TTYCONS T T) FOR YOU. (STATUS TTYCONS <TTY>) RETURNS THE TTY WHICH THE ONE YOU SPECIFIED IS LINKED TO, OR NIL IF IT ISN'T LINKED. THIS IS USEFUL, FOR EXAMPLE, IN A **MORE** INTERRUPT, TO DETERMINE WHICH INPUT TTY TO READ THE CHARACTER FROM. (STATUS TTYINT <CHAR> <INPUT TTY>) (SSTATUS TTYINT <CHAR> <FUNCTION> <INPUT TTY>) THESE STATUS FUNCTION ARE USED TO SET UP AND EXAMINE INTERRUPT CHARACTER FUNCTIONS FOR TTY INPUT FILES. IF <FILE> IS OMITTED, T (THE STANDARD TTY) IS ASSUMED. <CHAR> SHOULD BE EITHER A NUMERIC ASCII VALUE, OR A SINGLE CHARACTER OBJECT. NOTE THAT <CHAR> IS ALWAYS EVALUATED, UNLIKE (STATUS CHTRAN), FOR EXAMPLE. <FUNCTION> SHOULD BE EITHER A FUNCTION OF TWO ARGUMENTS OR A FIXNUM. IF IT IS A FUNCTION, THEN WHEN THE INTERRUPT OCCURS IT RECEIVES AS ARGUMENTS THE FILE ON WHICH THE INTERRUPT OCCURRED, AND THE CHARACTER TYPED, AS A FIXNUM. IF THE FUNCTION IS A FIXNUM, IT REPRESENTS THE INTERNAL SYSTEMIC INTERRUPT INITIALLY ASSOCIATED WITH THAT CHARACTER. THUS, FOR EXAMPLE: (SSTATUS TTYINT 7 '(LAMBDA (F CH) (PRINC '|WHY DID YOU TYPE ^G? |))) (SSTATUS TTYINT 6 7) WILL CAUSE ^F T DO A "^G QUIT", AND ^G MERELY TO PRINT THE MESSAGE "WHY DID YOU TYPE ^G? ". NOTE THAT AN INTERRUPT CAN BE ASSOCIATED WITH ANY ASCII CHARACTER, NOT JUST CONTROL CHARACTERS. (FOR A FRUSTRATING EXPERIENCE, SET ")" TO BE A "^G QUIT".) ON ITS, HOWEVER, ONE MUST USE (SSTATUS TTY) TO TELL ITS THAT THINGS LIKE "?" OR "#" ARE TO BE CONSIDERED INTERRUPT CHARACTERS (THIS IS SIMILAR TO THE ACTIVATION CHARACTER PROBLEM). THE MEANINGFUL SYSTEMIC INTERRUPT VALUES ARE: OCTAL VALUE CHAR WHAT IT DOES 3 ^C (SETQ ^D NIL) 4 ^D (SETQ ^D T) 7 ^G ^G QUIT 22 ^R (SETQ ^R T) 24 ^T (SETQ ^R NIL) 26 ^V (SETQ ^W NIL) 27 ^W (SETQ ^W T) 30 ^X ^X QUIT 32 ^Z RETURN TO DDT THE DIFFERENCE BETWEEN (SSTATUS TTYINT 1 4) AND (SSTATUS TTYINT 1 '(LAMBDA (F CH) (SETQ ^D T))) IS THAT THE FORMER WILL LET THE INTERRUPT HAPPEN AND TAKE EFFECT EVEN IF IN A PLACE WHERE A GENERAL USER FUNCTION MAY NOT BE RUN, E.G. IN THE MIDDLE OF A GARBAGE COLLECTION. NOTE THAT INITIALLY ^S IS SET TO BE LIKE ^W AS AN INTERRUPT CHARACTER (SEE BELOW). ^Q IS NO LONGER INITIALLY AN INTERRUPT CHARACTER, BUT A SPLICING MACRO AND FORCE-FEED WHOSE DEFINITION IS (LAMBDA NIL (SETQ ^Q T) NIL). THIS HAS THE SAME EFFECT WHEN TYPED AT THE KEYBOARD AS BEFORE, BUT PREVENTS CERTAIN TIMING SCREWS. ^S NO LONGER DOES (SETQ ^Q NIL). INSTEAD, IT IS THE SAME AS ^W AS AN INTERRUPT CHARACTER. UNLIKE ^W, IT IS ALSO A SPLICING MACRO AND FORCE-FEED, WITH THE DEFINITION (LAMBDA NIL (SETQ ^W NIL) (TERPRI) NIL). THUS IF A LONG PRINTOUT IS COMING AT YOU, JUST TYPE ^S AND YOU WILL SEE A TERPRI WHEN CONTROL RETURNS TO THE KEYBOARD. THIS IS LIKE ^S IN DDT, AND REPLACES THE OLD TRICK OF TYPING ^W AND THEN (IOC V). ^Z NO LONGER DOES A :VK TO DDT. ^U NO LONGER RELEASES THE PAGEPAUSE (WHICH IS ALSO GONE). ^B AND ^E DO NOT TOGGLE LPT OUTPUT. LOSERS CAN PROGRAM THIS FOR THEMSELVES. SEE ML:GLS;NIFTY QIO. ^H IS ALPHABETIC IN NEW I/O, FOR COMPATIBILITY WITH MULTICS, AND SO YOU CAN UNDERLINE NAMES. BEWARE! A<BACKSPACE>_ IS NOT THE SAME ATOM AS _<BACKSPACE>A. (THERE WILL EVENTUALLY BE A USER-PROGRAMMABLE SOLUTION TO THIS "BUG" - A LINE CANONICALIZER.) ^B IN NEW I/O GIVES A "^B BREAK", WHICH IS THE SAME AS THE "^H BREAK" OF OLD I/O. FOR TTY OUTPUT FILES ON ITS, THE ENDPAGEFN IS NOT TRIPPED WHEN THE LINENUM EXCEEDS PAGEL. RATHER, THE **MORE** INTERRUPT IS USED, WHICH IS MORE ACCURATE FOR DETECING THE BOTTOM OF THE SCREEN. WHEN THE TTY REACHES THE BOTTOM OF THE SCREEN, THE ENDPAGEFN FOR THE TTY IS INVOKED; IT RECEIVES AS ARGUMENT THE FILE ON WHICH THE INTERRUPT OCCURRED. HERE ARE SOME NEAT FUNCTIONS FOR USING THE **MORE** FEATURE (THEY LIVE IN ML:GLS;NIFTY QIO): (DECLARE (SPECIAL **MORE** MORE-FLUSH)) (SETQ **MORE** '##MORE##) (SETQ MORE-FLUSH NIL) ;;; TTY-ENDPAGEFN IS AN ENDPAGEFN FOR THE TTY FOR PROCESSING ;;; **MORE** INTERRUPTS. WHAT IT DOES DEPENDS ON TWO ;;; GLOBAL VARIABLES (BOUND BY THE CATCHMORE MACRO): ;;; **MORE** MORE-FLUSH ACTION ;;; NIL NIL NOTHING ;;; NON-NIL NIL "DUMB" MORE PROCESSING; ;;; I.E. PRINT THE VALUE ;;; OF **MORE** AND WAIT FOR ;;; THE LOSER TO TYPE SOMETHING, ;;; BUT NO PROVISION FOR FLUSHING ;;; NIL NON-NIL FLUSH IMMEDIATELY BY DOING ;;; (THROW NIL CLEVER-MORE). ;;; THIS IS GOOD FOR PRINTING ;;; EXACTLY ENOUGH TO FILL A SCREEN. ;;; NON-NIL NON-NIL "SMART" MORE PROCESSING; ;;; I.E. PRINC THE VALUE OF ;;; **MORE** AND WAIT FOR A ;;; CHARACTER. IF SPACE OR ;;; RUBOUT, GOBBLE IT. IF IT ;;; WAS SPACE, JUST RETURN; ;;; OTHERWISE FLUSH BY PRINC'ING ;;; MORE-FLUSH AND DOING ;;; (THROW NIL CLEVER-MORE). (DEFUN TTY-ENDPAGEFN (FILE) (COND (**MORE** (PRINC **MORE**) ((LAMBDA (IFILE) ((LAMBDA (CH) (AND (OR (= CH 40) (= CH 177)) (TYI IFILE)) (COND ((AND MORE-FLUSH (NOT (= CH 40))) (PRINC MORE-FLUSH) (THROW NIL CLEVER-MORE)) (T (CURSORPOS NIL 0 FILE) (CURSORPOS 'L FILE) (CURSORPOS 'T FILE)))) (TYIPEEK NIL IFILE))) (OR (STATUS TTYCONS FILE) T))) (MORE-FLUSH (THROW NIL CLEVER-MORE)))) (ENDPAGEFN T 'TTY-ENDPAGEFN) ;;; (CATCHMORE X Y Z) EVALUATES Z WITH A **MORE** CATCH ;;; AROUND IT. THIS COOPERATES WITH TTY-ENDPAGEFN ;;; TO DO **MORE** PROCESSING. ;;; THUS, FOR EXAMPLE, (CATCHMORE '**MORE** 'FLUSHED <STUFF>) ;;; WHERE <STUFF> DOES SOME PRINTING WILL PERFORM THE ;;; STANDARD KIND OF **MORE** PROCESSING, FLUSHING <STUFF> ;;; IF A NON-SPACE IS TYPED. ;;; THE MACRODEF MACRO-DEFINER LIVES IN ML:GLS;MACROS >. (MACRODEF CATCHMORE (MOREMSG FLUSHMSG . BODY) (CATCH ((LAMBDA (**MORE** MORE-FLUSH) . BODY) MOREMSG FLUSHMSG) CLEVER-MORE)) (DEFUN DIR FEXPR (X) ;LIST AN ITS FILE DIRECTORY (TERPRI) (CURSORPOS 'C) ((LAMBDA (FILE) (CATCHMORE '|---TYPE SPACE FOR MORE---| '|OH, WELL, SO MUCH FOR THAT...| (DO ((CH (TYI FILE) (TYI FILE))) ((= CH 14)) (TYO CH))) (CLOSE FILE)) (OPEN (CONS (CONS 'DSK X) '(/.FILE/. /(DIR/))))) (ASCII 0)) FASLOADING WITHIN A FASLOAD WORKS PRETTY WELL. NATURALLY, YOU CAN ONLY FASLOAD *BETWEEN* FUNCTION; "EVALUATED CONSTANTS" WITHIN A FUNCTION MAY NOT DO FASLOADS. (IF YOU DON'T UNDERSTAND THIS LAST ITEM, DON'T WORRY.) FORCE-OUTPUT IS AS IN THE MANUAL; IT FORCES AN BUFFER OUT. CLEAR-INPUT AND CLEAR-OUTPUT BOTH EXIST. ON ITS THEY ARE MEANINGFUL ONLY FOR TTY FILES, THOUGH THEY DON'T HURT ON ANY OTHER FILES. THE STATUS CALLS BELOW ARE EQUIVALENT TO THE EXPRESSIONS TO THE RIGHT, AND ARE INCLUDED ONLY FOR COMPATIBILITY WITH OLD I/O. AVOID USING THESE STATUS CALLS IN NEW CODE. NOTE THAT (STATUS UREAD) ETC. RETURNS A NEW I/O NAMELIST, WHICH IS NOT QUITE OF THE SAME FORM AS AN OLD I/O 4-LIST. (STATUS UREAD) <=> (TRUENAME UREAD) (SSTATUS UREAD ...) <=> (UREAD ...) (STATUS UWRITE) <=> (CAR (TRUENAME UWRITE)) (SSTATUS UWRITE ...) <=> (UWRITE ...) (STATUS CRFILE) <=> (CDR (DEFAULTF NIL)) (SSTATUS CRFILE ...) <=> (DEFAULTF '(...)) (STATUS CRUNIT) <=> (CRUNIT NIL) (SSTATUS CRUNIT ...) <=> (CRUNIT ...) FOR COMPATIBILITY WITH OLD I/O, IF THE FILE IS OMITTED IN THE STATUS CALLS BELOW, THE VALUE T (THE STANDARD INITIAL TTY) IS ASSUMED. (STATUS TTY X) HANDS BACK THE TTYST1, TTYST2, AND TTYSTS VARIABLES FOR THE TTY INPUT FILE X AS A LIST OF THREE FIXNUMS. (SSTATUS TTY M N X) SETS THE TTYST1 AND TTYST2 VARIABLES FOR THE TTY INPUT FILE X TO THE FIXNUMS M AND N. (STATUS TTYREAD X) HANDS BACK THE TTYREAD SWITCH FOR THE TTY INPUT FILE X. IF NIL, THEN ONLY FORCE-FEED CHARACTERS CAUSE THE TTY PRE-SCAN FUNCTION TO RETURN WITH ITS BUFFERED LIST OF CHARACTERS. (SSTATUS TTYREAD VAL X) SETS THE SWITCH TO T OR NIL ACCORDING TO VAL. (STATUS LINMODE X) HANDS BACK THE LINMODE SWITCH FOR THE TTY INPUT FILE X. IF T, THEN ONLY CARRIAGE RETURNS CAUSE THE TTY PRE-SCAN FUNCTION TO RETURN WITH ITS BUFFERED LIST OF CHARACTERS. (SSTATUS LINMODE VAL X) SETS THE LINMODE SWITCH. IT ALSO AFFECTS THE ACTIVATION BITS IN THE TTYST1 AND TTYST2 VARIABLES. ---------------------------------------------------------------- THINGS WHICH HAVE DISAPPEARED IN NEW I/O, NOT TO BE IMPLEMENTED ---------------------------------------------------------------- (STATUS INTERRUPT) AND (SSTATUS INTERRUPT) DO NOT EXIST IN NEWIO. (ENDPAGEFN <FILE> <FUNCTION>) IS USED TO SET UP **MORE** INTERRUPTS; (SSTATUS TTYINT) IS USED TO SET FUNCTIONS FOR INTERRUPT CHARACTERS. ALL OTHER INTERRUPT FUNCTIONS ARE THE VALUES OF ATOMIC SYMBOLS, AND SO CAN BE SET UP WITH SETQ. THE NAMES OF THESE VARIABLES ARE: ALARMCLOCK UNDF-FNCTN AUTOLOAD UNBND-VRBL ERRSET WRNG-TYPE-ARG *RSET-TRAP UNSEEN-GO-TAG GC-DAEMON WRNG-NO-ARGS GC-OVERFLOW GC-LOSSAGE PDL-OVERFLOW FAIL-ACT IO-LOSSAGE THE ONLY ONE OF THESE WHICH IS NEW IN NEWIO IS AUTOLOAD, WHICH HOLDS THE AUTOLOAD INTERRUPT HANDLER. LOADARRAYS AND DUMPARRAYS NO LONGER EXIST. A MORE GENERAL NEW I/O PRIMITIVE WILL EVENTUALLY ENABLE THE USER TO WRITE THESE FUNCTIONS FOR HIMSELF (A STANDARD PACKAGE EQUIVALENT TO THE OLD ONES WILL BE PROVIDED). IOC NO LONGER EXISTS IN NEW I/O. USE THE FOLLOWING TABLE OF EQUIVALENCES: (IOC C) <=> (SETQ ^D NIL) (IOC D) <=> (SETQ ^D T) (IOC G) <=> (^G) (IOC Q) <=> (SETQ ^Q T) (IOC R) <=> (SETQ ^R T) (IOC S) <=> (SETQ ^Q NIL) (IOC T) <=> (SETQ ^R NIL) (IOC V) <=> (SETQ ^W NIL) (IOC W) <=> (CLEAR-OUTPUT (SETQ ^W T)) (IOC X) <=> (^X) (IOC Z) <=> (VALRET ':VK/ ) TO INVOKE USER INTERRUPT FUNCTIONS, JUST FUNCALL THEM. IOG NO LONGER EXISTS. INSTEAD OF (IOG NIL ...) SAY INSTEAD ((LAMBDA (^Q ^R ^W) ...) NIL NIL NIL). (STATUS IOC), (SSTATUS IOC) NO LONGER EXIST. THEIR EFFECT CAN BE DUPLICATED BY USING SETQ, FUNCALL, OR THE NEW ^X AND ^G FUNCTIONS. (STATUS TERPRI), (SSTATUS TERPRI) NO LONGER EXIST. TO GET THEIR EFFECT, USE THE LINEL FUNCTION TO SET THE LINEL FOR EACH OUTPUT FILE TO 0. (A LINEL OF ZERO MEANS INFINITY.) (STATUS PAGEPAUSE), (SSTATUS PAGEPAUSE) NO LONGER EXIST. THEY HAVE BEEN SUPERSEDED BY THE **MORE** INTERRUPT FEATURE.