/usr/bin/gnuplot symlinks packageing problems were fixed gor gnuplot-x11
[gnuplot] / term / atariaes.trm
1 /* Hello, Emacs, this is -*-C-*-
2  * $Id: atariaes.trm,v 1.19 2006/07/21 02:35:45 sfeam Exp $
3  *
4  */
5
6 /* GNUPLOT - atari.trm */
7
8 /*[
9  * Copyright 1992, 1993, 1998, 2004
10  *
11  * Permission to use, copy, and distribute this software and its
12  * documentation for any purpose with or without fee is hereby granted,
13  * provided that the above copyright notice appear in all copies and
14  * that both that copyright notice and this permission notice appear
15  * in supporting documentation.
16  *
17  * Permission to modify the software is granted, but not the right to
18  * distribute the complete modified source code.  Modifications are to
19  * be distributed as patches to the released version.  Permission to
20  * distribute binaries produced by compiling modified sources is granted,
21  * provided you
22  *   1. distribute the corresponding source modifications from the
23  *    released version in the form of a patch file along with the binaries,
24  *   2. add special version identification to distinguish your version
25  *    in addition to the base release version number,
26  *   3. provide your name and address as the primary contact for the
27  *    support of your modified version, and
28  *   4. retain our contact information in regard to use of the base
29  *    software.
30  * Permission to distribute the released version of the source code along
31  * with corresponding source modifications in the form of a patch file is
32  * granted with same provisions 2 through 4 for binary distributions.
33  *
34  * This software is provided "as is" without express or implied warranty
35  * to the extent permitted by applicable law.
36 ]*/
37
38 /*
39  * This file is included by ../term.c.
40  *
41  * This terminal driver supports:
42  *   Atari Screens working with the normal VDI
43  *     (this should include TT and big screens)
44  *
45  * AUTHORS
46  *  Alexander Lehmann
47  *  HE Koechling
48  *
49  * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
50  *
51  * ATARI-related comments please to alexlehm@iti.informatik.th-darmstadt.de
52  *
53  */
54
55 #include "driver.h"
56
57 #ifdef TERM_REGISTER
58 register_term(atari)
59 #endif
60
61 #ifdef TERM_PROTO
62
63 /* function-prototypes */
64 TERM_PUBLIC void ATARI_options __PROTO((void));
65 TERM_PUBLIC void ATARI_init __PROTO((void));
66 TERM_PUBLIC void ATARI_reset __PROTO((void));
67 TERM_PUBLIC void ATARI_graphics __PROTO((void));
68 TERM_PUBLIC void ATARI_text __PROTO((void));
69 TERM_PUBLIC void ATARI_move __PROTO((unsigned int x, unsigned int y));
70 TERM_PUBLIC void ATARI_vector __PROTO((unsigned int x, unsigned int y));
71 TERM_PUBLIC void ATARI_linetype __PROTO((int lt));
72 TERM_PUBLIC void ATARI_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
73 TERM_PUBLIC int ATARI_text_angle __PROTO((int ang));
74 TERM_PUBLIC int ATARI_justify_text __PROTO((enum JUSTIFY mode));
75 TERM_PUBLIC void ATARI_point __PROTO((unsigned int x, unsigned int y, int number));
76
77 /* default to hi-res */
78 #define ATARI_XMAX 640
79 #define ATARI_YMAX 400
80 #define ATARI_VCHAR 16
81 #define ATARI_HCHAR 8
82 #define ATARI_HTIC (ATARI_XMAX/100)
83 #define ATARI_VTIC ATARI_HTIC
84
85 #endif /* TERM_PROTO */
86
87 #ifndef TERM_PROTO_ONLY
88 #ifdef TERM_BODY
89
90 #ifdef __PUREC__
91 /* why did they have to change these names ??? */
92 # include <aes.h>
93 # include <vdi.h>
94 # include <tos.h>
95 #else /* !__PUREC__ i.e. __GNUC__, maybe others */
96 # include <aesbind.h>
97 # include <vdibind.h>
98 # include <osbind.h>
99 extern short _global[];
100 #endif
101
102 #include <ctype.h>
103
104 static void open_window __PROTO((void));
105 static void close_window __PROTO((void));
106 static void text_mode __PROTO((void));
107 static void mouse_mode __PROTO((void));
108 static void application_exit __PROTO((void));
109 void application_init __PROTO((void));
110 static int intersect __PROTO((int *x1, int *y1, int *w1, int *h1, int x2, int y2, int w2, int h2));
111 static void walk_rects __PROTO((void (*draw) (int, int, int, int), int x1, int y1, int w1, int h1));
112 static void clear __PROTO((int x, int y, int w, int h));
113 static void process_message __PROTO((int *msg));
114 long poll_events __PROTO((int waitkey));
115 static void f_line __PROTO((int x, int y, int w, int h));
116 static void flush_line __PROTO((void));
117 static void put_text __PROTO((int x, int y, int w, int h));
118
119 static int multi_aes;
120 static int window_id = -1;
121 static int vdi_handle = -1;
122 static int win_xpos, win_ypos;
123 static int win_xsize, win_ysize;
124
125 #define ATARI_yc(y) (ATARI_maxycoord-(y))
126 static int ATARI_linetypes[] =
127 {
128     0xffff, 0x1111,
129     0xffff, 0x5555, 0x3333, 0x7777,
130     0x3f3f, 0x0f0f, 0x5f5f, 0xe4e4, 0x55f5
131 };
132
133 #define ATARI_LINETYPES_MAX     (sizeof(ATARI_linetypes)/sizeof(int))
134
135 static int ATARI_lt;
136 static int ATARI_maxycoord;
137 static int ATARI_rotation;
138 static int ATARI_numcolors;
139 static int pxy[128];            /* Maximum of 64 pixels per v_pline */
140 static int pxy_index;
141 static int ATARI_colors[16];
142 static int ATARI_savecolors[16][3];
143 static int ATARI_numpalette;
144
145 #define ATARI_c_height_default 6        /* well, well ...               */
146
147 static int ATARI_c_height = ATARI_c_height_default;
148
149 static int cursor_is_on = FALSE;
150 static int put_text_x;
151 static int put_text_y;
152 static char *put_text_str;
153
154 /* don't change this without changing process_message() below */
155 #define WINTYPE (NAME|CLOSER|FULLER|MOVER|SIZER)
156
157 static void
158 open_window()
159 {
160     int x, y, w, h;
161
162     if (window_id == -1) {
163         wind_calc(WC_BORDER, WINTYPE, win_xpos, win_ypos,
164                   win_xsize, win_ysize, &x, &y, &w, &h);
165         window_id = wind_create(WINTYPE, x, y, w, h);
166
167         if (window_id < 0) {
168             window_id = -1;
169             int_error(NO_CARET, "Can't create window");
170         }
171         wind_set(window_id, WF_NAME, "gnuplot output");
172         wind_open(window_id, x, y, w, h);
173     }
174 }
175
176 static void
177 close_window()
178 {
179     if (window_id != -1) {
180         wind_close(window_id);
181         wind_delete(window_id);
182         window_id = -1;
183     }
184 }
185
186 static void
187 text_mode()
188 {
189     if (!multi_aes) {
190         if (!cursor_is_on) {
191             cursor_is_on = TRUE;
192             graf_mouse(M_OFF, NULL);
193             fputs("\033e", stderr);
194         }
195         fputs("\033E", stderr);
196     }
197 }
198
199 static void
200 mouse_mode()
201 {
202     if (!multi_aes) {
203         if (cursor_is_on) {
204             cursor_is_on = FALSE;
205             graf_mouse(M_ON, NULL);
206             fputs("\033f", stderr);
207         }
208     }
209 }
210
211 static void
212 application_exit()
213 {
214     close_window();
215
216     if (vdi_handle != -1) {
217         v_clsvwk(vdi_handle);
218     }
219     mouse_mode();
220 }
221
222 void
223 application_init()
224 {
225     if (aesid < 0) {
226         if ((aesid = appl_init()) < 0)
227             int_error(NO_CARET, "APPL_INIT failed !");
228     }
229 #ifdef __PUREC__
230     multi_aes = _GemParBlk.global[1] == -1;
231 #else
232     /* tested with gcc only */
233     multi_aes = _global[1] == -1;
234 #endif
235
236     if (!multi_aes)
237         graf_mouse(ARROW, NULL);
238     else
239         menu_register(aesid, "  Terminal: atari");
240
241     text_mode();
242     atexit(application_exit);
243 }
244
245 static int
246 intersect(int *x1, int *y1, int *w1, int *h1, int x2, int y2, int w2, int h2)
247 {
248     if (*x1 > x2) {
249         w2 -= *x1 - x2;
250         x2 = *x1;
251     } else {
252         (*w1) -= x2 - *x1;
253         *x1 = x2;
254     }
255     if (*y1 > y2) {
256         h2 -= *y1 - y2;
257         y2 = *y1;
258     } else {
259         (*h1) -= y2 - *y1;
260         *y1 = y2;
261     }
262     if (*w1 > w2) {
263         *w1 = w2;
264     } else {
265         w2 = *w1;
266     }
267     if (*h1 > h2) {
268         *h1 = h2;
269     } else {
270         h2 = *h1;
271     }
272
273     return (*w1) > 0 && (*h1) > 0;
274 }
275
276 static void
277 walk_rects(void (*draw) (int, int, int, int), int x1, int y1, int w1, int h1)
278 {
279     int x, y, w, h;
280     int pxy[4];
281
282     wind_update(BEG_UPDATE);
283     graf_mouse(M_OFF, NULL);
284
285     wind_get(window_id, WF_FIRSTXYWH, &x, &y, &w, &h);
286     while (w > 0 && h > 0) {
287         if (intersect(&x, &y, &w, &h, x1, y1, w1, h1)) {
288             pxy[0] = x;
289             pxy[1] = y;
290             pxy[2] = x + w - 1;
291             pxy[3] = y + h - 1;
292             vs_clip(vdi_handle, 1, pxy);
293             (*draw) (x, y, w, h);
294         }
295         wind_get(window_id, WF_NEXTXYWH, &x, &y, &w, &h);
296     }
297     vs_clip(vdi_handle, 0, pxy);
298     graf_mouse(M_ON, NULL);
299     wind_update(END_UPDATE);
300 }
301
302 static void
303 clear(int x, int y, int w, int h)
304 {
305     static MFDB mfdb = { NULL };
306     int pxy[8];
307
308     pxy[0] = pxy[4] = x;
309     pxy[1] = pxy[5] = y;
310     pxy[2] = pxy[6] = x + w - 1;
311     pxy[3] = pxy[7] = y + h - 1;
312
313     vro_cpyfm(vdi_handle, ALL_WHITE /*0 */ , pxy, &mfdb, &mfdb);
314 }
315
316 static void
317 process_message(int *msg)
318 {
319     static int is_fulled = FALSE;
320     static int small_xpos, small_ypos, small_xsize, small_ysize;
321     int x, y, w, h;
322
323     if (window_id == -1 || msg[3] != window_id)
324         return;
325
326     switch (msg[0]) {
327     case WM_REDRAW:
328         walk_rects(clear, msg[4], msg[5], msg[6], msg[7]);
329         break;
330
331     case WM_CLOSED:
332         close_window();
333         break;
334
335     case WM_TOPPED:
336         wind_set(window_id, WF_TOP, window_id);
337         break;
338
339     case WM_MOVED:
340     case WM_SIZED:
341         is_fulled = 0;
342         wind_calc(WC_WORK, WINTYPE, msg[4], msg[5], msg[6], msg[7],
343                   &win_xpos, &win_ypos, &win_xsize, &win_ysize);
344         wind_set(window_id, WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
345         break;
346
347     case WM_FULLED:
348         if (!is_fulled) {
349             is_fulled = TRUE;
350             small_xpos = win_xpos;
351             small_ypos = win_ypos;
352             small_xsize = win_xsize;
353             small_ysize = win_ysize;
354
355             wind_get(0, WF_WORKXYWH, &x, &y, &w, &h);
356             wind_calc(WC_WORK, WINTYPE, x, y, w, h, &win_xpos, &win_ypos,
357                       &win_xsize, &win_ysize);
358         } else {
359             is_fulled = FALSE;
360             win_xpos = small_xpos;
361             win_ypos = small_ypos;
362             win_xsize = small_xsize;
363             win_ysize = small_ysize;
364         }
365         wind_calc(WC_BORDER, WINTYPE, win_xpos, win_ypos, win_xsize,
366                   win_ysize, &x, &y, &w, &h);
367         wind_set(window_id, WF_CURRXYWH, x, y, w, h);
368         break;
369     }
370 }
371
372 long
373 poll_events(int waitkey)
374 {
375     int msg[8];
376     int dummy;
377     int which;
378     int key = 0;
379     /* 1/10th second when waiting for key, poll otherwise */
380     unsigned long time = (waitkey ? 100L : 1L);
381
382     do {
383         which = evnt_multi(
384                               (waitkey ? (MU_MESAG | MU_KEYBD | MU_TIMER) : (MU_MESAG | MU_TIMER)),
385                               0, 0, 0,
386                               0, 0, 0, 0, 0,
387                               0, 0, 0, 0, 0,
388                               msg,
389 #ifdef __PUREC__
390                               time, 0,
391 #else
392                               time,
393 #endif
394                               &dummy, &dummy, &dummy, &dummy, &key, &dummy);
395
396         if (which & MU_MESAG) {
397             process_message(msg);
398         }
399     } while (which & MU_MESAG);
400
401     if (which & MU_KEYBD) {
402         return ((Kbshift(-1) & 7) << 24) | ((long) (key & 0xff00) << 8) | (key & 0xff);
403     } else {
404         return 0;
405     }
406 }
407
408 static void
409 f_line(int x, int y, int w, int h)
410 {
411     v_pline(vdi_handle, pxy_index, pxy);
412 }
413
414 static void
415 flush_line()
416 {
417     int line_type;
418     int color_index;
419     int i;
420
421     if (pxy_index >= 2) {
422         if (ATARI_numcolors == 2) {     /* Monochrome */
423             color_index = 1;
424             line_type = ATARI_lt;
425             if (line_type >= 0)
426                 line_type %= (ATARI_LINETYPES_MAX - 2);
427         } else {                /* Color */
428             if (ATARI_lt < 0) {
429                 color_index = 1;
430                 line_type = ATARI_lt;
431             } else {
432                 color_index = 2 + ATARI_lt % (ATARI_numcolors - 2);
433                 line_type = (ATARI_lt / (ATARI_numcolors - 2)) % (ATARI_LINETYPES_MAX - 2);
434             }
435         }
436
437         vswr_mode(vdi_handle, MD_TRANS);
438         vsl_color(vdi_handle, color_index);
439
440         vsl_type(vdi_handle, 7);
441         vsl_udsty(vdi_handle, ATARI_linetypes[line_type + 2]);
442         walk_rects(f_line, win_xpos, win_ypos, win_xsize, win_ysize);
443     }
444     if (pxy_index >= 1) {
445         pxy[0] = pxy[2 * (pxy_index - 1)];
446         pxy[1] = pxy[2 * (pxy_index - 1) + 1];
447         pxy_index = 1;
448     }
449 }
450
451 static void
452 put_text(int x, int y, int w, int h)
453 {
454     v_gtext(vdi_handle, put_text_x, put_text_y, put_text_str);
455 }
456
457 TERM_PUBLIC void
458 ATARI_options()
459 {
460 #define ATARIHEXERROR "palette values 3 hex digits, please"
461 #define ATARIHEIGHTERROR "expecting a character height"
462     char opt[6];                /* maximum: 'fff'\0 */
463     int i;
464     char *tok_end;
465
466     term_options[0] = NUL;
467     ATARI_c_height = ATARI_c_height_default;
468
469     for (i = 0; i < 17; i++) {
470         if (END_OF_COMMAND)
471             break;
472         if (token[c_token].length > 5) {
473             ATARI_numpalette = 0;
474             ATARI_c_height = ATARI_c_height_default;
475             term_options[0] = NUL;
476             int_error(c_token, ATARIHEXERROR);
477         }
478         capture(opt, c_token, c_token, 6);
479         if (!i) {
480             ATARI_c_height = strtoul(opt, &tok_end, 10);
481             if (*tok_end != NUL) {
482                 ATARI_numpalette = 0;
483                 ATARI_c_height = ATARI_c_height_default;
484                 term_options[0] = NUL;
485                 int_error(c_token, ATARIHEIGHTERROR);
486             }
487             if (ATARI_c_height > 999)
488                 ATARI_c_height = 999;   /* avoid opt length overflow */
489             sprintf(opt, "%d ", ATARI_c_height);
490         } else {
491             if (*opt == '"' || *opt == '\'') {
492                 opt[strlen(opt) - 1] = NUL;
493                 strcpy(opt, opt + 1);
494             }
495             ATARI_colors[i - 1] = strtoul(opt, &tok_end, 16);
496             if (*tok_end != NUL) {
497                 ATARI_numpalette = 0;
498                 ATARI_c_height = ATARI_c_height_default;
499                 term_options[0] = NUL;
500                 int_error(c_token, ATARIHEXERROR);
501             }
502             sprintf(opt, "%X ", ATARI_colors[i - 1]);
503
504             /* do we need to quote? */
505             if (isdigit((unsigned char) *opt) && strpbrk(opt, "ABCDEF")) {
506                 sprintf(opt, "\"%X\" ", ATARI_colors[i - 1]);
507             }
508         }
509         strcat(term_options, opt);
510         c_token++;
511     }
512     ATARI_numpalette = (i == 0 ? 0 : i - 1);
513     /* printf("Number of linetypes:%d\n", ATARI_LINETYPES_MAX); */
514 }
515
516 TERM_PUBLIC void
517 ATARI_init()
518 {
519     int work_in[11];
520     int work_out[57];
521     int i;
522     int hchar, wchar, dummy;
523     int rgb[3];
524     int num_save;
525     char *colors, *tok_end;
526     int x, y, w, h;
527     static int have_win_size = 0;
528
529     application_init();
530
531     if (ATARI_numpalette == 0 && (colors = getenv("GNUCOLORS")) && *colors) {
532         for (i = 0; i < 17; i++) {
533             if (!i) {
534                 ATARI_c_height = strtoul(colors, &tok_end, 10);
535                 if (colors == tok_end) {
536                     i = 0;
537                     ATARI_c_height = ATARI_c_height_default;
538                     break;
539                 }
540             } else {
541                 if (*colors == '\0')
542                     break;
543                 ATARI_colors[i] = strtoul(colors, &tok_end, 16);
544                 if (colors == tok_end || (unsigned) ATARI_colors[i] > 0xfff) {
545                     i = 0;
546                     break;
547                 }
548             }
549             colors = tok_end;
550
551             while (*colors == ' ')
552                 colors++;
553         }
554         ATARI_numpalette = (i == 0 ? 0 : i - 1);
555     }
556     vdi_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
557
558     if (!vdi_handle)
559         int_error(NO_CARET, "Fatal error opening virtual workstation");
560
561     for (i = 0; i < 10; work_in[i++] = 1);
562     work_in[10] = 2;            /* use raster coordinates */
563     v_opnvwk(work_in, &vdi_handle, work_out);
564
565     if (!vdi_handle)
566         int_error(NO_CARET, "Fatal error opening virtual workstation");
567
568     if (!have_win_size) {
569         wind_get(0, WF_WORKXYWH, &x, &y, &w, &h);
570         wind_calc(WC_WORK, WINTYPE, x, y, w, h, &win_xpos, &win_ypos,
571                   &win_xsize, &win_ysize);
572         have_win_size = 1;
573     }
574     term->xmax = win_xsize;
575     term->ymax = win_ysize;
576
577     vst_height(vdi_handle, ATARI_c_height, &dummy, &dummy, &wchar, &hchar);
578
579     term->h_char = wchar;
580     term->v_char = hchar;       /* hchar stands for height this time */
581     term->h_tic = win_xsize / 100;
582     term->v_tic = term->h_tic;
583
584     ATARI_maxycoord = win_ysize - 1;
585     ATARI_numcolors = work_out[13];
586
587     for (i = 0; i < ATARI_numpalette; i++) {
588         vq_color(vdi_handle, i, 1, ATARI_savecolors[i]);
589
590         rgb[0] = 1000 * (ATARI_colors[i] >> 8);
591         rgb[0] /= 15;
592         rgb[1] = 1000 * ((ATARI_colors[i] >> 4) & 15);
593         rgb[1] /= 15;
594         rgb[2] = 1000 * (ATARI_colors[i] & 15);
595         rgb[2] /= 15;
596         vs_color(vdi_handle, i, rgb);
597     }
598     pxy_index = 0;
599 }
600
601 TERM_PUBLIC void
602 ATARI_reset()
603 {
604     int i;
605
606     close_window();
607     if (vdi_handle != -1) {
608         for (i = 0; i < ATARI_numpalette; i++) {
609             vs_color(vdi_handle, i, ATARI_savecolors[i]);
610         }
611         v_clsvwk(vdi_handle);
612         vdi_handle = -1;
613     }
614 }
615
616 TERM_PUBLIC void
617 ATARI_graphics()
618 {
619     ATARI_maxycoord = win_ysize - 1;
620
621     term->xmax = win_xsize;
622     term->ymax = win_ysize;
623
624     mouse_mode();
625     open_window();
626     poll_events(0);
627     walk_rects(clear, win_xpos, win_ypos, win_xsize, win_ysize);
628
629     pxy_index = 0;
630 }
631
632 TERM_PUBLIC void
633 ATARI_text()
634 {
635     flush_line();
636     if (!multi_aes) {
637         while (window_id != -1 && !poll_events(1));
638         close_window();
639     }
640     text_mode();
641 }
642
643 TERM_PUBLIC void
644 ATARI_move(unsigned int x, unsigned int y)
645 {
646     flush_line();
647
648     pxy[0] = x + win_xpos;
649     pxy[1] = ATARI_yc(y) + win_ypos;
650     pxy_index = 1;
651 }
652
653 TERM_PUBLIC void
654 ATARI_vector(unsigned int x, unsigned int y)
655 {
656     pxy[2 * pxy_index] = x + win_xpos;
657     pxy[2 * pxy_index + 1] = ATARI_yc(y) + win_ypos;
658     pxy_index++;
659
660     if (pxy_index == 64) {      /* we're all full */
661         flush_line();
662     }
663 }
664
665 TERM_PUBLIC void
666 ATARI_linetype(int lt)
667 {
668     flush_line();
669
670     ATARI_lt = lt;
671 }
672
673 TERM_PUBLIC void
674 ATARI_put_text(unsigned int x, unsigned int y, const char *str)
675 {
676     int vchar = term->v_char;
677     int dummy;
678
679     if (!strlen(str))
680         return;
681
682     if (x < 0)
683         x = 0;
684     if (y < 0)
685         y = 0;
686
687     /* align text left and to middle of char height */
688     vst_alignment(vdi_handle, 0, 5, &dummy, &dummy);
689     vst_rotation(vdi_handle, (ATARI_rotation ? 900 : 0));
690     if (ATARI_rotation) {
691         put_text_x = x - vchar / 2 + 1 + win_xpos;
692         put_text_y = ATARI_yc(y) - 1 + win_ypos;
693         put_text_str = str;
694     } else {
695         put_text_x = x + 1 + win_xpos;
696         put_text_y = ATARI_yc(y) - vchar / 2 + 1 + win_ypos;
697         put_text_str = str;
698     }
699     walk_rects(put_text, win_xpos, win_ypos, win_xsize, win_ysize);
700 }
701
702 TERM_PUBLIC int
703 ATARI_text_angle(int ang)
704 {
705     ATARI_rotation = ang;
706
707     return TRUE;
708 }
709
710 TERM_PUBLIC int
711 ATARI_justify_text(enum JUSTIFY mode)
712 {
713     return FALSE;
714 }
715
716 TERM_PUBLIC void
717 ATARI_point(unsigned int x, unsigned int y, int number)
718 {
719     int old_linetype;
720
721     if (ATARI_numcolors == 2) {
722         line_and_point(x, y, number);   /* monochrome */
723     } else {
724         /* we map colors that exceed our limit to dotted lines, but we can't do
725            that with the markers (sortof a generalized line_and_point) */
726         old_linetype = ATARI_lt;
727         if (ATARI_lt > ATARI_numcolors - 2)
728             ATARI_linetype(ATARI_lt % (ATARI_numcolors - 2));   /* same color, but no dots */
729         do_point(x, y, number);
730         ATARI_linetype(old_linetype);
731     }
732 }
733
734 #endif /* TERM_BODY */
735
736 #ifdef TERM_TABLE
737
738 TERM_TABLE_START(atari_driver)
739     "atari", "Atari AES-Terminal",
740     ATARI_XMAX, ATARI_YMAX, ATARI_VCHAR, ATARI_HCHAR,
741     ATARI_VTIC, ATARI_HTIC, ATARI_options, ATARI_init, ATARI_reset,
742     ATARI_text, null_scale, ATARI_graphics, ATARI_move, ATARI_vector,
743     ATARI_linetype, ATARI_put_text, ATARI_text_angle,
744     ATARI_justify_text, ATARI_point, do_arrow, set_font_null,
745     0, TERM_CAN_MULTIPLOT, 0, 0
746 TERM_TABLE_END(atari_driver)
747
748 #undef LAST_TERM
749 #define LAST_TERM atari_driver
750
751 #endif /* TERM_TABLE */
752
753 #endif /* TERM_PROTO_ONLY */
754
755 #ifdef TERM_HELP
756 START_HELP(atari)
757 "1 atari ST (via AES)",
758 "?commands set terminal atari",
759 "?set terminal atari",
760 "?set term atari",
761 "?terminal atari",
762 "?term atari",
763 "?atari",
764 " The `atari` terminal has options to set the character size and the screen",
765 " colors.",
766 "",
767 " Syntax:",
768 "       set terminal atari {<fontsize>} {<col0> <col1> ... <col15>}",
769 "",
770 " The character size must appear if any colors are to be specified.  Each of",
771 " the (up to 16) colors is given as a three-digit hex number, where the digits",
772 " represent RED, GREEN and BLUE (in that order).  The range of 0--15 is scaled",
773 " to whatever color range the screen actually has.  On a normal ST screen, odd",
774 " and even intensities are the same.",
775 "",
776 " Examples:",
777 "       set terminal atari 4    # use small (6x6) font",
778 "       set terminal atari 6 0  # set monochrome screen to white on black",
779 "       set terminal atari 13 0 fff f00 f0 f ff f0f",
780 "                  # set first seven colors to black, white, red, green,",
781 "                  # blue, cyan, and purple and use large font (8x16).",
782 "",
783 " Additionally, if an environment variable GNUCOLORS exists, its contents are",
784 " interpreted as an options string, but an explicit terminal option takes",
785 " precedence."
786 END_HELP(atari)
787 #endif /* TERM_HELP */