File: fg.trm

package info (click to toggle)
gnuplot 3.5beta6.340-5
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 4,792 kB
  • ctags: 4,205
  • sloc: ansic: 41,878; asm: 539; makefile: 498; objc: 379; csh: 297; sh: 277; pascal: 194; perl: 138; lisp: 88
file content (431 lines) | stat: -rw-r--r-- 10,488 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
/* GNUPLOT - fg.trm */
/*
 * Copyright (C) 1990, 1991, 1992
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted, 
 * provided that the above copyright notice appear in all copies and 
 * that both that copyright notice and this permission notice appear 
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the modified code.  Modifications are to be distributed 
 * as patches to released version.
 *
 * This software  is provided "as is" without express or implied warranty.
 *
 * This file is included by ../term.c.
 *
 * This terminal driver supports:
 *	Under Zortech C
 *      egalib, vgalib, vgamono, svga, mcga, cga, hercules, att
 *
 * AUTHORS
 *		  Gnuplot for DOS 386/flash graphics
 *				  Clifton T. Liu
 *
 * There is a mailing list for gnuplot users. Note, however, that the
 * newsgroup 
 *	comp.graphics.apps.gnuplot 
 * is identical to the mailing list (they
 * both carry the same set of messages). We prefer that you read the
 * messages through that newsgroup, to subscribing to the mailing list.
 * (If you can read that newsgroup, and are already on the mailing list,
 * please send a message to majordomo@dartmouth.edu, asking to be
 * removed from the mailing list.)
 *
 * The address for mailing to list members is
 *	   info-gnuplot@dartmouth.edu
 * and for mailing administrative requests is 
 *	   majordomo@dartmouth.edu
 * The mailing list for bug reports is 
 *	   bug-gnuplot@dartmouth.edu
 * The list of those interested in beta-test versions is
 *	   info-gnuplot-beta@dartmouth.edu
 */
/* The modifications to allow Gnuplot to compile with Zortech C/C++   */
/* 3.1 /Flash Graphics	were made by Clifton T. Liu 				  */
/* (cliu@merlin.appmath.columbia.edu)		 20 Feb 1993			  */

/*
 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
 */

#ifndef GOT_DRIVER_H
#include "driver.h"
#endif

#ifdef TERM_REGISTER
register_term(hercules)
register_term(egamono)
register_term(egalib)
register_term(vgalib)
register_term(vgamono)
register_term(svgalib)
register_term(ssvgalib)
#endif

#ifdef TERM_PROTO
TERM_PUBLIC void PC_text __PROTO((void));
TERM_PUBLIC void PC_reset __PROTO((void));
TERM_PUBLIC int VGA_text_angle __PROTO((int ang));
TERM_PUBLIC int VGA_justify_text __PROTO((enum JUSTIFY mode));
TERM_PUBLIC void VGA_init __PROTO((void));
TERM_PUBLIC void HERC_graphics __PROTO((void));
TERM_PUBLIC void EGAMONO_graphics __PROTO((void));
TERM_PUBLIC void EGA_graphics __PROTO((void));
TERM_PUBLIC void VGA_graphics __PROTO((void));
TERM_PUBLIC void VGAMONO_graphics __PROTO((void));
TERM_PUBLIC void SVGA_graphics __PROTO((void));
TERM_PUBLIC void SSVGA_graphics __PROTO((void));
TERM_PUBLIC void VGA_linetype __PROTO((int linetype));
#define HERC_XMAX 720
#define HERC_YMAX 348

#define HERC_XLAST (HERC_XMAX - 1)
#define HERC_YLAST (HERC_YMAX - 1)

#define HERC_VCHAR 10
#define HERC_HCHAR 8
#define HERC_VTIC 5
#define HERC_HTIC 5



#define EGA_XMAX 640
#define EGA_YMAX 350

#define EGA_XLAST (EGA_XMAX - 1)
#define EGA_YLAST (EGA_YMAX - 1)

#define EGA_VCHAR 18
#define EGA_HCHAR 8
#define EGA_VTIC 5
#define EGA_HTIC 5


#define VGA_XMAX 640
#define VGA_YMAX 480

#define VGA_XLAST (VGA_XMAX - 1)
#define VGA_YLAST (VGA_YMAX - 1)

#define VGA_VCHAR 24
#define VGA_HCHAR 8
#define VGA_VTIC 5
#define VGA_HTIC 5


#define SVGA_XMAX 800
#define SVGA_YMAX 600

#define SVGA_XLAST (SVGA_XMAX - 1)
#define SVGA_YLAST (SVGA_YMAX - 1)

#define SVGA_VCHAR 24
#define SVGA_HCHAR 8
#define SVGA_VTIC 5
#define SVGA_HTIC 5

#define SSVGA_XMAX 1024
#define SSVGA_YMAX 768

#define SSVGA_XLAST (SSVGA_XMAX - 1)
#define SSVGA_YLAST (SSVGA_YMAX - 1)

#define SSVGA_VCHAR 24
#define SSVGA_HCHAR 8
#define SSVGA_VTIC 5
#define SSVGA_HTIC 5

#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY

void pause __PROTO((void));

#include <fg.h>

static int pattern[] = {0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f};

static int graphics_on = FALSE;
int startx, starty;
/*
int pc_angle;
#define PC_VCHAR FNT5X9_VCHAR
#define PC_HCHAR FNT5X9_HCHAR
*/
void pause()		/* press any key to continue... */
{
	(void) getch();
}


TERM_PUBLIC void PC_text()
{
	if (graphics_on) {
		graphics_on = FALSE;
		pause();
	}
   fg_term();
}

