1 | |
---|
2 | /* file GRAPHCH.C |
---|
3 | * ========= |
---|
4 | * |
---|
5 | * version 17, 24-May-93 |
---|
6 | * |
---|
7 | * channel dispatcher of graphic output |
---|
8 | * K. Stammler, 9-AUG-91 |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | #define __THIS_IS_GRAPHCH |
---|
13 | |
---|
14 | #include <stdio.h> |
---|
15 | #include BASECNST |
---|
16 | #include BC_SYSBASE |
---|
17 | #include "graphbas.h" |
---|
18 | #include "mmusrdef.h" |
---|
19 | #include "psusrdef.h" |
---|
20 | #include "xwusrdef.h" |
---|
21 | #include BC_GCUSRDEF |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | #define WDWMASK 7 |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | /* redraw routine available for all graphic modules |
---|
30 | * imported via graphbas.h |
---|
31 | */ |
---|
32 | void (*gbv_playback)( CHMAP src, CHMAP dst, PAINTBOX *pb, |
---|
33 | char outf[], STATUS *status ); |
---|
34 | |
---|
35 | |
---|
36 | /* global variables */ |
---|
37 | static BOOLEAN gcv_init; /* module initialized */ |
---|
38 | static unsigned int gcv_initmap; /* initialized modules */ |
---|
39 | static BOOLEAN gcv_swap; /* swap display */ |
---|
40 | static void (*gcv_writeext)(char text[]); |
---|
41 | /* write routine to external channel */ |
---|
42 | |
---|
43 | |
---|
44 | /* macros */ |
---|
45 | #define CSWAP(x,y) if (gcv_swap) {COOTYPE tmp;tmp=(x);(x)=(y);(y)=tmp;} |
---|
46 | |
---|
47 | |
---|
48 | /*------------------------------------------------------------------------*/ |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | void gc_init( CHMAP map, int attribs, COOTYPE xlo, COOTYPE ylo, |
---|
53 | COOTYPE width, COOTYPE height, STATUS *status ) |
---|
54 | |
---|
55 | /* initialises channels |
---|
56 | * |
---|
57 | * parameters of routine |
---|
58 | * CHMAP map; input; channel map |
---|
59 | * int attribs; input; window attributes |
---|
60 | * COOTYPE xlo; input; x-coo of lower left corner |
---|
61 | * COOTYPE ylo; input; y-coo of lower left corner |
---|
62 | * COOTYPE width; input; widths of window |
---|
63 | * COOTYPE height; input; height of window |
---|
64 | * STATUS *status; output; return status |
---|
65 | */ |
---|
66 | { |
---|
67 | /* executable code */ |
---|
68 | |
---|
69 | if (!gcv_init) { |
---|
70 | gbv_playback = mm_playback; |
---|
71 | gcv_init = TRUE; |
---|
72 | } /*endif*/ |
---|
73 | |
---|
74 | if (GCF_XWDW & map) { |
---|
75 | xw_init( map & WDWMASK, attribs, xlo, ylo, width, height, status ); |
---|
76 | if (Severe(status)) return; |
---|
77 | gcv_initmap |= GCF_XWDW; |
---|
78 | } /*endif*/ |
---|
79 | |
---|
80 | if (GCF_MEM & map) { |
---|
81 | mm_init( map & WDWMASK, status ); |
---|
82 | if (Severe(status)) return; |
---|
83 | gcv_initmap |= GCF_MEM; |
---|
84 | } /*endif*/ |
---|
85 | |
---|
86 | if (GCF_PSF & map) { |
---|
87 | ps_init( attribs, xlo, ylo, width, height, status ); |
---|
88 | if (Severe(status)) return; |
---|
89 | gcv_initmap |= GCF_PSF; |
---|
90 | } /*endif*/ |
---|
91 | |
---|
92 | } /* end of gc_init */ |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | /*------------------------------------------------------------------------*/ |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | void gc_exit( CHMAP map ) |
---|
101 | |
---|
102 | /* closes channel |
---|
103 | * |
---|
104 | * parameters of routine |
---|
105 | * CHMAP map; input; window to be closed |
---|
106 | */ |
---|
107 | { |
---|
108 | /* executable code */ |
---|
109 | |
---|
110 | if (GCF_XWDW & map) |
---|
111 | xw_exit( map & WDWMASK ); |
---|
112 | |
---|
113 | if (GCF_MEM & map) |
---|
114 | mm_exit( map & WDWMASK ); |
---|
115 | |
---|
116 | if (GCF_PSF & map) |
---|
117 | ps_exit(); |
---|
118 | |
---|
119 | } /* end of gc_exit */ |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | /*------------------------------------------------------------------------*/ |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | void gc_finish( void ) |
---|
128 | |
---|
129 | /* closes all channels and terminates graphics |
---|
130 | * |
---|
131 | * no parameters |
---|
132 | */ |
---|
133 | { |
---|
134 | /* executable code */ |
---|
135 | |
---|
136 | xw_finish(); |
---|
137 | mm_finish(); |
---|
138 | ps_finish(); |
---|
139 | gcv_initmap = 0; |
---|
140 | |
---|
141 | } /* end of gc_finish */ |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | /*------------------------------------------------------------------------*/ |
---|
146 | |
---|
147 | |
---|
148 | |
---|
149 | void gc_resizewdw( CHMAP map, COOTYPE xpos, COOTYPE ypos, |
---|
150 | COOTYPE width, COOTYPE height, STATUS *status ) |
---|
151 | |
---|
152 | /* resizes channel |
---|
153 | * |
---|
154 | * parameters of routine |
---|
155 | * CHMAP map; input; channel map |
---|
156 | * COOTYPE xpos, ypos; input; position of window |
---|
157 | * COOTYPE width, height; input; size of window |
---|
158 | * STATUS *status; output; return status |
---|
159 | */ |
---|
160 | { |
---|
161 | /* executable code */ |
---|
162 | |
---|
163 | if (GCF_XWDW & map) { |
---|
164 | xw_resizewdw( map & WDWMASK, xpos, ypos, width, height, status ); |
---|
165 | if (Severe(status)) return; |
---|
166 | } /*endif*/ |
---|
167 | |
---|
168 | if (GCF_PSF & map) { |
---|
169 | ps_resize( xpos, ypos, width, height, status ); |
---|
170 | if (Severe(status)) return; |
---|
171 | } /*endif*/ |
---|
172 | |
---|
173 | } /* end of gc_resizewdw */ |
---|
174 | |
---|
175 | |
---|
176 | |
---|
177 | /*------------------------------------------------------------------------*/ |
---|
178 | |
---|
179 | |
---|
180 | |
---|
181 | void gc_popwdw( CHMAP map ) |
---|
182 | |
---|
183 | /* pops window on top |
---|
184 | * |
---|
185 | * parameters of routine |
---|
186 | * CHMAP map; input; channel map |
---|
187 | */ |
---|
188 | { |
---|
189 | /* executable code */ |
---|
190 | |
---|
191 | if (GCF_XWDW & map) |
---|
192 | xw_popwdw( map & WDWMASK ); |
---|
193 | |
---|
194 | } /* end of gc_popwdw */ |
---|
195 | |
---|
196 | |
---|
197 | |
---|
198 | /*------------------------------------------------------------------------*/ |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | void gc_setwdwname( CHMAP map, char name[] ) |
---|
203 | |
---|
204 | /* sets new window name |
---|
205 | * |
---|
206 | * parameters of routine |
---|
207 | * CHMAP map; input; channel map |
---|
208 | * char name[]; input; new name |
---|
209 | */ |
---|
210 | { |
---|
211 | /* executable code */ |
---|
212 | |
---|
213 | if (GCF_XWDW & map) |
---|
214 | xw_setwdwname( map & WDWMASK, name ); |
---|
215 | |
---|
216 | } /* end of gc_setwdwname */ |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | /*------------------------------------------------------------------------*/ |
---|
221 | |
---|
222 | |
---|
223 | |
---|
224 | void gc_setstyle( CHMAP map, unsigned style, char item[], |
---|
225 | char value[], STATUS *status ) |
---|
226 | |
---|
227 | /* sets style attribute |
---|
228 | * |
---|
229 | * parameters of routine |
---|
230 | * CHMAP map; input; channel map |
---|
231 | * unsigned style; input; style block number |
---|
232 | * char item[]; input; name of attribute |
---|
233 | * char value[]; input; new value of attribute (text) |
---|
234 | * STATUS *status; output; return status |
---|
235 | */ |
---|
236 | { |
---|
237 | /* executable code */ |
---|
238 | |
---|
239 | if (GCF_XWDW & map) { |
---|
240 | xw_setstyle( map & WDWMASK, style, item, value, status ); |
---|
241 | if (Severe(status)) return; |
---|
242 | } /*endif*/ |
---|
243 | |
---|
244 | if (GCF_PSF & map) { |
---|
245 | ps_setstyle( style, item, value, status ); |
---|
246 | if (Severe(status)) return; |
---|
247 | } /*endif*/ |
---|
248 | |
---|
249 | } /* end of gc_setstyle */ |
---|
250 | |
---|
251 | |
---|
252 | |
---|
253 | /*------------------------------------------------------------------------*/ |
---|
254 | |
---|
255 | |
---|
256 | |
---|
257 | void gc_setcoo( CHMAP map, COOTYPE x, COOTYPE y, COOTYPE w, COOTYPE h, |
---|
258 | STATUS *status ) |
---|
259 | |
---|
260 | /* sets user coordinates in window. If x,y,w,h are all equal to zero, |
---|
261 | * the last call is repeated. |
---|
262 | * |
---|
263 | * parameters of routine |
---|
264 | * CHMAP map; input; channel map |
---|
265 | * COOTYPE x, y, w, h; input; user coordinates |
---|
266 | * STATUS *status; output; return status |
---|
267 | */ |
---|
268 | { |
---|
269 | /* executable code */ |
---|
270 | |
---|
271 | CSWAP(x,y) |
---|
272 | CSWAP(w,h) |
---|
273 | |
---|
274 | if (GCF_XWDW & map) { |
---|
275 | xw_setcoo( map & WDWMASK, x, y, w, h, status ); |
---|
276 | if (Severe(status)) return; |
---|
277 | } /*endif*/ |
---|
278 | |
---|
279 | if (GCF_MEM & map) { |
---|
280 | mm_setcoo( map & WDWMASK, x, y, w, h, status ); |
---|
281 | if (Severe(status)) return; |
---|
282 | } /*endif*/ |
---|
283 | |
---|
284 | if (GCF_PSF & map) { |
---|
285 | ps_setcoo( x, y, w, h, status ); |
---|
286 | if (Severe(status)) return; |
---|
287 | } /*endif*/ |
---|
288 | |
---|
289 | } /* end of gc_setcoo */ |
---|
290 | |
---|
291 | |
---|
292 | |
---|
293 | /*------------------------------------------------------------------------*/ |
---|
294 | |
---|
295 | |
---|
296 | |
---|
297 | float gc_aspectratio( CHMAP map ) |
---|
298 | |
---|
299 | /* returns ratio of width to height |
---|
300 | * |
---|
301 | * parameters of routine |
---|
302 | * CHMAP map; input; channel map |
---|
303 | * returns aspect ratio |
---|
304 | */ |
---|
305 | { |
---|
306 | /* executable code */ |
---|
307 | |
---|
308 | if (GCF_XWDW & map) |
---|
309 | return xw_aspectratio( map & WDWMASK ); |
---|
310 | |
---|
311 | if (GCF_PSF & map) |
---|
312 | return ps_aspectratio(); |
---|
313 | |
---|
314 | return 1.0; |
---|
315 | |
---|
316 | } /* end of gc_aspectratio */ |
---|
317 | |
---|
318 | |
---|
319 | |
---|
320 | /*------------------------------------------------------------------------*/ |
---|
321 | |
---|
322 | |
---|
323 | |
---|
324 | void gc_moveto( CHMAP map, COOTYPE x, COOTYPE y ) |
---|
325 | |
---|
326 | /* moves to position (x,y) in user coordinates |
---|
327 | * |
---|
328 | * parameters of routine |
---|
329 | * CHMAP map; input; channel map |
---|
330 | * COOTYPE x, y; input; location to move to |
---|
331 | */ |
---|
332 | { |
---|
333 | /* executable code */ |
---|
334 | |
---|
335 | CSWAP(x,y) |
---|
336 | |
---|
337 | if (GCF_XWDW & map) |
---|
338 | xw_moveto( map & WDWMASK, x, y ); |
---|
339 | |
---|
340 | if (GCF_MEM & map) |
---|
341 | mm_moveto( map & WDWMASK, x, y ); |
---|
342 | |
---|
343 | if (GCF_PSF & map) |
---|
344 | ps_moveto( x, y ); |
---|
345 | |
---|
346 | } /* end of gc_moveto */ |
---|
347 | |
---|
348 | |
---|
349 | |
---|
350 | /*------------------------------------------------------------------------*/ |
---|
351 | |
---|
352 | |
---|
353 | |
---|
354 | void gc_drawto( CHMAP map, int style, COOTYPE x, COOTYPE y ) |
---|
355 | |
---|
356 | /* moves to position (x,y) in user coordinates |
---|
357 | * |
---|
358 | * parameters of routine |
---|
359 | * CHMAP map; input; channel map |
---|
360 | * int style; input; style block number |
---|
361 | * COOTYPE x, y; input; location to move to |
---|
362 | */ |
---|
363 | { |
---|
364 | /* executable code */ |
---|
365 | |
---|
366 | CSWAP(x,y) |
---|
367 | |
---|
368 | if (GCF_XWDW & map) |
---|
369 | xw_drawto( map & WDWMASK, style, x, y ); |
---|
370 | |
---|
371 | if (GCF_MEM & map) |
---|
372 | mm_drawto( map & WDWMASK, style, x, y ); |
---|
373 | |
---|
374 | if (GCF_PSF & map) |
---|
375 | ps_drawto( style, x, y ); |
---|
376 | |
---|
377 | } /* end of gc_drawto */ |
---|
378 | |
---|
379 | |
---|
380 | |
---|
381 | /*------------------------------------------------------------------------*/ |
---|
382 | |
---|
383 | |
---|
384 | |
---|
385 | void gc_setpixel( CHMAP map, int style, COOTYPE x, COOTYPE y ) |
---|
386 | |
---|
387 | /* sets pixel at position (x,y) in user coordinates |
---|
388 | * |
---|
389 | * parameters of routine |
---|
390 | * CHMAP map; input; channel map |
---|
391 | * int style; input; style block number |
---|
392 | * COOTYPE x, y; input; location to move to |
---|
393 | */ |
---|
394 | { |
---|
395 | /* executable code */ |
---|
396 | |
---|
397 | CSWAP(x,y) |
---|
398 | |
---|
399 | if (GCF_MEM & map) |
---|
400 | mm_setpixel( map & WDWMASK, style, x, y ); |
---|
401 | |
---|
402 | } /* end of gc_setpixel */ |
---|
403 | |
---|
404 | |
---|
405 | |
---|
406 | /*------------------------------------------------------------------------*/ |
---|
407 | |
---|
408 | |
---|
409 | |
---|
410 | void gc_arrayplot( CHMAP map, int style, long cnt, int red, COOTYPE xoff, |
---|
411 | COOTYPE xinc, COOTYPE yoff, COOTYPE yarr[], COOTYPE yzoom, STATUS *status ) |
---|
412 | |
---|
413 | /* plots an array of sample data |
---|
414 | * |
---|
415 | * parameters of routine |
---|
416 | * CHMAP map; input; channel map |
---|
417 | * int style; input; line style ID |
---|
418 | * long cnt; input; length of data array |
---|
419 | * int red; input; reduction factor for plotting |
---|
420 | * COOTYPE xoff; input; x-position of first sample |
---|
421 | * COOTYPE xinc; input; x increment |
---|
422 | * COOTYPE yoff; input; y-position of first sample |
---|
423 | * COOTYPE yarr[]; input; sample data |
---|
424 | * COOTYPE yzoom; input; zoom factor of sample data |
---|
425 | * STATUS *status; output; return status |
---|
426 | */ |
---|
427 | { |
---|
428 | /* executable code */ |
---|
429 | |
---|
430 | if (cnt < 2) return; |
---|
431 | |
---|
432 | if (GCF_XWDW & map) { |
---|
433 | xw_arrayplot( map & WDWMASK, style, cnt, red, xoff, xinc, |
---|
434 | yoff, yarr, yzoom, status ); |
---|
435 | if (Severe(status)) return; |
---|
436 | } /*endif*/ |
---|
437 | |
---|
438 | if (GCF_MEM & map) { |
---|
439 | mm_arrayplot( map & WDWMASK, style, cnt, red, xoff, xinc, |
---|
440 | yoff, yarr, yzoom, status ); |
---|
441 | if (Severe(status)) return; |
---|
442 | } /*endif*/ |
---|
443 | |
---|
444 | if (GCF_PSF & map) { |
---|
445 | ps_arrayplot( style, cnt, red, xoff, xinc, yoff, yarr, |
---|
446 | yzoom, status ); |
---|
447 | if (Severe(status)) return; |
---|
448 | } /*endif*/ |
---|
449 | |
---|
450 | } /* end of gc_arrayplot */ |
---|
451 | |
---|
452 | |
---|
453 | |
---|
454 | /*------------------------------------------------------------------------*/ |
---|
455 | |
---|
456 | |
---|
457 | |
---|
458 | void gc_erase( CHMAP map ) |
---|
459 | |
---|
460 | /* clears channel |
---|
461 | * |
---|
462 | * parameters of routine |
---|
463 | * CHMAP map; input; channel map |
---|
464 | */ |
---|
465 | { |
---|
466 | /* executable code */ |
---|
467 | |
---|
468 | if (GCF_XWDW & map) |
---|
469 | xw_erase( map & WDWMASK ); |
---|
470 | |
---|
471 | if (GCF_MEM & map) |
---|
472 | mm_erase( map & WDWMASK ); |
---|
473 | |
---|
474 | if (GCF_PSF & map) |
---|
475 | ps_erase(); |
---|
476 | |
---|
477 | } /* end of gc_erase */ |
---|
478 | |
---|
479 | |
---|
480 | |
---|
481 | /*------------------------------------------------------------------------*/ |
---|
482 | |
---|
483 | |
---|
484 | |
---|
485 | void gc_text( CHMAP map, int style, COOTYPE x, COOTYPE y, char text[] ) |
---|
486 | |
---|
487 | /* writes text to window |
---|
488 | * |
---|
489 | * parameters of routine |
---|
490 | * CHMAP map; input; channel map |
---|
491 | * int style; input; character style block number |
---|
492 | * COOTYPE x, y; input; text position |
---|
493 | * char text[]; input; output text |
---|
494 | */ |
---|
495 | { |
---|
496 | /* executable code */ |
---|
497 | |
---|
498 | CSWAP(x,y) |
---|
499 | |
---|
500 | if (GCF_XWDW & map) |
---|
501 | xw_text( map & WDWMASK, style, x, y, text ); |
---|
502 | |
---|
503 | if (GCF_MEM & map) |
---|
504 | mm_text( map & WDWMASK, style, x, y, text ); |
---|
505 | |
---|
506 | if (GCF_PSF & map) |
---|
507 | ps_text( style, x, y, text ); |
---|
508 | |
---|
509 | } /* end of gc_text */ |
---|
510 | |
---|
511 | |
---|
512 | |
---|
513 | /*------------------------------------------------------------------------*/ |
---|
514 | |
---|
515 | |
---|
516 | |
---|
517 | void gc_write( CHMAP map, char text[] ) |
---|
518 | |
---|
519 | /* writes text to window at current write position |
---|
520 | * |
---|
521 | * parameters of routine |
---|
522 | * CHMAP map; input; channel map |
---|
523 | * char text[]; input; output text |
---|
524 | */ |
---|
525 | { |
---|
526 | /* executable code */ |
---|
527 | |
---|
528 | if (GCF_XWDW & map) |
---|
529 | xw_write( map & WDWMASK, text ); |
---|
530 | |
---|
531 | if (GCF_STDCH & map) |
---|
532 | printf( "%s", text ); |
---|
533 | |
---|
534 | if (GCF_EXTERN & map && gcv_writeext != NULL) |
---|
535 | (*gcv_writeext)( text ); |
---|
536 | |
---|
537 | } /* end of gc_write */ |
---|
538 | |
---|
539 | |
---|
540 | |
---|
541 | /*------------------------------------------------------------------------*/ |
---|
542 | |
---|
543 | |
---|
544 | |
---|
545 | void gc_wrtch( CHMAP map, char ch ) |
---|
546 | |
---|
547 | /* writes a single character to channel |
---|
548 | * |
---|
549 | * parameters of routine |
---|
550 | * CHMAP map; input; channel map |
---|
551 | * char ch; input; char to be written |
---|
552 | */ |
---|
553 | { |
---|
554 | /* executable code */ |
---|
555 | |
---|
556 | if (GCF_XWDW & map) |
---|
557 | xw_wrtch( map & WDWMASK, ch ); |
---|
558 | |
---|
559 | if (GCF_STDCH & map) |
---|
560 | printf( "%c", ch ); |
---|
561 | |
---|
562 | } /* end of gc_wrtch */ |
---|
563 | |
---|
564 | |
---|
565 | |
---|
566 | /*------------------------------------------------------------------------*/ |
---|
567 | |
---|
568 | |
---|
569 | |
---|
570 | int gc_txtwidth( CHMAP map ) |
---|
571 | |
---|
572 | /* returns width of channel in characters |
---|
573 | * |
---|
574 | * parameters of routine |
---|
575 | * CHMAP map; input; channel map |
---|
576 | */ |
---|
577 | { |
---|
578 | /* executable code */ |
---|
579 | |
---|
580 | if (GCF_STDCH & map) |
---|
581 | return 80; |
---|
582 | |
---|
583 | return 80; |
---|
584 | |
---|
585 | } /* end of gc_txtwidth */ |
---|
586 | |
---|
587 | |
---|
588 | |
---|
589 | /*------------------------------------------------------------------------*/ |
---|
590 | |
---|
591 | |
---|
592 | |
---|
593 | int gc_txtheight( CHMAP map ) |
---|
594 | |
---|
595 | /* returns height of window in characters |
---|
596 | * |
---|
597 | * parameters of routine |
---|
598 | * CHMAP wdw; input; channel map |
---|
599 | */ |
---|
600 | { |
---|
601 | /* executable code */ |
---|
602 | |
---|
603 | if (GCF_STDCH & map) |
---|
604 | return 24; |
---|
605 | |
---|
606 | return 24; |
---|
607 | |
---|
608 | } /* end of gc_txtheight */ |
---|
609 | |
---|
610 | |
---|
611 | |
---|
612 | /*------------------------------------------------------------------------*/ |
---|
613 | |
---|
614 | |
---|
615 | |
---|
616 | float gc_chheight( CHMAP map ) |
---|
617 | |
---|
618 | /* returns current character height in window "wdw" |
---|
619 | * |
---|
620 | * parameter of routine |
---|
621 | * CHMAP map; input; channel map |
---|
622 | */ |
---|
623 | { |
---|
624 | /* executable code */ |
---|
625 | |
---|
626 | if (GCF_XWDW & map) |
---|
627 | return xw_chheight( map & WDWMASK ); |
---|
628 | |
---|
629 | return 0.0; |
---|
630 | |
---|
631 | } /* end of gc_chheight */ |
---|
632 | |
---|
633 | |
---|
634 | |
---|
635 | /*------------------------------------------------------------------------*/ |
---|
636 | |
---|
637 | |
---|
638 | |
---|
639 | void gc_read( CHMAP map, int maxlth, char text[] ) |
---|
640 | |
---|
641 | /* reads text from terminal |
---|
642 | * |
---|
643 | * parameters of routine |
---|
644 | * CHMAP map; input; channel map |
---|
645 | * int maxlth; input; maximum length of text |
---|
646 | * char text[]; output; text read |
---|
647 | */ |
---|
648 | { |
---|
649 | /* executable code */ |
---|
650 | |
---|
651 | if (GCF_XWDW & map) { |
---|
652 | xw_read( map & WDWMASK, maxlth, text ); |
---|
653 | return; |
---|
654 | } /*endif*/ |
---|
655 | |
---|
656 | fgets( text, maxlth, stdin ); |
---|
657 | |
---|
658 | } /* end of gc_read */ |
---|
659 | |
---|
660 | |
---|
661 | |
---|
662 | /*------------------------------------------------------------------------*/ |
---|
663 | |
---|
664 | |
---|
665 | |
---|
666 | void gc_getloc( CHMAP map, COOTYPE *x, COOTYPE *y, char *ch ) |
---|
667 | |
---|
668 | /* requests mouse position in window |
---|
669 | * |
---|
670 | * parameters of routine |
---|
671 | * CHMAP map; input; channel map |
---|
672 | * COOTYPE *x, *y; output; location selected |
---|
673 | * char *ch; output; key pressed |
---|
674 | */ |
---|
675 | { |
---|
676 | /* executable code */ |
---|
677 | |
---|
678 | if (GCF_XWDW & map) { |
---|
679 | xw_getloc( map & WDWMASK, x, y, ch ); |
---|
680 | CSWAP(*x,*y) |
---|
681 | return; |
---|
682 | } /*endif*/ |
---|
683 | |
---|
684 | } /* end of gc_getloc */ |
---|
685 | |
---|
686 | |
---|
687 | |
---|
688 | /*------------------------------------------------------------------------*/ |
---|
689 | |
---|
690 | |
---|
691 | |
---|
692 | void gc_set_outputdir( char dir[], STATUS *status ) |
---|
693 | |
---|
694 | /* sets scratch directory |
---|
695 | * |
---|
696 | * parameters of routine |
---|
697 | * char dir[]; input; new directory name of scratch path |
---|
698 | * STATUS *status; output; return status |
---|
699 | */ |
---|
700 | { |
---|
701 | /* executable code */ |
---|
702 | |
---|
703 | ps_set_outputdir( dir, status ); |
---|
704 | if (Severe(status)) return; |
---|
705 | xw_set_outputdir( dir, status ); |
---|
706 | if (Severe(status)) return; |
---|
707 | |
---|
708 | } /* end of gc_set_outputdir */ |
---|
709 | |
---|
710 | |
---|
711 | |
---|
712 | /*------------------------------------------------------------------------*/ |
---|
713 | |
---|
714 | |
---|
715 | |
---|
716 | void gc_set_inputdir( char dir[], STATUS *status ) |
---|
717 | |
---|
718 | /* sets input directory |
---|
719 | * |
---|
720 | * parameters of routine |
---|
721 | * char dir[]; input; new directory name |
---|
722 | * STATUS *status; output; return status |
---|
723 | */ |
---|
724 | { |
---|
725 | /* executable code */ |
---|
726 | |
---|
727 | ps_set_inputdir( dir, status ); |
---|
728 | if (Severe(status)) return; |
---|
729 | xw_set_inputdir( dir, status ); |
---|
730 | if (Severe(status)) return; |
---|
731 | |
---|
732 | } /* end of gc_set_inputdir */ |
---|
733 | |
---|
734 | |
---|
735 | |
---|
736 | /*------------------------------------------------------------------------*/ |
---|
737 | |
---|
738 | |
---|
739 | |
---|
740 | void gc_setpar( CHMAP map, char item[], char value[], STATUS *status ) |
---|
741 | |
---|
742 | /* sets channel specific parameters |
---|
743 | * |
---|
744 | * parameters of routine |
---|
745 | * CHMAP map; input; channel map |
---|
746 | * char item[]; input; name of item to be changed |
---|
747 | * char value[]; input; new value of item |
---|
748 | * STATUS *status; output; return status |
---|
749 | */ |
---|
750 | { |
---|
751 | /* executable code */ |
---|
752 | |
---|
753 | if (GCF_PSF & map) { |
---|
754 | ps_setpar( item, value, status ); |
---|
755 | if (Severe(status)) return; |
---|
756 | } /*endif*/ |
---|
757 | |
---|
758 | } /* end of gc_setpar */ |
---|
759 | |
---|
760 | |
---|
761 | |
---|
762 | /*----------------------------------------------------------------------------*/ |
---|
763 | |
---|
764 | |
---|
765 | |
---|
766 | void gc_update( void ) |
---|
767 | |
---|
768 | /* updates window content |
---|
769 | * no parameters |
---|
770 | */ |
---|
771 | { |
---|
772 | /* executable code */ |
---|
773 | |
---|
774 | if (GCF_XWDW & gcv_initmap) |
---|
775 | xw_updatewdw(); |
---|
776 | |
---|
777 | } /* end of gc_update */ |
---|
778 | |
---|
779 | |
---|
780 | |
---|
781 | /*------------------------------------------------------------------------*/ |
---|
782 | |
---|
783 | |
---|
784 | |
---|
785 | void gc_flushbuffers( void ) |
---|
786 | |
---|
787 | /* flushes all output buffers |
---|
788 | * |
---|
789 | * no parameters |
---|
790 | */ |
---|
791 | { |
---|
792 | /* executable code */ |
---|
793 | |
---|
794 | if (GCF_XWDW & gcv_initmap) |
---|
795 | xw_flushbuffers(); |
---|
796 | |
---|
797 | } /* end of gc_flushbuffers */ |
---|
798 | |
---|
799 | |
---|
800 | |
---|
801 | /*------------------------------------------------------------------------*/ |
---|
802 | |
---|
803 | |
---|
804 | |
---|
805 | void gc_playback( CHMAP src, CHMAP dst, char outf[], STATUS *status ) |
---|
806 | |
---|
807 | /* copies content of channel src into channel dst |
---|
808 | * |
---|
809 | * parameters of routine |
---|
810 | * CHMAP src; input; source channel |
---|
811 | * CHMAP dst; input; destination channel |
---|
812 | * char outf[]; output; output filename |
---|
813 | * STATUS *status; output; return status |
---|
814 | */ |
---|
815 | { |
---|
816 | /* local variables */ |
---|
817 | PAINTBOX pb; /* paintbox routines */ |
---|
818 | |
---|
819 | /* executable code */ |
---|
820 | |
---|
821 | # ifdef BC_G_XWDW |
---|
822 | if (GCF_XWDW & dst) { |
---|
823 | pb.wpb.pbtype = GBC_WPAINT; |
---|
824 | pb.wpb.prepare = xw_prepare; |
---|
825 | pb.wpb.moveto = xw_moveto; |
---|
826 | pb.wpb.drawto = xw_drawto; |
---|
827 | pb.wpb.arrayplot = xw_arrayplot; |
---|
828 | pb.wpb.text = xw_text; |
---|
829 | pb.wpb.setstyle = xw_setstyle; |
---|
830 | pb.wpb.setcoo = xw_setcoo; |
---|
831 | pb.wpb.cleanup = xw_cleanup; |
---|
832 | mm_playback( src & WDWMASK, dst & WDWMASK, &pb, outf, status ); |
---|
833 | if (Severe(status)) return; |
---|
834 | } /*endif*/ |
---|
835 | # endif /* BC_G_XWDW */ |
---|
836 | |
---|
837 | # ifdef BC_G_POSTSCRIPT |
---|
838 | if (GCF_PSF & dst) { |
---|
839 | pb.ppb.pbtype = GBC_PPAINT; |
---|
840 | pb.ppb.prepare = ps_prepare; |
---|
841 | pb.ppb.moveto = ps_moveto; |
---|
842 | pb.ppb.drawto = ps_drawto; |
---|
843 | pb.ppb.arrayplot = ps_arrayplot; |
---|
844 | pb.ppb.text = ps_text; |
---|
845 | pb.ppb.setstyle = ps_setstyle; |
---|
846 | pb.ppb.setcoo = ps_setcoo; |
---|
847 | pb.ppb.cleanup = ps_cleanup; |
---|
848 | mm_playback( src & WDWMASK, dst & WDWMASK, &pb, outf, status ); |
---|
849 | if (Severe(status)) return; |
---|
850 | } /*endif*/ |
---|
851 | # endif /* BC_G_POSTSCRIPT */ |
---|
852 | |
---|
853 | } /* end of gc_playback */ |
---|
854 | |
---|
855 | |
---|
856 | |
---|
857 | /*------------------------------------------------------------------------*/ |
---|
858 | |
---|
859 | |
---|
860 | |
---|
861 | void gc_set_write_extern( void (*wr_rout)(char text[]) ) |
---|
862 | |
---|
863 | /* sets the write routine for the external channel |
---|
864 | * |
---|
865 | * parameters of routine |
---|
866 | * void (*wr_rout)(char text[]); input; output routine |
---|
867 | */ |
---|
868 | { |
---|
869 | /* executable code */ |
---|
870 | |
---|
871 | gcv_writeext = wr_rout; |
---|
872 | |
---|
873 | } /* end of gc_set_write_extern */ |
---|
874 | |
---|
875 | |
---|
876 | |
---|
877 | /*------------------------------------------------------------------------*/ |
---|
878 | |
---|
879 | |
---|
880 | |
---|
881 | void gc_closeplot( CHMAP map, char outf[], STATUS *status ) |
---|
882 | |
---|
883 | /* closes plot file on hardcopy channels |
---|
884 | * |
---|
885 | * parameters of routine |
---|
886 | * CHMAP map; input; channel map |
---|
887 | * char outf[]; output; name of plotfile |
---|
888 | * STATUS *status; output; return status |
---|
889 | */ |
---|
890 | { |
---|
891 | /* executable code */ |
---|
892 | |
---|
893 | if (GCF_PSF & map) { |
---|
894 | ps_cleanup( outf, status ); |
---|
895 | if (Severe(status)) return; |
---|
896 | } /*endif*/ |
---|
897 | |
---|
898 | } /* end of gc_closeplot */ |
---|
899 | |
---|
900 | |
---|
901 | |
---|
902 | /*------------------------------------------------------------------------*/ |
---|
903 | |
---|
904 | |
---|
905 | |
---|
906 | void gc_swap( BOOLEAN on_off ) |
---|
907 | |
---|
908 | /* switches x-y swapping on or off |
---|
909 | * |
---|
910 | * parameters of routine |
---|
911 | * BOOLEAN on_off; input; TRUE=on, FALSE=off |
---|
912 | */ |
---|
913 | { |
---|
914 | /* executable code */ |
---|
915 | |
---|
916 | gcv_swap = on_off; |
---|
917 | # ifdef BC_G_XWINDOW |
---|
918 | xw_arrayswap( on_off ); |
---|
919 | # endif |
---|
920 | # ifdef BC_G_POSTSCRIPT |
---|
921 | ps_arrayswap( on_off ); |
---|
922 | # endif |
---|
923 | |
---|
924 | } /* end of gc_swap */ |
---|
925 | |
---|
926 | |
---|
927 | |
---|
928 | /*------------------------------------------------------------------------*/ |
---|