FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
gnuplot-old/term/cgi.trm at gnuplot-4-4-alpha · gnuplot/gnuplot-old · GitHub
gnuplot
gnuplot-old
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
gnuplot-old
/
term
/
cgi.trm
Copy path
More file actions
More file actions
Latest commit
History
History
History
342 lines (292 loc) · 8.23 KB
Breadcrumbs
gnuplot-old
/
term
/
cgi.trm
Copy path
File metadata and controls
342 lines (292 loc) · 8.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/* Hello, Emacs, this is -*-C-*-
* $Id: cgi.trm,v 1.14 2006/07/21 02:35:45 sfeam Exp $
*
*/
/* GNUPLOT - cgi.trm */
/*[
* Copyright (C) 1990 - 1993 Ronald Florence
*
* 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 complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
* This file is included by ../term.h.
*
* This terminal driver supports SCO CGI drivers
*
* AUTHOR
* Ronald Florence <ron@18james.com>
*/
/*
* adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
*/
#include
"driver.h"
#ifdef
TERM_REGISTER
register_term
(
cgi
)
register_term
(
hcgi
)
#endif
#ifdef
TERM_PROTO
TERM_PUBLIC
void
CGI_init
__PROTO
((
void
));
TERM_PUBLIC
void
HCGI_init
__PROTO
((
void
));
TERM_PUBLIC
void
CGI_graphics
__PROTO
((
void
));
TERM_PUBLIC
void
CGI_text
__PROTO
((
void
));
TERM_PUBLIC
void
CGI_reset
__PROTO
((
void
));
TERM_PUBLIC
void
CGI_move
__PROTO
((
unsigned
int
x
,
unsigned
int
y
));
TERM_PUBLIC
void
CGI_vector
__PROTO
((
unsigned
int
x
,
unsigned
int
y
));
TERM_PUBLIC
void
CGI_linetype
__PROTO
((
int
linetype
));
TERM_PUBLIC
void
CGI_put_text
__PROTO
((
unsigned
int
x
,
unsigned
int
y
,
const
char
*
str
));
TERM_PUBLIC
int
CGI_text_angle
__PROTO
((
int
ang
));
TERM_PUBLIC
int
CGI_justify_text
__PROTO
((
enum
JUSTIFY
mode
));
TERM_PUBLIC
void
CGI_point
__PROTO
((
unsigned
int
x
,
unsigned
int
y
,
int
num
));
#define
CGI_XMAX
32767
#define
CGI_YMAX
32767
#define
CGI_VTIC
(CGI_YMAX / 75)
#define
CGI_HTIC
term->h_tic
#define
CGI_VCHAR
term->v_char
#define
CGI_HCHAR
term->h_char
#endif
#ifndef
TERM_PROTO_ONLY
#ifdef
TERM_BODY
#ifdef
VGA_MONO
static
short
rgb
[
16
][
3
]
=
{
0
,
0
,
0
,
/* Black */
1000
,
1000
,
1000
,
/* White */
800
,
800
,
0
,
/* Red */
0
,
600
,
0
,
/* Green */
0
,
800
,
800
,
/* Blue */
1000
,
1000
,
400
,
/* Yellow */
0
,
600
,
600
,
/* Cyan */
600
,
600
,
600
,
/* Magenta */
800
,
800
,
0
,
/* Brown */
600
,
600
,
600
,
/* Lt. Grey */
400
,
600
,
400
,
/* Dark Grey */
400
,
600
,
1000
,
/* Lt. Blue */
400
,
1000
,
400
,
/* Lt Green */
400
,
1000
,
1000
,
/* Lt Cyan */
1000
,
600
,
400
,
/* Lt Red */
600
,
600
,
1000
/* Lt Magenta */
};
#endif
#define
CRT
(gout[45] == 0)
#define
CGICOLORS
gout[13]
#define
CGILINES
gout[6]
#define
CGIROTATES
gout[36]
#define
CGITEXTALIGN
gout[48]
static
short
gout
[
66
];
static
short
cgidev
;
static
short
vect
[
4
];
static
short
gin
[
19
]
=
{
0
,
/* default aspect ratio */
1
,
/* solid line */
1
,
/* line color */
1
,
/* marker type . */
1
,
/* marker color */
1
,
/* graphics text font */
1
,
/* graphics text color */
0
,
/* fill interior style */
0
,
/* fill style index */
1
,
/* fill color index */
1
/* prompt for paper changes */
};
char
*
cgidriver
,
*
getenv
();
TERM_PUBLIC
void
CGI_init
()
{
if
(
getenv
(
cgidriver
=
"CGIDISP"
)
==
NULL
)
HCGI_init
();
}
TERM_PUBLIC
void
HCGI_init
()
{
if
(
getenv
(
cgidriver
=
"CGIPRNT"
)
==
NULL
)
int_error
(
NO_CARET
,
"no CGI driver"
);
}
TERM_PUBLIC
void
CGI_graphics
()
{
int
i
,
aspect
;
char
*
s
;
short
font_cap
[
9
];
if
((
s
=
getenv
(
"ASPECT"
))
!=
NULL
&&
(
aspect
=
atoi
(
s
)) >=
0
&&
aspect
<=
3
)
gin
[
0
]
=
aspect
;
for
(
i
=
0
;
cgidriver
[
i
];
i
++
)
gin
[
11
+
i
]
=
cgidriver
[
i
];
gin
[
18
]
=
' '
;
if
(
v_opnwk
(
gin
,
&
cgidev
,
gout
)
<
0
) {
int_error
(
NO_CARET
,
"CGI error %d opening %s"
,
-
vq_error
(),
cgidriver
);
}
vqt_representation
(
cgidev
,
9
,
font_cap
);
CGI_VCHAR
=
font_cap
[
8
]
*
3
/
2
;
CGI_HCHAR
=
font_cap
[
7
];
CGI_HTIC
=
CGI_VTIC
*
((
double
)
gout
[
1
] / (
double
)
gout
[
4
]) /
((
double
)
gout
[
0
] / (
double
)
gout
[
3
]);
#ifdef
VGA_MONO
if
(
CGICOLORS
>
2
)
vsc_table
(
cgidev
,
0
,
CGICOLORS
,
rgb
);
#endif
}
TERM_PUBLIC
void
CGI_text
()
{
if
(
CRT
) {
short
ptin
[
2
];
char
strin
[
2
];
ptin
[
0
]
=
0
;
ptin
[
1
]
=
0
;
vrq_string
(
cgidev
,
1
,
0
,
ptin
,
strin
);
}
v_clswk
(
cgidev
);
}
TERM_PUBLIC
void
CGI_reset
()
{
}
TERM_PUBLIC
void
CGI_move
(
unsigned
int
x
,
unsigned
int
y
)
{
vect
[
0
]
=
x
;
vect
[
1
]
=
y
;
}
TERM_PUBLIC
void
CGI_vector
(
unsigned
int
x
,
unsigned
int
y
)
{
vect
[
2
]
=
x
;
vect
[
3
]
=
y
;
v_pline
(
cgidev
,
2
,
vect
);
vect
[
0
]
=
x
;
vect
[
1
]
=
y
;
}
TERM_PUBLIC
void
CGI_linetype
(
int
linetype
)
{
short
lcolor
;
if
(
CGICOLORS
>
2
) {
lcolor
=
(
linetype
+
2
) %
CGICOLORS
+
1
;
vsl_color
(
cgidev
,
lcolor
);
vsm_color
(
cgidev
,
lcolor
);
}
vsl_type
(
cgidev
, (
linetype
<
1
) ?
1
: (
linetype
%
CGILINES
)
+
1
);
}
TERM_PUBLIC
void
CGI_put_text
(
unsigned
int
x
,
unsigned
int
y
,
const
char
*
str
)
{
v_gtext
(
cgidev
, (
short
)
x
, (
short
)
y
,
str
);
}
TERM_PUBLIC
int
CGI_text_angle
(
int
ang
)
{
if
(!
CGIROTATES
)
return
FALSE;
/* angles are 1/10 degree ccw */
vst_rotation
(
cgidev
, (
ang
) ?
900
:
0
);
return
TRUE;
}
TERM_PUBLIC
int
CGI_justify_text
(
enum
JUSTIFY
mode
)
{
short
hor_in
,
hor_out
,
vert_out
;
if
(!
CGITEXTALIGN
)
return
FALSE;
switch
(
mode
) {
case
LEFT
:
hor_in
=
0
;
break
;
case
CENTRE
:
hor_in
=
1
;
break
;
case
RIGHT
:
hor_in
=
2
;
break
;
}
vst_alignment
(
cgidev
,
hor_in
,
1
,
&
hor_out
,
&
vert_out
);
return
TRUE;
}
#define
POINT_TYPES
6
TERM_PUBLIC
void
CGI_point
(
unsigned
int
x
,
unsigned
y
,
int
num
)
{
short
point
[
2
];
static
short
cgimarker
[
POINT_TYPES
]
=
{
1
,
2
,
6
,
4
,
5
,
3
};
/* . + <> [] X * */
if
(
num
<
0
) {
CGI_move
(
x
,
y
);
CGI_vector
(
x
,
y
);
}
else
{
vsm_type
(
cgidev
,
cgimarker
[
num
%
POINT_TYPES
]);
point
[
0
]
=
x
;
point
[
1
]
=
y
;
v_pmarker
(
cgidev
,
1
,
point
);
}
}
#endif
/* TERM_BODY */
#ifdef
TERM_TABLE
TERM_TABLE_START
(
cgi_driver
)
"cgi"
,
"SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)"
,
CGI_XMAX
,
CGI_YMAX
,
0
,
0
,
CGI_VTIC
,
0
,
options_null
,
CGI_init
,
CGI_reset
,
CGI_text
,
null_scale
,
CGI_graphics
,
CGI_move
,
CGI_vector
,
CGI_linetype
,
CGI_put_text
,
CGI_text_angle
,
CGI_justify_text
,
CGI_point
,
do_arrow
,
set_font_null
TERM_TABLE_END
(
cgi_driver
)
#undef
LAST_TERM
#define
LAST_TERM
cgi_driver
TERM_TABLE_START
(
hcgi_driver
)
"hcgi"
,
"SCO CGI drivers (hardcopy, requires CGIPRNT env variable)"
,
CGI_XMAX
,
CGI_YMAX
,
0
,
0
,
CGI_VTIC
,
0
,
options_null
,
HCGI_init
,
CGI_reset
,
CGI_text
,
null_scale
,
CGI_graphics
,
CGI_move
,
CGI_vector
,
CGI_linetype
,
CGI_put_text
,
CGI_text_angle
,
CGI_justify_text
,
CGI_point
,
do_arrow
,
set_font_null
TERM_TABLE_END
(
hcgi_driver
)
#undef
LAST_TERM
#define
LAST_TERM
hcgi_driver
#endif
/* TERM_TABLE */
#endif
/* TERM_PROTO_ONLY */
#ifdef
TERM_HELP
START_HELP
(
cgi
)
"1 cgi"
,
"?commands set terminal cgi"
,
"?set terminal cgi"
,
"?set term cgi"
,
"?terminal cgi"
,
"?term cgi"
,
"?cgi"
,
"?commands set terminal hcgi"
,
"?set terminal hcgi"
,
"?set term hcgi"
,
"?terminal hcgi"
,
"?term hcgi"
,
"?hcgi"
,
" The `cgi` and `hcgi` terminal drivers support SCO CGI drivers. `hcgi` is for"
,
" printers; the environment variable CGIPRNT must be set. `cgi` may be used"
,
" for either a display or hardcopy; if the environment variable CGIDISP is set,"
,
" then that display is used. Otherwise CGIPRNT is used."
,
""
,
" These terminals have no options."
END_HELP
(
cgi
)
#endif
Back
|
FazBrowse Home
|
New Git URL