line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
/* -*- buffer-read-only: t -*- |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
This file is auto-generated. ***ANY*** changes here will be lost. |
5
|
|
|
|
|
|
|
Written by genchars.pl version 1.98 */ |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#define HAVE_POLL_H |
8
|
|
|
|
|
|
|
#define HAVE_SYS_POLL_H |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#ifdef CC_TERMIOS |
12
|
|
|
|
|
|
|
# define TermStructure struct termios |
13
|
|
|
|
|
|
|
# ifdef NCCS |
14
|
|
|
|
|
|
|
# define LEGALMAXCC NCCS |
15
|
|
|
|
|
|
|
# else |
16
|
|
|
|
|
|
|
# ifdef NCC |
17
|
|
|
|
|
|
|
# define LEGALMAXCC NCC |
18
|
|
|
|
|
|
|
# endif |
19
|
|
|
|
|
|
|
# endif |
20
|
|
|
|
|
|
|
#else |
21
|
|
|
|
|
|
|
# ifdef CC_TERMIO |
22
|
|
|
|
|
|
|
# define TermStructure struct termio |
23
|
|
|
|
|
|
|
# ifdef NCC |
24
|
|
|
|
|
|
|
# define LEGALMAXCC NCC |
25
|
|
|
|
|
|
|
# else |
26
|
|
|
|
|
|
|
# ifdef NCCS |
27
|
|
|
|
|
|
|
# define LEGALMAXCC NCCS |
28
|
|
|
|
|
|
|
# endif |
29
|
|
|
|
|
|
|
# endif |
30
|
|
|
|
|
|
|
# endif |
31
|
|
|
|
|
|
|
#endif |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#if !defined(LEGALMAXCC) |
34
|
|
|
|
|
|
|
# define LEGALMAXCC 126 |
35
|
|
|
|
|
|
|
#endif |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#ifdef XS_INTERNAL |
38
|
|
|
|
|
|
|
# define TRTXS(a) XS_INTERNAL(a) |
39
|
|
|
|
|
|
|
#else |
40
|
|
|
|
|
|
|
# define TRTXS(a) XS(a) |
41
|
|
|
|
|
|
|
#endif |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#if defined(CC_TERMIO) || defined(CC_TERMIOS) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
STATIC const char * const cc_names[] = { |
46
|
|
|
|
|
|
|
#if defined(VDISCARD) && (VDISCARD < LEGALMAXCC) |
47
|
|
|
|
|
|
|
"DISCARD", |
48
|
|
|
|
|
|
|
#else |
49
|
|
|
|
|
|
|
"", |
50
|
|
|
|
|
|
|
#endif |
51
|
|
|
|
|
|
|
#if defined(VFLUSH) && (VFLUSH < LEGALMAXCC) |
52
|
|
|
|
|
|
|
"DISCARD", |
53
|
|
|
|
|
|
|
#else |
54
|
|
|
|
|
|
|
"", |
55
|
|
|
|
|
|
|
#endif |
56
|
|
|
|
|
|
|
#if defined(VDSUSP) && (VDSUSP < LEGALMAXCC) |
57
|
|
|
|
|
|
|
"DSUSPEND", |
58
|
|
|
|
|
|
|
#else |
59
|
|
|
|
|
|
|
"", |
60
|
|
|
|
|
|
|
#endif |
61
|
|
|
|
|
|
|
#if defined(VEOF) && (VEOF < LEGALMAXCC) |
62
|
|
|
|
|
|
|
"EOF", |
63
|
|
|
|
|
|
|
#else |
64
|
|
|
|
|
|
|
"", |
65
|
|
|
|
|
|
|
#endif |
66
|
|
|
|
|
|
|
#if defined(VEOL) && (VEOL < LEGALMAXCC) |
67
|
|
|
|
|
|
|
"EOL", |
68
|
|
|
|
|
|
|
#else |
69
|
|
|
|
|
|
|
"", |
70
|
|
|
|
|
|
|
#endif |
71
|
|
|
|
|
|
|
#if defined(VEOL2) && (VEOL2 < LEGALMAXCC) |
72
|
|
|
|
|
|
|
"EOL2", |
73
|
|
|
|
|
|
|
#else |
74
|
|
|
|
|
|
|
"", |
75
|
|
|
|
|
|
|
#endif |
76
|
|
|
|
|
|
|
#if defined(VERASE) && (VERASE < LEGALMAXCC) |
77
|
|
|
|
|
|
|
"ERASE", |
78
|
|
|
|
|
|
|
#else |
79
|
|
|
|
|
|
|
"", |
80
|
|
|
|
|
|
|
#endif |
81
|
|
|
|
|
|
|
#if defined(VWERASE) && (VWERASE < LEGALMAXCC) |
82
|
|
|
|
|
|
|
"ERASEWORD", |
83
|
|
|
|
|
|
|
#else |
84
|
|
|
|
|
|
|
"", |
85
|
|
|
|
|
|
|
#endif |
86
|
|
|
|
|
|
|
#if defined(VINTR) && (VINTR < LEGALMAXCC) |
87
|
|
|
|
|
|
|
"INTERRUPT", |
88
|
|
|
|
|
|
|
#else |
89
|
|
|
|
|
|
|
"", |
90
|
|
|
|
|
|
|
#endif |
91
|
|
|
|
|
|
|
#if defined(VKILL) && (VKILL < LEGALMAXCC) |
92
|
|
|
|
|
|
|
"KILL", |
93
|
|
|
|
|
|
|
#else |
94
|
|
|
|
|
|
|
"", |
95
|
|
|
|
|
|
|
#endif |
96
|
|
|
|
|
|
|
#if defined(VMIN) && (VMIN < LEGALMAXCC) |
97
|
|
|
|
|
|
|
"MIN", |
98
|
|
|
|
|
|
|
#else |
99
|
|
|
|
|
|
|
"", |
100
|
|
|
|
|
|
|
#endif |
101
|
|
|
|
|
|
|
#if defined(VQUIT) && (VQUIT < LEGALMAXCC) |
102
|
|
|
|
|
|
|
"QUIT", |
103
|
|
|
|
|
|
|
#else |
104
|
|
|
|
|
|
|
"", |
105
|
|
|
|
|
|
|
#endif |
106
|
|
|
|
|
|
|
#if defined(VLNEXT) && (VLNEXT < LEGALMAXCC) |
107
|
|
|
|
|
|
|
"QUOTENEXT", |
108
|
|
|
|
|
|
|
#else |
109
|
|
|
|
|
|
|
"", |
110
|
|
|
|
|
|
|
#endif |
111
|
|
|
|
|
|
|
#if defined(VQUOTE) && (VQUOTE < LEGALMAXCC) |
112
|
|
|
|
|
|
|
"QUOTENEXT", |
113
|
|
|
|
|
|
|
#else |
114
|
|
|
|
|
|
|
"", |
115
|
|
|
|
|
|
|
#endif |
116
|
|
|
|
|
|
|
#if defined(VREPRINT) && (VREPRINT < LEGALMAXCC) |
117
|
|
|
|
|
|
|
"REPRINT", |
118
|
|
|
|
|
|
|
#else |
119
|
|
|
|
|
|
|
"", |
120
|
|
|
|
|
|
|
#endif |
121
|
|
|
|
|
|
|
#if defined(VSTART) && (VSTART < LEGALMAXCC) |
122
|
|
|
|
|
|
|
"START", |
123
|
|
|
|
|
|
|
#else |
124
|
|
|
|
|
|
|
"", |
125
|
|
|
|
|
|
|
#endif |
126
|
|
|
|
|
|
|
#if defined(VSTATUS) && (VSTATUS < LEGALMAXCC) |
127
|
|
|
|
|
|
|
"STATUS", |
128
|
|
|
|
|
|
|
#else |
129
|
|
|
|
|
|
|
"", |
130
|
|
|
|
|
|
|
#endif |
131
|
|
|
|
|
|
|
#if defined(VSTOP) && (VSTOP < LEGALMAXCC) |
132
|
|
|
|
|
|
|
"STOP", |
133
|
|
|
|
|
|
|
#else |
134
|
|
|
|
|
|
|
"", |
135
|
|
|
|
|
|
|
#endif |
136
|
|
|
|
|
|
|
#if defined(VSUSP) && (VSUSP < LEGALMAXCC) |
137
|
|
|
|
|
|
|
"SUSPEND", |
138
|
|
|
|
|
|
|
#else |
139
|
|
|
|
|
|
|
"", |
140
|
|
|
|
|
|
|
#endif |
141
|
|
|
|
|
|
|
#if defined(VSWTC) && (VSWTC < LEGALMAXCC) |
142
|
|
|
|
|
|
|
"SWITCH", |
143
|
|
|
|
|
|
|
#else |
144
|
|
|
|
|
|
|
"", |
145
|
|
|
|
|
|
|
#endif |
146
|
|
|
|
|
|
|
#if defined(VSWTCH) && (VSWTCH < LEGALMAXCC) |
147
|
|
|
|
|
|
|
"SWITCH", |
148
|
|
|
|
|
|
|
#else |
149
|
|
|
|
|
|
|
"", |
150
|
|
|
|
|
|
|
#endif |
151
|
|
|
|
|
|
|
#if defined(VTIME) && (VTIME < LEGALMAXCC) |
152
|
|
|
|
|
|
|
"TIME", |
153
|
|
|
|
|
|
|
#else |
154
|
|
|
|
|
|
|
"", |
155
|
|
|
|
|
|
|
#endif |
156
|
|
|
|
|
|
|
}; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
STATIC const int MAXCC = 0 |
159
|
|
|
|
|
|
|
#if defined(VDISCARD) && (VDISCARD < LEGALMAXCC) |
160
|
|
|
|
|
|
|
+1 /* DISCARD */ |
161
|
|
|
|
|
|
|
#endif |
162
|
|
|
|
|
|
|
#if defined(VFLUSH) && (VFLUSH < LEGALMAXCC) |
163
|
|
|
|
|
|
|
+1 /* DISCARD */ |
164
|
|
|
|
|
|
|
#endif |
165
|
|
|
|
|
|
|
#if defined(VDSUSP) && (VDSUSP < LEGALMAXCC) |
166
|
|
|
|
|
|
|
+1 /* DSUSPEND */ |
167
|
|
|
|
|
|
|
#endif |
168
|
|
|
|
|
|
|
#if defined(VEOF) && (VEOF < LEGALMAXCC) |
169
|
|
|
|
|
|
|
+1 /* EOF */ |
170
|
|
|
|
|
|
|
#endif |
171
|
|
|
|
|
|
|
#if defined(VEOL) && (VEOL < LEGALMAXCC) |
172
|
|
|
|
|
|
|
+1 /* EOL */ |
173
|
|
|
|
|
|
|
#endif |
174
|
|
|
|
|
|
|
#if defined(VEOL2) && (VEOL2 < LEGALMAXCC) |
175
|
|
|
|
|
|
|
+1 /* EOL2 */ |
176
|
|
|
|
|
|
|
#endif |
177
|
|
|
|
|
|
|
#if defined(VERASE) && (VERASE < LEGALMAXCC) |
178
|
|
|
|
|
|
|
+1 /* ERASE */ |
179
|
|
|
|
|
|
|
#endif |
180
|
|
|
|
|
|
|
#if defined(VWERASE) && (VWERASE < LEGALMAXCC) |
181
|
|
|
|
|
|
|
+1 /* ERASEWORD */ |
182
|
|
|
|
|
|
|
#endif |
183
|
|
|
|
|
|
|
#if defined(VINTR) && (VINTR < LEGALMAXCC) |
184
|
|
|
|
|
|
|
+1 /* INTERRUPT */ |
185
|
|
|
|
|
|
|
#endif |
186
|
|
|
|
|
|
|
#if defined(VKILL) && (VKILL < LEGALMAXCC) |
187
|
|
|
|
|
|
|
+1 /* KILL */ |
188
|
|
|
|
|
|
|
#endif |
189
|
|
|
|
|
|
|
#if defined(VMIN) && (VMIN < LEGALMAXCC) |
190
|
|
|
|
|
|
|
+1 /* MIN */ |
191
|
|
|
|
|
|
|
#endif |
192
|
|
|
|
|
|
|
#if defined(VQUIT) && (VQUIT < LEGALMAXCC) |
193
|
|
|
|
|
|
|
+1 /* QUIT */ |
194
|
|
|
|
|
|
|
#endif |
195
|
|
|
|
|
|
|
#if defined(VLNEXT) && (VLNEXT < LEGALMAXCC) |
196
|
|
|
|
|
|
|
+1 /* QUOTENEXT */ |
197
|
|
|
|
|
|
|
#endif |
198
|
|
|
|
|
|
|
#if defined(VQUOTE) && (VQUOTE < LEGALMAXCC) |
199
|
|
|
|
|
|
|
+1 /* QUOTENEXT */ |
200
|
|
|
|
|
|
|
#endif |
201
|
|
|
|
|
|
|
#if defined(VREPRINT) && (VREPRINT < LEGALMAXCC) |
202
|
|
|
|
|
|
|
+1 /* REPRINT */ |
203
|
|
|
|
|
|
|
#endif |
204
|
|
|
|
|
|
|
#if defined(VSTART) && (VSTART < LEGALMAXCC) |
205
|
|
|
|
|
|
|
+1 /* START */ |
206
|
|
|
|
|
|
|
#endif |
207
|
|
|
|
|
|
|
#if defined(VSTATUS) && (VSTATUS < LEGALMAXCC) |
208
|
|
|
|
|
|
|
+1 /* STATUS */ |
209
|
|
|
|
|
|
|
#endif |
210
|
|
|
|
|
|
|
#if defined(VSTOP) && (VSTOP < LEGALMAXCC) |
211
|
|
|
|
|
|
|
+1 /* STOP */ |
212
|
|
|
|
|
|
|
#endif |
213
|
|
|
|
|
|
|
#if defined(VSUSP) && (VSUSP < LEGALMAXCC) |
214
|
|
|
|
|
|
|
+1 /* SUSPEND */ |
215
|
|
|
|
|
|
|
#endif |
216
|
|
|
|
|
|
|
#if defined(VSWTC) && (VSWTC < LEGALMAXCC) |
217
|
|
|
|
|
|
|
+1 /* SWITCH */ |
218
|
|
|
|
|
|
|
#endif |
219
|
|
|
|
|
|
|
#if defined(VSWTCH) && (VSWTCH < LEGALMAXCC) |
220
|
|
|
|
|
|
|
+1 /* SWITCH */ |
221
|
|
|
|
|
|
|
#endif |
222
|
|
|
|
|
|
|
#if defined(VTIME) && (VTIME < LEGALMAXCC) |
223
|
|
|
|
|
|
|
+1 /* TIME */ |
224
|
|
|
|
|
|
|
#endif |
225
|
|
|
|
|
|
|
; |
226
|
|
|
|
|
|
|
|
227
|
0
|
|
|
|
|
|
TRTXS(XS_Term__ReadKey_GetControlChars) |
228
|
|
|
|
|
|
|
{ |
229
|
0
|
|
|
|
|
|
dXSARGS; |
230
|
0
|
0
|
|
|
|
|
if (items < 0 || items > 1) { |
|
|
0
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
croak("Usage: Term::ReadKey::GetControlChars()"); |
232
|
|
|
|
|
|
|
} |
233
|
0
|
|
|
|
|
|
SP -= items; |
234
|
|
|
|
|
|
|
{ |
235
|
|
|
|
|
|
|
PerlIO * file; |
236
|
|
|
|
|
|
|
TermStructure s; |
237
|
0
|
0
|
|
|
|
|
if (items < 1) |
238
|
0
|
|
|
|
|
|
file = STDIN; |
239
|
|
|
|
|
|
|
else { |
240
|
0
|
|
|
|
|
|
file = IoIFP(sv_2io(ST(0))); |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
#ifdef CC_TERMIOS |
244
|
0
|
0
|
|
|
|
|
if(tcgetattr(PerlIO_fileno(file),&s)) |
245
|
|
|
|
|
|
|
#else |
246
|
|
|
|
|
|
|
# ifdef CC_TERMIO |
247
|
|
|
|
|
|
|
if(ioctl(PerlIO_fileno(file),TCGETA,&s)) |
248
|
|
|
|
|
|
|
# endif |
249
|
|
|
|
|
|
|
#endif |
250
|
0
|
|
|
|
|
|
croak("Unable to read terminal settings in GetControlChars"); |
251
|
|
|
|
|
|
|
else { |
252
|
0
|
0
|
|
|
|
|
EXTEND(sp,MAXCC*2); |
|
|
0
|
|
|
|
|
|
253
|
|
|
|
|
|
|
#if defined(VDISCARD) && (VDISCARD < LEGALMAXCC) |
254
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[0],strlen(cc_names[0])))); /* DISCARD */ |
255
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VDISCARD],1))); |
256
|
|
|
|
|
|
|
#endif |
257
|
|
|
|
|
|
|
#if defined(VFLUSH) && (VFLUSH < LEGALMAXCC) |
258
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[1],strlen(cc_names[1])))); /* DISCARD */ |
259
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VFLUSH],1))); |
260
|
|
|
|
|
|
|
#endif |
261
|
|
|
|
|
|
|
#if defined(VDSUSP) && (VDSUSP < LEGALMAXCC) |
262
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[2],strlen(cc_names[2])))); /* DSUSPEND */ |
263
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VDSUSP],1))); |
264
|
|
|
|
|
|
|
#endif |
265
|
|
|
|
|
|
|
#if defined(VEOF) && (VEOF < LEGALMAXCC) |
266
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[3],strlen(cc_names[3])))); /* EOF */ |
267
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VEOF],1))); |
268
|
|
|
|
|
|
|
#endif |
269
|
|
|
|
|
|
|
#if defined(VEOL) && (VEOL < LEGALMAXCC) |
270
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[4],strlen(cc_names[4])))); /* EOL */ |
271
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VEOL],1))); |
272
|
|
|
|
|
|
|
#endif |
273
|
|
|
|
|
|
|
#if defined(VEOL2) && (VEOL2 < LEGALMAXCC) |
274
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[5],strlen(cc_names[5])))); /* EOL2 */ |
275
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VEOL2],1))); |
276
|
|
|
|
|
|
|
#endif |
277
|
|
|
|
|
|
|
#if defined(VERASE) && (VERASE < LEGALMAXCC) |
278
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[6],strlen(cc_names[6])))); /* ERASE */ |
279
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VERASE],1))); |
280
|
|
|
|
|
|
|
#endif |
281
|
|
|
|
|
|
|
#if defined(VWERASE) && (VWERASE < LEGALMAXCC) |
282
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[7],strlen(cc_names[7])))); /* ERASEWORD */ |
283
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VWERASE],1))); |
284
|
|
|
|
|
|
|
#endif |
285
|
|
|
|
|
|
|
#if defined(VINTR) && (VINTR < LEGALMAXCC) |
286
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[8],strlen(cc_names[8])))); /* INTERRUPT */ |
287
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VINTR],1))); |
288
|
|
|
|
|
|
|
#endif |
289
|
|
|
|
|
|
|
#if defined(VKILL) && (VKILL < LEGALMAXCC) |
290
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[9],strlen(cc_names[9])))); /* KILL */ |
291
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VKILL],1))); |
292
|
|
|
|
|
|
|
#endif |
293
|
|
|
|
|
|
|
#if defined(VMIN) && (VMIN < LEGALMAXCC) |
294
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[10],strlen(cc_names[10])))); /* MIN */ |
295
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VMIN],1))); |
296
|
|
|
|
|
|
|
#endif |
297
|
|
|
|
|
|
|
#if defined(VQUIT) && (VQUIT < LEGALMAXCC) |
298
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[11],strlen(cc_names[11])))); /* QUIT */ |
299
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VQUIT],1))); |
300
|
|
|
|
|
|
|
#endif |
301
|
|
|
|
|
|
|
#if defined(VLNEXT) && (VLNEXT < LEGALMAXCC) |
302
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[12],strlen(cc_names[12])))); /* QUOTENEXT */ |
303
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VLNEXT],1))); |
304
|
|
|
|
|
|
|
#endif |
305
|
|
|
|
|
|
|
#if defined(VQUOTE) && (VQUOTE < LEGALMAXCC) |
306
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[13],strlen(cc_names[13])))); /* QUOTENEXT */ |
307
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VQUOTE],1))); |
308
|
|
|
|
|
|
|
#endif |
309
|
|
|
|
|
|
|
#if defined(VREPRINT) && (VREPRINT < LEGALMAXCC) |
310
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[14],strlen(cc_names[14])))); /* REPRINT */ |
311
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VREPRINT],1))); |
312
|
|
|
|
|
|
|
#endif |
313
|
|
|
|
|
|
|
#if defined(VSTART) && (VSTART < LEGALMAXCC) |
314
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[15],strlen(cc_names[15])))); /* START */ |
315
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VSTART],1))); |
316
|
|
|
|
|
|
|
#endif |
317
|
|
|
|
|
|
|
#if defined(VSTATUS) && (VSTATUS < LEGALMAXCC) |
318
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[16],strlen(cc_names[16])))); /* STATUS */ |
319
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VSTATUS],1))); |
320
|
|
|
|
|
|
|
#endif |
321
|
|
|
|
|
|
|
#if defined(VSTOP) && (VSTOP < LEGALMAXCC) |
322
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[17],strlen(cc_names[17])))); /* STOP */ |
323
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VSTOP],1))); |
324
|
|
|
|
|
|
|
#endif |
325
|
|
|
|
|
|
|
#if defined(VSUSP) && (VSUSP < LEGALMAXCC) |
326
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[18],strlen(cc_names[18])))); /* SUSPEND */ |
327
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VSUSP],1))); |
328
|
|
|
|
|
|
|
#endif |
329
|
|
|
|
|
|
|
#if defined(VSWTC) && (VSWTC < LEGALMAXCC) |
330
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[19],strlen(cc_names[19])))); /* SWITCH */ |
331
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VSWTC],1))); |
332
|
|
|
|
|
|
|
#endif |
333
|
|
|
|
|
|
|
#if defined(VSWTCH) && (VSWTCH < LEGALMAXCC) |
334
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[20],strlen(cc_names[20])))); /* SWITCH */ |
335
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VSWTCH],1))); |
336
|
|
|
|
|
|
|
#endif |
337
|
|
|
|
|
|
|
#if defined(VTIME) && (VTIME < LEGALMAXCC) |
338
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[21],strlen(cc_names[21])))); /* TIME */ |
339
|
0
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[VTIME],1))); |
340
|
|
|
|
|
|
|
#endif |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
} |
343
|
0
|
|
|
|
|
|
PUTBACK; |
344
|
0
|
|
|
|
|
|
return; |
345
|
|
|
|
|
|
|
} |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
|
TRTXS(XS_Term__ReadKey_SetControlChars) |
349
|
|
|
|
|
|
|
{ |
350
|
0
|
|
|
|
|
|
dXSARGS; |
351
|
|
|
|
|
|
|
/*if ((items % 2) != 0) { |
352
|
|
|
|
|
|
|
croak("Usage: Term::ReadKey::SetControlChars(%charpairs,file=STDIN)"); |
353
|
|
|
|
|
|
|
}*/ |
354
|
0
|
|
|
|
|
|
SP -= items; |
355
|
|
|
|
|
|
|
{ |
356
|
|
|
|
|
|
|
TermStructure s; |
357
|
|
|
|
|
|
|
PerlIO * file; |
358
|
0
|
0
|
|
|
|
|
if ((items % 2) == 1) |
359
|
0
|
|
|
|
|
|
file = IoIFP(sv_2io(ST(items-1))); |
360
|
|
|
|
|
|
|
else { |
361
|
0
|
|
|
|
|
|
file = STDIN; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
#ifdef CC_TERMIOS |
365
|
0
|
0
|
|
|
|
|
if(tcgetattr(PerlIO_fileno(file),&s)) |
366
|
|
|
|
|
|
|
#else |
367
|
|
|
|
|
|
|
# ifdef CC_TERMIO |
368
|
|
|
|
|
|
|
if(ioctl(PerlIO_fileno(file),TCGETA,&s)) |
369
|
|
|
|
|
|
|
# endif |
370
|
|
|
|
|
|
|
#endif |
371
|
0
|
|
|
|
|
|
croak("Unable to read terminal settings in SetControlChars"); |
372
|
|
|
|
|
|
|
else { |
373
|
|
|
|
|
|
|
int i; |
374
|
|
|
|
|
|
|
char * name, value; |
375
|
0
|
0
|
|
|
|
|
for(i=0;i+1
|
376
|
0
|
0
|
|
|
|
|
name = SvPV(ST(i),PL_na); |
377
|
0
|
0
|
|
|
|
|
if( SvIOKp(ST(i+1)) || SvNOKp(ST(i+1)) )/* If Int or Float */ |
|
|
0
|
|
|
|
|
|
378
|
0
|
0
|
|
|
|
|
value = (char)SvIV(ST(i+1)); /* Store int value */ |
379
|
|
|
|
|
|
|
else /* Otherwise */ |
380
|
0
|
0
|
|
|
|
|
value = SvPV(ST(i+1),PL_na)[0]; /* Use first char of PV */ |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
if (0) ; |
383
|
|
|
|
|
|
|
#if defined(VDISCARD) && (VDISCARD < LEGALMAXCC) |
384
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[0])==0) /* DISCARD */ |
385
|
0
|
|
|
|
|
|
s.c_cc[VDISCARD] = value; |
386
|
|
|
|
|
|
|
#endif |
387
|
|
|
|
|
|
|
#if defined(VFLUSH) && (VFLUSH < LEGALMAXCC) |
388
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[1])==0) /* DISCARD */ |
389
|
|
|
|
|
|
|
s.c_cc[VFLUSH] = value; |
390
|
|
|
|
|
|
|
#endif |
391
|
|
|
|
|
|
|
#if defined(VDSUSP) && (VDSUSP < LEGALMAXCC) |
392
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[2])==0) /* DSUSPEND */ |
393
|
|
|
|
|
|
|
s.c_cc[VDSUSP] = value; |
394
|
|
|
|
|
|
|
#endif |
395
|
|
|
|
|
|
|
#if defined(VEOF) && (VEOF < LEGALMAXCC) |
396
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[3])==0) /* EOF */ |
397
|
0
|
|
|
|
|
|
s.c_cc[VEOF] = value; |
398
|
|
|
|
|
|
|
#endif |
399
|
|
|
|
|
|
|
#if defined(VEOL) && (VEOL < LEGALMAXCC) |
400
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[4])==0) /* EOL */ |
401
|
0
|
|
|
|
|
|
s.c_cc[VEOL] = value; |
402
|
|
|
|
|
|
|
#endif |
403
|
|
|
|
|
|
|
#if defined(VEOL2) && (VEOL2 < LEGALMAXCC) |
404
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[5])==0) /* EOL2 */ |
405
|
0
|
|
|
|
|
|
s.c_cc[VEOL2] = value; |
406
|
|
|
|
|
|
|
#endif |
407
|
|
|
|
|
|
|
#if defined(VERASE) && (VERASE < LEGALMAXCC) |
408
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[6])==0) /* ERASE */ |
409
|
0
|
|
|
|
|
|
s.c_cc[VERASE] = value; |
410
|
|
|
|
|
|
|
#endif |
411
|
|
|
|
|
|
|
#if defined(VWERASE) && (VWERASE < LEGALMAXCC) |
412
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[7])==0) /* ERASEWORD */ |
413
|
0
|
|
|
|
|
|
s.c_cc[VWERASE] = value; |
414
|
|
|
|
|
|
|
#endif |
415
|
|
|
|
|
|
|
#if defined(VINTR) && (VINTR < LEGALMAXCC) |
416
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[8])==0) /* INTERRUPT */ |
417
|
0
|
|
|
|
|
|
s.c_cc[VINTR] = value; |
418
|
|
|
|
|
|
|
#endif |
419
|
|
|
|
|
|
|
#if defined(VKILL) && (VKILL < LEGALMAXCC) |
420
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[9])==0) /* KILL */ |
421
|
0
|
|
|
|
|
|
s.c_cc[VKILL] = value; |
422
|
|
|
|
|
|
|
#endif |
423
|
|
|
|
|
|
|
#if defined(VMIN) && (VMIN < LEGALMAXCC) |
424
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[10])==0) /* MIN */ |
425
|
0
|
|
|
|
|
|
s.c_cc[VMIN] = value; |
426
|
|
|
|
|
|
|
#endif |
427
|
|
|
|
|
|
|
#if defined(VQUIT) && (VQUIT < LEGALMAXCC) |
428
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[11])==0) /* QUIT */ |
429
|
0
|
|
|
|
|
|
s.c_cc[VQUIT] = value; |
430
|
|
|
|
|
|
|
#endif |
431
|
|
|
|
|
|
|
#if defined(VLNEXT) && (VLNEXT < LEGALMAXCC) |
432
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[12])==0) /* QUOTENEXT */ |
433
|
0
|
|
|
|
|
|
s.c_cc[VLNEXT] = value; |
434
|
|
|
|
|
|
|
#endif |
435
|
|
|
|
|
|
|
#if defined(VQUOTE) && (VQUOTE < LEGALMAXCC) |
436
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[13])==0) /* QUOTENEXT */ |
437
|
|
|
|
|
|
|
s.c_cc[VQUOTE] = value; |
438
|
|
|
|
|
|
|
#endif |
439
|
|
|
|
|
|
|
#if defined(VREPRINT) && (VREPRINT < LEGALMAXCC) |
440
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[14])==0) /* REPRINT */ |
441
|
0
|
|
|
|
|
|
s.c_cc[VREPRINT] = value; |
442
|
|
|
|
|
|
|
#endif |
443
|
|
|
|
|
|
|
#if defined(VSTART) && (VSTART < LEGALMAXCC) |
444
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[15])==0) /* START */ |
445
|
0
|
|
|
|
|
|
s.c_cc[VSTART] = value; |
446
|
|
|
|
|
|
|
#endif |
447
|
|
|
|
|
|
|
#if defined(VSTATUS) && (VSTATUS < LEGALMAXCC) |
448
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[16])==0) /* STATUS */ |
449
|
|
|
|
|
|
|
s.c_cc[VSTATUS] = value; |
450
|
|
|
|
|
|
|
#endif |
451
|
|
|
|
|
|
|
#if defined(VSTOP) && (VSTOP < LEGALMAXCC) |
452
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[17])==0) /* STOP */ |
453
|
0
|
|
|
|
|
|
s.c_cc[VSTOP] = value; |
454
|
|
|
|
|
|
|
#endif |
455
|
|
|
|
|
|
|
#if defined(VSUSP) && (VSUSP < LEGALMAXCC) |
456
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[18])==0) /* SUSPEND */ |
457
|
0
|
|
|
|
|
|
s.c_cc[VSUSP] = value; |
458
|
|
|
|
|
|
|
#endif |
459
|
|
|
|
|
|
|
#if defined(VSWTC) && (VSWTC < LEGALMAXCC) |
460
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[19])==0) /* SWITCH */ |
461
|
0
|
|
|
|
|
|
s.c_cc[VSWTC] = value; |
462
|
|
|
|
|
|
|
#endif |
463
|
|
|
|
|
|
|
#if defined(VSWTCH) && (VSWTCH < LEGALMAXCC) |
464
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[20])==0) /* SWITCH */ |
465
|
|
|
|
|
|
|
s.c_cc[VSWTCH] = value; |
466
|
|
|
|
|
|
|
#endif |
467
|
|
|
|
|
|
|
#if defined(VTIME) && (VTIME < LEGALMAXCC) |
468
|
0
|
0
|
|
|
|
|
else if(strcmp(name,cc_names[21])==0) /* TIME */ |
469
|
0
|
|
|
|
|
|
s.c_cc[VTIME] = value; |
470
|
|
|
|
|
|
|
#endif |
471
|
|
|
|
|
|
|
else |
472
|
0
|
|
|
|
|
|
croak("Invalid control character passed to SetControlChars"); |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
#ifdef CC_TERMIOS |
476
|
0
|
0
|
|
|
|
|
if(tcsetattr(PerlIO_fileno(file),TCSANOW,&s)) |
477
|
|
|
|
|
|
|
#else |
478
|
|
|
|
|
|
|
# ifdef CC_TERMIO |
479
|
|
|
|
|
|
|
if(ioctl(PerlIO_fileno(file),TCSETA,&s)) |
480
|
|
|
|
|
|
|
# endif |
481
|
|
|
|
|
|
|
#endif |
482
|
0
|
|
|
|
|
|
croak("Unable to write terminal settings in SetControlChars"); |
483
|
|
|
|
|
|
|
} |
484
|
|
|
|
|
|
|
} |
485
|
0
|
|
|
|
|
|
XSRETURN(1); |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
#endif |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
#ifdef CC_SGTTY |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
struct termstruct { |
496
|
|
|
|
|
|
|
struct sgttyb s1; |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
}; |
499
|
|
|
|
|
|
|
#define TermStructure struct termstruct |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
STATIC const char * const cc_names[] = { |
502
|
|
|
|
|
|
|
"ERASE", |
503
|
|
|
|
|
|
|
"KILL", |
504
|
|
|
|
|
|
|
}; |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
#define MAXCC 2 |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
TRTXS(XS_Term__ReadKey_GetControlChars) |
509
|
|
|
|
|
|
|
{ |
510
|
|
|
|
|
|
|
dXSARGS; |
511
|
|
|
|
|
|
|
if (items < 0 || items > 1) { |
512
|
|
|
|
|
|
|
croak("Usage: Term::ReadKey::GetControlChars()"); |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
SP -= items; |
515
|
|
|
|
|
|
|
{ |
516
|
|
|
|
|
|
|
PerlIO * file; |
517
|
|
|
|
|
|
|
TermStructure s; |
518
|
|
|
|
|
|
|
if (items < 1) |
519
|
|
|
|
|
|
|
file = STDIN; |
520
|
|
|
|
|
|
|
else { |
521
|
|
|
|
|
|
|
file = IoIFP(sv_2io(ST(0))); |
522
|
|
|
|
|
|
|
} |
523
|
|
|
|
|
|
|
if(ioctl(fileno(PerlIO_file),TIOCGETP,&s.s1) |
524
|
|
|
|
|
|
|
) |
525
|
|
|
|
|
|
|
croak("Unable to read terminal settings in GetControlChars"); |
526
|
|
|
|
|
|
|
else { |
527
|
|
|
|
|
|
|
int i; |
528
|
|
|
|
|
|
|
EXTEND(sp,MAXCC*2); |
529
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[0],strlen(cc_names[0])))); /* ERASE */ |
530
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(&s.s1.sg_erase,1))); |
531
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(cc_names[1],strlen(cc_names[1])))); /* KILL */ |
532
|
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv(&s.s1.sg_kill,1))); |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
} |
535
|
|
|
|
|
|
|
PUTBACK; |
536
|
|
|
|
|
|
|
return; |
537
|
|
|
|
|
|
|
} |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
TRTXS(XS_Term__ReadKey_SetControlChars) |
541
|
|
|
|
|
|
|
{ |
542
|
|
|
|
|
|
|
dXSARGS; |
543
|
|
|
|
|
|
|
/*if ((items % 2) != 0) { |
544
|
|
|
|
|
|
|
croak("Usage: Term::ReadKey::SetControlChars(%charpairs,file=STDIN)"); |
545
|
|
|
|
|
|
|
}*/ |
546
|
|
|
|
|
|
|
SP -= items; |
547
|
|
|
|
|
|
|
{ |
548
|
|
|
|
|
|
|
PerlIO * file; |
549
|
|
|
|
|
|
|
TermStructure s; |
550
|
|
|
|
|
|
|
if ((items%2)==0) |
551
|
|
|
|
|
|
|
file = STDIN; |
552
|
|
|
|
|
|
|
else { |
553
|
|
|
|
|
|
|
file = IoIFP(sv_2io(ST(items-1))); |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
if(ioctl(PerlIO_fileno(file),TIOCGETP,&s.s1) |
557
|
|
|
|
|
|
|
) |
558
|
|
|
|
|
|
|
croak("Unable to read terminal settings in SetControlChars"); |
559
|
|
|
|
|
|
|
else { |
560
|
|
|
|
|
|
|
int i; |
561
|
|
|
|
|
|
|
char * name, value; |
562
|
|
|
|
|
|
|
for(i=0;i+1
|
563
|
|
|
|
|
|
|
name = SvPV(ST(i),PL_na); |
564
|
|
|
|
|
|
|
if( SvIOKp(ST(i+1)) || SvNOKp(ST(i+1)) )/* If Int or Float */ |
565
|
|
|
|
|
|
|
value = (char)SvIV(ST(i+1)); /* Store int value */ |
566
|
|
|
|
|
|
|
else /* Otherwise */ |
567
|
|
|
|
|
|
|
value = SvPV(ST(i+1),PL_na)[0]; /* Use first char of PV */ |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
if (0) ; |
570
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[0])==0) /* ERASE */ |
571
|
|
|
|
|
|
|
s.s1.sg_erase = value; |
572
|
|
|
|
|
|
|
else if(strcmp(name,cc_names[1])==0) /* KILL */ |
573
|
|
|
|
|
|
|
s.s1.sg_kill = value; |
574
|
|
|
|
|
|
|
else |
575
|
|
|
|
|
|
|
croak("Invalid control character passed to SetControlChars"); |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
} |
578
|
|
|
|
|
|
|
if(ioctl(fileno(PerlIO_file),TIOCSETN,&s.s1) |
579
|
|
|
|
|
|
|
) croak("Unable to write terminal settings in SetControlChars"); |
580
|
|
|
|
|
|
|
} |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
XSRETURN(1); |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
#endif |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
#if !defined(CC_TERMIO) && !defined(CC_TERMIOS) && !defined(CC_SGTTY) |
588
|
|
|
|
|
|
|
#define TermStructure int |
589
|
|
|
|
|
|
|
TRTXS(XS_Term__ReadKey_GetControlChars) |
590
|
|
|
|
|
|
|
{ |
591
|
|
|
|
|
|
|
dXSARGS; |
592
|
|
|
|
|
|
|
if (items <0 || items>1) { |
593
|
|
|
|
|
|
|
croak("Usage: Term::ReadKey::GetControlChars([FileHandle])"); |
594
|
|
|
|
|
|
|
} |
595
|
|
|
|
|
|
|
SP -= items; |
596
|
|
|
|
|
|
|
{ |
597
|
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
598
|
|
|
|
|
|
|
PUTBACK; |
599
|
|
|
|
|
|
|
return; |
600
|
|
|
|
|
|
|
} |
601
|
|
|
|
|
|
|
} |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
TRTXS(XS_Term__ReadKey_SetControlChars) |
604
|
|
|
|
|
|
|
{ |
605
|
|
|
|
|
|
|
dXSARGS; |
606
|
|
|
|
|
|
|
if (items < 0 || items > 1) { |
607
|
|
|
|
|
|
|
croak("Invalid control character passed to SetControlChars"); |
608
|
|
|
|
|
|
|
} |
609
|
|
|
|
|
|
|
SP -= items; |
610
|
|
|
|
|
|
|
XSRETURN(1); |
611
|
|
|
|
|
|
|
} |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
#endif |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
/* ex: set ro: */ |