1 /* Hello, Emacs, this is -*-C-*-
2 * $Id: fg.trm,v 1.13 2006/07/21 02:35:46 sfeam Exp $
8 * Copyright 1990 - 1993, 1998, 2004
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.
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,
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
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.
33 * This software is provided "as is" without express or implied warranty
34 * to the extent permitted by applicable law.
38 * This file is included by ../term.c.
40 * This terminal driver supports:
42 * egalib, vgalib, vgamono, svga, mcga, cga, hercules, att
45 * Gnuplot for DOS 386/flash graphics
50 /* The modifications to allow Gnuplot to compile with Zortech C/C++ */
51 /* 3.1 /Flash Graphics were made by Clifton T. Liu */
52 /* (cliu@merlin.appmath.columbia.edu) 20 Feb 1993 */
55 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
61 register_term(hercules)
62 register_term(egamono)
65 register_term(vgamono)
66 register_term(svgalib)
67 register_term(ssvgalib)
71 TERM_PUBLIC void PC_text __PROTO((void));
72 TERM_PUBLIC void PC_reset __PROTO((void));
73 TERM_PUBLIC int VGA_text_angle __PROTO((int ang));
74 TERM_PUBLIC int VGA_justify_text __PROTO((enum JUSTIFY mode));
75 TERM_PUBLIC void VGA_init __PROTO((void));
76 TERM_PUBLIC void HERC_graphics __PROTO((void));
77 TERM_PUBLIC void EGAMONO_graphics __PROTO((void));
78 TERM_PUBLIC void EGA_graphics __PROTO((void));
79 TERM_PUBLIC void VGA_graphics __PROTO((void));
80 TERM_PUBLIC void VGAMONO_graphics __PROTO((void));
81 TERM_PUBLIC void SVGA_graphics __PROTO((void));
82 TERM_PUBLIC void SSVGA_graphics __PROTO((void));
83 TERM_PUBLIC void VGA_linetype __PROTO((int linetype));
84 TERM_PUBLIC void VGA_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
85 TERM_PUBLIC void VGA_move __PROTO((int x, int y));
86 TERM_PUBLIC void VGA_vector __PROTO((int x, int y));
87 TERM_PUBLIC void VGA_text __PROTO((void));
88 TERM_PUBLIC void VGA_reset __PROTO((void));
92 #define HERC_XLAST (HERC_XMAX - 1)
93 #define HERC_YLAST (HERC_YMAX - 1)
105 #define EGA_XLAST (EGA_XMAX - 1)
106 #define EGA_YLAST (EGA_YMAX - 1)
117 #define VGA_XLAST (VGA_XMAX - 1)
118 #define VGA_YLAST (VGA_YMAX - 1)
126 #define SVGA_XMAX 800
127 #define SVGA_YMAX 600
129 #define SVGA_XLAST (SVGA_XMAX - 1)
130 #define SVGA_YLAST (SVGA_YMAX - 1)
132 #define SVGA_VCHAR 24
137 #define SSVGA_XMAX 1024
138 #define SSVGA_YMAX 768
140 #define SSVGA_XLAST (SSVGA_XMAX - 1)
141 #define SSVGA_YLAST (SSVGA_YMAX - 1)
143 #define SSVGA_VCHAR 24
144 #define SSVGA_HCHAR 8
148 #endif /* TERM_PROTO */
150 #ifndef TERM_PROTO_ONLY
153 void pause __PROTO((void));
157 static int pattern[] ={ 0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f };
159 static int graphics_on = FALSE;
163 #define PC_VCHAR FNT5X9_VCHAR
164 #define PC_HCHAR FNT5X9_HCHAR
168 { /* press any key to continue... */
190 /* all of the FlashGraphics C routines for the different graphics devices
195 static int vga256color[] ={ 7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6 };
196 static int *vgacolor = vga256color;
197 static fg_color_t vga_color;
198 static int text_angle;
199 static fg_line_t line_to_draw;
202 VGA_text_angle(int ang)
204 text_angle = (ang ? 1 : 0);
209 VGA_justify_text(enum JUSTIFY mode)
217 if (fg_init() == FG_NULL) {
218 fputs("Graphics card not detected.\n", stderr);
273 VGA_linetype(int linetype)
279 vga_color = fg.color[vgacolor[linetype + 2]];
283 VGA_put_text(unsigned int x, unsigned int y, const char *str)
285 fg_puts(vga_color, FG_MODE_SET, ~0, text_angle, x, y, str, fg.displaybox);
289 VGA_move(unsigned int x, unsigned int y)
291 line_to_draw[FG_X1] = x;
292 line_to_draw[FG_Y1] = y;
297 VGA_vector(unsigned int x, unsigned int y);
299 line_to_draw[FG_X2] = x;
300 line_to_draw[FG_Y2] = y;
301 fg_drawline(vga_color, FG_MODE_SET, ~0, FG_LINE_SOLID, line_to_draw);
302 line_to_draw[FG_X1] = x;
303 line_to_draw[FG_Y1] = y;
323 #endif /* TERM_BODY */
327 TERM_TABLE_START(hercules_driver)
328 "hercules", "IBM PC/Clone with Hercules graphics board",
329 HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
330 HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
331 VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
332 VGA_linetype, VGA_put_text, VGA_text_angle,
333 VGA_justify_text, do_point, do_arrow, set_font_null
334 TERM_TABLE_END(hercules_driver)
337 #define LAST_TERM hercules_driver
339 TERM_TABLE_START(egamono_driver)
340 "egamono", "IBM PC/Clone with monochrome EGA graphics board",
341 EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
342 EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
343 VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
344 VGA_linetype, VGA_put_text, VGA_text_angle,
345 VGA_justify_text, do_point, do_arrow, set_font_null
346 TERM_TABLE_END(egamono_driver)
349 #define LAST_TERM egamono_driver
351 TERM_TABLE_START(egalib_driver)
352 "egalib", "IBM PC/Clone with color EGA graphics board",
353 EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
354 EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
355 VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
356 VGA_linetype, VGA_put_text, VGA_text_angle,
357 VGA_justify_text, do_point, do_arrow, set_font_null
358 TERM_TABLE_END(egalib_driver)
361 #define LAST_TERM egalib_driver
363 TERM_TABLE_START(vgalib_driver)
364 "vgalib", "IBM PC/Clone with VGA graphics board",
365 VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
366 VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
367 VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
368 VGA_linetype, VGA_put_text, VGA_text_angle,
369 VGA_justify_text, do_point, do_arrow, set_font_null
370 TERM_TABLE_END(vgalib_driver)
373 #define LAST_TERM vgalib_driver
375 TERM_TABLE_START(vgamono_driver)
376 "vgamono", "IBM PC/Clone with monochrome VGA graphics board",
377 VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
378 VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
379 VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
380 VGA_linetype, VGA_put_text, VGA_text_angle,
381 VGA_justify_text, do_point, do_arrow, set_font_null
382 TERM_TABLE_END(vgamono_driver)
385 #define LAST_TERM vgamono_driver
387 TERM_TABLE_START(svgalib_driver)
388 "svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
389 SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
390 SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
391 VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
392 VGA_linetype, VGA_put_text, VGA_text_angle,
393 VGA_justify_text, do_point, do_arrow, set_font_null
394 TERM_TABLE_END(svgalib_driver)
397 #define LAST_TERM svgalib_driver
399 TERM_TABLE_START(ssvgalib_driver)
400 "ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
401 SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
402 SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
403 VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
404 VGA_linetype, VGA_put_text, VGA_text_angle,
405 VGA_justify_text, do_point, do_arrow, set_font_null
406 TERM_TABLE_END(ssvgalib_driver)
409 #define LAST_TERM ssvgalib_driver
411 #endif /* TERM_TABLE */
412 #endif /* TERM_PROTO_ONLY */
418 "?commands set terminal hercules",
419 "?set terminal hercules",
420 "?set term hercules",
421 "?terminal hercules",
424 "?commands set terminal egalib",
425 "?set terminal egalib",
430 "?commands set terminal egamono",
431 "?set terminal egamono",
436 "?commands set terminal vgalib",
437 "?set terminal vgalib",
442 "?commands set terminal vgamono",
443 "?set terminal vgamono",
448 "?commands set terminal svgalib",
449 "?set terminal svgalib",
454 "?commands set terminal ssvgalib",
455 "?set terminal ssvgalib",
456 "?set term ssvgalib",
457 "?terminal ssvgalib",
460 " These drivers supports PC monitors with autodetected graphics boards. They",
461 " can be used only when compiled with Zortech C/C++. None have options."
463 #endif /* TERM_HELP */