Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

yet another lineprinter emulator

24 views
Skip to first unread message

luserXtrog

unread,
Sep 18, 2010, 7:03:38 AM9/18/10
to
539(1)06:01 AM:ps 0> cat tt.ps
%!
%teletype emulator

/in { 72 mul } def
/switch { exch 2 copy known not { pop /default } if get exec } def

/X 8.5 in def
/Y 11 in def
/Courier 10 selectfont
/y 11 def
/x 7 def

/code <<
/bs { x neg 0 rmoveto }
/cr { 0 currentpoint exch pop moveto }
/lf { 0 y neg rmoveto }
/ff { showpage 0 Y moveto lf }
/advance { x 0 rmoveto }
/can {
{
currentpoint pop 0 lt { exit } if
bs (/) emit
bs (\\) emit
bs
} loop
}
/emit { currentpoint 3 -1 roll show moveto advance }
>> def

/ascii {
%16#00
%^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O
%nul soh stx etx eot enq ack bel bs ht lf vt ff cr so si
{} {} {} {} {} {} {} {} {bs} {} {cr lf} {} {ff} {cr} {} {}
%16#10
%^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_
% XON XOFF
%dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fc gs rs us
{} {} {} {} {} {can} {} {} {can} {} {} {} {} {} {} {}
%16#20
{advance}
(!) (") (#) ($) (%) (&) (') (\() (\)) (*) (+) (,) (-) (.) (/)
%16#30
(0) (1) (2) (3) (4) (5) (6) (7) (8) (9) (:) (;) (<) (=) (>) (?)
%16#40
(@) (A) (B) (C) (D) (E) (F) (G) (H) (I) (J) (K) (L) (M) (N) (O)
%16#50
(P) (Q) (R) (S) (T) (U) (V) (W) (X) (Y) (Z) ([) (\\) (]) (^) (_)
%16#60
(`) (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) (m) (n) (o)
%16#70
(p) (q) (r) (s) (t) (u) (v) (w) (x) (y) (z) ({) (|) (}) (~)
%16#7F
%^?
{}
} cvlit def

/tt {
code begin
ascii exch get dup type <<
/default { (unrecognized) perror }
/arraytype { exec }
/stringtype { emit }
>> switch
end
} def

/dotty {
0 Y y sub moveto
{
%(%stdin) (r) file
currentfile
80 string readline {
/tt load forall
8#012 tt
} { pop exit } ifelse
} loop
showpage
} def

dotty
A simple line printer emulator.
Only ascii printable characters and backspace,
which allows:
xxxxxxxxxx
and total line cancellation▒
ancient ^gliness in modern guise.

#eof
540(1)06:01 AM:ps 0>

0 new messages