source: trunk/third/transcript/lib/psdit.pro @ 9090

Revision 9090, 10.2 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9089, which included commits to RCS files with non-trunk default branches.
Line 
1% psdit.pro -- prolog for ditroff translator
2% Copyright (c) 1985,1987,1992 Adobe Systems Incorporated. All Rights
3% Reserved. 
4% GOVERNMENT END USERS: See Notice file in TranScript library directory
5% -- probably /usr/lib/ps/Notice
6% RCS: $Header: /afs/dev.mit.edu/source/repository/third/transcript/lib/psdit.pro,v 1.1.1.1 1996-10-07 20:25:31 ghudson Exp $
7/$DITroff 180 dict def $DITroff begin
8
9% Psfig additions
10/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecap
11currentlinejoin currentdash currentgray currentmiterlimit ] cvx def
12
13/startFig {
14        /SavedState save def
15        userdict maxlength dict begin
16        currentpoint transform
17
18        DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap
19                setlinewidth setmatrix
20
21        itransform moveto
22
23        /ury exch def
24        /urx exch def
25        /lly exch def
26        /llx exch def
27        /y exch 72 mul resolution div def
28        /x exch 72 mul resolution div def
29       
30        currentpoint /cy exch def /cx exch def
31
32        /sx x urx llx sub div def       % scaling for x
33        /sy y ury lly sub div def       % scaling for y
34
35        sx sy scale                     % scale by (sx,sy)
36
37        cx sx div llx sub
38        cy sy div ury sub translate
39       
40        /DefFigCTM matrix currentmatrix def
41
42        /initmatrix {
43                DefFigCTM setmatrix
44        } def
45        /defaultmatrix {
46                DefFigCTM exch copy
47        } def
48
49        /initgraphics {
50                DocumentInitState setmiterlimit setgray setdash
51                        setlinejoin setlinecap setlinewidth setmatrix
52                DefFigCTM setmatrix
53        } def
54
55        /showpage {
56                initgraphics
57        } def
58
59} def
60% Args are llx lly urx ury (in figure coordinates)
61/clipFig {
62        currentpoint 6 2 roll
63        newpath 4 copy
64        4 2 roll moveto
65        6 -1 roll exch lineto
66        exch lineto
67        exch lineto
68        closepath clip
69        newpath
70        moveto
71} def
72% doclip, if called, will always be just after a `startfig'
73/doclip { llx lly urx ury clipFig } def
74/endFig {
75        end SavedState restore
76} def
77/globalstart {
78        % Push details about the enviornment on the stack.
79        fontnum fontsize fontslant fontheight firstpage
80        mh my resolution slotno currentpoint
81        pagesave restore gsave
82} def
83/globalend {
84        grestore moveto
85        /slotno exch def /resolution exch def /my exch def
86        /mh exch def /firstpage exch def /fontheight exch def
87        /fontslant exch def /fontsize exch def /fontnum exch def
88        F
89        /pagesave save def
90} def
91
92%% end XMOD additions
93/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def
94/xi {/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F
95  }def
96/ps {/pagesave save def 72 mul 0 exch translate 72 resolution div dup neg
97      scale 0 0 moveto } def
98/PB{save /psv exch def currentpoint translate
99  resolution 72 div dup neg scale 0 0 moveto}def
100/PE{psv restore}def
101/m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def
102/tan{dup sin exch cos div}bind def
103/point{resolution 72 div mul}bind def
104/dround {transform round exch round exch itransform}bind def
105/xT{/devname exch def}def
106/xr{/mh exch def /my exch def /resolution exch def}def
107/xp{}def
108/xs{docsave restore end}def
109/xt{}def
110/xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not
111 {fonts slotno fontname findfont put fontnames slotno fontname put}if}def
112/xH{/fontheight exch def F}bind def
113/xS{/fontslant exch def F}bind def
114/s{/fontsize exch def /fontheight fontsize def F}bind def
115/f{/fontnum exch def F}bind def
116/F{fontheight 0 le {/fontheight fontsize def}if
117   fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore
118   fontslant 0 ne{1 0 fontslant neg tan 1 0 0 m2 astore m3 concatmatrix}if
119   makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}bind def
120/X{exch currentpoint exch pop moveto show}bind def
121/N{3 1 roll moveto show}bind def
122/Y{exch currentpoint pop exch moveto show}bind def
123/S /show load def
124/ditpush{}def/ditpop{}def
125/AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}bind def
126/AN{4 2 roll moveto 0 exch ashow}bind def
127/AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}bind def
128/AS{0 exch ashow}bind def
129/MX{currentpoint exch pop moveto}bind def
130/MY{currentpoint pop exch moveto}bind def
131/MXY /moveto load def
132/cb{pop}def     % action on unknown char -- nothing for now
133/n{}def/w{}def
134/p{pop pagesave restore showpage}def
135/abspoint{currentpoint exch pop add exch currentpoint pop add exch}def
136/dstroke{currentpoint stroke moveto}bind def
137/Dl{2 copy gsave rlineto stroke grestore rmoveto}bind def
138/arcellipse{oldmat currentmatrix pop
139 currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def
140 rad 0 rad -180 180 arc oldmat setmatrix}def
141/Dc{gsave dup /diamv exch def /diamh exch def arcellipse dstroke
142    grestore diamh 0 rmoveto}def
143/De{gsave /diamv exch def /diamh exch def arcellipse dstroke
144    grestore diamh 0 rmoveto}def
145/Da{currentpoint /by exch def /bx exch def /fy exch def /fx exch def
146   /cy exch def /cx exch def /rad cx cx mul cy cy mul add sqrt def
147   /ang1 cy neg cx neg atan def /ang2 fy fx atan def cx bx add cy by add
148   2 copy rad ang1 ang2 arcn stroke exch fx add exch fy add moveto}def
149/Barray 200 array def % 200 values in a wiggle
150/D~{mark}def
151/D~~{counttomark Barray exch 0 exch getinterval astore /Bcontrol exch def pop
152 /Blen Bcontrol length def Blen 4 ge Blen 2 mod 0 eq and
153 {Bcontrol 0 get Bcontrol 1 get abspoint /Ycont exch def /Xcont exch def
154  Bcontrol 0 2 copy get 2 mul put Bcontrol 1 2 copy get 2 mul put
155  Bcontrol Blen 2 sub 2 copy get 2 mul put
156  Bcontrol Blen 1 sub 2 copy get 2 mul put
157  /Ybi /Xbi currentpoint 3 1 roll def def 0 2 Blen 4 sub
158  {/i exch def
159   Bcontrol i get 3 div Bcontrol i 1 add get 3 div
160   Bcontrol i get 3 mul Bcontrol i 2 add get add 6 div
161   Bcontrol i 1 add get 3 mul Bcontrol i 3 add get add 6 div
162   /Xbi Xcont Bcontrol i 2 add get 2 div add def
163   /Ybi Ycont Bcontrol i 3 add get 2 div add def
164   /Xcont Xcont Bcontrol i 2 add get add def
165   /Ycont Ycont Bcontrol i 3 add get add def
166   Xbi currentpoint pop sub Ybi currentpoint exch pop sub rcurveto
167  }for dstroke}if}def
168end
169/ditstart{$DITroff begin
170 /nfonts 60 def                 % NFONTS makedev/ditroff dependent!
171 /fonts[nfonts{0}repeat]def
172 /fontnames[nfonts{()}repeat]def
173/docsave save def
174}def
175
176% character outcalls
177/oc {/pswid exch def /cc exch def /name exch def
178   /ditwid pswid fontsize mul resolution mul 72000 div def
179   /ditsiz fontsize resolution mul 72 div def
180   ocprocs name known{ocprocs name get exec}{name cb}
181   ifelse}def
182/fractm [.65 0 0 .6 0 0] def
183/fraction
184 {/fden exch def /fnum exch def gsave /cf currentfont def
185  cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto
186  fnum show rmoveto currentfont cf setfont(\244)show setfont fden show
187  grestore ditwid 0 rmoveto} def
188/oce {grestore ditwid 0 rmoveto}def
189/dm {ditsiz mul}def
190/ocprocs 50 dict def ocprocs begin
191(14){(1)(4)fraction}def
192(12){(1)(2)fraction}def
193(34){(3)(4)fraction}def
194(13){(1)(3)fraction}def
195(23){(2)(3)fraction}def
196(18){(1)(8)fraction}def
197(38){(3)(8)fraction}def
198(58){(5)(8)fraction}def
199(78){(7)(8)fraction}def
200(sr){gsave .05 dm .16 dm rmoveto(\326)show oce}def
201(is){gsave 0 .15 dm rmoveto(\362)show oce}def
202(->){gsave 0 .02 dm rmoveto(\256)show oce}def
203(<-){gsave 0 .02 dm rmoveto(\254)show oce}def
204(==){gsave 0 .05 dm rmoveto(\272)show oce}def
205end
206%%BeginResource: font DIThacks
207% DIThacks fonts for some special chars
20850 dict dup begin
209/FontType 3 def
210/FontName /DIThacks def
211/FontMatrix [.001 0.0 0.0 .001 0.0 0.0] def
212/FontBBox [-220 -280 900 900] def% a lie but ...
213/Encoding 256 array def
2140 1 255{Encoding exch /.notdef put}for
215Encoding
216 dup 8#040/space put %space
217 dup 8#110/rc put %right ceil
218 dup 8#111/lt put %left  top curl
219 dup 8#112/bv put %bold vert
220 dup 8#113/lk put %left  mid curl
221 dup 8#114/lb put %left  bot curl
222 dup 8#115/rt put %right top curl
223 dup 8#116/rk put %right mid curl
224 dup 8#117/rb put %right bot curl
225 dup 8#120/rf put %right floor
226 dup 8#121/lf put %left  floor
227 dup 8#122/lc put %left  ceil
228 dup 8#140/sq put %square
229 dup 8#141/bx put %box
230 dup 8#142/ci put %circle
231 dup 8#143/br put %box rule
232 dup 8#144/rn put %root extender
233 dup 8#145/vr put %vertical rule
234 dup 8#146/ob put %outline bullet
235 dup 8#147/bu put %bullet
236 dup 8#150/ru put %rule
237 dup 8#151/ul put %underline
238 pop
239/DITfd 100 dict def
240/BuildChar{0 begin
241 /cc exch def /fd exch def
242 /charname fd /Encoding get cc get def
243 /charwid fd /Metrics get charname get def
244 /charproc fd /CharProcs get charname get def
245 charwid 0 fd /FontBBox get aload pop setcachedevice
246 40 setlinewidth
247 newpath 0 0 moveto gsave charproc grestore
248 end}def
249/BuildChar load 0 DITfd put
250%/UniqueID 5 def
251/CharProcs 50 dict def
252CharProcs begin
253/space{}def
254/.notdef{}def
255/ru{500 0 rls}def
256/rn{0 750 moveto 500 0 rls}def
257/vr{20 800 moveto 0 -770 rls}def
258/bv{20 800 moveto 0 -1000 rls}def
259/br{20 770 moveto 0 -1040 rls}def
260/ul{0 -250 moveto 500 0 rls}def
261/ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def
262/bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def
263/sq{80 0 rmoveto currentpoint dround newpath moveto
264    640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def
265/bx{80 0 rmoveto currentpoint dround newpath moveto
266    640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def
267/ci{355 333 rmoveto currentpoint newpath 333 0 360 arc
268    50 setlinewidth stroke}def
269
270/lt{20 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def
271/lb{20 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def
272/rt{20 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def
273/rb{20 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def
274/lk{20 800 moveto 20 300 -280 300 s4 arcto pop pop 1000 sub
275    currentpoint stroke moveto
276    20 300 4 2 roll s4 a4p 20 -200 lineto stroke}def
277/rk{20 800 moveto 20 300 320 300 s4 arcto pop pop 1000 sub
278    currentpoint stroke moveto
279    20 300 4 2 roll s4 a4p 20 -200 lineto stroke}def
280/lf{20 800 moveto 0 -1000 rlineto s4 0 rls}def
281/rf{20 800 moveto 0 -1000 rlineto s4 neg 0 rls}def
282/lc{20 -200 moveto 0 1000 rlineto s4 0 rls}def
283/rc{20 -200 moveto 0 1000 rlineto s4 neg 0 rls}def
284end
285
286/Metrics 50 dict def Metrics begin
287/.notdef 0 def
288/space 500 def
289/ru 500 def
290/br 0 def
291/lt 250 def
292/lb 250 def
293/rt 250 def
294/rb 250 def
295/lk 250 def
296/rk 250 def
297/rc 250 def
298/lc 250 def
299/rf 250 def
300/lf 250 def
301/bv 250 def
302/ob 350 def
303/bu 350 def
304/ci 750 def
305/bx 750 def
306/sq 750 def
307/rn 500 def
308/ul 500 def
309/vr 0 def
310end
311
312DITfd begin
313/s2 500 def /s4 250 def /s3 333 def
314/a4p{arcto pop pop pop pop}def
315/2cx{2 copy exch}def
316/rls{rlineto stroke}def
317/currx{currentpoint pop}def
318/dround{transform round exch round exch itransform} def
319end
320end
321/DIThacks exch definefont pop
322%%EndResource
Note: See TracBrowser for help on using the repository browser.