1 /* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
4 Copyright (c) 1993, 1994 X Consortium
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 Except as contained in this notice, the name of the X Consortium shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from the X Consortium.
37 #include "Xfuncproto.h"
44 #include <sys/types.h>
48 #define MAXDEFINES 512
51 #define SYMTABINC 10 /* must be > 1 for define() to work right */
53 /* the following must match the directives table in main.c */
71 #define IFFALSE 16 /* pseudo value --- never matched */
72 #define ELIFFALSE 17 /* pseudo value --- never matched */
73 #define INCLUDEDOT 18 /* pseudo value --- never matched */
74 #define IFGUESSFALSE 19 /* pseudo value --- never matched */
75 #define ELIFGUESSFALSE 20 /* pseudo value --- never matched */
78 // uncomment this for debugging version.
81 extern int _debugmask;
85 * 0 show ifn*(def)*,endif
86 * 1 trace defined/!defined
88 * 3 show #include SYMBOL
91 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
93 #define debug(level,arg) {}
102 char *i_incstring; /* string from #include line */
103 char *i_file; /* path name of the include file */
104 inclist **i_list; /* list of files it itself includes */
105 int i_listlen; /* length of i_list */
106 symtab *i_defs; /* symbol table for this file */
107 int i_ndefs; /* current # defines */
108 int i_deflen; /* amount of space in table */
109 bool i_defchecked; /* whether defines have been checked */
110 bool i_notified; /* whether we have revealed includes */
111 bool i_marked; /* whether it's in the makefile */
112 bool i_searched; /* whether we have read this */
113 bool i_included_sym; /* whether #include SYMBOL was found */
114 /* Can't use i_list if true */
126 #ifndef X_NOT_STDC_ENV
128 #if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
129 char *malloc(), *realloc();
141 filepointer *getfile();
142 inclist *newinclude(register char *, register char *);
147 int cppsetup(register char *line, register filepointer *filep,
148 register inclist *inc);
151 inclist *newinclude(register char *newfile, register char *incstring);
153 inclist *inc_path(register char *file, register char *include, bool dot,
155 void included_by(register inclist *ip, register inclist *newfile);
158 char *base_name(register char *file);
159 char *copy(register char *str);
160 filepointer *getfile(char *file);
161 void freefile(filepointer *fp);
162 char *getline(register filepointer *filep);
163 int match(register const char *str, register const char **list);
164 void redirect(char *line, char *makefile);
165 #if NeedVarargsPrototypes
166 void fatalerr(const char *, ...);
167 void warning(const char *, ...);
168 void warning1(const char *, ...);
172 void define(char *def, inclist *file);
173 void define2(char *name, char *val, inclist *file);
174 int deftype(register char *line, register filepointer *filep,
175 register inclist *file_red, register inclist *file,
177 symtab *fdefined(register char *symbol, inclist *file, inclist **srcfile);
178 int find_includes(filepointer *filep, inclist *file,
179 inclist *file_red, int recursion, bool failOK);
180 int gobble(register filepointer *filep, inclist *file,
182 symtab *isdefined(register char *symbol, inclist *file,
184 symtab *slookup(register char *symbol, register inclist *file);
185 void undefine(char *symbol, register inclist *file);
186 int zero_value(register char *exp, register filepointer *filep,
187 register inclist *file_red);
190 void add_include(filepointer *filep, inclist *file,
191 inclist *file_red, char *include, bool dot, bool failOK);
192 void pr(register inclist *ip, char *file, char *base, bool rc_file);
193 void recursive_pr_include(register inclist *head, register char *file,
194 register char *base);