|
Lines 1-5
Link Here
|
| 1 |
--- xplot.c.orig Wed Jul 2 13:26:09 1997 |
1 |
--- xplot.c.orig Wed Nov 19 18:35:43 2003 |
| 2 |
+++ xplot.c Sat Aug 1 00:12:42 1998 |
2 |
+++ xplot.c Wed Nov 19 18:35:42 2003 |
| 3 |
@@ -46,7 +46,7 @@ |
3 |
@@ -46,7 +46,7 @@ |
| 4 |
#include <X11/cursorfont.h> |
4 |
#include <X11/cursorfont.h> |
| 5 |
#include <math.h> |
5 |
#include <math.h> |
|
Lines 33-39
Link Here
|
| 33 |
d_i[d].clr_map = DefaultColormap(pl->dpy, DefaultScreen(pl->dpy)); |
33 |
d_i[d].clr_map = DefaultColormap(pl->dpy, DefaultScreen(pl->dpy)); |
| 34 |
|
34 |
|
| 35 |
- if ( option_mono || |
35 |
- if ( option_mono || |
| 36 |
- |
36 |
+ if ( option_mono ) { |
|
|
37 |
+ usewhite = 1; |
| 38 |
+ } else { |
| 39 |
+ usewhite = 0; |
| 40 |
|
| 37 |
- ! XAllocColorCells(pl->dpy, |
41 |
- ! XAllocColorCells(pl->dpy, |
| 38 |
- d_i[d].clr_map, 0, |
42 |
- d_i[d].clr_map, 0, |
| 39 |
- &d_i[d].line_plane_mask, 1, |
43 |
- &d_i[d].line_plane_mask, 1, |
|
Lines 56-66
Link Here
|
| 56 |
- d_i[d].clr.pixel |= d_i[d].line_plane_mask; |
60 |
- d_i[d].clr.pixel |= d_i[d].line_plane_mask; |
| 57 |
- XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr); |
61 |
- XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr); |
| 58 |
- d_i[d].Colors[i] = d_i[d].clr.pixel; |
62 |
- d_i[d].Colors[i] = d_i[d].clr.pixel; |
| 59 |
+ if ( option_mono ) { |
|
|
| 60 |
+ usewhite = 1; |
| 61 |
+ } else { |
| 62 |
+ usewhite = 0; |
| 63 |
+ |
| 64 |
+ for (i = 0; i < NColors; i++) { |
63 |
+ for (i = 0; i < NColors; i++) { |
| 65 |
+ XColor alloc, exact; |
64 |
+ XColor alloc, exact; |
| 66 |
+ |
65 |
+ |
|
Lines 72-83
Link Here
|
| 72 |
+ break; |
71 |
+ break; |
| 73 |
} |
72 |
} |
| 74 |
+ d_i[d].Colors[i] = alloc.pixel; |
73 |
+ d_i[d].Colors[i] = alloc.pixel; |
| 75 |
+ } |
74 |
} |
| 76 |
+ } |
75 |
+ } |
| 77 |
+ if ( usewhite ) { |
76 |
+ if ( usewhite ) { |
| 78 |
+ for ( i = 0; i < NColors; i++) { |
77 |
+ for ( i = 0; i < NColors; i++) { |
| 79 |
+ d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen); |
78 |
+ d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen); |
| 80 |
} |
79 |
+ } |
| 81 |
+ } |
80 |
+ } |
| 82 |
} |
81 |
} |
| 83 |
|
82 |
|
|
Lines 94-96
Link Here
|
| 94 |
/* Bracket the PS program with gsave/grestore so these page descriptions |
93 |
/* Bracket the PS program with gsave/grestore so these page descriptions |
| 95 |
can be concatenated, then printed. */ |
94 |
can be concatenated, then printed. */ |
| 96 |
fputs("%%BoundingBox: ", fp); |
95 |
fputs("%%BoundingBox: ", fp); |
|
|
96 |
@@ -3168,146 +3161,146 @@ |
| 97 |
fputs("gsave\n", fp); |
| 98 |
|
| 99 |
/* Set up scale */ |
| 100 |
- fputs(" |
| 101 |
-%/sign { dup 0 gt { pop 1 } { 0 lt { -1 } { 0 } ifelse } ifelse } def |
| 102 |
- |
| 103 |
-%matrix currentmatrix |
| 104 |
-%aload pop |
| 105 |
-%6 2 roll sign |
| 106 |
-%6 1 roll sign |
| 107 |
-%6 1 roll sign |
| 108 |
-%6 1 roll sign |
| 109 |
-%6 1 roll |
| 110 |
-%matrix astore setmatrix |
| 111 |
- |
| 112 |
-0.12 dup scale |
| 113 |
- |
| 114 |
+ fputs("\n\ |
| 115 |
+%/sign { dup 0 gt { pop 1 } { 0 lt { -1 } { 0 } ifelse } ifelse } def\n\ |
| 116 |
+\n\ |
| 117 |
+%matrix currentmatrix\n\ |
| 118 |
+%aload pop\n\ |
| 119 |
+%6 2 roll sign\n\ |
| 120 |
+%6 1 roll sign\n\ |
| 121 |
+%6 1 roll sign\n\ |
| 122 |
+%6 1 roll sign\n\ |
| 123 |
+%6 1 roll\n\ |
| 124 |
+%matrix astore setmatrix\n\ |
| 125 |
+\n\ |
| 126 |
+0.12 dup scale\n\ |
| 127 |
+\n\ |
| 128 |
", fp); |
| 129 |
|
| 130 |
fprintf(fp, "/theta {%d mul} def\n", ( (state == PRINTING) ? 4 : 2)); |
| 131 |
|
| 132 |
/* Set up units of measurement. */ |
| 133 |
fprintf(fp, "/inch {%d mul} def\n", PER_INCH); |
| 134 |
- fputs("/pt {inch 72 div} def |
| 135 |
-% |
| 136 |
-% |
| 137 |
-/tfont /Times-Bold findfont 12 pt scalefont def |
| 138 |
-% |
| 139 |
-/lfont /Times-Roman findfont 10 pt scalefont def |
| 140 |
-% |
| 141 |
-%tfont /FontBBox get |
| 142 |
-% aload pop |
| 143 |
-% tfont /FontMatrix get dtransform pop /tascent exch def |
| 144 |
-% tfont /FontMatrix get dtransform pop neg /tdescent exch def |
| 145 |
-lfont /FontBBox get |
| 146 |
- aload pop |
| 147 |
- lfont /FontMatrix get dtransform pop 0.65 mul /lascent exch def |
| 148 |
- lfont /FontMatrix get dtransform pop neg /ldescent exch def |
| 149 |
-% begin gdt mod |
| 150 |
-% define font for xplot characters |
| 151 |
-/BuildCharDict 10 dict def |
| 152 |
-/Xplotfontdict 7 dict def |
| 153 |
-Xplotfontdict begin |
| 154 |
- /FontType 3 def |
| 155 |
- /FontMatrix [1 0 0 1 0 0] def |
| 156 |
- /FontBBox [-1 -1 1 1]def |
| 157 |
- /Encoding 256 array def |
| 158 |
- 0 1 255 {Encoding exch /.notdef put} for |
| 159 |
- Encoding (.) 0 get /xplotfontdot put |
| 160 |
- /CharacterDefs 3 dict def |
| 161 |
- CharacterDefs /.notdef {} put |
| 162 |
- CharacterDefs /xplotfontdot |
| 163 |
- { newpath |
| 164 |
- 0 0 1 0 360 arc fill |
| 165 |
- } put |
| 166 |
- /BuildChar |
| 167 |
- { BuildCharDict begin |
| 168 |
- /char exch def |
| 169 |
- /fontdict exch def |
| 170 |
- /charname fontdict /Encoding get |
| 171 |
- char get def |
| 172 |
- /charproc fontdict /CharacterDefs |
| 173 |
- get charname get def |
| 174 |
- 1 0 -1 -1 1 1 setcachedevice |
| 175 |
- gsave charproc grestore |
| 176 |
- end |
| 177 |
- } def |
| 178 |
-end |
| 179 |
-/XplotFont Xplotfontdict definefont pop |
| 180 |
-% scale font according to theta |
| 181 |
-/dotsetup { /dotfont /XplotFont findfont 4 theta scalefont def } def |
| 182 |
-% DONE gdt mod |
| 183 |
-%define procedures for each xplot primitive. |
| 184 |
-% x y x -- |
| 185 |
-/x {moveto 8 8 rlineto -16 -16 rlineto |
| 186 |
- 8 8 rmoveto |
| 187 |
- -8 8 rlineto 16 -16 rlineto} def |
| 188 |
-% x y + -- |
| 189 |
-/+ {moveto 0 8 rlineto 0 -16 rlineto |
| 190 |
- 0 8 rmoveto |
| 191 |
- -8 0 rlineto 16 0 rlineto} def |
| 192 |
-% x y ?arrow -- |
| 193 |
-/darrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto |
| 194 |
- -8 theta 8 theta rlineto } def |
| 195 |
-/uarrow {moveto -8 theta -8 theta rmoveto 8 theta 8 theta rlineto |
| 196 |
- 8 theta -8 theta rlineto } def |
| 197 |
-/rarrow {moveto -8 theta 8 theta rmoveto 8 theta -8 theta rlineto |
| 198 |
- -8 theta -8 theta rlineto } def |
| 199 |
-/larrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto |
| 200 |
- 8 theta -8 theta rlineto } def |
| 201 |
-%x y x y line -- |
| 202 |
-/line {moveto lineto} def |
| 203 |
-%x y dot -- |
| 204 |
-% begin gdt mod |
| 205 |
-/dot { moveto dotfont setfont (.) show } def |
| 206 |
-%/dot {stroke 8 theta 0 360 arc fill} def |
| 207 |
-% end gdt mod |
| 208 |
-%x y plus -- |
| 209 |
-/plus {moveto -16 theta 0 rmoveto 16 theta 0 rlineto |
| 210 |
- -16 theta -16 theta rmoveto 0 16 theta rlineto} def |
| 211 |
-%x y box -- |
| 212 |
-/box {moveto -8 theta -8 theta rmoveto |
| 213 |
- 16 theta 0 rlineto |
| 214 |
- 0 16 theta rlineto |
| 215 |
- -16 theta 0 rlineto |
| 216 |
- 0 -16 theta rlineto} def |
| 217 |
-%x y diamond -- |
| 218 |
-/diamond { moveto 0 theta 24 theta rmoveto |
| 219 |
- -24 theta -24 theta rlineto |
| 220 |
- 24 theta -24 theta rlineto |
| 221 |
- 24 theta 24 theta rlineto |
| 222 |
- -24 theta 24 theta rlineto} def |
| 223 |
-%x y ?tick -- |
| 224 |
-/utick {moveto 0 6 theta rlineto} def |
| 225 |
-/dtick {moveto 0 -6 theta rlineto} def |
| 226 |
-/ltick {moveto -6 theta 0 rlineto} def |
| 227 |
-/rtick {moveto 6 theta 0 rlineto} def |
| 228 |
-/htick {moveto -6 theta 0 rmoveto 12 theta 0 rlineto} def |
| 229 |
-/vtick {moveto 0 -6 theta rmoveto 0 12 theta rlineto} def |
| 230 |
-%Separate functions for each text position. |
| 231 |
-%x y string ?text -- |
| 232 |
-/space 6 pt def |
| 233 |
-% Set the font, figure out the width. |
| 234 |
-% x y string tsetup string x width y |
| 235 |
-/tsetup {lfont setfont dup stringwidth pop exch |
| 236 |
- 4 1 roll exch} def |
| 237 |
-%CENTER |
| 238 |
-/ctext {tsetup lascent 2 div sub |
| 239 |
- 3 1 roll 2 div sub exch |
| 240 |
-% stack should now be string x y |
| 241 |
- moveto show} def |
| 242 |
-%ABOVE |
| 243 |
-/atext {tsetup space ldescent add add |
| 244 |
- 3 1 roll 2 div sub exch moveto show} def |
| 245 |
-%BELOW |
| 246 |
-/btext {tsetup space lascent add sub |
| 247 |
- 3 1 roll 2 div sub exch moveto show} def |
| 248 |
-%TO_THE_LEFT |
| 249 |
-/ltext {tsetup lascent 2 div sub |
| 250 |
- 3 1 roll space add sub exch moveto show} def |
| 251 |
-%TO_THE_RIGHT |
| 252 |
-/rtext {tsetup lascent 2 div sub |
| 253 |
- 3 1 roll pop space add exch moveto show} def |
| 254 |
+ fputs("/pt {inch 72 div} def\n\ |
| 255 |
+%\n\ |
| 256 |
+%\n\ |
| 257 |
+/tfont /Times-Bold findfont 12 pt scalefont def\n\ |
| 258 |
+%\n\ |
| 259 |
+/lfont /Times-Roman findfont 10 pt scalefont def\n\ |
| 260 |
+%\n\ |
| 261 |
+%tfont /FontBBox get\n\ |
| 262 |
+% aload pop\n\ |
| 263 |
+% tfont /FontMatrix get dtransform pop /tascent exch def\n\ |
| 264 |
+% tfont /FontMatrix get dtransform pop neg /tdescent exch def\n\ |
| 265 |
+lfont /FontBBox get\n\ |
| 266 |
+ aload pop\n\ |
| 267 |
+ lfont /FontMatrix get dtransform pop 0.65 mul /lascent exch def\n\ |
| 268 |
+ lfont /FontMatrix get dtransform pop neg /ldescent exch def\n\ |
| 269 |
+% begin gdt mod\n\ |
| 270 |
+% define font for xplot characters\n\ |
| 271 |
+/BuildCharDict 10 dict def\n\ |
| 272 |
+/Xplotfontdict 7 dict def\n\ |
| 273 |
+Xplotfontdict begin\n\ |
| 274 |
+ /FontType 3 def\n\ |
| 275 |
+ /FontMatrix [1 0 0 1 0 0] def\n\ |
| 276 |
+ /FontBBox [-1 -1 1 1]def\n\ |
| 277 |
+ /Encoding 256 array def\n\ |
| 278 |
+ 0 1 255 {Encoding exch /.notdef put} for\n\ |
| 279 |
+ Encoding (.) 0 get /xplotfontdot put\n\ |
| 280 |
+ /CharacterDefs 3 dict def\n\ |
| 281 |
+ CharacterDefs /.notdef {} put\n\ |
| 282 |
+ CharacterDefs /xplotfontdot\n\ |
| 283 |
+ { newpath\n\ |
| 284 |
+ 0 0 1 0 360 arc fill\n\ |
| 285 |
+ } put\n\ |
| 286 |
+ /BuildChar\n\ |
| 287 |
+ { BuildCharDict begin\n\ |
| 288 |
+ /char exch def\n\ |
| 289 |
+ /fontdict exch def\n\ |
| 290 |
+ /charname fontdict /Encoding get\n\ |
| 291 |
+ char get def\n\ |
| 292 |
+ /charproc fontdict /CharacterDefs\n\ |
| 293 |
+ get charname get def\n\ |
| 294 |
+ 1 0 -1 -1 1 1 setcachedevice\n\ |
| 295 |
+ gsave charproc grestore\n\ |
| 296 |
+ end\n\ |
| 297 |
+ } defn\n\ |
| 298 |
+end\n\ |
| 299 |
+/XplotFont Xplotfontdict definefont pop\n\ |
| 300 |
+% scale font according to theta\n\ |
| 301 |
+/dotsetup { /dotfont /XplotFont findfont 4 theta scalefont def } def\n\ |
| 302 |
+% DONE gdt mod\n\ |
| 303 |
+%define procedures for each xplot primitive.\n\ |
| 304 |
+% x y x --\n\ |
| 305 |
+/x {moveto 8 8 rlineto -16 -16 rlineto\n\ |
| 306 |
+ 8 8 rmoveto\n\ |
| 307 |
+ -8 8 rlineto 16 -16 rlineto} def\n\ |
| 308 |
+% x y + --\n\ |
| 309 |
+/+ {moveto 0 8 rlineto 0 -16 rlineto\n\ |
| 310 |
+ 0 8 rmoveto\n\ |
| 311 |
+ -8 0 rlineto 16 0 rlineto} def\n\ |
| 312 |
+% x y ?arrow --\n\ |
| 313 |
+/darrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto\n\ |
| 314 |
+ -8 theta 8 theta rlineto } def\n\ |
| 315 |
+/uarrow {moveto -8 theta -8 theta rmoveto 8 theta 8 theta rlineto\n\ |
| 316 |
+ 8 theta -8 theta rlineto } def\n\ |
| 317 |
+/rarrow {moveto -8 theta 8 theta rmoveto 8 theta -8 theta rlineto\n\ |
| 318 |
+ -8 theta -8 theta rlineto } def\n\ |
| 319 |
+/larrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto\n\ |
| 320 |
+ 8 theta -8 theta rlineto } def\n\ |
| 321 |
+%x y x y line --\n\ |
| 322 |
+/line {moveto lineto} def\n\ |
| 323 |
+%x y dot --\n\ |
| 324 |
+% begin gdt mod\n\ |
| 325 |
+/dot { moveto dotfont setfont (.) show } def\n\ |
| 326 |
+%/dot {stroke 8 theta 0 360 arc fill} def\n\ |
| 327 |
+% end gdt mod\n\ |
| 328 |
+%x y plus --\n\ |
| 329 |
+/plus {moveto -16 theta 0 rmoveto 16 theta 0 rlineto\n\ |
| 330 |
+ -16 theta -16 theta rmoveto 0 16 theta rlineto} def\n\ |
| 331 |
+%x y box --\n\ |
| 332 |
+/box {moveto -8 theta -8 theta rmoveto\n\ |
| 333 |
+ 16 theta 0 rlineto\n\ |
| 334 |
+ 0 16 theta rlineto\n\ |
| 335 |
+ -16 theta 0 rlineto\n\ |
| 336 |
+ 0 -16 theta rlineto} def\n\ |
| 337 |
+%x y diamond --\n\ |
| 338 |
+/diamond { moveto 0 theta 24 theta rmoveto\n\ |
| 339 |
+ -24 theta -24 theta rlineto\n\ |
| 340 |
+ 24 theta -24 theta rlineto\n\ |
| 341 |
+ 24 theta 24 theta rlineto\n\ |
| 342 |
+ -24 theta 24 theta rlineto} def\n\ |
| 343 |
+%x y ?tick --\n\ |
| 344 |
+/utick {moveto 0 6 theta rlineto} def\n\ |
| 345 |
+/dtick {moveto 0 -6 theta rlineto} def\n\ |
| 346 |
+/ltick {moveto -6 theta 0 rlineto} def\n\ |
| 347 |
+/rtick {moveto 6 theta 0 rlineto} def\n\ |
| 348 |
+/htick {moveto -6 theta 0 rmoveto 12 theta 0 rlineto} def\n\ |
| 349 |
+/vtick {moveto 0 -6 theta rmoveto 0 12 theta rlineto} def\n\ |
| 350 |
+%Separate functions for each text position.\n\ |
| 351 |
+%x y string ?text --\n\ |
| 352 |
+/space 6 pt def\n\ |
| 353 |
+% Set the font, figure out the width.\n\ |
| 354 |
+% x y string tsetup string x width y\n\ |
| 355 |
+/tsetup {lfont setfont dup stringwidth pop exch\n\ |
| 356 |
+ 4 1 roll exch} def\n\ |
| 357 |
+%CENTER\n\ |
| 358 |
+/ctext {tsetup lascent 2 div sub\n\ |
| 359 |
+ 3 1 roll 2 div sub exch\n\ |
| 360 |
+% stack should now be string x y\n\ |
| 361 |
+ moveto show} def\n\ |
| 362 |
+%ABOVE\n\ |
| 363 |
+/atext {tsetup space ldescent add add\n\ |
| 364 |
+ 3 1 roll 2 div sub exch moveto show} def\n\ |
| 365 |
+%BELOW\n\ |
| 366 |
+/btext {tsetup space lascent add sub\n\ |
| 367 |
+ 3 1 roll 2 div sub exch moveto show} def\n\ |
| 368 |
+%TO_THE_LEFT\n\ |
| 369 |
+/ltext {tsetup lascent 2 div sub\n\ |
| 370 |
+ 3 1 roll space add sub exch moveto show} def\n\ |
| 371 |
+%TO_THE_RIGHT\n\ |
| 372 |
+/rtext {tsetup lascent 2 div sub\n\ |
| 373 |
+ 3 1 roll pop space add exch moveto show} def\n\ |
| 374 |
", fp); |
| 375 |
|
| 376 |
{ |
| 377 |
@@ -3354,9 +3347,9 @@ |
| 378 |
if (state == PRINTING) { |
| 379 |
fputs("-90 rotate -11 inch 0 inch translate\n", fp); |
| 380 |
} else { |
| 381 |
- fputs(" |
| 382 |
-/notintex { currentdict userdict eq } def |
| 383 |
-notintex { 1.5 inch 5.0 inch translate } if |
| 384 |
+ fputs("\n\ |
| 385 |
+/notintex { currentdict userdict eq } def\n\ |
| 386 |
+notintex { 1.5 inch 5.0 inch translate } if\n\ |
| 387 |
", fp); |
| 388 |
} |
| 389 |
/* Move origin to create left & bottom margins. */ |