1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/********************************************
mawk.h
copyright 1991 1992, Michael D. Brennan
This is a source file for mawk, an implementation of
the AWK programming language.
Mawk is distributed without warranty under the terms of
the GNU General Public License, version 2, 1991.
********************************************/
/* $Log: mawk.h,v $
/* Revision 1.2 1993/07/02 23:57:40 jtc
/* Updated to mawk 1.1.4
/*
* Revision 5.5.1.3 1993/01/22 15:04:50 mike
* pow2->mpow2 for linux
*
* Revision 5.5.1.2 1993/01/20 12:53:10 mike
* d_to_l()
*
* Revision 5.5.1.1 1993/01/15 03:33:46 mike
* patch3: safer double to int conversion
*
* Revision 5.5 1992/07/06 20:15:49 brennan
* DONT_PROTO_OPEN macro
*
* Revision 5.4 1992/03/03 16:34:41 brennan
* conditional around open() proto
*
* Revision 5.3 92/01/09 08:46:58 brennan
* cell destroy macro
*
* Revision 5.2 92/01/06 08:08:56 brennan
* binmode() proto for MSDOS
*
* Revision 5.1 91/12/05 07:59:26 brennan
* 1.1 pre-release
*
*/
/* mawk.h */
#ifndef MAWK_H
#define MAWK_H
#include "config.h"
#ifdef DEBUG
#define YYDEBUG 1
extern int yydebug ; /* print parse if on */
extern int dump_RE ;
#endif
extern int dump_code ;
extern int posix_space_flag ;
#include <stdio.h>
#if HAVE_STRING_H
#include <string.h>
#else
char *strchr() ;
char *strcpy() ;
char *strrchr() ;
#endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "types.h"
/*----------------
* GLOBAL VARIABLES
*----------------*/
/* a well known string */
extern STRING null_str ;
#ifndef TEMPBUFF_GOES_HERE
#define EXTERN extern
#else
#define EXTERN /* empty */
#endif
/* a useful scratch area */
EXTERN union {
STRING *_split_buff[MAX_SPLIT] ;
char _string_buff[MIN_SPRINTF] ;
} tempbuff ;
/* anonymous union */
#define string_buff tempbuff._string_buff
#define split_buff tempbuff._split_buff
#define SPRINTF_SZ sizeof(tempbuff)
/* help with casts */
extern int mpow2[] ;
/* these are used by the parser, scanner and error messages
from the compile */
extern char *pfile_name ; /* program input file */
extern int current_token ;
extern unsigned token_lineno ; /* lineno of current token */
extern unsigned compile_error_count ;
extern int paren_cnt, brace_cnt ;
extern int print_flag, getline_flag ;
extern short mawk_state ;
#define EXECUTION 1 /* other state is 0 compiling */
/*---------*/
#ifndef MSDOS_MSC
extern int errno ;
#endif
extern char *progname ; /* for error messages */
/* macro to test the type of two adjacent cells */
#define TEST2(cp) (mpow2[(cp)->type]+mpow2[((cp)+1)->type])
/* macro to get at the string part of a CELL */
#define string(cp) ((STRING *)(cp)->ptr)
#ifdef DEBUG
#define cell_destroy(cp) DB_cell_destroy(cp)
#else
#define cell_destroy(cp) if ( (cp)->type >= C_STRING &&\
-- string(cp)->ref_cnt == 0 )\
zfree(string(cp),string(cp)->len+STRING_OH);else
#endif
/* prototypes */
void PROTO( cast1_to_s, (CELL *) ) ;
void PROTO( cast1_to_d, (CELL *) ) ;
void PROTO( cast2_to_s, (CELL *) ) ;
void PROTO( cast2_to_d, (CELL *) ) ;
void PROTO( cast_to_RE, (CELL *) ) ;
void PROTO( cast_for_split, (CELL *) ) ;
void PROTO( check_strnum, (CELL *) ) ;
void PROTO( cast_to_REPL, (CELL *) ) ;
long PROTO( d_to_l, (double)) ;
#define d_to_i(d) ((int)d_to_l(d))
int PROTO( test, (CELL *) ) ; /* test for null non-null */
CELL *PROTO( cellcpy, (CELL *, CELL *) ) ;
CELL *PROTO( repl_cpy, (CELL *, CELL *) ) ;
void PROTO( DB_cell_destroy, (CELL *) ) ;
void PROTO( overflow, (char *, unsigned) ) ;
void PROTO( rt_overflow, (char *, unsigned) ) ;
void PROTO( rt_error, ( char *, ...) ) ;
void PROTO( mawk_exit, (int) ) ;
void PROTO( da, (INST *, FILE *)) ;
char *PROTO( str_str, (char*, char*, unsigned) ) ;
char *PROTO( rm_escape, (char *) ) ;
int PROTO( re_split, (char *, PTR) ) ;
char *PROTO( re_pos_match, (char *, PTR, unsigned *) ) ;
int PROTO( binmode, (void)) ;
void PROTO( exit, (int) ) ;
#ifdef THINK_C
#include <unix.h>
#else
int PROTO( close, (int) ) ;
/* ANSI compilers won't like open() if they've ever seen open as
int open(char *,int, ...). If so ,
#define DONT_PROTO_OPEN
*/
#ifndef DONT_PROTO_OPEN
int PROTO( open, (char *,int, int) ) ;
#endif
int PROTO( read, (int , PTR, unsigned) ) ;
#endif
int PROTO ( parse, (void) ) ;
int PROTO ( yylex, (void) ) ;
int PROTO( yyparse, (void) ) ;
void PROTO( yyerror, (char *) ) ;
void PROTO( bozo, (char *) ) ;
void PROTO( errmsg , (int, char*, ...) ) ;
void PROTO( compile_error, ( char *, ...) ) ;
void PROTO( execute, (INST *, CELL *, CELL *) ) ;
char *PROTO( find_kw_str, (int) ) ;
double strtod() ;
double fmod() ;
#endif /* MAWK_H */
|