Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/macros/maktec.tco
There is 1 other file named maktec.tco in the archive. Click here to see a list.
!;MAKTEC -- A TECO macro to produce .TEC files from .TCO files	!
!;Author: Clive B. Dawson -- Univ. of Texas at Austin		!
!; Editor:							!
!;	R. McQueen -- Stevens Institute of Technology		!
!;This macro reads a specially formated TECO program (.TCO file)!
!;and converts it to a real TECO macro (.TEC file).		!
!;This provides a simpler mechanism for writing TECO programs,!
!;since easy mechnisms are provided for inserting altmodes and	!
!;other control characters.  Programs are also easier to format	!
!;since you can use tabs for indenting and lining up comments.	!
!;Finally, TECO macros are made more efficient by stripping the	!
!;comments out of the "production" version.			!
!;The following steps are taken:				!
!;	1.  All dollar signs are converted to escapes		!
!;	2.  Removes all tabs					!
!;	3.  All strings of the form <excl><semicolon>...<excl>	!
!;	    are removed.  Following <CR><LF>'S are removed.	!
!;	4.  All strings of the form <up-arrow><char> are	!
!;	    converted to <control-char>.			!
!;Note: It will usually be necessary to quote certain characters!
!;such as tabs, dollar signs, up-arrows, and some exclamation	!
!;points if they are to remain intact.  The quote character used!
!;is the "`" (ASCII 140).  "``" is converted to "`".		!

	:ER.tco$"U'			!;Set default extension to .TCO!
	13I$ 10I$ HXf HK		!;Put crlf in Qf!
	EEmaktec$			!;Create a .SAV file!
	^A"?" for help.^A		!;Greeting!
!START!	Qf= ^AFile: ^A			!;Ask for file name!
	HK I:ER$ .U1			!;Begin building ER command!
!GETCH!	^TUt				!;Get a char!
	Qt-^o77 "E ^A
Type the file name of the TECO program file that you want
that you want converted to a .TEC file.  End with a <CR>.^A OSTART$ '
	Qt-^o10 "E Q1-."E OSTART$ ' ^A ^A :^o10,1^T -D OGETCH$ ' !;^H!
	Qt-^o177"E Q1-."E OSTART$ ' .-1,.T          -D OGETCH$ ' !;<DEL>!
	Qt-^o25 "E ^A^U^A :^o15,1^T :^o12,1^T          OSTART$ ' !;^U!
	Qt-^o22 "E ^A^A   :^o15,1^T :^o12,1^T Q1,.T    OGETCH$ ' !;^R!
	Qt-^o15 "N QtI$ OGETCH$ ' 	!;Insert normal chars!
	^T$ I/MODE:ASCII^R$$	!;Eat the lf, insert escape!
	HXt Mt"F ^AFile not found.^A OSTART$ ' !;Read the file!

	HK Gf				!;Wipe the buffer, insert a crlf!
	EW.tec$ EIted:ha$		!;Open output, and read in whole file!
	J <S````$;-2D 0I$>		!;Convert all quoted quotes to nulls!
	J <S^Gf`!;$; .-2U1		!;Search for comment at start of line!
	   S`!$				!;Move to end of comment!
	   :.,.+2S^Gf$"S Q1,.K'		!;Remove whole line comment!
	   2R>				!;Backup over first crlf and loop!
	J <S^N```!;$; -2D FD`!$;	!;Get rid of comments!
		:.,.+2S^Gf$"S .-2,.K' R>!; and following CRLF!
	J <S^N```^$;			!;Search for <up-arrow><char>!
	   1A-^O100"G 1AU1 -DD		!;Is it a potential control char?!
		      Q1-96"G Q1-32U1'	!;Yes, see if lower case!
		      Q1-^O100U1	!;Bring down to control-range!
		      Q1I$ 		!;Insert control char!
	  R >				!;Backup one and loop!

	J <S^N``^E<44>$; -D I^R$$ R>	!;Change dollar signs to altmodes!
	J <S^N``^E<11>$; -D R>		!;Get rid of all tabs!
	J <FS``$^V$;>			!;Delete quotes!
	J <FS^E<0>$``$;>		!;Bring back real quotes!
	J 2D				!;Delete the initial crlf!
	HP EF ^C			!;Close the file and exit!