Annotation of OpenXM_contrib/gnuplot/term/xlib.trm, Revision 1.1.1.3
1.1 maekawa 1: /*
1.1.1.3 ! ohara 2: * $Id: xlib.trm,v 1.7.2.1 2002/12/11 19:24:27 lhecking Exp $
1.1 maekawa 3: */
4:
5: /* GNUPLOT - xlib.trm */
6:
7: /*[
8: * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
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: * xlib.trm - inboard terminal driver for X11 (dumps gnuplot_x11 commands)
39: *
40: * To be used with gnulib_x11.
41: */
42:
43: /*
44: * adapted to new terminal layout by Stefan Bodewig (Dec. 1995)
45: */
46:
47: #include "driver.h"
48:
49: #ifdef TERM_REGISTER
50: register_term(xlib)
51: #endif
52:
53: #ifdef TERM_PROTO
54: TERM_PUBLIC void Xlib_init __PROTO((void));
55: TERM_PUBLIC void Xlib_graphics __PROTO((void));
56: TERM_PUBLIC void Xlib_text __PROTO((void));
57: TERM_PUBLIC void Xlib_reset __PROTO((void));
58: TERM_PUBLIC void Xlib_move __PROTO((unsigned int x, unsigned int y));
59: TERM_PUBLIC void Xlib_vector __PROTO((unsigned int x, unsigned int y));
60: TERM_PUBLIC void Xlib_linetype __PROTO((int lt));
61: TERM_PUBLIC void Xlib_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
62: TERM_PUBLIC int Xlib_justify_text __PROTO((enum JUSTIFY mode));
63:
64: #define Xlib_XMAX 4096
65: #define Xlib_YMAX 4096
66:
67: /* approximations for typical font/screen sizes */
68: #define Xlib_VCHAR (Xlib_YMAX/25)
69: #define Xlib_HCHAR (Xlib_XMAX/100)
70: #define Xlib_VTIC (Xlib_YMAX/100)
71: #define Xlib_HTIC (Xlib_XMAX/150)
72:
73: #define GOT_XLIB_PROTO
74: #endif
75:
76: #ifndef TERM_PROTO_ONLY
77: #ifdef TERM_BODY
78:
79: TERM_PUBLIC void Xlib_init()
80: {
81: /* empty */
82: }
83:
84: TERM_PUBLIC void Xlib_graphics()
85: {
86: fputs("G\n", gpoutfile);
87: }
88:
89: TERM_PUBLIC void Xlib_text()
90: {
91: fputs("E\n", gpoutfile);
92: fflush(gpoutfile);
93: #ifdef ULTRIX_KLUDGE
94: fputs("E\n", gpoutfile);
95: fflush(gpoutfile);
96: #endif
97: }
98:
99: TERM_PUBLIC void Xlib_reset()
100: {
101: fputs("R\n", gpoutfile);
102: fflush(gpoutfile);
103: }
104:
105: TERM_PUBLIC void Xlib_move(x, y)
106: unsigned int x, y;
107: {
108: fprintf(gpoutfile, "M%04d%04d\n", x, y);
109: }
110:
111: TERM_PUBLIC void Xlib_vector(x, y)
112: unsigned int x, y;
113: {
114: fprintf(gpoutfile, "V%04d%04d\n", x, y);
115: }
116:
117: TERM_PUBLIC void Xlib_linetype(lt)
118: int lt;
119: {
120: fprintf(gpoutfile, "L%04d\n", lt);
121: }
122:
123: TERM_PUBLIC void Xlib_put_text(x, y, str)
124: unsigned int x, y;
125: char str[];
126: {
127: fprintf(gpoutfile, "T%04d%04d%s\n", x, y, str);
128: }
129:
130: TERM_PUBLIC int Xlib_justify_text(mode)
131: enum JUSTIFY mode;
132: {
133: fprintf(gpoutfile, "J%04d\n", mode);
134: return (TRUE);
135: }
136:
137: #endif
138:
139: #ifdef TERM_TABLE
140: TERM_TABLE_START(xlib_driver)
141: "xlib", "X11 Window System (gnulib_x11 dump)",
142: Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR,
143: Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset,
144: Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector,
145: Xlib_linetype, Xlib_put_text, null_text_angle,
146: Xlib_justify_text, line_and_point, do_arrow, set_font_null
147: TERM_TABLE_END(xlib_driver)
148:
149: #undef LAST_TERM
150: #define LAST_TERM xlib_driver
151:
152: #endif /* TERM_TABLE */
153: #endif /* TERM_PROTO_ONLY */
154:
155: #ifdef TERM_HELP
156: START_HELP(xlib)
157: "1 xlib",
158: "?commands set terminal xlib",
159: "?set terminal xlib",
160: "?set term xlib",
161: "?terminal xlib",
162: "?term xlib",
163: "?xlib",
164: " The `xlib` terminal driver supports the X11 Windows System. It generates",
1.1.1.3 ! ohara 165: " gnuplot_x11 commands. `set term x11` behaves similarly to `set terminal xlib;",
1.1 maekawa 166: " set output \"|gnuplot_x11\"`. `xlib` has no options, but see `x11`."
167: END_HELP(xlib)
168: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>