1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-27 09:18:58 +00:00

CLU mode for EMACS.

Also CLU-MORE library.
This commit is contained in:
Lars Brinkhoff
2021-08-26 08:28:49 +02:00
parent 74c3facf09
commit aba51512d7
4 changed files with 290 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ respond "\n" "\033xgenerate\033emacs;abstr\033emacs1;abstr\r"
respond ":EJ" "\033xgenerate\033emacs;auto-s\033emacs1;auto-s\r"
respond ":EJ" "\033xbare\033emacs1;bare\r"
respond "\n" "\033xgenerate\033emacs;c\033emacs1;c\r"
respond "\n" "\033xgenerate\033emacs;clu\033emacs1;clu\r"
respond "\n" "\033xgenerate\033emacs;clu2\033emacs1;clu2\r"
respond ":EJ" "\033xgenerate\033emacs;complt\033emacs1;complt\r"
respond ":EJ" "\033xgenerate\033emacs;delim\033emacs1;delim\r"
respond ":EJ" "\033xgenerate\033emacs;dired\033emacs1;dired\r"

View File

@@ -349,6 +349,8 @@ emacs1/bare.18 198904020122.07
emacs1/buffer.207 198904020122.25
emacs1/c.1 198904020122.28
emacs1/ccl.196 198904020122.32
emacs1/clu2.2 198904012322.37
emacs1/clu.512 198904012322.35
emacs1/complt.5 198402211732.30
emacs1/crl.208 198904020122.46
emacs1/delim.21 198904020122.50

BIN
src/emacs1/clu.513 Normal file

Binary file not shown.

286
src/emacs1/clu2.2 Normal file
View File

