One more check on valid display which is known to be in the startup
[xcircuit.git] / lib / xcircps2.pro
blobb8dd2acde5880b9155a4081411c9934ced68be78
1 %%BeginProlog
3 % PostScript prolog for output from xcircuit
4 % Version: 3.9
6 % Electrical circuit (and otherwise general) drawing program
8 % Written by Tim Edwards 8/5/93--4/12/16 (tim@opencircuitdesign.com)
9 % The Johns Hopkins University (1993-2004)
10 % MultiGiG, Inc. (2004-2012)
11 % Open Circuit Design (2012-2016)
13 %%BeginResource: procset XCIRCproc 3.9 1
15 % supporting definitions --- these are the primary xcircuit types.
17 /XCIRCsave save def
18 /topmat matrix currentmatrix def
20 /fontslant { /slant exch def [1 0 slant 1 0 0]
21 exch findfont exch makefont dup length dict /ndict exch def
22 { 1 index /FID ne { ndict 3 1 roll put } { pop pop } ifelse } forall
23 ndict definefont pop} def
24 /ul { count 0 gt { dup type /stringtype eq showflag 1 eq and { gsave
25 currentpoint topmat setmatrix 0 0 moveto 2 index stringwidth pop (_)
26 false charpath flattenpath pathbbox grestore exch pop 1 index
27 sub setlinewidth exch pop currentpoint 3 -1 roll add moveto 0
28 rlineto stroke moveto } if } if } def
29 /ol { count 0 gt { dup type /stringtype eq showflag 1 eq and { gsave gsave
30 currentpoint topmat setmatrix 2 index stringwidth pop 3 index
31 true charpath flattenpath pathbbox grestore exch pop
32 exch pop topmat setmatrix (_) true charpath pathbbox grestore
33 exch pop 1 index sub setlinewidth exch pop currentpoint
34 exch 4 1 roll exch sub add moveto pop 0 rlineto stroke
35 moveto } if } if } def
36 /stW { gsave currentpoint newpath moveto true charpath flattenpath
37 pathbbox pop exch pop sub grestore } def
38 /Ts {mark Tabs aload pop counttomark 1 add array astore /Tabs exch def Tabs
39 0 currentpoint pop put} def
40 /Tbn {mark Tabs aload pop counttomark dup 2 add 1 roll cleartomark 1 sub} def
41 /Tb { 0 1 Tbn {Tabs exch get dup currentpoint pop lt
42 {currentpoint exch pop moveto exit} {pop} ifelse } for } def
43 /Tf { Tbn -1 0 {Tabs exch get dup currentpoint pop gt
44 {currentpoint exch pop moveto exit} {pop} ifelse } for } def
45 /qS { (aa) stW (a a) stW sub 4 div 0 Kn } def
46 /hS { qS qS } def
47 /pspc 0 def
48 /cf0 { scalefont setfont } bind def
49 /Kn { dup kY add /kY exch def rmoveto } bind def
50 /ss { /fscale fscale 0.67 mul def currentfont 0.67 cf0 0 fscale0 fscale mul
51 0.33 mul neg Kn} def
52 /Ss { /fscale fscale 0.67 mul def currentfont 0.67 cf0 0 fscale0 fscale mul
53 0.67 mul Kn } def
54 /ns { 0 kY neg Kn /kY 0 def /fscale 1.0 def xfont0 1.0 cf0 } def
55 /MR { /twidth exch def } def
56 /CRx { } def
57 /CR { ns 0 /Bline Bline fscale0 neg add def Bline moveto CRx } def
58 /cf { dup type /realtype ne {1.0} if exch findfont exch kY 0 eq
59 { 40 mul dup /fscale0 exch def cf0 /xfont0 currentfont def}
60 {fscale0 mul fscale mul cf0} ifelse } def
61 /ctmk { counttomark dup 2 add -1 roll pop } bind def
62 /label { gsave translate 0 0 moveto dup scale neg
63 /rotval exch def /twidth 100000 def /just exch def just 128 and
64 0 gt {/mshow {pop} def} {/mshow {show} def} ifelse just 16 and 0
65 gt {gsave rotval rotate 0 1 dtransform gsave pagemat setmatrix
66 idtransform exch grestore 1 0 dtransform gsave pagemat setmatrix
67 idtransform exch grestore dup abs 1e-9 lt {pop mul 0 gt} {3 1 roll
68 pop pop 0 lt} ifelse grestore {-1 /rotval rotval neg def /just just
69 dup 3 and 1 ne {3 xor} if def} {1} ifelse exch -1e-9 lt {-1 /rotval
70 rotval neg def /just just dup 12 and 4 ne {12 xor} if def} {1}
71 ifelse scale } if /showflag 0 def /fspc pspc def /Bline 0 def
72 /numlines 0 def /padding 0 array def /Tabs 0 array def
73 /fscale 1.0 def /kY 0 def gsave /CRx { linewid padding
74 aload pop numlines 1 add dup /numlines exch def array astore
75 /padding exch def /linewid 0 def } def dup 1 add copy dup 1 0
76 dtransform exch atan rotate {exch dup type /stringtype eq {gsave dup
77 gsave newpath 0 0 moveto true charpath flattenpath pathbbox pop exch
78 pop exch pop grestore currentpoint pop add dup /linewid exch def twidth
79 ge {grestore CR exch 1 add dup 2 add {CR} exch 1 roll exch} {grestore}
80 ifelse true charpath flattenpath} {dup type /arraytype eq {exec} {12
81 string cvs true charpath flattenpath} ifelse} ifelse} repeat
82 CRx /CRx {padding aload pop just 1280 and 0 gt {blockwid exch sub just
83 1024 and 0 gt {0.5 mul} if} {pop 0} ifelse 0 rmoveto numlines 1 sub
84 dup /numlines exch def array astore /padding exch def} def exch pop
85 pathbbox grestore 4 copy pop exch pop exch sub /blockwid exch def
86 3 -1 roll pop 3 1 roll just 1 and 0 gt {just 2 and
87 0 gt {exch pop neg fspc sub} {exch sub 0.5 mul neg} ifelse} {pop neg
88 fspc add} ifelse exch Bline exch just 4 and 0 gt {just 8 and 0 gt
89 {exch pop neg fspc sub} {add 0.5 mul neg} ifelse} {pop neg fspc add}
90 ifelse rotval rotate Kn currentpoint translate /showflag 1 def /Bline
91 0 def /Tabs 0 array def /fscale 1.0 def /kY 0 def CRx {dup type
92 /stringtype eq {mshow} {dup type /arraytype eq {exec} {12 string cvs
93 mshow} ifelse} ifelse} repeat grestore endclip} def
94 /pinlabel { 4 index 32 and 0 ne hlevel 0 eq or { /pspc 10 def label
95 /pspc 0 def } { pop pop pop pop pop {pop} repeat } ifelse } def
96 /pinglobal { pinlabel } def
97 /infolabel { pinlabel } def
98 /graphic { gsave 4 index cvx exec /DataSource get resetfile translate 0 0
99 moveto neg rotate dup scale cvx exec image grestore endclip} def
101 /scb { setrgbcolor } bind def /sce { defColor aload pop scb } bind def
102 /cRedef {/defColor currentcolor 3 array astore def} def
103 /begingate {dup type /dicttype ne {1 dict} if begin % default params
104 dup type /dicttype ne {1 dict} if begin % instanced params
105 /hlevel hlevel 1 add def /defColor currentcolor sce 3 array astore
106 def gsave sce dup type /nametype eq { pop } if translate 0 0 moveto
107 neg rotate dup type /nametype eq not { dup abs currentlinewidth exch
108 div setlinewidth } { pop } ifelse dup abs scale clipped 1 and 1 eq
109 {/clipped clipped 1 add def} if} bind def
110 /endgate { /hlevel hlevel 1 sub def grestore defColor aload pop cRedef
111 scb end end endclip} bind def
113 /hlevel 0 def
114 /endclip {clipped 1 and 1 eq {grestore /clipped clipped 1 sub def} if} def
115 /tmpa [1 0 0 1 0 0] def
116 /gar {8 8 true tmpa {<c0 c0 00 00 0c 0c 00 00>} imagemask} bind
117 {8 8 true tmpa {<30 70 60 02 03 07 06 20>} imagemask} bind
118 {8 8 true tmpa {<0c 1e 1e 0c c0 e1 e1 c0>} imagemask} bind
119 {8 8 true tmpa {<0f 0f 0f 0f f0 f0 f0 f0>} imagemask} bind
120 {8 8 true tmpa {<3f f3 e1 e1 f3 3f 1e 1e>} imagemask} bind
121 {8 8 true tmpa {<df cf 8f 9f fd fc f8 f9>} imagemask} bind
122 {8 8 true tmpa {<ff 3f 3f ff ff f3 f3 ff>} imagemask} bind 7 array astore def
123 /ppaint { gsave clip tmpa dup setmatrix pathbbox neg exch neg 4 2 roll
124 neg 4 -1 roll 2 copy gt {exch} if 8 div ceiling 8 mul 4 2 roll neg 2 copy
125 gt {exch} if 8 div ceiling 8 mul 3 -1 roll -8 5 -1 roll
126 { 3 index exch 5 exch put dup -8 3 index { 3 index
127 exch 4 exch put 3 index exec } for } for pop pop pop pop grestore } bind def
128 /setstyles {
129 currentlinewidth mul setlinewidth /style exch def style 2048 and 0 gt
130 clipped 1 and 0 eq and {clip newpath /clipped clipped 1 add def} {
131 style 1 and 0 gt not {closepath} if
132 style 1024 and 0 gt {2 setlinecap 0 setlinejoin} if
133 style 2 and 0 gt {currentlinewidth 4 mul dup 2 array astore 0 setdash} if
134 style 4 and 0 gt {0.5 currentlinewidth 4 mul 2 array astore 0 setdash} if
135 gsave style 16 and 0 gt { style 224 and -5 bitshift style 256 and 0 gt {
136 7 exch sub 8 div dup 1 exch sub currentrgbcolor 3 array astore
137 {3 copy mul add 4 1 roll pop} forall pop pop setrgbcolor eofill}
138 {dup 7 lt {gar exch get ppaint} {pop eofill} ifelse} ifelse}
139 {style 256 and 0 gt {1 setgray eofill} if} ifelse grestore style 8 and 0 gt
140 style 512 eq or {newpath} {stroke} ifelse grestore endclip} ifelse} def
142 /addtoy {exch dup dup 2 mul 3 add 1 roll -1 1 { 4 1 roll dup 4 1 roll add
143 4 -1 roll 2 mul 1 add index 2 mul 2 add 2 roll} for pop} def
144 /addtoy1 {1 exch addtoy pop} def
145 /addtoy3 {3 exch addtoy pop} def
146 /addtoy4 {4 exch addtoy pop} def
147 /addtox {exch dup dup 2 mul 3 add 1 roll -1 1 { 4 1 roll dup 4 1 roll 3 -1 roll
148 add exch 4 -1 roll 2 mul 1 add index 2 mul 2 add 2 roll} for pop} def
149 /addtox1 {1 exch addtox pop} def
150 /addtox3 {3 exch addtox pop} def
151 /addtox4 {4 exch addtox pop} def
152 /polygon { gsave /num exch def moveto num 1 sub {lineto} repeat setstyles } def
153 /xcarc { gsave newpath arc setstyles } def
154 /elb { matrix currentmatrix 7 -1 roll 7 -1 roll translate 5 1 roll 4 -1 roll
155 3 index div 1 scale } def
156 /ele { 0 4 1 roll 0 4 1 roll } bind def
157 /ellipse { gsave elb newpath ele arc setmatrix setstyles } def
158 /pellip { elb ele arc setmatrix } def
159 /nellip { elb ele arcn setmatrix } def
160 /spline { gsave moveto curveto setstyles } def
161 /polyc { {lineto} repeat } bind def
162 /beginpath { gsave moveto } bind def
163 /endpath { setstyles } bind def
164 /bop { 1 setlinecap 2 setlinejoin 6 setmiterlimit 0 0 0 scb cRedef
165 /clipped 0 def} def
166 /psinsertion {/PSobj save def /showpage {} def /setpagedevice {pop} def bop
167 rotate translate dup scale} def
168 /end_insert {PSobj restore} def
169 /setpagemat {/pagemat matrix currentmatrix def} def
170 /inchscale {setpagemat 0.375 mul dup scale} def
171 /cmscale {setpagemat 0.35433071 mul dup scale} def
173 %%EndResource
174 %%EndProlog