Annotation of OpenXM_contrib/gnuplot/term/fg.trm, Revision 1.1
1.1 ! maekawa 1: /*
! 2: * $Id: $
! 3: */
! 4:
! 5: /* GNUPLOT - fg.trm */
! 6:
! 7: /*[
! 8: * Copyright 1990 - 1993, 1998
! 9: *
! 10: * Permission to use, copy, and distribute this software and its
! 11: * documentation for any purpose with or without fee is hereby granted,
! 12: * provided that the above copyright notice appear in all copies and
! 13: * that both that copyright notice and this permission notice appear
! 14: * in supporting documentation.
! 15: *
! 16: * Permission to modify the software is granted, but not the right to
! 17: * distribute the complete modified source code. Modifications are to
! 18: * be distributed as patches to the released version. Permission to
! 19: * distribute binaries produced by compiling modified sources is granted,
! 20: * provided you
! 21: * 1. distribute the corresponding source modifications from the
! 22: * released version in the form of a patch file along with the binaries,
! 23: * 2. add special version identification to distinguish your version
! 24: * in addition to the base release version number,
! 25: * 3. provide your name and address as the primary contact for the
! 26: * support of your modified version, and
! 27: * 4. retain our contact information in regard to use of the base
! 28: * software.
! 29: * Permission to distribute the released version of the source code along
! 30: * with corresponding source modifications in the form of a patch file is
! 31: * granted with same provisions 2 through 4 for binary distributions.
! 32: *
! 33: * This software is provided "as is" without express or implied warranty
! 34: * to the extent permitted by applicable law.
! 35: ]*/
! 36:
! 37: /*
! 38: * This file is included by ../term.c.
! 39: *
! 40: * This terminal driver supports:
! 41: * Under Zortech C
! 42: * egalib, vgalib, vgamono, svga, mcga, cga, hercules, att
! 43: *
! 44: * AUTHORS
! 45: * Gnuplot for DOS 386/flash graphics
! 46: * Clifton T. Liu
! 47: *
! 48: * There is a mailing list for gnuplot users. Note, however, that the
! 49: * newsgroup
! 50: * comp.graphics.apps.gnuplot
! 51: * is identical to the mailing list (they
! 52: * both carry the same set of messages). We prefer that you read the
! 53: * messages through that newsgroup, to subscribing to the mailing list.
! 54: * (If you can read that newsgroup, and are already on the mailing list,
! 55: * please send a message to majordomo@dartmouth.edu, asking to be
! 56: * removed from the mailing list.)
! 57: *
! 58: * The address for mailing to list members is
! 59: * info-gnuplot@dartmouth.edu
! 60: * and for mailing administrative requests is
! 61: * majordomo@dartmouth.edu
! 62: * The mailing list for bug reports is
! 63: * bug-gnuplot@dartmouth.edu
! 64: * The list of those interested in beta-test versions is
! 65: * info-gnuplot-beta@dartmouth.edu
! 66: */
! 67: /* The modifications to allow Gnuplot to compile with Zortech C/C++ */
! 68: /* 3.1 /Flash Graphics were made by Clifton T. Liu */
! 69: /* (cliu@merlin.appmath.columbia.edu) 20 Feb 1993 */
! 70:
! 71: /*
! 72: * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
! 73: */
! 74:
! 75: #include "driver.h"
! 76:
! 77: #ifdef TERM_REGISTER
! 78: register_term(hercules)
! 79: register_term(egamono)
! 80: register_term(egalib)
! 81: register_term(vgalib)
! 82: register_term(vgamono)
! 83: register_term(svgalib)
! 84: register_term(ssvgalib)
! 85: #endif
! 86:
! 87: #ifdef TERM_PROTO
! 88: TERM_PUBLIC void PC_text __PROTO((void));
! 89: TERM_PUBLIC void PC_reset __PROTO((void));
! 90: TERM_PUBLIC int VGA_text_angle __PROTO((int ang));
! 91: TERM_PUBLIC int VGA_justify_text __PROTO((enum JUSTIFY mode));
! 92: TERM_PUBLIC void VGA_init __PROTO((void));
! 93: TERM_PUBLIC void HERC_graphics __PROTO((void));
! 94: TERM_PUBLIC void EGAMONO_graphics __PROTO((void));
! 95: TERM_PUBLIC void EGA_graphics __PROTO((void));
! 96: TERM_PUBLIC void VGA_graphics __PROTO((void));
! 97: TERM_PUBLIC void VGAMONO_graphics __PROTO((void));
! 98: TERM_PUBLIC void SVGA_graphics __PROTO((void));
! 99: TERM_PUBLIC void SSVGA_graphics __PROTO((void));
! 100: TERM_PUBLIC void VGA_linetype __PROTO((int linetype));
! 101: #define HERC_XMAX 720
! 102: #define HERC_YMAX 348
! 103:
! 104: #define HERC_XLAST (HERC_XMAX - 1)
! 105: #define HERC_YLAST (HERC_YMAX - 1)
! 106:
! 107: #define HERC_VCHAR 10
! 108: #define HERC_HCHAR 8
! 109: #define HERC_VTIC 5
! 110: #define HERC_HTIC 5
! 111:
! 112:
! 113:
! 114: #define EGA_XMAX 640
! 115: #define EGA_YMAX 350
! 116:
! 117: #define EGA_XLAST (EGA_XMAX - 1)
! 118: #define EGA_YLAST (EGA_YMAX - 1)
! 119:
! 120: #define EGA_VCHAR 18
! 121: #define EGA_HCHAR 8
! 122: #define EGA_VTIC 5
! 123: #define EGA_HTIC 5
! 124:
! 125:
! 126: #define VGA_XMAX 640
! 127: #define VGA_YMAX 480
! 128:
! 129: #define VGA_XLAST (VGA_XMAX - 1)
! 130: #define VGA_YLAST (VGA_YMAX - 1)
! 131:
! 132: #define VGA_VCHAR 24
! 133: #define VGA_HCHAR 8
! 134: #define VGA_VTIC 5
! 135: #define VGA_HTIC 5
! 136:
! 137:
! 138: #define SVGA_XMAX 800
! 139: #define SVGA_YMAX 600
! 140:
! 141: #define SVGA_XLAST (SVGA_XMAX - 1)
! 142: #define SVGA_YLAST (SVGA_YMAX - 1)
! 143:
! 144: #define SVGA_VCHAR 24
! 145: #define SVGA_HCHAR 8
! 146: #define SVGA_VTIC 5
! 147: #define SVGA_HTIC 5
! 148:
! 149: #define SSVGA_XMAX 1024
! 150: #define SSVGA_YMAX 768
! 151:
! 152: #define SSVGA_XLAST (SSVGA_XMAX - 1)
! 153: #define SSVGA_YLAST (SSVGA_YMAX - 1)
! 154:
! 155: #define SSVGA_VCHAR 24
! 156: #define SSVGA_HCHAR 8
! 157: #define SSVGA_VTIC 5
! 158: #define SSVGA_HTIC 5
! 159:
! 160: #endif /* TERM_PROTO */
! 161:
! 162: #ifndef TERM_PROTO_ONLY
! 163: #ifdef TERM_BODY
! 164:
! 165: void pause __PROTO((void));
! 166:
! 167: #include <fg.h>
! 168:
! 169: static int pattern[] ={ 0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f };
! 170:
! 171: static int graphics_on = FALSE;
! 172: int startx, starty;
! 173: /*
! 174: int pc_angle;
! 175: #define PC_VCHAR FNT5X9_VCHAR
! 176: #define PC_HCHAR FNT5X9_HCHAR
! 177: */
! 178: void pause()
! 179: { /* press any key to continue... */
! 180: (void) getch();
! 181: }
! 182:
! 183:
! 184: TERM_PUBLIC void PC_text()
! 185: {
! 186: if (graphics_on) {
! 187: graphics_on = FALSE;
! 188: pause();
! 189: }
! 190: fg_term();
! 191: }
! 192:
! 193: TERM_PUBLIC void PC_reset()
! 194: {
! 195: }
! 196:
! 197:
! 198:
! 199: /* all of the FlashGraphics C routines for the different graphics devices
! 200: * go here */
! 201:
! 202:
! 203:
! 204: static int vga256color[] ={ 7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6 };
! 205: static int *vgacolor = vga256color;
! 206: static fg_color_t vga_color;
! 207: static int text_angle;
! 208: static fg_line_t line_to_draw;
! 209:
! 210: TERM_PUBLIC int VGA_text_angle(ang)
! 211: int ang;
! 212: {
! 213: text_angle = ang;
! 214: return TRUE;
! 215: }
! 216:
! 217: TERM_PUBLIC int VGA_justify_text(mode)
! 218: enum JUSTIFY mode;
! 219: {
! 220: return FALSE;
! 221: }
! 222:
! 223: TERM_PUBLIC void VGA_init()
! 224: {
! 225: if (fg_init() == FG_NULL) {
! 226: fputs("Graphics card not detected.\n", stderr);
! 227: exit(EXIT_FAILURE);
! 228: }
! 229: }
! 230:
! 231: TERM_PUBLIC void HERC_graphics()
! 232: {
! 233: fg_init_herc();
! 234: graphics_on = TRUE;
! 235: }
! 236:
! 237: TERM_PUBLIC void EGAMONO_graphics()
! 238: {
! 239: fg_init_egamono();
! 240: graphics_on = TRUE;
! 241: }
! 242:
! 243: TERM_PUBLIC void EGA_graphics()
! 244: {
! 245: fg_init_egaecd();
! 246: graphics_on = TRUE;
! 247: }
! 248:
! 249: TERM_PUBLIC void VGA_graphics()
! 250: {
! 251: fg_init_vga12();
! 252: graphics_on = TRUE;
! 253: }
! 254:
! 255: TERM_PUBLIC void VGAMONO_graphics()
! 256: {
! 257: fg_init_vga11();
! 258: graphics_on = TRUE;
! 259: }
! 260:
! 261: TERM_PUBLIC void SVGA_graphics()
! 262: {
! 263: fg_init_vesa6a();
! 264: graphics_on = TRUE;
! 265: }
! 266:
! 267: TERM_PUBLIC void SSVGA_graphics()
! 268: {
! 269: fg_init_vesa5();
! 270: graphics_on = TRUE;
! 271: }
! 272:
! 273: TERM_PUBLIC void VGA_linetype(linetype)
! 274: {
! 275: if (linetype >= 13)
! 276: linetype %= 13;
! 277: vga_color = fg.color[vgacolor[linetype + 2]];
! 278: }
! 279:
! 280: TERM_PUBLIC void VGA_put_text(x, y, str)
! 281: unsigned int x, y;
! 282: char *str;
! 283: {
! 284: fg_puts(vga_color, FG_MODE_SET, ~0, text_angle, x, y, str, fg.displaybox);
! 285: }
! 286:
! 287: TERM_PUBLIC void VGA_move(x, y)
! 288: {
! 289: line_to_draw[FG_X1] = x;
! 290: line_to_draw[FG_Y1] = y;
! 291: }
! 292:
! 293:
! 294: TERM_PUBLIC void VGA_vector(x, y)
! 295: {
! 296: line_to_draw[FG_X2] = x;
! 297: line_to_draw[FG_Y2] = y;
! 298: fg_drawline(vga_color, FG_MODE_SET, ~0, FG_LINE_SOLID, line_to_draw);
! 299: line_to_draw[FG_X1] = x;
! 300: line_to_draw[FG_Y1] = y;
! 301: }
! 302:
! 303: TERM_PUBLIC void VGA_text()
! 304: {
! 305: if (graphics_on) {
! 306: graphics_on = FALSE;
! 307: fg_flush();
! 308: pause();
! 309: }
! 310: fg_term();
! 311: }
! 312:
! 313: TERM_PUBLIC void VGA_reset()
! 314: {
! 315: fg_term();
! 316: }
! 317:
! 318: #endif /* TERM_BODY */
! 319:
! 320: #ifdef TERM_TABLE
! 321:
! 322: TERM_TABLE_START(hercules_driver)
! 323: "hercules", "IBM PC/Clone with Hercules graphics board",
! 324: HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
! 325: HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
! 326: VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
! 327: VGA_linetype, VGA_put_text, VGA_text_angle,
! 328: VGA_justify_text, do_point, do_arrow, set_font_null
! 329: TERM_TABLE_END(hercules_driver)
! 330:
! 331: #undef LAST_TERM
! 332: #define LAST_TERM hercules_driver
! 333:
! 334: TERM_TABLE_START(egamono_driver)
! 335: "egamono", "IBM PC/Clone with monochrome EGA graphics board",
! 336: EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
! 337: EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
! 338: VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
! 339: VGA_linetype, VGA_put_text, VGA_text_angle,
! 340: VGA_justify_text, do_point, do_arrow, set_font_null
! 341: TERM_TABLE_END(egamono_driver)
! 342:
! 343: #undef LAST_TERM
! 344: #define LAST_TERM egamono_driver
! 345:
! 346: TERM_TABLE_START(egalib_driver)
! 347: "egalib", "IBM PC/Clone with color EGA graphics board",
! 348: EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
! 349: EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
! 350: VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
! 351: VGA_linetype, VGA_put_text, VGA_text_angle,
! 352: VGA_justify_text, do_point, do_arrow, set_font_null
! 353: TERM_TABLE_END(egalib_driver)
! 354:
! 355: #undef LAST_TERM
! 356: #define LAST_TERM egalib_driver
! 357:
! 358: TERM_TABLE_START(vgalib_driver)
! 359: "vgalib", "IBM PC/Clone with VGA graphics board",
! 360: VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
! 361: VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
! 362: VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
! 363: VGA_linetype, VGA_put_text, VGA_text_angle,
! 364: VGA_justify_text, do_point, do_arrow, set_font_null
! 365: TERM_TABLE_END(vgalib_driver)
! 366:
! 367: #undef LAST_TERM
! 368: #define LAST_TERM vgalib_driver
! 369:
! 370: TERM_TABLE_START(vgamono_driver)
! 371: "vgamono", "IBM PC/Clone with monochrome VGA graphics board",
! 372: VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
! 373: VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
! 374: VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
! 375: VGA_linetype, VGA_put_text, VGA_text_angle,
! 376: VGA_justify_text, do_point, do_arrow, set_font_null
! 377: TERM_TABLE_END(vgamono_driver)
! 378:
! 379: #undef LAST_TERM
! 380: #define LAST_TERM vgamono_driver
! 381:
! 382: TERM_TABLE_START(svgalib_driver)
! 383: "svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
! 384: SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
! 385: SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
! 386: VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
! 387: VGA_linetype, VGA_put_text, VGA_text_angle,
! 388: VGA_justify_text, do_point, do_arrow, set_font_null
! 389: TERM_TABLE_END(svgalib_driver)
! 390:
! 391: #undef LAST_TERM
! 392: #define LAST_TERM svgalib_driver
! 393:
! 394: TERM_TABLE_START(ssvgalib_driver)
! 395: "ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
! 396: SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
! 397: SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
! 398: VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
! 399: VGA_linetype, VGA_put_text, VGA_text_angle,
! 400: VGA_justify_text, do_point, do_arrow, set_font_null
! 401: TERM_TABLE_END(ssvgalib_driver)
! 402:
! 403: #undef LAST_TERM
! 404: #define LAST_TERM ssvgalib_driver
! 405:
! 406: #endif /* TERM_TABLE */
! 407: #endif /* TERM_PROTO_ONLY */
! 408:
! 409:
! 410: #ifdef TERM_HELP
! 411: START_HELP(hercules)
! 412: "1 hercules",
! 413: "?commands set terminal hercules",
! 414: "?set terminal hercules",
! 415: "?set term hercules",
! 416: "?terminal hercules",
! 417: "?term hercules",
! 418: "?hercules",
! 419: "?commands set terminal egalib",
! 420: "?set terminal egalib",
! 421: "?set term egalib",
! 422: "?terminal egalib",
! 423: "?term egalib",
! 424: "?egalib",
! 425: "?commands set terminal egamono",
! 426: "?set terminal egamono",
! 427: "?set term egamono",
! 428: "?terminal egamono",
! 429: "?term egamono",
! 430: "?egamono",
! 431: "?commands set terminal vgalib",
! 432: "?set terminal vgalib",
! 433: "?set term vgalib",
! 434: "?terminal vgalib",
! 435: "?term vgalib",
! 436: "?vgalib",
! 437: "?commands set terminal vgamono",
! 438: "?set terminal vgamono",
! 439: "?set term vgamono",
! 440: "?terminal vgamono",
! 441: "?term vgamono",
! 442: "?vgamono",
! 443: "?commands set terminal svgalib",
! 444: "?set terminal svgalib",
! 445: "?set term svgalib",
! 446: "?terminal svgalib",
! 447: "?term svgalib",
! 448: "?svgalib",
! 449: "?commands set terminal ssvgalib",
! 450: "?set terminal ssvgalib",
! 451: "?set term ssvgalib",
! 452: "?terminal ssvgalib",
! 453: "?term ssvgalib",
! 454: "?ssvgalib",
! 455: " These drivers supports PC monitors with autodetected graphics boards. They",
! 456: " can be used only when compiled with Zortech C/C++. None have options."
! 457: END_HELP(hercules)
! 458: #endif /* TERM_HELP */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>