!SQUSQU.TES V1.00! ! --------------------------------------------------------------------- ! ! ! ! TECO macro to produce SQUSQU.TEC from itself. Then SQUSQU.TEC will ! ! be used to produce SQU.TEC from SQU.TES. The conversion of SQU will ! ! be performed in two passes. This conversion process is required ! ! because SQU.TES is not directly runable and it would be agonizingly ! ! slow if it were. Another reason is that not all versions of TECO can ! ! run an EImacro$ that is larger than 64K bytes. Well here goes... ! !.iif 0 ! @I~ ! First insert myself into the edit buffer. ! ! unless SQU is squishing SQUSQU ! !SQUSQU.TEC V1.00 - Macro to produce SQU.TEC from SQU.TES! ET&1024"N ! see if refresh type scope ! @^UW#W# ! yes make Qw a W ! | ! else ! @^UW#V# ! yes make Qw a V ! ' ! endif ! Z"E ! if empty edit buffer we are squishing SQU.TES ! @:ER%SQU.TES%"F ! See if SQU.TES is found ! @^A%SQU.TES Not found!% ! not found, print error ! @O!EXIT! ! goto exit ! ' ! endif, SQU.TES was found ! @EW%SQU.TEC% ! open file for first pass ! ' ! endif ! 1,0ED ! ^ in search strings means Control next char ! @^A% Compressing file...% < ! loop ! ZJ ! go to end of buffer ! 1:A; ! append 1 line, exit loop if no more ! @:FS`^ES ` `$ ! remove any trailing , ignore error ! ZJ ! position to eob ! -3A-^^!"E ! if last char on line an exclamation point ! -2@S`!` ! backup to preceeding exclamation point ! ::@S`^ES`"S ! if ! .+^S-1,Z-2K ! kill comment ! MW ! see result of K ! ' ! endif (deleteable comment ! ' ! endif line ending in comment ! > ! end loop, all comments out ! ZJ ! go to end of buffer ! < ! loop ! -@:S`^E<10>!.iif`; ! if no .iif exit ! @S`!` ! find end of .iif ! ::@S`^ES`$ ! span ! 0K ! kill to start of line ! MW ! see replace ! > ! end loop ! ZJ ! go to end of buffer ! < ! loop ! -@:FS` ^ES` `; ! replace with ! MW ! see replace ! > ! end loop ! J ! beginning of buffer ! < ! loop ! @:FS`^ES ` `; ! replace with ! MW ! see replace ! > ! end loop ! < ! loop ! @:FD`^EM^E<9>`; ! delete all s ! MW ! see replace ! > ! end loop ! EC ! close first pass on SQU ! @I%SQU% ! insert name of file to squish ! @EI%SQU% ! now squish SQU again with SQU ! !EXIT! !.iif 0 ! ~ ! The tilda above finishes the insert of the un-squished SQUSQU.TEC ! ! The first thing we must do is remove the comments. The following is ! ! a compressed version of inner loop #1 above. If you wish you may ! ! read the commented version above. Note, no tabs used below here. ! 0J! no tabs any more !! go back to in front of text inserted ! 1,0ED! !! ^ in search strings means Control next char ! <@:FS%^EM^E<9>% %;>! !! replace all tabs with space ! HXM! !! place tab replaced macro into Q-reg m ! @EW%SQUSQU.TEC%! !! open the compressed version of SQUSQU ! EC! !! close out first pass of SQUSQU ! @EB%SQUSQU.TEC%! !! open the compressed version of SQUSQU ! 1:A$! !! get first line of SQUSQU so as to make Z.gt.0 ! MM! !! perform SQUSQU on itself (to remove comments) ! HK! !! kill buffer ! @EI%SQUSQU%! !! startup SQUSQU.TEC which will now squish SQU !