Annotation of src/usr.bin/m4/extern.h, Revision 1.39
1.39 ! espie 1: /* $OpenBSD: extern.h,v 1.38 2003/06/30 22:13:32 espie Exp $ */
1.2 deraadt 2: /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */
1.1 deraadt 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.
1.31 millert 19: * 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 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:
1.11 espie 38: /* eval.c */
1.35 espie 39: extern void eval(const char *[], int, int, int);
1.29 millert 40: extern void dodefine(const char *, const char *);
1.24 espie 41: extern unsigned long expansion_id;
1.11 espie 42:
43: /* expr.c */
1.29 millert 44: extern int expr(const char *);
1.11 espie 45:
46: /* gnum4.c */
1.29 millert 47: extern void addtoincludepath(const char *);
48: extern struct input_file *fopen_trypath(struct input_file *, const char *);
49: extern void doindir(const char *[], int);
50: extern void dobuiltin(const char *[], int);
51: extern void dopatsubst(const char *[], int);
52: extern void doregexp(const char *[], int);
1.17 espie 53:
1.29 millert 54: extern void doprintlineno(struct input_file *);
55: extern void doprintfilename(struct input_file *);
1.20 espie 56:
1.29 millert 57: extern void doesyscmd(const char *);
1.17 espie 58:
1.11 espie 59:
60: /* look.c */
1.38 espie 61:
62: #define FLAG_UNTRACED 0
63: #define FLAG_TRACED 1
64: #define FLAG_NO_TRACE 2
65:
1.36 espie 66: extern void init_macros(void);
1.29 millert 67: extern ndptr lookup(const char *);
1.38 espie 68: extern void mark_traced(const char *, int);
69: extern struct ohash macros;
1.34 espie 70:
71: extern struct macro_definition *lookup_macro_definition(const char *);
72: extern void macro_define(const char *, const char *);
73: extern void macro_pushdef(const char *, const char *);
74: extern void macro_popdef(const char *);
75: extern void macro_undefine(const char *);
76: extern void setup_builtin(const char *, unsigned int);
77: extern void macro_for_all(void (*)(const char *, struct macro_definition *));
1.38 espie 78: #define macro_getdef(p) ((p)->d)
79: #define macro_name(p) ((p)->name)
80: #define macro_builtin_type(p) ((p)->builtin_type)
81: #define is_traced(p) ((p)->trace_flags == FLAG_NO_TRACE ? (trace_flags & TRACE_ALL) : (p)->trace_flags)
82:
1.37 espie 83: extern ndptr macro_getbuiltin(const char *);
1.14 espie 84:
85: /* main.c */
1.29 millert 86: extern void outputstr(const char *);
1.30 espie 87: extern void do_emit_synchline(void);
88: #define emit_synchline() do { if (synch_lines) do_emit_synchline(); } while(0)
1.11 espie 89:
90: /* misc.c */
1.29 millert 91: extern void chrsave(int);
92: extern char *compute_prevep(void);
93: extern void getdiv(int);
94: extern ptrdiff_t indx(const char *, const char *);
95: extern void initspaces(void);
96: extern void killdiv(void);
97: extern void onintr(int);
98: extern void pbnum(int);
99: extern void pbunsigned(unsigned long);
100: extern void pbstr(const char *);
101: extern void putback(int);
1.39 ! espie 102: extern void *xalloc(size_t, const char *fmt, ...);
! 103: extern void *xrealloc(void *, size_t, const char *fmt, ...);
1.29 millert 104: extern char *xstrdup(const char *);
105: extern void usage(void);
106: extern void resizedivs(int);
107: extern size_t buffer_mark(void);
108: extern void dump_buffer(FILE *, size_t);
109:
110: extern int obtain_char(struct input_file *);
111: extern void set_input(struct input_file *, FILE *, const char *);
112: extern void release_input(struct input_file *);
1.26 espie 113:
114: /* speeded-up versions of chrsave/putback */
115: #define PUTBACK(c) \
116: do { \
117: if (bp >= endpbb) \
118: enlarge_bufspace(); \
119: *bp++ = (c); \
120: } while(0)
121:
122: #define CHRSAVE(c) \
123: do { \
124: if (ep >= endest) \
125: enlarge_strspace(); \
126: *ep++ = (c); \
127: } while(0)
128:
129: /* and corresponding exposure for local symbols */
1.29 millert 130: extern void enlarge_bufspace(void);
131: extern void enlarge_strspace(void);
1.26 espie 132: extern char *endpbb;
133: extern char *endest;
1.15 espie 134:
1.25 espie 135: /* trace.c */
1.38 espie 136: extern unsigned int trace_flags;
137: #define TRACE_ALL 512
1.29 millert 138: extern void trace_file(const char *);
139: extern ssize_t trace(const char **, int, struct input_file *);
140: extern void finish_trace(size_t);
141: extern void set_trace_flags(const char *);
1.25 espie 142: extern FILE *traceout;
1.15 espie 143:
1.1 deraadt 144: extern ndptr hashtab[]; /* hash table for macros etc. */
1.19 espie 145: extern stae *mstack; /* stack of m4 machine */
146: extern char *sstack; /* shadow stack, for string space extension */
1.1 deraadt 147: extern FILE *active; /* active output file pointer */
1.15 espie 148: extern struct input_file infile[];/* input file stack (0=stdin) */
1.21 espie 149: extern FILE **outfile; /* diversion array(0=bitbucket) */
150: extern int maxout; /* maximum number of diversions */
1.1 deraadt 151: extern int fp; /* m4 call frame pointer */
152: extern int ilevel; /* input file stack pointer */
153: extern int oindex; /* diversion index. */
154: extern int sp; /* current m4 stack pointer */
1.16 espie 155: extern char *bp; /* first available character */
156: extern char *buf; /* push-back buffer */
157: extern char *bufbase; /* buffer base for this ilevel */
158: extern char *bbase[]; /* buffer base per ilevel */
1.13 espie 159: extern char ecommt[MAXCCHARS+1];/* end character for comment */
1.1 deraadt 160: extern char *ep; /* first free char in strspace */
1.13 espie 161: extern char lquote[MAXCCHARS+1];/* left quote character (`) */
1.1 deraadt 162: extern char *m4wraps; /* m4wrap string default. */
163: extern char *null; /* as it says.. just a null. */
1.13 espie 164: extern char rquote[MAXCCHARS+1];/* right quote character (') */
165: extern char scommt[MAXCCHARS+1];/* start character for comment */
1.30 espie 166: extern int synch_lines; /* line synchronisation directives */
1.9 espie 167:
1.18 espie 168: extern int mimic_gnu; /* behaves like gnu-m4 */
1.34 espie 169: