[comp.sys.atari.st] A program to print files, expanding tabs

braner@batcomputer.tn.cornell.edu (braner) (01/14/87)

[]

Many printers don't know how to handle tab characters (ASCII 9),
or at least require that you set up tab stops explicitly.  A pain
when you want a quick printout of, say, a program listing.

Here is a little utility that will expand tabs to spaces and print
the file.  It assumes a tab stop every 8 columns.  Note that embedded
control characters (besides cr/lf and tabs) will confuse the column
count for the rest of that line.

Note that this program replaces "lpr.ttp" (in micro-C-Shell).

- Moshe Braner

~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~
begin 644 PRINT.TOS
M8!H   *"                             "IO  0@/   *  O "\-0F<_
M/ !*3D'?_     Q*@&8  61(>0   CH_/  )3D%<CTGY   "A"8\    ,F$ 
M 71(>0   K@_/  :3D%<CT)G2'D   *$/SP 3DY!4(]*0&8  2)"9TAY   "
MA#\\ #U.05"/2D!K  $,,\    *"1?D   +D1_D   +D0D="1K7+90QA  "<
M9@  !E?'8%@:&@P%  UF&K7+90QA  "$9@  !E?'8$ :$@P%  IF.&#># 4 
M"F<P# 4 "686.CP (&$  $I21C & D  !V;N8 #_OF$  #A21F  _[1A  !"
M9@#_G%?'2@=G" P$  IG  !V.CP #6$  !0Z/  *80  #$H'9@  8&  _W(8
M!4B%/P4_/   /SP  TY-7(].=4JY   "TF<  #Q(>0   N0O/   )  _.0  
M H(_/  _3D'?_     Q*@&L  ")G   >D;D   +21?D   +D1_(( $J 3G5A
M   H8   (&$  "!(>0   FD_/  )3D%<CS\\  (_/  "3DU8CT)G3D$_.0  
M H(_/  ^3D%8CTYU0H0_/  "/SP  DY-6(\,   (9P  +@P  ']G   F#   
M#6<  $(,   @;0#_UK:$9P#_T!F 2 !2A&$  #Q@ /_"2H1G /^\4X00/  (
M80  *! \ "!A   @$#P "&$  !A@ /^>80  $! \  IA   (0C1( $YU/P _
M/  "/SP  TY-7(].=0T*"D5N=&5R(&YA;64@;V8@9FEL92!T;R!P<FEN=#H@
M  T*<V9I<G-T(&]K#0H #0H*5$]3(&5R<F]R(&]C8W5R<F5D(2       "0.
.$! 6% 8&K H,' 8:'@  
 
end

braner@batcomputer.tn.cornell.edu (braner) (01/15/87)

[]

Here is a vastly enhanced version of 'PRINT'.  Reminder: this program
prints a text file with tabs expanded into (8) spaces.  Added options:

	skip-over-the-perforation
	extra left margin
	manual entry of printer control characters

You may enter the options from the command line ([] means: optional):

	"[-s] [-m#] [-c] filename"

	-s  to skip over perforation
	-m# sets extra left margin to # columns
	-c  to get to type in printer control characters
		(you enter them interactively)

Alternatively, if the comand line is empty, PRINTER.TTP will ask you
about the file name and the options.

Enter control characters carefully: you cannot edit them.
End the control string with <Return> (use Control-M for ASCII 13).
Note that you enter TWO strings: one will be sent to the printer
before the file text, the other one afterwards.

You may abort the printout by pressing <Esc>.

This is a mundane but important utility.  It is written in assembler
language (for practice) and the source is available upon request.

- Moshe Braner

~~~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~~~
begin 644 print.ttp
M8!H   6L                             "IO  0@/   *@ O "\-0F<_
M/ !*3D'?_     Q*@&8  UA">0  !:Q">0  !:Y">0  !;#;_    ( 2'6=F
M2?D   6X4T$0'0P  "!G#@P   EG" P  "UG#!C 4<G_Z$(48   XA =4T$,
M  !39P8,  !S9@A7^0  !:Q@W@P  $-G!@P  &-F"%?Y   %KF#*#   36<&
M#   ;6:^80 #UF"X0?D   2:2?D   6X=E!A  +R0?D   2\2?D   8*=E!A
M  +@$!0,  !99P8,  !Y9AQ!^0  !-U)^0  !@IV4&$  L!+^0  !@IA  .&
M0?D   3X2?D   8*=E!A  *D$!0,  !95_D   6L9PH,  !Y5_D   6L0?D 
M  492?D   8*=E!A  )Z$!0,  !95_D   6N9PH,  !Y5_D   6N0CD   8*
M0CD   9<2GD   6N9R1!^0  !3I)^0  !@I"0V$  CQ!^0  !55)^0  !EQ"
M0V$  BI(>0  !JX_/  :3D%<CT)G2'D   6X/SP 3DY!4(]*0&8  =A"9TAY
M   %N#\\ #U.05"/2D!K  '",\    6R1_D   8*&AMG!F$  3A@]DGY   &
MVD?Y   &VD)Y   %M$)Y   %MDAY   %<#\\  E.05R/0D:\>0  !;!L"GH@
M80 ! %)&8.Y"1C\\  (_/  !3DU8CTI 9Q0_/  "/SP  DY-6(\,   ;9P !
M,+G+91!A  #B9@  "E?Y   %M&!>&AP,!0 -9AZYRV4080  QF8   I7^0  
M!;1@0AH4# 4 "F8Z8-H,!0 *9S(,!0 )9A1Z(&$  (I21C & D  !V;P8 #_
MO&$  'A21F  _[)A  ""9@#_EE?Y   %M$IY   %M&<(# 0 "F<  *YZ#6$ 
M $YZ"F$  $A*.0  !;1F  "82GD   6L9P#_)C Y   %ME) ,\    6V#$  
M/&T _Q!\!7H-80  %GH*80  $%'.__)">0  !;9@ /[T& 5(A3\%/SP  #\\
M  -.35R/3G5*N0  !LAG   \2'D   ;:+SP  "0 /SD   6R/SP /TY!W_P 
M   ,2H!K   R9P  +I&Y   &R$GY   &VD?T" !*@$YU1_D   9<&AMG!F$ 
M_YI@]F$  "A@   @80  ($AY   %DC\\  E.05R//SP  C\\  ).35B/0F=.
M03\Y   %LC\\ #Y.05B/3G4O"#\\  E.05R/2D-F,G90/SP  C\\  ).35B/
M2$ ,   <9@1"%$YU2$ 8P#\ /SP !3\\  -.35R/4<O_U&#D0D0_/  "/SP 
M DY-6(\,   ;9P#_F P   AG   N#   ?V<  "8,   -9P  0@P  "!M /_.
MMD1G /_(&8!  %)$80  /&  _[I*1&< _[131! \  AA   H$#P (&$  " 0
M/  (80  &&  _Y9A   0$#P "F$   A"-$  3G4_ #\\  (_/  #3DU<CTYU
M0D(0'5-!2( $0  P;0X,0  );@C$_  *U$!@YC/"   %L$YU#0H*"45N=&5R
M(&YA;64@;V8@9FEL92!T;R!P<FEN=#H@  T*"4%D9"!A(&UA<F=I;B!A="!L
M969T(" H>2]N*3\@  T*"5=I9'1H(&]F(&QE9G0@;6%R9VEN.B @  T*"5-K
M:7 @;W9E<B!P97)F;W)A=&EO;B H>2]N*3\@  T*"5-E;F0@8V]N=')O;"!C
M;V1E<R @(" H>2]N*3\@  T*"4-H87)A8W1E<G,@=&\@<')E<&5N9#H@  T*
M"4-H87)A8W1E<G,@=&\@(&%P<&5N9#H@  T*"@E0<F5S<R \17-C/B!T;R!S
M=&]P('!R:6YT:6YG(  -"@H)5$]3(&5R<F]R(&]C8W5R<F5D(2       "0&
M!A X%!H&# 8:!@P*!A(,!@82# 8&!@@&# 8,$!84!A &!@8&$$0<1 8<"@H(
+(!X*#!P&#AP>_   
 
end

braner@batcomputer.tn.cornell.edu (braner) (01/16/87)

[]

Oops: A little bug in "print.ttp".

~~~~~~~~~~~~~~ to fix: ~~~~~~~~~~~~~~~~
Change the FIRST CODE LINE in the uuencoded "print.ttp":
OLD:
M8!H   6L                             "IO  0@/   *@ O "\-0F<_
NEW:
M8!H   6L                             "IO  0@/   +  O "\-0F<_

change:                                          ^^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Moshe Braner