Initial release of Maemo 5 port of gnuplot
[gnuplot] / term / dxy.trm
1 /* Hello, Emacs, this is -*-C-*-
2  * $Id: dxy.trm,v 1.14 2006/07/21 02:35:45 sfeam Exp $
3  *
4  */
5
6 /* GNUPLOT - dxy.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  *  Roland DXY800A plotter
43  *
44  * AUTHORS
45  *  Martin Yii, eln557h@monu3.OZ
46  *  Further modified Jan 1990 by Russell Lang, rjl@monu1.cc.monash.oz
47  *
48  * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
49  *
50  */
51
52 /*
53  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
54  */
55
56 #include "driver.h"
57
58 #ifdef TERM_REGISTER
59 register_term(dxy800a)
60 #endif
61
62 #ifdef TERM_PROTO
63 TERM_PUBLIC void DXY_init __PROTO((void));
64 TERM_PUBLIC void DXY_graphics __PROTO((void));
65 TERM_PUBLIC void DXY_text __PROTO((void));
66 TERM_PUBLIC void DXY_linetype __PROTO((int linetype));
67 TERM_PUBLIC void DXY_move __PROTO((unsigned int x, unsigned int y));
68 TERM_PUBLIC void DXY_vector __PROTO((unsigned int x, unsigned int y));
69 TERM_PUBLIC void DXY_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
70 TERM_PUBLIC int DXY_text_angle __PROTO((int ang));
71 TERM_PUBLIC void DXY_reset __PROTO((void));
72
73 #define DXY_XMAX 2470
74 #define DXY_YMAX 1700
75
76 #define DXY_XLAST (DXY_XMAX - 1)
77 #define DXY_YLAST (DXY_XMAX - 1)
78
79 #define DXY_VCHAR       (56)    /* double actual height of characters */
80 #define DXY_HCHAR       (28)    /* actual width including spacing */
81 #define DXY_VTIC        (28)
82 #define DXY_HTIC        (28)
83 #endif /* TERM_PROTO */
84
85 #ifndef TERM_PROTO_ONLY
86 #ifdef TERM_BODY
87
88 int dxy_angle = 0;
89
90 TERM_PUBLIC void
91 DXY_init()
92 {
93     /* No initialisation sequences for DXY 800A */
94 }
95
96
97 TERM_PUBLIC void
98 DXY_graphics()
99 {
100     /* HOME, Character size 3 */
101     fputs("H\nS3\n", gpoutfile);
102 }
103
104
105 TERM_PUBLIC void
106 DXY_text()
107 {
108     /* No sequences needed */
109 }
110
111
112 TERM_PUBLIC void
113 DXY_linetype(int linetype)
114 {
115     /* select pen */
116     fprintf(gpoutfile, "J%d\n", (linetype + 2) % 8 + 1);
117     switch (linetype) {
118     case LT_AXIS:
119         /* use dotted line for axis */
120         fputs("L1\nB50\n", gpoutfile);
121         break;
122     default:
123         /* use solid line for all others */
124         fputs("L0\n", gpoutfile);
125         break;
126     }
127 }
128
129
130 TERM_PUBLIC void
131 DXY_move(unsigned int x, unsigned int y)
132 {
133     fprintf(gpoutfile, "M%d,%d\n", x, y);
134 }
135
136
137 TERM_PUBLIC void
138 DXY_vector(unsigned int x, unsigned int y)
139 {
140     fprintf(gpoutfile, "D%d,%d\n", x, y);
141 }
142
143
144 TERM_PUBLIC void
145 DXY_put_text(unsigned int x, unsigned int y, const char *str)
146 {
147     if (dxy_angle == 1) {
148         /* vertical */
149         DXY_move(x + DXY_VCHAR / 4, y);
150     } else {
151         /* horiz */
152         DXY_move(x, y - DXY_VCHAR / 4);
153     }
154     fprintf(gpoutfile, "P%s\n", str);
155 }
156
157
158 TERM_PUBLIC int
159 DXY_text_angle(int ang)
160 {
161     dxy_angle = (ang ? 1 : 0);
162     fprintf(gpoutfile, "Q%d\n", ang);
163     return TRUE;
164 }
165
166
167 TERM_PUBLIC void
168 DXY_reset()
169 {
170     /* Home pen */
171     fputs("H\n", gpoutfile);
172 }
173
174 #endif /* TERM_BODY */
175
176 #ifdef TERM_TABLE
177 TERM_TABLE_START(dxy_driver)
178     "dxy800a", "Roland DXY800A plotter",
179     DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
180     DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
181     DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
182     DXY_linetype, DXY_put_text, DXY_text_angle,
183     null_justify_text, do_point, do_arrow, set_font_null
184 TERM_TABLE_END(dxy_driver)
185
186 #undef LAST_TERM
187 #define LAST_TERM dxy_driver
188
189 #endif /* TERM_TABLE */
190 #endif /* TERM_PROTO_ONLY */
191
192 #ifdef TERM_HELP
193 START_HELP(dxy800a)
194 "1 dxy800a",
195 "?commands set terminal dxy800a",
196 "?set terminal dxy800a",
197 "?set term dxy800a",
198 "?terminal dxy800a",
199 "?term dxy800a",
200 "?dxy800a",
201 " This terminal driver supports the Roland DXY800A plotter.  It has no options."
202 END_HELP(dxy800a)
203 #endif