TERM_PUBLIC void PC_reset()
{
}



/* all of the FlashGraphics C routines for the different graphics devices go here */



static int vga256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
static int *vgacolor = vga256color;
static fg_color_t vga_color;
static int text_angle;
static fg_line_t line_to_draw;

TERM_PUBLIC int VGA_text_angle(ang)
int ang;
{
	text_angle = ang;
	return TRUE;
}

TERM_PUBLIC int VGA_justify_text(mode)
enum JUSTIFY mode;
{
	return FALSE;
}

TERM_PUBLIC void VGA_init()
{
	   if (fg_init() == FG_NULL)  {
		   fprintf(stderr,"Graphics card not detected.\n");
		   exit(1);
	  }
}

TERM_PUBLIC void HERC_graphics()
{
   fg_init_herc();
   graphics_on = TRUE;
}

TERM_PUBLIC void EGAMONO_graphics()
{
   fg_init_egamono();
   graphics_on = TRUE;
}

TERM_PUBLIC void EGA_graphics()
{
   fg_init_egaecd();
   graphics_on = TRUE;
}

TERM_PUBLIC void VGA_graphics()
{
   fg_init_vga12();
   graphics_on = TRUE;
}

TERM_PUBLIC void VGAMONO_graphics()
{
   fg_init_vga11();
   graphics_on = TRUE;
}

TERM_PUBLIC void SVGA_graphics()
{
   fg_init_vesa6a();
   graphics_on = TRUE;
}

TERM_PUBLIC void SSVGA_graphics()
{
   fg_init_vesa5();
   graphics_on = TRUE;
}

TERM_PUBLIC void VGA_linetype(linetype)
{
   if (linetype >= 13)
       linetype %= 13;
       vga_color = fg.color[vgacolor[linetype+2]];
}

TERM_PUBLIC void VGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
   fg_puts(vga_color, FG_MODE_SET,	~0,  text_angle, x, y, str, fg.displaybox);
}

TERM_PUBLIC void VGA_move(x,y)
{
	 line_to_draw[FG_X1] = x;
	 line_to_draw[FG_Y1] = y;
}


TERM_PUBLIC void VGA_vector(x,y)
{
	 line_to_draw[FG_X2] = x;
	 line_to_draw[FG_Y2] = y;
	 fg_drawline(vga_color, FG_MODE_SET, ~0, FG_LINE_SOLID, line_to_draw);
	 line_to_draw[FG_X1] = x;
	 line_to_draw[FG_Y1] = y;
}

TERM_PUBLIC void VGA_text()
{
	if (graphics_on) {
		graphics_on = FALSE;
		fg_flush();
		pause();
	}
   fg_term();
}

TERM_PUBLIC void VGA_reset()
{
   fg_term();
}

#endif /* TERM_BODY */

#ifdef TERM_TABLE

TERM_TABLE_START(hercules_driver)
	"hercules", "IBM PC/Clone with Hercules graphics board",
	   HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
	   HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
       VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(hercules_driver)

#undef LAST_TERM
#define LAST_TERM hercules_driver

TERM_TABLE_START(egamono_driver)
	"egamono", "IBM PC/Clone with monochrome EGA graphics board",
	   EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
	   EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
       VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(egamono_driver)

#undef LAST_TERM
#define LAST_TERM egamono_driver

TERM_TABLE_START(egalib_driver)
	"egalib", "IBM PC/Clone with color EGA graphics board",
	   EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
	   EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
       VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(egalib_driver)

#undef LAST_TERM
#define LAST_TERM egalib_driver

TERM_TABLE_START(vgalib_driver)
	"vgalib", "IBM PC/Clone with VGA graphics board",
	   VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
	   VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
       VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(vgalib_driver)

#undef LAST_TERM
#define LAST_TERM vgalib_driver

TERM_TABLE_START(vgamono_driver)
	"vgamono", "IBM PC/Clone with monochrome VGA graphics board",
	   VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
	   VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
       VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(vgamono_driver)

#undef LAST_TERM
#define LAST_TERM vgamono_driver

TERM_TABLE_START(svgalib_driver)
	"svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
	   SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
	   SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
	   VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(svgalib_driver)

#undef LAST_TERM
#define LAST_TERM svgalib_driver

TERM_TABLE_START(ssvgalib_driver)
	"ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
	   SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
	   SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
	   VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
	   VGA_linetype, VGA_put_text, VGA_text_angle, 
       VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(ssvgalib_driver)

#undef LAST_TERM
#define LAST_TERM ssvgalib_driver

#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */


#ifdef TERM_HELP
START_HELP(hercules)
"1 hercules",
"?set terminal hercules",
"?set term hercules",
"?terminal hercules",
"?term hercules",
"?hercules",
"?set terminal egalib",
"?set term egalib",
"?terminal egalib",
"?term egalib",
"?egalib",
"?set terminal egamono",
"?set term egamono",
"?terminal egamono",
"?term egamono",
"?egamono",
"?set terminal vgalib",
"?set term vgalib",
"?terminal vgalib",
"?term vgalib",
"?vgalib",
"?set terminal vgamono",
"?set term vgamono",
"?terminal vgamono",
"?term vgamono",
"?vgamono",
"?set terminal svgalib",
"?set term svgalib",
"?terminal svgalib",
"?term svgalib",
"?svgalib",
"?set terminal ssvgalib",
"?set term ssvgalib",
"?terminal ssvgalib",
"?term ssvgalib",
"?ssvgalib",
" These drivers supports PC monitors with autodetected graphics boards.  They",
" can be used only when compiled with Zortech C/C++.  None have options."
END_HELP(hercules)
#endif