1 /* Hello, Emacs, this is -*-C-*-
2 * $Id: debug.trm,v 1.17 2006/07/21 02:35:45 sfeam Exp $
6 /* GNUPLOT - debug.trm */
9 * Copyright 1990 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
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.
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,
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
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.
34 * This software is provided "as is" without express or implied warranty
35 * to the extent permitted by applicable law.
39 * This file is included by ../term.c.
41 * This terminal driver supports:
47 * send your comments or suggestions to (luecken@udel.edu).
52 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
53 * generalised to have *all* defined capabilities by HBB (June 1997)
64 TERM_PUBLIC void DEBUG_init __PROTO((void));
65 TERM_PUBLIC void DEBUG_graphics __PROTO((void));
66 TERM_PUBLIC void DEBUG_text __PROTO((void));
67 TERM_PUBLIC void DEBUG_linetype __PROTO((int linetype));
68 TERM_PUBLIC void DEBUG_move __PROTO((unsigned int x, unsigned int y));
69 TERM_PUBLIC void DEBUG_vector __PROTO((unsigned int x, unsigned int y));
70 TERM_PUBLIC void DEBUG_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
71 TERM_PUBLIC void DEBUG_reset __PROTO((void));
72 TERM_PUBLIC int DEBUG_justify_text __PROTO((enum JUSTIFY mode));
73 TERM_PUBLIC int DEBUG_text_angle __PROTO((int ang));
74 TERM_PUBLIC void DEBUG_point __PROTO((unsigned int x, unsigned int y, int pointstyle));
75 TERM_PUBLIC void DEBUG_arrow __PROTO((unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, int head));
76 TERM_PUBLIC int DEBUG_set_font __PROTO((const char *font));
77 TERM_PUBLIC void DEBUG_pointsize __PROTO((double pointsize));
78 TERM_PUBLIC void DEBUG_suspend __PROTO((void));
79 TERM_PUBLIC void DEBUG_resume __PROTO((void));
80 TERM_PUBLIC void DEBUG_fillbox __PROTO((int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height));
81 TERM_PUBLIC void DEBUG_linewidth __PROTO((double linewidth));
83 #define DEBUG_XMAX 512
84 #define DEBUG_YMAX 390
86 #define DEBUG_XLAST (DEBUG_XMAX - 1)
87 #define DEBUG_YLAST (DEBUG_XMAX - 1)
89 /* Assume a character size of 1, or a 7 x 10 grid. */
90 #define DEBUG_VCHAR 10
92 #define DEBUG_VTIC (DEBUG_YMAX/70)
93 #define DEBUG_HTIC (DEBUG_XMAX/75)
94 #endif /* TERM_PROTO */
96 #ifndef TERM_PROTO_ONLY
99 int DEBUG_linetype_last;
106 fputs("init\n", gpoutfile);
107 DEBUG_linetype_last = LT_NODRAW;
114 DEBUG_xlast = DEBUG_ylast = 0;
115 fputs("graphics\n", gpoutfile);
122 fputs("text\n", gpoutfile);
127 DEBUG_linetype(int linetype)
130 if (linetype != DEBUG_linetype_last){
131 fprintf(gpoutfile,"l%d",linetype);
132 DEBUG_linetype_last = linetype;
135 fprintf(gpoutfile, "line %d\n", linetype);
140 DEBUG_move(unsigned int x, unsigned int y)
143 if (x != DEBUG_xlast || y != DEBUG_ylast){
144 fprintf(gpoutfile,"mm");
149 fprintf(gpoutfile, "move %d, %d\t(%d, %d)\n", x, y, x - DEBUG_xlast, y - DEBUG_ylast);
156 DEBUG_vector(unsigned int x, unsigned int y)
159 if (x != DEBUG_xlast || y != DEBUG_ylast){
160 fprintf(gpoutfile,"vv");
165 fprintf(gpoutfile, "vect %d, %d\t(%d, %d)\n", x, y, x - DEBUG_xlast, y - DEBUG_ylast);
172 DEBUG_put_text(unsigned int x, unsigned int y, const char *str)
176 fprintf(gpoutfile,"tx%s\r",str);
178 fputs("put_text calls:", gpoutfile);
180 fprintf(gpoutfile, "put_text '%s'\n", str);
188 fputs("reset", gpoutfile);
192 DEBUG_justify_text(enum JUSTIFY mode)
194 fputs("justify ", gpoutfile);
197 fputs("centre", gpoutfile);
200 fputs("right", gpoutfile);
204 fputs("left", gpoutfile);
207 fputs("\n", gpoutfile);
212 DEBUG_text_angle(int ang)
214 fprintf(gpoutfile, "text_angle %d:", ang);
217 fputs(": horizontal\n", gpoutfile);
220 fputs(": upwards\n", gpoutfile);
223 fputs(": \a*undefined*\n", gpoutfile);
230 DEBUG_point(unsigned int x, unsigned int y, int pointstyle)
232 fprintf(gpoutfile, "point at (%ud,%ud), pointstyle %d\n", x, y, pointstyle);
237 unsigned int sx, unsigned int sy,
238 unsigned int ex, unsigned int ey,
241 fprintf(gpoutfile, "arrow from (%ud,%ud) to (%ud,%ud), %s head\n",
242 sx, sy, ex, ey, head ? "with" : "without");
246 DEBUG_set_font(const char *font)
248 fprintf(gpoutfile, "set font to \"%s\"\n",
249 font ? (*font ? font : "\aempty string!") : "\aNULL string!");
254 DEBUG_pointsize(double pointsize)
256 fprintf(gpoutfile, "set pointsize to %lf\n", pointsize);
262 fputs("suspended terminal driver\n", gpoutfile);
268 fputs("resumed terminal driver\n", gpoutfile);
274 unsigned int x1, unsigned int y1,
275 unsigned int width, unsigned int height)
277 fprintf(gpoutfile, "fillbox/clear at (%ud,%ud), area (%ud,%ud), style %d)\n",
278 x1, y1, width, height, style);
282 DEBUG_linewidth(double linewidth)
284 fprintf(gpoutfile, "set linewidth %lf\n", linewidth);
288 #endif /* TERM_BODY */
292 TERM_TABLE_START(debug_driver)
293 "debug", "debugging driver",
294 DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
295 DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
296 DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
297 DEBUG_linetype, DEBUG_put_text, DEBUG_text_angle,
298 DEBUG_justify_text, DEBUG_point, DEBUG_arrow, DEBUG_set_font,
301 DEBUG_suspend, DEBUG_resume, DEBUG_fillbox, DEBUG_linewidth
302 TERM_TABLE_END(debug_driver)
305 #define LAST_TERM debug_driver
307 #endif /* TERM_TABLE */
308 #endif /* TERM_PROTO_ONLY */
313 "?commands set terminal debug",
314 "?set terminal debug",
319 " This terminal is provided to allow for the debugging of `gnuplot`. It is",
320 " likely to be of use only for users who are modifying the source code."