Commit | Line | Data |
352d5a3a |
1 | /* $RCSfile: perl.h,v $$Revision: 4.0.1.2 $$Date: 91/06/07 11:28:33 $ |
a687059c |
2 | * |
352d5a3a |
3 | * Copyright (c) 1991, Larry Wall |
a687059c |
4 | * |
352d5a3a |
5 | * You may distribute under the terms of either the GNU General Public |
6 | * License or the Artistic License, as specified in the README file. |
8d063cd8 |
7 | * |
8 | * $Log: perl.h,v $ |
352d5a3a |
9 | * Revision 4.0.1.2 91/06/07 11:28:33 lwall |
10 | * patch4: new copyright notice |
11 | * patch4: made some allowances for "semi-standard" C |
12 | * patch4: many, many itty-bitty portability fixes |
13 | * |
35c8bce7 |
14 | * Revision 4.0.1.1 91/04/11 17:49:51 lwall |
15 | * patch1: hopefully straightened out some of the Xenix mess |
16 | * |
fe14fcc3 |
17 | * Revision 4.0 91/03/20 01:37:56 lwall |
18 | * 4.0 baseline. |
8d063cd8 |
19 | * |
20 | */ |
21 | |
35c8bce7 |
22 | #define VOIDWANT 1 |
ac58e20f |
23 | #include "config.h" |
24 | |
0f85fab0 |
25 | #ifdef MSDOS |
fe14fcc3 |
26 | /* This stuff now in the MS-DOS config.h file. */ |
0f85fab0 |
27 | #else /* !MSDOS */ |
28 | |
29 | /* |
30 | * The following symbols are defined if your operating system supports |
31 | * functions by that name. All Unixes I know of support them, thus they |
32 | * are not checked by the configuration script, but are directly defined |
33 | * here. |
34 | */ |
fe14fcc3 |
35 | #define HAS_ALARM |
36 | #define HAS_CHOWN |
37 | #define HAS_CHROOT |
38 | #define HAS_FORK |
39 | #define HAS_GETLOGIN |
40 | #define HAS_GETPPID |
41 | #define HAS_KILL |
42 | #define HAS_LINK |
43 | #define HAS_PIPE |
44 | #define HAS_WAIT |
45 | #define HAS_UMASK |
0f85fab0 |
46 | /* |
47 | * The following symbols are defined if your operating system supports |
48 | * password and group functions in general. All Unix systems do. |
49 | */ |
fe14fcc3 |
50 | #define HAS_GROUP |
51 | #define HAS_PASSWD |
0f85fab0 |
52 | |
53 | #endif /* !MSDOS */ |
54 | |
352d5a3a |
55 | #if defined(__STDC__) || defined(_AIX) || defined(__stdc__) |
56 | # define STANDARD_C 1 |
57 | #endif |
58 | |
59 | #if defined(HASVOLATILE) || defined(STANDARD_C) |
663a0e37 |
60 | #define VOLATILE volatile |
663a0e37 |
61 | #else |
62 | #define VOLATILE |
663a0e37 |
63 | #endif |
64 | |
a687059c |
65 | #ifdef IAMSUID |
66 | # ifndef TAINT |
67 | # define TAINT |
68 | # endif |
69 | #endif |
70 | |
fe14fcc3 |
71 | #ifndef HAS_VFORK |
03a14243 |
72 | # define vfork fork |
73 | #endif |
74 | |
fe14fcc3 |
75 | #ifdef HAS_GETPGRP2 |
76 | # ifndef HAS_GETPGRP |
77 | # define HAS_GETPGRP |
663a0e37 |
78 | # endif |
79 | # define getpgrp getpgrp2 |
80 | #endif |
81 | |
fe14fcc3 |
82 | #ifdef HAS_SETPGRP2 |
83 | # ifndef HAS_SETPGRP |
84 | # define HAS_SETPGRP |
663a0e37 |
85 | # endif |
86 | # define setpgrp setpgrp2 |
87 | #endif |
88 | |
fe14fcc3 |
89 | #include <stdio.h> |
90 | #include <ctype.h> |
91 | #include <setjmp.h> |
92 | #ifndef MSDOS |
352d5a3a |
93 | #ifdef PARAM_NEEDS_TYPES |
94 | #include <sys/types.h> |
03a14243 |
95 | #endif |
352d5a3a |
96 | #include <sys/param.h> |
97 | #endif |
98 | #ifdef STANDARD_C |
fe14fcc3 |
99 | /* Use all the "standard" definitions */ |
100 | #include <stdlib.h> |
101 | #include <string.h> |
352d5a3a |
102 | #endif /* STANDARD_C */ |
03a14243 |
103 | |
fe14fcc3 |
104 | #if defined(HAS_MEMCMP) && defined(mips) && BYTEORDER == 0x1234 |
105 | #undef HAS_MEMCMP |
663a0e37 |
106 | #endif |
fe14fcc3 |
107 | |
108 | #ifdef HAS_MEMCPY |
109 | |
352d5a3a |
110 | # ifndef STANDARD_C |
fe14fcc3 |
111 | # ifndef memcpy |
112 | extern char * memcpy(), *memset(); |
450a55e4 |
113 | extern int memcmp(); |
fe14fcc3 |
114 | # endif /* ndef memcpy */ |
352d5a3a |
115 | # endif /* ndef STANDARD_C */ |
fe14fcc3 |
116 | |
352d5a3a |
117 | # ifndef bcopy |
118 | # define bcopy(s1,s2,l) memcpy(s2,s1,l) |
119 | # endif |
120 | # ifndef bzero |
121 | # define bzero(s,l) memset(s,0,l) |
122 | # endif |
fe14fcc3 |
123 | #endif /* HAS_MEMCPY */ |
8d063cd8 |
124 | |
fe14fcc3 |
125 | #ifndef HAS_BCMP /* prefer bcmp slightly 'cuz it doesn't order */ |
352d5a3a |
126 | # ifndef bcmp |
127 | # define bcmp(s1,s2,l) memcmp(s1,s2,l) |
128 | # endif |
d9d8d8de |
129 | #endif |
378cc40b |
130 | |
131 | #ifndef _TYPES_ /* If types.h defines this it's easy. */ |
132 | #ifndef major /* Does everyone's types.h define this? */ |
8d063cd8 |
133 | #include <sys/types.h> |
378cc40b |
134 | #endif |
135 | #endif |
136 | |
ae986130 |
137 | #ifdef I_NETINET_IN |
138 | #include <netinet/in.h> |
139 | #endif |
140 | |
8d063cd8 |
141 | #include <sys/stat.h> |
135863df |
142 | |
663a0e37 |
143 | #ifdef I_TIME |
144 | # include <time.h> |
ffed7fef |
145 | #endif |
663a0e37 |
146 | |
fe14fcc3 |
147 | #ifdef I_SYS_TIME |
663a0e37 |
148 | # ifdef SYSTIMEKERNEL |
149 | # define KERNEL |
150 | # endif |
151 | # include <sys/time.h> |
152 | # ifdef SYSTIMEKERNEL |
153 | # undef KERNEL |
154 | # endif |
a687059c |
155 | #endif |
135863df |
156 | |
d9d8d8de |
157 | #ifndef MSDOS |
8d063cd8 |
158 | #include <sys/times.h> |
d9d8d8de |
159 | #endif |
8d063cd8 |
160 | |
fe14fcc3 |
161 | #if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR)) |
162 | #undef HAS_STRERROR |
663a0e37 |
163 | #endif |
164 | |
165 | #include <errno.h> |
d9d8d8de |
166 | #ifndef MSDOS |
663a0e37 |
167 | #ifndef errno |
168 | extern int errno; /* ANSI allows errno to be an lvalue expr */ |
169 | #endif |
d9d8d8de |
170 | #endif |
663a0e37 |
171 | |
35c8bce7 |
172 | #ifndef strerror |
fe14fcc3 |
173 | #ifdef HAS_STRERROR |
663a0e37 |
174 | char *strerror(); |
175 | #else |
176 | extern int sys_nerr; |
177 | extern char *sys_errlist[]; |
178 | #define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e]) |
179 | #endif |
35c8bce7 |
180 | #endif |
663a0e37 |
181 | |
a687059c |
182 | #ifdef I_SYSIOCTL |
183 | #ifndef _IOCTL_ |
184 | #include <sys/ioctl.h> |
185 | #endif |
186 | #endif |
187 | |
188 | #if defined(mc300) || defined(mc500) || defined(mc700) /* MASSCOMP */ |
fe14fcc3 |
189 | #ifdef HAS_SOCKETPAIR |
190 | #undef HAS_SOCKETPAIR |
a687059c |
191 | #endif |
fe14fcc3 |
192 | #ifdef HAS_NDBM |
193 | #undef HAS_NDBM |
a687059c |
194 | #endif |
195 | #endif |
196 | |
fe14fcc3 |
197 | #ifdef HAS_GDBM |
198 | #ifdef I_GDBM |
199 | #include <gdbm.h> |
200 | #endif |
201 | #define SOME_DBM |
202 | #ifdef HAS_NDBM |
203 | #undef HAS_NDBM |
204 | #endif |
205 | #ifdef HAS_ODBM |
206 | #undef HAS_ODBM |
207 | #endif |
208 | #else |
209 | #ifdef HAS_NDBM |
a687059c |
210 | #include <ndbm.h> |
211 | #define SOME_DBM |
fe14fcc3 |
212 | #ifdef HAS_ODBM |
213 | #undef HAS_ODBM |
ae986130 |
214 | #endif |
a687059c |
215 | #else |
fe14fcc3 |
216 | #ifdef HAS_ODBM |
a687059c |
217 | #ifdef NULL |
218 | #undef NULL /* suppress redefinition message */ |
219 | #endif |
220 | #include <dbm.h> |
221 | #ifdef NULL |
222 | #undef NULL |
223 | #endif |
224 | #define NULL 0 /* silly thing is, we don't even use this */ |
225 | #define SOME_DBM |
226 | #define dbm_fetch(db,dkey) fetch(dkey) |
227 | #define dbm_delete(db,dkey) delete(dkey) |
228 | #define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent) |
229 | #define dbm_close(db) dbmclose() |
230 | #define dbm_firstkey(db) firstkey() |
fe14fcc3 |
231 | #endif /* HAS_ODBM */ |
232 | #endif /* HAS_NDBM */ |
233 | #endif /* HAS_GDBM */ |
a687059c |
234 | #ifdef SOME_DBM |
235 | EXT char *dbmkey; |
236 | EXT int dbmlen; |
237 | #endif |
238 | |
239 | #if INTSIZE == 2 |
240 | #define htoni htons |
241 | #define ntohi ntohs |
242 | #else |
243 | #define htoni htonl |
244 | #define ntohi ntohl |
245 | #endif |
246 | |
35c8bce7 |
247 | #if defined(I_DIRENT) |
663a0e37 |
248 | # include <dirent.h> |
249 | # define DIRENT dirent |
ae986130 |
250 | #else |
fe14fcc3 |
251 | # ifdef I_SYS_NDIR |
79a0689e |
252 | # include <sys/ndir.h> |
663a0e37 |
253 | # define DIRENT direct |
254 | # else |
fe14fcc3 |
255 | # ifdef I_SYS_DIR |
79a0689e |
256 | # ifdef hp9000s500 |
257 | # include <ndir.h> /* may be wrong in the future */ |
258 | # else |
259 | # include <sys/dir.h> |
260 | # endif |
663a0e37 |
261 | # define DIRENT direct |
262 | # endif |
263 | # endif |
a687059c |
264 | #endif |
265 | |
352d5a3a |
266 | #ifdef FPUTS_BOTCH |
267 | /* work around botch in SunOS 4.0.1 and 4.0.2 */ |
268 | # ifndef fputs |
269 | # define fputs(str,fp) fprintf(fp,"%s",str) |
270 | # endif |
271 | #endif |
272 | |
c623bd54 |
273 | /* |
274 | * The following gobbledygook brought to you on behalf of __STDC__. |
275 | * (I could just use #ifndef __STDC__, but this is more bulletproof |
276 | * in the face of half-implementations.) |
277 | */ |
278 | |
279 | #ifndef S_IFMT |
280 | # ifdef _S_IFMT |
281 | # define S_IFMT _S_IFMT |
282 | # else |
283 | # define S_IFMT 0170000 |
284 | # endif |
285 | #endif |
286 | |
287 | #ifndef S_ISDIR |
288 | # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) |
289 | #endif |
290 | |
291 | #ifndef S_ISCHR |
292 | # define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR) |
293 | #endif |
294 | |
295 | #ifndef S_ISBLK |
fe14fcc3 |
296 | # ifdef S_IFBLK |
297 | # define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK) |
298 | # else |
299 | # define S_ISBLK(m) (0) |
300 | # endif |
c623bd54 |
301 | #endif |
302 | |
303 | #ifndef S_ISREG |
304 | # define S_ISREG(m) ((m & S_IFMT) == S_IFREG) |
305 | #endif |
306 | |
307 | #ifndef S_ISFIFO |
fe14fcc3 |
308 | # ifdef S_IFIFO |
309 | # define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO) |
310 | # else |
311 | # define S_ISFIFO(m) (0) |
312 | # endif |
c623bd54 |
313 | #endif |
314 | |
315 | #ifndef S_ISLNK |
316 | # ifdef _S_ISLNK |
317 | # define S_ISLNK(m) _S_ISLNK(m) |
318 | # else |
319 | # ifdef _S_IFLNK |
320 | # define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK) |
321 | # else |
322 | # ifdef S_IFLNK |
323 | # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK) |
324 | # else |
325 | # define S_ISLNK(m) (0) |
326 | # endif |
327 | # endif |
328 | # endif |
329 | #endif |
330 | |
331 | #ifndef S_ISSOCK |
332 | # ifdef _S_ISSOCK |
333 | # define S_ISSOCK(m) _S_ISSOCK(m) |
334 | # else |
335 | # ifdef _S_IFSOCK |
336 | # define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK) |
337 | # else |
338 | # ifdef S_IFSOCK |
339 | # define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK) |
340 | # else |
341 | # define S_ISSOCK(m) (0) |
342 | # endif |
343 | # endif |
344 | # endif |
345 | #endif |
346 | |
347 | #ifndef S_IRUSR |
348 | # ifdef S_IREAD |
349 | # define S_IRUSR S_IREAD |
350 | # define S_IWUSR S_IWRITE |
351 | # define S_IXUSR S_IEXEC |
352 | # else |
353 | # define S_IRUSR 0400 |
354 | # define S_IWUSR 0200 |
355 | # define S_IXUSR 0100 |
356 | # endif |
357 | # define S_IRGRP (S_IRUSR>>3) |
358 | # define S_IWGRP (S_IWUSR>>3) |
359 | # define S_IXGRP (S_IXUSR>>3) |
360 | # define S_IROTH (S_IRUSR>>6) |
361 | # define S_IWOTH (S_IWUSR>>6) |
362 | # define S_IXOTH (S_IXUSR>>6) |
363 | #endif |
364 | |
365 | #ifndef S_ISUID |
366 | # define S_ISUID 04000 |
367 | #endif |
368 | |
369 | #ifndef S_ISGID |
370 | # define S_ISGID 02000 |
371 | #endif |
372 | |
352d5a3a |
373 | #ifdef f_next |
374 | #undef f_next |
375 | #endif |
376 | |
450a55e4 |
377 | typedef unsigned int STRLEN; |
378 | |
8d063cd8 |
379 | typedef struct arg ARG; |
380 | typedef struct cmd CMD; |
381 | typedef struct formcmd FCMD; |
382 | typedef struct scanpat SPAT; |
8d063cd8 |
383 | typedef struct stio STIO; |
378cc40b |
384 | typedef struct sub SUBR; |
8d063cd8 |
385 | typedef struct string STR; |
386 | typedef struct atbl ARRAY; |
387 | typedef struct htbl HASH; |
378cc40b |
388 | typedef struct regexp REGEXP; |
a687059c |
389 | typedef struct stabptrs STBP; |
390 | typedef struct stab STAB; |
d9d8d8de |
391 | typedef struct callsave CSV; |
8d063cd8 |
392 | |
378cc40b |
393 | #include "handy.h" |
394 | #include "regexp.h" |
8d063cd8 |
395 | #include "str.h" |
378cc40b |
396 | #include "util.h" |
8d063cd8 |
397 | #include "form.h" |
398 | #include "stab.h" |
399 | #include "spat.h" |
400 | #include "arg.h" |
401 | #include "cmd.h" |
402 | #include "array.h" |
403 | #include "hash.h" |
404 | |
450a55e4 |
405 | #if defined(iAPX286) || defined(M_I286) || defined(I80286) |
a687059c |
406 | # define I286 |
407 | #endif |
408 | |
352d5a3a |
409 | #ifndef STANDARD_C |
135863df |
410 | #ifdef CHARSPRINTF |
411 | char *sprintf(); |
412 | #else |
413 | int sprintf(); |
414 | #endif |
a687059c |
415 | #endif |
135863df |
416 | |
8d063cd8 |
417 | EXT char *Yes INIT("1"); |
418 | EXT char *No INIT(""); |
419 | |
a687059c |
420 | /* "gimme" values */ |
421 | |
422 | /* Note: cmd.c assumes that it can use && to produce one of these values! */ |
423 | #define G_SCALAR 0 |
424 | #define G_ARRAY 1 |
425 | |
426 | #ifdef CRIPPLED_CC |
427 | int str_true(); |
428 | #else /* !CRIPPLED_CC */ |
429 | #define str_true(str) (Str = (str), \ |
430 | (Str->str_pok ? \ |
431 | ((*Str->str_ptr > '0' || \ |
432 | Str->str_cur > 1 || \ |
433 | (Str->str_cur && *Str->str_ptr != '0')) ? 1 : 0) \ |
434 | : \ |
435 | (Str->str_nok ? (Str->str_u.str_nval != 0.0) : 0 ) )) |
436 | #endif /* CRIPPLED_CC */ |
8d063cd8 |
437 | |
135863df |
438 | #ifdef DEBUGGING |
a687059c |
439 | #define str_peek(str) (Str = (str), \ |
440 | (Str->str_pok ? \ |
441 | Str->str_ptr : \ |
442 | (Str->str_nok ? \ |
443 | (sprintf(tokenbuf,"num(%g)",Str->str_u.str_nval), \ |
444 | (char*)tokenbuf) : \ |
445 | "" ))) |
135863df |
446 | #endif |
447 | |
a687059c |
448 | #ifdef CRIPPLED_CC |
449 | char *str_get(); |
450 | #else |
451 | #ifdef TAINT |
452 | #define str_get(str) (Str = (str), tainted |= Str->str_tainted, \ |
453 | (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) |
454 | #else |
8d063cd8 |
455 | #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) |
a687059c |
456 | #endif /* TAINT */ |
457 | #endif /* CRIPPLED_CC */ |
458 | |
459 | #ifdef CRIPPLED_CC |
460 | double str_gnum(); |
461 | #else /* !CRIPPLED_CC */ |
462 | #ifdef TAINT |
463 | #define str_gnum(str) (Str = (str), tainted |= Str->str_tainted, \ |
464 | (Str->str_nok ? Str->str_u.str_nval : str_2num(Str))) |
465 | #else /* !TAINT */ |
466 | #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_u.str_nval : str_2num(Str))) |
467 | #endif /* TAINT*/ |
468 | #endif /* CRIPPLED_CC */ |
8d063cd8 |
469 | EXT STR *Str; |
470 | |
471 | #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len) |
472 | |
450a55e4 |
473 | #ifndef MSDOS |
a687059c |
474 | #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len) |
450a55e4 |
475 | #define Str_Grow str_grow |
476 | #else |
477 | /* extra parentheses intentionally NOT placed around "len"! */ |
478 | #define STR_GROW(str,len) if ((str)->str_len < (unsigned long)len) \ |
479 | str_grow(str,(unsigned long)len) |
480 | #define Str_Grow(str,len) str_grow(str,(unsigned long)(len)) |
481 | #endif /* MSDOS */ |
a687059c |
482 | |
483 | #ifndef BYTEORDER |
ffed7fef |
484 | #define BYTEORDER 0x1234 |
a687059c |
485 | #endif |
486 | |
fe14fcc3 |
487 | #if defined(htonl) && !defined(HAS_HTONL) |
488 | #define HAS_HTONL |
ae986130 |
489 | #endif |
fe14fcc3 |
490 | #if defined(htons) && !defined(HAS_HTONS) |
491 | #define HAS_HTONS |
ae986130 |
492 | #endif |
fe14fcc3 |
493 | #if defined(ntohl) && !defined(HAS_NTOHL) |
494 | #define HAS_NTOHL |
ae986130 |
495 | #endif |
fe14fcc3 |
496 | #if defined(ntohs) && !defined(HAS_NTOHS) |
497 | #define HAS_NTOHS |
ae986130 |
498 | #endif |
fe14fcc3 |
499 | #ifndef HAS_HTONL |
d9d8d8de |
500 | #if (BYTEORDER & 0xffff) != 0x4321 |
fe14fcc3 |
501 | #define HAS_HTONS |
502 | #define HAS_HTONL |
503 | #define HAS_NTOHS |
504 | #define HAS_NTOHL |
a687059c |
505 | #define MYSWAP |
506 | #define htons my_swap |
507 | #define htonl my_htonl |
508 | #define ntohs my_swap |
509 | #define ntohl my_ntohl |
510 | #endif |
511 | #else |
d9d8d8de |
512 | #if (BYTEORDER & 0xffff) == 0x4321 |
fe14fcc3 |
513 | #undef HAS_HTONS |
514 | #undef HAS_HTONL |
515 | #undef HAS_NTOHS |
516 | #undef HAS_NTOHL |
a687059c |
517 | #endif |
518 | #endif |
519 | |
0f85fab0 |
520 | #ifdef CASTNEGFLOAT |
521 | #define U_S(what) ((unsigned short)(what)) |
522 | #define U_I(what) ((unsigned int)(what)) |
523 | #define U_L(what) ((unsigned long)(what)) |
524 | #else |
525 | unsigned long castulong(); |
526 | #define U_S(what) ((unsigned int)castulong(what)) |
527 | #define U_I(what) ((unsigned int)castulong(what)) |
528 | #define U_L(what) (castulong(what)) |
529 | #endif |
530 | |
8d063cd8 |
531 | CMD *add_label(); |
532 | CMD *block_head(); |
533 | CMD *append_line(); |
534 | CMD *make_acmd(); |
535 | CMD *make_ccmd(); |
a687059c |
536 | CMD *make_icmd(); |
8d063cd8 |
537 | CMD *invert(); |
538 | CMD *addcond(); |
539 | CMD *addloop(); |
540 | CMD *wopt(); |
378cc40b |
541 | CMD *over(); |
8d063cd8 |
542 | |
8d063cd8 |
543 | STAB *stabent(); |
378cc40b |
544 | STAB *genstab(); |
8d063cd8 |
545 | |
378cc40b |
546 | ARG *stab2arg(); |
8d063cd8 |
547 | ARG *op_new(); |
548 | ARG *make_op(); |
8d063cd8 |
549 | ARG *make_match(); |
550 | ARG *make_split(); |
a687059c |
551 | ARG *rcatmaybe(); |
378cc40b |
552 | ARG *listish(); |
a687059c |
553 | ARG *maybelistish(); |
378cc40b |
554 | ARG *localize(); |
a687059c |
555 | ARG *fixeval(); |
556 | ARG *jmaybe(); |
378cc40b |
557 | ARG *l(); |
a687059c |
558 | ARG *fixl(); |
378cc40b |
559 | ARG *mod_match(); |
560 | ARG *make_list(); |
561 | ARG *cmd_to_arg(); |
562 | ARG *addflags(); |
563 | ARG *hide_ary(); |
564 | ARG *cval_to_arg(); |
8d063cd8 |
565 | |
8d063cd8 |
566 | STR *str_new(); |
567 | STR *stab_str(); |
a687059c |
568 | |
569 | int do_each(); |
570 | int do_subr(); |
571 | int do_match(); |
572 | int do_unpack(); |
573 | int eval(); /* this evaluates expressions */ |
574 | int do_eval(); /* this evaluates eval operator */ |
575 | int do_assign(); |
378cc40b |
576 | |
577 | SUBR *make_sub(); |
8d063cd8 |
578 | |
579 | FCMD *load_format(); |
580 | |
581 | char *scanpat(); |
582 | char *scansubst(); |
583 | char *scantrans(); |
584 | char *scanstr(); |
fe14fcc3 |
585 | char *scanident(); |
8d063cd8 |
586 | char *str_append_till(); |
587 | char *str_gets(); |
a687059c |
588 | char *str_grow(); |
8d063cd8 |
589 | |
8d063cd8 |
590 | bool do_open(); |
591 | bool do_close(); |
592 | bool do_print(); |
378cc40b |
593 | bool do_aprint(); |
594 | bool do_exec(); |
595 | bool do_aexec(); |
8d063cd8 |
596 | |
597 | int do_subst(); |
378cc40b |
598 | int cando(); |
599 | int ingroup(); |
8d063cd8 |
600 | |
378cc40b |
601 | void str_replace(); |
602 | void str_inc(); |
603 | void str_dec(); |
8d063cd8 |
604 | void str_free(); |
a687059c |
605 | void stab_clear(); |
378cc40b |
606 | void do_join(); |
378cc40b |
607 | void do_sprintf(); |
a687059c |
608 | void do_accept(); |
ac58e20f |
609 | void do_pipe(); |
a687059c |
610 | void do_vecset(); |
fe14fcc3 |
611 | void do_unshift(); |
612 | void do_execfree(); |
613 | void magicalize(); |
614 | void magicname(); |
a687059c |
615 | void savelist(); |
616 | void saveitem(); |
617 | void saveint(); |
618 | void savelong(); |
619 | void savesptr(); |
620 | void savehptr(); |
621 | void restorelist(); |
ac58e20f |
622 | void repeatcpy(); |
a687059c |
623 | HASH *savehash(); |
624 | ARRAY *saveary(); |
378cc40b |
625 | |
ac58e20f |
626 | EXT char **origargv; |
627 | EXT int origargc; |
fe14fcc3 |
628 | EXT char **origenviron; |
35c8bce7 |
629 | extern char **environ; |
630 | |
a687059c |
631 | EXT line_t subline INIT(0); |
632 | EXT STR *subname INIT(Nullstr); |
8d063cd8 |
633 | EXT int arybase INIT(0); |
634 | |
635 | struct outrec { |
d9d8d8de |
636 | long o_lines; |
637 | char *o_str; |
638 | int o_len; |
8d063cd8 |
639 | }; |
640 | |
641 | EXT struct outrec outrec; |
642 | EXT struct outrec toprec; |
643 | |
a687059c |
644 | EXT STAB *stdinstab INIT(Nullstab); |
8d063cd8 |
645 | EXT STAB *last_in_stab INIT(Nullstab); |
646 | EXT STAB *defstab INIT(Nullstab); |
647 | EXT STAB *argvstab INIT(Nullstab); |
648 | EXT STAB *envstab INIT(Nullstab); |
649 | EXT STAB *sigstab INIT(Nullstab); |
650 | EXT STAB *defoutstab INIT(Nullstab); |
651 | EXT STAB *curoutstab INIT(Nullstab); |
652 | EXT STAB *argvoutstab INIT(Nullstab); |
378cc40b |
653 | EXT STAB *incstab INIT(Nullstab); |
a687059c |
654 | EXT STAB *leftstab INIT(Nullstab); |
655 | EXT STAB *amperstab INIT(Nullstab); |
656 | EXT STAB *rightstab INIT(Nullstab); |
657 | EXT STAB *DBstab INIT(Nullstab); |
d9d8d8de |
658 | EXT STAB *DBline INIT(Nullstab); |
a687059c |
659 | EXT STAB *DBsub INIT(Nullstab); |
660 | |
661 | EXT HASH *defstash; /* main symbol table */ |
662 | EXT HASH *curstash; /* symbol table for current package */ |
663 | EXT HASH *debstash; /* symbol table for perldb package */ |
664 | |
665 | EXT STR *curstname; /* name of current package */ |
8d063cd8 |
666 | |
667 | EXT STR *freestrroot INIT(Nullstr); |
378cc40b |
668 | EXT STR *lastretstr INIT(Nullstr); |
a687059c |
669 | EXT STR *DBsingle INIT(Nullstr); |
d9d8d8de |
670 | EXT STR *DBtrace INIT(Nullstr); |
671 | EXT STR *DBsignal INIT(Nullstr); |
a687059c |
672 | |
673 | EXT int lastspbase; |
674 | EXT int lastsize; |
8d063cd8 |
675 | |
fe14fcc3 |
676 | EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEF"); |
378cc40b |
677 | EXT char *origfilename; |
ac58e20f |
678 | EXT FILE * VOLATILE rsfp; |
8d063cd8 |
679 | EXT char buf[1024]; |
a687059c |
680 | EXT char *bufptr; |
681 | EXT char *oldbufptr; |
682 | EXT char *oldoldbufptr; |
683 | EXT char *bufend; |
8d063cd8 |
684 | |
685 | EXT STR *linestr INIT(Nullstr); |
686 | |
fe14fcc3 |
687 | EXT char *rs INIT("\n"); |
688 | EXT int rschar INIT('\n'); /* final char of rs, or 0777 if none */ |
a687059c |
689 | EXT int rslen INIT(1); |
8d063cd8 |
690 | EXT char *ofs INIT(Nullch); |
a687059c |
691 | EXT int ofslen INIT(0); |
8d063cd8 |
692 | EXT char *ors INIT(Nullch); |
a687059c |
693 | EXT int orslen INIT(0); |
8d063cd8 |
694 | EXT char *ofmt INIT(Nullch); |
695 | EXT char *inplace INIT(Nullch); |
a687059c |
696 | EXT char *nointrp INIT(""); |
8d063cd8 |
697 | |
378cc40b |
698 | EXT bool preprocess INIT(FALSE); |
699 | EXT bool minus_n INIT(FALSE); |
700 | EXT bool minus_p INIT(FALSE); |
fe14fcc3 |
701 | EXT bool minus_l INIT(FALSE); |
378cc40b |
702 | EXT bool minus_a INIT(FALSE); |
703 | EXT bool doswitches INIT(FALSE); |
704 | EXT bool dowarn INIT(FALSE); |
450a55e4 |
705 | EXT bool doextract INIT(FALSE); |
378cc40b |
706 | EXT bool allstabs INIT(FALSE); /* init all customary symbols in symbol table?*/ |
707 | EXT bool sawampersand INIT(FALSE); /* must save all match strings */ |
708 | EXT bool sawstudy INIT(FALSE); /* do fbminstr on all strings */ |
a687059c |
709 | EXT bool sawi INIT(FALSE); /* study must assume case insensitive */ |
710 | EXT bool sawvec INIT(FALSE); |
ac58e20f |
711 | EXT bool localizing INIT(FALSE); /* are we processing a local() list? */ |
a687059c |
712 | |
352d5a3a |
713 | #ifndef MAXSYSFD |
714 | # define MAXSYSFD 2 |
715 | #endif |
716 | EXT int maxsysfd INIT(MAXSYSFD); /* top fd to pass to subprocesses */ |
717 | |
ae986130 |
718 | #ifdef CSH |
719 | char *cshname INIT(CSH); |
720 | int cshlen INIT(0); |
721 | #endif /* CSH */ |
a687059c |
722 | |
723 | #ifdef TAINT |
724 | EXT bool tainted INIT(FALSE); /* using variables controlled by $< */ |
725 | #endif |
378cc40b |
726 | |
450a55e4 |
727 | #ifndef MSDOS |
378cc40b |
728 | #define TMPPATH "/tmp/perl-eXXXXXX" |
450a55e4 |
729 | #else |
57ebbfd0 |
730 | #define TMPPATH "plXXXXXX" |
450a55e4 |
731 | #endif /* MSDOS */ |
378cc40b |
732 | EXT char *e_tmpname; |
733 | EXT FILE *e_fp INIT(Nullfp); |
734 | |
8d063cd8 |
735 | EXT char tokenbuf[256]; |
a687059c |
736 | EXT int expectterm INIT(TRUE); /* how to interpret ambiguous tokens */ |
ac58e20f |
737 | EXT VOLATILE int in_eval INIT(FALSE); /* trap fatal errors? */ |
a687059c |
738 | EXT int multiline INIT(0); /* $*--do strings hold >1 line? */ |
739 | EXT int forkprocess; /* so do_open |- can return proc# */ |
740 | EXT int do_undump INIT(0); /* -u or dump seen? */ |
741 | EXT int error_count INIT(0); /* how many errors so far, max 10 */ |
742 | EXT int multi_start INIT(0); /* 1st line of multi-line string */ |
743 | EXT int multi_end INIT(0); /* last line of multi-line string */ |
744 | EXT int multi_open INIT(0); /* delimiter of said string */ |
745 | EXT int multi_close INIT(0); /* delimiter of said string */ |
8d063cd8 |
746 | |
747 | FILE *popen(); |
748 | /* char *str_get(); */ |
749 | STR *interp(); |
750 | void free_arg(); |
751 | STIO *stio_new(); |
752 | |
753 | EXT struct stat statbuf; |
a687059c |
754 | EXT struct stat statcache; |
755 | STAB *statstab INIT(Nullstab); |
756 | STR *statname; |
d9d8d8de |
757 | #ifndef MSDOS |
8d063cd8 |
758 | EXT struct tms timesbuf; |
d9d8d8de |
759 | #endif |
378cc40b |
760 | EXT int uid; |
761 | EXT int euid; |
a687059c |
762 | EXT int gid; |
763 | EXT int egid; |
378cc40b |
764 | UIDTYPE getuid(); |
765 | UIDTYPE geteuid(); |
766 | GIDTYPE getgid(); |
767 | GIDTYPE getegid(); |
768 | EXT int unsafe; |
8d063cd8 |
769 | |
770 | #ifdef DEBUGGING |
ac58e20f |
771 | EXT VOLATILE int debug INIT(0); |
8d063cd8 |
772 | EXT int dlevel INIT(0); |
a687059c |
773 | EXT int dlmax INIT(128); |
774 | EXT char *debname; |
775 | EXT char *debdelim; |
d96024cf |
776 | #define YYDEBUG 1 |
8d063cd8 |
777 | #endif |
a687059c |
778 | EXT int perldb INIT(0); |
fe14fcc3 |
779 | #define YYMAXDEPTH 300 |
8d063cd8 |
780 | |
378cc40b |
781 | EXT line_t cmdline INIT(NOLINE); |
782 | |
a687059c |
783 | EXT STR str_undef; |
8d063cd8 |
784 | EXT STR str_no; |
785 | EXT STR str_yes; |
786 | |
787 | /* runtime control stuff */ |
788 | |
789 | EXT struct loop { |
a687059c |
790 | char *loop_label; /* what the loop was called, if anything */ |
791 | int loop_sp; /* stack pointer to copy stuff down to */ |
8d063cd8 |
792 | jmp_buf loop_env; |
a687059c |
793 | } *loop_stack; |
8d063cd8 |
794 | |
795 | EXT int loop_ptr INIT(-1); |
a687059c |
796 | EXT int loop_max INIT(128); |
8d063cd8 |
797 | |
798 | EXT jmp_buf top_env; |
799 | |
ac58e20f |
800 | EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */ |
8d063cd8 |
801 | |
450a55e4 |
802 | struct ufuncs { |
803 | int (*uf_val)(); |
804 | int (*uf_set)(); |
805 | int uf_index; |
806 | }; |
807 | |
a687059c |
808 | EXT ARRAY *stack; /* THE STACK */ |
809 | |
ac58e20f |
810 | EXT ARRAY * VOLATILE savestack; /* to save non-local values on */ |
378cc40b |
811 | |
812 | EXT ARRAY *tosave; /* strings to save on recursive subroutine */ |
813 | |
a687059c |
814 | EXT ARRAY *lineary; /* lines of script for debugger */ |
d9d8d8de |
815 | EXT ARRAY *dbargs; /* args to call listed by caller function */ |
a687059c |
816 | |
d9d8d8de |
817 | EXT ARRAY *fdpid; /* keep fd-to-pid mappings for mypopen */ |
818 | EXT HASH *pidstatus; /* keep pid-to-status mappings for waitpid */ |
a687059c |
819 | |
ac58e20f |
820 | EXT int *di; /* for tmp use in debuggers */ |
821 | EXT char *dc; |
822 | EXT short *ds; |
823 | |
fe14fcc3 |
824 | /* Fix these up for __STDC__ */ |
825 | EXT long basetime INIT(0); |
826 | char *mktemp(); |
352d5a3a |
827 | #ifndef STANDARD_C |
fe14fcc3 |
828 | /* All of these are in stdlib.h or time.h for ANSI C */ |
8d063cd8 |
829 | double atof(); |
a687059c |
830 | long time(); |
8d063cd8 |
831 | struct tm *gmtime(), *localtime(); |
378cc40b |
832 | char *index(), *rindex(); |
833 | char *strcpy(), *strcat(); |
352d5a3a |
834 | #endif /* ! STANDARD_C */ |
8d063cd8 |
835 | |
8d063cd8 |
836 | #ifdef EUNICE |
378cc40b |
837 | #define UNLINK unlnk |
838 | int unlnk(); |
8d063cd8 |
839 | #else |
840 | #define UNLINK unlink |
841 | #endif |
a687059c |
842 | |
fe14fcc3 |
843 | #ifndef HAS_SETREUID |
844 | #ifdef HAS_SETRESUID |
a687059c |
845 | #define setreuid(r,e) setresuid(r,e,-1) |
fe14fcc3 |
846 | #define HAS_SETREUID |
a687059c |
847 | #endif |
848 | #endif |
fe14fcc3 |
849 | #ifndef HAS_SETREGID |
850 | #ifdef HAS_SETRESGID |
a687059c |
851 | #define setregid(r,e) setresgid(r,e,-1) |
fe14fcc3 |
852 | #define HAS_SETREGID |
a687059c |
853 | #endif |
854 | #endif |