mirror of
https://github.com/PDP-10/its.git
synced 2026-05-01 14:06:28 +00:00
Except IVORY, there's also WORDAB and TMACS. IVORY needs go be generated with itself, so include the :EJ for bootstrapping.
1028 lines
41 KiB
Plaintext
Executable File
1028 lines
41 KiB
Plaintext
Executable File
!* EMACS "Purifier" and "Compressor". -*-TECO-*-
|
||
|
||
Modification history:
|
||
9/02/81 188 ECC Added Change PURIFY Format to IVORY Format.
|
||
|
||
The Compressor takes a file of macros such as this one and deletes
|
||
comments and whitespace around these comments. It also creates the
|
||
documentation strings and the ~DIRECTORY~. Nothing else is changed
|
||
(unlike PURIFY). It is intended that macros written for IVORY be
|
||
executable without being compressed; i.e. that the compression will
|
||
effect no semantic changes on the code.
|
||
|
||
The Purifier turns a compressed file in the buffer into a file that
|
||
can be :EJ'ed, creating the loader macro and other cruft that is
|
||
required for proper operation.
|
||
|
||
A special hack has been implemented to allow PURIFY format libraries
|
||
to be compressed in with IVORY libraries. For a library FOO, if
|
||
variable PURIFY Library FOO exists and is non-zero, the library will
|
||
be treated as a PURIFY library. IVORY knows about a number of common
|
||
PURIFY libraries already -- see MM Generate Library.!
|
||
|
||
!~FILENAME~:! !Macros for maintaining EMACS libraries!
|
||
IVORY
|
||
|
||
!TECO Mode:! !C Set up commands for editing TECO code.
|
||
Makes Rubout the Tab-hacking Rubout. Tab does ^R Indent Nested.
|
||
M-' and M-" move forward and back over conditionals.!
|
||
|
||
m(m.m& Init Buffer Locals)
|
||
1,1m.lSpace Indent Flag
|
||
1,40m.lComment Column
|
||
1,(:i*!* )m.lComment Start
|
||
1,(:i*!)m.lComment End
|
||
1,(:i*)m.lParagraph Delimiter
|
||
1,(m.m^R Indent Nested)m.qI
|
||
1,q¨1,q.í.q›w)m.q.› !* Exchange rubout flavors.!
|
||
1,0m.lDisplay Matching Paren
|
||
m.m^R Backward TECO Conditionalm.q.."
|
||
m.m^R Forward TECO Conditionalm.q..'
|
||
m.q..D
|
||
0fo..qTECO ..Df"n u..d' !* Select the TECO-mode syntax table!
|
||
"# w :g..du..d !* creating it if doesnt exist.!
|
||
q..dm.vTECO ..D
|
||
1m(m.m& Alter ..D)[A]A"(')<(>);A'
|
||
1m(m.m& Set Mode Line)TECO
|
||
|
||
!& Compress Buffer:! !S Compress a file of macros, in the buffer.
|
||
Removes comments, and makes the documentation and directory strings.
|
||
Documentation will be added to the buffer passed in Q8.
|
||
Function names will be added to the buffer passed in Q9.!
|
||
!*
|
||
If > 0, then we are working on the first library
|
||
in a sequence of libraries. If it is = 0, we are after the first
|
||
library in a sequence.
|
||
This first one's ~FILENAME~ is used for the whole object file.
|
||
1st ~FILENAME~ Name is set to that filename, for use by the caller.
|
||
All other's ~FILENAME~ are turned into "& Compressed foo Library:",
|
||
where foo is the filename. (Thus Apropos etc. can show how a file
|
||
breaks up into source files.)
|
||
& SetUp Compressed Libraries will accumulate code to call the
|
||
&Setups that are in the various compressed files, as well as code
|
||
to set default variables. It will be prepended to the &Setup
|
||
macro in the first library (such a &Setup will be created if one
|
||
doesn't already exist).
|
||
& Kill Compressed Libraries behaves analogously.
|
||
Some syntax notes:
|
||
- A macro may have multiple names. These must precede the macro
|
||
documentation string. They may be on separate lines if desired.
|
||
- FF-CRLFs start macros. If you need one inside a macro, you can
|
||
quote the FF with Control-Q (if in a search) or Control-] Control-Q in
|
||
general. I.e. ^]^Q^L^M^J.
|
||
- Blank macros are ok, e.g. for formatting/commenting source files.
|
||
These macros must ONLY contain comments. No macro names, no code...
|
||
- We remove all comments and surrounding whitespace BEFORE checking
|
||
the major syntax, and thus you may have comments, e.g. before a macro
|
||
name.
|
||
Special Hack: if we are given a non-zero arg, then the buffer is assumed to
|
||
be in PURIFY format, and we will autoload the PURIFY library to perform
|
||
the compression.!
|
||
|
||
m(m.m& Declare Load-Time Defaults)
|
||
& SetUp Compressed Libraries, setup-caller: ||
|
||
& Kill Compressed Libraries, kill-caller: ||
|
||
1st ~FILENAME~ Name, 1st found: 0
|
||
|
||
|
||
[..o[0[1[2[3[4[5[6[7 !* Save regs!
|
||
q..ou7 !* Save source buffer.!
|
||
|
||
|
||
"N !* PURIFY compatibility hack. Since IVORY will eventually take over!
|
||
!* ..the world, we provide for upward compatibility from old (PURIFY)!
|
||
!* ..libraries here, just because we are nice guys.!
|
||
|
||
0fo..qSilent Running"E ft(PURIFY format file)
|
||
'
|
||
m(m.mRun Library)PURIFY& Compress Bufferw !* Call in the marines.!
|
||
0s
|
||
|
||
j< :s; -3c-2d > !* Clean up after marines are gone.!
|
||
0s:! j< :s; -c @f k > !* ...!
|
||
|
||
js
|
||
!~DOC~ 0l !* Find where doc-strings start.!
|
||
.,( s
|
||
!~DIRECTORY~:!0l ).fx1 !* Pick them up,!
|
||
q8u..o g1 q7u..o !* and copy into doc-buffer.!
|
||
|
||
:k i~FILENAME~ 0l !* Put this back into directory, as we!
|
||
!* ..may need it later.!
|
||
.,( < .-z; i! :l i:! k > )zfx1 !* Coerce PURIFY directory into!
|
||
!* ..the form we like.!
|
||
q9u..o g1 q7u..o !* Append it to our directory.!
|
||
' !* (Done with PURIFY source compression.)!
|
||
|
||
|
||
"# !* IVORY source compression!
|
||
|
||
!*** DELETE COMMENTS!
|
||
|
||
j < :s!*; !* find comment!
|
||
.-2(s! @f l),.k !* kill comment and whitespace after!
|
||
-@f
|
||
k !* along with spaces & blank lines before!
|
||
2 |