Initial release of Maemo 5 port of gnuplot
[gnuplot] / term / aed.trm
1 /* Hello, Emacs, this is -*-C-*-
2  * $Id: aed.trm,v 1.14 2006/07/21 02:35:45 sfeam Exp $
3  *
4  */
5
6 /* GNUPLOT - aed.trm */
7
8 /*[
9  * Copyright 1990 - 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  *   AED terminals
43  *
44  * AUTHORS
45  *     Colin Kelley, Thomas Williams, Russell Lang
46  *
47  * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
48  *
49  */
50
51 /*
52  * adapted to the new terminal layout by Stefan Bodewig (Dez. 1995)
53  */
54
55 #include "driver.h"
56
57 #ifdef TERM_REGISTER
58 register_term(aed512)
59 register_term(aed767)
60 #endif
61
62 #ifdef TERM_PROTO
63 TERM_PUBLIC void AED_init __PROTO((void));
64 TERM_PUBLIC void AED_graphics __PROTO((void));
65 TERM_PUBLIC void AED_text __PROTO((void));
66 TERM_PUBLIC void AED_linetype __PROTO((int linetype));
67 TERM_PUBLIC void AED_move __PROTO((unsigned int x, unsigned int y));
68 TERM_PUBLIC void AED_vector __PROTO((unsigned int x, unsigned int y));
69 TERM_PUBLIC void AED_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
70 TERM_PUBLIC void AED_reset __PROTO((void));
71
72 #define AED_XMAX 768
73 #define AED_YMAX 575
74
75 #define AED_VCHAR       13
76 #define AED_HCHAR       8
77 #define AED_VTIC        8
78 #define AED_HTIC        7
79
80 /* slightly different for AED 512 */
81 #define AED5_XMAX 512
82 #endif
83
84 #ifndef TERM_PROTO_ONLY
85 #ifdef TERM_BODY
86
87 #define AED_XLAST (AED_XMAX - 1)
88 #define AED_YLAST (AED_YMAX - 1)
89
90 #define AED5_XLAST (AED5_XMAX - 1)
91
92 TERM_PUBLIC void
93 AED_init()
94 {
95     fputs("\033SEN3DDDN.SEC.7.SCT.0.1.80.80.90.SBC.0.AAV2.MOV.0.9.CHR.0.FFD", gpoutfile);
96 /*         2            3     4                5     7    6       1
97         1. Clear Screen
98         2. Set Encoding
99         3. Set Default Color
100         4. Set Backround Color Table Entry
101         5. Set Backround Color
102         6. Move to Bottom Lefthand Corner
103         7. Anti-Alias Vectors
104 */
105 }
106
107
108 TERM_PUBLIC void
109 AED_graphics()
110 {
111     fputs("\033FFD\033", gpoutfile);
112 }
113
114
115 TERM_PUBLIC void
116 AED_text()
117 {
118     fputs("\033MOV.0.9.SEC.7.XXX", gpoutfile);
119 }
120
121
122
123 TERM_PUBLIC void
124 AED_linetype(int linetype)
125 {
126     static int color[2 + 9] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 };
127     static int type[2 + 9] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 };
128
129     if (linetype <= -3)
130         return;
131     if (linetype >= 10)
132         linetype %= 10;
133
134     fprintf(gpoutfile, "\
135 \033SLS%d.255.\
136 \033SEC%d.",
137             type[linetype + 2],
138             color[linetype + 2]);
139 }
140
141
142
143 TERM_PUBLIC void
144 AED_move(unsigned int x, unsigned int y)
145 {
146     fprintf(gpoutfile, "\033MOV%d.%d.", x, y);
147 }
148
149
150 TERM_PUBLIC void
151 AED_vector(unsigned int x, unsigned int y)
152 {
153     fprintf(gpoutfile, "\033DVA%d.%d.", x, y);
154 }
155
156
157 TERM_PUBLIC void
158 AED_put_text(unsigned int x, unsigned int y, const char *str)
159 {
160     AED_move(x, y - AED_VCHAR / 2 + 2);
161     fprintf(gpoutfile, "\033XXX%s\033", str);
162 }
163
164
165 #define hxt (AED_HTIC/2)
166 #define hyt (AED_VTIC/2)
167
168 TERM_PUBLIC void
169 AED_reset()
170 {
171     fputs("\033SCT0.1.0.0.0.SBC.0.FFD", gpoutfile);
172 }
173
174 #endif /* TERM_BODY */
175
176 #ifdef TERM_TABLE
177 TERM_TABLE_START(aed512_driver)
178     "aed512", "AED 512 Terminal",
179     AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
180     AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset,
181     AED_text, null_scale, AED_graphics, AED_move, AED_vector,
182     AED_linetype, AED_put_text, null_text_angle,
183     null_justify_text, do_point, do_arrow, set_font_null
184 TERM_TABLE_END(aed512_driver)
185
186 #undef LAST_TERM
187 #define LAST_TERM aed512_driver
188
189 TERM_TABLE_START(aed767_driver)
190     "aed767", "AED 767 Terminal",
191     AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
192     AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset,
193     AED_text, null_scale, AED_graphics, AED_move, AED_vector,
194     AED_linetype, AED_put_text, null_text_angle,
195     null_justify_text, do_point, do_arrow, set_font_null
196 TERM_TABLE_END(aed767_driver)
197
198 #undef LAST_TERM
199 #define LAST_TERM aed767_driver
200
201 #endif /* TERM_TABLE */
202 #endif /* TERM_PROTO_ONLY */
203
204 #ifdef TERM_HELP
205 START_HELP(aed767)
206 "1 aed767",
207 "?commands set terminal aed767",
208 "?set terminal aed767",
209 "?set term aed767",
210 "?terminal aed767",
211 "?term aed767",
212 "?aed767",
213 "?commands set terminal aed512",
214 "?set terminal aed512",
215 "?set term aed512",
216 "?terminal aed512",
217 "?term aed512",
218 "?aed512",
219 " The `aed512` and `aed767` terminal drivers support AED graphics terminals.",
220 " The two drivers differ only in their horizontal ranges, which are 512 and",
221 " 768 pixels, respectively.  Their vertical range is 575 pixels.  There are",
222 " no options for these drivers."
223 END_HELP(aed767)
224 #endif