perl 1.0 patch 5: a2p didn't make use of the config.h generated by Configure
[p5sagit/p5-mst-13.2.git] / x2p / a2p.h
CommitLineData
be04251a 1/* $Header: a2p.h,v 1.0.1.1 88/01/26 09:52:30 root Exp $
8d063cd8 2 *
3 * $Log: a2p.h,v $
be04251a 4 * Revision 1.0.1.1 88/01/26 09:52:30 root
5 * patch 5: a2p didn't use config.h.
6 *
8d063cd8 7 * Revision 1.0 87/12/18 13:06:58 root
8 * Initial revision
9 *
10 */
11
be04251a 12#define VOIDUSED 1
13#include "../config.h"
14
15#ifndef BCOPY
16# define bcopy(s1,s2,l) memcpy(s2,s1,l);
17# define bzero(s,l) memset(s,0,l);
18#endif
19
8d063cd8 20#include "handy.h"
21#define Nullop 0
22
23#define OPROG 1
24#define OJUNK 2
25#define OHUNKS 3
26#define ORANGE 4
27#define OPAT 5
28#define OHUNK 6
29#define OPPAREN 7
30#define OPANDAND 8
31#define OPOROR 9
32#define OPNOT 10
33#define OCPAREN 11
34#define OCANDAND 12
35#define OCOROR 13
36#define OCNOT 14
37#define ORELOP 15
38#define ORPAREN 16
39#define OMATCHOP 17
40#define OMPAREN 18
41#define OCONCAT 19
42#define OASSIGN 20
43#define OADD 21
44#define OSUB 22
45#define OMULT 23
46#define ODIV 24
47#define OMOD 25
48#define OPOSTINCR 26
49#define OPOSTDECR 27
50#define OPREINCR 28
51#define OPREDECR 29
52#define OUMINUS 30
53#define OUPLUS 31
54#define OPAREN 32
55#define OGETLINE 33
56#define OSPRINTF 34
57#define OSUBSTR 35
58#define OSTRING 36
59#define OSPLIT 37
60#define OSNEWLINE 38
61#define OINDEX 39
62#define ONUM 40
63#define OSTR 41
64#define OVAR 42
65#define OFLD 43
66#define ONEWLINE 44
67#define OCOMMENT 45
68#define OCOMMA 46
69#define OSEMICOLON 47
70#define OSCOMMENT 48
71#define OSTATES 49
72#define OSTATE 50
73#define OPRINT 51
74#define OPRINTF 52
75#define OBREAK 53
76#define ONEXT 54
77#define OEXIT 55
78#define OCONTINUE 56
79#define OREDIR 57
80#define OIF 58
81#define OWHILE 59
82#define OFOR 60
83#define OFORIN 61
84#define OVFLD 62
85#define OBLOCK 63
86#define OREGEX 64
87#define OLENGTH 65
88#define OLOG 66
89#define OEXP 67
90#define OSQRT 68
91#define OINT 69
92
93#ifdef DOINIT
94char *opname[] = {
95 "0",
96 "PROG",
97 "JUNK",
98 "HUNKS",
99 "RANGE",
100 "PAT",
101 "HUNK",
102 "PPAREN",
103 "PANDAND",
104 "POROR",
105 "PNOT",
106 "CPAREN",
107 "CANDAND",
108 "COROR",
109 "CNOT",
110 "RELOP",
111 "RPAREN",
112 "MATCHOP",
113 "MPAREN",
114 "CONCAT",
115 "ASSIGN",
116 "ADD",
117 "SUB",
118 "MULT",
119 "DIV",
120 "MOD",
121 "POSTINCR",
122 "POSTDECR",
123 "PREINCR",
124 "PREDECR",
125 "UMINUS",
126 "UPLUS",
127 "PAREN",
128 "GETLINE",
129 "SPRINTF",
130 "SUBSTR",
131 "STRING",
132 "SPLIT",
133 "SNEWLINE",
134 "INDEX",
135 "NUM",
136 "STR",
137 "VAR",
138 "FLD",
139 "NEWLINE",
140 "COMMENT",
141 "COMMA",
142 "SEMICOLON",
143 "SCOMMENT",
144 "STATES",
145 "STATE",
146 "PRINT",
147 "PRINTF",
148 "BREAK",
149 "NEXT",
150 "EXIT",
151 "CONTINUE",
152 "REDIR",
153 "IF",
154 "WHILE",
155 "FOR",
156 "FORIN",
157 "VFLD",
158 "BLOCK",
159 "REGEX",
160 "LENGTH",
161 "LOG",
162 "EXP",
163 "SQRT",
164 "INT",
165 "70"
166};
167#else
168extern char *opname[];
169#endif
170
171union {
172 int ival;
173 char *cval;
174} ops[50000]; /* hope they have 200k to spare */
175
176EXT int mop INIT(1);
177
178#define DEBUGGING
179
180#include <stdio.h>
181#include <ctype.h>
182#include <setjmp.h>
183#include <sys/types.h>
184#include <sys/stat.h>
185#include <time.h>
186#include <sys/times.h>
187
188typedef struct string STR;
189typedef struct htbl HASH;
190
191#include "str.h"
192#include "hash.h"
193
194/* A string is TRUE if not "" or "0". */
195#define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
196EXT char *Yes INIT("1");
197EXT char *No INIT("");
198
199#define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 )))
200
201#define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%g)",Str->str_nval),buf) : "" )))
202#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
203#define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str)))
204EXT STR *Str;
205
206#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
207
208STR *str_new();
209
210char *scanpat();
211char *scannum();
212
213void str_free();
214
215EXT int line INIT(0);
216
217EXT FILE *rsfp;
218EXT char buf[1024];
219EXT char *bufptr INIT(buf);
220
221EXT STR *linestr INIT(Nullstr);
222
223EXT char tokenbuf[256];
224EXT int expectterm INIT(TRUE);
225
226#ifdef DEBUGGING
227EXT int debug INIT(0);
228EXT int dlevel INIT(0);
229#define YYDEBUG;
230extern int yydebug;
231#endif
232
233EXT STR *freestrroot INIT(Nullstr);
234
235EXT STR str_no;
236EXT STR str_yes;
237
238EXT bool do_split INIT(FALSE);
239EXT bool split_to_array INIT(FALSE);
240EXT bool set_array_base INIT(FALSE);
241EXT bool saw_RS INIT(FALSE);
242EXT bool saw_OFS INIT(FALSE);
243EXT bool saw_ORS INIT(FALSE);
244EXT bool saw_line_op INIT(FALSE);
245EXT bool in_begin INIT(TRUE);
246EXT bool do_opens INIT(FALSE);
247EXT bool do_fancy_opens INIT(FALSE);
248EXT bool lval_field INIT(FALSE);
249EXT bool do_chop INIT(FALSE);
250EXT bool need_entire INIT(FALSE);
251EXT bool absmaxfld INIT(FALSE);
252
253EXT char const_FS INIT(0);
254EXT char *namelist INIT(Nullch);
255EXT char fswitch INIT(0);
256
257EXT int saw_FS INIT(0);
258EXT int maxfld INIT(0);
259EXT int arymax INIT(0);
260char *nameary[100];
261
262EXT STR *opens;
263
264EXT HASH *symtab;