1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-26 12:12:12 +00:00

Added documentation for lisp and lisp libraries.

This commit is contained in:
Eric Swenson
2016-11-30 08:38:43 -08:00
committed by Lars Brinkhoff
parent e9619de352
commit 88aae69a9e
36 changed files with 31779 additions and 1 deletions

1670
doc/_info_/cgol.doc Executable file

File diff suppressed because it is too large Load Diff

233
doc/_info_/fasbin.format Executable file
View File

@@ -0,0 +1,233 @@
THE "NEW" FASLOAD SCHEME (AS OF 1/31/73) USES A NEW FORMAT
FOR ITS FILES. A FASL FILE CONSISTS OF TWO HEADER WORDS,
FOLLOWED BY A SERIES OF FASL BLOCKS; THE TWO HEADER WORDS
ARE BOTH SIXBIT, THE FIRST BEING "*FASL*" AND THE SECOND
THE CONTENTS OF LOCATION LDFNM2 IN THE LISP WHICH ASSEMBLED
THE FILE (A VERSION NUMBER IN SIXBIT).
EACH FASL BLOCK CONSISTS OF A WORD OF NINE FOUR-BIT
RELOCATION BYTES, FOLLOWED BY NINE PIECES OF FASL DATA.
THE LENGTH OF EACH DATA ITEM IS DEPENDENT ON THE
RELOCATION TYPE; THUS FASLBLOCKS ARE OF VARYING LENGTH.
THE LAST BLOCK MAY HAVE FEWER THAN NINE DATA ITEMS.
THE RELOCATION TYPES AND THE FORMATS OF THE ASSOCIATED
DATA ITEMS ARE AS FOLLOWS:
TYPE NAME DATA FORMAT
0 ABSOLUTE ONE ABSOLUTE WORD TO BE LOADED.
1 RELOCATABLE ONE WORD, THE RIGHT HALF OF WHICH
IS RELOCATABLE; I.E. AT LOAD TIME
THE LOAD OFFSET IS TO BE ADDED TO
THE RIGHT HALF.
2 SPECIAL A WORD TO BE LOADED, WHOSE RIGHT
HALF CONTAINS THE INDEX OF AN ATOM
(HOPEFULLY OF TYPE PNAME) THE ADDRESS
OF THE VALUE CELL OF WHICH IS TO
REPLACE THE RIGHT HALF OF THE LOADED
WORD. (IF NO VALUE CELL EXISTS, ONE
IS TO BE CREATED.)
3 SMASHABLE CALL SIMILAR TO TYPE 4 (Q.V.) EXCEPT THAT
THE INSTRUCTION IS ONE OF THE SERIES
OF CALL UUOS WHICH MAY BE "SMASHED"
FOR PURIFICATION PURPOSES. AT PRESENT
THESE UUOS ARE: CALL, JCALL, NCALL,
NJCALL.
4 QUOTE ATOM ONE WORD TO BE LOADED WHOSE RIGHT HALF
CONTAINS THE INDEX OF AN ATOM WHOSE
ADDRESS IS TO REPLACE THE RIGHT HALF
OF THE WORD LOADED.
5 QUOTE LIST A SERIES OF WORDS REPRESENTING AN
S-EXPRESSION TO BE CONSTRUCTED BY THE
LOADER. THE FORMAT OF THESE WORDS IS
BEST EXPLAINED BY THE ALGORITHM USED
TO CONTRUCT THE S-EXPRESSION: THE
LOADER EXAMINES BITS 4.7-4.9 OF EACH
WORD. IF 0, THEN THE ATOM WHOSE INDEX
IS IN THE RIGHT HALF OF THE WORD IS
PUSHED ONTO A STACK. IF 1, THEN THE
LOADER POPS AS MANY ITEMS OFF THE STACK
AS SPECIFIED BY THE NUMBER IN THE RIGHT HALF
OF THE WORD AND MAKES A LIST OF THEM, SO THAT
THE LAST ITEM POPPED BECOMES THE FIRST
ITEM OF THE LIST; THIS LIST IS THEN
PUSHED ONTO THE STACK. IF 2, THEN THE
LOADER POPS ONE ITEM OFF THE STACK AND
PROCEEDS AS FOR 1, EXCEPT THAT THE ITEM
FIRST POPPED IS USED TO END THE LIST
INSTEAD IF NIL. (THIS ALLOWS FOR DOTTED
PAIRS.) IF 3, THEN THE TOP ITEM ON THE STACK
IS EVALUATED AND RESTORED BACK ON THE TOP OF
THE STACK. IF 7, THEN THE LEFT HALF OF THE
WORD SHOULD BE -1 OR -2, INDICATING THE
SECOND LAST WORD OF THE DATA; IF -1,
THE RIGHT HALF OF THIS WORD AND THE
ADDRESS OF (WHAT SHOULD BE) THE SINGLE
ITEM ON THE STACK (WHICH IS POPPED OFF)
ARE MADE RESPECTIVELY INTO THE LEFT AND
RIGHT HALVES OF A WORD TO BE LOADED INTO
BINARY PROGRAM SPACE; IF -2, THE
S-EXPRESSION IS PLACED INTO THE NEXT
SLOT OF THE ATOMTABLE (SEE TYPE 12).
THE ONE WORD REMAINING IS THE HASH KEY
OF THE S-EXPRESSION AS COMPUTED BY
SXHASH; THIS IS USED BY THE LOADER
TO SAVE GCPRO SOME WORK.
6 GLOBALSYM ONE WORD; THE RIGHT HALF IS AN INDEX
INTO THE TABLE LSYMS IN LISP. THE
INDICATED VALUE IS RETRIEVED, NEGATED
IF BIT 4.9 OF THE DATA WORD IS 1, AND
ADDED TO THE RIGHT HALF OF THE LAST
WORD LOADED INTO BINARY PROGRAM SPACE.
THIS ALLOWS LAP CODE TO REFER TO
SELECTED LOCATIONS INTERNAL TO LISP
WITHOUT GETTING SYMBOLS FROM DDT.
7 GETDDTSYM IF THE FIRST WORD IS -1, THEN THE LOAD
OFFSET IF ADDED INTO THE LEFT HALF
OF THE WORD MOST RECENTLY LOADED INTO
BINARY PROGRAM SPACE (THIS IS HOW LEFT
HALF RELOCATION IS ACCOMPLISHED).
OTHERWISE, THE FIRST WORD
CONTAINS IN BITS 1.1-4.5 A SYMBOL
IN SQUOZE CODE. THE LOADER GETS
THE VALUE OF THIS SYMBOL FROM DDT
IF POSSIBLE, NEGATES IT IF BIT 4.9
IS 1, THEN ADDS THE RESULT TO THE
FIELD OF THE LAST WORD LOADED AS
SPECIFIED BY BITS 4.6-4.7:
3=ENTIRE WORD
2=AC FIELD ONLY
1=RIGHT HALF ONLY
0=ENTIRE WORD, BUT SWAP HALVES OF
VALUE BEFORE ADDING.
THESE FOUR FIELDS CORRESPOND TO
OPCODE, AC, ADDRESS, AND INDEX FIELDS
RESPECTIVELY IN A LAP INSTRUCTION.
IF BIT 4.8 IS A 1, THEN ANOTHER WORD
FOLLOWS, CONTAINING THE VALUE OF THE
SYMBOL AS OBTAINED FROM DDT AT
ASSEMBLE TIME. IF THE VERSION NUMBER
OF THAT LISP (AS DETERMINED FROM THE
SECOND FILE HEADER WORD) IS THE SAME
AS THAT OF THE LISP BEING LOADED INTO,
THEN THIS VALUE IS USED AND DDT IS NOT
CONSULTED AT LOAD TIME; THIS IS FOR
SPEED. IF THE VERSION NUMBERS ARE
DIFFERENT, THEN DDT IS CONSULTED.
10 ARRAY REF ONE WORD TO BE LOADED, WHOSE RIGHT HALF
CONTAINS THE ATOMINDEX OF AN ATOMIC
SYMBOL. IF THE SYMBOL HAS AN ARRAY
PROPERTY, IT IS FETCHED; OTHERWISE
ONE IS CREATED. THE RIGHT HALF OF THE
WORD TO BE LOADED IS REPLACED WITH
THE ADDRESS OF THE SECOND WORD OF THE
ARRAY POINTER (I.E. OF THE TTSAR).
IN THIS WAY ACCESSES TO ARRAYS CAN BE
OPEN-CODED.
11 UNUSED [ERROR IN FILE]
12 ATOMTABLE INFO A HEADER WORD, POSSIBLY FOLLOWED BY
OTHERS, DEPENDING ON BITS 4.7-4.8:
IF 0, THE RIGHT HALF IS THE NUMBER
OF WORDS FOLLOWING, WHICH CONSTITUTE
THE PNAME OF A PNAME-TYPE ATOM, IN THE
ORDER OF THEIR APPEARANCE ON A
PROPERTY LIST. THE ATOM IS INTERNED.
IF 1, THE ONE WORD FOLLOWING IS
THE VALUE OF A FIXNUM TO BE CREATED.
IF 2, THE FOLLOWING WORD IS THE VALUE
OF A FLONUM. IF 3, THE RIGHT HALF IS
THE NUMBER OF FIXNUM COMPONENTS OF A
BIGNUM FOLLOWING, MOST SIGNIFICANT
WORD FIRST. THE HEADER WORD CONTAINS
THREE BITS OF THE SIGN OF THE BIGNUM
IN BITS 3.1-3.3.
THE ATOM THUS CREATED IS ASSIGNED A
PLACE IN THE ATOMTABLE MAINTAINED BY
THE LOADER (AS AN ARRAY) USING
CONSECUTIVE LOCATIONS; FROM THAT POINT
ON OTHER DATA ITEMS REFERRING TO THAT
ITEM CAN DO SO BY THE INDEX OF THE
ATOM IN THIS TABLE.
SEE ALSO TYPES 5 AND 16, WHICH ALSO
MAKE ENTRIES IN THE ATOMTABLE.
13 ENTRY INFO TWO WORDS. THE LEFT HALF OF THE FIRST
WORD IS THE ATOMINDEX OF THE NAME OF
THE FUNCTION BEING DEFINED; THE RIGHT
HALF THAT OF THE SUBR TYPE (THE
PROPERTY UNDER WHICH TO CREATE THE
ENTRY POINT, E.G. SUBR OR FSUBR).
THE RIGHT HALF OF THE SECOND WORD IS
THE LOCATION OF THE ENTRY POINT AS A
RELOCATABLE POINTER: THE LOAD OFFSET
MUST BE ADDED TO IT. THE LEFT HALF OF
THE SECOND WORD CONTAINS INFORMATION
USED TO CREATE AN ARGS PROPERTY FOR
THE FUNCTION AS SPECIFIED IN THE
ORIGINAL LAP CODE. IF THIS HALFWORD
IS ZERO, NO ARGS PROPERTY IS CREATED
AND ANY ALREADY PRESENT IS REMOVED.
OTHERWISE THE HALFWORD IS DIVIDED INTO
TWO NINE-BIT BYTES, EACH OF WHICH IS
CONVERTED AS FOLLOWS:
BYTE RESULT
0 NIL
777 777
N N-1, WHERE N IS NOT 0 OR 777
THESE TWO ITEMS ARE THEN CONSED AND
FOR THE ARGS PROPERTY.
14 LOC THE WORD IS A RELOCATABLE QUANTITY
SPECIFYING WHERE TO CONTINUE LOADING.
IT IS NOT PERMITTED TO LOC BELOW THE
ORIGIN OF THE ASSEMBLY. IF THE LOC
IS TO A LOCATION HIGHER THAN ANY YET
LOADED INTO, THEN FASLOAD ZEROS OUT
ALL WORDS ABOVE THAT HIGHEST LOCATION
UP TO THE LOCATION SPECIFIED.
FASLOAD KEEPS TRACK OF THE HIGHEST
LOCATION EVER LOADED INTO; THIS VALUE
PLUS ONE BECOMES THE VALUE OF BPORG
AT THE END OF ASSEMBLY, REGARDLESS
OF THE STATE OF THE LOCATION POINTER
WHEN LOADING TERMINATES.
15 PUTDDTSYM FIRST WORD, THE SYMBOL IN SQUOZE CODE.
IF BIT 4.9=0, THE SYMBOL IS DEFINED TO
DDT IF POSSIBLE WITH THE ADDRESS OF THE
WORD OF BINARY PROGRAM SPACE ABOUT
TO BE LOADED INTO AS ITS VALUE.
IF BIT 4.9=1, THE VALUE IS GOBBLED FROM
THE FOLLOWING WORD. BIT 4.8 (OF THE WORD
CONTAINING THE SQUOZE) MEANS RELOCATE
THE LEFT HALF OF THE VALUE BY THE LOAD
OFFSET, AND BIT 4.7 LIKEWISE FOR THE
RIGHT HALF.
WHETHER OR NOT THE SYMBOL ACTUALLY GETS
PUT IN DDT'S SYMBOL TABLE IS A FUNCTION
OF THREE CONDITIONS: FIRST, THAT THERE
IS A DDT WITH A SYMBOL TABLE; SECOND,
THE VALUE OF THE VARIABLE SYMBOLS;
THIRD, BIT 4.6 OF THE FIRST PUTDDTSYM
WORD. THE FIRST CONDITION OF COURSE MUST
BE SATISFIED. IF SO, THEN THE SYMBOL IS
PUT IN THE SYMBOL TABLE ONLY IF SYMBOLS
HAS A NON-NIL VALUE. FURTHERMORE, IF
THAT VALUE IS THE ATOM SYMBOLS ITSELF,
THEN THE SYMBOL IS PUT ONLY IF BIT 4.6
IS ON (INDICATING A "GLOBAL" SYMBOL).
16 EVAL MUNGEABLE A SERIES OF WORDS SIMILAR TO THOSE
FOR TYPE 5, BUT WITH NO FOLLOWING
HASH KEY. AN S-EXPRESSION IS
CONSTRUCTED AND EVALUATED. THIS IS
USED FOR THE SO-CALLED "MUNGEABLES"
IN A FILE OF LAP CODE.
IF THE LEFT HALF OF THE LAST WORD IS
-1, THE VALUE IS THROWN AWAY. IF IT
IS -2, THE VALUE IS ENTERED IN THE
ATOMTABLE.
17 END OF BINARY ONE WORD, WHICH MUST BE "*FASL*" IN
SIXBIT. THIS SHOULD BE THE LAST DATA
WORD IN THE FILE. ANY RELOCATION
BYTES LEFT OVER AFTER A TYPE 17 ARE
IGNORED.
THIS SHOULD BE FOLLOWED EITHER BY END OF FILE OR A WORD
FULL OF ^C'S.

425
doc/_info_/fasl.format Executable file
View File

@@ -0,0 +1,425 @@
;;; FORMAT OF FASL FILES:
THE "NEW" FASLOAD SCHEME (AS OF 1/31/73) USES A NEW FORMAT FOR
ITS FILES. A FASL FILE CONSISTS OF TWO HEADER WORDS, FOLLOWED BY
A SERIES OF FASL BLOCKS; THE TWO HEADER WORDS ARE BOTH SIXBIT,
THE FIRST BEING "*FASL+" (FOR HISTORICAL REASONS, "*FASL* IS
ALSO ACCEPTED) AND THE SECOND THE CONTENTS OF LOCATION LDFNM2 IN
THE LISP WHICH ASSEMBLED THE FILE (A VERSION NUMBER IN SIXBIT).
EACH FASL BLOCK CONSISTS OF A WORD OF NINE FOUR-BIT RELOCATION
BYTES, FOLLOWED BY NINE PIECES OF FASL DATA. THE LENGTH OF EACH
DATA ITEM IS DEPENDENT ON THE RELOCATION TYPE; THUS FASLBLOCKS
ARE OF VARYING LENGTH. THE LAST BLOCK MAY HAVE FEWER THAN NINE
DATA ITEMS. THE RELOCATION TYPES AND THE FORMATS OF THE
ASSOCIATED DATA ITEMS ARE AS FOLLOWS:
TYPE 0 ABSOLUTE
ONE ABSOLUTE WORD TO BE LOADED.
TYPE 1 RELOCATABLE
ONE WORD, THE RIGHT HALF OF WHICH IS RELOCATABLE; I.E. AT LOAD
TIME THE LOAD OFFSET IS TO BE ADDED TO THE RIGHT HALF.
TYPE 2 SPECIAL
A WORD TO BE LOADED, WHOSE RIGHT HALF CONTAINS THE INDEX OF AN
ATOM (HOPEFULLY OF TYPE PNAME) THE ADDRESS OF THE VALUE CELL OF
WHICH IS TO REPLACE THE RIGHT HALF OF THE LOADED WORD. (IF NO
VALUE CELL EXISTS, ONE IS TO BE CREATED.)
TYPE 3 SMASHABLE CALL
SIMILAR TO TYPE 4 (Q.V.) EXCEPT THAT THE INSTRUCTION IS ONE OF
THE SERIES OF CALL UUOS WHICH MAY BE "SMASHED" FOR PURIFICATION
PURPOSES. AT PRESENT THESE UUOS ARE: CALL, JCALL, NCALL, NJCALL.
TYPE 4 QUOTED ATOM
ONE WORD TO BE LOADED WHOSE RIGHT HALF CONTAINS THE INDEX OF AN
ATOM WHOSE ADDRESS IS TO REPLACE THE RIGHT HALF OF THE WORD
LOADED.
TYPE 5 QUOTED LIST
A SERIES OF WORDS REPRESENTING AN S-EXPRESSION TO BE CONSTRUCTED
BY THE LOADER. THE FORMAT OF THESE WORDS IS BEST EXPLAINED BY
THE ALGORITHM USED TO CONTRUCT THE S-EXPRESSION: THE LOADER
EXAMINES BITS 4.7-4.9 OF SUCCESSIVELY READ WORDS, AND DISPATCHES
ON THEM:
0 THE ATOM WHOSE INDEX IS IN THE RIGHT HALF OF THE WORD
IS PUSHED ONTO A STACK.
1 THE LOADER POPS AS MANY ITEMS OFF THE STACK AS
SPECIFIED BY THE NUMBER IN THE RIGHT HALF OF THE WORD
AND MAKES A LIST OF THEM, SO THAT THE LAST ITEM POPPED
BECOMES THE FIRST ITEM OF THE LIST; THIS LIST IS THEN
PUSHED ONTO THE STACK.
2 THE LOADER POPS ONE ITEM OFF THE STACK AND PROCEEDS AS
FOR 1, EXCEPT THAT THE ITEM FIRST POPPED IS USED TO
END THE LIST INSTEAD IF NIL. (THIS ALLOWS FOR DOTTED
PAIRS.)
3 THE TOP ITEM ON THE STACK IS EVALUATED AND STORED BACK
ON THE TOP OF THE STACK.
4 THE RIGHT HALF OR THE WORD SPECIFIES THE LENGTH OF A
HUNK TO BE MADE BY TAKING THAT MANY ITEMS FROM THE TOP
OF THE STACK; THIS HUNK IS THEN PUSHED BACK.
5 UNUSED.
6 UNUSED.
7 THE LEFT HALF OF THE WORD SHOULD BE -1 OR -2,
INDICATING THE SECOND LAST WORD OF THE DATA; IF -1,
THE RIGHT HALF OF THIS WORD AND THE ADDRESS OF (WHAT
SHOULD BE) THE SINGLE ITEM ON THE STACK (WHICH IS
POPPED OFF) ARE MADE RESPECTIVELY INTO THE LEFT AND
RIGHT HALVES OF A WORD TO BE LOADED INTO BINARY
PROGRAM SPACE; IF -2, THE S-EXPRESSION IS PLACED INTO
THE NEXT SLOT OF THE ATOMTABLE (SEE TYPE 12). THE ONE
WORD REMAINING IS THE HASH KEY OF THE S-EXPRESSION AS
COMPUTED BY SXHASH; THIS IS USED BY THE LOADER TO SAVE
GCPRO SOME WORK.
TYPE 6 GLOBALSYM
ONE WORD; THE RIGHT HALF IS AN INDEX INTO THE TABLE LSYMS IN
LISP. THE INDICATED VALUE IS RETRIEVED, NEGATED IF BIT 4.9 OF
THE DATA WORD IS 1, AND ADDED TO THE RIGHT HALF OF THE LAST
WORD LOADED INTO BINARY PROGRAM SPACE. THIS ALLOWS LAP CODE
TO REFER TO SELECTED LOCATIONS INTERNAL TO LISP WITHOUT
GETTING SYMBOLS FROM DDT.
TYPE 7 GETDDTSYM
IF THE FIRST WORD IS -1, THEN THE LOAD OFFSET IS ADDED INTO
THE LEFT HALF OF THE WORD MOST RECENTLY LOADED INTO BINARY
PROGRAM SPACE (THIS IS HOW LEFT HALF RELOCATION IS
ACCOMPLISHED). OTHERWISE, THE FIRST WORD CONTAINS IN BITS
1.1-4.5 A SYMBOL IN SQUOZE CODE. THE LOADER GETS THE VALUE OF
THIS SYMBOL FROM DDT IF POSSIBLE, NEGATES IT IF BIT 4.9 IS 1,
THEN ADDS THE RESULT TO THE FIELD OF THE LAST WORD LOADED AS
SPECIFIED BY BITS 4.6-4.7:
3 = ENTIRE WORD
2 = AC FIELD ONLY
1 = RIGHT HALF ONLY
0 = ENTIRE WORD, BUT SWAP HALVES OF VALUE BEFORE ADDING.
THESE FOUR FIELDS CORRESPOND TO OPCODE, AC, ADDRESS, AND INDEX
FIELDS RESPECTIVELY IN A LAP INSTRUCTION. IF BIT 4.8 IS A 1,
THEN ANOTHER WORD FOLLOWS, CONTAINING THE VALUE OF THE SYMBOL
AS OBTAINED FROM DDT AT ASSEMBLE TIME. IF THE VERSION NUMBER
OF THAT LISP (AS DETERMINED FROM THE SECOND FILE HEADER WORD)
IS THE SAME AS THAT OF THE LISP BEING LOADED INTO, THEN THIS
VALUE IS USED AND DDT IS NOT CONSULTED AT LOAD TIME; THIS IS
FOR SPEED. IF THE VERSION NUMBERS ARE DIFFERENT, THEN DDT IS
CONSULTED.
TYPE 10 ARRAY REFERENCE
ONE WORD TO BE LOADED, WHOSE RIGHT HALF CONTAINS THE ATOMINDEX
OF AN ATOMIC SYMBOL. IF THE SYMBOL HAS AN ARRAY PROPERTY, IT
IS FETCHED; OTHERWISE ONE IS CREATED. THE RIGHT HALF OF THE
WORD TO BE LOADED IS REPLACED WITH THE ADDRESS OF THE SECOND
WORD OF THE ARRAY POINTER (I.E. OF THE TTSAR). IN THIS WAY
ACCESSES TO ARRAYS CAN BE OPEN-CODED.
TYPE 11 UNUSED
TYPE 12 ATOMTABLE INFO
A HEADER WORD, POSSIBLY FOLLOWED BY OTHERS, DEPENDING ON BITS
4.7-4.9:
0 THE RIGHT HALF IS THE NUMBER OF WORDS FOLLOWING, WHICH
CONSTITUTE THE PNAME OF A PNAME-TYPE ATOM, IN THE
ORDER OF THEIR APPEARANCE ON A PROPERTY LIST. THE ATOM
IS INTERNED.
1 THE ONE WORD FOLLOWING IS THE VALUE OF A FIXNUM TO BE
CREATED.
2 THE FOLLOWING WORD IS THE VALUE OF A FLONUM.
3 THE RIGHT HALF IS THE NUMBER OF FIXNUM COMPONENTS OF A
BIGNUM FOLLOWING, MOST SIGNIFICANT WORD FIRST. BIT 3.1
IS THE SIGN OF THE BIGNUM.
4 THE FOLLOWING TWO WORDS ARE A DOUBLE-PRECISION NUMBER.
5 THE FOLLOWING TWO WORDS ARE A COMPLEX NUMBER.
6 THE FOLLOWING FOUR WORDS ARE A DUPLEX NUMBER.
7 UNUSED.
THE ATOM THUS CREATED IS ASSIGNED A PLACE IN THE ATOMTABLE
MAINTAINED BY THE LOADER (AS AN ARRAY) USING CONSECUTIVE
LOCATIONS; FROM THAT POINT ON OTHER DATA ITEMS REFERRING TO
THAT ITEM CAN DO SO BY THE INDEX OF THE ATOM IN THIS TABLE.
SEE ALSO TYPES 5 AND 16, WHICH ALSO MAKE ENTRIES IN THE
ATOMTABLE.
TYPE 13 ENTRY INFO
TWO WORDS. THE LEFT HALF OF THE FIRST WORD IS THE ATOMINDEX
OF THE NAME OF THE FUNCTION BEING DEFINED; THE RIGHT HALF
THAT OF THE SUBR TYPE (THE PROPERTY UNDER WHICH TO CREATE THE
ENTRY POINT, E.G. SUBR OR FSUBR). THE RIGHT HALF OF THE
SECOND WORD IS THE LOCATION OF THE ENTRY POINT AS A
RELOCATABLE POINTER: THE LOAD OFFSET MUST BE ADDED TO IT. THE
LEFT HALF OF THE SECOND WORD CONTAINS THE ARGS PROPERTY, IN
INTERNAL ARGS PROPERTY FORMAT, AS SPECIFIED IN THE ORIGINAL
LAP CODE BY THE ARGS CONSTRUCT.
TYPE 14 LOC
THE WORD IS A RELOCATABLE QUANTITY SPECIFYING WHERE TO
CONTINUE LOADING. IT IS NOT PERMITTED TO LOC BELOW THE
ORIGIN OF THE ASSEMBLY. IF THE LOC IS TO A LOCATION HIGHER
THAN ANY YET LOADED INTO, THEN FASLOAD ZEROS OUT ALL WORDS
ABOVE THAT HIGHEST LOCATION UP TO THE LOCATION SPECIFIED.
FASLOAD KEEPS TRACK OF THE HIGHEST LOCATION EVER LOADED INTO;
THIS VALUE PLUS ONE BECOMES THE VALUE OF BPORG AT THE END OF
ASSEMBLY, REGARDLESS OF THE STATE OF THE LOCATION POINTER
WHEN LOADING TERMINATES. THIS TYPE IS NEVER USED BY LAP
CODE, BUT ONLY BY MIDAS .FASL CODE.
TYPE 15 PUTDDTSYM
FIRST WORD, THE SYMBOL IN SQUOZE CODE. IF BIT 4.9=0, THE
SYMBOL IS DEFINED TO DDT IF POSSIBLE WITH THE ADDRESS OF THE
WORD OF BINARY PROGRAM SPACE ABOUT TO BE LOADED INTO AS ITS
VALUE. IF BIT 4.9=1, THE VALUE IS GOBBLED FROM THE FOLLOWING
WORD. BIT 4.8 (OF THE WORD CONTAINING THE SQUOZE) MEANS
RELOCATE THE LEFT HALF OF THE VALUE BY THE LOAD OFFSET, AND
BIT 4.7 LIKEWISE FOR THE RIGHT HALF. WHETHER OR NOT THE
SYMBOL ACTUALLY GETS PUT IN DDT'S SYMBOL TABLE IS A FUNCTION
OF THREE CONDITIONS: FIRST, THAT THERE IS A DDT WITH A SYMBOL
TABLE; SECOND, THE VALUE OF THE LISP VARIABLE "SYMBOLS";
THIRD, BIT 4.6 OF THE FIRST PUTDDTSYM WORD. THE FIRST
CONDITION OF COURSE MUST BE SATISFIED. IF SO, THEN THE SYMBOL
IS PUT IN THE SYMBOL TABLE ONLY IF SYMBOLS HAS A NON-NIL
VALUE. FURTHERMORE, IF THAT VALUE IS THE ATOM SYMBOLS ITSELF,
THEN THE SYMBOL IS PUT ONLY IF BIT 4.6 IS ON (INDICATING A
"GLOBAL" SYMBOL).
TYPE 16 EVAL MUNGEABLE
A SERIES OF WORDS SIMILAR TO THOSE FOR TYPE 5, BUT WITH NO
FOLLOWING HASH KEY. AN S-EXPRESSION IS CONSTRUCTED AND
EVALUATED. THIS IS USED FOR THE SO-CALLED "MUNGEABLES" IN A
FILE OF LAP CODE. IF THE LEFT HALF OF THE LAST WORD IS -1,
THE VALUE IS THROWN AWAY. IF IT IS -2, THE VALUE IS ENTERED
IN THE ATOMTABLE.
TYPE 17 END OF BINARY
ONE WORD, WHICH MUST BE "*FASL+" (OR "*FASL*") IN SIXBIT.
THIS SHOULD BE THE LAST DATA WORD IN THE FILE. ANY RELOCATION
BYTES LEFT OVER AFTER A TYPE 17 ARE IGNORED. THIS SHOULD BE
FOLLOWED EITHER BY END OF FILE OR A WORD FULL OF ^C'S.
THE "NEW" FASLOAD SCHEME (AS OF 1/31/73) USES A NEW FORMAT
FOR ITS FILES. A FASL FILE CONSISTS OF TWO HEADER WORDS,
FOLLOWED BY A SERIES OF FASL BLOCKS; THE TWO HEADER WORDS
ARE BOTH SIXBIT, THE FIRST BEING "*FASL*" AND THE SECOND
THE CONTENTS OF LOCATION LDFNM2 IN THE LISP WHICH ASSEMBLED
THE FILE (A VERSION NUMBER IN SIXBIT).
EACH FASL BLOCK CONSISTS OF A WORD OF NINE FOUR-BIT
RELOCATION BYTES, FOLLOWED BY NINE PIECES OF FASL DATA.
THE LENGTH OF EACH DATA ITEM IS DEPENDENT ON THE
RELOCATION TYPE; THUS FASLBLOCKS ARE OF VARYING LENGTH.
THE LAST BLOCK MAY HAVE FEWER THAN NINE DATA ITEMS.
THE RELOCATION TYPES AND THE FORMATS OF THE ASSOCIATED
DATA ITEMS ARE AS FOLLOWS:
TYPE NAME DATA FORMAT
0 ABSOLUTE ONE ABSOLUTE WORD TO BE LOADED.
1 RELOCATABLE ONE WORD, THE RIGHT HALF OF WHICH
IS RELOCATABLE; I.E. AT LOAD TIME
THE LOAD OFFSET IS TO BE ADDED TO
THE RIGHT HALF.
2 SPECIAL A WORD TO BE LOADED, WHOSE RIGHT
HALF CONTAINS THE INDEX OF AN ATOM
(HOPEFULLY OF TYPE PNAME) THE ADDRESS
OF THE VALUE CELL OF WHICH IS TO
REPLACE THE RIGHT HALF OF THE LOADED
WORD. (IF NO VALUE CELL EXISTS, ONE
IS TO BE CREATED.)
3 SMASHABLE CALL SIMILAR TO TYPE 4 (Q.V.) EXCEPT THAT
THE INSTRUCTION IS ONE OF THE SERIES
OF CALL UUOS WHICH MAY BE "SMASHED"
FOR PURIFICATION PURPOSES. AT PRESENT
THESE UUOS ARE: CALL, JCALL, NCALL,
NJCALL.
4 QUOTE ATOM ONE WORD TO BE LOADED WHOSE RIGHT HALF
CONTAINS THE INDEX OF AN ATOM WHOSE
ADDRESS IS TO REPLACE THE RIGHT HALF
OF THE WORD LOADED.
5 QUOTE LIST A SERIES OF WORDS REPRESENTING AN
S-EXPRESSION TO BE CONSTRUCTED BY THE
LOADER. THE FORMAT OF THESE WORDS IS
BEST EXPLAINED BY THE ALGORITHM USED
TO CONTRUCT THE S-EXPRESSION: THE
LOADER EXAMINES BITS 4.7-4.9 OF EACH
WORD. IF 0, THEN THE ATOM WHOSE INDEX
IS IN THE RIGHT HALF OF THE WORD IS
PUSHED ONTO A STACK. IF 1, THEN THE
LOADER POPS AS MANY ITEMS OFF THE STACK
AS SPECIFIED BY THE NUMBER IN THE RIGHT HALF
OF THE WORD AND MAKES A LIST OF THEM, SO THAT
THE LAST ITEM POPPED BECOMES THE FIRST
ITEM OF THE LIST; THIS LIST IS THEN
PUSHED ONTO THE STACK. IF 2, THEN THE
LOADER POPS ONE ITEM OFF THE STACK AND
PROCEEDS AS FOR 1, EXCEPT THAT THE ITEM
FIRST POPPED IS USED TO END THE LIST
INSTEAD IF NIL. (THIS ALLOWS FOR DOTTED
PAIRS.) IF 3, THEN THE TOP ITEM ON THE STACK
IS EVALUATED AND RESTORED BACK ON THE TOP OF
THE STACK. IF 7, THEN THE LEFT HALF OF THE
WORD SHOULD BE -1 OR -2, INDICATING THE
SECOND LAST WORD OF THE DATA; IF -1,
THE RIGHT HALF OF THIS WORD AND THE
ADDRESS OF (WHAT SHOULD BE) THE SINGLE
ITEM ON THE STACK (WHICH IS POPPED OFF)
ARE MADE RESPECTIVELY INTO THE LEFT AND
RIGHT HALVES OF A WORD TO BE LOADED INTO
BINARY PROGRAM SPACE; IF -2, THE
S-EXPRESSION IS PLACED INTO THE NEXT
SLOT OF THE ATOMTABLE (SEE TYPE 12).
THE ONE WORD REMAINING IS THE HASH KEY
OF THE S-EXPRESSION AS COMPUTED BY
SXHASH; THIS IS USED BY THE LOADER
TO SAVE GCPRO SOME WORK.
6 GLOBALSYM ONE WORD; THE RIGHT HALF IS AN INDEX
INTO THE TABLE LSYMS IN LISP. THE
INDICATED VALUE IS RETRIEVED, NEGATED
IF BIT 4.9 OF THE DATA WORD IS 1, AND
ADDED TO THE RIGHT HALF OF THE LAST
WORD LOADED INTO BINARY PROGRAM SPACE.
THIS ALLOWS LAP CODE TO REFER TO
SELECTED LOCATIONS INTERNAL TO LISP
WITHOUT GETTING SYMBOLS FROM DDT.
7 GETDDTSYM IF THE FIRST WORD IS -1, THEN THE LOAD
OFFSET IF ADDED INTO THE LEFT HALF
OF THE WORD MOST RECENTLY LOADED INTO
BINARY PROGRAM SPACE (THIS IS HOW LEFT
HALF RELOCATION IS ACCOMPLISHED).
OTHERWISE, THE FIRST WORD
CONTAINS IN BITS 1.1-4.5 A SYMBOL
IN SQUOZE CODE. THE LOADER GETS
THE VALUE OF THIS SYMBOL FROM DDT
IF POSSIBLE, NEGATES IT IF BIT 4.9
IS 1, THEN ADDS THE RESULT TO THE
FIELD OF THE LAST WORD LOADED AS
SPECIFIED BY BITS 4.6-4.7:
3=ENTIRE WORD
2=AC FIELD ONLY
1=RIGHT HALF ONLY
0=ENTIRE WORD, BUT SWAP HALVES OF
VALUE BEFORE ADDING.
THESE FOUR FIELDS CORRESPOND TO
OPCODE, AC, ADDRESS, AND INDEX FIELDS
RESPECTIVELY IN A LAP INSTRUCTION.
IF BIT 4.8 IS A 1, THEN ANOTHER WORD
FOLLOWS, CONTAINING THE VALUE OF THE
SYMBOL AS OBTAINED FROM DDT AT
ASSEMBLE TIME. IF THE VERSION NUMBER
OF THAT LISP (AS DETERMINED FROM THE
SECOND FILE HEADER WORD) IS THE SAME
AS THAT OF THE LISP BEING LOADED INTO,
THEN THIS VALUE IS USED AND DDT IS NOT
CONSULTED AT LOAD TIME; THIS IS FOR
SPEED. IF THE VERSION NUMBERS ARE
DIFFERENT, THEN DDT IS CONSULTED.
10 ARRAY REF ONE WORD TO BE LOADED, WHOSE RIGHT HALF
CONTAINS THE ATOMINDEX OF AN ATOMIC
SYMBOL. IF THE SYMBOL HAS AN ARRAY
PROPERTY, IT IS FETCHED; OTHERWISE
ONE IS CREATED. THE RIGHT HALF OF THE
WORD TO BE LOADED IS REPLACED WITH
THE ADDRESS OF THE SECOND WORD OF THE
ARRAY POINTER (I.E. OF THE TTSAR).
IN THIS WAY ACCESSES TO ARRAYS CAN BE
OPEN-CODED.
11 UNUSED [ERROR IN FILE]
12 ATOMTABLE INFO A HEADER WORD, POSSIBLY FOLLOWED BY
OTHERS, DEPENDING ON BITS 4.7-4.8:
IF 0, THE RIGHT HALF IS THE NUMBER
OF WORDS FOLLOWING, WHICH CONSTITUTE
THE PNAME OF A PNAME-TYPE ATOM, IN THE
ORDER OF THEIR APPEARANCE ON A
PROPERTY LIST. THE ATOM IS INTERNED.
IF 1, THE ONE WORD FOLLOWING IS
THE VALUE OF A FIXNUM TO BE CREATED.
IF 2, THE FOLLOWING WORD IS THE VALUE
OF A FLONUM. IF 3, THE RIGHT HALF IS
THE NUMBER OF FIXNUM COMPONENTS OF A
BIGNUM FOLLOWING, MOST SIGNIFICANT
WORD FIRST. THE HEADER WORD CONTAINS
THREE BITS OF THE SIGN OF THE BIGNUM
IN BITS 3.1-3.3.
THE ATOM THUS CREATED IS ASSIGNED A
PLACE IN THE ATOMTABLE MAINTAINED BY
THE LOADER (AS AN ARRAY) USING
CONSECUTIVE LOCATIONS; FROM THAT POINT
ON OTHER DATA ITEMS REFERRING TO THAT
ITEM CAN DO SO BY THE INDEX OF THE
ATOM IN THIS TABLE.
SEE ALSO TYPES 5 AND 16, WHICH ALSO
MAKE ENTRIES IN THE ATOMTABLE.
13 ENTRY INFO TWO WORDS. THE LEFT HALF OF THE FIRST
WORD IS THE ATOMINDEX OF THE NAME OF
THE FUNCTION BEING DEFINED; THE RIGHT
HALF THAT OF THE SUBR TYPE (THE
PROPERTY UNDER WHICH TO CREATE THE
ENTRY POINT, E.G. SUBR OR FSUBR).
THE RIGHT HALF OF THE SECOND WORD IS
THE LOCATION OF THE ENTRY POINT AS A
RELOCATABLE POINTER: THE LOAD OFFSET
MUST BE ADDED TO IT. THE LEFT HALF OF
THE SECOND WORD CONTAINS INFORMATION
USED TO CREATE AN ARGS PROPERTY FOR
THE FUNCTION AS SPECIFIED IN THE
ORIGINAL LAP CODE. IF THIS HALFWORD
IS ZERO, NO ARGS PROPERTY IS CREATED
AND ANY ALREADY PRESENT IS REMOVED.
OTHERWISE THE HALFWORD IS DIVIDED INTO
TWO NINE-BIT BYTES, EACH OF WHICH IS
CONVERTED AS FOLLOWS:
BYTE RESULT
0 NIL
777 777
N N-1, WHERE N IS NOT 0 OR 777
THESE TWO ITEMS ARE THEN CONSED AND
FOR THE ARGS PROPERTY.
14 LOC THE WORD IS A RELOCATABLE QUANTITY
SPECIFYING WHERE TO CONTINUE LOADING.
IT IS NOT PERMITTED TO LOC BELOW THE
ORIGIN OF THE ASSEMBLY. IF THE LOC
IS TO A LOCATION HIGHER THAN ANY YET
LOADED INTO, THEN FASLOAD ZEROS OUT
ALL WORDS ABOVE THAT HIGHEST LOCATION
UP TO THE LOCATION SPECIFIED.
FASLOAD KEEPS TRACK OF THE HIGHEST
LOCATION EVER LOADED INTO; THIS VALUE
PLUS ONE BECOMES THE VALUE OF BPORG
AT THE END OF ASSEMBLY, REGARDLESS
OF THE STATE OF THE LOCATION POINTER
WHEN LOADING TERMINATES.
15 PUTDDTSYM FIRST WORD, THE SYMBOL IN SQUOZE CODE.
IF BIT 4.9=0, THE SYMBOL IS DEFINED TO
DDT IF POSSIBLE WITH THE ADDRESS OF THE
WORD OF BINARY PROGRAM SPACE ABOUT
TO BE LOADED INTO AS ITS VALUE.
IF BIT 4.9=1, THE VALUE IS GOBBLED FROM
THE FOLLOWING WORD. BIT 4.8 (OF THE WORD
CONTAINING THE SQUOZE) MEANS RELOCATE
THE LEFT HALF OF THE VALUE BY THE LOAD
OFFSET, AND BIT 4.7 LIKEWISE FOR THE
RIGHT HALF.
WHETHER OR NOT THE SYMBOL ACTUALLY GETS
PUT IN DDT'S SYMBOL TABLE IS A FUNCTION
OF THREE CONDITIONS: FIRST, THAT THERE
IS A DDT WITH A SYMBOL TABLE; SECOND,
THE VALUE OF THE VARIABLE SYMBOLS;
THIRD, BIT 4.6 OF THE FIRST PUTDDTSYM
WORD. THE FIRST CONDITION OF COURSE MUST
BE SATISFIED. IF SO, THEN THE SYMBOL IS
PUT IN THE SYMBOL TABLE ONLY IF SYMBOLS
HAS A NON-NIL VALUE. FURTHERMORE, IF
THAT VALUE IS THE ATOM SYMBOLS ITSELF,
THEN THE SYMBOL IS PUT ONLY IF BIT 4.6
IS ON (INDICATING A "GLOBAL" SYMBOL).
16 EVAL MUNGEABLE A SERIES OF WORDS SIMILAR TO THOSE
FOR TYPE 5, BUT WITH NO FOLLOWING
HASH KEY. AN S-EXPRESSION IS
CONSTRUCTED AND EVALUATED. THIS IS
USED FOR THE SO-CALLED "MUNGEABLES"
IN A FILE OF LAP CODE.
IF THE LEFT HALF OF THE LAST WORD IS
-1, THE VALUE IS THROWN AWAY. IF IT
IS -2, THE VALUE IS ENTERED IN THE
ATOMTABLE.
17 END OF BINARY ONE WORD, WHICH MUST BE "*FASL*" IN
SIXBIT. THIS SHOULD BE THE LAST DATA
WORD IN THE FILE. ANY RELOCATION
BYTES LEFT OVER AFTER A TYPE 17 ARE
IGNORED.
THIS SHOULD BE FOLLOWED EITHER BY END OF FILE OR A WORD
FULL OF ^C'S.

