Annotation of OpenXM_contrib/gnuplot/term/debug.trm, Revision 1.1
1.1 ! maekawa 1: /*
! 2: * $Id: debug.trm,v 1.11 1998/04/14 00:17:35 drd Exp $
! 3: *
! 4: */
! 5:
! 6: /* GNUPLOT - debug.trm */
! 7:
! 8: /*[
! 9: * Copyright 1990 - 1993, 1998 Thomas Williams, Colin Kelley
! 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: * DEBUG
! 43: *
! 44: * AUTHORS
! 45: * luecken@udel.edu
! 46: *
! 47: * send your comments or suggestions to (luecken@udel.edu).
! 48: *
! 49: */
! 50:
! 51: /*
! 52: * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
! 53: * generalised to have *all* defined capabilities by HBB (June 1997)
! 54: */
! 55:
! 56:
! 57: #include "driver.h"
! 58:
! 59: #ifdef TERM_REGISTER
! 60: register_term(debug)
! 61: #endif
! 62:
! 63: #ifdef TERM_PROTO
! 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, 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((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));
! 82:
! 83: #define DEBUG_XMAX 512
! 84: #define DEBUG_YMAX 390
! 85:
! 86: #define DEBUG_XLAST (DEBUG_XMAX - 1)
! 87: #define DEBUG_YLAST (DEBUG_XMAX - 1)
! 88:
! 89: /* Assume a character size of 1, or a 7 x 10 grid. */
! 90: #define DEBUG_VCHAR 10
! 91: #define DEBUG_HCHAR 7
! 92: #define DEBUG_VTIC (DEBUG_YMAX/70)
! 93: #define DEBUG_HTIC (DEBUG_XMAX/75)
! 94: #endif /* TERM_PROTO */
! 95:
! 96: #ifndef TERM_PROTO_ONLY
! 97: #ifdef TERM_BODY
! 98:
! 99: int DEBUG_linetype_last;
! 100: int DEBUG_xlast;
! 101: int DEBUG_ylast;
! 102:
! 103: TERM_PUBLIC void DEBUG_init()
! 104: {
! 105: fputs("init\n", gpoutfile);
! 106: DEBUG_linetype_last = -3;
! 107: }
! 108:
! 109:
! 110: TERM_PUBLIC void DEBUG_graphics()
! 111: {
! 112: DEBUG_xlast = DEBUG_ylast = 0;
! 113: fputs("graphics\n", gpoutfile);
! 114: }
! 115:
! 116:
! 117: TERM_PUBLIC void DEBUG_text()
! 118: {
! 119: fputs("text\n", gpoutfile);
! 120: }
! 121:
! 122:
! 123: TERM_PUBLIC void DEBUG_linetype(linetype)
! 124: int linetype;
! 125: {
! 126: /*
! 127: if (linetype != DEBUG_linetype_last){
! 128: fprintf(gpoutfile,"l%d",linetype);
! 129: DEBUG_linetype_last = linetype;
! 130: }
! 131: */
! 132: fprintf(gpoutfile, "line %d\n", linetype);
! 133: }
! 134:
! 135:
! 136: TERM_PUBLIC void DEBUG_move(x, y)
! 137: unsigned int x, y;
! 138: {
! 139: /*
! 140: if (x != DEBUG_xlast || y != DEBUG_ylast){
! 141: fprintf(gpoutfile,"mm");
! 142: DEBUG_xlast = x;
! 143: DEBUG_ylast = y;
! 144: }
! 145: */
! 146: fprintf(gpoutfile, "move %d, %d\t(%d, %d)\n", x, y, x - DEBUG_xlast, y - DEBUG_ylast);
! 147: DEBUG_xlast = x;
! 148: DEBUG_ylast = y;
! 149: }
! 150:
! 151:
! 152: TERM_PUBLIC void DEBUG_vector(x, y)
! 153: unsigned int x, y;
! 154: {
! 155: /*
! 156: if (x != DEBUG_xlast || y != DEBUG_ylast){
! 157: fprintf(gpoutfile,"vv");
! 158: DEBUG_xlast = x;
! 159: DEBUG_ylast = y;
! 160: }
! 161: */
! 162: fprintf(gpoutfile, "vect %d, %d\t(%d, %d)\n", x, y, x - DEBUG_xlast, y - DEBUG_ylast);
! 163: DEBUG_xlast = x;
! 164: DEBUG_ylast = y;
! 165: }
! 166:
! 167:
! 168: TERM_PUBLIC void DEBUG_put_text(x, y, str)
! 169: unsigned int x, y;
! 170: char *str;
! 171: {
! 172: /*
! 173: DEBUG_move(x,y);
! 174: fprintf(gpoutfile,"tx%s\r",str);
! 175: */
! 176: fputs("put_text calls:", gpoutfile);
! 177: DEBUG_move(x, y);
! 178: fprintf(gpoutfile, "put_text '%s'\n", str);
! 179: }
! 180:
! 181:
! 182:
! 183: TERM_PUBLIC void DEBUG_reset()
! 184: {
! 185: fputs("reset", gpoutfile);
! 186: }
! 187:
! 188: TERM_PUBLIC int DEBUG_justify_text(mode)
! 189: enum JUSTIFY mode;
! 190: {
! 191: fputs("justify ", gpoutfile);
! 192: switch (mode) {
! 193: case (CENTRE):
! 194: fputs("centre", gpoutfile);
! 195: break;
! 196: case (RIGHT):
! 197: fputs("right", gpoutfile);
! 198: break;
! 199: default:
! 200: case (LEFT):
! 201: fputs("left", gpoutfile);
! 202: break;
! 203: }
! 204: fputs("\n", gpoutfile);
! 205: return (TRUE);
! 206: }
! 207:
! 208: TERM_PUBLIC int DEBUG_text_angle(ang)
! 209: int ang;
! 210: {
! 211: fprintf(gpoutfile, "text_angle %d:", ang);
! 212: switch (ang) {
! 213: case 0:
! 214: fputs(": horizontal\n", gpoutfile);
! 215: break;
! 216: case 1:
! 217: fputs(": upwards\n", gpoutfile);
! 218: break;
! 219: default:
! 220: fputs(": \a*undefined*\n", gpoutfile);
! 221: break;
! 222: }
! 223: return TRUE;
! 224: }
! 225:
! 226: TERM_PUBLIC void DEBUG_point(x, y, pointstyle)
! 227: unsigned int x, y;
! 228: int pointstyle;
! 229: {
! 230: fprintf(gpoutfile, "point at (%ud,%ud), pointstyle %d\n", x, y, pointstyle);
! 231: }
! 232:
! 233: TERM_PUBLIC void DEBUG_arrow(sx, sy, ex, ey, head)
! 234: unsigned int sx, sy, ex, ey;
! 235: int head;
! 236: {
! 237: fprintf(gpoutfile, "arrow from (%ud,%ud) to (%ud,%ud), %s head\n",
! 238: sx, sy, ex, ey, head ? "with" : "without");
! 239: }
! 240:
! 241: TERM_PUBLIC int DEBUG_set_font(font)
! 242: char *font;
! 243: {
! 244: fprintf(gpoutfile, "set font to \"%s\"\n",
! 245: font ? (*font ? font : "\aempty string!") : "\aNULL string!");
! 246: return TRUE;
! 247: }
! 248:
! 249: TERM_PUBLIC void DEBUG_pointsize(pointsize)
! 250: double pointsize;
! 251: {
! 252: fprintf(gpoutfile, "set pointsize to %lf\n", pointsize);
! 253: }
! 254:
! 255: TERM_PUBLIC void DEBUG_suspend(void)
! 256: {
! 257: fputs("suspended terminal driver\n", gpoutfile);
! 258: }
! 259:
! 260: TERM_PUBLIC void DEBUG_resume(void)
! 261: {
! 262: fputs("resumed terminal driver\n", gpoutfile);
! 263: }
! 264:
! 265: TERM_PUBLIC void DEBUG_fillbox(style, x1, y1, width, height)
! 266: int style;
! 267: unsigned int x1, y1, width, height;
! 268: {
! 269: fprintf(gpoutfile, "fillbox/clear at (%ud,%ud), area (%ud,%ud), style %d)\n",
! 270: x1, y1, width, height, style);
! 271: }
! 272:
! 273: TERM_PUBLIC void DEBUG_linewidth(double linewidth)
! 274: {
! 275: fprintf(gpoutfile, "set linewidth %lf\n", linewidth);
! 276: }
! 277:
! 278:
! 279: #endif /* TERM_BODY */
! 280:
! 281: #ifdef TERM_TABLE
! 282:
! 283: TERM_TABLE_START(debug_driver)
! 284: "debug", "debugging driver",
! 285: DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
! 286: DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
! 287: DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
! 288: DEBUG_linetype, DEBUG_put_text, DEBUG_text_angle,
! 289: DEBUG_justify_text, DEBUG_point, DEBUG_arrow, DEBUG_set_font,
! 290: DEBUG_pointsize,
! 291: TERM_CAN_MULTIPLOT,
! 292: DEBUG_suspend, DEBUG_resume, DEBUG_fillbox, DEBUG_linewidth
! 293: TERM_TABLE_END(debug_driver)
! 294:
! 295: #undef LAST_TERM
! 296: #define LAST_TERM debug_driver
! 297:
! 298: #endif /* TERM_TABLE */
! 299: #endif /* TERM_PROTO_ONLY */
! 300:
! 301: #ifdef TERM_HELP
! 302: START_HELP(debug)
! 303: "1 debug",
! 304: "?commands set terminal debug",
! 305: "?set terminal debug",
! 306: "?set term debug",
! 307: "?terminal debug",
! 308: "?term debug",
! 309: "?debug",
! 310: " This terminal is provided to allow for the debugging of `gnuplot`. It is",
! 311: " likely to be of use only for users who are modifying the source code."
! 312: END_HELP(debug)
! 313: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>