! - - - - - - - - - - - - - - - - - - - - - - - ! ! Responder to TECO commands ! ! !!TECO.TEC V01.00!! ! ! ! ! Last edit on 10-Apr-79 by MHB ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Switches recognized by commands: ! ! /FI-ND TECO ! ! /IN-SPECT TECO ! ! /NOI-NI TECO,MAKE,MUNG ! ! /NOM-EMORY TECO,MAKE ! ! /VT-EDIT TECO,MAKE ! ! /VT-EDIT:H-OLD TECO,MAKE ! ! /VT-EDIT:H-OLD:S-EEALL TECO,MAKE ! ! /VT-EDIT:S-EEALL TECO,MAKE ! ! /VT-EDIT:S-EEALL:H-OLD TECO,MAKE ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Entry conditions: ! ! Q-reg 1 ! ! 0 => Try for private TECO.TEC ! ! -1 => EITECO$ already tried ! ! This macro (see ** notes) ! ! Active EI -or- ! ! Q-reg Y ! ! DCL/CCL/MCR command ! ! Text buffer -or- ! ! Q-reg Z (if text buffer empty) ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Q-register usage: ! ! 0 % Scratch ! ! 0 $ Scratch ! ! 1 % Bit encoded flags (see below) ! ! 1 $ Top level directory specification ! ! 9 % Bit flags from initializer ! ! 9 $ File specification for memory ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Bit encoded flags (in Q-reg 1) ! ! Load VTEDIT +1 ! ! Inspect file +2 ! ! Don't use memory +4 ! ! Find position marker +8 ! ! Use VTEDIT SEEALL mode +16 ! ! Use VTEDIT hold mode +32 ! ! Force memory write +8192 ! ! Announce file used +16384 ! ! Memory used +32768 ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Set up our operating environment ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Shut ourselves off (** deleted if we're in Y) ! @EI%% ! Remove old copy (** deleted if we're in Y) ! 0,0XY ! Save old context; set our context ! [9 0,0X9 [0 0,0X0 10U0 [0 ^D ^XU0 [0 0^X EDU0 [0 ED&4ED EUU0 [0 -1EU ESU0 [0 0ES ETU0 [0 32768#32#8#1,0ET Q1U0 0U1 [1 0,0X1 ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Try for private command decoder ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Do EITECO$ if not already tried ! Q0"E :@EI%TECO%"S ]1 -1U1 [1 @O!DONE! ' ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Do initial set up ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Get command into text buffer if not already ! Z"E GZ 0,0XZ ' ! Fix up spacing on command ! J ::@FS%^ES%%^[ ZJ < -Z; -1A-32"N -1A-9"N 0; ' ' -D > ! Just quit if no command at all ! Z"E @O!DONE! ' ! Default all bit encoded flags to off ! 0U1 ! Default directory specification to null ! 0,0X1 ! Default memory file specification to null ! 0,0X9 ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Handle private initializers ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Parse /NOINI if present ! J :@FS%^ES/NOI%%"S @O!/NOINI! ' J :@FS%/NOI%%"S !/NOINI! ::@FS%N%%"S ::@FS%I%%^[ ' ::@FS%^ES%%"S 0A"A @I% % ' ' | ! Start of private initializer processing ! HX0 HK EP EA EF ! Use built in "INI" and "MEM" if available ! :@EG%INI%"S G* J ::@S%$%"S .,ZX1 :@ER%^EQ1%"S HK Y HX1 HK EC G1 ' ' 0,0X1 | ! Else form default directory specification ! 0,0X1 -1EJ-5"E @EN%*.*% :@EN%%"S G* J @S%[% R 0K @FS%.%]% J @S%]% 0,.X1 HK ' ' ! Try for initialization from TECO.INI ! :@ER%^EQ1TECO.INI%"S Y HX9 HK EC G9 0,0X9 ' ' ! Form file specification of memory ! G1 ^YX9 ^YK :@^U9%TECF% 0EJ+100\ .-2,.:X9 -3D :@^U9%.TMP% -1EJ-4"E :@^U9%<60>/MODE:#3000% | -1EJ-7"N :@^U9%;1/-CR% ' ' ! Use private initializer code if any ! @ER%% @EW%% Z"N :@^U9%=% G0 ^Y:X9 ^YK ]1 ]0 Q0ET ]0 Q0ES ]0 Q0EU ]0 Q0ED ]0 Q0^X ]0 Q0^R HX0 HK G9 J @S%=% 0,.-1X9 0,.K M0+0U9 0,0X0 10U0 [0 ^D ^XU0 [0 0^X EDU0 [0 ED&4ED EUU0 [0 -1EU ESU0 [0 0ES ETU0 [0 32768#32#8#1,0ET [1 J G9 .U0 -@S%TECF^ED^ED.TMP% 0,.-10X1 0,Q0K ! Set initializer defaulted bit encoded flags ! Q9U1 ! Fix up spacing on command again ! J ::@FS%^ES%%^[ ZJ < -Z; -1A-32"N -1A-9"N 0; ' ' -D > ! Is there any command there at all? ! Z"E @O!VTEDIT! ' ! End of private initializer processing ! | G0 ' ' ! "TECO @file" is "MUNG file" if not RSTS/E ! -1EJ-4"N J ::@S%TE%"S < 0A"A C > ' ::@S%^ES@%"S 0K @I%MUNG % ' ' ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Decode MUNG command ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Is the command 'MUNG' ? ! J ::@FS%MU%%"S ! Yes, it is 'MUNG', do correct thing ! < 0A"A D > ' ::@FS%^ES%%^[ ! Isolate the file to MUNG and argument string ! HX0 ZU0 J :@S%,%"S R .U1 Q1J -:@S%[%"S :@S%]%"S .-Q1"G %1^[ ' ' | Q1J -:@S%<%"S :@S%>%"S .-Q1"G %1^[ ' ' | Q1J -:@S%(%"S :@S%)%"S .-Q1"G %1^[ ' ' ' ' ' Q1J :@S%,%"S < -D -.; -1A-32"N -1A-9"N 0; ' ' > 0,.X0 ::@S%^ES%^[ .U0 ' ' 0,Q0K :Q0"E @^A/?How can I MUNG nothing? / ^C^C ' @EI%^EQ0% @O!DONE! ! End of 'MUNG' command processing ! ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Decode common command switches ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Parse /VTEDIT if present ! J :@FS%^ES/VT%%"S @O!/VTEDIT! ' J :@FS%/VT%%"S !/VTEDIT! ::@FS%E%%"S ::@FS%D%%"S ::@FS%I%%"S ::@FS%T%%^[ ' ' ' ! Sub-parse :HOLD if present ! ::@FS%:H%%"S ::@FS%O%%"S ::@FS%L%%"S ::@FS%D%%^[ ' ' Q1#32U1 ' ! Sub-parse :SEEALL if present ! ::@FS%:S%%"S ::@FS%E%%"S ::@FS%E%%"S ::@FS%A%%"S ::@FS%L%%"S ::@FS%L%%^[ ' ' ' ' Q1#16U1 ' ! Sub-parse :HOLD again if present ! ::@FS%:H%%"S ::@FS%O%%"S ::@FS%L%%"S ::@FS%D%%^[ ' ' Q1#32U1 ' ::@FS%^ES%%"S 0A"A @I% % ' ' Q1#1U1 ' ! Parse /NOMEMORY if present ! J :@FS%^ES/NOM%%"S @O!/NOMEMORY! ' J :@FS%/NOM%%"S !/NOMEMORY! ::@FS%E%%"S ::@FS%M%%"S ::@FS%O%%"S ::@FS%R%%"S ::@FS%Y%%^[ ' ' ' ' ::@FS%^ES%%"S 0A"A @I% % ' ' Q1#4U1 ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Decode TECO command ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Is the command 'TECO' ? ! J ::@FS%TE%%"S ! Yes, it is 'TECO', do correct thing ! < 0A"A D > ' ::@FS%^ES%%^[ ! Parse /INSPECT if present ! J :@FS%^ES/IN%%"S @O!/INSPECT! ' J :@FS%/IN%%"S !/INSPECT! ::@FS%S%%"S ::@FS%P%%"S ::@FS%E%%"S ::@FS%C%%"S ::@FS%T%%^[ ' ' ' ' ::@FS%^ES%%"S 0A"A @I% % ' ' Q1#2U1 ' ! Parse /FIND if present ! J :@FS%^ES/FI%%"S @O!/FIND! ' J :@FS%/FI%%"S !/FIND! ::@FS%N%%"S ::@FS%D%%^[ ' ::@FS%^ES%%"S 0A"A @I% % ' ' Q1#8U1 ' ! Now we can strip out all spaces/tabs ! J < @FS%^ES%%; > ! Default file if none and not /NOMEMORY ! Q1&4#Z"E :@EG%MEM%"S G* | ! Form default directory specification if none ! :Q1"E -1EJ-5"E @EN%*.*% :@EN%%"S G* J @S%[% R 0K @FS%.%]% J @S%]% 0,.X1 HK ' ' ' ! Form file specification of memory if none ! :Q9"E 0EJ+100\ J D G1 @I%TECF% ZJ @I%.TMP% -1EJ-4"E @I%<60>/MODE:#3000% | -1EJ-7"N @I%;1/-CR% ' ' HX9 HK ' ! Try to read the memory file ! EP EA EF :@ER%^EQ9%"S Y HX0 HK EC G0 0,0X0 ' @ER%% @EW%% ' ! Strip out all spaces/tabs from memory ! J < @FS%^ES%%; > ! Parse /FIND on memory if present ! J :@FS%/FI%%"S ::@FS%N%%"S ::@FS%D%%^[ ' Q1#8192#8U1 ' ! Say memory used if we found something ! Z"N Q1#32768#16384U1 ' ' ! Announce the file if requested ! Q1&16384"N Q1&2"E @^A/Edi/ | @^A/Inspec/ ' @^A/ting file "/ HT @^A/" / ' ! Exit or error if no file ! Z"E Q1&2"E @O!VTEDIT! ' @^A/?How can I inspect nothing? / ^C^C ' ! Check for output=input format ! Q1&2"E J :@S%=%"S 0,.-1X0 0,.K ZU0 [0 HX0 HK :Q0"N :@ER%^EQ0%"U G0 ]0 HX0 HK @O!NOTFND! ' ' ]0 :Q0"N @EW%^EQ0% ' Q0"N Y ' @O!REMEM! ' ' ! Check for editing file ! HX0 HK Q1&2"E :@EB%^EQ0%"S Y @O!REMEM! ' @^A/%Can't find file "/ :G0 @^A/" / Q1&32768"E @^A/%Creating new file / @O!CREATE! | @^A/%Ignoring TECO's memory / Q1#8192U1 0,0X0 @O!REMEM! ' ' ! It must be inspect file by now... ! :@ER%^EQ0%"S Y @O!VTEDIT! ' ! File not found type error, so say so ! !NOTFND! @^A/?Can't find file "/ :G0 @^A/"? / ^C^C ! End of 'TECO' command processing ! ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Decode MAKE command ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Is the command 'MAKE' ? ! J ::@FS%MA%%"S ! Yes, it is 'MAKE', do correct thing ! < 0A"A D > ' ::@FS%^ES%%^[ ! Now we can strip out all spaces/tabs ! J < @FS%^ES%%; > ! Check for null and fancy messages... ! Z"E @^A/?How can I MAKE nothing? / ^C^C ' Z-4"E J ::@S%LOVE%"S @^A/Not war? / ' ' ! Set file for creation ! HX0 HK ! Do file creation ! !CREATE! @EW%^EQ0% @O!REMEM! ! End of 'MAKE' command processing ! ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! We couldn't recognize the command ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! We could not recognize this command ! @^A/%Unrecognized command "/ HT HK @^A/" / @O!VTEDIT! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Write TECO's memory ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Remember the file name in Q0 if desired ! !REMEM! Q1&8192"N @O!WRITE! ' Q1&(32768#4)"N @O!VTEDIT! ' :Q0"E @O!VTEDIT! ' ! Write the memory ! !WRITE! :@EG%MEM ^EQ0%"U ! Form default directory specification if none ! :Q1"E -1EJ-5"E @EN%*.*% :@EN%%"S ZJ .U0 G* Q0J @S%[% R Q0,.K @FS%.%]% Q0J @S%]% Q0,.X1 Q0,ZK ' ' ' ! Form file specification of memory if none ! :Q9"E G1 ^YX9 ^YK :@^U9%TECF% 0EJ+100\ .-2,.:X9 -3D :@^U9%.TMP% -1EJ-4"E :@^U9%<60>/MODE:#3000% | -1EJ-7"N :@^U9%;1/-CR% ' ' ' ! Write the memory file ! EA :@EW%^EQ9%"S G0 ^YPW ^YK ' EF @EW%% ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Invoke VTEDIT ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! If /VTEDIT specified, set up scope modes ! !VTEDIT! Q1&1"N ET&512"E @^A/%Your terminal is not an interactive scope. / | 0,3:W^[ Q1&16"N -1,3:W^[ ' 0,5:W^[ Q1&32"N -1,5:W^[ ' ! Form default directory specification if none ! :Q1"E -1EJ-5"E @EN%*.*% :@EN%%"S ZJ .U0 G* Q0J @S%[% R Q0,.K @FS%.%]% Q0J @S%]% Q0,.X1 Q0,ZK ' ' ' ! Try to get the VTEDIT macro ! :@EI%^EQ1VTEDIT%"U -1EJ-4"E @^U1%$% ' -1EJ-7"E @^U1%SY:% ' -1EJ-5"E @^U1%SYS$LIBRARY:% ' :@EI%^EQ1VTEDIT%"U @^A/%The VTEDIT macro is not available. / ' ' ' ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Find position marker ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! If /FIND specified, find the ~~/\~~ ! !FIND! Q1&8"N @^A/Finding position marker... / @EW%% G* ^YX0 ^YK -1^X :Q0"N :@FN%~~/\~~ %%U0 | :@F_%~~/\~~ %%U0 ' 0^X Q0"U @^A/?Position marker not found? / ^C^C ' ' ! - - - - - - - - - - - - - - - - - - - - - - - ! ! Restore caller's operating environment ! ! - - - - - - - - - - - - - - - - - - - - - - - ! ! All finished, restore context ! !DONE! J ]1 ]0 Q0ET ]0 Q0ES ]0 Q0EU ]0 Q0ED ]0 Q0^X ]0 Q0^R ]0 ]9 ! 0,0XY (** added if we're in Y) ! ! Final double ESCape (** deleted if we're in Y)!