@@ -0,0 +1,286 @@
!* -*-TECO-*- This library implements more EMACS CLU MODE.!
!~FILENAME~:! !Package to provide more functions for editing CLU
code (CLU Mode).!
CLU-MORE
!& Setup CLU-MORE Library:! !S !
M(M.M Make_Prefix_Character).Y M.C Control_\_Prefix Prefix character for CLU hacking commands
M.M ^R_Compile_CLU_and_Edit_Errors U:.Y(C) !* C-\ C to compile & edit !
M.M ^R_Run_Tlink U:.Y(J) !* C-\ J for Tlink !
M.M ^R_Fancy_Run_Tlink U:.Y(T) !* C-\ T Fancy Tlink !
M.M ^R_Edit_CLU_Errors U:.Y(E) !* C-\ E for editing errors !
M.M ^R_Edit_Next_CLU_Error U:.Y(N) !* C-\ N for going to the next error !
M.M ^R_Edit_Next_CLU_Error U:.X(N) !* C-X N for compatibility with someone !
!* C-\ is a prefix character now!
QControl_\_Prefix U.\ 
M(M.M Load_Library)<PAO.BIN>EFORK !* emacs:efork doesn't let us call!
!* ^R Invoke Inferior from a macro right!
:@I*/M(M.M &_Internal_CLU_Mode_Hook )/ [6
0 M.V TLINK_Fork  !* define a variable to hold the index!
:FO..Q CLU_Mode_Hook "L
Q6 M.C CLU_Mode_Hook  '
"#
F[ B BIND
GCLU_Mode_Hook G6 0,.XCLU_Mode_Hook '

!& Internal CLU Mode Hook:! !S Set up additional keys for CLU Mode!
!* set up C-A to go to a line!
M.M ^R_New_Beginning_of_Line  M(M.M Make_Local_Q-reg) .A
0
!^R New Beginning of Line:! ! Go to beginning of line.
If given an argument, goes to that line in the buffer. (Absolute reckoning)!
FF"G !* go to the line specified by the arg!
BJ F-1L'
"# 0L'
!Document New CLU Functions:! !C Prints documentation for the new EMACS CLU functions.
The following keys have been defined:
C-\ C Compiles a clu program, then runs C-\ E
C-\ J Runs an inferior TLINK.
C-\ T Fancy run TLINK - tries to reload changed binaries.
C-\ E After a CLU compile (M-&), displays the error file in the top
four lines of the screen. Moves the cursor to the first error.
C-\ N Advances the cursor to the next error, displaying the error at
the top of the screen.
!
m(m.mDescribe)Document_New_CLU_Functions 
!^R Compile CLU and Edit Errors:! !^R Run (hacked) M-&, then C-\ E
Runs a hacked version of M-& which doesn't do View File on the errors,
Then runs Edit Clu Errors.!
m(m.m ^R_Better_CLU_Compile )
m(m.m ^R_Edit_CLU_Errors )
!& Fancy Run Tlink:! !^R Fancy Run Tlink:! !Runs an inferior TLINK.
Give the command an argument of zero to kill the inferior.!
[0 :@I0/_Type_`valret_("\n")'_to_return_to_EMACS
/
FF"E Orun it '
"E !* we have an argument!
@FT Killing_old_Tlink
0FS ECHO ACTIVE
-QTLINK_Fork F"N FZ' !* kill it.!
0UTLINK_Fork' !* forget about it...!
"# !run it!
!* get the file name to load !
QBuffer_Name M(M.M &_Find_Buffer) [B
Q:.B(QB+2!*bufvis!)[F
QF"N
F[ D FILE ETF
FS D FN1UF
FS D FN2[1 F=1CLU"N 0UF''
@FT0 0FS ECHO ACTIVE
QTLINK_Fork"E !* do we need to start one?!
QF"E FZSYS:TLINK.EXE U TLINK_Fork '
"# FZSYS:TLINK.EXE_F U TLINK_Fork ' '
"#
QF"E -1,QTLINK_Fork FZ  '
"# -1,QTLINK_Fork FZ load("F")
 !''! ''
FI @V '  !* gobble the valretted character!
!& Run Tlink:! !^R Run Tlink:! !Runs an inferior TLINK.
Give the command an argument of zero to kill the inferior.!
[0 :@I0/_Type_`valret_("\n")'_to_return_to_EMACS
/
FF"E Orunit '
"E !* we have an argument!
@FT Killing_old_Tlink
0FS ECHO ACTIVE
-QTLINK_Fork F"N FZ'' !* kill it.!
"# !runit!
@FT0 0FS ECHO ACTIVE
QTLINK_Fork "E FZ SYS:TLINK.EXE UTLINK_Fork'
"# QTLINK_Fork FZ'
FI' !* gobble the valretted character!
!^R Edit CLU Errors:! ! Edit the lines with errors in two window mode.
^R Edit Next CLU Error will go the next line in error.!
M(M.M &_Initialize_CLU_Error_Buffer) M.V Current_Clu_Error
QCurrent_Clu_Error "E :I*NER No_Errors FS ERR '
QCurrent_Clu_Error F"L FS ERR' W
0J QCurrent_Clu_Error-1L
:I**Clu_Errors* M(M.M &_Find_Buffer) [B !* ERRORS BUFFER => QB!
Q:.B(QB+4!*bufbuf!) M.V Errors_Buffer_Buffer
0FO..QWindow_2_Size"N
:I*A2W Already_Two_Windows FS ERR'
fs rgetty"e
:I*TTY You_are_on_a_printing_terminalFS ERR'
MMM_&_Check_Top_Levelwindows
[Previous_Buffer !* Don't set Previous Buffer to buffer of window we leave.!
QBuffer_Name M.V Window_2_Buffer
QBuffer_Name M.V Program_Buffer_Name
Q:.B(QB+4!*bufbuf!) M.V Other_Window_Buffer
FS WINDOW M.V Window_2_Window
. M.V Window_2_Pointer
FSLINES M.VDefault_Size
FS LINESF"E
FS HEIGHT-(FS ECHO LINES)-1 ' M.V Total_Size
4 M.V Window_1_Size !* ERRORS WINDOW = 4 LINES!
:@I*/*Clu_Errors*/ M.V Window_1_Buffer
QOther_Window_Buffer[..O . M.V Window_1_Pointer
. M.V Window_1_Window ]..O
QWindow_1_Size[0
QTotal_Size-1-Q0:"G !* If old window 1 size is unreasonable, fix it up.!
QTotal_Size/2U0 Q0UWindow_1_Size'
1F[NOQUIT
QTotal_Size-1-Q0 M.V Window_2_Size
!* This refresh mechanism may not work right. I will probably have!
!* to re-write it!
FS REFRESHM.V Window_1_Refresh
M.M &_Multi-window_Refresh FS REFRESH
"N Q0 FS LINESW
Q:.B(QWindow_2_Buffer M(M.M &_Find_Buffer)+4!*bufbuf!) M.V Other_Window_Buffer
F]NOQUIT
M(FS REFRESH)W ' !* If cursor should stay in top window, display bottom one.!
Q0 FS TOP LINE !* Else, draw the line of dots, and switch into bottom!
:FT FS WIDTH/10<FT----------> 0U..H !* window, causing it to be displayed.!
-1FS TYPEOUT
0FS TOP LINE
F]NOQUIT
M.M ^R_Done_With_CLU_Errors U:.X(1)
QWindow_1_Size+1 FS Top Line
QWindow_2_Size FS LINES
M(FS REFRESH)

!& Initialize CLU Error Buffer:! !S Initializes the *Clu Errors* buffer.
Loads CLU.JUNK into the *Clu Errors* buffer, setting things up for the
 Edit Errors command.!
!* DO SOME INITIAL ERROR CHECKING!
Q:.B(QBuffer_Index+2!*bufvis!) "E
:I*NOF Not_visiting_a_file FS ERR '
FS MODIFIED "N :I*MOD Buffer_has_been_modified FS ERR '
FSMSNAME :IJJCLU.JUNK.0 !* make sure we look in connected dir!
E? J  "N :I*NCJ No_CLU.JUNK_file FS ERR '
!* get the CLU.JUNK file!
QBuffer_Name [Previous_Buffer
M.M &_Return_to_Buffer [R !* save typing here!
:I**Clu_Errors* M(M.M Select_Buffer)
-1 M(M.M Visit_File) J 
@:S/Compiling_/"E :I*BFJ Bad_Format_CLU.JUNK_File MR '
.[0 [1 L 2R Q0,.X1 L !* check file name!
!* FILENAME OF COMPILED FILE => Q1!
QPrevious_Buffer M(M.M &_Find_Buffer) [B
F[ B BIND
G:.B(QB+2!*bufvis!) -S. C K !* fix version number from 0!
Q:.B(QB+9!*bufver!) \
HX0 !* FILENAME OF BUFFER => Q0!
F] B BIND !* All done with that buffer!
F~01 "N :I*WRF Wrong_file MR '
!* OK, let's find the first error!
M(M.M &_Find_Next_Clu_Error) [4
MR
Q4
!& Return to Buffer:! !S "Returns" to the "Previous Buffer".
Given an argument (which should be a string), signals that error.!
QPrevious_Buffer M(M.M Select_Buffer)
FF"N FS ERR '

!& Find Next Clu Error:! !S Looks for a number beginning a line in the current buffer.!
<:S
"E 0' .-Z"E 0' !* go to the next line. return 0 if none!
1A"D 0;' !* line start with a digit?!
1:FBoutput_failure:"N !* or an output error?!
0L 1:X*'
>
\[0 0l Q0
!& Done With CLU Errors:! !^R Done With CLU Errors:! !S Revert to one window mode.!
0 UErrors_Buffer_Buffer
1 M(M.M ^R_One_Window)
M.M ^R_One_Window U:.X(1) w
!^R Edit Next CLU Error:! ! Goes to the next CLU error.
Will position the errors window to display the next error at the top of
the screen, and position the text buffer near the line on which the error
occurs.!
[E
QErrors_Buffer_Buffer F"E
:I*NEE Not_Editing_Errors FS ERR ' [..O
M(M.M &_Find_Next_Clu_Error) UE
.UWindow_1_Pointer .UWindow_1_Window
]..O
QE"E !* no more errors!
:I*C FS ECHO DISPLAY
@FT (No_more_errors)  0FS ECHO ACTIVE
M(M.M &_Done_With_CLU_Errors)
'
QE F"L (M(M.M&_Done_With_CLU_Errors) ) FS ERR'
!* or an error message...!
FS TOP LINE"E M(M.M ^R_Other_Window) '
QProgram_Buffer_Name [A
F=Buffer_NameA "N QProgram_Buffer_Name M(M.M Select_Buffer) '
QE F(-1 (0J) L) UCurrent_Clu_Error !* position cursor!
!* and setup CCE!
M(FS REFRESH)

!^R Better CLU Compile:! !^R Call the CLU compiler.
Like ^R CLU Compile in the "clu" library, but doesn't ask stupid questions.
Create a compiler if needed. We first offer to write out each file,
unless there is a numeric arg other than 0. Reads a command line to
pass to CLU: "&" in it is translated into the name of the visited file.
If just CR is typed, "compile &" is used, that is, it compiles the
visited file. The command line may have several commands separated by
"#". We always add the "stay" command. The CLU compiler is kept from
one call to another. Arg = 0 => just kill the compiler.!
!* Instead, ask for the command to the compiler if there is an arg ~= 0 !
!* ff"e m(m.m Save_All_Files)' !
m(m.m Save_All_Files)
!* Arg 0 is special, destroy the compiler.!
"# "e -qCLU_*Handle* f"l fz' w -1uCLU_*Handle* 0''
!* Set up helpful action if user types the help character.!
:i* :ftCLU_command_(or_several_commands_separated_by_#)
If_null,_will_compile_this_file.
  f[help mac
ff"n !* if arg and not equal to 0 !
3,m(m.m &_Read_Line)CLU_command:_[3 !* Find out what user wants.!
fq3"l 0u..h '' !* Give up if get a rubout instead.!
ff"e !* if no arg, or arg = 0 !
:i3compile_& '
ff"n fq3"e :i3compile_& ''
qBuffer_Filenames[5
[4 [6 :i4 !* q4 get stuff already processed.!
<&f3 f(:;) f(,0: :g3u6 :i4465)+1,fq3 :g3u3 >
:i343_#_stay !* Q3 has the JCL line to use.!
:ft >>>___3___Running..... !* Echo the command.!


qCLU_Compiler[4
qCLU_*Handle*f"l !* See if we have a compiler somewhere.!
fz 4_#_3uCLU_*Handle*' !* We do now.!
"#,0: fz clu_#_3' !* when restarting, must provide !
!* phony job name for it to flush.!
0u..h !* erase the "running" message!
!* fs msname :f6u3 * Get the connected directory!
!* m(m.m View_File) 3clu.junk.0  * so we always display the right file.!
0