extern.h revision 1.11 1 /* $NetBSD: extern.h,v 1.11 2003/08/07 11:14:31 agc Exp $ */
2 /* $OpenBSD: extern.h,v 1.28 2001/10/10 18:12:00 espie Exp $ */
3
4 /*-
5 * Copyright (c) 1991, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Ozan Yigit at York University.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)extern.h 8.1 (Berkeley) 6/6/93
36 */
37
38 #if HAVE_CONFIG_H
39 #include "config.h"
40 #endif
41
42 #include <err.h>
43 #include <unistd.h>
44
45 /* eval.c */
46 extern void eval __P((const char *[], int, int));
47 extern void dodefine __P((const char *, const char *));
48 extern unsigned long expansion_id;
49
50 /* expr.c */
51 extern int expr __P((const char *));
52
53 /* gnum4.c */
54 extern void addtoincludepath __P((const char *));
55 extern struct input_file *fopen_trypath __P((struct input_file *, const char *));
56 extern void doindir __P((const char *[], int));
57 extern void dobuiltin __P((const char *[], int));
58 extern void dopatsubst __P((const char *[], int));
59 extern void doregexp __P((const char *[], int));
60 extern void doprintlineno __P((struct input_file *));
61 extern void doprintfilename __P((struct input_file *));
62 extern void doesyscmd __P((const char *));
63
64
65 /* look.c */
66 extern ndptr addent __P((const char *));
67 extern unsigned hash __P((const char *));
68 extern ndptr lookup __P((const char *));
69 extern void remhash __P((const char *, int));
70
71 /* main.c */
72 extern void outputstr __P((const char *));
73 extern int builtin_type __P((const char *));
74 extern const char *builtin_realname __P((int));
75
76 /* misc.c */
77 extern void chrsave __P((int));
78 extern char *compute_prevep __P((void));
79 extern void getdiv __P((int));
80 extern ptrdiff_t indx __P((const char *, const char *));
81 extern void initspaces __P((void));
82 extern void killdiv __P((void));
83 extern void onintr __P((int));
84 extern void pbnum __P((int));
85 extern void pbunsigned __P((unsigned long));
86 extern void pbstr __P((const char *));
87 extern void putback __P((int));
88 extern void *xalloc __P((size_t));
89 extern char *xstrdup __P((const char *));
90 extern void usage __P((const char *));
91 extern void resizedivs __P((int));
92 extern size_t buffer_mark __P((void));
93 extern void dump_buffer __P((FILE *, size_t));
94
95 extern int obtain_char __P((struct input_file *));
96 extern void set_input __P((struct input_file *, FILE *, const char *));
97 extern void release_input __P((struct input_file *));
98
99 /* speeded-up versions of chrsave/putback */
100 #define PUTBACK(c) \
101 do { \
102 if (bp >= endpbb) \
103 enlarge_bufspace(); \
104 *bp++ = (c); \
105 } while(0)
106
107 #define CHRSAVE(c) \
108 do { \
109 if (ep >= endest) \
110 enlarge_strspace(); \
111 *ep++ = (c); \
112 } while(0)
113
114 /* and corresponding exposure for local symbols */
115 extern void enlarge_bufspace __P((void));
116 extern void enlarge_strspace __P((void));
117 extern char *endpbb;
118 extern char *endest;
119
120 /* trace.c */
121 extern void mark_traced __P((const char *, int));
122 extern int is_traced __P((const char *));
123 extern void trace_file __P((const char *));
124 extern ssize_t trace __P((const char **, int, struct input_file *));
125 extern void finish_trace __P((size_t));
126 extern void set_trace_flags __P((const char *));
127 extern int traced_macros;
128 extern FILE *traceout;
129
130 extern ndptr hashtab[]; /* hash table for macros etc. */
131 extern stae *mstack; /* stack of m4 machine */
132 extern char *sstack; /* shadow stack, for string space extension */
133 extern FILE *active; /* active output file pointer */
134 extern struct input_file infile[];/* input file stack (0=stdin) */
135 extern FILE **outfile; /* diversion array(0=bitbucket) */
136 extern int maxout; /* maximum number of diversions */
137 extern int fp; /* m4 call frame pointer */
138 extern int ilevel; /* input file stack pointer */
139 extern int oindex; /* diversion index. */
140 extern int sp; /* current m4 stack pointer */
141 extern char *bp; /* first available character */
142 extern char *buf; /* push-back buffer */
143 extern char *bufbase; /* buffer base for this ilevel */
144 extern char *bbase[]; /* buffer base per ilevel */
145 extern char ecommt[MAXCCHARS+1];/* end character for comment */
146 extern char *ep; /* first free char in strspace */
147 extern char lquote[MAXCCHARS+1];/* left quote character (`) */
148 extern char *m4wraps; /* m4wrap string default. */
149 extern char *null; /* as it says.. just a null. */
150 extern char rquote[MAXCCHARS+1];/* right quote character (') */
151 extern char scommt[MAXCCHARS+1];/* start character for comment */
152 extern int mimic_gnu; /* behaves like gnu-m4 */
153