86
doc/_info_/lisp.cursor Executable file
View File

@@ -0,0 +1,86 @@
Cursorpos in Lisp:
CURSORPOS is an LSUBR of 0-3 evaluated arguments. If no arguments are
given, then the cursor coordinates of the default output TTY are returned
as a dotted pair in the form (line# . column#). If args are specified,
then the result is determined as shown below (returns "T" on success, "NIL"
on failure) and if the last arg is a TTY output file then it is used
instead of the default. Note that the "T" option alone will return the
coordinates of TTY "T" rather than homing the cursor; see "T" below. With
two numeric args given, the cursor is moved to the ARG1th line and ARG2th
column.
These are the special codes used for (CURSORPOS [<options>]):
A Advance to a fresh line. If at beginning of line do nothing,
else act like a CRLF.
B move Backward. Decrements the horizontal position.
If the horizontal position is 0, it is set to the horizontal
screen size (wraparound from left margin to right margin).
C Clear screen. The cursor goes to the upper left corner and
the whole screen is cleared. On a printing tty (%TOMVU is 0)
a CRLF is output, since "clearing the screen" is undefined.
If "C" is output to the echo area, only the echo area is
cleared, and only the echo area cursor is moved.
D move Down. The vertical position is incremented. If it becomes
equal to the vertical screen size, it is set to 0.
E clear to Eof. The remainder of the current line, and all lower
lines, are erased. The cursor doesn't move.
F move Forward. The horizontal position is incremented. At the
end of the line it wraps around to the beginning of the
same line.
H set Horizontal position. Takes one extra argument: it
should be the desired horizontal position setting.
The vertical position is not changed. An attempt to
set the position beyond a margin will position it at the
margin.
I Outputs a one-position printing character. Takes an extra
argument: the numeric ASCII code of the desired character.
K Kill (erase) the character the cursor points at. The cursor
does not move. The position erased is the one that would be
written in next by ordinary output.
L clear Line. The current line, starting with the position that
the cursor points at, is erased. The cursor does not move.
M (More) hang up until a character is read in then home-up.
N (No home-up) similar, but don't home up after the character is
read.
P output a .
Q output a .
R Restore cursor position. The cursor is set to the most
recently saved value.
S Save cursor position. Remembers the current cursor position
for use with "R". There is no stack for saved cursor
positions; only the most recent saved position is remembered.
T go to Top of screen (home up). The cursor is positioned at the
upper left corner of the screen. Note: since "T" will be
taken to mean output TTY "T" an alternate form must be used.
(CURSORPOS 'top), (CURSORPOS 84.), and (CURSORPOS 'T 'T) will
all work.
U move Up. The vertical position is decremented. If it was 0,
it becomes equal to the vertical size minus one.
V set Vertical position. Takes an argument--the desired vertical
position. An attempt to set the cursor beyond the top or bottom
margin will position it as far as allowed in the desired direction.
Similarly, "V" will not move the echo area cursor outside the echo
area. Note that vertical positions in the echo area are to be
specified relative to the top of the echo area.
X backspace and erase one character ("B" followed by "K").
Z home down. The cursor is positioned at the lower left corner.
] obsolete - same as "L".
[ insert line. The current line and all lines below it are
pushed down one slot. A blank line appears at the current
position. The cursor does not move. Works only on terminals
which have %TOLID set ("\" also). See :TTYVAR TTYOPT
for information on %TOLID.
\ delete line. The current line disappears, and all the lines
below it move up by one position. The bottom line becomes
blank. The cursor does not move.
^ insert character. All the characters after the cursor move
right one position. The last one moves off the right margin
and disappears. A space appears at the cursor, which does not
move. Works only on terminals which have %TOCID set ("_" also).
See :TTYVAR TTYOPT for information on %TOCID.
_ delete character. The character at the cursor disappears, and
all the rest of the characters on the line move left one
position. A space appears at the end of the line. The cursor
does not move. Note: it's an underscore, not hyphen.

248
doc/_info_/lisp.defvst Executable file
View File

@@ -0,0 +1,248 @@
DEFVST is an acronym for "DEFine a Vector-like STructure"
All entries in a Vector-like structure are "pointers" (FIXNUMs, LISTs, etc)
Future plans call for
DEFBST - "DEFine a Bitstring-like STructure", useful where
the structure is an interface to some memory
block required to be sequential by, say, operating
system conventions, or hardware needs.
DEFSTRUCT - "DEFine a general STRUCTure"
which will be done by composing DEFVST and DEFBST.
Vector-like structures are implemented as EXTENDs, which are emulated in
maclisp by HUNKs, and on the LISPMachine by 1-dimensional
ART-Q arrays; EXTENDs interface to a CLASS system, which in MacLISP
interface will be activated at any time when the CLASS system is loaded --
only a skeletal amount of information is necessary in each class
of vector-like structures in order to prepare for the link-up.
Free (global) variables controlling actions:
CONSTRUCTOR-NAMESTRING-PREFIX - constructor name is obtained by
concatenating this string with the
structure name.
SELECTOR-NAMESTRING-STYLE - () ==> selector macro name is same
as keyword (variable name).
- "xxx" ==> selector macro name gotten
by concatenating structure
name, "xxx", and keyword.
Basic macros: DEFVST for defining a structure
SETVST for updating a selected component
(and SETF)
Also, an interface from DEFSTRUCT has been defined (see its documentation).
Additional functions:
STRUCT-TYPEP for "structures", returns the given name,
and for non-structures, returns ().
|defvst-construction/||, |defvst-initialize/||, |defvst-typchk/||,
|defvst-construction-1/||, |defvst-selection/||, and |defvst-xref/||
are internal helper functions.
Usage is like:
(DEFVST SHIP
(X-POSITION /: FIXNUM)
Y-POSITION
(MASS = 1000.)
(COST (DAY-HIGH-PRICE))
COLOR )
(SETVST (SHIP-X-POSITION QE2) 109.)
or alternatively,
(SETF (SHIP-X-POSITION QE2) 109.)
since SETF will macroexpand out the component selector, and thus turn
into SETVST, on structures references. Also, a set of "options" may
be specified by including the structure name in a list:
(DEFVST (SHIP <option1> <option2> ...) ...)
currently, only :CONSTRUCTOR and :NO-SELECTOR-MACROS are valid options.
Note that "=" is used as a keyword in the component part to mean
an initialization form follows; and that a component specification
which is just a 2-list is expanded like
(<component-name> <form>) ==> (<component-name> = <form>)
This is done for compatibility of style with the LISPM defstructure.
See further notes below for the meaning of the ":" in the default form.
The SETVST macro (and SETF) is used in conjunction with DEFVST. The
example use of DEFVST "defines" a vector-like structure of 4 components;
the generic name of this structure is "SHIP", and the components are
identified by the ordering of what are called keywords - X-POSITION,
Y-POSITION, MASS, and COLOR. Each "definition" causes the creation of
1) A constructor macro, whose name (normally) is obtained by prefixing
the string "CONS-A-" onto the generic name of the structure.
(Actually, it gets this prefix string from the variable
CONSTRUCTOR-NAMESTRING-PREFIX, so that it can be modified)
In the example, this becomes CONS-A-SHIP. The constructor
permits installing values into the component slots at instantiation
time, which are evaluated from either the (default) forms supplied
by the invocation of DEFVST, or from the forms obtained by keyword
parameters in the instantiating form. E.g.
(CONS-A-BANK DOLLARS (PLUS 300. WALLET) MANAGER '|Jones, J.|)
would put the numerical value of 300.+WALLET in the DOLLARS
component of a newly-created bank, and install |Jones, J.| as
its MANAGER. When the CONSTRUCTOR option is given, the user
supplies a specific name for this macro.
2) N selector macros, one for each keyword (which denotes one
component slot), which are obtained (normally) by concatenating
the generic name, a "-", and the keyword name. (Actually,
the middle string is obtained from the value of the variable
SELECTOR-NAMESTRING-STYLE, so that it can be modified)
In the example, we have SHIP-X-POSITION, SHIP-Y-POSITION,
SHIP-MASS, and SHIP-COLOR.
2a: (SHIP-X-POSITION QE2)
to obtain the x-coordinate of QE2
2b: (SETVST (SHIP-X-POSITION QE2) 109.)
to change the x-coordinate to of QE2 to 109.
One interesting facet of the selector macroexpansions is that
when done for compilation, the turn into the MacLISP CXR,
which can generally be open-coded in one or two instructions.
But when expanded during interpretation, the go thru a
safety checking function, which assures that a selector
created for a SHIP structure is only applied to SHIP structures,
and not to other kinds of data, or other structures.
When the NO-SELECTOR-MACROS option is given, then these macros,
like SHIP-X-POSITION, are not created; this is intended to
delete the spurious creation of macros, when another macro
package is using DEFVST like a subroutine.
3) An information structure, stored as the STRUCT=INFO property
of the generic name symbol. This information has the shape
(DEFVST STRUCT=INFO
VERSION-NUMBER
GENERIC-NAME
CONSTRUCTOR-NAME
NUMBER-OF-NAMED-COMPONENTS
COMPONENT-DEFAULT-INITIALIZATION-LISTS
CLASS-SKELETON)
The generic name corresponds to the "name" of the structure
being defined; in the example, it is BANK. The version number
corresponds to a version of "implementation status" for DEFVST --
thus it should be possible to make rather radical changes in
the future implementation, while maintain compatibility with
previously compiled structures (that means that existing FASL
files won't have to be recompiled whenever some change to
DEFVST is made).
The zero'th element of the initializations is either (), or a
3-list of the key-name, selector-name, and default size for the
&REST component - the "block" of unnamed components in the
structure. The remaining elements of the initializations are
the "initialization lists" for each named component:
(<key-name> <corresponding-selector>)
;() initial value, no restrictions
(<key-name> <corresponding-selector> <ini-val-form>)
;no restrictions
(<key-name> <corresponding-selector>
<ini-val-form> . <list-of-types-for-restrictions>)
CONSTRAINTS, and INITIAL VALUES
Each of the components may be constrained to be a particular
type datum, and may be initialized according to the form supplied
as default by the call to DEFVST.
The syntax for a non-simple component specification is a list with
the first element being the key name, the item following the first
"=" in the list being a form which is the default form to be evaluated
for that component in any creations of instances of that structure,
and the element following the first ":" is either a type name or list
of type names that restricts any creating instance from supplying an
initial value of the wrong type. If a key has a restriction
associated with it, but no default initial-value form, then DEFVST
picks some default value consistent with the restriction.
Consider the example
(DEFVST BANK
(DOLLARS : (FIXNUM FLONUM MUMBLE))
MANAGER
(LIMIT : (FIXNUM FLONUM) = 1000000.0)
&REST
VAULTS
30.)
First, the macro invocation of DEFVST would expand into
(EVAL-WHEN (EVAL COMPILE LOAD)
(AND (STATUS FEATURE COMPLR) (SPECIAL BANK-CLASS))
(DEFPROP BANK BANK-CLASS CLASS-VAR)
(|defvst-initialize/||
'BANK ;structure name
'CONS-A-BANK ;constructor name
3 ;number of components in each structure
'#((VAULTS BANK-VAULTS 36) ;vector of slot information
(DOLLARS BANK-DOLLARS 0 FIXNUM FLONUM MUMBLE)
(MANAGER BANK-MANAGER)
(LIMIT BANK-LIMIT 1000000.0 FIXNUM FLONUM))
2 ;"generation" number of DEFVST
'((DSK JONL) TEST EXAMPL)) ;file being processed when DEFVST expanded
(DEFPROP BANK-VAULTS (BANK 4 &REST) SELECTOR)
'BANK)
The internal function |defvst-initialize/|| creates the STRUCT=INFO
property for BANK, and sets up macro definitions for all the selector
names, and for the constructor name; also, a "skeleton" is framed
so that all instances may be grouped into a CLASS of such structures.
(This information is kept in in the STRUCT=INFO property.) When the
CLASS system is actually loaded, the skeletons will be fleshed out
to the full degree [ see the documentation on the MacLISP SEND
facility, and on the EXTENDed CLASS system].
After that, then, a "simple" creation instance will take default values
for all components with either initial value or restriction
specifications, and null in the unspecified components; for example
(CONS-A-BANK)
then yields an instance, which when printed as a VECTOR, is like
#( 0 () 1.0E6 () . . . () )
namely, a bank with three named components, and with 30. unnamed
components which are accessed as if VAULTS were a vector name.
Note that the the function CLASS-OF (and also SI:EXTEND-CLASS-OF)
gets the class descriptor for this class of structures, which
may be only a "skeleton" when the CLASS system isn't loaded.
A more complex example of construction, such as,
(CONS-A-BANK DOLLARS (CASEQ VIP
(FEDERAL 15.0E9)
(SAVINGS-&-LOAN 10.0E6)
(MICKEY-MOUSE 1))
MANAGER '|Jones, J.|
LIMIT (BANK-DOLLARS CURRENT-CONSTRUCTION)
VAULTS 12.)
illustrates four points of a creating instance - -
(1) keywords paired with initial values are just alternating
pairs in the list, and
(2) the forms for initial values are substituted into a piece of
code output by the macro, so that they are evaluated at
instantiation time, and
(3) the variable CURRENT-CONSTRUCTION is temporarily bound to the
structure being created so that it may be referenced; the
installing of initial values happens last.
(4) components which are under a restriction, and are not constant
(at compile time) must be submitted to dynamic type checking.
Notice how this macro-expands --
(LET ((CURRENT-CONSTRUCTION (SI:MAKE-EXTEND 33. BANK-CLASS)))
(SETVST (BANK-DOLLARS CURRENT-CONSTRUCTION)
(|defvst-typchk/|| (CASEQ VIP
(FEDERAL 1.5E+10)
(SAVINGS-&-LOAN 10000000.0)
(MICKEY-MOUSE 1))
'(FIXNUM FLONUM MUMBLE)
'BANK-DOLLARS))
(SETVST (BANK-LIMIT CURRENT-CONSTRUCTION)
(|defvst-typchk/|| (BANK-DOLLARS CURRENT-CONSTRUCTION)
'(FIXNUM FLONUM)
'BANK-LIMIT))
CURRENT-CONSTRUCTION)
This code might actually not run, since it could stop on a Restriction
Violation if the variable VIP does not have a value among
FEDERAL, SAVINGS-&-LOAN, MICKEY-MOUSE
for then it would turn up a () for the DOLLARS component, which
was specified to be restricted to fixnums.
Further macro-expansion causes the "SETVST"s to become "SI:XSET"s.
In maclisp, SI:XREF becomes CXR, SI:XSET becomes RPLACX, and
SI:MAKE-EXTEND becomes MAKHUNK (that is how EXTEND's are emulated
there). Neither the EXTEND package nor any runtime CLASS facilities
need be loaded in the runtime environment of code which uses structures,
since dynamic tests are made before any of these facilites are are used
(that is, any facility beyond the MacLISP native HUNK capability).

239
doc/_info_/lisp.edit Executable file
View File

@@ -0,0 +1,239 @@
The following excerpts from the historical maclisp update files
may help the luser of the Kludgy Binford Editor
5/15/71 -JONL-
. . .
8) THE BINFORD EDITOR HAS BEEN IN LISP FOR SOME TIME, BUT WAS
UNDOCUMENTED [EXCEPT BY WORD OF MOUTH.] FOR THOSE WHO HAVE ALREADY
USED IT, NOTE THAT IT HAS BEEN CHANGED EVER SO SLIGHTLY IN LISP 190]
EVAL'ING (EDIT) ENTERS EDIT MODE, WHEREIN COMMANDS ARE GIVEN SIMILAR
TO TECO COMMANDS, ACTION IS TAKEN ON SOME EXPRESSION CURRENTLY IN THE
WORKING SPACE, AND A WINDOW AROUND THE POINTER IS PRINTED OUT AFTER
EVERY COMMAND EXECUTION. (EDIT T) ENTERS EDIT MODE BUT DOES NOT
TYPE OUT THE WINDOW AFTER EVERY COMMAND. [THE P COMMAND WILL CAUSE
PRINTING OF THE WINDOW - USEFUL WHEN AT A TELETYPE]. COMMANDS ARE:
Q<SPACE> EXIT FROM THE EDITOR BACK TO LISP.
Y<SPACE>ATOM<SAPCE> CAUSES THE FUNCTION PROPERTY OF ATOM TO
BE BROUGHT IN FOR EDITING.
YP<SPACE>ATOM<SPACE>PROP<SPACE> YANK IN THE PROP PROPERTY OF
THE ATOM ATOM.
YP<SPACE>ATOM<SPACE> YANKS THE WHOLE PROPERTY LIST OF ATOM.
J<SPACE> CAUSES THE POINTER [WHICH IS PRINTED OUT AS ] TO
JUMP TO THE TOP OF THE WORKING EXPRESSION.
S<SPACE>E1 . . . EN<SPACE><SPACE> SEARCHES FOR AN OCCURENCE
OF THE SEQUENCE OF S-EXPRESSIONS E1 . . . EN AND
MOVES THE POINTER JUST TO THE RIGHT IF SUCCESSFUL.
NOTE THAT THE LISP READER IS USED FOR READ-IN BY THE
EDITOR, SO THAT THE ATOM <ALTMODE><ALTMODE> MUST BE
FOLLOWED BY SOME ATOM TERMINATING CHARACTER
[SUCH AS <SPACE>].
I<SPACE>E1 . . . EN<SPACE><SPACE> INSERTS AT THE CURRENT
POINTER POSITION THE SEQUENCE E1 . . . EN
K<SPACE> KILLS THE S-EXPRESSION JUST TO THE RIGHT OF THE
POINTER, AND SAVES IT AS THE VALUE OF THE ATOM .
IV<SPACE>EXP INSERTS THE VALUE OF THE S-EXPRESSION EXP.
ESPECIALLY USEFUL WHEN INSERTING STUFF DELETED FROM
SOME PRIOR POINT.
EV<SPACE>EXP MERELY EVALUATES EXP.
HENCEFORWARD, <SPACE> WILL NOT BE EXPLICITLY WRITTEN OUT, BUT WILL BE
UNDERSTOOD TO BE THE COMMAND TERMINATION CHARACTER. THE NEXT GROUP
OF COMMANDS ADMIT AN OPTIONAL NUMERIC ARGUMENT [BASE 10.], PRECEEDING
THE COMMAND, TO BE INTERPRETED AS A REPLICATION NUMBER:
F MOVE FORWARD [RIGHTWARDS] PAST ONE TOKEN. A TOKEN IS
EITHER A PARENTHESIS OR AN ATOM.
C SAME AS F
-B SAME AS F
B MOVE BACK [LEFTWARDS] OVER ONE TOKEN.
-C SAME AS B
-F SAME AS B
R MOVE RIGHTWARDS PAST THE NEXT S-EXPRESSION.
L MOVE LEFT OVER ONE S-EXPRESSION.
D MOVE "DOWN" INTO THE FIRST NON-ATOMIC S-EXPRESSION TO THE
RIGHT OF THE POINTER.
U MOVE "UP" OUT OF THE S-EXPRESSION CONTAINING THE POINTER.
K KILL ALSO ADMITS A REPLICATION NUMBER.
PW ARG IS NOT REALLY A REPLICATION NUMBER,
BUT RATHER THE "WINDOW WIDTH" IN NUMBER OF TOKENS.
THE FOLLOWING LITTLE USED COMMANDS MAY POSSIBLY BE OF SOME INTEREST:
( INSERT A VIRTUAL OPEN PARENTHESIS.
) INSERT A VIRTUAL CLOSE PARENTHESIS.
D( VIRTUALLY DELETE AN OPEN PARENS
D) VIRTUALLY DELETE A CLOSE PARENS
() RESTRUCTURE THE WORKING S-EXPRESSION ACCORDING TO THE
VIRTUAL PARENTHESES AND DELETIONS.
[[Note: the "virtual parens" stuff probably doesn't work right -- JONL]]
7/8/73 - JONL -
. . .
THE VALUE OF THE VARIABLE EDIT IS NOW (AS OF LISP 486) A LIST OF FLAGS
THAT THE IN-CORE EDITOR WILL USE WHEN SEARCHING FOR A FUNCTION
DEFINITION. THUS TO EDIT CNVR FUNCTIONS, ONE MAY WANT TO DO
(SETQ EDIT (CONS 'CEXPR EDIT))
THE VALUE OF THE VARIABLE  IS THE BACK-UP CHAIN FOR THE EDITOR,
THE CAR OF WHICH WILL BE POINTING TO THE PLACE IN YOUR FUNCTION WHERE
THE CURRENT EDIT CURSOR IS. THUS, ONE MAY USE THE EDITOR TO POSITION
THE EDIT-CURSOR, AND THEN RUN OTHER PROGRAMS THAT "TAKE IT FROM THERE"
AUG 17, 1974 LISP 893 - GLS AND JONL -
. . .
[3] NEW COMMANDS FOR THE BINFORD EDITOR:
SS (SAVE SPOT) GOBBLES THE NAME OF AN ATOMIC
SYMBOL, AND SETQ'S IT TO THE CURRENT EDITOR
CONTEXT.
RS (RESTORE SPOT) GOBBLES SUCH A SETQ'D ATOMIC SYMBOL
AND MAGICALLY MOVES THE EDITOR'S CURSOR TO THE
SAVED SPOT.
PC (PRINT CONTEXT) GOBBLES UP TO TWO FLONUMS (TERMINATE
WITH $$) AND, USING THEM FOR THE PRINLEVEL AND
PRINLENGTH, PRINTS THE CURRENT LEVEL OF LIST
STRUCTURE. IF YOU DON'T SUPPLY TWO ARGS,
DEFAULTS OF 4 ARE USED.
TUESDAY SEPT 14,1976 FM+6D.1H.33M.7S. LISP 1211 -GLS,JONL-
. . .
[7] CHANGES TO THE "BINFORD EDITOR" (EDIT FUNCTION):
[7.1] THE COMMANDS "C" AND "-C" HAVE DISAPPEARED.
THEY WERE EQUIVALENT TO THE STILL-EXISTING
"F" AND "-F" COMMANDS.
[7.2] "SS" = "SAVE SPOT", "RS" = "RESTORE SPOT"
BOTH TAKE AN ATOMIC SYMBOL AS AN ARGUMENT.
SS SAVES THE CURRENT "SPOT" (WHERE THE $$ APPEARS)
AS THE VALUE OF THE SPECIFIED VARIABLE, AND RS
RETURNS TO THAT SPOT. THUS:
SS FOO
... LOTSA EDITING ...
RS FOO
<NOW CURSOR IS WHERE IT WAS BEFORE THE SS>
[7.3] AN ARGUMENT TO EDIT NO LONGER CONTROLS THE AUTO-PRINT
FEATURE (SEE [7.4] BELOW); INSTEAD, IT SHOULD BE AN
ATOMIC SYMBOL, THE NAME OF A FUNCTION. AS THE EDITOR
IS ENTERED, THAT FUNCTION IS "YANKED" SO THAT EDITING
MAY BEGIN ON ITS CODE WITHOUT EXPLICITLY USING THE
"Y" COMMAND. THE VALUE OF THE VARIABLE "EDIT"
CONTROLS WHICH PROPERTIES WILL BE HUNTED FOR BY THE
"Y" OPERATION [INITIAL VALUE IS (EXPR FEXPR MACRO)].
[7.4] "SP" = "START/STOP PRINTING" TOGGLES THE STATE OF
THE AUTOMATIC PRINTOUT AFTER EACH COMMAND.
[7.5] "-KI" IS LIKE "L KI"; THAT IS, IT REPLACES THE
PRECEDING S-EXPRESSION WITH ITS ARGUMENT.
[7.6] AN "S" COMMAND IMMEDIATELY FOLLOWED BY "$$"
(I.E. A NULL SEARCH STRING" WILL REPEAT THE PREVIOUS
SEARCH, AS IN TECO.
[7.7] YANKING IN A VALUE PROPERTY NOW WINS. THUS:
YP FOO VALUE $$
ALLOWS YOU TO EDIT THE VALUE PROPERTY OF FOO.
WEDNESDAY DEC 29,1976 FQ+1D.9H.29M.54S. LISP 1251 -JONL-
. . .
8) EDIT ALLOWS THE USER TO DEFINE NEW EDITING FUNCTIONS. PUTTING AN
"EDIT" PROPERTY ON AN ATOM MAKES IT AN EDITOR COMMAND, AND WHEN
INVOKED, THAT FUNCTIONS IS CALLED WITH THREE ARGUMENTS:
I) REPEAT COUNT
II) THE CURRENT "LEFT-LIST" (VALUE OF THE ATOM )
III) THE CURRENT "UP-LIST"
FOR MORE DETAILS, SEE THE FILE MC:LISP;EDITOR >
THURSDAY JAN 06,1977 FM+1D.23H.52M.11S. LISP 1252 - GLS -
. . .
[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.
1/13/78 LISP 1383
. . .
[3] THE EDITOR COMMAND YV FOO IS THE SAME AS YP FOO VALUE .
IT IS USEFUL FOR EDITING THE VALUE OF A SYMBOL.
Thursday June 07,1979 FQ+5D.11H.58M.56S. - Jonl -
. . .
5) The famous but Kludgy Binford Editor is now autoloadable.
Thus it is no longer part of the initial ITS maclisp environment.
REMEMBER:  holds the last thing killed
 holds the "back-upwards" list
^^^ holds the "back-leftwards" list
EDIT hold a list of the names for "editible" properties
"S", that is the search command, with no trailing arguments,
means to search again for the same thing as before.
Both "S" and "I" take arbitrarily many trailing arguments,
terminated by <alt-mode><altmode><space>
Also, any symbol with an EDIT property may be an edit command,
wherein the function stored under the EDIT property is applied
to a number: 0 means no numeric arg to function
n > 0 is the numeric argument given to the command

175
doc/_info_/lisp.extend Executable file
View File

@@ -0,0 +1,175 @@
Functions:
PTR-TYPEP Primitive TYPE name for a datum -- see MC:NIL;NEWFUN >
for specifics.
EXTENDP
SI:EXTENDP A basic primitive type is the EXTEND, which is just a chunk
of index-access components, and a link to a descriptor object
which is itself another EXTEND. In fact, these "descriptor
objects" are essentially CLASSes in the LISPM and SMALLTALK
sense. In MacLISP, they are emulated with hunks.
EXTEND-LENGTH
SI:EXTEND-LENGTH The argument is an "instance" and this function just
counts the number of components in that instance.
SI:MAKE-EXTEND Takes two arguments -- first is number of "slots"
to be allocated in the instance, 2nd is CLASS object for which
an instance is being created,
SI:MAKE-RANDOM-EXTEND Basically, like SI:MAKE-EXTEND, except that
the 2nd arg is optional, and it is not required to be a
CLASS object (but will be put into the class-link slot).
This is primarily for bootstrapping class-like systems.
SI:EXTEND First arg must be a CLASS -- remaining args are constructed
into an object of that CLASS; (SI:EXTEND SOME-CLASS 'T () )
would cons up a "SOME", and (SI:XREF frob 0) would get the 'T.
SI:XREF basic accessor for EXTENDs, e.g. (SI:XREF <ob> <index>)
SI:XSET basic updator, e.g. (SI:XSET <ob> <index> <val>)
CLASSP A predicate which is "true" iff its arg is not only an EXTEND,
but a class descriptor for some class of objects; such an
object, a CLASS object, will henceforth just be called a CLASS.
CLASS-OF For any argument, will return the CLASS for which that argument
is an instance; arguments of "primitive" type (i.e., not a
EXTEND) will be classified according to a systemic table,
whereas an EXTEND itself will have a direct link to its CLASS.
SEND Takes two or more arguments; the first is an object to
be acted upon, the second is a "keyword" which will be used
to select a method from among those accessible in the CLASS
of the first argument, and the remaining arguments are
just additional arguments to the method function.
SEND-AS Takes three or more arguments. Second arg is some object
to be acted upon (third is "keyword") just as with SEND, but
first argument is a CLASS which is to be the root for method
searching rather than the the class of the active object.
ADD-METHOD Takes args -- (<keyword> <fun> <class>) -- and stores the
function <fun> as a <keyword> method in the CLASS <class>.
Thus if SEND sends a message with the key <keyword> to an
object in the CLASS <class> (or to any object whose CLASS has
<class> as a superior class), then <fun> will be invoked.
There is an as-yet undocumented means for specifying the
method-searching function on a class by class basis.
FIND-METHOD (FIND-METHOD <msg> <class>) Returns the function
which will handle message <msg> for the CLASS <class>.
DESCRIBE Prints a brief description of the object; for EXTENDed
objects, retrieves some information from the corresponding
CLASS; for CLASS's themselves, will also do the DESCRIBE
operation for all its superiors.
WHICH-OPERATIONS For any object as argument, will print out a sequence
of lines with the (1) name of each "operation" (or message)
which is applicable to this object (as well as any object in
the same CLASS), (2) the name of the function which will handle
that operation, and (3) the name of the CLASS from which that
method was "inherited." See also SI:OPERATIONS-LIST below.
TYPE-OF Retrieves the TYPE name as stored in the CLASS for the datum
given as argument. For all MacLISP primitive datatypes (like,
SYMBOLs, BIGNUMS, etc), this will be the same as the TYPEP of
the datum.
EQ-FOR-EQUAL? Takes two args -- returns "true" only if EQ is
satisfactory for the EQUAL test (e.g., as on SYMBOLs).
SI:DEFCLASS*-1 Argspectrum is like (<typename> <class-var> <suprs>
&optional (<class-name> <typename>))
Normally, called by using the DEFCLASS* macro;
<typename> is a symbol to be used to describe the "type" of
objects and is stored in a slot of the CLASS retrieveable
by SI:CLASS-TYPEP and TYPE-OF (see below).
<class-var> is a symbol which will be set to the CLASS about
to be created; conventionally, if FOO is chosen as the
type name, then FOO-CLASS is the class variable.
<suprs> a list of CLASSes which are to be considered superiors
of this class (for the purposes of inheritance of
properties, such as "methods").
SI:HAS-SUPERIOR A predicate, "true" iff the second arg is some super-
class of the first arg. Both arguments must be classs.
SI:WHERE-IS-METHOD As above with SI:FIND-METHOD, but returns the actual
CLASS under which that function was stored as a method.
SI:OPERATIONS-LIST Argument must be a CLASS; returns a list of items
like `(,<key> ,<fun> ,<class>), where <key> is a method
name (or message key word), <fun> is the function which
handles that method, and <class> is the CLASS in which it was
found. <class> will either be the same as the argument, or
one of the superiors of the argument.
The following functions (which are SUBR's) also have macro definitions
which are "enabled" when compiling, to produce more efficient compiled code:
EXTEND-LENGTH, EXTENDP (merely produces call to the "SI:"-named versions)
SI:MAKE-EXTEND, SI:EXTEND, SI:XREF, and SI:XSET
Macros (only):
DEFCLASS* (DEFCLASS* <name> <variable> <superiors> . <options>) creates
a new CLASS named <name>, and putting it in the variable named
<variable>; the superior class may not be ommited. Typical
use might be
(DEFCLASS* MUMBLENUM MUMBLENUM-CLASS (NUMBER-CLASS))
[Note that the value of OBJECT-CLASS is the CLASS which is the
root of the CLASS hierarchy].
DEFMETHOD* Defines a method for a particular class, to be used when a
specified message is sent. For example,
(DEFMETHOD* (KEY FOO-CLASS) (OBJ . <arg-vars>)
. <body>)
defines a KEY method for instances of class FOO. Then when
(SEND <bar> 'KEY <a1> <a2>) is executed, OBJ is bound to <bar>,
the <arg-vars> are bound (or "spread-out") to <a1> and <a2>,
and <body> is executed. KEY can be a list of keys instead of
a single key.
TYPECASEQ Like CASEQ, but dispatches on the "primitive" type of the
datum. E.g., (TYPECASEQ X ((SYMBOL STRING) 5) (T 6))
could be emulated by (CASEQ (PTR-TYPEP X)
((SYMBOL STRING) 5)
(T 6))
In some implementations, however, this will be done by a
fast dispatch through a table, rather than by sequence of
EQ comparisons.
MAPF A generalized Mapper, usable on VECTORs, FIXNUMs, as well as
lists. See MC:NIL;NEWFUN > for more details.
**SELF-EVAL** Most EXTENDed data will have this symbol stored in
the (CXR 1 <obj>) slot. The macro-expansion of
(**SELF-EVAL** ...) yields (QUOTE (**SELF-EVAL** ...))
**CLASS-SELF-EVAL** Same as for **SELF-EVAL**, but used only in CLASS's --
this provides a simple heuristic to distinguish them quickly
from other hunks, and other EXTENDs
SI:EXTEND-CLASS-OF 1 arg. If object is know to be an EXTEND, this will
produce much faster code than calling CLASS-OF.
SI:CLASS-VAR
SI:CLASS-NAME
SI:CLASS-TYPEP
SI:CLASS-SUPERIORS Each CLASS (an EXTENDED data object which serves as
a descriptor for a whole class of objects) has about 17.
slots of data, the 5 more important of which are listed here
by the accessor macro names. Typically, each class has some
symbolic name, and some global variable whose value is that
class object; e.g. let <v> be the CLASS for VECTORs, then
(SI:CLASS-NAME <v>) ==> VECTOR, and
(SI:CLASS-VAR <v>) ==> VECTOR-CLASS
As a general convention, any class named FOO has the
class variable FOO-CLASS. The SI:CLASS-TYPEP component
is the value to be returned by TYPE-OF. SI:CLASS-SUPERIORS
is a list of CLASS's of which this one is a subclass;
primarily, the superiors are of interest when searching
for applicable methods, and the search goes "upwards" in
order to "inherit" properties from the superiors.
Variables:
NULL-CLASS CLASS for ()
PAIR-CLASS CLASS for non-null lists
and CLASS's for standard MacLISP data types:
FIXNUM-CLASS, FLONUM-CLASS, BIGNUM-CLASS, SYMBOL-CLASS, ARRAY-CLASS
HUNK-CLASS, SFA-CLASS, FILE-CLASS, JOB-CLASS, RANDOM-CLASS
*:TRUTH In MacLISP world, this is just "T", but in a real
NIL, it will be a new, unique constant to mean
"true"; "false" will still be represented by ().
SI:INITIAL-CLASSES Holds a list of lists -- total of 22. -- each list
of which holds a little information about the initial
set up of the CLASS system; (mapcar 'CAR SI:INITIAL-CLASSES)
returns a list of the names of all initial CLASSes.
Error facilities:
Because the EXTEND facilities are designed to provide the MacLISP
user with some of the amenities of NIL or the LISPM, some extension
to the error system was needed, and it comes from the system file
LISP:CERROR -- CERROR and FERROR are supported, as on the LISPMachine,
but FORMAT is not forcibly loaded (it is called only when already loaded
so that one may use EXTENDs without having to load the humungous FORMAT file).
A few global variables are set up:
STANDARD-OUTPUT is set to T, and
ERROR-OUTPUT is set to a SFA which directs output to MSGFILES

119
doc/_info_/lisp.format Executable file
View File

@@ -0,0 +1,119 @@
This is an abbreviated version of FORMAT documentation, intended
for on-line use. It is intended as a quick reference only, and does
not contain detailed semantics.
FORMAT destination control-string &rest args
If DESTINATION is NIL, the formatted output is collected in a
"string"; if it is T, then the "standard default output stream" is
used, which the same as the NIL output filespec in Maclisp.
CONTROL-STRING may be a "string" (symbol), or a list. If it is a
list, then the elements are processed sequentially; if an element is
a "string" it is FORMATted; otherwise, the element should be a list,
and if the car of it is a recognized FORMAT directive, the
corresponding action is taken, and the cdr of that element is taken to
be the list of parameters to that directive. If it isn't a recognized
directive, then it is simply EVALed, and anything it writes to the
stream STANDARD-OUTPUT will appear in the result of FORMAT.
?FORMAT destination control-string &rest args
This is identical to FORMAT except in the interpretation of
DESTINATION, which is interpreted as a Maclisp style filespec. That
is, NIL means output to the standard default output stream, T means
the tty, etc.
FERROR condition control-string &rest args
This SIGNALs CONDITION with arguments of CONTROL-STRING, NIL, NIL,
and (spread) ARGS. In Maclisp, if CONDITION is NIL, then
CONTROL-STRING and ARGS are given to FORMAT to get a string argument
to give as a sole argument to ERROR. Otherwise, the SIGNAL function
is called, as it is on the Lisp Machine. SIGNAL is not defined here.
The Operators
Character args used parameters
----------------------------------------------------------------
~D One column-width, pad-char, comma-char
Output arg as a decimal integer, right justified. If the :
modifier is given, 3-digit groups will be separated by
comma-char. If the @ modifier is given, then the sign will be
output unconditionally.
~O Same as ~D, but outputs the number in octal.
~A One mincol, colinc, minpad, padchar
The argument is PRINCed, left-justified in a field mincol
wide. See ~< for interpretation of the other params.
~S Same as ~A, only uses PRIN1 (recognizes the PRIN1 hook, too).
~C One <none>
In Maclisp only: this operator should not be considered to be
properly defined yet, except insofar as ~C (no modifiers) will
try to output the character as it is (TYO plus "C-" and/or
"M-" for supra-ascii control and meta), and ~:@C will give a
long-winded fully spelled out naming of the character.
~P Hairy <none>
With no modifiers, this takes one arg, and if it is not 1,
prints a lower-case "s". The following is tentative, based on
feedback: If the : modifier is given, the previous arg is
used instead (ie, it sort of does a ~-1* first). If the @
modifier is given, then if the arg is 1 a "y" is printed,
otherwise "ies".
~* Hairy count
This ignores count (default 1) arguments. Count may be
negative.
~% None count
Outputs count (default 1) newlines.
~& None count
Performs the FRESH-LINE operation, and then outputs count-1
newlines. Count defaults to 1.
~| none count
Outputs count (default 1) formfeeds. This will do a
(CURSORPOS 'C) on TTYs.
~X none count
Outputs count (default 1) spaces.
~T none destination, increment
Spaces to column (plus destination (times n increment)) for
the smallest value of N needed to pass the current column.
Destination and increment default to 1. This may use absolute
cursor positioning on TTYs.
~~ none count
Outputs count (default 1) tildes.
~G hairy n
"Goes to" the Nth argument (zero origined). The : modifier
makes this relative, ie identical to ~*.
~[ One none
This formats the ARGth alternative of the portion of the
control string terminated by a matching ~] (ie they may be
nested) and separated by ~;, as in
"~[Siamese ~;Persian ~;Yu-shiang ~:;Unknown ~]Kitty".
The alternatives are zero origined. The : modifier given to
~; causes the following alternative to be treated as an "else"
clause; eg, an argument of 1 will give "Persian Kitty", and
an arg of anything but 0, 1, or 2 will give "Unknown Kitty".
~:[ one none
This is an "if" rather than a selection. The first
alternative string will be used if the arg is false, otherwise
the second will be.
~; This is the canonical control-string separater. It is not
itself defined, and any arguments, parameters, or modifiers it
uses are interpreted by whoever is using it as a delimiter.
~] Terminates ~[ or ~:[.
~< none mincol, colinc, minpad, padchar
The text between the ~< and the balancing ~> is "broken into
chunks" by delimiting ~;s, and justified in a field MINCOL
wide. With no modifiers, the leftmost segment will be left
justified, and the rightmost right justified. The : modifier
causes spacing to be put before the leftmost segment, and the
@ modifier after the rightmost. If there is only one segment
and no modifiers, then the segment will be right justified.
MINCOL is adjusted upwards in COLINC (default 1) increments so
that there will be at least MINPAD (default 0) pad characters
in each of the spacing breaks. Thus,
"~10<foo~;bar~>" => "foo bar", and
"~10<foobar~>" => " foobar", and
"~10:<foo~;bar~>" => " foo bar"
~> Terminates a ~> construct.
~R one none
~R prints its arg as a cardinal English number, eg "four";
~:R prints it as ordinal, eg "fourth";
~@R prints it as a Roman numeral, eg "IV";
~:@R prints it as an ole Roman numeral, eg "IIII".

973
doc/_info_/lisp.loop Executable file
View File

@@ -0,0 +1,973 @@
.c Thursday July 10,1980 3:59 LQ+5D.3H.56M.26S. -*- Text -*-
.chapter "Introduction"
LOOP is a Lisp macro which provides a programmable iteration
facility. The same LOOP module operates compatibly in both Lisp
Machine Lisp and Maclisp (PDP-10 and Multics). LOOP was inspired by
the "FOR" facility of CLISP in InterLisp; however, it is not
compatible and differs in several details.
The general approach is that a form introduced by the word
3loop* generates a single program loop, into which a large variety
of features can be incorporated. The loop consists of some
initialization (2prologue*) code, a body which may be executed
several times, and some exit (2epilogue*) code. Variables may be
declared local to the loop. The
features are concerned with loop variables, deciding when to end the
iteration, putting user-written code into the loop, returning a value
from the construct, and iterating a variable through various real or
virtual sets of values.
The 3loop* form consists of a series of clauses, each
introduced by a keyword symbol. Forms appearing in or implied by the
clauses of a 3loop* form are classed as those to be executed as
initialization code, body code, and/or exit code, but aside from that
they are executed strictly in the order implied by the original
composition. Thus, just as in ordinary Lisp code, side-effects may
be used, and one piece of code may depend on following another for
its proper operation. This is the principal philosophy difference
from InterLisp's "FOR" facility.
Note that 3loop* forms are intended to look like stylized English
rather than Lisp code. There is a notably low density of parentheses,
and many of the keywords are accepted in several synonymous forms to
allow writing of more euphonious and grammatical English. Some
find this notation verbose and distasteful, while others find it
flexible and convenient. The former are invited to stick to 3do*.
.space 1
.group
.lisp
(defun print-elements-of-list (list-of-elements)
(loop for element in list-of-elements
do (print element)))
.end_lisp
The above function prints each element in its argument, which
should be a list. It returns 3nil*.
.end_group
.space 1
.group
.lisp
(defun extract-interesting-numbers (start-value end-value)
(loop for number from start-value to end-value
when (interesting-p number) collect number))
.end_lisp
The above function takes two arguments, which should be
fixnums, and returns a list of all the numbers in that range
(inclusive) which satisfy the predicate 3interesting-p*.
.end_group
.space 1
.group
.lisp
(defun find-maximum-element (array)
(loop for i from 0 below (cadr (arraydims array))
maximize (funcall array i)))
.end_lisp
3Find-maximum-element* returns the maximum of the elements
of its argument, a one-dimensional array.
.end_group
.group
.space 1
.lisp
(defun remove (object list)
(loop for element in list
unless (equal object element) collect element))
.end_lisp
3Remove* is like the Lisp function 3delete*, except
that it copies the list rather than destructively splicing out
elements.
.end_group
.space 1
.group
.lisp
(defun find-frob (list)
(loop for element in list
when (frobp element) return element
finally (error '|Frob not found in list| list)))
.end_lisp
This returns the first element of its list argument which
satisfies the predicate 3frobp*. If none is found, an error is
generated.
.end_group
.chapter "Clauses"
Internally, LOOP constructs a 3prog* which includes
variable bindings, pre-iteration (initialization) code,
post-iteration (exit) code, the body of the iteration, and stepping
of variables of iteration to their next values (which happens on
every iteration after executing the body).
A 2clause* consists of the keyword symbol and any other
Lisp forms and keywords which it deals with. For example,
.lisp
(loop for x in l do (print x)),
.end_lisp
contains two clauses, "7for x in l*" and "7do (print x)*".
Certain of the
parts of the clause will be described as being 2expressions*, e.g.
"(print x)" in the above.
An expression can be a single Lisp form, or a series of forms
implicitly collected with 3progn*. An expression is terminated by
the next following atom, which is taken to be a keyword. Thus, syntax
allows only the first form in an expression to be atomic, but makes
misspelled keywords more easily detectable.
Bindings and iteration variable steppings may be performed
either sequentially or in
'cindex sequential vs parallel binding and initialization
parallel, which affects how the stepping of one iteration
variable may depend on the value of another. The syntax for
distinguishing the two will be described with the corresponding clauses.
When a set of things is "in parallel", all of the bindings produced
will be performed in parallel by a single lambda binding.
Subsequent bindings will be performed inside of that binding environment.
.section "Iteration-Producing Clauses"
These clauses all create a 2variable of iteration*, which
is bound locally to the loop and takes on a new value on each
successive iteration. Note that if more than one iteration-producing
clause is used in the same loop, several variables are created which
all step together through their values; when any of the iterations
terminates, the entire loop terminates. Nested iterations are not
generated; for those, you need a second 3loop* form in the body of
the loop.
All of the iteration-producing clauses initially defined are
introduced with the keyword 3for* (or 3as*, which is
synonomous).
'cindex parallel vs. sequential iteration stepping
3For* clauses may be clustered into groups, the variables of
iteration of which are to be stepped in
parallel, by introducing the additional clauses with 3and* instead
of 3for* or 3as*. For example, the following iterates over the
elements in a list, and also has a variable for the element from the
previous iteration:
.lisp
(loop for item in list and previous-item = 'foo then item
do ...)
.end_lisp
During the first iteration, 3previous-item* has the value
3foo*; in subsequent iterations, it has the value of 3item*
from the previous iteration. Note that this would not work if the
stepping were not performed in parallel.
The order of evaluation in iteration-producing clauses is that
'cindex order of evaluation in iteration clauses
those expressions which are only evaluated once are evaluated in order
at the beginning of the form, during the variable-binding phase, while
those expressions which are evaluated each time around the loop are
evaluated in order in the body.
These are the iteration-producing clauses. Optional parts are
enclosed in curly brackets.
.table 3 250 500
.item for 2var* {2data-type*} in 2expr1* {by 2expr2*}
.kindex for
This iterates over each of the elements in the list 2expr1*. If
the 3by* subclause is present, 2expr2* is evaluated once
on entry to the loop
to supply the function to be used to fetch successive sublists,
instead of 3cdr*.
.item for 2var* on 2expr1* {by 2expr2*}
.kindex for
This is like the previous 3for* format, except that 2var* is
set to successive tails of the list instead of successive elements.
.item for 2var* {2data-type*} = 2expr*
.kindex for
On each iteration, 2expr* is evaluated and 2var* is set to the result.
.item for 2var* {2data-type*} = 2expr1* then 2expr2*
.kindex for
2Var* is bound to 2expr1* when the loop is entered, and set to
2expr2* on all succeeding iterations.
.item for 2var* {2data-type*} from 2expr1* {to 2expr2*} {by 2expr3*}
.kindex for
'c i can't read moon's handwriting!
This performs numeric iteration. 2Var* is initialized to
2expr1*, and on each succeeding iteration is incremented by
2expr3* (default 31*). If the 3to* phrase is given, the
iteration terminates when 2var* becomes greater than 2expr2*.
Each of the
expressions is evaluated only once, and the 3to* and 3by*
phrases may be written in either order. 3Downto* may be used instead
of 3to*, in which case 2var* is decremented by the step value,
and the endtest is adjusted accordingly. If 3below* is used
instead of 3to*, or 3above* instead of 3downto*, the
iteration will be terminated before 2expr2* is reached, rather
than after. Note that the 3to* variant appropriate for the
direction of stepping must be used for the endtest to be formed
correctly, i.e. the code will not work if 2expr3* is negative or
zero. If no limit specifying clause is given, then the direction of
the stepping may be specified as being decreasing by using
3downfrom* instead of 3from*. 3Upfrom* may also be used
instead of 3from*; it forces the stepping direction to be
increasing.
The 2data-type* defaults to 3fixnum*.
.item for 2var* {2data-type*} being 2expr* and its 2path* ...
.item1 for 2var* {2data-type*} being {each} 2path* ...
.kindex for
This provides a user-definable iteration facility. 2Path* names
the manner in which the iteration is to be performed. The ellipsis
indicates where various path dependent preposition/expression pairs
may appear. See the section on Iteration Paths
((iteration-path-page)) for complete documentation.
.end_table
.section "Bindings"
.setq with-clause page
.kindex with
'cindex variable bindings
The 3with* keyword may be used to establish initial
bindings, that is, variables which are local to the loop but are only
set once, rather than on each iteration. The 3with* clause looks like:
.lisp
3with 2var1* {2data-type*} {= 2expr1*}
{and 2var2* {2data-type*} {= 2expr2*}}...*
.end_lisp
If no 2expr* is given, the variable is initialized to the
appropriate value for its data type, usually 3nil*.
3With* bindings linked by 3and* are performed in
parallel; those not linked are performed sequentially. That is,
.lisp
(loop with a = (foo) and b = (bar) ...)
.end_lisp
binds the variables like
.lisp
((lambda (a b) ...)
(foo) (bar))
.end_lisp
whereas
.lisp
(loop with a = (foo) with b = (barprime a) ...)
.end_lisp
binds the variables like
.lisp
((lambda (a)
((lambda (b) ...)
(barprime a)))
(foo))
.end_lisp
All 2expr*'s in 3with* clauses are evaluated in the order they
are written, upon entrance to the loop rather than where they appear
in the body. Thus good style suggests that 3with* clauses be
placed first in the loop.
For binding more than one variable with no particular
initialization, one may use the construct
.lisp
3with 2variable-list* {2data-type-list*} {and ...}*
.end_lisp
as in
.lisp
with (i j k t1 t2) (fixnum fixnum fixnum) ...
.end_lisp
which is a useful special case of 2destructuring*
((destructuring-section)).
.section "Entrance and Exit"
.table 3 250 500
.item initially 2expression*
.kindex initially
This puts 2expression* into the 2prologue* of the iteration. It
will be evaluated before any other initialization code other than the
initial bindings. For the sake of good style, the 3initially*
clause should therefore be placed after any 3with* clauses but
before the main body of the loop.
.item finally 2expression*
.kindex finally
This puts 2expression* into the 2epilogue* of the loop, which is
evaluated when the iteration terminates (other than by an explicit
3return*). For stylistic reasons, then, this clause should appear
last in the loop body. Note that certain clauses may generate code
which terminates the iteration without running the epilogue code;
this behaviour is noted with those clauses.
.end_table
.section "Side Effects"
.setq side-effects-section css-number
.table 3 250 500
.item do 2expression*
.item1 doing 2expression*
.kindex do doing
2Expression* is evaluated each time through the loop.
.end_table
.section "Values"
.setq values-section css-number
The following clauses accumulate a return value for the
iteration in some manner. The general form is
.lisp
32type-of-collection expr* {2data-type*} {into 2var*}*
.end_lisp
where 2type-of-collection* is a 3loop* keyword, and 2expr*
is the thing being "accumulated" somehow. If no 3into* is
specified, then the accumulation will be returned when the 3loop*
terminates. If there is an 3into*, then when the epilogue of the
3loop* is reached, 2var* (a variable automatically bound
locally in the loop) will have been set to the accumulated
result and may be used by the epilogue code. In this way, a user may
accumulate and somehow pass back multiple values from a single
3loop*, or use them during the loop. It is safe to reference
these variables during the loop, but they should not be modified
until the epilogue code of the loop is reached.
For example,
.lisp
(loop for x in list
collect (foo x) into foo-list
collect (bar x) into bar-list
collect (baz x) into baz-list
finally (return (list foo-list bar-list baz-list)))
.end_lisp
which has the same effect as
.lisp
(do ((g0001 l (cdr g0001)) (x) (foo-list) (bar-list) (baz-list))
((null g0001)
(list (nreverse foo-list)
(nreverse bar-list)
(nreverse baz-list)))
(setq x (car g0001))
(setq foo-list (cons (foo x) foo-list))
(setq bar-list (cons (bar x) bar-list))
(setq baz-list (cons (baz x) baz-list)))
.end_lisp
.table 3 250 500
.item collect 2expr* {into 2var*}
.item1 collecting ...
.kindex collect collecting
.setq collect-clause page
This causes the values of 2expr* on each iteration to be collected
into a list.
.item nconc 2expr* {into 2var*}
.item1 nconcing ...
.item1 append ...
.item1 appending ...
.kindex nconc nconcing append appending
These are like 3collect*, but the results are 3nconc*ed or
3append*ed together as appropriate.
3collecting*:3mapcar*::3nconcing*:3mapcan*.
.item count 2expr* {into 2var*}
.item1 counting ...
.kindex count counting
If 2expr* evaluates non-3nil*, a counter is incremented.
The 2data-type* is always 3fixnum*.
.item sum 2expr* {2data-type*} {into 2var*}
.item1 summing ...
.kindex sum summing
Evaluates 2expr* on each iteration, and accumulates the sum of all
the values. 2Data-type* defaults to
3number*, which for all practical purposes is 3notype*.
.item maximize 2expr* {2data-type*} {into 2var*}
.item1 minimize ...
.kindex maximize minimize
Computes the maximum (or minimum) of 2expr* over all
iterations. 2Data-type* defaults to 3number*.
.end_table
Not only may there be multiple 2accumulations* in a
'cindex multiple accumulations
3loop*, but a single 2accumulation* may come from multiple
places 2within the same 3loop* form*. Obviously, the types of
the collection must be compatible. 3Collect*, 3nconc*, and
3append* may all be mixed, as may 3sum* and 3count*, and
3maximize* and 3minimize*. For example,
.lisp
(loop for x in '(a b c) for y in '((1 2) (3 4) (5 6))
collect x
append y)
=> (a 1 2 b 3 4 c 5 6)
.end_lisp
.group
The following computes the average of the entries in the list
2list-of-frobs*:
.lisp
(loop for x in list-of-frobs
count t into count-var
sum x into sum-var
finally (return (quotient sum-var count-var)))
.end_lisp
.end_group
.section "Endtests"
.cindex terminating the iteration
The following clauses may be used to provide additional
control over when the iteration gets terminated, possibly causing
exit code (due to 3finally*) to be performed and possibly returning
a value (e.g., from 3collect*).
.table 3 250 500
.item while 2expr*
.kindex while
If 2expr* evaluates to 3nil*, the loop is exited, performing
exit code (if any), and returning any accumulated value. The
test is placed in the body of the loop where it is written. It may
appear between sequential 3for* clauses.
.item until 2expr*
.kindex until
Identical to 3while (not 2expr*)*.
.end_table
This may be needed, for example, to step through a strange
data structure, as in
.lisp
(loop for concept = 2expr* then (superior-concept concept)
until (eq concept [summum-genus])
...)
.end_lisp
.section "Aggregated Boolean Tests"
.table 3 250 500
.item always 2expr*
.kindex always
If 2expr* evaluates to 3nil*, the iteration is terminated and
3nil* returned; otherwise, 3t* will be returned when the loop
finishes, after the epilogue code (if any, as specified with the
3finally* clause) has been run.
.item never 2expr*
.kindex never
This is like 3always (not 2expr*)*.
.item thereis 2expr*
.kindex thereis
If 2expr* evaluates non-3nil*, then the iteration is
terminated and that value is returned, without running the epilogue
code.
.end_table
.section "Conditionalization"
.cindex conditionalizing clause(s)
These clauses may be used to "conditionalize" the following
clause. They may precede any of the side-effecting or value-producing
clauses, such as 3do*, 3collect*, or 3always*.
.table 3 250 500
.item when 2expr*
.item1 if 2expr*
.kindex when if
.space 0
.c Make sure this starts it on a new line....
.c .break doesn't do it.
.c Will a ".space 0" do it?
If 2expr* evaluates to 3nil*, the following clause will be
skipped, otherwise not.
.item unless 2expr*
.kindex unless
This is equivalent to 3when (not 2expr*))*.
.end_table
Multiple conditionalization clauses may appear in sequence.
If one test fails, then any following tests in the immediate sequence,
and the clause being conditionalized, are skipped.
Multiple clauses may be conditionalized under the same test by
joining them with 3and*, as in
.lisp
(loop for i from a to b
when (zerop (remainder i 3))
collect i and do (print i))
.end_lisp
which returns a list of all multiples of 33* from 2a* to
2b* (inclusive) and prints them as they are being collected.
Conditionals may be nested. For example,
.lisp
(loop for i from a to b
when (zerop (remainder i 3))
do (print i)
and when (zerop (remainder i 2))
collect i)
.end_lisp
returns a list of all multiples of 36* from 2a* to 2b*,
and prints all multiples of 33* from 2a* to 2b*.
Useful with the conditionalization clauses is the 3return*
clause, which causes an explicit return of its "argument" as
the value of the iteration, bypassing any epilogue code. That is,
.lisp
3when 2expr1* return 2expr2**
.end_lisp
is equivalent to
.lisp
3when 2expr1* do (return 2expr2*)*
.end_lisp
Conditionalization of one of the "aggregated boolean value"
clauses simply causes the test which would cause the iteration to
terminate early not to be performed unless the condition succeeds.
For example,
.lisp
(loop for x in l
when (significant-p x)
do (print x) (princ "is significant.")
and thereis (extra-special-significant-p x))
.end_lisp
.group
The format of a conditionalization and following clause is
typically something like
.lisp
3when 2expr1* 2keyword* 2expr2**
.end_lisp
If 2expr2* is the keyword 3it*, then a variable is generated to
hold the value of 2expr1*, and that variable gets substituted for
2expr2*. Thus, the composition
.lisp
3when 2expr* return it*
.end_lisp
is equivalent to the clause
.lisp
3thereis 2expr**
.end_lisp
and one may collect all non-null values in an iteration by saying
.lisp
3when 2expression* collect it*
.end_lisp
If multiple clauses are joined with 3and*, the 3it* keyword
may only be used in the first. If multiple 3when*s,
3unless*es, and/or 3if*s occur in sequence, the value
substituted for 3it* will be that of the last test performed.
.end_group
.chapter "LOOP Synonyms"
.defmac define-loop-macro
.lisp
(define-loop-macro 2keyword*)
.end_lisp
may be used to make 2keyword*, a 3loop* keyword (such as
3for*), into a LISP macro which may introduce a 3loop* form.
For example, after evaluating
.lisp
(define-loop-macro for),
.end_lisp
one may now write an iteration as
.lisp
(for i from 1 below n do ...)
.end_lisp
.end_defmac
.chapter "Data Types"
.setq data-type-section page
.cindex data type keywords
In many of the clause descriptions, an optional 2data-type*
is shown. A 2data-type* in this sense is an atomic symbol, and is
recognizable as such by LOOP. LOOP interfaces to a module which
defines how declarations and initializations are to be performed for
various data types. However, it recognizes several types specially so
that that module need not be present in order for them to be used:
.table 3 250 500
.item fixnum
An implementation-dependent limited range integer.
.item flonum
An implementation-dependent limited precision floating point number.
.item integer
Any integer (no range restriction).
.item number
Any number.
.item notype
Unspecified type (i.e., anything else).
.end_table
.chapter "Destructuring"
.setq destructuring-section page
2Destructuring* provides one with the ability to
"simultaneously" assign or bind multiple variables to components of
some data structure. Typically this is used with list structure
(which is the only mode currently supported). For example,
.lisp
(desetq (foo . bar) '(a b c))
.end_lisp
has the effect of setting 3foo* to 3a* and 3bar* to 3(b
c)*.
LOOP only requires destructuring support when one of these patterns is
supplied in place of a variable.
In addition, the "binding" of a pattern to a constant 3nil* is so
treated that it requires no special support code; this allows the
case
.lisp
with (a b c)
.end_lisp
to work without destructuring support code.
One may specify the data types of the components of a pattern
by using a corresponding pattern of the data type keywords in place of
a single data type keyword. This syntax remains unambiguous because
wherever a data type keyword is possible, a 3loop* keyword is
the only other possibility. Thus, if one wants to do
.lisp
(loop for x in l
as i fixnum = (car x)
and j fixnum = (cadr x)
and k fixnum = (cddr x)
...)
.end_lisp
and no reference to 3x* is needed, one may instead write
.lisp
(loop for (i j . k) (fixnum fixnum . fixnum) in l ...)
.end_lisp
To allow some abbreviation of the data type pattern, an atomic data
type component of the pattern is considered to state that all
components of the corresponding part of the variable pattern are of
that type. That is, the previous form could be written as
.lisp
(loop for (i j . k) fixnum in l ...)
.end_lisp
This generality allows binding of multiple typed variables in a
reasonably concise manner, as in
.lisp
(loop with (a b c) and (i j k) fixnum ...)
.end_lisp
which binds 3a*, 3b*, and 3c* to 3nil* and 3i*,
3j*, and 3k* to 30* for use as temporaries during the
iteration, and declares 3i*, 3j*, and 3k* to be fixnums
for the benefit of the compiler.
.lisp
.space 1
(defun map-over-properties (fn symbol)
(loop for (propname propval) on (plist symbol) by 'cddr
do (funcall fn symbol propname propval)))
.end_lisp
.space 1
See also section (dependencies-section),
(dependencies-section-page), which discusses support code needed in
various implementations.
.chapter "Iteration Paths"
.setq iteration-path-page page
Iteration paths provide a mechanism for user extension of
iteration-producing clauses. The interface is constrained so that the
definition of a path
need not depend on much of the internals of LOOP. In general, a path
iteration has one of the forms
.lisp
for 2var* {2data-type*} being 2expr0* and its 2pathname*
{2preposition1* 2expr1*}...
for 2var* {2data-type*} being {each} 2pathname* of 2expr0*
{2preposition1* 2expr1*}
.end_lisp
The difference between the two is this: in the first, 2var* will
take on the value of 2expr0* the first time through the loop; but
in the second, it will be the "first step along the path".
2Pathname* is an atomic symbol which is defined as a 3loop* path
function. The usage and defaulting of 2data-type* is up to the
path function. Any number of preposition/expression pairs may be
present; the prepositions allowable for any particular path are
defined by that path. The 3of* preposition has special
meaning in that it specifies the starting point of the path; thus,
the first variation shown implicitly uses an 3of* 2expr0*
"prepositional phrase". To enhance readability, pathnames are usually
defined in both the singular and plural forms. To satisfy the
anthropomorphic among you, 3his*, 3her*, or 3their* may be
substituted for the 3its* keyword. Egocentricity is not condoned.
One pre-defined path is 3cars*; it simply iterates over
successive 3car*s of its starting argument, terminating after an
atom is reached. For example,
.lisp
(loop for x being cars of '((a b) c) collect x)
=> ((a b) a)
(loop for x being '((a b) c) and its cars collect x)
=> (((a b) c) (a b) a)
.end_lisp
The above forms are equivalent to
.lisp
(loop for x = (car '((a b) c)) then (car x)
collect x
until (atom x))
.end_lisp
and
.lisp
(loop for x = '((a b) c) then (car x)
collect x
until (atom x))
.end_lisp
respectively. (Note that the 3atom* check following the
body of this loop is part of the
definition of the 3cars* path, and is not a property of
paths in general.)
.group
By special dispensation, if a 2pathname* is not
recognized, then the 3attachments* path will be invoked upon a
syntactic transformation of the original input. This name derives
historically from its original usage in XLMS.
Essentially, the 3loop* fragment
.lisp
for 2var* being 2a-r* of 2expr* ...
.end_lisp
is taken as if it were
.lisp
for 2var* being attachments in 2a-r-** of 2expr* ...
.end_lisp
and
.lisp
for 2var* being 2expr* and its 2a-r* ...
.end_lisp
is taken as if it were
.lisp
for 2var* being 2expr* and its attachments in 2a-r-**
.end_lisp
Thus, this "undefined pathname hook" only works if the
3attachments* path is defined. Note also:
.defvar loop-attachment-transformer
The value of this is a function of one argument which will be called
on 2a-r* to transform it into 2a-r-**. If it is
3nil*, then a 3quote* is listed around the expression,
effectively causing the special 3attachments* syntax to be an
unevaluated form of the 3attachments* path. This
is initially 3nil* except in an LMS environment, in which case it
is a function which simply returns 2a-r*.
.end_defvar
.end_group
.need 6000
.c 6 inches -- don't want the section header to come out all alone.
.section "Defining Paths"
This section will probably be of interest only to those
interested in defining their own paths.
For the purposes of discussion, the general template form of
an iteration may be assumed to be
.lisp
(let 2variable-bindings*
(prog ()
2prologue-code*
next-loop
2pre-body-endtests-1*
2pre-body-steps-1*
2pre-body-endtests-2*
2pre-body-steps-2*
...
2body*
2post-body-endtests-1*
2post-body-steps-1*
2post-body-endtests-2*
2post-body-steps-2*
...
(go next-loop)
end-loop
2epilogue-code*
))
.end_lisp
When more than one 3for* clause is grouped together with 3and*,
the endtests and steps are arranged to occur together in parallel.
Sequentially arranged 3for* clauses cause multiple endtests and
steps to occur one after another, as shown in the above template.
A function to generate code for a path may be declared to
3loop* with the 3define-loop-path* function:
.defun define-loop-path pathname-or-names path-function list-of-allowable-prepositions (1any-number-of*data)
This defines 2path-function* to be the handler for the path(s)
2pathname-or-names*, which may be either a symbol or a list of
symbols. Such a handler should follow the conventions described
below.
.end_defun
The handler will be called with the following arguments:
.table 2 250 500
.item path-name
The name of the path which caused the path function to be invoked.
.item variable
The "iteration variable".
.item data-type
The data type supplied with the iteration variable, or 3nil* if
none was supplied.
.item prepositional-phrases
This is a list with entries of the form 2(preposition
expression)*, in the order in which they were collected. This may
also include some supplied implicitly (e.g. 3of* phrases, and
3in* phrases for
attachment relations); the ordering will show the order of evaluation
which should be followed for the expressions.
.item inclusive?
This is 3t* if 2variable* should have the starting point of
the path as its value on the first iteration, 3nil* otherwise.
.item allowed-prepositions
This is the list of allowable prepositions declared for the pathname
that caused the path function to be invoked. It and 2data*
(immediately below) may be used by the path function such that a
single function may handle similar paths.
.item data
This is the list of "data" declared for the pathname that caused the
path function to be invoked. It may, for instance, contain a
canonicalized pathname, or a set of functions or flags to aid the
path function in determining what to do. In this way, the same
path function may be able to handle different paths.
.end_table
The handler should return a list with the following elements:
.table 2 250 500
.item variable-bindings
This is a list of variables which need to be bound. The entries in it
may be of the form 2variable*, (2variable* 2expression*),
or (2variable* 2expression* 2data-type*). Note that it is
the responsibility of the handler to make sure the iteration variable
gets bound. All of these variables will be bound in parallel; thus,
if initialization of one depends on others, it should be done with a
3setq* in the 2prologue-forms*.
.item prologue-forms
This is a list of forms which should be included in the loop prologue.
.item pre-body-endtest
This is a single form.
.item pre-body-steps
This should be an alternating list of variables and expressions to
step them. They will be stepped in parallel. (This is like the
arguments to 3setq*; in fact, it will be used as the arguments to
3psetq*.)
.item post-body-endtest
Like 2pre-body-endtest*, but done after the 2body*, just
before starting the next iteration.
.item post-body-steps
Like 2pre-body-steps*.
.end_table
If anyone finds that they need to modify the 2main* body or the
epilogue code, we would like to hear about it.
A qualification is in order with respect to stepping. In
order to make parallel stepping work properly, 3loop* must be able
to coerce the stepping code for different 3for* clauses to act in
parallel. Thus, the canonical place for stepping to occur is in the
2post-body-steps*; the 2pre-body-steps* is mainly useful when
the iteration variable needs to be set to some function of whatever is
actually being iterated over. For example, the LOOP clause
.lisp
3for 2var* in 2list**
.end_lisp
effectively returns the following elements for the template (where
2tem* is really a gensymed variable name):
.table 2 250 500
.item variable-bindings
3(2var* (2tem* 2list*))*
.item prologue-forms
3nil*
.item pre-body-endtest
3(null 2tem*)*
.item pre-body-steps
3(2var* (car 2tem*))*
.item post-body-endtest
3nil*
.item post-body-steps
3(2tem* (cdr 2tem*))*
.end_table
.defun loop-tequal token symbol-or-string
This is the LOOP token comparison function. 2Token* is any Lisp
object; 2symbol-or-string* is the keyword it is to be compared
against. It returns 3t* if they represent the same token,
comparing in a manner appropriate for the implementation. In certain
implementations 3loop-tequal* may be a macro.
.end_defun
.chapter "Compatibility with FOR"
LOOP is not truly compatible with FOR (a similar Maclisp
iteration package). The reason for this is
that LOOP has certain "ideas" about how it should handle such things
as order of evaluation and repeated evaluation, which are quite
different from FOR's simpler template approach. Many of the keywords,
and hopefully all of the functionality, have been preserved. In many
cases, code written with FOR will work with LOOP, although it
sometimes may not behave identically. For convenience, here is a
(non-exhaustive) summary of the major differences.
One major difference is that LOOP is more fastidious about how
it orders the assignments and endtests. Take, for example
.lisp
(loop for n in list as z = (* n n) collect z)
.end_lisp
In FOR, 3n* would be assigned to the 3car* of the list, then
3z* would be stepped, and then the 3null* check would be made
on the iteration list. This means that on the last iteration 3z*
will be assigned to 3(* nil nil)*, which might cause some
consternation to the Lisp interpreter. In LOOP, first a 3null*
check is made on the list, then 3n* is set to the 3car* of the
list, then 3z* is stepped.
Explicit endtests (3while* and 3until*) are placed
"where they appear" in the iteration sequence. This obviates the
3repeat-while* and 3repeat-until* keywords of FOR. For
example, the FOR construct
.lisp
(for x in l collect x repeat-while (< x 259.))
.end_lisp
may be replaced by the LOOP construct
.lisp
(loop for x in l collect x while (< x 259.))
.end_lisp
Note that in the FOR case, the ordering of the clauses typically does
not matter, but in the LOOP case it typically does. Thus, the
ordering in
.lisp
(loop for data = (generate-some-data)
collect (f data)
while (test data))
.end_lisp
causes the result to be a list with at least one element.
LOOP attempts to suppress repeated evaluation where possible.
Which expressions get repeatedly evaluated is documented with the
corresponding clauses. One significant example where LOOP and FOR
differ is in the case
.lisp
(loop for i from 0 to 2expression* ...)
.end_lisp
in which FOR evaluates 2expression* at every iteration, whereas
LOOP saves the value at the start of the iteration.
It should be noted that the conditionalization clauses
(3when*, 3until*, and 3if*) affect only the following
clause rather than the whole of the "body" of the iteration, as would
be the case in FOR.
Because it is difficult for it to work in all cases, the
3trailing* clause has been eliminated. Its effect may be achieved,
however, by tacking
.lisp
and 2var* = 2initial-value* then 2var-to-be-trailed*
.end_lisp
after the 3for* clause which steps 2var-to-be-trailed*.
.chapter "Dependencies"
.setq dependencies-section css-number
.setq dependencies-section-page page
The LOOP package may require the existence of other routines
in some implementations. For efficiency reasons, LOOP avoids
producing 3let* in the code it generates unless it is necessary
for destructuring bindings.
In the PDP-10 Maclisp implementation, LOOP uses 3ferror*
to generate error messages; 3ferror* is part of the FORMAT
package, and is assumed to be autoloadable from there. 3Let*,
which is used to produce destructuring bindings, and the destructuring
version of 3setq* called 3desetq*, which is used only when
destructuring is used, are both autoloadable. The "parallel setq"
mechanism is simulated so that 3psetq* is not needed. Macro
memoizing is performed using the same facilities which 3defmacro*
uses, and are autoloadable (and typically present in most
environments).
In Multics Maclisp, LOOP does not presently call 3ferror*,
which does not exist.
There is a 3let* macro available with
destructuring capability; it is non-standard (not part of the Multics
Lisp system) -- for further information contact the authors. Currently,
macro memoizing is performed by 3rplaca*/3rplacd* splicing,
unconditionally.
In Lisp Machine lisp, 3ferror* is used to generate errors.
This is part of the basic Lisp Machine environment. At this time,
destructuring support is not part of the basic environment, although
it is available; contact either the authors or the Lisp Machine group
if you need this. Macro memoizing is performed using 3displace*,
with the same effect as in Multics Maclisp.
.c Local Modes:
.c Auto Fill Mode:1
.c Comment Start:.c
.c Comment Begin:.c
.c Comment End:
.eof

215
doc/_info_/lisp.newio Executable file
View File

@@ -0,0 +1,215 @@
MacLISP NewIO Functions Kent M. Pitman, 21 Feb 1980
Opening/Closing and using file objects in New-I/O.
New I/O has the notion of a data object called a file. Files are actually
implemented as arrays, so if you get ahold of a file object and type
(TYPEP <thing>) it will answer "ARRAY", but there is another predicate
(FILEP <thing>) that should return T in the case of files and not for other
arrays.
File objects are created by the open command. The open command takes
the following syntax (both arguments optional).
(OPEN [<filespec> [ <options> ]])
<filespec> must evaluate to either a NAMESTRING or a NAMELIST.
The default file is the value of the variable DEFAULTF.
<options> must evaluate to a list of atoms specifying the modes to open
the file in. The default is '(IN ASCII DSK BLOCK).
Possible options are:
Direction - either IN (or READ), OUT (or PRINT), APPEND
Data mode - either ASCII, FIXNUM (bastard image mode),
or IMAGE (really super-image).
Device type - TTY or DSK
Buffering mode - BLOCK or SINGLE
Echo mode - Open in echo area of tty only (this works only
in ITS MACLISP)
This operation opens a file and creates an object which knows what is
going on with respect to the file. Each time you open a file, a new
file object is created (except under certain conditions to be detailed
later). Multiple file objects may be open to a file by the same name.
If they are reading the file, they will all have pointers to the same file.
If they are writing to the file, they will all have pointers to different
files, and the file object which is closed last will be the one which
becomes the file named. A file opened for write cannot be opened by
anyone else (including DDT's print). It MUST be closed first.
To close a file, the syntax is merely (CLOSE <object>) where <object>
must be a form that evaluates to a file object (the thing returned by
the OPEN request). Note that the thing returned from the open request
does not get stored anywhere automatically so make sure you setq some
variable to it or you will not be able to do anything with it! File
objects with no pointers to them are closed and recycled the next time
a garbage collection is done.
Most input/output commands default to the tty and accept optional file
objects as a last arg. Examples are:
(TYO <n> [ <file-object> ]) ; Output ascii char corresponding to <n>
; on <file-object> if given, else tty.
(TYI [ <file object> ]) ; Return the fixnum value of next character seen
; on <file-object> if given, else tty.
(PRINT <exp> [ <file-object> ]) ; Use lisp normal printer to display <exp>
; on <file-object> if given, else tty.
READ, READLINE, IN, OUT, PRINC, PRIN1, and so on all work in analagous ways.
Most commands that are for inputing from a file also allow an optional
arg following the file object which is the value to be returned if there
is an end of file.
Thus you can also say:
(SETQ UNIQUE (GENSYM))
(READ <file-object> UNIQUE)
and if an end of file condition occurs during the real (ie, the read fails),
then the last arg (UNIQUE in above example) will be returned. If the read
happens to touch the end of the buffer but is still successful, the end
of file value will not be returned. TYI and TYIPEEK require that the
end-of-file value be a fixnum (-1. is a good choice - especially since
TYIPEEK is broken at the time I am writing this and it will return -1.
regardless of what you say if an end of file is hit.)
Note: The end of file condition on the tty cannot happen in tyi/tyipeek
but can happen in READ and READLINE and is defined to happen
if there is an over-rubout.
If an end-of-file is reached and there is no form to return (ie, the
optional arg was omitted) an error results if there is also not an
EOF function... (What's an EOF function?)
The function (EOFFN <file-object> [ <optional-function-spec> ]) is a
function that reads or sets the eoffn (End Of File FuNction) for a
file-object. If the EOFFN is null (default) then an error will happen
if there is an eof condition is reached.
(EOFFN <file-object>) tells you what <file-object>'s related End of file
function is.
(EOFFN <file-object> <function-name-or-lambda>) sets <file-object>'s
eoffn.
The EOFFN must be a function of two args:
arg1= the stream on which the end-of-file has happened.
arg2= the value that the user expected returned (optional last value
or default last value (NIL for READ and READLINE, -1 for TYI
and TYIPEEK, etc.))
The file will be closed automatically by lisp when an end-of-file
is read and before the eof function has been called (if any) or the
eof value returned. A common kind of EOF function is one which re-opens
the file object. A file object may be re-opened in the identical modes
it was opened the first time by just saying (OPEN <file-object>).
File specifications may take on the following formats:
((device directory) filename1 filename2) ; Namelist
|device: directory; filename1 filename2| ; Namestring
with * being used as a wildcard (means use the default, NOT match all files).
The default file is stored in DEFAULTF. It should never be altered by
(SETQ DEFAULTF ...) but rather the function DEFAULTF of one arg should be
used. It will ensure that the right syntax is used.
Eg, if DEFAULTF evals to ((DSK FOO) BAZ >) and the user does:
(DEFAULTF '(FOO BAR))
DEFAULTF is now => ((DSK FOO) FOO BAR)
(DEFAULTF 'BOX)
DEFAULTF => ((DSK FOO) BOX BAR)
(DEFAULTF '((BAZ)))
DEFAULTF => ((DSK BAZ) BOX BAR)
(DEFAULTF '((AI)))
DEFAULTF => ((AI BAZ) BOX BAR) ; DEFAULTF is smart about devices
(DEFAULTF '((FOO) * BAX))
DEFAULTF => ((AI FOO) BOX BAX)
and so on...
There is a general command that you can call to merge to filenames.
It is called MERGEF and is what is used by DEFAULTF. Thus saying
(MERGEF '|HI THERE| '((FOO BAR) BAZ GUNK)) will return
((FOO BAR) HI THERE).
Other useful commands are which work on all of [namelists, namestrings,
file-objects] are:
(NAMELIST <file>) ; give namelist form of file
(NAMESTRING <file>) ; give namestring form of file
(SHORTNAMESTRING <file>) ; give only filename1 and filename2
; parts of namestring
NOTE: The namestring format on non-ITS sites allows the appropriate
filenaming conventions for the operating system being run under.
eg, for Twenex, |<FOO>BAR.BAZ.3| would be an appropriate
namestring.
(PROBEF <file>) ; returns NIL if file doesn't exist, and the true name
; of the file as a namelist if it does exist.
(DELETEF <file>) ; deletes the file
(RENAMEF <file> <filename>) ; renames the <file> to <filename>
The following are kind of special purpose things:
(CNAMEF <closed-file-object> <new-name>)
This command will take a file object which must be closed, and
rename it so that when you call OPEN on it, you'll be opening
a different file. This helps cope with the problem that you can
only create some fixed number of open streams (like 13 or so)
on ITS, and if you have used all the file streams but have one
you want to recycle, you can do a CNAMEF.
(ENDPAGEFN <file-object> [ <end-page-function> ])
When a page-end occurs on a stream it is non-fatal and will
just be ignored unless an endpage handler has been specified.
There is a default ENDPAGEFN for TYO (the default tty output
stream) which causes the ##MORE## at the bottom of a page.
This is similar in use to EOFFN.
Notes on variables:
TYO - Should always have the tty output object in it.
TYI - Should always have the tty input object in it.
(CURSORPOS [ <data> ] [ <tty-file-object> ])
If <data> is omitted, the cursorposition on <tty-file-object> (or the
default output file if this is missing) is returned as
( <vertical-pos> . <horizontal-pos> ) -- 0-indexed.
If <data> is given it is of one of the following forms:
<char> - send a <char> to the tty - see .INFO.;LISP CURSOR
for full description of what options there are.
<char> <val> - same as <char> - some chars need extra data.
<vpos> <hpos> - move to position ( <vpos> . <hpos> )
NIL <hpos> - move to <vpos> on current line - same as 'H <hpos>
<vpos> NIL - move to <vpos> (same <hpos>) - same as 'V <vpos>
NIL NIL - stay where you are (?)
------------------------------------------------------------------------------
There is also a function called LOAD which will read and execute a file
as a unit. If the file is a FASL file, it will be fasloaded, else it will
forms will be read and eval'd from it sequentially as if it had been typed
at the terminal. (Default input is bound during such a read so that commands
like (TYI) ore (READ) at toplevel with no file-spec argument will be read
from the file rather than from the terminal.) The syntax for the command
is just (LOAD <filename>) where <filename> should evaluate to a namelist,
namestring, or file object.

8508
doc/_info_/lisp.news Executable file

File diff suppressed because it is too large Load Diff

51
doc/_info_/lisp.recent Executable file
View File

@@ -0,0 +1,51 @@
Wednesday February 17,1982 LQ+2D.4H.21M.13S. -- JonL --
1) In SHARPM 82, #| now works as on the LISPM, namely #|...cruft...|#
"disappears" like a balanced comment; note that termination is |#
Also, #<n>R<ddd> now works; e.g. #3R21 is 7 (21 in base 3).
2) Two new functions in auxillary files, but not autoloading
DEFCONST is in the MLMAC file; it is like DEFVAR, but always SETQs.
ARRAYP is in the MLSUB file; returns true for non-funny arrays.
3) GENTEMP, an LSUBR, generates truly uninterned symbols. Should be
used in preference to GENSYM by macros which generate temporary
local variables.
4) The TTYNOTES-FUNCTION facility for COMPLR has been emended
_______________________________________________________________________
2) Two new functions in auxillary files, but not autoloading
DEFCONST is in the MLMAC file; it is like DEFVAR, but always SETQs.
ARRAYP is in the MLSUB file; returns true for non-funny arrays.
(defun ARRAYP (x)
(and (eq (typep x) 'ARRAY)
(memq (array-type x) '(NIL T FIXNUM FLONUM))
'T))
3) GENTEMP, an LSUBR, generates truly uninterned symbols. Should be
used in preference to GENSYM by macros which generate temporary
local variables.
GENTEMP permits one optional argument, a prefix for the symbol to be
created (defaults to T), and creates a symbol like
(maknam (append (explode <prefix>)
(explode '|..|)
(explode (<increment-gentemp-counter>))))
E.g., (GENTEMP) => |T..1|
(GENTEMP '|Foo|) => |Foo..1|
A basic problem with GENSYM is that even though the symbol is uninterned
when created, it may be written out to a FASL during compilation, and
upon loading it will then be interned; separate such compilations
can thus have unfortunate co-incidences between variables which were
thought to be unique. Any symbol with a +INTERNAL-TEMP-MARKER
property on its property list will be treated during compilation in
such a way that it won't be interned when the FASL file is loaded.
4) The TTYNOTES-FUNCTION facility for COMPLR has been emended
If a symbol has a TTYNOTES-FUNCTION property, then that is assumed to
be some function which when applied to the symbol will either return a
re-nameing of it for the unfasl and ttynotes purposes, or will return ()
meaning "I've alredy outputted all the msgs I care to see". Currently it
doesn't support the re-naming for break-point error msgs.

164
doc/_info_/lisp.send Executable file
View File

@@ -0,0 +1,164 @@
Documentation of the "usrhunk" apparatus for SENDing messages.
(SSTATUS USRHUNK <predicate>) specifies the "user hunk" predicate, which
determines whether to "hook into" a user-provided definition for
some system facility, or to treat the data strictly as a hunk.
(SSTATUS SENDI <function>) specifies a "SEND" interpreter -- <function>
is invoked in order to send a "message" to a "user hunk", when a
hunk which passes the "usrhunk" test is given as argument to any of
EQUAL SUBST PURCOPY EVAL SXHASH PRINT EXPLODE
FLATSIZE ALPHALESSP SAMEPNAMEP NAMESTRING
or to any of the following out-of-core facilities
GFLATSIZE SPRINT USERATOMS-HOOK DESCRIBE WHICH-OPERATIONS
(SSTATUS CALLI <function>)
The usrhunk <predicate> takes one argument, and should return
non-null for objects that LISP should send messages to. It is invoked
via (CALL 1,) so this link gets snapped, which means that if you redefine
the predicate then the new definition may not take effect unless you
un-snap by doing (SSTATUS USRHUNK (STATUS USRHNK)).
The usrhunk SEND interpreter, <function>, is invoked via (JCALL 16,)
so its link too may be snapped. This function is responsible for
delivering the message to the apropriate code for handling it; return
values are sometimes significant. See below for documentation on specific
messages which will be sent by LISP. Note that an lsubr "SEND" is assumed;
this function could be the function that is given to (SSTATUS SENDI ...).
For the dozen or so system functions which will send a message to
a usrhunk, the action is as follows. Suppose the message is, say, DOIT;
then (DOIT <weirdo> <another>) will be interpreted by doing a send like
(SEND <weirdo> 'DOIT <another>), and this will cause the send interpreter
function to select some specialized function, say, FROBULATE, which will
then be applied to the arguments in the same order as given to SEND. E.g.,
(DEFUN FROBULATE (actor msg-key other-arg)
(caseq msg-key
(DOIT <happiness>)
(DONT <ugliness>)
(T <error?>)))
Actually, the "msg-key" argument could be ignored, but this example shows
how several different messages could be dispatched to the same function.
The argument spectrum of the frobulator should match that of the original
function; thus for the SXHASH message it might be
(DEFUN HASH-IT-ALL (ob () ) ...)
where the "()" means to ignore the message key (which should be sent as
SXHASH). On the other hand, there may be some importance to the order
of arguments, as this example for the SUBST message shows:
(DEFUN SUBST-FOR-TRICKY-HUNK (hunk () old new)
(hunkify (subst old new (extract-data hunk))))
Here is a table of the actions taken by the system functions which
resort to SENDing, and of the meanings of the arguments being "sent":
EQUAL -- (send obj1 'EQUAL obj2) -- "obj1" and "obj2" are two objects
to be compared, and of course "equal" is commutative.
SUBST -- (send object 'SUBST a b) -- Substitute a for b in object.
PURCOPY -- (send object 'SUBST a b) -- Substitute a for b in object,
using static (potentially read-only) consing areas.
EVAL -- (send object 'EVAL) -- Return the value of this object.
Typically, just returns itself for "implicit quoting".
FLATSIZE -- (send object 'FLATSIZE printp level slashifyp)
"printp" -- non-null if called from inside print as part of the
autoterpri hackery; in this case it should return
characters before next legal place to break. This doesn't
matter if you're not doing autoterpri hacking.
"level" -- fixnum level of recursion of PRINT/FLATSIZE; can
be passed on to PRINT-OBJECT or FLATSIZE-OBJECT (see
below for their definitions). This is used to limit
recursion with PRINLEVEL set non-null.
"slashifyp" -- If non-null, include slashes where print would.
PRINT -- First, there will be done
(send object 'FLATSIZE 'T -1 slashifyp)
and then
(send object 'PRINT stream level slashifyp)
"stream" -- SFA, file, T, or () to print to
"level" -- recursion level of PRINT calling print or print
methods recursively. If you do printing that may wish
to be limited in depth by PRINLEVEL, you should do your
output with PRINT-OBJECT, which takes the current nesting
level as one of it's arguments. ;
"slashify-p" -- if non-null, this is PRIN1, not PRINC
EXPLODE -- As with PRINT, there will first be done
(send object 'FLATSIZE 'T -1 slashifyp)
and then
(send object 'EXPLODE slashify-p number-p)
"slashify-p" -- non-null if slashes should be output where
print would put them.
"number-p" -- non-null if characters should be returned as
fixnums; otherwise, they are single-character symbols.
ALPHALESSP -- Will send either a LESSP or GREATERP message,
with one argument, which is the 'other' object for comparison.
SAMEPNAMEP -- Sends a SAMEPNAMEP message, with one argument which is
the 'other' object for comparison.
SXHASH -- Sends a SXHASH message, which should return a FIXNUM to
be the SXHASH of the object.
NAMESTRING -- Sends a NAMESTRING message, which should return a SYMBOL
whose pname characters are a 'namestring' for the object.
Two new functions have been added to the initial MacLISP for the sake
of recursive calls to PRINT and FLATSIZE by various PRINT and FLATSIZE
methods, and they have arguments similarly.
PRINT-OBJECT (object level slashifyp stream &optional ignored)
FLATSIZE-OBJECT (object printp level slashifyp &optional ignored)
"object" -- object to be printed or to have it's FLATSIZE computed.
"level" -- recursive printing level, for PRINLEVEL detection. You should
pass in the current LEVEL, zero-origen.
"slashifyp" -- non-null indicates slashification should be done
"stream" -- file or SFA
"printp" -- non-null if FLATSIZE is being called originally from PRINT
This will be passed in to any FLATSIZE methods called
recursively and means "This is a FLATSIZE up to first place
OK to break", for print's TERPRI hacking. If you see this
and want to punt, return zero.
"ignored" -- for compatability with an irrelevant LISPM feature.
*** CALLI processing ***
CALLI interpreters must be hand coded; they cannot be coded in LISP.
This is because of the way they are invoked: They get invoked with
the stack in the format for IAPPLY. IAPPLY is LISP's Internal APPLY.
The arguments are on the stack, like for an LSUBR call, and T contains
the negative of the number of args, just like for an LSUBR call. However,
where the return address would be is found the object to be applied. What
LISP does is to take that object, figure out how to apply it, replace it's
slot on the stack with <object>,,CPOPJ . CPOPJ is the address of a POPJ P,
thus returning to it returns to the caller of the IAPPLY, who's return
address is just below that.
|arg n
|arg n-1
..
..
..
|arg 1
|arg 0
object-to-be-applied
return-address
Register T (accumulator 6) contains -n, and the slot containing
object-to-be-applied is clobbered to <object-to-be-applied>,,CPOPJ
and the function is invoked.
The user CALLI handler can act in several ways. You can figure out the
function you wish to invoke, clobber the <object-to-be-applied> slot to
contain a CPOPJ (or whatever routine you want executed later) and do
a JCALLF 16,(routine) or you can replace the <object-to-be-applied> with
another object to be used instead, and JRST off to IAPPLY. IAPPLY will
then recompute what to do (possibly invoking the user CALLI handler if
it answers true to the USRHUNK test), apply the function and return.
Since the CALLI handler is not a function, it does not live in a SUBR
or LSUBR property, but instead in a CALLI property. (SSTATUS CALLI 'FOO)
looks for a CALLI property on FOO. If it finds it, it stores a JRST to
that routine internally, and saves the symbol FOO to be returned by
(STATUS CALLI).
____________________________________________________________________________
2/19/80 -- RWK
1) **SELF-EVAL** hook
PRINC/PRIN1 now send a FLATC/FLATSIZE message first. This should be
improved some more but it really does work. PRINLEVEL info needs to be
passed back and forth between MACLISP and user printers, and FLATC/FLATSIZE
should be told whether or not it is for PRINT so they can give the FLATC
before the first break.

342
doc/_info_/lisp.sfa Executable file
View File

@@ -0,0 +1,342 @@
I) Introduction.
There are many instances when a MacLISP programmer wishes to
simulate an arbitrary I/O device. That is, he wishes to use the primitives
provided in LISP for doing I/O (such as READ and PRINT) yet wishes the
target/source of the characters to be completely arbitrary. I propose a
mechanism called an "SFA" (Software File Array) to handle this situation.
An SFA consists of a function and some associated local storage
bound up in an "SFA-object". In order to satisfy the above goals, an
SFA-object may be used in almost all places that a file-object can be used.
Note that the existence of SFAs will not obviate the need for the current
NEWIO implementation of files. SFAs are strictly a user entity, and the
files are still needed in order to communicate with the operating system.
The SFA-function is a user-defined EXPR/SUBR which accepts 3
arguments. Its first argument is the SFA-object on which it is to act, and
the second argument is a symbol indicating the operation to be performed.
The third argument is operation specific. The SFA-object needs to be
supplied to the function because one SFA-function may be associated with
many different SFA-objects. There are some operations used by the system
(TYI, TYO, etc...). The user is free to define new operations and to use
them by calling the SFA directly.
As there are predefined uses for many of the system I/O functions
that currently exist, when these functions are translated to SFA operations
they must retain the semantics they have when applied to file-objects.
Since this is the case, any SFA that expects to interface directly to the
standard I/O routines must know about the difference between binary and
character-oriented operations. Generally, an SFA will only handle one type
of I/O (i.e. most SFAs will not handle both the IN and TYI operation), yet
the structure of SFAs will not preclude them handling both.
II) System defined operations
1) Operations applicable to both input and output SFAs
A) WHICH-OPERATIONS
The SFA must return a list of operations which it can perform.
Every SFA *must* handle the WHICH-OPERATIONS operation.
B) OPEN
This operation is invoked if an OPEN is done with a SFA as its first
argument. The SFA should return either a file-object or a
SFA-object. The third argument to the SFA is the second argument to
the OPEN, and it defaults to NIL.
C) CLOSE
This operation is invoked when a CLOSE is done with a SFA as its
argument. There is never a third arg, and the SFA should return either
T if the close was successful and NIL if not (e.g. if the SFA was already
"closed".)
D) DELETEF
No arguments will be passed to the SFA. There is no clear global
semantic meaning of this.
E) FILEPOS
If an argument is given to FILEPOS, it is NCONS'ed and handed to the
SFA, else the SFA is given NIL. For a NIL argument, a fixnum should be
returned. For one argument, the SFA should interpret the argument as a
"position" to set the "file" to, and perform appropriate actions.
F) (STATUS FILEMODE) [operation: FILEMODE]
The SFA should return a list of adjectives describing itself. If the
SFA cannot support the FILEMODE operation (as determined by a
system-performed WHICH-OPERATIONS check), then a list of the form:
((SFA) {results of a WHICH-OPERATIONS call})
is returned.
2) Functions applicable to SFAs which can do input
If the SFA is to support normal LISP reading other than TYI, it must
support at least TYI and UNTYI, and preferably TYIPEEK also.
A) TYI
The SFA should return a fixnum representing a character. This operation
may be called from a READ, READLINE, or a straight TYI (the SFA cannot
depend upon being able to determine the context). The argument is the
value to return when EOF is reached (this is true for all input functions
including IN).
B) UNTYI
The SFA should put the argument into its input stream and on the next
TYI should spew forth the saved character rather than the next one in the
"stream". Note that an arbitrary number of UNTYI's may be done in a row.
C) TYIPEEK
The SFA should return a fixnum (as in TYI) but should not remove the
character from the input flow. Therefore, subsequent TYIPEEK's will read
the same character. If the SFA cannot handle TYIPEEK, it will be simulated
by a TYI/UNTYI pair of operations.
D) IN
The value returned should be a fixnum that is the next binary value in
the input stream. The argument is the EOF value.
E) READLINE
The value returned should be a symbol that represents one "line" of the
input stream. If the SFA cannot handle this operation, it is simulated in
terms of TYI. The argument is the value to return upon EOF.
F) READ
The value returned should be the next "object" in the input stream If
the SFA cannot handle this operation, it is simulated in terms of
TYI/UNTYI. The argument is the value to return upon EOF.
G) LISTEN
CLEAR-INPUT
For LISTEN, the total number of items (or "characters") currently
held in the input buffer is returned; for CLEAR-INPUT, the input buffer
is just thrown away.
3) Functions applicable to SFAs which can do output
A) TYO
The argument is a fixnum representing a character. The value returned
should be T if the SFA succeeds, and NIL if the output was unsuccessful.
B) OUT
The argument is a fixnum and is output as such. The TYO/OUT pair of
functions is the analog to the TYI/IN pair.
C) FORCE-OUTPUT
CLEAR-OUTPUT
For FORCE-OUTPUT, the SFA should empty its output buffer to the logical
"device" to which it is connected; for CLEAR-OUTPUT, any buffer is just
thrown away.
D) PRIN1
The SFA should print the arg in its slashified form. If the SFA
cannot perform this operation, it is simulated in terms of TYO.
E) PRINT
The SFA should print the arg in its slashified form preceeded by a
<NEWLINE> and terminated by a <SPACE>. If the SFA cannot perform this
operation, it is simulated in terms of TYO.
F) PRINC
The SFA should print the arg in its unslashified form. If the SFA
cannot perform this operation, it is simulated in terms of TYO.
G) CURSORPOS
The SFA will receive a list of the data args given to CURSORPOS. There
may be 0, 1 or 2 of these. If given the horizontal and vertical position,
there will be two elements in the list (<Vertical> <Horizontal>) which are
zero-indexed fixnums (or NIL for either/both meaning use the current value).
If given a single ascii character object, a relative cursor movement will
be expected (eg, C=Clear Screen, U=Move Up, ... [See .INFO.;LISP CURSOR])
If an empty data list is received, the SFA-handler should return the current
cursor position as a dotted pair (<Vertical> . <Horizontal>). There is
no clear global semantic meaning of this operations when
performed on non-tty's.
H) RUBOUT
The sfa should try to delete the last character output (either
by main output, or by echo output). See documentation on the MacLISP
RUBOUT function.
III) System functions for manipulating SFAs
A) (SFA-CREATE <old-SFA or SFA-function>
<amount-of-local-user-storage>
<printed-representation>)
SFA-CREATE returns an SFA-object which represents a function and
associated local storage. If the first arg is a SYMBOL, then that symbol
is taken as the SFA-function; if the first arg is an SFA-object, then the
function associated with it is used as the SFA-function, and the local
storage is possibly reclaimed (the first arg being an SFA is not yet
implemented). The second arg to this function should be the number of user
locations to allocate in the SFA-object.
When the SFA-CREATE is done, the SFA is immediatly invoked with a
WHICH-OPERATIONS call. A mask is then created corresponding to the
internal functions that the SFA knows how to do. This mask is used for
fast error-checking when a predefined operation is handed an SFA (e.g.
TYO).
B) (SFA-CALL <SFA-object> <operation> [<argument to SFA>])
SFA-CALL is used to perform an arbitrary operation on an arbitrary
SFA-object. For example, (TYO 1 <SFA>) is equivalent to
(SFA-CALL <SFA> 'TYO 1).
C) (SFAP <lisp-object>)
Returns T iff <lisp-object> is a SFA-object else returns NIL.
D) (SFA-GET <SFA-object> <fixnum or system-location-name>)
SFA-GET reads the local storage of <SFA-object>. If the second
arg is a fixnum, then location <fixnum> of the user's local storage is
accessed. This number may range from 0 to the maximum as specified when
the SFA-object is created {see SFA-CREATE}. If the second arg is a
symbol, then one of the "named" locations is accessed. The names are as
follows:
FUNCTION The SFA-function
WHICH-OPERATIONS A list of operations of interest to the
system that the SFA can perform. This is a
subset of the SFAs WHICH-OPERATIONS list.
PNAME The object to print as the "name" of an SFA
PLIST A general property list, for use by the user.
XCONS A "correspondent" for a bi-directional SFA;
akin to the TTYCONS concept for TTY's.
E) (SFA-STORE <SFA-object> <fixnum or system-location-name> <value>)
<value> is stored in the location specified by the second arg to
SFA-STORE. Locations are as for SFA-GET. It is strongly recommended that
the SFA-function NEVER be changed.
IV) Higher level tools.
A) DEFSFA -- Define a SFA
[requires some runtime support, which will be autoloaded in]
(DEFSFA <sfa-name> (<self-var> <op-var>) <slot-specs> <options>
&rest <clauses>)
<sfa-name> -- The name of this type of SFA.
<self-var> -- a variable to be bound to the SFA itself when it is sent a
message
<op-var> -- a variable to be bound to the name of the message.
<slot-specs> -- a list of slot names, or (<slot-name> <initial-value>)
each slot will have an accessor macro defined for it, with a name formed by
(SYMBOLCONC <sfa-name> '- <slot-name>)
<options> -- a list of option specs. An option spec is either a bare
symbol, denoting that the specified option is TRUE, or a list of an option
name and a value. The only option defined currently is :INIT, which
suppresses newly consed SFA's of this type getting a :INIT message if no
initial values are supplied. (If initial values are supplied, the :INIT
message must be sent in order to store them).
<clauses> -- a list of clauses. Each clause has the form
(<op or list of ops> <argspec> . <body>)
<op or list of ops> -- the ops are message keys, ala the second argument
to SEND or SFA-CALL.
<argspec> -- This is either a symbol, in which case it is bound to the
3rd argument, or a list of two or more symbols, in which
case it is bound to the 3rd-<n+2>th arguments. No error
checking on number of arguments will be done. If the symbol
is atomic, it will be reachable via either SFA-CALL or SEND,
otherwise it will be reachable only by SEND. This is
because SFA-CALL does not allow other than 3 arguments to be
passed.
<body> -- list of forms to be evaluated. The last one's value will be
returned.
This defines accessor macros for each slot in the SFA, plus a macro for
creating the SFA, named by prepending CONS-A- to the sfa-name. The
CONS-A-mumble macro does the SFA-CREATE, and immediately sends it a :INIT
message with a list of alternating slot-names and values.
All this works via the following lower-level mechanisms:
B) (SFA-UNCLAIMED-MESSAGE <sfa> <operation> <data>) Basically, this reports
the error. But first, it handles several special cases. The first is
turning a SEND into an SFA-CALL. When a SEND is performed on a SFA, it is
simulated by doing an SFA-CALL with an operation of :SEND, and a 3rd
argument of (LIST <old operation> <3rd argument> ... <nth argument>). If
:SEND is the operation to SFA-UNCLAIMED-MESSAGE, AND the SFA claims to
implement the <old operation> (in response to a WHICH-OPERATIONS-INTERNAL
query), it will turn it back into an SFA-CALL of the <old operation>, with
any extra arguments being thrown away. If it DOESN'T claim to handle it
the message is passed off to the superclass via SEND-AS
A subcase of the :SEND case is when the <old operation> is
WHICH-OPERATIONS. This implies a (SEND <sfa> 'WHICH-OPERATIONS) was done.
So this is simulated by mergeing any operations obtainable from the
superclass of SFA-CLASS. (If the EXTEND package isn't loaded, it doesn't
try to get them though.)
If the message is WHICH-OPERATIONS-INTERNAL, then the handler did not
implement WHICH-OPERATIONS-INTERNAL. We assume WHICH-OPERATIONS will
do the job and SFA-CALL that.
If the message is something other than :SEND, it just passes the message on
up to the superclass with SEND-AS.
It is recommended that any SFA's which for one reason or another do not use
DEFSFA should use SFA-UNCLAIMED-MESSAGE. Essentially the correct behaviour
with respect to SEND should result.
;;; Local modes: !
;;; Mode: Text !
;;; Auto fill mode:1 !
;;; Fill column:75 !
;;; End: !

127
doc/_info_/lisp.sharpc Executable file
View File

@@ -0,0 +1,127 @@
Date: 25 November 1980 12:52-EST
From: Robert W. Kerns <RWK at MIT-MC>
Subject: Feature double creature
To: KMP at MIT-MC
cc: LISP-FORUM at MIT-MC, "(FILE [LISP;SHARPC DOC])" at MIT-MC
Well, I suppose I should at this time (I've been postponing it) propose my
FEATURE-SET proposal.
First off, a couple notes about KMP's proposal:
1) I think the need for a canonical way of determining which dialect the code
is running under is clear.
2) I don't see any reason for it to be a STATUS mumble rather than a variable.
3) The issue is separate from issues of sharp-sign conditionalization and
feature-testing. Sharp-sign conditionalization does not want to depend on what
features are PRESENT AT READ TIME, but rather WHAT FEATURES ARE PRESENT AT
TIME-OF-USE. This last is the motivation for my proposal.
Some of you have seen this before. I've long intended to bring this out as
an alternate mode for the existing MACLISP SHARPM package, but haven't had the
time for integrating my code into the current version. But since it turns out
I need it for cross-compilation in NIL, I've just fixed it up.
1) A single LISP environment often has need of reading forms intended for
different LISP environments. For example, a compiler may be doing READ for
forms which may be EVAL'ed in its environment, or which may be EVAL'd in some
other LISP with possibly different features (probably not the COMPLR feature!)
with or without compilation. I.e. the line #-FOO in a source file usually
refers to a feature FOO in the LISP that the compiled file will run in. (I'll
get into exceptions to this later). The LISP where it will eventually matter
whether the FOO feature exists I will call the TARGET LISP. The target LISP
may or may not be the same LISP that is doing the READ that see's the #+FOO.
2) It is not really enough to say that because a feature is not on a list of
features somewhere that a feature is not present. Sometimes this is because
whoever told the compiler what features exist simply did not know all about the
target environment (I.e. I'm compiling this file for use with the RWK-HACKS
feature). Sometimes you know that a feature is NOT present, like FRANZ in the
MACLISP compiler. The obvious solution is to maintain TWO LISTS, of KNOWN
FEATURES and NON-FEATURES. What do you do if a feature is not known? Two
options are to signal an error, and to ask the user. I prefer the later.
3) It is not enough to have simply ONE set of features. When doing a LOAD in
a COMPLR, for example, one generally intends for that code to be evaluated in
the compiler, so the LOCAL LISP is the target, and the LOCAL FEATURES should be
brought to bear. When reading for compilation, COMPILATION-TARGET-FEATURES
should be what is used (by default) for FEATUREP.
So! I define the following goodies:
[This stuff is available by loading ((LISP) SHARPCONDITIONALS) either on top of
or instead of ((LISP) SHARPM)]
defun DEF-FEATURE-SET target features &optional nofeatures (query-mode ':QUERY)
Defines a feature-set for a target environment named <target>, with
the supplied features and non-features. If <query-mode> is :QUERY, the
user will be asked each time. If <query-mode> is :ERROR, an error is
signaled. If <query-mode> is T, FEATUREP of things unknown returns T, while
if it is (), it returns ().
[This query-mode stuff is merely to satisfy any namby-pambies out there who
don't like this winning stuff for one reason or another. If nobody dislikes
this stuff, maybe it should be flushed as being excess hair.]
defvar TARGET-FEATURES default LOCAL-FEATURES
The default feature-set for FEATUREP and the sharp-sign macro. This should
be bound around calls to READ when the result of the READ will be understood
in some other environment, such as compilers.
defun FEATUREP feature &optional (feature-set TARGET-FEATURES) (featurep T)
Returns T if <feature> is known to be a feature in <feature-set>.
<feature-set> is a symbol which has been defined to be a feature-set by
DEF-FEATURE-SET. If it the feature is not known to be either a feature or
not a feature, action is taken according to the query-mode of the feature
set. (see DEF-FEATURE-SET)
featurep is a purely internal flag which if () turns FEATURP into NOFEATUREP.
defun NOFEATUREP feature &optional (feature-set TARGET-FEATURES)
like FEATUREP, except returns T if known NOT to be a feature.
FEATUREP will take not only a feature name, but a generalized FEATURE-SPEC. A
feature-spec is a feature name, or (OR f1 f2 ... fn), meaning T iff f1, f2, ...
OR fn satisfy the FEATUREP test, (NOT f) [meaning the same as (nofeature f)],
(AND f1 f2 ... fn) meaning T iff f1, f2, ... AND fn satisfy the featurep test.
In addition to these familiar operators can be used any name of a FEATURE-SET.
I.e. (FEATUREP (AND (LOCAL-FEATURES F1) F2)) returns T iff F1 is a feature in
LOCAL-FEATURES and F2 is a feature in whatever feature set is the value of
TARGET-FEATURES. This may have some limited application in conjunction with #+
and #-, but should not be used wantonly.
#+ and #- are followed by a feature-spec and another form. #+ calls FEATUREP,
and #- calls NOFEATUREP on the feature-spec, and if () is returned, the next
form is gobbled and thrown away. Note that it is gobbled via a recursive READ,
so if it contains illegal syntax or #.'s, an error may result. Note that
using #- and #+ inside forms conditionalized with #- and #+ can quickly result
in unreadable and unmaintainable code.
A few functions for manipulating FEATURE-SETs:
defun COPY-FEATURE-SET old new
This function makes a new feature-set having the same known features,
non-features, and query mode as the old. It is probably the right way
to create new feature sets for related environments.
defun SET-FEATURE feature &optional (feature-set-name TARGET-FEATURES)
This function makes <feature> be a feature in the feature-set named by
<feature-set-name>. (FEATUREP <feature> <feature-set-name>) will thereafter
return T.
defun SET-NOFEATURE feature &optional (feature-set-name TARGET-FEATURES)
This function makes <feature> be a non-feature in the feature-set named by
<feature-set-name>. (NOFEATUREP <feature> <feature-set-name>) will
thereafter return T.
defun SET-FEATURE-UNKNOWN feature &optional (feature-set-name TARGET-FEATURES)
This function makes <feature> be unknown in the feature set. Depending on
the query-mode, FEATUREP and NOFEATUREP may query, give an error, or assume
the default values thereafter.
defun SET-FEATURE-SET-QUERY-MODE feature-set-name mode
sets the feature-set query-mode to <mode>. <mode> can be one of :QUERY,
:ERROR, T, or (), as described above.


82
doc/_info_/lisp.sharpm Executable file
View File

@@ -0,0 +1,82 @@
The extended syntax of #, as indicated by the subsequent character, with
questionable or not-yet-fully worked-out cases indicated by "???", and *
in column 1 meaning NIL/NIL-compatibility only
* " BITS expressed as 4 bits per hexadecimal digit
% MACROEXPAND following form at read time.
' Like single-quote macro. #'foo ==> (FUNCTION foo)
* ( S-expression VECTOR, elements inside list
* Unsigned-integer, or Machine-word
+ Conditional read, for next expression. A feature name, or
list with "OR" or "AND" as first element and remaining elements
as feature names, must immediately follow. Next form is
skipped unless this system has one of the requested features
(for "OR") or unless it has all the requested features (for
"AND".
, Load-time evaluation
- Conditional read, like "#+", but next form is skipped if the
conditions indicated are satisfied.
. Read-time evaluation
0 ... 9 decimal representation for a radix denotation
??? : Flush a package prefix, e.g. #:SI:FOO is the same as FOO
* B Binary notation for a bitstring follows
M Next form is flushed unless this is a MACLISP system
N Next form is flushed unless this is a NIL system
O Octal notation follows, either for a number or for a bitstring
Q Next form is flushed unless this is a LISPM system
R Radix change -- #16R<nnn> reads <nnn> in base 16.
* T Truthity, a specific non-null, not false, constant
X Hexadecimal notation for a number or for a bitstring
^ A FIXNUM, obtained by "controlifying" the next character.
(e.g. #^B is 2, the ascii value of control-B)
/ A FIXNUM, denoted by the next character (e.g. #/A is 65.).
\ A FIXNUM, denoted by the following standard symbolic names:
Name Value Name Value
NULL 0 RETURN 13
ALPHA 2 NEWLINE 13
BETA 3 CR 13
EPSILON 6 NL 13
BELL 7 ALTMODE 27
BACKSPACE 8 ALT 27
BS 8 BACK-NEXT 31
TAB 9 SPACE 32
LINEFEED 10 SP 32
LF 10 DELETE 127
VT 11 RUBOUT 127
FORM 12 HELP 2120
FORMFEED 12
FF 12
The user may add to this list using the function SETSYNTAX-SHARP-MACRO,
whose argument list is
(<character> <type> <function> &OPTIONAL (rt READTABLE))
The general # macro character function will dispatch to <function>
when <character> is the character immediately following the #; the
dispatch table is kept on a per Readtable basis. Or he may use the
autoloadable macro DEFSHARP which provides an easy way to set up "macro
character functions". For example
(defsharp /% (() )
(macroexpand (/#sub-read () READ-STREAM)))
defines (and activates using SETSYNTAX-SHARP-MACRO) a function to be run
when #% occurs. An alternative form is
(defsharp /: SPLICING (() )
(/#-flush-chars-not-set #/: 'T) () )
where the word SPLICING indicates that the result is to be like a
SPLICING readmacro character -- the default is like an elemental
readmacro character.
The # macro works by keying off a second character, with possibly an
argument in between. Currently, the permissible arguments are
(1) digits, for a numeric argument, e.g. #3R201 reads 201 in base 3.
(2) ^B, ^C, or ^F to signify respectively "add control bit", "add meta
bit", and "add control-meta bits". The "control" bit has value
128. and the "meta" bit has value 256.
The alist from /#-MACRO-DATALIST holds, for each valid "second" character,
a 4-list: (<char-code> <peekp> <type> <function>)
where <function> Takes one argument, as described above in (1) and (2). If
there is no "argument" then () is passed to the function.
<type> Is either MACRO or SPLICING
<peekp> A flag which, if non-null, means don't flush the "second"
character from the input stream before running <function>.
<char-code> Is the numeric encoding of the character

697
doc/_info_/lisp.stepmm Executable file
View File

@@ -0,0 +1,697 @@
--- THE LISP STEPPER ---
(FOR MORE INFORMATION THAN PROVIDED HERE CONTACT THE AUTHOR:
MATTHEW MORGENSTERN M.I.T. NE43-317 253-3546
OR :MAIL TO MM; @ML:)
TO LOAD: FROM LISP EXECUTE (FASLOAD STEPMM FASL COM).
NOTE: THE STEPPER HAS BEEN MODIFIED TO WORK IN BOTH OLDIO AND
NEWIO LISP ENVIRONMENTS. AN ENDPAGEFN IS PROVIDED
WITHIN THE STEPPER FOR NEWIO AND IT MAY BE CHANGED BY
GIVING A DIFFERENT VALUE TO THE ATOM MMSTEP-ENDPAGEFN .
THIS IS ALSO THE NAME OF THE INITIAL ENDPAGEFN, AND IT
CAN BE USED OUTSIDE THE STEPPER TOO BY DOING
(ENDPAGEFN T 'MMSTEP-ENDPAGEFN).
TO CURRENT USERS:
A NEW INTERESTING DISPLAY MODE IS NOW AVAILABLE, SEE THE
S COMMAND. OTHER NEW COMMANDS INCLUDE (U -), PATTERN MATCHING
FOR AN S-EXPRESSION IN A (COND ...), E(VAL), WTALL (WAIT-ALL),
WTIF (WAIT-IF), AND VARIABLE LENGTH PAUSING WHILE IN A AND C
MODES.
I CAPABILITIES
THE LISP STEPPER PACKAGE PROVIDES DEBUGGING CAPABILITIES
FOR INTERPRETED LISP PROGRAMS THAT ARE COMPARABLE TO THE CAPABILITIES
PROVIDED BY DDT FOR ASSEMBLER CODE. THESE CAPABILITIES INCLUDE:
1) SINGLE STEPPING THROUGH THE EVALUATION OF A FUNCTION AND
OVER OR INTO OTHER INTERPRETED FUNCTIONS, WHEN CALLED, ON A
SELECTIVE BASIS AS DETERMINED BY THE USER. EACH SUCH FORM
AND ITS RESULTING VALUE MAY BE DISPLAYED.
2) DYNAMIC BREAKPOINTING ON ONE OR MORE OF THE FOLLOWING
CONDITIONS: THE S-EXPRESSION OR ATOM ABOUT TO BE EVALUATED
MATCHES A PATTERN YOU PROVIDE; A SPECIFIC FUNCTION IS EXPLICITLY
EVAL'D; A GIVEN ATOM EVALUATES TO A GIVEN VALUE; A GIVEN ATOM
IS TO BE BOUND IN A PROG, EITHER TYPE OF DO, OR AN EVAL'D
LAMBDA; OR UPON AN ARBITRARY USER-SPECIFIED CONDITION.
3) RETURNING A DIFFERENT VALUE FOR A GIVEN S-EXPRESSION --
THIS ALLOWS FOR CHANGING THE ACTION THAT WOULD BE INITIATED BY
CONDITIONALS IN THE PROGRAM AND/OR BY GO'S IN A PROG OR DO.
YOU CAN ALSO "GO" TO ANY <TAG> INSIDE THE CURRENT PROG.
4) THESE CAPABILITIES MAY BE REQUESTED WHEN THE INITIAL
FUNCTION IS STARTED, OR THEY MAY BE INITIATED AT ANY
OTHER POINT IN THE COURSE OF EXECUTION -- EITHER FROM THE
CONSOLE WHILE IN A BREAKPOINT, OR DIRECTLY FROM THE PROGRAM.
II HOW TO USE
THE STEPPER MAY BE INVOKED INITIALLY BY USING THE
FUNCTION MEV AS ONE WOULD USE EVAL OF ONE ARGUMENT; EG.
(MEV '(FCN ARG1 ARG2)). FROM A BREAKPOINT OR IN A PROGRAM,
THE STEPPER MAY BE TURNED ON BY INVOKING (HKSTART) WITH NO
ARGUMENTS. IT MAY BE TURNED OFF BY THE Q COMMAND DESCRIBED
BELOW, OR OF COURSE BY CONTROL-G. AFTER MEV EVALUATES ITS
ARGUMENT, IT RETURNS THE VALUE AND TURNS OFF THE STEPPER.
NOTE THAT IN THE ABOVE EXAMPLE THE FORM TO MEV WAS QUOTED.
IF, SAY, THE VALUE OF F WAS THE S-EXPRESSION (FCN ARG1 ARG2),
THEN ONE COULD USE (MEV F) INSTEAD.
AT ANY POINT DURING THE STEPPING, ONE MAY INSPECT THE
VALUES OF OTHER VARIABLES, AND EVEN REAPPLY MEV TO ANY FORM.
THIS MAY BE DONE IN EITHER OF THREE WAYS. EACH COMMAND WILL BE
PROMPTED FOR BY // , USUALLY FOLLOWING THE LAST FORM PRINTED
OUT. ANY S-EXPRESSION THAT YOU TYPE WHICH IS NOT RECOGNIZED AS
A COMMAND WILL BE EVAL'D (WITHIN AN ERRSET TO CATCH ERRORS).
ALTERNATIVELY, YOU CAN USE THE E COMMAND TO EVAL ANY EXPRESSION,
OR THE H COMMAND TO GET A NICE TYPE OF CONTROL-H BREAK.
EACH COMMAND MUST BE FOLLOWED BY A SPACE (UNLESS THE
COMMAND IS A LIST). EACH FORM AND RESULT WHICH IS
PRINTED OUT WILL BE FOLLOWED BY #<NUMBER> INDICATING THE
RELATIVE LEVEL OF EVALUATION (IE. STACK DEPTH SINCE INVOCATION).
THE PRIMARY COMMANDS ARE:
D (MNEMONIC FOR DOWN) GO DOWN TO THE NEXT DEEPER LEVEL OF
EVALUATION AND DISPLAY THE FIRST FORM THERE BEFORE EVALUATING
IT. EG. IF THE FORM IS A FUNCTION CALL, WILL DISPLAY THE FIRST
ARGUMENT OF THE FUNCTION IF IT HAS ARGUMENTS IN THE CALL;
ELSE WILL DISPLAY THE FIRST S-EXP OF THE FUNCTION.
THEN PROMPTS FOR THE NEXT COMMAND.
E (EVAL) CAN BE USED TO EVAL AN ARBITRARY EXPRESSION. IT
STARTS A NEW LINE, WAITS FOR YOU TO TYPE THE EXPRESSION,
THEN EVAL'S IT WITHIN AN ERRSET, AND PRINTS THE RESULT.
COMPARABLE TO JUST TYPING THE EXPRESSION OR ATOM AFTER
THE //, BUT CANNOT BE CONFUSED WITH A COMMAND, AND THE
FORMAT IS NICER.
H (CONTROL-H) EXECUTES A CONTROL-H BREAK, AND WHEN $P'ED
DISPLAYS THE CURRENT FORM. WITHIN THE BREAK, ONE CAN
INSPECT THE VALUES OF VARIABLES, ETC., AND EVEN REAPPLY MEV
TO ANY FORM.
N (NEXT) DISPLAY THE NEXT FORM (IE. S-EXP) AT THIS LEVEL,
WITHOUT SHOWING OR INSPECTING THE EVALUATION OF THE LOWER
LEVELS OF THE CURRENT FORM. THE VALUE OF THE CURRENT FORM
IS DISPLAYED FIRST. IF YOU WISH A CONDITION TO BE TESTED FOR
AT LOWER LEVELS, USE NN INSTEAD.
NN LIKE N BUT SLOWER SINCE IT INSPECTS THE LOWER LEVELS.
USE INSTEAD OF N WHEN TESTING FOR A CONDITION.
U (UP) GO UP TO THE NEXT HIGHER LEVEL OF EVALUATION AND SHOW
THE NEXT FORM AT THAT LEVEL. THE FORM(S) AT THE CURRENT AND
LOWER LEVELS ARE EVALUATED WITHOUT DISPLAY. AS AN EXAMPLE
OF ITS USE, AFTER YOU HAVE SEEN THE EVALUATION OF THE
ARGUMENTS TO A FUNCTION, THE NEXT FORM TO BE EVALUATED, IF
THE FUNCTION IS BEING INTERPRETED, WILL BE THE FIRST
S-EXPRESSION OF THE FUNCTION; TO AVOID SEEING HOW THE
FUNCTION IS EVALUATED INTERNALLY, YOU CAN TYPE U .
NOTE THAT THE LOWER LEVELS ARE NOT INSPECTED -- THUS
IF A CONDITION IS TO BE TESTED FOR AT THESE LEVELS, USE UU.
(U <NUM>) IF <NUM> IS POSITIVE (INCL. 0), FORMS ARE NOT
INSPECTED NOR DISPLAYED UNTIL THAT LEVEL NUMBER IS RETURNED
TO. IF NEGATIVE, GOES UP THIS NUMBER (ABSOLUTE VALUE) OF
LEVELS RELATIVE TO THE CURRENT LEVEL. THUS (U -1) IS
EQUIVALENT TO U .
UU LIKE U BUT SLOWER. USE IF TESTING FOR A CONDITION.
(UU <NUM>) LIKE (U <NUM>) BUT SLOWER. USE IF TESTING FOR A
CONDITION.
Q (QUIT) EXIT FROM THE STEPPER.
S (SHOW OR DISPLAY MODE) FOR DATAPOINTS AND OTHER DISPLAY
CONSOLES, THIS GIVES A NICE EASY READING OUTPUT
OF SELECTED LEVELS THAT CONSTITUTE THE CONTEXT OF THE
CURRENT EVALUATION. SPECIFICALLY, IT SELECTS THE CURRENT
LEVEL FOR SPRINTING AS A "HEADER", AND AS YOU GO DEEPER, THE
LOCAL CONTEXT IS ABBREVIATE-PRINTED UNDER THIS HEADER, AND
THE CURRENT OUTPUT WILL BE SPRINTED. S MAY BE USED AS OFTEN
AS YOU LIKE. HEADERS WILL AUTOMATICALLY BE POPPED WHEN YOU
RETURN . THE COMMAND (S <NUM>) SELECTS A PARTICULAR LEVEL
AS A HEADER. IT AND THE COMMAND SN AND SEVERAL USER
SETTABLE PARAMETERS ARE DESCRIBED IN THE MORE DETAILED
SECTION BELOW.
(= <S-EXP>) THE S-EXPRESSION IS SUBSTITUTED FOR THE CURRENT
FORM AND ANOTHER COMMAND IS PROMPTED FOR (IE. YOU CAN STEP
INTO OR OVER THE NEW FORM IF YOU WANT TO). WHEN THE
RESULTING VALUE IS RETURNED IT WILL BE AS IF THE
ORIGINAL FORM HAD YIELDED THAT VALUE. FOR
EXAMPLE YOU CAN CHANGE THE APPARENT TRUTH OR FALSITY OF
PREDICATES OR BYPASS A (GO <LABEL>), AS WELL AS JUST RETURN-
ING DIFFERENT VALUES FOR AN S-EXPRESSION.
(COND ...) TESTS FOR CONDITIONS PRIOR TO EVALUATION OF EACH
FUTURE FORM, AND WHEN SATISFIED WILL PRINT A MESSAGE,
DISPLAY THE FORM, AND WAIT FOR ANOTHER COMMAND (WHICH
MAY OF COURSE BE H FOR A BREAK). THE ARGUMENT TO THIS
"COND" IS AN ARBITRARY S-EXPRESSION OR ATOM WHICH IS
EVALUATED LIKE A PREDICATE (SIMILAR TO THAT IN THE
TRACE PACKAGE).
IN SPECIFYING THE PREDICATE, THE FORM ABOUT TO BE
EVALUATED MAY BE OBTAINED AS THE VALUE OF %%FORM. THE
FUNCTION (HOOKLEVEL) RETURNS THE RELATIVE LEVEL OF EVALUATION.
MORE THAN ONE ARGUMENT MAY BE GIVEN, IN WHICH CASE
THEY ARE OR'ED TOGETHER, EXCEPT WHEN TWO ARGUMENTS FORM A
SPECIAL TEST AS DESCRIBED IN THE MORE DETAILED SECTION BELOW.
THE CONDITION WILL REMAIN ACTIVE AT ALL LEVELS THAT ARE
INSPECTED BY THE STEPPER UNTIL EXPLICITLY TURNED OFF BY
(COND NIL).
(MATCHF ...) IS A FUNCTION WHICH WILL PATTERN MATCH AGAINST
THE CURRENT FORM, AND MAY BE USED IN THE PREDICATE OF THE
COND. (ALSO SEE ITS RELATED USE AS A COMMAND.) THE ARGUMENT
TO MATCHF IS COMPARED TO %%FORM ELEMENT BY ELEMENT FROM LEFT
TO RIGHT, AND SUCCEEDS WHEN EACH ELEMENT OF THE PATTERN
SUCCEEDS. OF IMPORTANCE, THE PATTERN NEED NOT INCLUDE THE
ENTIRE S-EXPRESSION OF %%FORM. * MATCHES ANYTHING. THE
PROCEDURE IS APPLIED RECURSIVELY TO SUBLISTS, UNLESS THE
SUBLIST IS OF THE FORM (# ...) IN WHICH CASE # IS BOUND TO
THE CURRENT ELEMENT OF %%FORM AND THE CDR (NOT CADR) OF THE
#-LIST IS EVAL'D AS THE TEST ON THAT ELEMENT. EXCEPT IN THIS
CASE, ATOMS AND LISTS SHOULD BE GIVEN AS IN THE ORIGINAL CODE
AS THEY ARE NOT EVALUATED. SOME SIMPLE EXAMPLES ARE:
(MATCHF XYZ) SUCCEEDS IF THE ATOM XYZ IS ABOUT TO BE EVAL'D
(MATCHF (SETQ ALPHA)) SUCCEEDS IF THE ATOM ALPHA IS ABOUT TO
BE SETQ'D.
(MATCHF (PUTPROP NAME * 'SOURCE)) SUCCEEDS IF THE PROPERTY
SOURCE IS ABOUT TO BE PUTPROP'D ON THE ATOM POINTED TO
BY (IE. THE VALUE OF) NAME.
(MATCHF (SETQ (# MEMBER # '(ALPHA BETA S3)))) SUCCEEDS IF
EITHER ALPHA, BETA, OR S3 ARE ABOUT TO BE SETQ'D.
(MATHCF (RPLACD * '(* 9))) FOR EXAMPLE MATCHES
(RPLACD (LAST URLIST) '(2 9 4))
(MATHCF ((# MEMBER # '(FOO BAR)))) SUCCEEDS IF A FUNCTION
CALL TO EITHER FOO OR BAR IS ABOUT TO BE EVAL'D (MORE
PRECISELY IF THE CAR OF THE LIST ABOUT TO BE EVAL'D
IS EITHER FOO OR BAR).
NIL (COND NIL) TURNS THE CONDITION OFF AND SAVES THE
CURRENT NON-NIL CONDITION.
(COND) WHEN NO ARGUMENT IS GIVEN, THE LAST NON-NIL CONDITION
(WHICH IS THE 'OLD PROPERTY OF '%%COND) IS ESTABLISHED
AS THE CURRENT CONDITION (WHICH IS THE VALUE OF
%%COND). (IF THE PREVIOUS CONDITION WAS NOT NIL THEN
IT IS SAVED AS THE 'OLD PROPERTY, THUS ALLOWING FOR
ALTERNATION OF TWO CONDITIONS.)
(MATCHF ...) IS EQUIVALENT TO (COND (MATCHF ...)), SEE ABOVE.
RELATED FUNCTIONS:
(HKSTART) WILL INITIATE STEPPING WHEN ENCOUNTERED IN A PROGRAM
OR TYPED FROM A BREAKPOINT. (HKSTOP) WILL ACT LIKE THE Q
COMMAND TO TURN OFF STEPPING. (ALSO SEE BELOW FOR MORE INFO.)
(MBAK) IS A FUNCTION TO BE USED LIKE THE LISP SYSTEM'S
(BAKLIST). (MBAK) STRIPS OUT FROM THE RESULT OF (BAKLIST)
THOSE FUNCTIONS THAT HAVE TO DO WITH THE STEPPER.
-------------------------
III COMPLETE LIST OF COMMANDS:
COMMANDS WHICH ARE NOT LISTS MUST BE FOLLOWED BY A SPACE.
YOU CAN USE RUBOUT BEFORE COMPLETING THE COMMAND (AND ITS SPACE
IF NECESSARY). ALTERNATIVELY YOU MAY ABORT THE COMMAND
BEFORE COMPLETING IT BY DOING CONTROL-X.
ANY S-EXPRESSION THAT YOU TYPE WHICH IS NOT RECOGNIZED AS A
COMMAND WILL BE EVAL'D (WITHIN AN ERRSET TO CATCH ERRORS). THUS
YOU CAN EVALUATE ANY ATOM OR DO ANY FUNCTION CALL SIMPLY BY
TYPING IT FOLLOWING THE PROMPTING // SO LONG AS IT IS NOT
INTERPRETABLE AS ONE OF THE COMMANDS BELOW (OR NIL). NOTE THAT
YOU CAN ACTUALLY "GO" TO A <TAG> WITHIN YOUR PROGRAM SIMPLY BY
TYPING (GO <TAG>) AFTER THE //. TO EVALUATE A FORM WHICH LOOKS
LIKE A COMMAND, TYPE (OR <S-EXP>) TO EVALUATE IT, EG. (OR A)
EVALUATES THE ATOM A. (IF YOU WISH YOU CAN EVEN WRITE FUNCTIONS
WITH REGARD TO THE STEPPER AND TREAT THEM AS COMMANDS.)
A (ALL) AUTOMATICALLY DISPLAYS ALL FORMS AND VALUES SEEN BY
THE STEPPER AT ALL LEVELS. TYPING A SPACE AT ANY TIME
THEREAFTER WILL CAUSE THE STEPPER TO LEAVE THIS MODE AND
PROMPT FOR A NEW COMMAND. IF YOU WANT THE STEPPER TO WAIT
FOR A COMMAND AFTER EACH FORM, YOU CAN USE THE D COMMAND.
COMMANDS A AD (A -) C AND CC PAUSE AFTER EACH NEW FORM
IS DISPLAYED IF %%AC-SLEEP IS NON-NIL, ITS VALUE IS USED AS
THE SLEEP TIME IN SECONDS.
AD (ALL DOWN) AUTOMATICALLY DISPLAYS ALL FORMS AND VALUES
ENCOUNTERED BY THE STEPPER IN EVALUATING THE CURRENT FORM
(IE. AT DEEPER LEVELS). TYPING A SPACE PRIOR TO COMPLETION
WILL CAUSE THE STEPPER TO LEAVE THIS MODE AND PROMPT FOR A
NEW COMMAND. (ALSO SEE D.) SLEEPS AFTER EACH FORM, AS
DESRIBED UNDER THE A COMMAND.
(A <LEV>) AUTOMATICALLY DISPLAYS ALL FORMS AND VALUES AT THE
INDICATED LEVEL AND LOWER (DEEPER) LEVELS, TURNING ITSELF
OFF WHEN EVALUATION POPS TO A LEVEL WITH A SMALLER LEVEL
NUMBER. TYPING A SPACE PRIOR TO COMPLETION WILL CAUSE
THE STEPPER TO LEAVE THIS MODE AND PROMPT FOR A NEW
COMMAND. (ALSO SEE D.) SLEEPS AFTER EACH FORM, AS
DESRIBED UNDER THE A COMMAND.
B SETS A BREAKPOINT TO OCCUR AFTER EVALUATION OF THE CURRENT
FORM. AT THE BREAK, THE VALUE TO BE RETURNED IS THE VALUE
OF %%VALUE, AND MAY BE CHANGED BY SETQING THIS VARIABLE.
THE FORM THAT YIELDED THIS VALUE IS THE VALUE OF %%FORM.
DO $P TO PROCEED FROM THE BREAKPOINT. IF YOU PREFER THE
SYSTEM TO WAIT RATHER THAN BREAK SEE THE WTIF COMMAND.
(B OPERATES BY ADDING THE CURRENT HOOKLEVEL TO
%%BREAKLIST.) YOU CAN GET AUTOMATIC BREAKING AT ALL LEVELS
BY USING (RETCOND T) OR CONDITIONAL BREAKING AS DESCRIBED
BELOW FOR THE (RETCOND ...) COMMAND.
C (CURRENT) AUTOMATICALLY DISPLAYS ALL FORMS AND VALUES AT
JUST THE CURRENT LEVEL. TYPING A SPACE AT ANY TIME DURING
THE DISPLAY WILL CAUSE THE STEPPER TO LEAVE THIS MODE AND
PROMPT FOR A NEW COMMAND. THE STEPPER DOES NOT INSPECT
THE FORMS OF LOWER LEVELS -- THUS IF A CONDITION IS TO
BE TESTED FOR AT THESE LEVELS, USE CC. SLEEPS AFTER EACH
FORM, AS DESRIBED UNDER THE A COMMAND.
CC LIKE C, BUT INSPECTS THE LOWER LEVELS.
CTOG FLIPS THE %%CONDNOTALLOW TOGGLE WHICH IS INITIALLY T,
MEANING DO NOT ALLOW C, M, N, OR U COMMANDS IF A CONDITION
IS BEING TESTED FOR. NIL MEANS ALLOW THESE ANYWAY.
(COND ...) TESTS FOR CONDITIONS PRIOR TO EVALUATION OF EACH
FUTURE FORM. FOR PATTERN MATCHING AGAINST THE FORM USING
THE MATCHF FUNCTION AND FOR OTHER INFOR. ALSO SEE THE
DESCRIPTION OF (COND ...) IN SECTION II ABOVE.
SPECIAL TESTS FOR (COND ...) :
TO AID THE SPECIFICATION OF COMMON TESTS, THE FOLLOWING
"FLAGS" ARE PROVIDED -- THE SAME EFFECTS COULD BE OBTAINED
BY INSPECTING %%FORM IN YOUR OWN PREDICATE GIVEN TO "COND".
IF THE FIRST ARGUMENT TO THE COND IS FROM THE SET:
(FORM FORMQ BIND BINDQ ATOMVAL ATOMVALQ
FCN FCNQ AND ANDQ)
THEN THE SECOND ARGUMENT IS USED TO DERIVE A TEST.
THIS PROCESS IS REPEATED WITH THE REMAINING ARGUMENTS,
IF ANY. THE RESULTING TESTS, TOGETHER WITH ANY
REMAINING ARGUMENTS NOT SATISFYING THIS PROCESS, ARE
EFFECTIVELY OR'ED TOGETHER TO DERIVE THE OVERALL
CONDITION (EXCEPT FOR THE "AND ANDQ FLAG" SPECIAL TESTS
WHICH ARE AND'ED). THE ARGUMENTS ARE NOT EVALUATED WHEN
TYPED BUT ARE EVAL'D EACH TIME THE CONDITION IS TESTED.
THESE FLAGS EACH MAY BE USED MORE THAN ONCE.
THE MEANING OF THESE FLAGS ARE:
ANDQ THE NEXT ARGUMENT IS AND'ED WITH THE REMAINING
TESTS, AND MUST YIELD A NON-NIL VALUE FOR THE
REMAINDER OF THE CONDITION TO SUCCEED. (SEE THE
COMMENTS FOR COND IN THE "COMPLETE LIST OF
COMMANDS" BELOW REGARDING THE USE OF SIDE EFFECTS)
ATOMVALQ THE NEXT ARGUMENT SHOULD BE A LIST OF TWO
ELEMENTS, THE FIRST AN (UNQUOTED) NAME OF AN ATOM,
AND THE SECOND THE VALUE OF THIS ATOM FOR THE TEST
TO SUCCEED.
BINDQ WATCH FOR THE FOLLOWING (UNQUOTED) ATOM
TO BE BOUND IN A PROG, OR IN EITHER TYPE OF DO, OR
AN EXPLICITLY "EVAL'D" LAMBDA (AS DISTINCT FROM AN
"APPLY'D" LAMBDA OR FUNCTION CALL).
FCNQ WATCH FOR THE FOLLOWING (UNQUOTED) FUNCTION NAME
TO BE SEEN BY "EVAL" AS THE "CAR" OF THE FORM
ABOUT TO BE EVALUATED (CANNOT CHECK FOR "APPLY'D"
OR "MAP'D" FUNCTION CALLS).
FORMQ THE FOLLOWING (UNQUOTED) S-EXP IS TO BE WATCHED
FOR. EG.USE TO CHECK WHEN AN ATOM IS ABOUT TO BE
EVALUATED.
AND : THESE EVALUATE THEIR ARGUMENT EACH TIME THE
BIND : CONDITION IS TESTED IN ORDER TO GET THE DESIRED
FCN : S-EXP OR ATOM NAME, AND THEN PERFORM LIKE THEIR
FORM : "Q" COUNTERPARTS. PARTICULARLY USEFUL IF THE
: FLAG'S ARGUMENT IS THE VALUE OF AN ATOM.
: (BE SURE NOT TO CHANGE THE ATOM'S VALUE ACCIDENT-
: ALLY WHILE THE CONDITION REMAINS IN EFFECT.)
ATOMVAL SIMILARLY, EVALUATES THE CAR OF ITS ARGUMENT TO GET
THE ATOM NAME, AND THEN ACTS LIKE ATOMVALQ.
AS A SIMPLE EXAMPLE, (COND FCNQ RPLACD) WILL CHECK AND
STOP WHEN THE FUNCTION RPLACD IS ABOUT TO BE EVALUATED
(IE. WHEN IT IS THE THE "CAR" OF THE FORM TO BE EVAL'D).
THE COMMANDS C, M, N, AND U DO NOT INSPECT ALL
LEVELS, AND THUS THE CONDITION CANNOT BE TESTED FOR AT
THESE LEVELS. YOU CAN USE CC, NN, MM, OR UU INSTEAD, OR
USE THE CTOG COMMAND. NATURALLY, CONDITION TESTING SLOWS
THE SPEED OF EXECUTION AT LEVELS THAT ARE INSPECTED BY
THE STEPPER BUT WHICH YOU DO NOT HAVE DISPLAYED.
IF YOU CHOOSE TO, YOU CAN HAVE YOUR PREDICATES
PRODUCE SIDE-EFFECTS SUCH AS RECORDING INFORMATION OF VALUE
TO YOU OR SETTING STATES FOR USE BY THE CONDITION LATTER.
YOU CAN USE THE AND ANDQ FLAGS (MORE THAN ONCE IF
YOU LIKE) TO HAVE THE EXPRESSIONS EXECUTED EVEN UPON
SUCCESS, SO LONG AS THESE FLAGS APPEAR FIRST IN THE
CONDITION. OTHER CONDITIONS ARE EVALUATED IN THE ORDER
OF APPEARANCE UNTIL THE FIRST SUCCESS IS FOUND.
D (DOWN) DISPLAYS THE NEXT LEVEL DOWN (AS DESCRIBED ABOVE ALSO).
NOTE THAT IF THE FORM IS AN ATOM, THE EFFECT IS THE SAME
AS THE N COMMAND. HENCE IF YOU WANT THE STEPPER TO DISPLAY
EVERY FORM AND VALUE, BUT TO WAIT FOR A COMMAND AFTER EACH
FORM, JUST KEEP USING THE D COMMAND.
E (EVAL) CAN USE TO EVAL AN ARBITRARY EXPRESSION. IT STARTS
A NEW LINE, WAITS FOR YOU TO TYPE IT, THEN EVAL'S IT WITHIN
AN ERRSET, AND PRINTS THE RESULT. COMPARABLE TO JUST
TYPING THE EXPRESSION OR ATOM AFTER THE //, BUT CANNOT BE
CONFUSED WITH A COMMAND, AND THE FORMAT IS NICER.
(= <S-EXP>) REPLACES THE CURRENT FORM WITH THE GIVEN
S-EXPRESSION, AND THEN PROMPTS FOR ANOTHER COMMAND,
AS DESCRIBED ABOVE. IF TWO ARGUMENTS ARE GIVEN, THEN
THIS EXPRESSION WILL NOT BE TREATED AS A STEPPER COMMAND,
RATHER IT WILL BE EVALUATED (SEE COMMENTS AT TOP OF THIS
SECTION).
H CONTROL-H BREAK IS EXECUTED. CURRENT FORM IS REDISPLAYED
WHEN $P IS DONE. THE FORM ABOUT TO BE EVALUATED IS THE
VALUE OF %%FORM. WITHIN THE BREAK, ONE CAN INSPECT
THE VALUES OF VARIABLES, ETC., AND EVEN REAPPLY MEV TO
ANY FORM.
K (KILL) DOES NOT EVALUATE THE CURRENT FORM NOR DISPLAY
ANY VALUE. EG. GOOD FOR AVOIDING SIDE EFFECTS IF
RESTEPPING THROUGH A PROGRAM AGAIN. EQUIVALENT TO (= NIL)
FOLLOWED BY M COMMAND.
LR (LAST RESULT) A COMPLETE RATHER THAN ABBREVIATED PRINTOUT
OF THE LAST RESULT IS GIVEN. (SEE (P - -) FOR FURTHER INFO)
M NEXT, LIKE N BUT THE RESULT OF THE CURRENT FORM IS NOT
DISPLAYED. IF A CONDITION IS TO BE TESTED FOR AT LOWER
LEVELS, USE MM.
(MATCHF ...) IS EQUIVALENT TO (COND (MATCHF ...)), SEE THE
THE DESCRIPTION OF (COND ...) IN SECTION II ABOVE.
MM NEXT, LIKE NN BUT THE RESULT OF THE CURRENT FORM IS NOT
DISPLAYED
N (NEXT) DISPLAYS THE VALUE OF THE CURRENT FORM AND DISPLAYS
THE NEXT FORM, THEN AWAITS THE NEXT COMMAND. DOES NOT
INSPECT THE LOWER LEVELS. IF A CONDITION IS TO BE TESTED
FOR AT LOWER LEVELS, USE NN INSTEAD.
NN LIKE N BUT INSPECTS THE LOWER LEVELS.
O (OLD) DOES (MEV '<LAST FORM>). USEFUL FOR SEEING HOW A
FORM PRODUCED AN UNEXPECTED VALUE WHEN YOU WENT OVER IT
WITH N OR NN. IF REEVALUATING THE FORM CAN PRODUCE SIDE
EFFECTS BE CAREFUL. CAN BE EXITED FROM BY THE XX COMMAND.
(THE OLD FORM IS THE VALUE OF %%OLDFORM.)
OL (OLD, AT CURRENT LEVEL) DOES (MEV '<LAST FORM AT THIS
LEVEL>). BEHAVES LIKE O. USEFUL TO SEE THE FORM (AT
THIS LEVEL) WHICH PRODUCED THE CURRENT VALUE -- RATHER
THAN THE LAST FORM PRINTED OUT, AS O WOULD YIELD.
(THE OLD FORM USED HERE CAN BE OBTAINED BY
(GET %%HOOKLEVEL 'OLDFORM).)
P (PRINT) REDISPLAYS THE CURRENT FORM. EG. USEFUL IF YOU
WISH TO CLEAR SCREEN FIRST WITH CONTROL-L. GIVES TYPICAL
ABBREVIATED DISPLAY (SEE (P - -)), EXCEPT HAS SOMEWHAT
DIFFERENT EFFECT IF IN DISPLAY MODE (SEE S COMMAND).
(FOR HACKERS OF SPECIAL DATA STRUCTURES, EG "OWL",
PRINTING WILL BE DONE WITH THE FUNCTION WHICH IS THE
VALUE OF THE ATOM PRIN1 IF NON-NIL -- AS ALSO APPLIES
TO TOP-LEVEL IN LISP. THIS VALUE OF PRIN1 IS CHECKED
ONLY IN MEV FUNCTION. MOREOVER, UNLESS YOU REQUEST
LISP NOT TO "SNAP LINKS" IN COMPILED CODE, YOU MAY HAVE
TO RELOAD THE STEPPER AFTER CHANGING PRIN1. TO AVOID
THE RELOADING MESSAGES HAVE FASLOAD = NIL.)
PP (FULL PRINT) GIVES A COMPLETE PRINTOUT OF THE CURRENT FORM.
3
PPP (P , IE. EVEN BETTER PRINTOUT) PRETTY-PRINTS THE CURRENT
FORM USING THE SPRINT FUNCTION. USES A LOT OF SCREEN IN
GENERAL, AND SO WILL PAGEPAUSE FOR YOU.
(P - -) RESETS THE PARAMETERS FOR THE ABBREVIATED PRINTOUT USED
FOR RESULTS, FORMS AND THE P COMMAND. FIRST PARAMETER IS
THE PRINLEVEL, THE SECOND IS PRINLENGTH (AS IN THE LISP
MANUAL); BOTH MUST BE GIVEN. IF NIL IS GIVEN INSTEAD OF A
NUMBER NO ABBREVIATING IS DONE WITH RESPECT TO THAT
PARAMETER; THUS (P NIL NIL) TURNS OFF ABBREVIATING. (THE
CURRENT SETTINGS ARE THE VALUE OF %%HOOKPRIN.)
Q (QUIT) EXITS FROM THE STEPPER. PREVIOUSLY REQUESTED BREAKS
AND CONDITIONS ARE DISABLED, AND ANY NON-NIL CONDITIONS
ARE SAVED ON THE 'OLD PROPERTY OF THE CONDITON NAME.
(CONTROL-G ALSO EXITS AS USUAL.)
S (SHOW OR DISPLAY MODE) FOR DATAPOINTS AND OTHER DISPLAY
CONSOLES, THIS GIVES A NICE EASY READING OUTPUT
OF SELECTED LEVELS THAT CONSTITUTE THE CONTEXT OF THE
CURRENT EVALUATION. SPECIFICALLY, IT SELECTS THE CURRENT
LEVEL FOR SPRINTING AS A "HEADER", AND AS YOU GO DEEPER,
THE LOCAL CONTEXT IS ABBREVIATE-PRINTED UNDER THIS HEADER,
AND THE CURRENT OUTPUT WILL BE SPRINTED. S MAY BE USED AS
OFTEN AS YOU LIKE. HEADERS WILL AUTOMATICALLY BE POPPED
WHEN YOU RETURN. ALL SPRINTING IS DONE WITH PAGEPAUSE ON.
IF CONTROL-X IS TYPED DURING SPRINTING, THAT EXPRESSION
WILL BE REDISPLAYED USING ABBREVIATED-PRINTING INSTEAD.
WHEN IN THIS DISPLAY MODE, THE P COMMAND WILL CLEAR THE
SCREEN FROM THE LAST FORM DOWN, UNLESS PRECEEDED BY
CONTROL-L (OR IF WRAP-AROUND OCCURRED), IN WHICH CASE THE
SCREEN IS FULLY REDISPLAYED. ALSO SEE (S <ARG>) FOR MORE
INFORMATION AND OPTIONS.
(S <ARG>) IF <ARG> IS POSITIVE, SELECTS THE FORM AT THAT LEVEL
AS THE "HEADER" FOR S(HOW) MODE. IF NEGATIVE, USES THE
FORM AT <ARG> LEVELS ABOVE THE CURRENT ONE. IF <ARG> IS
NIL, DISPLAY MODE IS TURNED OFF (HEADERS ARE REMEMBERED
THO). (S T) JUST TURNS DISPLAY MODE ON IF CURRENTLY OFF
USING THE PREVIOUSLY REMEMBERED HEADERS IF STILL APPLICABLE
; BUT IF ALREADY ON, THIS POPS THE STACK OF HEADERS BY ONE
(NORMALLY HEADERS ARE AUTOMATICALLY POPPED WHEN THE LEVEL
RETURNED FROM). ALL SPRINTING IS DONE WITH PAGEPAUSE ON.
IF CONTROL-X IS TYPED DURING SPRINTING, THAT EXPRESSION
WILL BE REDISPLAYED USING ABBREVIATED-PRINTING INSTEAD.
ALSO SEE SN COMMAND.
SEVERAL PARAMETERS ARE USER SETTABLE FROM THEIR
DEFAULTS. %%LOWERDISPLAY AND %%LOWERDISPLAY-MIN CONTROL
THE MAX AND MIN NUMBER OF LEVELS TO DISPLAY BELOW THE
HEADER (DEFAULTS OF 5 AND 2). THIS IS DONE IN IN
ABBREVIATE-PRINTED FORM USING %%SHORTPRIN WHICH IS A
LIST OF THE PRINLEVEL AND PRINLENGTH (DEFAULT 3 3).
SPRINTING OF FORMS AND RESULTS WILL BE ABBREVIATE-SPRINTED
BY THE MSPRINT FUNCTION IF THE FLATSIZE OF THE EXPRESSION
EXCEEDS %%FLATSIZE-MAX (DEFAULT ABOUT 450). THE PRINLEVEL
AND PRINLENGTH FOR THE LATTER ARE THE LIST %%SPRINTABBR
(DEFAULT IS 7 8). IF %%FLATSIZE IS NIL, FULL SPRINTING
WILL ALWAYS BE USED; (IF NEGATIVE, ABBREVIATE SPRINTING
WILL ALWAYS BE USED SO THAT INFINITE PRINTING
CIRCULAR STRUCTURES WILL SPRINT AND ABBREVIATE-PRINT
FINITELY -- REQUESTED BY SUN; FOR "OWL" WORKERS).
TO TURN OFF SPRINTING OF RESULTS SETQ
%%RESULT-SPRINT TO NIL (DEFAULT T). IF %%MDISTITLE IS
NEITHER NIL OR A NUMBER, IT WILL BE EVAL'D JUST AFTER THE
SCREEN IS CLEARED, ALLOWING PRINTING OF A TITLE. IF IT IS
A NUMBER, THAT NUMBER OF BLANK LINES WILL BE LEFT AT THE
TOP OF THE SCREEN (ALSO SEE SVIEWMSG FUNCTION BELOW).
IF THE PARTIAL CLEARING OF THE SCREEN BOTHERS YOUR EYES,
SETQ'ING %%EYESTRAIN1 TO A NUMBER OF SECONDS (EG 0.5
TO 2.0) WILL SLOW DOWN THE NEW DISPLAY DEPENDING ON THE
NUMBER OF LINES CLEARED.
SN JUST FOR S(HOW) DISPLAY MODE. IT PREVENTS CLEARING OF THE
SCREEN AFTER PROMPTING FOR ANOTHER COMMAND, BUT ONLY UNTIL
THE NEXT PROMPTING // AFTER THAT. USEFUL IF YOU WANT A
RESULT TO REMAIN DISPLAYED A LITTLE LONGER. IF YOU WANT TO
PREVENT CLEARING OF THE SCREEN FOR MORE THAN A COUPLE OF
TIMES, USE (S NIL), THEN DO (S T) WHEN YOU WANT TO RESUME
DISPLAY MODE.
(RETCOND ...) TESTS FOR CONDITIONS JUST AFTER EACH FORM IS
EVALUATED, AND BREAKS WHEN SUCH CONDITION IS SATISFIED.
AT THE BREAK, THE VALUE TO BE RETURNED IS THE VALUE
OF %%VALUE, AND MAY BE CHANGED BY SETQING THIS VARIABLE.
THE FORM THAT YIELDED THIS VALUE IS THE VALUE OF %%FORM.
DO $P TO PROCEED FROM THE BREAKPOINT. THE CONDITIONS ARE
SPECIFIED AS FOR (COND ...) NOTE THAT (RETCOND T) WILL
GIVE YOU A BREAK AS EACH LEVEL IS POPPED (RETURNED FROM),
INCLUDING LEVELS ABOVE THE ONE WHERE THE REQUEST WAS
MADE. (RETCOND NIL) DISABLES THE RETCOND. IF YOU PREFER
WAITING RATHER THAN BREAKING SEE THE WTIF COMMAND.
ALSO, TWO ADDITIONAL FLAGS ARE AVAILBLE:
VALUEQ THE TEST (EQUAL %%VALUE <NEXT-ARGUMENT>) IS
PERFORMED AS IF IT WERE ANDED WITH THE REMAINING
PREDICATES IN THE CONDITION.
VALUE LIKE VALUEQ BUT THE TEST IS
(EQUAL %%VALUE (EVAL <NEXT-ARGUMENT>)) .
THE OVERALL CONDITION IS MAINTAINED ON THE ATOM %%RETCOND,
AND THE PREVIOUS NON-NIL CONDITION IS ON THE 'OLD PROPERTY
OF THIS ATOM. IF YOU WANT BOTH COND AND RETCOND CONDITIONS
TO BE THE SAME YOU CAN (SETQ %%RETCOND %%COND). THE VALUE
AND VALUEQ PREDICATES WILL BE IGNORED IN A (COND ...).
U (UP) GO UP TO NEXT HIGHER LEVEL. CURRENT AND LOWER LEVELS
ARE EXECUTED WITHOUT DISPLAY. THE LOWER LEVELS ARE NOT
INSPECTED -- THUS IF A CONDITION IS TO BE TESTED FOR AT
THESE LEVELS, USE UU. CAN BE USED TO SKIP THE DISPLAY
OF A FUNCTION'S INTERNAL EVALUATION AFTER HAVING
SEEN THE ARGUMENTS, AS DESCRIBED IN THE PREVIOUS SECTION.
(U <NUM>) IF <NUM> IS POSITIVE (INCL. 0), FORMS ARE NOT
INSPECTED NOR DISPLAYED UNTIL THAT LEVEL NUMBER IS REACHED.
IF NEGATIVE, GOES UP THIS NUMBER (ABSOLUTE VALUE) OF LEVELS
RELATIVE TO THE CURRENT LEVEL. THUS (U -1) IS EQUIVALENT
TO U .
UU LIKE U, BUT ALSO INSPECTS LOWER LEVELS. USE IF YOU
HAVE A CONDITION TO BE TESTED.
(UU <NUM>) LIKE (U <NUM>) BUT SLOWER. USE IF TESTING FOR A
CONDITION. NOTE THAT (UU -999) EFFECTIVELY MEANS THAT
YOU WON'T SEE ANY LEVELS UNLESS THE CONDITION IN A COND
OR RETCOND IS SATISFIED.
WTAL (WAIT-ALL) FLIPS A TOGGLE WHICH WHEN ON CAUSES A PAUSE
AFTER THE EVALUATION OF EVERY FORM, BUT BEFORE THAT VALUE
IS RETURNED. THE SYSTEM WAITS FOR AN INPUT CHARACTER.
TYPING Y(ES), B(REAK), OR H (FOR CONTROL-H) FOLLOWED BY
SPACE WILL CAUSE A BREAK AS WOULD THE B COMMAND. TYPING
JUST A SPACE, OR ANY OTHER CHARACTER FOLLOWED BY A SPACE,
WILL PROCEED FROM THE PAUSE. DEFAULT IS OFF.
WTIF (WAIT-IF) FLIPS A TOGGLE WHICH WHEN ON CAUSES REQUESTS BY
THE B AND (RETCOND ...) COMMANDS TO RESULT IN A PAUSE
RATHER THAN A BREAK. THE PAUSE IS LIKE THAT OF THE WTAL
COMMAND, AND MAY BE PROCEEDED BY A SPACE; OR A BREAK
INITIATED BY TYPING Y, B, OR H FOLLOWED BY A SPACE.
DEFAULT IS OFF.
XX DOES A CONTROL-X TYPE OF LISP QUIT.
(A CONTROL-X TYPED AFTER THE // PROMPTER WILL BE CAUGHT
BY AN ERRSET. THE XX COMMAND IS EXECUTED OUTSIDE OF THAT
ERRSET.)
OTHER FACILITIES:
(GETHKLEVEL <NO.>) THIS FUNCTION RETURNS THE S-EXPRESSION
THAT IS ON THE EXECUTION STACK OF THE STEPPER AT THE GIVEN
LEVEL NUMBER (SEE HKSHOW). CAN BE USED TO GET AN
UNSPRINTED UNABBREVIATED DISPLAY OF THE FORM OR TO RECORD
OR PROCESS THE FORM AS YOU DESIRE, INCLUDING REAPPLICATION
OF MEV TO IT IN THE CURRENT CONTEXT.
(HKSHOW <NO.>) THIS FUNCTION WILL DISPLAY PREVIOUS FORMS WHICH
ARE ON THE EXECUTION STACK, AS SEEN BY THE STEPPER WHILE
IT HAS BEEN ACTIVATED. THE PREVIOUS <NO.> OF LEVELS ARE
SHOWN, WITH THE CURRENT FORM LAST. IF NO ARGUMENT IS
GIVEN, THEN ALL LEVELS ARE SHOWN. THE DISPLAY IS DONE UNDER
THE CONTROL OF PRINLEVEL AND PRINLENGTH WHICH ARE SETTABLE
BY THE (P - -) COMMAND. OF COURSE THIS FUNCTION CAN ALSO
BE USED AS IF IT WERE A COMMAND BY TYPING IT AFTER THE
PROMPTING // .
(HKSPRINT <NO.>) THIS FUNCTION WILL SPRINT THE FORM ON THE
LEVEL WHOSE NUMBER IS GIVEN AS THE ARGUMENT. CAN ALSO
BE USED AS A COMMAND.
(HKSTART) USE THIS FUNCTION TO INVOKE OR REINVOKE THE STEPPER
FROM A BREAKPOINT OR FROM A PROGRAM AS DESCRIBED ABOVE.
IF USED WITHIN A BREAK, TYPE (HKSTART) BY ITSELF
RATHER THAN WITHIN ANOTHER S-EXPRESSION OR FUNCTION,
AS IT HAS TO CLIMB THE STACK FROM THE POINT OF INVOCATION.
IF AN ARGUMENT IS GIVEN TO THIS FEXPR, IT WILL BE EVAL'D
JUST PRIOR TO ESTABLISHING STEPPING, WITH ^W BOUND TO NIL,
-- EG. YOU CAN PRINT OUT INFOR. IF CALLED FROM A PROGRAM.
(IT IS POSSIBLE FOR THE INVOCATION OF THE
STEPPER BY THIS METHOD TO HAVE LIMITED SCOPE UNDER
SOME CIRCUMSTANCES. SUCH A BOUNDARY WOULD BE
A SECOND BREAKPOINT HIGHER ON THE STACK OR A PREVIOUSLY
TERMINATED INVOCATION OF THE STEPPER THAT IS STILL ON THE
STACK. ALSO IF THE PROGRAM WAS INITIALLY STARTED WITHOUT
MEV, AND STEPPING IS RETAINED THOUGHOUT THE REST OF THE
EXECUTION, STEPPING MAY ALSO REMAIN FOR FORMS TYPED AT TOP
LEVEL -- TO STOP THIS JUST DO CONTROL-G (OR USE THE Q
COMMAND) .)
(HKSTOP) THIS FUNCTION TURNS OFF THE STEPPER WHENEVER EXECUTED
-- IN THE SAME MANNER AS THE Q COMMAND WOULD.
HOOKLIST IS AN ATOM WHOSE VALUE IS INSPECTED BEFORE
EACH ATTEMPT TO READ A COMMAND FROM THE CONSOLE.
IF HOOKLIST IS NON-NIL, IT IS ASSUMMED TO BE A
LIST OF COMMANDS TO THE STEPPER -- EACH IS PRINTED OUT WHEN
USED AND TREATED AS IF IT CAME FROM YOUR TYPEIN. HOOKLIST
IS ALSO EXAMINED AT EACH LEVEL THAT IS INSPECTED BY THE
STEPPER EVEN IF NO COMMAND READING IS DONE (EG. NN OR UU
MODES).
(MBAK) THIS FUNCTION GIVES (BAKLIST) BUT WITHOUT THE STEPPER
FUNCTIONS, AS DESCRIBED ABOVE.
(MEV <TOP-FORM>) THIS FUNCTION INITIATES STEPPING AND OTHERWISE
ACTS LIKE EVAL OF ONE ARGUMENT, AS DESCRIBED ABOVE.
(MSPRINT <FORM>) GIVES "ABBREVIATED" SPRINTING OF THE <FORM>.
A SECOND AND THIRD NUMERIC ARGUMENT SPECIFY THE EFFECTIVE
PRINLEVEL AND PRINLENGTH HERE, ELSE A LIST OF TWO NUMBERS
FOUND AS THE VALUE OF MSPRINT ARE USED. THE CURRENT
IMPLEMENTATION IS SOMEWHAT SLOW AS THE REGULAR SPRINT DOES
NOT RESPOND TO STANDARD ABBREVIATING.
(SVIEWMSG <LINENO.> <TOEVAL>) USEFUL IN CONJUNCTION WITH S(HOW)
MODE. PUTS THE CURSOR AT THE <LINENO.> AND EVAL'S THE
SECOND ARGUMENT, THEN RETURNS THE CURSOR TO ITS ORIGINAL
POSITION BEFORE THE CALL. <LINENO.> = 0 MEANS TOP; IF
NEGATIVE COUNTS FROM BOTTOM, WITH -1 THE BOTTOM LINE.
TYPICALLY HAVE %%MDISTITLE (SEE (S -) COMMAND) BE A NUMBER
TO SKIP LINES ON TOP, AND USE SVIEWMSG TO DISPLAY
YOUR DEBUG INFOR. UP THERE.
IF YOU REALLY WANT SPECIALIZED PROCESSING IN PARTICULAR
SITUATIONS, YOU CAN INSPECT AND/OR CHANGE %%FORM IN A (COND ...)
PREDICATE, AND %%VALUE IN A (RETCOND ...). IF %%NOHOOKFLAG
IS T, FORM AND VALUE PRINTOUT AND COMMAND READING (EXCEPT FROM
A NON-NIL HOOKLIST) IS INHIBITED UNTIL IT IS RESET TO NIL.
NORMAL COMMAND PROCESSING IS INVOKED BY (%%MHOOKCOM) WITH
%%NOHOOKFLAG BOUND TO NIL. ALSO DESCRIBED ABOVE ARE
%%BREAKLIST, %%COND, %%RETCOND, AND %%HOOKPRIN.
DECEMBER 2, 1974 UPDATED MARCH 1976.
(c) Copyright 1974, 1975, and 1976 by Matthew Morgenstern,
Massachusetts Institute of Technology.

68
doc/_info_/lisp.string Executable file
View File

@@ -0,0 +1,68 @@
;;; STRING -*-MODE:LISP;PACKAGE:SI-*- -*-LISP-*-
;;; **************************************************************
;;; *** NIL ***** Functions for CHARACTERs and STRINGs ***********
;;; **************************************************************
;;; ** (C) COPYRIGHT 1980 MASSACHUSETTS INSTITUTE OF TECHNOLOGY **
;;; ****** THIS IS A READ-ONLY FILE! (ALL WRITES RESERVED) *******
;;; **************************************************************
;;; Provides support for NIL string operations under maclisp, with
;;; some functions added for compatibility with LISPM and maclisp.
;;; To read this file in on LISPM, do (PACKAGE-DECLARE * SYSTEM 100)
;;; CHARACTER support:
;;; CHARACTERP,
;;; m *:CHARACTER-TO-FIXNUM, *:FIXNUM-TO-CHARACTER
;;; TO-CHARACTER, TO-CHARACTER-N, DIGITP, DIGITP-N
;;; + CHARACTER, CHAR-EQUAL, CHAR-LESSP,
;;; & |+internal-tilde-macro/|| (can be set onto ~ as readmacro)
;;; STRING support:
;;; STRINGP
;;; m CHAR, RPLACHAR
;;; m STRING-LENGTH, SET-STRING-LENGTH, STRING-SEARCHQ, STRING-BSEARCHQ
;;; TO-STRING, MAKE-STRING, STRING-SUBSEQ, STRING-MISMATCHQ
;;; * CHAR-N, RPLACHAR-N, STRING-FILL, STRING-FILL-N, STRING-REPLACE
;;; * STRING-POSQ, STRING-BPOSQ, STRING-POSQ-N, STRING-BPOSQ-N
;;; * STRING-SKIPQ, STRING-BSKIPQ, STRING-SKIPQ-N, STRING-BSKIPQ-N
;;; +m STRING-EQUAL, STRING-LESSP, STRING-SEARCH, STRING-REVERSE-SEARCH
;;; +m STRING-DOWNCASE, STRING-UPCASE
;;; + GET-PNAME, SUBSTRING, STRING-APPEND, STRING-REVERSE, STRING-NREVERSE
;;; + STRING-TRIM, STRING-LEFT-TRIM, STRING-RIGHT-TRIM
;;; +* CHAR-DOWNCASE, CHAR-UPCASE,
;;; +* STRING-SEARCH-CHAR, STRING-SEARCH-NOT-CHAR,
;;; +* STRING-SEARCH-SET, STRING-SEARCH-NOT-SET
;;; +* STRING-REVERSE-SEARCH-CHAR, STRING-REVERSE-SEARCH-NOT-CHAR,
;;; +* STRING-REVERSE-SEARCH-SET, STRING-REVERSE-SEARCH-NOT-SET
;;; * STRING-EXPLODEN, STRING-PNGET, STRING-PNPUT
;;; & STR/:PURCOPY, STR/:PRINTER, |+internal-doublequote-macro/||
;;; &* STR/:CLEAR-WORDS, STR/:GRAB-PURSEG
;;; (a "m" is for lines whose routines are implemented as both macros and
;;; subrs - macro definition is active only in the compiler)
;;; (a + is for lines whose routines are directly LISPM compatible -
;;; many other such routines can be written using the NIL primitives)
;;; (an * is for lines whose routines have been written in MIDAS -
;;; primarily for speed - and are in the file STRAUX >)
;;; (a & is for lines whose routines are PDP10-specific, and are
;;; primarily for internal support)
;;; (the functions named "...-N" use ascii numerical values for their
;;; arguments which are interpreted as "CHARACTER"s, instead of the
;;; new datatype "CHARACTER" - thus while STRING-POSQ scans for a
;;; particular character in a string, STRING-POSQ-N wants its character
;;; as a fixnum.)
; ---------
;A "STRING" is a 4-hunk, with | 1 | 0 |
; indices as indicated in the ---------
; diagram. | 3 | 2 |
; ---------
; (cxr 0 s) ;ptr to class object for STRINGs
; (cxr 1 s) ;"**SELF-EVAL**"
; (cxr 2 s) ;word-index in STR:ARRAY of first word
; (cxr 3 s) ;length of string, in characters

45
doc/_info_/lisp.trace Executable file
View File

@@ -0,0 +1,45 @@
1/18/75 GROSS
TRACE 46 is the new version of trace.
To use the old version, (FASLOAD OTRACE FASL DSK COMLAP).
Features:
[1] Unlike previous versions of Trace, this one is
fully compiled. Thus it will load noticeably faster,
and the faster execution of the function TRACE may
be noticeable when the system is heavily loaded
(which is often, nowadays).
[2] The stuff printed by Trace is indented according to
the actual depth of function nesting (not to be
confused with the number that Trace prints in the
(ENTER FOO <number> ...) message, which is the
recursion level for that____ function only).
The variable TRACE-INDENT-INCR (initially = 2)
controls the number of spaces indented for each
level deep.
TRACE-INDENT-MAX (initially = 16) limits the
total indentation to that many spaces.
To disable the indenting feature, set either of
these variables to zero.
[3] The GRIND option as described in the Maclisp manual
exists here (there no longer being any STRACE).
The hack mentioned in the update to the manual about
setting the variable SPRINTER to T is now inoperative.
So (TRACE (FOO GRIND)) will cause the trace messages
to be pretty-printed (Note, however, that they will
not___ be indented as in [2]).
[4] Several minor bugs dealing with some of the more
obscure options have been fixed.
For example, the sequence:
(TRACE FOO)
(TRACE (BAR WHEREIN FOO))
now works properly.
Also, ARGPDL now works with LSUBRs (as if anyone cares).
Please send comments regarding any remaining bugs
to GROSS at MIT-AI.

98
doc/_info_/lisp.whovar Executable file
View File

@@ -0,0 +1,98 @@
Some stuff from LISP NEWS about who-line variables.
[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.
[E] (SSTATUS WHO1 A B C D) SETS THE .WHO1 USER VARIABLE TO
<.BYTE 8 ? A ? B ? C ? D>
IN MIDAS TERMINOLOGY. A AND C MUST BE FIXNUMS; B AND D
MUST BE FIXNUMS WITH ASCII VALUES, OR CHARACTER OBJECTS.
(SSTATUS WHO2 X) AND (SSTATUS WHO3 X) SET THE .WHO2 AND
.WHO3 USER VARIABLES. X MAY BE A FIXNUM OR A SYMBOL;
IN THE LATTER CASE THE FIRST SIX CHARACTERS ARE USED TO
FORM A SIXBIT WORD.
THE .WHON USER VARIABLES CAUSE INFORMATION TO BE DISPLAYED
IN THE TERMINAL'S WHO-LINE.
THE MEANING OF A, B, C, AND D IS AS FOLLOWS:
VAR BITS MEANING
A 200 IF 1, SUPPRESS ENTIRE WHO-LINE
100 SUPPRESS SPACE BETWEEN HALVES OF .WHO2
70 MODE FOR PRINTING LEFT HALF OF .WHO2
0 DO NOT PRINT
1 DATE IN PACKED FORM:
774000 YEAR MOD 100.
3600 MONTH (1=JANUARY)
174 DAY OF MONTH
2 TIME IN FORTIETHS OF A SECOND,
PRINTED AS HH:MM:SS.T
3 TIME IN HALF-SECONDS,
PRINTED AS HH:MM:SS
4 OCTAL HALFWORD
5 DECIMAL HALFWORD (NO . SUPPLIED)
6 THREE SIXBIT CHARACTERS
7 UNUSED
7 MODE FOR RIGHT HALF OF .WHO2
B 177 IF NON-ZERO, PRINT BETWEEN HALVES OF
.WHO2 AS AN ASCII CHARACTER
200 IF 1, PRINT CHAR TWICE
C 200 IF 1, SUPPRESS SPACE BETWEEN .WHO2
PRINTOUT AND .WHO3 PRINTOUT
OTHERWISE LIKE A, BUT FOR .WHO3.
D LIKE B, BUT FOR .WHO3.
THAT IS, IF THE WHO-LINE IS PRINTED AT ALL, WHAT APPEARS
AT THE END IS THE CHARACTERS:
IIIIXX-JJJJ=KKKKYY+LLLL
WHERE:
IIII IS THE RESULT OF PRINTING THE LEFT HALF
OF .WHO2 AS SPECIFIED BY A'S 70 BITS.
JJJJ RIGHT HALF OF .WHO2, BY A'S 7 BITS.
KKKK LEFT HALF OF .WHO3, BY C'S 70 BITS.
LLLL RIGHT HALF OF .WHO3, BY C'S 7 BITS.
XX ZERO TO TWO CHARACTERS, SPECIFIED BY B.
YY ZERO TO TWO CHARACTERS, SPECIFIED BY D.
- SPACE, UNLESS A'S 100 BIT IS 1.
= SPACE, UNLESS C'S 200 BIT IS 1.
+ SPACE, UNLESS C'S 100 BIT IS 1.
EXAMPLE:
(SSTATUS WHO1 166 0 144 '/!)
(SSTATUS WHO2 'FOOBAR)
(SSTATUS WHO3 (+ (LSH 1234 22) 3456))
CAUSES "FOOBAR 1234!5678" TO APPEAR IN THE WHO-LINE.
THE STATUS FORMS ARE AS FOLLOWS:
(STATUS WHO1) RETURNS A LIST OF FOUR FIXNUMS.
(STATUS WHO2) AND (STATUS WHO3) RETURN FIXNUMS.

564
doc/_info_/newio.stuff Executable file
View File

@@ -0,0 +1,564 @@
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.

462
doc/_info_/qioord.2122 Executable file
View File

@@ -0,0 +1,462 @@
ITS MacLISP 2122 Functions and Other Features
This file was created by JONL on Wednesday, March 10, 1982 at 2:38 PM
User SUBRs:
*-READ-EVAL-PRINT CONS NOINTERRUPT
*BREAK COPYSYMBOL NORET
*DEPOSIT-BYTE COS NOT
*DIF CXR NOUUO
*DPB DEFAULTF NRECONC
*LDB DELETEF NREVERSE
*LOAD-BYTE DEPOSIT NTH
*NOPOINT DEPOSIT-BYTE NTHCDR
*QUO DISPLACE NULL
*READ DPB NUMBERP
*READCH EQ ODDP
*RSET EQUAL OUT
*THROW ERRFRAME PAIRP
*TYI EVALFRAME PLIST
+TYI EXAMINE PLUSP
+TYO EXP PNGET
1+ EXPLODE PNPUT
1+$ EXPLODEC PROBEF
1- EXPLODEN PUREP
1-$ EXPT PUTPROP
< FASLP QMARK
= FBOUNDP READ-*-EVAL-PRINT
> FILEP READ-EVAL-*-PRINT
ABS FILLARRAY READ-EVAL-PRINT-*
ADD1 FIX READLIST
ALARMCLOCK FIXNUM-IDENTITY RECLAIM
ALLOC FIXP REMAINDER
ALPHALESSP FLATC REMOB
ARG FLATSIZE REMPROP
ARRAY-#-DIMS FLOAT RENAMEF
ARRAY-DIMENSION-N FLOATP RETURN
ARRAY-TYPE FLONUM-IDENTITY REVERSE
ARRAYDIMS FORCE-OUTPUT ROT
ASCII FRETRY RPLACA
ASH FRETURN RPLACD
ASSOC FSC RPLACX
ASSQ GC RUNTIME
ATAN GCD SAMEPNAMEP
ATOM GET SASSOC
BIGP GETCHAR SASSQ
BOUNDP GETCHARN SET
CAAAAR GETL SETARG
CAAADR HAIPART SETPLIST
CAAAR HAULONG SETSYNTAX
CAADAR HUNKP SFA-CALL
CAADDR HUNKSIZE SFA-CREATE
CAADR IFIX SFA-GET
CAAR IMPLODE SFA-STORE
CADAAR IN SFAP
CADADR INCLUDEF SHORTNAMESTRING
CADAR INPUSH SIN
CADDAR INTERN SLEEP
CADDDR LAST SQRT
CADDR LDB SUB1
CADR LENGTH SUBLIS
CAR LENGTHF SUBR
CDAAAR LISTIFY SUBST
CDAADR LOAD SXHASH
CDAAR LOAD-BYTE SYMBOLP
CDADAR LOG SYMEVAL
CDADDR LSH SYSP
CDADR MAKE-LIST TIME
CDAR MAKHUNK TRUENAME
CDDAAR MAKNAM TYPEP
CDDADR MAKNUM UNTYI
CDDAR MAKUNBOUND VALUE-CELL-LOCATION
CDDDAR MEMBER WRITEABLEP
CDDDDR MEMQ XCONS
CDDDR MERGEF ZEROP
CDDR MINUS \
CDR MINUSP \\
CLEAR-INPUT MUNKAM ^
CLEAR-OUTPUT NAMELIST ^$
CLOSE NAMESTRING ^G
CNAMEF NCONS
User FSUBRs:
*CATCH DECLARE LSUBRCALL SUBRCALL
*FUNCTION DEFPROP OR UAPPEND
AND DEFUN POP UCLOSE
ARRAY DO PROG UFILE
ARRAYCALL ERR PROGV UKILL
BREAK ERRSET PUSH UNWIND-PROTECT
CASEQ EVAL-WHEN QUOTE UPROBE
CATCH-BARRIER FASLOAD SETQ UREAD
CATCHALL FUNCTION SIGNP UWRITE
COMMENT GCTWA SSTATUS
COND GO STATUS
CRUNIT INCLUDE STORE
User LSUBRs:
* DELQ LIST* PRINT-OBJECT
*$ DIFFERENCE LISTARRAY PROG1
*ARRAY ENDPAGEFN LISTEN PROG2
*REARRAY EOFFN MAP PROGN
+ ERROR MAPATOMS QUIT
+$ ERRPRINT MAPC QUOTIENT
- EVAL MAPCAN RANDOM
-$ EVALHOOK MAPCAR READ
/ FILEPOS MAPCON READCH
/$ FLATSIZE-OBJECT MAPLIST READLINE
APPEND FUNCALL MAX RUBOUT
APPLY GENSYM MIN SUSPEND
ARGS GETSP NCONC SYSCALL
BAKLIST GREATERP OPEN TERPRI
BAKTRACE HUNK PAGEL TIMES
BOOLE LESSP PAGENUM TYI
CHARPOS LEXPR-FUNCALL PLUS TYIPEEK
CURSORPOS LINEL PRIN1 TYO
DELASSQ LINENUM PRINC VALRET
DELETE LIST PRINT
STATUS options (* = can use with SSTATUS too):
* + * GCMAX * PDLMAX * TTYCONS
* ABBREVIATE * GCMIN PDLNAMES TTYIF ?
ARRAY * GCSIZE PDLROOOM * TTYINT
BPSH * GCTIME PDLSIZE TTYOF ?
BPSL * GCWHO * PUNT * TTYREAD
* BREAK HACTRN PURSIZE * TTYSCAN
* CALLI ? HOMEDIR PURSPACENAMES TTYSIZE
* CHTRAN HSNAM * RANDOM TTYTYPE
* CLI ITS SEGLOG UDIR
* CRFIL JCL * SENDI ? UNAME
* CRUNIT JNAME SITE * UREAD
DATE JNUMBER SPCNAMES USERI
DAYTIME * LINMODE SPCSIZE * USRHU ?
* DIVOV LISPVERSION SPDL * UUOLINKS
DOW * LOSEF SSTATUS * UWRITE
* EVALHOOK * MACRO STATUS * VECTO ?
FASLN ? * MAR SUBSYS * WHO1
FASLOAD MEMFREE * SXHAS ? * WHO2
* FEATURE NEWLINE * SYNTAX * WHO3
FILEMODE * NOFEATURE SYSTEM XUNAM
FILES ? * NOINT ? TABSIZE * _
FLPDL OPSYS ? * TERPRI
* FLUSH OSPEED * TOPLEVEL
FXPDL PDL * TTY
Initial arrays:
OBARRAY READTABLE STR:ARRAY
Initial User AUTOLOAD properties:
NAME OF ATOM INITIAL VALUE
**CLASS-SELF-EVAL** ((LISP) EXTEND FASL)
**SELF-EVAL** ((LISP) EXTSTR FASL)
*:FIXNUM-TO-CHARACTER ((LISP) STRING FASL)
<= ((LISP) MLSUB FASL)
>= ((LISP) MLSUB FASL)
ADD-METHOD ((LISP) EXTEND FASL)
ALLFILES ((LISP) ALLFILES FASL)
BLTARRAY ((LISP) BLTARRAY FASL)
CATCH ((LISP) MLMAC FASL)
CERROR ((LISP) CERROR FASL)
CGOL ((LISP) CGOL FASL)
CGOLREAD ((LISP) CGOL FASL)
CHECK-SUBSEQUENCE ((LISP) ERRCK FASL)
CHECK-TYPE ((LISP) ERRCK FASL)
CLASS-OF ((LISP) EXTEND FASL)
CLASSP ((LISP) EXTEND FASL)
CREATE-JOB ((LISP) HUMBLE FASL)
DEFBOTHMACRO ((LISP) MACAID FASL)
DEFCLASS* ((LISP) EXTMAC FASL)
DEFCOMPLRMAC ((LISP) MACAID FASL)
DEFCONST ((LISP) MLMAC FASL)
DEFINE-LOOP-PATH ((LISP) LOOP FASL)
DEFMACRO ((LISP) DEFMACRO FASL)
DEFMACRO-DISPLACE ((LISP) DEFMACRO FASL)
DEFMETHOD* ((LISP) EXTMAC FASL)
DEFSHARP ((LISP) SHARPM FASL)
DEFSIMPLEMAC ((LISP) MACAID FASL)
DEFUN& ((LISP) DEFMACRO FASL)
DEFVAR ((LISP) MLMAC FASL)
DEFVST ((LISP) DEFVST FASL)
DESCRIBE ((LISP) DESCRIBE FASL)
DESETQ ((LISP) LET FASL)
DESETQ-EXPANDER-1 ((LISP) LET FASL)
DIRECTORY ((LISP) ALLFILES FASL)
DUMPARRAYS ((LISP) DUMPARRAYS FASL)
EDIT ((LISP) EDIT FASL)
ERROR-RESTART ((LISP) CERROR FASL)
EVENP ((LISP) MLSUB FASL)
EXTENDP ((LISP) EXTEND FASL)
FERROR ((LISP) CERROR FASL)
FIND-METHOD ((LISP) EXTEND FASL)
FIXNUMP ((LISP) MLSUB FASL)
FLATTEN-SYMS ((LISP) MACAID FASL)
FLONUMP ((LISP) MLSUB FASL)
FLUSH-MACROMEMOS ((LISP) DEFMAX FASL)
FORMAT ((LISP) FORMAT FASL)
GETMIDASOP ((LISP) GETMIDASOP FASL)
GRIND ((LISP) GRIND FASL)
GRIND0 ((LISP) GRIND FASL)
GRINDEF ((LISP) GRINDEF FASL)
HERALD ((LISP) MLMAC FASL)
IF ((LISP) MLMAC FASL)
INF-EDIT ((LISP) LISPT FASL)
LAP ((LISP) LAP FASL)
LAP-A-LIST ((LISP) LAP FASL)
LEDIT ((LISP) LEDIT FASL)
LET ((LISP) LET FASL)
LET* ((LISP) LET FASL)
LET*-EXPANDER-1 ((LISP) LET FASL)
LET-EXPANDER-1 ((LISP) LET FASL)
LISPT ((LISP) LISPT FASL)
LISTP ((LISP) MLSUB FASL)
LOADARRAYS ((LISP) DUMPARRAYS FASL)
LOGAND ((LISP) MLSUB FASL)
LOGIOR ((LISP) MLSUB FASL)
LOGNOT ((LISP) MLSUB FASL)
LOGXOR ((LISP) MLSUB FASL)
LOOP ((LISP) LOOP FASL)
MACRO ((LISP) DEFMACRO FASL)
MACROEXPAND ((LISP) DEFMAX FASL)
MACROEXPAND-1 ((LISP) DEFMAX FASL)
MACROEXPAND-1* ((LISP) DEFMAX FASL)
MACROEXPAND-1*M ((LISP) DEFMAX FASL)
MACROEXPANDED ((LISP) DEFMAX FASL)
MACROFETCH ((LISP) DEFMAX FASL)
MACROMEMO ((LISP) DEFMAX FASL)
MAKE-STRING ((LISP) STRING FASL)
MAPALLFILES ((LISP) ALLFILES FASL)
MAPDIRECTORY ((LISP) ALLFILES FASL)
MULTIPLE-VALUE ((LISP) MLMAC FASL)
MULTIPLE-VALUE-BIND ((LISP) MLMAC FASL)
MULTIPLE-VALUE-LIST ((LISP) MLMAC FASL)
PSETQ ((LISP) MLMAC FASL)
PTR-TYPEP ((LISP) EXTEND FASL)
READMACROINVERSE ((LISP) GRINDEF FASL)
REPLACE ((LISP) SUBSEQ FASL)
SELECTQ ((LISP) MLMAC FASL)
SEND ((LISP) EXTEND FASL)
SETF ((LISP) SETF FASL)
SETQ-IF-UNBOUND ((LISP) MLMAC FASL)
SETSYNTAX-SHARP-MACRO ((LISP) SHARPM FASL)
SETVST ((LISP) DEFVSX FASL)
SFA-UNCLAIMED-MESSAGE ((LISP) EXTSFA FASL)
SI:CHECK-MULTIPLICITIES ((LISP) MLSUB FASL)
SI:CHECK-SUBSEQUENCER ((LISP) ERRCK FASL)
SI:CHECK-TYPER ((LISP) ERRCK FASL)
SI:DEFCLASS*-1 ((LISP) EXTEND FASL)
SI:DEFCLASS*-2 ((LISP) EXTSTR FASL)
SI:EXTEND ((LISP) EXTBAS FASL)
SI:EXTEND-LENGTH ((LISP) EXTBAS FASL)
SI:EXTENDP ((LISP) EXTEND FASL)
SI:MAKE-EXTEND ((LISP) EXTBAS FASL)
SI:XREF ((LISP) EXTBAS FASL)
SI:XSET ((LISP) EXTBAS FASL)
SORT ((LISP) SORT FASL)
SORTCAR ((LISP) SORT FASL)
SPRIN1 ((LISP) GRINDEF FASL)
SPRINTER ((LISP) GRINDEF FASL)
STRING-PNPUT ((LISP) STRING FASL)
STRUCT-TYPEP ((LISP) DEFVSY FASL)
SUBSEQ ((LISP) SUBSEQ FASL)
SYMBOLCONC ((LISP) MACAID FASL)
THROW ((LISP) MLMAC FASL)
TO-BITS ((LISP) SUBSEQ FASL)
TO-LIST ((LISP) SUBSEQ FASL)
TO-STRING ((LISP) SUBSEQ FASL)
TO-VECTOR ((LISP) SUBSEQ FASL)
TRACE ((LISP) TRACE FASL)
VALUES ((LISP) MLMAC FASL)
VALUES-LIST ((LISP) MLSUB FASL)
WHICH-OPERATIONS ((LISP) DESCRIBE FASL)
WITH-INTERRUPTS ((LISP) MLMAC FASL)
WITHOUT-INTERRUPTS ((LISP) MLMAC FASL)
WITHOUT-TTY-INTERRUPTS ((LISP) MLMAC FASL)
Y-OR-N-P ((LISP) YESNOP FASL)
YES-OR-NO-P ((LISP) YESNOP FASL)
LAP and FASLOAD functions:
*APPEND *NCONC *TYO PURCOPY
*APPLY *PLUS FASLAPSETUP| PURIFY
*DELETE *PRIN1 GCPROTECT PUTDDTSYM
*DELQ *PRINC GETDDTSYM TTSR|
*EVAL *PRINT LAPSETUP|
*GREAT *TERPRI LH|
*LESS *TIMES PAGEBPORG
Internal system functions:
+INTERNAL-"-MACRO +INTERNAL-SET-STRING-WORD-N
+INTERNAL-'-MACRO +INTERNAL-STRING-WORD-N
+INTERNAL-*RSET-BREAK +INTERNAL-TTY-ENDPAGEFN
+INTERNAL-;-MACRO +INTERNAL-TTYSCAN-SUBR
+INTERNAL-AUTOLOAD +INTERNAL-UBV-BREAK
+INTERNAL-CARCDRP +INTERNAL-UDF-BREAK
+INTERNAL-CHAR-N +INTERNAL-UGT-BREAK
+INTERNAL-FAC-BREAK +INTERNAL-UREAD-EOFFN
+INTERNAL-GCL-BREAK +INTERNAL-WNA-BREAK
+INTERNAL-GCO-BREAK +INTERNAL-WTA-BREAK
+INTERNAL-INCLUDE-EOFFN +INTERNAL-^B-BREAK
+INTERNAL-IOL-BREAK +INTERNAL-^Q-MACRO
+INTERNAL-PDL-BREAK +INTERNAL-^S-MACRO
+INTERNAL-RPLACHAR-N +INTERNAL-|-MACRO
Internal system AUTOLOAD properties:
NAME OF ATOM INITIAL VALUE
|&r-l/|| ((LISP) DEFMACRO FASL)
+INTERNAL-/#-MACRO ((LISP) SHARPM FASL)
|+INTERNAL-,-macro/|| ((LISP) BACKQ FASL)
+INTERNAL-DUP-P ((LISP) MACAID FASL)
+INTERNAL-LOSSAGE ((LISP) CERROR FASL)
+INTERNAL-POP-X ((LISP) SETF FASL)
+INTERNAL-PUSH-X ((LISP) SETF FASL)
+INTERNAL-SETF-X ((LISP) SETF FASL)
+INTERNAL-TRY-AUTOLOADP ((LISP) DEFMAX FASL)
|+INTERNAL-`-macro/|| ((LISP) BACKQ FASL)
MULTIPLE-VALUE-LIST/| ((LISP) MLSUB FASL)
|`-expander/|| ((LISP) BACKQ FASL)
|carcdrp/|| ((LISP) MACAID FASL)
|constant-p/|| ((LISP) MACAID FASL)
|defmacro-1/|| ((LISP) DEFMACRO FASL)
|defvst-construction-1/|| ((LISP) DEFVSX FASL)
|defvst-construction/|| ((LISP) DEFVSX FASL)
|defvst-initialize/|| ((LISP) DEFVSY FASL)
|defvst-selection-1/|| ((LISP) DEFVSX FASL)
|defvst-typchk/|| ((LISP) DEFVSY FASL)
|defvst-xref/|| ((LISP) DEFVSX FASL)
|forget-macromemos/|| ((LISP) DEFMAX FASL)
|no-funp/|| ((LISP) MACAID FASL)
|side-effectsp/|| ((LISP) MACAID FASL)
System variables:
NAME OF ATOM INITIAL VALUE
P P
/#-MACRO-DATALIST NIL
|&r-l/|| UNBOUND
* *
*-READ-EVAL-PRINT NIL
*:TRUTH T
*NOPOINT NIL
*RSET T
*RSET-TRAP +INTERNAL-*RSET-BREAK
+ +
+INTERNAL-INTERRUPT-BOUND-VARIABLES NIL
- -
// NIL
ALARMCLOCK NIL
ARGS NIL
AUTOLOAD +INTERNAL-AUTOLOAD
BACKQUOTE-EXPAND-WHEN EVAL
BASE 10
CAR NIL
CDR NIL
CLI-MESSAGE NIL
COMPILER-STATE NIL
DEFAULTF ((DSK LOSER) @ @)
DEFMACRO-CHECK-ARGS T
DEFMACRO-DISPLACE-CALL T
DEFMACRO-FOR-COMPILING T
DEFUN NIL
DEFUN& NIL
ECHOFILES NIL
EDIT NIL
ERRLIST NIL
ERROR-BREAK-ENVIRONMENT (#OBARRAY-1200-70004 . #READTABLE-0-70006)
ERRSET NIL
EVAL NIL
EVALHOOK NIL
FAIL-ACT +INTERNAL-FAC-BREAK
FASLOAD (SUBR FSUBR LSUBR)
FILE-EXIT-FUNCTIONS NIL
FILE-EXIT-FUNCTIONS-DEFAULT NIL
GC-DAEMON NIL
GC-LOSSAGE +INTERNAL-GCL-BREAK
GC-OVERFLOW +INTERNAL-GCO-BREAK
GCTWA NIL
GRINDEF NIL
HUNKP T
IBASE 10
INFILE T
INSTACK NIL
IO-LOSSAGE +INTERNAL-IOL-BREAK
MACHINE-ERROR NIL
MACRO-EXPANSION-USE MACROEXPANDED
MACROEXPANDED NIL
MACROMEMO NIL
MAKHUNK T
MAR-BREAK NIL
MSGFILES (T)
NIL NIL
NORET NIL
NOUUO NIL
OBARRAY #OBARRAY-1200-70004
OUTFILES NIL
PDL-OVERFLOW +INTERNAL-PDL-BREAK
PRIN1 NIL
PRINLENGTH NIL
PRINLEVEL NIL
PURCOPY NIL
READ NIL
READ-*-EVAL-PRINT NIL
READ-EVAL-*-PRINT NIL
READ-EVAL-PRINT-* NIL
READTABLE #READTABLE-0-70006
SYMBOLS NIL
SYS-DEATH NIL
T T
TERPRI T
TTY 11
TTY-RETURN NIL
TTYSCAN-STRINGERS/| ((73 . 15) (174 . 174) (42 . 42))
TYI #FILE-IN-|TTY:* *|-70012
TYO #FILE-OUT-|TTY:* *|-70014
UNBND-VRBL +INTERNAL-UBV-BREAK
UNDF-FNCTN +INTERNAL-UDF-BREAK
UNSEEN-GO-TAG +INTERNAL-UGT-BREAK
UREAD NIL
UWRITE NIL
WRNG-NO-ARGS +INTERNAL-WNA-BREAK
WRNG-TYPE-ARG +INTERNAL-WTA-BREAK
ZFUZZ NIL
ZUNDERFLOW NIL
^A NIL
^D NIL
^Q NIL
^R NIL
^W NIL
|carcdrp/|| T
LAP and FASLOAD variables:
NAME OF ATOM INITIAL VALUE
*PURE NIL
BPEND 136223
BPORG 126164
GCPROTECT NIL
LAPSETUP/| NIL
PURCLOBRL NIL
PURE 1
PUTPROP (+INTERNAL-STRING-MARKER SUBR FSUBR LSUBR)
TTSR/| 12657

124
doc/_info_/stack.info Executable file
View File

@@ -0,0 +1,124 @@
;;; FRIDAY NOV 19,1976 10:51:28
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; STACK DEBUGGING TOOLS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; These routines are for crawling around in the LISP stack. For
;;;any meaningful stack information to be available *RSET must be set to
;;;T. Further, only minimal information will be present for compiled
;;;calls unless NOUUO is T. This package takes up 376. decimal words.
;;; The variable *FRAME*-*POINTER* (hereafter called the CURSOR) is
;;;always bound to a "stack frame 4-tuple". Each tuple is the value of
;;;an EVALFRAME function call. All the functions described below,
;;;unless otherwise noted, have as their value the current CURSOR.
;;; The CURSOR is either of the form:
;;; (EVAL <pdl-ptr> <form> <spec-pdl-ptr>) or
;;; (APPLY <pdl-ptr> (<operator> <arglist>) <spec-pdl-ptr>)
;;;The first atom is a keyword identifier indicating the format of the
;;;third entry. EVAL means that the form is an entity that is being
;;;EVAL'ed and the user could EVAL to see the effect. APPLY means that
;;;the third element is the list of the operator and its argument list.
;;;The argument list has been evaluated and is ready for the operator to
;;;be APPLY'ed to it. The user can do the latter by hand to see the
;;;effect.
;;; The <pdl-ptr> and <spec-pdl-ptr> print as FIXNUM's. They are
;;;pointers that are meaningful for EVALFRAME, FRETURN, EVAL, APPLY and
;;;a few other commands. The reader is refered to the MACLISP manual
;;;for a more detailed discussion.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; COMMANDS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;TOP (no args)
;;; Set the CURSOR to the "top" of the stack. The "top" is closest
;;;to the break. Like a plant the growing point of a stack is at its
;;;top.
;;;BOT (no args)
;;; Set the CURSOR to the "bottom" of the stack. The "bottom" is
;;;the frame of the last call from "command line".
;;;UP (fexpr)
;;; Move the CURSOR another frame towards the top. Falling off the
;;;top of the stack causes an error message to be printed. The CURSOR
;;;is not changed. (Thus the value of UP will be EQ to its previous
;;;value).
;;;DN (fexpr)
;;; Move the CURSOR another frame towards the bottom. Falling off
;;;the bottom of the stack causes an error message to be printed. The
;;;CURSOR is not changed. (Thus the value of DN will be EQ to its
;;;previous value).
;;;both UP and DN
;;;take the following arguments:
;;; <some number> do the operation that many times
;;; <some function> go to the frame where that function was invoked
;;; the letter F move the CURSOR until the first user function
;;; call is encountered
;;; the letter I move the CURSOR until the first non-compiled
;;; user function call is encountered
;;; the letter C move the CURSOR until the first compiled user
;;; function call is encountered
;;; the letter M move the CURSOR until the first user macro call
;;;FR (lexpr)
;;; Given no argument, its value is simply the CURSOR.
;;; Given an argument, it will reset the CURSOR to the argument.
;;;FM (no args)
;;; Return only the FORM of the stack frame. This is the third
;;;element of the CURSOR structure.
;;;RET (lexpr)
;;; no arg - reexecute the form at the cursor and unwind the stack
;;; Only this type execution of RET evaluates in the
;;; original (CURSOR) lambda variable binding environment
;;; one arg - return the arg in place of computing the value of the
;;; form at the CURSOR.
;;; two arg - as above, but use (arg 2) in place of the CURSOR.
;;;EV (lexpr)
;;; one arg - evaluate the arg in the binding environment of the
;;; CURSOR frame.
;;; two arg - as above, but use (arg 2) in place of the CURSOR.
;;;EVQ (fexpr)
;;; The evalquote version of the above function.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; HINTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; When the CURSOR 4-tuple is of the EVAL type (the first element
;;;of the tuple is EVAL), the form component is EQ to the piece of code
;;;that is in the actual function being executed. Thus RPLAC operators
;;;on this form wil make patches to the function.
;;; RET is most useful to return the correct value for some
;;;evaluation sequence that has gone amuck and proceed with the overall
;;;processing. It eliminates the necessity of starting again from the
;;;beginning because of some "simple" bug.
;;; To evaluate a number of variables and forms in some frame
;;;context it is often easier to do a (EVQ (BREAK FOO)) rather than
;;;repetitive EVQ's. The former expression places a BREAK "at an
;;;earlier place in the evaluation". Obviously this BREAK should be
;;;$P'ed, when it is no longer needed.

138
doc/_info_/step.info Executable file
View File

@@ -0,0 +1,138 @@
How to Use the STEP Facility
<comments and problems accepted> Charles Rich, TS-824
x3-6032
AI: RICH
Nov 03/76
The LISP "stepping" package is intended to give the LISP programmer
a facility analogous to the Instruction Step mode of running a
machine language program. The package contains two compiled functions
which are loaded by
(FASLOAD STEP FASL DSK LIBLSP)
The user interface is through the function (fexpr) STEP, which sets
switches to put the LISP interpreter in and out of "stepping" mode.
The basic commands are:
(STEP T) Turn on stepping mode.
(STEP NIL) Turn off stepping mode.
These commands are usually typed at top level, and will take effect
immediately (i.e. the next S-exp typed in will be evaluated in stepping
mode). Also <ctl G>, in addition to returning to top level, turns off
stepping mode.
In stepping mode, the LISP evaluator will print out each S-exp to
be evaluated before evaluation, and the returned value after evaluation,
calling itself recursively to display the stepped evaulation of each
argument, if the S-exp is a function call. In stepping mode, the
evaluator will wait after displaying each S-exp before evaluation
for a command character from the console:
<space> Continue stepping recursively.
<rubout> Show returned value from this level
only, and continue stepping upward.
<cr> or <tab> Turn off stepping mode. (but continue
evaluation without stepping).
P Redisplay current form in full
(i.e. rebind prinlevel and prinlength to nil)
B Get breakpoint; proceed with alt-P
M See advanced features under
"stepping macro expansions"
**************** More Advanced Features *************************
Selectively turning on STEP:
(STEP FOO1 FOO2 ...)
If this command is typed at top level, stepping will not commence
immediately, but rather when the evaluator first encounters a S-expr
whose CAR is one of FOO1, FOO2, etc. This form will then display
at the console, and the evaluator will be in stepping mode waiting
for a command character.
Stepping Macro Expansions:
If the stepper is proceeded with a <sp>, it will not step the execution
of macro expansions, but will rather just show the result of the macro
of expansion and wait for another command.
To see the execution of the macro expansion itself, proceed the stepper
with an M instead of a <sp>.
Using STEP with breakpoints:
The above description applies to turning stepping on and off globally
at top level. More detail is necessary to use STEP flexibly in and
out of breakpoints (e.g. together with TRACE).
If stepping is turned on by (STEP T) at top level, the evaluator will
NOT be in stepping mode within a breakpoint loop. If you wish to use
stepped evaluation within a break loop you must turn it on locally
by (STEP T). Conversely, if stepping was not turned on at top level
and it is turned on by (STEP T) in a break loop, it will NOT be on
when return is made from the break loop by <alt>P.
However, executing (STEP NIL) inside a break loop will turn off
stepping globally, i.e. within the break loop, and after return has
be made by <alt>P.
The most useful feature is the following, however:
(STEP) Command at top level has no immediate effect.
After (STEP) has been executed at top level, a subsequent (STEP T) inside
of a break loop will have the effect of turning on stepping mode both
inside the break loop and globally, i.e. the evaluator will start to
step as soon as the return is made from the break loop by <alt>P. Thus,
for instance, one could set TRACE to break at some special place, and then
use the break to turn on stepping.
Interaction with PRIN1, PRINLEVEL and PRINLENGTH:
If the user has provided an alternate top-level printing function as the value
of PRIN1, step will also use this printing function whenever it prints.
In the present version, for convenience, PRINLEVEL and PRINLENGTH are
lambda-bound inside the hooking function to 3 and 5 respectively. These
could be changed by editing the EXPR code and recompiling.
When the P command is used, PRINLEVEL and PRINLENGTH are temporarily bound
to NIL, and the toplevel printer (value of atom PRIN1) is used to redisplay
current form.
Overhead of Stepping:
If stepping mode has been turned off by <ctl G>, the execution overhead
of having the stepping packing in your LISP is identically NIL.
If stepping mode has been turned off by (STEP NIL), every call to EVAL
incurs a small overhead--several machine instructions, corresponding
to the compiled code for a simple COND and one function pushdown.
Running with (STEP) entered at top level is the same overhead-wise
as running with (STEP NIL).
Stopping stepping by responding <tab> incurs the same
continued overhead as (STEP NIL).
Running with (STEP FOO1 FOO2 ...) can be more expensive, since a
MEMBER of the CAR of the current form into the list (FOO1 FOO2 ...)
is required at each call to EVAL.
Memory-wise, the total compiled stepping package occupies about 423
words of binary program storage.
Interaction with DEBUG and TRACE:
To the best of my knowledge, the STEP package has no special interactions
with DEBUG, TRACE, or any other system packages.

1422
doc/alan/struct.doc Executable file

File diff suppressed because it is too large Load Diff

4723
doc/info/lisp.15 Executable file

File diff suppressed because it is too large Load Diff

4170
doc/info/lispa.5 Executable file

File diff suppressed because it is too large Load Diff

2641
doc/info/lispc.6 Executable file

File diff suppressed because it is too large Load Diff

2161
doc/info/lispio.4 Executable file

File diff suppressed because it is too large Load Diff

285
doc/info/lispt.22 Executable file
View File

@@ -0,0 +1,285 @@
-*-TEXT-*-
This file contains documentation on the LISPT package for running
TECO editors as a inferior jobs to LISP (or MACSYMA).

File: INFO;LISPT Node: TOP Up: (DIR)
The LISPT inferior job editor package
This package is intended to support TECO based editors as inferior jobs
to a LISP or MACSYMA. The superior/inferior relationship between the
LISP and TECO allows a unique interaction between them, namely the
direct reading and writing of text from/to TECO buffers and a convenient
command scheme for passing the console back and forth between the
jobs. This package is highly dependent on ITS job control features and
is unlikely to be transportable. Also some features are dependent on
the EMACS macro library and can be used only with editors based on
EMACS.
* MENU:
* LISP Usage: LISP Basic use of LISPT from LISP
* MACSYMA Usage: MACSYMA Basic use of MACST from MACSYMA
* Console Passing: CONSOLE Between LISP (MACSYMA) and editors
* Editor Commands: EDIT Editor Commands for TECO, E, TE, ...
* Job Functions: JOB Editor killing, disowning, etc
* Details - LISP: LDETAILS Functions and Variables in LISPT
* Details - EMACS: EDETAILS EMACS macros supporting LISPT
* Other info: Other Misc. information about LISPT
(not all of these are written yet)
Type 1 for basic information on using LISPT from LISP; type 2 for
use from MACSYMA (the inferior editor is called MACST in this case).

File: LISPT Node: LISP Next: CONSOLE Up: TOP
The Basic Use of LISPT from LISP
The first thing you must do is load LISPT into your LISP by either
FASLOAD'ing LIBLSP;LISPT FASL or using the INF-EDIT function which has
an autoload property when LISP is started. The basic functions for
entering the editor are INF-EDIT, TECO, EMACS, and TECMAC. These
functions will pass the console to an inferior-job editor, creating,
loading, and starting the editor job, as necessary.
INF-EDIT - (MACRO) This function always tries to find an existing
editor, reowing or detaching it from DDT if possible.
If the editor does not exist, one will be created as
specified below. If the editor is currently under
some job other than DDT, you will be asked if you want
to create another editor or wait for the existing one.
The default job name of the editor is LISPT (actually
the value of the variable LISPT-JNAME). If INF-EDIT is
given at least one argument, it must be a symbol and is
taken as the editor's job name.
If an editor is not found, it must be loaded from a file.
With no arguments, it will load <udir>;TS LISPT, or,
if that is not found, SYS2;TS LISPT. <udir> is the result
of (STATUS UDIR). <udir>;TS EDIT is also checked. TS LISPT
on SYS2 is a plain TECO with the LISPT macro library loaded.
With one argument, the files UDIR;TS <arg> and SYS2;TS <arg>
are checked first. If a second argument is given, it is
taken as a namelist from which to load the editor, with
the feature that if it is a symbol, ((SYS2) TS <arg2>)
is used. INF-EDIT* is an LSUBR version of INF-EDIT.
Example: In a fresh LISP, (INF-EDIT EMACS) will put you
in an inferior job EMACS editor.
TECO, EMACS, TECMAC - These functions are like INF-EDIT except they
enter bare TECO, E, or TE editors respectively. However,
unlike INF-EDIT, they do not have autoload properties in
built-in to LISP.
Currently, only one editor sub-job is allowed. When multiple inferior-
job editors are implemented, there will be some way to specify which
job you want the console passed to.
The next node (CONSOLE) describes how to pass the console back and
forth between DDT, the superior job LISP or MACSYMA, and the inferior
job editor.

File: LISPT Node: MACSYMA Up: TOP
The Basic Use of MACST from MACSYMA
To enter an inferior job editor, you must execute one of the following
funcitons:
EDIT(); With no arguments, EDIT loads <udir>;TS LISPT,
<udir>;TS EDIT, or SYS2;TS LISPT (which ever is found
first). SYS2;TS LISPT is a plain TECO with the LISPT
TECO macro library loaded. With one argument, EDIT
will load the specified editor. Examples:
EDIT(EMACS); loads SYS2;TS EMACS, the standard editor.
EDIT(EDIT,[MY,EDITOR,DSK,JLK]) loads a special editor from
JLK; (actually the file spec is merged with
[TS,LISPT,DSK,SYS2]). The job name will be EDIT.
TECO(), EMACS(), TECMAC()
These functions load editors of the same name.
The first time an editor function is called, an inferior editor job is
created (job creation is announced by a message typeout). Currently,
only one inferior job editor is allowed (but this may change someday).
On subsequent calls to these functions, the previously created editor
is simply re-entered (this means the job is started and the console is
passed to it).
The next node (CONSOLE) describes how to pass the console back and
forth between DDT, the superior job LISP or MACSYMA, and the inferior
job editor.

File: LISPT Node: CONSOLE Next: EDIT Up: TOP
Passing the Console between LISP (or MACSYMA) and Editors
The console is passed to the editor by the various editor creating
functions. Once an editor is created, using these functions
subsequently, simply causes the editor to be re-entered. For
convenience, an interrupt character ^T is provided, which passes
the console directly to the editor. In fact, this can be done
while your LISP or MACSYMA job is running. If you want this
console-passing function on some other character, see
*note LISP-DETAILS: LDETAILS, for how its done.
Once the console has been passed to the inferior-job editor, you
return by typing CALL (^Z on non-meta keyboards) or by executing
some command in the editor for returning to its superior (e.g.
^C in bare TECO, ^Z in EMACS or TECMAC, etc.). LISPT will type
a message telling you the console has been reconnected to LISP
and will reprompt, if the LISP job is in a read state.
If you want to exit all the way back to DDT, you can type Back/Next
twice (or ^_^_ on non-meta keyboards). This is convenient for times
when you want to go back to DDT momentarily (say, to look at a SENDs
message) and return to the editor. When your LISP job is re-entered,
the console is passed back to the editor immediately. You can avoid
this by prefixing the ^_ command with ^U. Then the console stays
in LISP when it is returned from DDT. Of course you can also just
do 2 CALL's (^Z's) but this is messier.
Next is a description of the editor commands for causing the
superior LISP or MACSYMA to read commands from the editor's
buffer.

File: LISPT Node: EDIT Next: JOB, Previous: CONSOLE, Up: TOP
Editor commands
One of the primary capabilities of the LISPT system is to allow a
LISP or MACSYMA to read directly out of an inferior-job editor's
buffer. This reading is initiated by commands in the editor which
set the virtual buffer boundaries around the text to be read, and
send a command to the superior, requesting the read.
* MENU:
* Plain TECO:: Text reading commands in plain TECO [Type 1]
* EMACS Commands:: Commands for editors using the EMACS Library
(including E, TECMAC, etc) [Type 2]

File: LISPT Node: Plain TECO Next: JOB Up: EDIT
Text Reading Commands in Plain TECO
The primary text-read-by-superior-job command in plain TECO is MZ (that
is, Q-register Z contains a macro for requesting reads by a superior).
With no arguments or an argument of 1, this macro will cause the piece
of code containing or following the TECO cursor (/\) to be read by
the superior. The macro determines by the contents of the text, whether
the text is LISP code or MACSYMA code.
With one argument, the piece of code pointed at and <arg>-1 subsequent
commands or expressions are read (if the argument is negative, <arg>-1
preceeding expressions are read).
With a prefix argument (e.g. 1, MZ), the current expression and all
subsequent expressions in the buffer are read. This is particularly
useful when a previous read encountered an error part way through,
and you want to continue reading at the expression that had the error.
With two arguments ( m,n MZ), the range of the buffer delimited by
the two arguments is read, that is, the two arguments are character
pointers into the buffer, relative to the beginning. For example
B,Z MZ or H MZ would read the whole buffer, while B,. MZ would
read from the beginning up to ".".
Real-time edit mode characters Meta-Z and Control-Meta-Z function
like MZ and 1,MZ respectively, but these may be hard to type in
when using plain TECO, unless you have a keyboard with a meta key.
Next is a discussion of some job manipulations that can be
performed on inferior-job editors.

File: LISPT Node: EMACS Commands Next: JOB Up: EDIT
Text Reading Commands in EMACS-based Editors

File: LISPT Node: JOB Next: Other, Previous: EDIT, Up: TOP
Manipulating editor jobs (killing, disowning, reowning, etc.)
(KILL-EDITOR), KILLEDITOR();
(DISOWN-EDITOR), DISOWNEDITOR();
(REOWN-EDITOR JNAME) REOWNEDITOR(JNAME);
(EDITOR-TO-DDT) ; snarfs it from DDT
(EDITOR-FROM-DDT JNAME) ; gives it back to ddt

File: LISPT Node: Other Previous: JOB, Up: TOP
Miscellaneous Information about LISPT
LISPT was originally implemented by Rich Bryan (RLB) as an experiment
in the use of inferior jobs and the USR device. It has since been
developed somewhat by JLK. LISPT requires an inferior job package
to accomplish job managing operations. Currently it uses the LDDT
package (LIBLSP;LDDT FASL) which in turn uses the HUMBLE package
for low level primitives. These may be replaced in the near future
by a combined package (GSB;QJOB >).
There are various problems in using the USR device for transmitting
ASCII text. Neither LISP nor ITS supports this mode of operation,
and therefore it is necessary that a kludgey patch be made (automatically)
to LISPT when LISPT is loaded (see JLK;LISPT PATCH). This patch causes 2
otherwise shareable pages in LISP to become unshared. Hopefully this
situation will not persist, but for the moment it is an overhead which
must be considered. The necessity for this patch is due to the
desirability of being able to use READ, PRINT, SPRINTER, etc on a USR
device channel to or from a TECO buffer.
Many of the job managing aspects of LISPT are still in a state of
development (e.g. allowing multiple inferior editors, passing the
editor between LISP and DDT, TTY passing, TTY-RETURN prompting
and acknowledgement, etc.). Any suggestions in this area would be
appreciated.

File: LISPT Node: LDETAILS Up: TOP
Details on the LISPT implementation for LISP Programmers
(information you need for customizing LISPT behavior)
(SSTATYS TTYINT...) for tty passing, reown-disown, etc, LISPT-NULL
TTY-RETURN hackery, JOB-RETURN-TTY
variables controling job loading, jname, etc.(LISPT-FILE, LISPT-JNAME)
READ-EVAL-PRINT uses values of READ, EVAL, and PRIN1. Also LISPT-READTABLE
Alternate read loops (LISPT-READ-LOOP, DEFAULT-LISPT-READ-LOOP,
CATCH-READ-LOOP)
Can't read LAP yet
does handle INCLUDE
CATCH-READ-LOOP punts upon encountering ^C (more reliable but
can't read files with ^C in them)
LISPT-PROTECT, EDPROTECT
LISPT-VERBOSE (not implemented)
EDITOR-JOB, EDITOR-JNAME
SUSPENDing LISP with inferiors
When VALRETing you may want to bind TTY-RETURN off
LDDT features (P, :CONTIN, :PROCEED, G, :JCL, ...)
JCL hacking
TECO-BATCHing in MACSYMA - reads "..." in bothcases

File: LISPT Node: EDETAILS UP: TOP
EMACS Macros used with LISPT
Low level text sending protocol
FS SUPERIOR conventions
List of macros
Setup hook
window hackery
deferred sending of text
.Z q-vector of macros and other things

272
doc/info/trace.1 Executable file
View File

@@ -0,0 +1,272 @@
This file is the documentation for the Lisp Trace package. It is
admittedly out of date, but nonetheless better than nothing. Improve
it!
08/01/72
The Lisp Trace package consists of three main functions,
Trace, untrace, and remtrace, all of which are fexprs.
A call to Trace has the following form:
(Trace <Trace specs>)
a "Trace spec" in turn is either an atom (the name
of the function to be Traced) or a list of this form:
(<function name> <options>)
where the options are as follows:
Break <pred> causes a break after printing the entry
Trace (if any) but before applying the
Traced function to its arguments, if
and only if <pred> evaluates to non-nil.
Cond <pred> causes Trace information to be printed
for function entry and/or exit if and
only if <pred> evaluates to non-nil.
Entrycond <pred> causes Trace information to be printed for
function entry if and only if <pred> evaluates to
non-nil. If both cond and entrycond are used, the
<pred> specified for cond is evaluated first; and
both <pred>'s must evaluate to non-nil for
entry Trace information to be printed. If the
<pred> for cond evaluates to nil, then the <pred> for
entrycond will not be evaluated.
Exitcond <pred> causes Trace information to be printed for
function exit if and only if <pred> evaluates to
non-nil. If both cond and exitcond are used, both must
evaluate to non-nil for exit Trace information to be
printed. Note that the <pred> for cond is
not re-evaluated on exit; rather, its value on entry
is saved. If this value is nil, then the <pred>
for exitcond will not be evaluated.
Wherein <fn> causes the function to be Traced only
when called from the specified function.
One can give several Trace specs to Trace,
all specifying the same function but with
different wherein options, so that the
function is Traced in different ways when
called from different functions. Note that
if the function specified by the wherein
option is already being Traced itself, the
wherein option probably will not work as
desired, probably. (Then again, it might.)
Note that <fn> must be an interpreted function,
since the wherein Trace involves altering
the calling function as well as the called.
Argpdl <pdl> specifies an atom <pdl> whose value Trace
initially sets to nil. When the function is
Traced, a list of the current recursion
level for the function, the function's
name, and a list of the arguments is consed
onto the <pdl> when the function is entered,
and cdr'ed back off when the function is
exited. (Actually, this consing/cdring is done by
means of lambda-binding, so that if an error or
other interrupt occurs the <pdl> will be reset by
unbinding.) The <pdl> can be inspected from a
breakpoint, for example, and used to
determine the very recent history of the
function. This option can be used with or
without printed Trace output. Each function
can be given its own pdl, or one pdl may
serve several functions.
Entry <list> specifies a list of arbitrary s-expressions
whose values are to be printed along with
the usual entry Trace. The list of
resultant values, when printed, is preceded
by a \\ to separate them from the other
information.
Exit <list> similar to entry, but specifies expressions
whose values are printed with the exit Trace.
Again, the list of values printed
is preceded by \\.
Arg specify that the function's arguments,
value resultant value, both, or neither are to
both be Traced. If not specified, the default
nil is both. Any "options" following one of
these four are assumed to be arbitrary
s-expressions whose values are to be printed
on both entry and exit to the function.
However, if arg is specified, the values are
printed only on entry, and if value, only on
exit. Note that since arg, value, both, nil,
swallow all following expressions for this
purpose, whichever one is used should be the
last option specified. Any such values
printed will be preceded by a // and will
follow any values specified by entry or exit
options.
If the variable arglist is used in any of the expressions
given for the cond, break, entry, exit, or after-the-arg-
value-both-or-nil options, when those expressions are
evaluated the value of arglist will effectively be a list
of the arguments given to the Traced function. Thus
(Trace (foo break (null (car arglist))))
would cause a break in foo iff the first argument to
foo is nil. Similarly, the variable fnvalue will effectively
be the resulting value of the Traced function; since the value
of the function is of course available only on exit
from the function, this should only be used with the exit and
exitcond options. Also, the variable recurlev, on both entry and
exit, will effectively have as its value a number indicating the
current recursion level (as would be printed by Trace). This
allows conditional breaks and Traces based on the depth
of recursion. The recursion level is incremented by means of
lambda-binding; thus if an error or other interrupt occurs,
the recursion level will be reset by unbinding.
(Note that the word "effectively" is used in describing the
values of the above "variables" since these variables are
not actually used; Trace actually performs a sublis on the
expressions for the options mentioned above, substituting
certain non-interned atoms for any and all appearances of
the special "variables" mentioned above. Therefore, do
not try to use these variables for anything but obtaining
their values when using them in expressions for the above
options.)
In addition to using the variable arglist, expressions
for Trace options may refer to the actual names of
the function's arguments if the function is interpreted rather
than compiled. Furthermore, such argument variables may
be examined from breakpoints.
Trace uses the Prin1 current at the time of printing the trace
for its printouts. Thus, in order to have your Trace output
passed through Grind, you might perform (setq prin1 'Sprint);
for debugging Macsyma internals, (Fasload Funpr Fasl Dsk Libmax)
(setq prin1 'Funprint). You can also use the Grind option
(Trace (foo Grind)), but of course this uses the system grind.
Examples of calls to Trace:
[1] to Trace function foo, printing both arguments on entry
and result on exit:
(Trace foo) or (Trace (foo)) or (Trace (foo both)).
[2] to Trace function foo only when called from function bar,
and then only if (cdr x) is nil:
(Trace (foo wherein bar cond (null (cdr x))))
or (Trace (foo cond (null (cdr x)) wherein bar)).
As this example shows, the order of the options makes no
difference, except for arg, value, both, or nil, which must
be last.
[3] to Trace function quux, printing the resultant value
on exiting but no arguments on entry, printing the value
of (car x) on entry, of foo1, foo2, and (foo3 bar) on exit,
and of zxcvbnm and (qwerty shrdlu) on both entry and exit:
(Trace (quux entry ((car x)) exit (foo1 foo2 (foo3 bar))
value zxcvbnm (qwerty shrdlu))).
[4] to Trace function foo only when called by functions bar
and baz, printing args on entry and result on exit, printing
the value of (quux barf barph) on exit from foo when called
by baz only, and conditionally breaking when called by bar if
a equals b:
(Trace (foo wherein bar break (equal a b))
(foo wherein baz exit ((quux barf barph)))).
[5] to Trace functions phoo and fu, never printing anything
for either, but saving all arguments for both on a common pdl
called foopdl, and breaking inside phoo if x is nil:
(Trace (phoo argpdl foopdl break (null x) cond nil nil)
(fu argpdl foopdl cond nil nil)).
The "cond nil" prevents anything at all from being printed.
The second nil in each <Trace spec> specifies that no args
or value are to be printed; although the cond nil would
prevent the printout anyway, specifying this too prevents
Trace from even setting up the mechanisms to do this (which
it would, against the possibility that someday nil might not
evaluate to nil.)
[6] to Trace function foobar, printing args on entry and
result on exit, plus the value of moby-expr on exit, and
pretty-printing the output:
(Trace (foobar grind exit (moby-expr))).
[7] to Trace function ghoti, one of whose arguments is
fish, printing all arguments only if fish
is non-nil, and printing on exit only if the result is not
a number:
(Trace (ghoti entrycond fish
exitcond (not (numberp fnvalue)))).
[8] to Trace function ssehc, printing Trace output only if
draob is non-atomic, and even then on entry only if pohsib is
a negative number, breaking when the recursion level is either
3 or greater than 7:
(Trace (ssehc cond draob
entrycond (and (numberp pohsib) (minusp pohsib))
break (and neeuq (or (equal recurlev 3)
(lessp 7 recurlev))))).
Trace returns as its value a list of names of all functions
set to Trace; for any functions Traced with the wherein
option, say (Trace (foo wherein bar)), instead of returning
just the name it returns a 3-list (foo wherein bar).
If Trace finds a <Trace spec> it doesn't like, instead of the
function's name it returns a list whose car is ? and whose
cdr indicates what Trace didn't like. (This should be slightly
more helpful than the oold Trace, which simply returned nil.)
A list of possible error indications:
(? wherein foo) Trace couldn't find an expr, fexpr, or
macro property for the function specified by the
wherein option; or the function specified was not
atomic.
(? Argpdl foo) the item following the argpdl option was
not a non-nil pname-type atom.
(? Foo not function) indicates that the function specified
to be Traced was non-atomic, or had no functional
property. (Valid functional properties are expr,
fexpr, subr, fsubr, lsubr, and macro.)
(? Foo) foo is not a valid option.
Thus a call to Trace such as
(Trace (foo wherein (nil)) (bar argpdl nil))
would return, without setting up any Traces,
((? wherein (nil)) (? argpdl nil)).
If you attempt to specify to Trace a function already
being Traced, Trace calls untrace before setting up the new
Trace. If an error occurs, causing (? <random>) to be
returned, the function for which the error occurred may or
may not have been untraced. Beware!
it is possible to call Trace with no arguments. (Trace)
returns as its value a list of all functions currently
being Traced.
Untrace is used to undo the effects of Trace and restore
functions to their normal (?) untraced state. The argument
to untrace for a given function should be essentially what
Trace returned for it; i.e. If Trace returned foo, use
(untrace foo); if Trace returned (foo wherein bar) use
(untrace (foo wherein bar)). Untrace will take multiple
untrace specifications, e.g. (Untrace foo quux (bar
wherein baz) fuphoo). Calling untrace with no arguments
will untrace all functions currently being Traced.
Remtrace, oddly enough, expunges the entire Trace package.
It takes no arguments.