home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / language / perl / Source / H / Perl < prev    next >
Encoding:
Text File  |  1991-02-09  |  19.1 KB  |  677 lines

  1. /* $Header: perl.h,v 3.0.1.11 91/01/11 18:10:57 lwall Locked $
  2.  *
  3.  *    Copyright (c) 1989, Larry Wall
  4.  *
  5.  *    You may distribute under the terms of the GNU General Public License
  6.  *    as specified in the README file that comes with the perl 3.0 kit.
  7.  *
  8.  * $Log:    perl.h,v $
  9.  * Revision 3.0.1.11  91/01/11  18:10:57  lwall
  10.  * patch42: ANSIfied the stat mode checking
  11.  * 
  12.  * Revision 3.0.1.10  90/11/10  01:44:13  lwall
  13.  * patch38: more msdos/os2 upgrades
  14.  * 
  15.  * Revision 3.0.1.9  90/10/15  17:59:41  lwall
  16.  * patch29: some machines didn't like unsigned C preprocessor values
  17.  * 
  18.  * Revision 3.0.1.8  90/08/09  04:10:53  lwall
  19.  * patch19: various MSDOS and OS/2 patches folded in
  20.  * patch19: did preliminary work toward debugging packages and evals
  21.  * patch19: added -x switch to extract script from input trash
  22.  * 
  23.  * Revision 3.0.1.7  90/03/27  16:12:52  lwall
  24.  * patch16: MSDOS support
  25.  * patch16: support for machines that can't cast negative floats to unsigned ints
  26.  * 
  27.  * Revision 3.0.1.6  90/03/12  16:40:43  lwall
  28.  * patch13: did some ndir straightening up for Xenix
  29.  * 
  30.  * Revision 3.0.1.5  90/02/28  17:52:28  lwall
  31.  * patch9: Configure now determines whether volatile is supported
  32.  * patch9: volatilized some more variables for super-optimizing compilers
  33.  * patch9: unused VREG symbol deleted
  34.  * patch9: perl can now start up other interpreters scripts  
  35.  * patch9: you may now undef $/ to have no input record separator
  36.  * patch9: nested evals clobbered their longjmp environment
  37.  * 
  38.  * Revision 3.0.1.4  89/12/21  20:07:35  lwall
  39.  * patch7: arranged for certain registers to be restored after longjmp()
  40.  * patch7: Configure now compiles a test program to figure out time.h fiasco
  41.  * patch7: Configure now detects DG/UX thingies like [sg]etpgrp2 and utime.h
  42.  * patch7: memcpy() and memset() return void in __STDC__
  43.  * patch7: errno may now be a macro with an lvalue
  44.  * patch7: ANSI strerror() is now supported
  45.  * patch7: Xenix support for sys/ndir.h, cross compilation
  46.  * 
  47.  * Revision 3.0.1.3  89/11/17  15:28:57  lwall
  48.  * patch5: byteorder now is a hex value
  49.  * patch5: Configure now looks for <time.h> including <sys/time.h>
  50.  * 
  51.  * Revision 3.0.1.2  89/11/11  04:39:38  lwall
  52.  * patch2: Configure may now set -DDEBUGGING
  53.  * patch2: netinet/in.h needed sys/types.h some places
  54.  * patch2: more <sys/time.h> and <time.h> wrangling
  55.  * patch2: yydebug moved to where type doesn't matter  
  56.  * 
  57.  * Revision 3.0.1.1  89/10/26  23:17:08  lwall
  58.  * patch1: vfork now conditionally defined based on VFORK
  59.  * patch1: DEC risc machines have a buggy memcmp
  60.  * patch1: perl.h now includes <netinet/in.h> if it exists
  61.  * 
  62.  * Revision 3.0  89/10/18  15:21:21  lwall
  63.  * 3.0 baseline
  64.  * 
  65.  */
  66.  
  67. #define VOIDUSED 1
  68. #include "config.h"
  69.  
  70. #define PROTOTYPES
  71. #define PROTO(x) x
  72.  
  73. #undef I_PARAM
  74. #undef I_TYPES
  75. #undef I_TIMES
  76. #undef TIMES
  77.  
  78. #define TIME_T    time_t
  79.  
  80. #define ANSI_INCLUDES
  81.  
  82. #define mypopen  popen
  83. #define mypclose pclose
  84.  
  85. #define VOLATILE
  86.  
  87. #ifdef MEMCPY
  88. #define bcopy(s1,s2,l) memcpy(s2,s1,l)
  89. #define bzero(s,l) memset(s,0,l)
  90. #endif /* MEMCPY */
  91.  
  92. #ifndef BCMP        /* prefer bcmp slightly 'cuz it doesn't order */
  93. #define bcmp(s1,s2,l) memcmp(s1,s2,l)
  94. #endif
  95.  
  96. #include <stdlib.h>
  97. #include <string.h>
  98. #include <stdio.h>
  99. #include <ctype.h>
  100. #include <setjmp.h>
  101. #include <time.h>
  102. #include <errno.h>
  103. #include "kernel.h"
  104. #include "swis.h"
  105.  
  106. #include "stat.h"
  107.  
  108. #ifdef GDBM
  109.  
  110. #include "gdbm.h"
  111. #define SOME_DBM
  112. #ifdef NDBM
  113. #undef NDBM
  114. #endif
  115. #ifdef ODBM
  116. #undef ODBM
  117. #endif
  118.  
  119. #define DBM dbm_file_info
  120. #define dbm_fetch(db,key)        gdbm_fetch(db,key)
  121. #define dbm_delete(db,key)        gdbm_delete(db,key)
  122. #define dbm_nextkey(db,key)        gdbm_nextkey(db,key)
  123. #define dbm_firstkey(db)        gdbm_firstkey(db)
  124. #define dbm_close(db)            gdbm_close(db)
  125. #define dbm_store(db,key,val,rep)    gdbm_store(db,key,val)
  126.  
  127. #else /* GDBM */
  128. #ifdef NDBM
  129.  
  130. #include <ndbm.h>
  131. #define SOME_DBM
  132. #ifdef ODBM
  133. #undef ODBM
  134. #endif
  135.  
  136. #else /* NDBM */
  137. #ifdef ODBM
  138.  
  139. #ifdef NULL
  140. #undef NULL        /* suppress redefinition message */
  141. #endif
  142. #include <dbm.h>
  143. #ifdef NULL
  144. #undef NULL
  145. #endif
  146. #define NULL 0        /* silly thing is, we don't even use this */
  147. #define SOME_DBM
  148. #define dbm_fetch(db,dkey) fetch(dkey)
  149. #define dbm_delete(db,dkey) delete(dkey)
  150. #define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent)
  151. #define dbm_close(db) dbmclose()
  152. #define dbm_firstkey(db) firstkey()
  153.  
  154. #endif /* ODBM */
  155. #endif /* NDBM */
  156. #endif /* GDBM */
  157.  
  158. #ifdef SOME_DBM
  159. EXT char *dbmkey;
  160. EXT int dbmlen;
  161. #endif
  162.  
  163. #if defined(I_DIRENT) && !defined(M_XENIX)
  164. #   include <dirent.h>
  165. #   define DIRENT dirent
  166. #else
  167. #   ifdef I_SYSNDIR
  168. #    include <sys/ndir.h>
  169. #    define DIRENT direct
  170. #   else
  171. #    ifdef I_SYSDIR
  172. #        ifdef hp9000s500
  173. #        include <ndir.h>    /* may be wrong in the future */
  174. #        else
  175. #        include "sys/dir.h"
  176. #        endif
  177. #        define DIRENT direct
  178. #    endif
  179. #   endif
  180. #endif
  181.  
  182. typedef unsigned int STRLEN;
  183.  
  184. typedef struct arg ARG;
  185. typedef struct cmd CMD;
  186. typedef struct formcmd FCMD;
  187. typedef struct scanpat SPAT;
  188. typedef struct stio STIO;
  189. typedef struct sub SUBR;
  190. typedef struct string STR;
  191. typedef struct atbl ARRAY;
  192. typedef struct htbl HASH;
  193. typedef struct regexp REGEXP;
  194. typedef struct stabptrs STBP;
  195. typedef struct stab STAB;
  196. typedef struct callsave CSV;
  197.  
  198. #include "handy.h"
  199. #include "regexp.h"
  200. #include "str.h"
  201. #include "util.h"
  202. #include "form.h"
  203. #include "stab.h"
  204. #include "spat.h"
  205. #include "arg.h"
  206. #include "cmd.h"
  207. #include "array.h"
  208. #include "hash.h"
  209.  
  210. #if defined(iAPX286) || defined(M_I286) || defined(I80286)
  211. #   define I286
  212. #endif
  213.  
  214. #ifndef    __STDC__
  215. #ifdef CHARSPRINTF
  216.     char *sprintf();
  217. #else
  218.     int sprintf();
  219. #endif
  220. #endif
  221.  
  222. EXT char *Yes INIT("1");
  223. EXT char *No INIT("");
  224.  
  225. /* "gimme" values */
  226.  
  227. /* Note: cmd.c assumes that it can use && to produce one of these values! */
  228. #define G_SCALAR 0
  229. #define G_ARRAY 1
  230.  
  231. #ifdef CRIPPLED_CC
  232. int str_true();
  233. #else /* !CRIPPLED_CC */
  234. #define str_true(str) (Str = (str), \
  235.     (Str->str_pok ? \
  236.         ((*Str->str_ptr > '0' || \
  237.           Str->str_cur > 1 || \
  238.           (Str->str_cur && *Str->str_ptr != '0')) ? 1 : 0) \
  239.     : \
  240.         (Str->str_nok ? (Str->str_u.str_nval != 0.0) : 0 ) ))
  241. #endif /* CRIPPLED_CC */
  242.  
  243. #ifdef DEBUGGING
  244. #define str_peek(str) (Str = (str), \
  245.     (Str->str_pok ? \
  246.         Str->str_ptr : \
  247.         (Str->str_nok ? \
  248.         (sprintf(tokenbuf,"num(%g)",Str->str_u.str_nval), \
  249.             (char*)tokenbuf) : \
  250.         "" )))
  251. #endif
  252.  
  253. #ifdef CRIPPLED_CC
  254. char *str_get();
  255. #else
  256. #ifdef TAINT
  257. #define str_get(str) (Str = (str), tainted |= Str->str_tainted, \
  258.     (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
  259. #else
  260. #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
  261. #endif /* TAINT */
  262. #endif /* CRIPPLED_CC */
  263.  
  264. #ifdef CRIPPLED_CC
  265. double str_gnum();
  266. #else /* !CRIPPLED_CC */
  267. #ifdef TAINT
  268. #define str_gnum(str) (Str = (str), tainted |= Str->str_tainted, \
  269.     (Str->str_nok ? Str->str_u.str_nval : str_2num(Str)))
  270. #else /* !TAINT */
  271. #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_u.str_nval : str_2num(Str)))
  272. #endif /* TAINT*/
  273. #endif /* CRIPPLED_CC */
  274. EXT STR *Str;
  275.  
  276. #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
  277.  
  278. #ifndef MSDOS
  279. #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len)
  280. #define Str_Grow str_grow
  281. #else
  282. /* extra parentheses intentionally NOT placed around "len"! */
  283. #define STR_GROW(str,len) if ((str)->str_len < (unsigned long)len) \
  284.         str_grow(str,(unsigned long)len)
  285. #define Str_Grow(str,len) str_grow(str,(unsigned long)(len))
  286. #endif /* MSDOS */
  287.  
  288. #ifndef BYTEORDER
  289. #define BYTEORDER 0x1234
  290. #endif
  291.  
  292. #ifdef CASTNEGFLOAT
  293. #define U_S(what) ((unsigned short)(what))
  294. #define U_I(what) ((unsigned int)(what))
  295. #define U_L(what) ((unsigned long)(what))
  296. #else
  297. unsigned long castulong();
  298. #define U_S(what) ((unsigned int)castulong(what))
  299. #define U_I(what) ((unsigned int)castulong(what))
  300. #define U_L(what) (castulong(what))
  301. #endif
  302.  
  303. extern CMD *add_label PROTO((char *, CMD *));
  304. extern CMD *block_head PROTO((CMD *));
  305. extern CMD *append_line PROTO((CMD *, CMD *));
  306. extern CMD *make_acmd PROTO((int, STAB *, ARG *, ARG *));
  307. extern CMD *make_ccmd PROTO((int, ARG *, struct compcmd));
  308. extern CMD *make_icmd PROTO((int, ARG *, struct compcmd));
  309. extern CMD *invert PROTO((CMD *));
  310. extern CMD *addcond PROTO((CMD *, ARG *));
  311. extern CMD *addloop PROTO((CMD *, ARG *));
  312. extern CMD *wopt PROTO((CMD *));
  313. extern CMD *over PROTO((STAB *, CMD *));
  314.  
  315. extern STAB *stabent PROTO((char *, int));
  316. extern STAB *genstab PROTO((void));
  317.  
  318. extern ARG *stab2arg PROTO((int, STAB *));
  319. extern ARG *op_new PROTO((int));
  320. extern ARG *make_op PROTO((int, int, ARG *, ARG *, ARG *));
  321. extern ARG *make_match PROTO((int, ARG *, SPAT *));
  322. extern ARG *make_split PROTO((STAB *, ARG *, ARG *));
  323. extern ARG *rcatmaybe PROTO((ARG *));
  324. extern ARG *listish PROTO((ARG *));
  325. extern ARG *maybelistish PROTO((int, ARG *));
  326. extern ARG *localize PROTO((ARG *));
  327. extern ARG *fixeval PROTO((ARG *));
  328. extern ARG *jmaybe PROTO((ARG *));
  329. extern ARG *l PROTO((ARG *));
  330. extern ARG *fixl PROTO((int, ARG *));
  331. extern ARG *mod_match PROTO((int, ARG *, ARG *));
  332. extern ARG *make_list PROTO((ARG *));
  333. extern ARG *cmd_to_arg PROTO((CMD *));
  334. extern ARG *addflags PROTO((int, int, ARG *));
  335. extern ARG *hide_ary PROTO((ARG *));
  336. extern ARG *cval_to_arg PROTO((char *));
  337.  
  338. #ifdef LEAKTEST
  339. extern STR *str_new PROTO((int, STRLEN));
  340. #else
  341. extern STR *str_new PROTO((STRLEN));
  342. #endif
  343. extern STR *stab_str PROTO((STR *));
  344.  
  345. extern int do_each PROTO((STR *, HASH *, int, int *));
  346. extern int do_subr PROTO((ARG *, int, int *));
  347. extern int do_match PROTO((STR *, ARG *, int, int *));
  348. extern int do_unpack PROTO((STR *, int, int *));
  349. extern int do_truncate PROTO((STR *, ARG *, int, int *));
  350. extern int eval PROTO((ARG *, int, int));            /* evaluates expressions */
  351. extern int do_eval PROTO((STR *, int, HASH *, int, int *));    /* evaluates eval operator */
  352. extern int do_assign PROTO((ARG *, int, int *));
  353. extern int frename PROTO((const char *, const char *));
  354.  
  355. extern SUBR *make_sub PROTO((char *, CMD *));
  356. extern SUBR *make_usub PROTO((char *, int, int (*)(), char *));
  357.  
  358. extern FCMD *load_format PROTO((void));
  359.  
  360. extern char *scanpat PROTO((char *));
  361. extern char *scansubst PROTO((char *));
  362. extern char *scantrans PROTO((char *));
  363. extern char *scanstr PROTO((char *));
  364. extern char *scanreg PROTO((char *, char *, char *));
  365. extern char *str_append_till PROTO((STR *, char *, char *, int, char *));
  366. extern char *str_gets PROTO((STR *, FILE *, int));
  367. extern char *str_grow PROTO((STR *, int));
  368. extern char *getenvar PROTO((char *, char **));
  369.  
  370. extern bool do_open PROTO((STAB *, char *, STRLEN));
  371. extern bool do_close PROTO((STAB *, int));
  372. extern bool do_print PROTO((STR *, FILE *));
  373. extern bool do_aprint PROTO((ARG *, FILE *, int *));
  374. extern bool do_exec PROTO((char *));
  375. extern bool do_aexec PROTO((STR *, int *));
  376.  
  377. extern int do_subst PROTO((STR *, ARG *, int));
  378. extern int do_dbsubr PROTO((ARG *, int, int *));
  379. extern int do_study PROTO((STR *, ARG *, int, int *));
  380. extern int do_defined PROTO((STR *, ARG *, int, int *));
  381. extern int do_undef PROTO((STR *, ARG *, int, int *));
  382. extern int do_vec PROTO((int, STR *, int *));
  383. extern int do_ctl PROTO((int, STAB *, int, STR *));
  384. extern int do_dirop PROTO((int, STAB *, int, int *));
  385. extern int do_splice PROTO((ARRAY *, int, int *));
  386. extern int do_grep PROTO((ARG *, STR *, int, int *));
  387. extern int do_reverse PROTO((int *));
  388. extern int do_sreverse PROTO((STR *, int *));
  389. extern int do_sort PROTO((STR *, STAB *, int, int *));
  390. extern int do_range PROTO((int, int *));
  391. extern int do_kv PROTO((STR *, HASH *, int, int, int *));
  392. extern int do_aspawn PROTO((STR *, int *));
  393. extern int do_spawn PROTO((char *));
  394. extern int do_unlink PROTO((int *));
  395. extern int do_caller PROTO((ARG *, int, int, int *));
  396. extern int ingroup PROTO((int, int));
  397. extern int looks_like_number PROTO((STR *));
  398. extern int mystat PROTO((ARG *, STR *));
  399. extern int yyparse PROTO((void));
  400. extern int yylex PROTO((void));
  401.  
  402. extern void str_replace PROTO((STR *, STR *));
  403. extern void str_inc PROTO((STR *));
  404. extern void str_dec PROTO((STR *));
  405. extern void str_free PROTO((STR *));
  406. extern void stab_clear PROTO((STAB *));
  407. extern void do_unshift PROTO((ARRAY *, int *));
  408. extern void do_join PROTO((STR *, int *));
  409. extern void do_sprintf PROTO((STR *, int, STR **));
  410. extern void do_accept PROTO((STR *, STAB *, STAB *));
  411. extern void do_pipe PROTO((STR *, STAB *, STAB *));
  412. extern void do_vecset PROTO((STR *, STR *));
  413. extern void do_pack PROTO((STR *, int *));
  414. extern void do_chop PROTO((STR *, STR *));
  415. extern void do_vop PROTO((int, STR *, STR *, STR *));
  416. extern void savelist PROTO((STR **, int));
  417. extern void saveitem PROTO((STR *));
  418. extern void saveint PROTO((int *));
  419. extern void savelong PROTO((long *));
  420. extern void savesptr PROTO((STR **));
  421. extern void savehptr PROTO((HASH **));
  422. extern void restorelist PROTO((int));
  423. extern void repeatcpy PROTO((char *, char *, int, int));
  424. extern void make_form PROTO((STAB *, FCMD *));
  425. extern void make_cswitch PROTO((CMD *, int));
  426. extern void make_nswitch PROTO((CMD *, int));
  427. extern void yyerror PROTO((char *));
  428. extern void cmd_free PROTO((CMD *));
  429. extern void arg_free PROTO((ARG *));
  430. extern void spat_free PROTO((SPAT *));
  431. extern void dehoist PROTO((ARG *, int));
  432. extern void magicalize PROTO((char *));
  433. extern void hoistmust PROTO((SPAT *));
  434. extern void while_io PROTO((CMD *));
  435. extern void grow_dlevel PROTO((void));
  436. extern void checkcomma PROTO((char *, char *));
  437. extern void regfree PROTO((struct regexp *));
  438. extern void stamp PROTO((char *));
  439. extern void userinit PROTO((void));
  440. extern void magicname PROTO((char *, char *, int));
  441.  
  442. extern STR *do_syscall PROTO((int *));
  443.  
  444. extern HASH *savehash PROTO((STAB *));
  445.  
  446. extern ARRAY *saveary PROTO((STAB *));
  447.  
  448. #ifdef DEBUGGING
  449. extern void dump_all PROTO((void));
  450. extern void dump_cmd PROTO((CMD *, CMD *));
  451. extern void dump_arg PROTO((ARG *));
  452. extern void dump_flags PROTO((char *, unsigned int));
  453. extern void dump_stab PROTO((STAB *));
  454. extern void dump_spat PROTO((SPAT *));
  455. extern void dump PROTO((char *, ...));
  456. #endif
  457.  
  458. EXT char **origargv;
  459. EXT int origargc;
  460. EXT line_t subline INIT(0);
  461. EXT STR *subname INIT(Nullstr);
  462. EXT int arybase INIT(0);
  463.  
  464. struct outrec {
  465.     long    o_lines;
  466.     char    *o_str;
  467.     int        o_len;
  468. };
  469.  
  470. EXT struct outrec outrec;
  471. EXT struct outrec toprec;
  472.  
  473. EXT STAB *stdinstab INIT(Nullstab);
  474. EXT STAB *last_in_stab INIT(Nullstab);
  475. EXT STAB *defstab INIT(Nullstab);
  476. EXT STAB *argvstab INIT(Nullstab);
  477. EXT STAB *envstab INIT(Nullstab);
  478. EXT STAB *sigstab INIT(Nullstab);
  479. EXT STAB *defoutstab INIT(Nullstab);
  480. EXT STAB *curoutstab INIT(Nullstab);
  481. EXT STAB *argvoutstab INIT(Nullstab);
  482. EXT STAB *incstab INIT(Nullstab);
  483. EXT STAB *leftstab INIT(Nullstab);
  484. EXT STAB *amperstab INIT(Nullstab);
  485. EXT STAB *rightstab INIT(Nullstab);
  486. EXT STAB *DBstab INIT(Nullstab);
  487. EXT STAB *DBline INIT(Nullstab);
  488. EXT STAB *DBsub INIT(Nullstab);
  489.  
  490. EXT HASH *defstash;        /* main symbol table */
  491. EXT HASH *curstash;        /* symbol table for current package */
  492. EXT HASH *debstash;        /* symbol table for perldb package */
  493.  
  494. EXT STR *curstname;        /* name of current package */
  495.  
  496. EXT STR *freestrroot INIT(Nullstr);
  497. EXT STR *lastretstr INIT(Nullstr);
  498. EXT STR *DBsingle INIT(Nullstr);
  499. EXT STR *DBtrace INIT(Nullstr);
  500. EXT STR *DBsignal INIT(Nullstr);
  501.  
  502. EXT int lastspbase;
  503. EXT int lastsize;
  504.  
  505. EXT char *origfilename;
  506. EXT FILE * VOLATILE rsfp;
  507. EXT char buf[1024];
  508. EXT char *bufptr;
  509. EXT char *oldbufptr;
  510. EXT char *oldoldbufptr;
  511. EXT char *bufend;
  512.  
  513. EXT STR *linestr INIT(Nullstr);
  514.  
  515. EXT int record_separator INIT('\n');
  516. EXT int rslen INIT(1);
  517. EXT char *ofs INIT(Nullch);
  518. EXT int ofslen INIT(0);
  519. EXT char *ors INIT(Nullch);
  520. EXT int orslen INIT(0);
  521. EXT char *ofmt INIT(Nullch);
  522. EXT char *inplace INIT(Nullch);
  523. EXT char *nointrp INIT("");
  524.  
  525. EXT bool preprocess INIT(FALSE);
  526. EXT bool minus_n INIT(FALSE);
  527. EXT bool minus_p INIT(FALSE);
  528. EXT bool minus_a INIT(FALSE);
  529. EXT bool doswitches INIT(FALSE);
  530. EXT bool dowarn INIT(FALSE);
  531. EXT bool doextract INIT(FALSE);
  532. EXT bool allstabs INIT(FALSE);    /* init all customary symbols in symbol table?*/
  533. EXT bool sawampersand INIT(FALSE);    /* must save all match strings */
  534. EXT bool sawstudy INIT(FALSE);        /* do fbminstr on all strings */
  535. EXT bool sawi INIT(FALSE);        /* study must assume case insensitive */
  536. EXT bool sawvec INIT(FALSE);
  537. EXT bool localizing INIT(FALSE);    /* are we processing a local() list? */
  538.  
  539. #ifdef CSH
  540. char *cshname INIT(CSH);
  541. int cshlen INIT(0);
  542. #endif /* CSH */
  543.  
  544. #ifdef TAINT
  545. EXT bool tainted INIT(FALSE);        /* using variables controlled by $< */
  546. #endif
  547.  
  548. #define TMPPATH "PerlTmp"
  549.  
  550. EXT char *e_tmpname;
  551. EXT FILE *e_fp INIT(Nullfp);
  552.  
  553. EXT char tokenbuf[256];
  554. EXT int expectterm INIT(TRUE);        /* how to interpret ambiguous tokens */
  555. EXT VOLATILE int in_eval INIT(FALSE);    /* trap fatal errors? */
  556. EXT int multiline INIT(0);        /* $*--do strings hold >1 line? */
  557. EXT int error_count INIT(0);        /* how many errors so far, max 10 */
  558. EXT int multi_start INIT(0);        /* 1st line of multi-line string */
  559. EXT int multi_end INIT(0);        /* last line of multi-line string */
  560. EXT int multi_open INIT(0);        /* delimiter of said string */
  561. EXT int multi_close INIT(0);        /* delimiter of said string */
  562.  
  563. EXT char err_mess[255];            /* Last OS error string */
  564. EXT int err_no;                /* Last OS error number */
  565.  
  566. extern void save_err PROTO((void));
  567. extern void os_starttime PROTO((double *));
  568.  
  569. extern void execv PROTO((char *, char **));
  570. extern void sleep PROTO((unsigned));
  571. extern int mkdir PROTO((char *));
  572. extern int rmdir PROTO((char *));
  573. extern int chdir PROTO((char *));
  574. extern int unlink PROTO((char *));
  575. #ifdef ARM
  576. /* Note: not the same as Unix isatty() */
  577. extern int isatty PROTO((FILE *));
  578. /* Interface for exec/spawn functions */
  579. extern int exec_cmdv PROTO((int, int *));
  580. /* Get current dir: arg 1 => preserve PWD, arg 2 => value of PWD */
  581. extern char *getcwd PROTO((int, char **));
  582. #endif
  583.  
  584. extern STR *interp PROTO((STR *, STR *, int));
  585. extern void free_arg PROTO((ARG *));
  586. extern STIO *stio_new PROTO((void));
  587.  
  588. EXT struct stat statbuf;
  589. EXT struct stat statcache;
  590. EXT STAB *statstab INIT(Nullstab);
  591. EXT STR *statname;
  592. EXT int unsafe;
  593.  
  594. #ifdef DEBUGGING
  595. EXT VOLATILE int debug INIT(0);
  596. EXT int dlevel INIT(0);
  597. EXT int dlmax INIT(128);
  598. EXT char *debname;
  599. EXT char *debdelim;
  600. #define YYDEBUG 1
  601. #endif
  602. EXT int perldb INIT(0);
  603.  
  604. EXT line_t cmdline INIT(NOLINE);
  605.  
  606. EXT STR str_undef;
  607. EXT STR str_no;
  608. EXT STR str_yes;
  609.  
  610. /* runtime control stuff */
  611.  
  612. EXT struct loop {
  613.     char *loop_label;        /* what the loop was called, if anything */
  614.     int loop_sp;        /* stack pointer to copy stuff down to */
  615.     jmp_buf loop_env;
  616. } *loop_stack;
  617.  
  618. EXT int loop_ptr INIT(-1);
  619. EXT int loop_max INIT(128);
  620.  
  621. EXT jmp_buf top_env;
  622.  
  623. EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
  624.  
  625. struct ufuncs {
  626.     int (*uf_val)();
  627.     int (*uf_set)();
  628.     int uf_index;
  629. };
  630.  
  631. EXT ARRAY *stack;        /* THE STACK */
  632.  
  633. EXT ARRAY * VOLATILE savestack;    /* to save non-local values on */
  634.  
  635. EXT ARRAY *tosave;        /* strings to save on recursive subroutine */
  636.  
  637. EXT ARRAY *lineary;        /* lines of script for debugger */
  638. EXT ARRAY *dbargs;        /* args to call listed by caller function */
  639.  
  640. EXT int *di;            /* for tmp use in debuggers */
  641. EXT char *dc;
  642. EXT short *ds;
  643.  
  644. EXT double basetime INIT(0.0);
  645.  
  646. #ifndef ANSI_INCLUDES
  647. double atof();
  648. long time();
  649. struct tm *gmtime(), *localtime();
  650. char *index(), *rindex();
  651. char *strcpy(), *strcat();
  652. #endif
  653. extern char *mktemp PROTO((const char *));
  654. #ifdef CRYPT
  655. extern char *crypt PROTO((char *, char *));
  656. #endif
  657.  
  658. #ifdef EUNICE
  659. #define UNLINK unlnk
  660. int unlnk();
  661. #else
  662. #define UNLINK unlink
  663. #endif
  664.  
  665. #ifndef SETREUID
  666. #ifdef SETRESUID
  667. #define setreuid(r,e) setresuid(r,e,-1)
  668. #define SETREUID
  669. #endif
  670. #endif
  671. #ifndef SETREGID
  672. #ifdef SETRESGID
  673. #define setregid(r,e) setresgid(r,e,-1)
  674. #define SETREGID
  675. #endif
  676. #endif
  677.