mirror of
https://github.com/PDP-10/its.git
synced 2026-02-03 15:22:48 +00:00
479 lines
22 KiB
Plaintext
Executable File
479 lines
22 KiB
Plaintext
Executable File
!* -*-TECO-*-!
|
||
|
||
!* Q.B contains the buffer table. It is a vector which is divided
|
||
into several multi-word entries, one for each buffer.
|
||
The entries are in no particular order.
|
||
Each entry starts with its length in words, as the zeroth word.
|
||
Word 1|*bufnam| is the name of the buffer.
|
||
Word 2|*bufvis| is the visited filename.
|
||
These are the filenames as spec'd, not the real
|
||
names (ie, they contain ">", not the version).
|
||
This word can be 0, if the buffer doesn't correspond to a file.
|
||
Word 3|*bufmod| is the name of the major mode selected in this
|
||
buffer (eg, "LISP" or "Fundamental"). This may not be accurate
|
||
for the selected buffer.
|
||
Word 4|*bufbuf| points to the actual buffer itself.
|
||
Word 5|*buftdf| is the TECO default filenames associated with the buffer.
|
||
They are swapped in and out of FS D FILE,
|
||
and are not accurate for the selected buffer.
|
||
They are 0 in a buffer that has never been selected.
|
||
Word 6|*bufwin| is the FS WINDOW associated with the buffer.
|
||
This is not accurate for the selected buffer.
|
||
Word 7|*bufnum| is the buffer's number, assigned when it was created.
|
||
A buffer can be selected by number as well as by name.
|
||
Word 8|*bufdat| is the creation date of last file visited or saved.
|
||
Word 9|*bufver| is the actual version number as of last read or save.
|
||
On ITS, if the files does not have a numeric FN2, this slot
|
||
contains the FN2 as a string. Consider as a number, the string is negative.
|
||
Referred to only in SUPPRT and FILES and BUFFER.
|
||
Word 10|*bufsav| is nonzero if autosaving is on for this buffer;
|
||
1 for saving as the visited filename, or else the filename for auto saves.
|
||
Referred to only in this file and FILES and SUPPRT.
|
||
Word 11|*bufsiz| is the size of the file when last read or saved.
|
||
Referred to only in FILES.
|
||
Word 12|*bufnwr| is nonzero for read-only visiting.
|
||
Positive means the buffer can be changed but not the file.
|
||
Negative means the file cannot be changed either.
|
||
Word 13|*buflcl| is the start of the local variables,
|
||
of which there may be zero or more.
|
||
Referred to only in this file and EINIT.
|
||
|
||
Following words in an entry are in pairs, one pair per local variable.
|
||
The first word of a pair is the variable name (a string); the second
|
||
is the value. When a buffer is selected, the global value lives here.
|
||
When it is not selected, the local value lives here. Thus, ..Q always
|
||
has the actual (local or global) value of the variable.
|
||
|
||
|*buf...| is a comment, removed during compression, which makes
|
||
it easy to find code that depends on the order of elements in
|
||
the buffer table entry. You really write it with exclamation marks,
|
||
not vertical bars, but it's impossible to put exclamation marks
|
||
inside this big comment.
|
||
|
||
A buffer's "Index" is the offset of its entry from the start of .B, in words.
|
||
A buffer's index can change, if earlier entries grow, but only the
|
||
current buffer's entry can grow, so the current buffer's index can't change.
|
||
!
|
||
|
||
!Select Buffer:! !C Select or create buffer with specified name.
|
||
Can accept the buffer name as a string arg, or the buffer number
|
||
as a numeric arg, or a string pointer as arg (when used as a subroutine).
|
||
If there is a buffer with that name, it is selected.
|
||
Otherwise, a buffer with that name is created and selected.
|
||
When a new buffer is selected the first time, if Buffer Creation Hook
|
||
is nonzero, it is run after the buffer is selected.
|
||
A precomma arg is the prompt string to use.!
|
||
|
||
MMM_&_Check_Top_Levelbuffers
|
||
[4 0[3
|
||
FF&1"N U3' !* Numeric arg => use it as buffer or buffer # to select.!
|
||
"# "E :F"G :i3'' !* Precomma arg, or no postcomma arg, => read string arg.!
|
||
Q3"E M.M List_BuffersF[HELPMAC !* Else must read from tty.!
|
||
"N u4' !* Precomma arg is prompt string to use.!
|
||
"# :i4 Select_Buffer'
|
||
QPrevious_Bufferu3 !* Get name of default new buffer to put in prompt.!
|
||
1,Q3M(M.M &_Find_Buffer)"L Q:.B(1)U3'
|
||
3,m(m.m &_Read_Line)4_(3):_u3 !* Read name of buffer to select.!
|
||
Q..H"N F' 0U..H !* Don't wait for space: redisplay text immediately.!
|
||
FQ3"L 0' !* Give up if get a rubout instead.!
|
||
F]HELPMAC''
|
||
Q3[5 !* Save name (or buffer #) in Q5.!
|
||
FQ3"E QPrevious_BufferU3' !* Null string means previous buffer.!
|
||
1,Q3 M(M.M&_Find_Buffer)[1 !* Get index in buffer table of this name or number.!
|
||
Q1u4 !* Q4 remains negative, for a new buffer.!
|
||
Q1"L !* No such buffer => make one now.!
|
||
FQ3"L :I*No_such_buffer FS ERR' !* Refuse to create buffer if bfr number spec'd.!
|
||
FQ5"E 0U1 0U4' !* If ^XB<cr> and prev bfr non ex, use 1st buffer instead.!
|
||
"# Q3 M(M.M &_Create_Buffer)U1'' !* Else create the specified buffer.!
|
||
QBuffer_IndexU3
|
||
Q1-Q3"E 0'
|
||
1F[Noquit !* Prevent quitting half-switched.!
|
||
0FO..Q Buffer_Deselection_Hook[5
|
||
Q5"N M5'
|
||
Q.B[..O ZJ 0 |