extern.h revision 1.31
1/*	$OpenBSD: extern.h,v 1.31 2003/06/03 02:56:10 millert Exp $	*/
2/*	$NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk 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/* eval.c */
39extern void	eval(const char *[], int, int);
40extern void	dodefine(const char *, const char *);
41extern unsigned long expansion_id;
42
43/* expr.c */
44extern int	expr(const char *);
45
46/* gnum4.c */
47extern void 	addtoincludepath(const char *);
48extern struct input_file *fopen_trypath(struct input_file *, const char *);
49extern void doindir(const char *[], int);
50extern void dobuiltin(const char *[], int);
51extern void dopatsubst(const char *[], int);
52extern void doregexp(const char *[], int);
53
54extern void doprintlineno(struct input_file *);
55extern void doprintfilename(struct input_file *);
56
57extern void doesyscmd(const char *);
58
59
60/* look.c */
61extern ndptr	addent(const char *);
62extern unsigned	hash(const char *);
63extern ndptr	lookup(const char *);
64extern void	remhash(const char *, int);
65
66/* main.c */
67extern void outputstr(const char *);
68extern int builtin_type(const char *);
69extern char *builtin_realname(int);
70extern void do_emit_synchline(void);
71#define emit_synchline() do { if (synch_lines) do_emit_synchline(); } while(0)
72
73/* misc.c */
74extern void	chrsave(int);
75extern char 	*compute_prevep(void);
76extern void	getdiv(int);
77extern ptrdiff_t indx(const char *, const char *);
78extern void 	initspaces(void);
79extern void	killdiv(void);
80extern void	onintr(int);
81extern void	pbnum(int);
82extern void	pbunsigned(unsigned long);
83extern void	pbstr(const char *);
84extern void	putback(int);
85extern void	*xalloc(size_t);
86extern char	*xstrdup(const char *);
87extern void	usage(void);
88extern void	resizedivs(int);
89extern size_t	buffer_mark(void);
90extern void	dump_buffer(FILE *, size_t);
91
92extern int 	obtain_char(struct input_file *);
93extern void	set_input(struct input_file *, FILE *, const char *);
94extern void	release_input(struct input_file *);
95
96/* speeded-up versions of chrsave/putback */
97#define PUTBACK(c)				\
98	do {					\
99		if (bp >= endpbb)		\
100			enlarge_bufspace();	\
101		*bp++ = (c);			\
102	} while(0)
103
104#define CHRSAVE(c)				\
105	do {					\
106		if (ep >= endest)		\
107			enlarge_strspace();	\
108		*ep++ = (c);			\
109	} while(0)
110
111/* and corresponding exposure for local symbols */
112extern void enlarge_bufspace(void);
113extern void enlarge_strspace(void);
114extern char *endpbb;
115extern char *endest;
116
117/* trace.c */
118extern void mark_traced(const char *, int);
119extern int is_traced(const char *);
120extern void trace_file(const char *);
121extern ssize_t trace(const char **, int, struct input_file *);
122extern void finish_trace(size_t);
123extern int traced_macros;
124extern void set_trace_flags(const char *);
125extern FILE *traceout;
126
127extern ndptr hashtab[];		/* hash table for macros etc. */
128extern stae *mstack;		/* stack of m4 machine */
129extern char *sstack;		/* shadow stack, for string space extension */
130extern FILE *active;		/* active output file pointer */
131extern struct input_file infile[];/* input file stack (0=stdin) */
132extern FILE **outfile;		/* diversion array(0=bitbucket) */
133extern int maxout;		/* maximum number of diversions */
134extern int fp; 			/* m4 call frame pointer */
135extern int ilevel;		/* input file stack pointer */
136extern int oindex;		/* diversion index. */
137extern int sp;			/* current m4 stack pointer */
138extern char *bp;		/* first available character */
139extern char *buf;		/* push-back buffer */
140extern char *bufbase;		/* buffer base for this ilevel */
141extern char *bbase[];		/* buffer base per ilevel */
142extern char ecommt[MAXCCHARS+1];/* end character for comment */
143extern char *ep;		/* first free char in strspace */
144extern char lquote[MAXCCHARS+1];/* left quote character (`) */
145extern char *m4wraps;		/* m4wrap string default. */
146extern char *null;		/* as it says.. just a null. */
147extern char rquote[MAXCCHARS+1];/* right quote character (') */
148extern char scommt[MAXCCHARS+1];/* start character for comment */
149extern int  synch_lines;	/* line synchronisation directives */
150
151extern int mimic_gnu;		/* behaves like gnu-m4 */
152