This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 1.0 patch 14: a2p incorrectly translates 'for (a in b)' construct.
[perl5.git] / perl.h
CommitLineData
d96024cf 1/* $Header: perl.h,v 1.0.1.4 88/01/30 08:54:00 root Exp $
8d063cd8
LW
2 *
3 * $Log: perl.h,v $
d96024cf
MA
4 * Revision 1.0.1.4 88/01/30 08:54:00 root
5 * patch9: changed #define YYDEBUG; to #define YYDEBUG 1
6 *
a559c259
LW
7 * Revision 1.0.1.3 88/01/28 10:24:17 root
8 * patch8: added eval operator.
9 *
135863df
AB
10 * Revision 1.0.1.2 88/01/24 03:53:47 root
11 * patch 2: hid str_peek() in #ifdef DEBUGGING.
12 *
36ce8bec
DF
13 * Revision 1.0.1.1 88/01/21 21:29:23 root
14 * No longer defines STDSTDIO--gets it from config.h now.
15 *
8d063cd8
LW
16 * Revision 1.0 87/12/18 13:05:38 root
17 * Initial revision
18 *
19 */
20
21#define DEBUGGING
8d063cd8
LW
22
23#define VOIDUSED 1
24#include "config.h"
25
26#ifndef BCOPY
27# define bcopy(s1,s2,l) memcpy(s2,s1,l);
28# define bzero(s,l) memset(s,0,l);
29#endif
30
31#include <stdio.h>
32#include <ctype.h>
33#include <setjmp.h>
34#include <sys/types.h>
35#include <sys/stat.h>
135863df
AB
36
37#ifdef TMINSYS
38#include <sys/time.h>
39#else
8d063cd8 40#include <time.h>
135863df
AB
41#endif
42
8d063cd8
LW
43#include <sys/times.h>
44
45typedef struct arg ARG;
46typedef struct cmd CMD;
47typedef struct formcmd FCMD;
48typedef struct scanpat SPAT;
49typedef struct stab STAB;
50typedef struct stio STIO;
51typedef struct string STR;
52typedef struct atbl ARRAY;
53typedef struct htbl HASH;
54
55#include "str.h"
56#include "form.h"
57#include "stab.h"
58#include "spat.h"
59#include "arg.h"
60#include "cmd.h"
61#include "array.h"
62#include "hash.h"
63
135863df
AB
64#ifdef CHARSPRINTF
65 char *sprintf();
66#else
67 int sprintf();
68#endif
69
8d063cd8
LW
70/* A string is TRUE if not "" or "0". */
71#define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
72EXT char *Yes INIT("1");
73EXT char *No INIT("");
74
75#define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 )))
76
135863df 77#ifdef DEBUGGING
8d063cd8 78#define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%g)",Str->str_nval),buf) : "" )))
135863df
AB
79#endif
80
8d063cd8
LW
81#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
82#define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str)))
83EXT STR *Str;
84
85#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
86
87CMD *add_label();
88CMD *block_head();
89CMD *append_line();
90CMD *make_acmd();
91CMD *make_ccmd();
92CMD *invert();
93CMD *addcond();
94CMD *addloop();
95CMD *wopt();
96
97SPAT *stab_to_spat();
98
99STAB *stabent();
100
101ARG *stab_to_arg();
102ARG *op_new();
103ARG *make_op();
104ARG *make_lval();
105ARG *make_match();
106ARG *make_split();
107ARG *flipflip();
108
109STR *arg_to_str();
110STR *str_new();
111STR *stab_str();
a559c259
LW
112STR *eval(); /* this evaluates expressions */
113STR *do_eval(); /* this evaluates eval operator */
8d063cd8
LW
114
115FCMD *load_format();
116
117char *scanpat();
118char *scansubst();
119char *scantrans();
120char *scanstr();
121char *scanreg();
122char *reg_get();
123char *str_append_till();
124char *str_gets();
125
126bool do_match();
127bool do_open();
128bool do_close();
129bool do_print();
130
131int do_subst();
132
133void str_free();
134void freearg();
135
136EXT int line INIT(0);
137EXT int arybase INIT(0);
138
139struct outrec {
140 int o_lines;
141 char *o_str;
142 int o_len;
143};
144
145EXT struct outrec outrec;
146EXT struct outrec toprec;
147
148EXT STAB *last_in_stab INIT(Nullstab);
149EXT STAB *defstab INIT(Nullstab);
150EXT STAB *argvstab INIT(Nullstab);
151EXT STAB *envstab INIT(Nullstab);
152EXT STAB *sigstab INIT(Nullstab);
153EXT STAB *defoutstab INIT(Nullstab);
154EXT STAB *curoutstab INIT(Nullstab);
155EXT STAB *argvoutstab INIT(Nullstab);
156
157EXT STR *freestrroot INIT(Nullstr);
158
159EXT FILE *rsfp;
160EXT char buf[1024];
161EXT char *bufptr INIT(buf);
162
163EXT STR *linestr INIT(Nullstr);
164
165EXT char record_separator INIT('\n');
166EXT char *ofs INIT(Nullch);
167EXT char *ors INIT(Nullch);
168EXT char *ofmt INIT(Nullch);
169EXT char *inplace INIT(Nullch);
170
171EXT char tokenbuf[256];
172EXT int expectterm INIT(TRUE);
173EXT int lex_newlines INIT(FALSE);
a559c259 174EXT int in_eval INIT(FALSE);
8d063cd8
LW
175
176FILE *popen();
177/* char *str_get(); */
178STR *interp();
179void free_arg();
180STIO *stio_new();
181
182EXT struct stat statbuf;
183EXT struct tms timesbuf;
184
185#ifdef DEBUGGING
186EXT int debug INIT(0);
187EXT int dlevel INIT(0);
188EXT char debname[40];
189EXT char debdelim[40];
d96024cf 190#define YYDEBUG 1
8d063cd8
LW
191extern int yydebug;
192#endif
193
194EXT STR str_no;
195EXT STR str_yes;
196
197/* runtime control stuff */
198
199EXT struct loop {
200 char *loop_label;
201 jmp_buf loop_env;
202} loop_stack[32];
203
204EXT int loop_ptr INIT(-1);
205
206EXT jmp_buf top_env;
a559c259 207EXT jmp_buf eval_env;
8d063cd8
LW
208
209EXT char *goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
210
211double atof();
212long time();
213struct tm *gmtime(), *localtime();
214
8d063cd8
LW
215#ifdef EUNICE
216#define UNLINK(f) while (unlink(f) >= 0)
217#else
218#define UNLINK unlink
219#endif