00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef X_NOT_POSIX
00031 #ifndef _POSIX_SOURCE
00032 #define _POSIX_SOURCE
00033 #endif
00034 #endif
00035 #include <stdio.h>
00036 #ifndef X_NOT_STDC_ENV
00037 #include <string.h>
00038 #endif
00039 #include <ctype.h>
00040 #include <sys/types.h>
00041 #include <fcntl.h>
00042 #include <sys/stat.h>
00043
00044 #define MAXFILES 4096
00045 #define MAXDIRS 4096
00046 #define SYMTABINC 10
00047 #define TRUE 1
00048 #define FALSE 0
00049
00050
00051 #define IF 0
00052 #define IFDEF 1
00053 #define IFNDEF 2
00054 #define ELSE 3
00055 #define ENDIF 4
00056 #define DEFINE 5
00057 #define UNDEF 6
00058 #define INCLUDE 7
00059 #define LINE 8
00060 #define PRAGMA 9
00061 #define ERROR 10
00062 #define IDENT 11
00063 #define SCCS 12
00064 #define ELIF 13
00065 #define EJECT 14
00066 #define WARNING 15
00067 #define IFFALSE 16
00068 #define ELIFFALSE 17
00069 #define INCLUDEDOT 18
00070 #define IFGUESSFALSE 19
00071 #define ELIFGUESSFALSE 20
00072
00073 #ifdef DEBUG
00074 extern int _debugmask;
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
00085 #else
00086 #define debug(level,arg)
00087 #endif
00088
00089 typedef unsigned char boolean;
00090
00091 struct symtab {
00092 char *s_name;
00093 char *s_value;
00094 };
00095
00096
00097 #define DEFCHECKED (1<<0)
00098 #define NOTIFIED (1<<1)
00099 #define MARKED (1<<2)
00100 #define SEARCHED (1<<3)
00101 #define FINISHED (1<<4)
00102 #define INCLUDED_SYM (1<<5)
00103
00104 struct inclist {
00105 char *i_incstring;
00106 char *i_file;
00107 struct inclist **i_list;
00108 int i_listlen;
00109 struct symtab **i_defs;
00110
00111 int i_ndefs;
00112 boolean *i_merged;
00113
00114 unsigned char i_flags;
00115 };
00116
00117 struct filepointer {
00118 char *f_p;
00119 char *f_base;
00120 char *f_end;
00121 long f_len;
00122 long f_line;
00123 };
00124
00125 #ifndef X_NOT_STDC_ENV
00126 #include <stdlib.h>
00127 #if defined(macII) && !defined(__STDC__)
00128 char *malloc(), *realloc();
00129 #endif
00130 #else
00131 char *malloc();
00132 char *realloc();
00133 #endif
00134
00135 char *copy(char*);
00136 char *base_name(char*);
00137 char *rgetline(struct filepointer*);
00138 struct symtab **slookup(char*, struct inclist*);
00139 struct symtab **isdefined(char*,struct inclist*, struct inclist**);
00140 struct symtab **fdefined();
00141 struct filepointer *getfile(char*);
00142 struct inclist *newinclude(char*,char*);
00143 struct inclist *inc_path(char*, char*, boolean);
00144 void undefine_all(struct inclist *);
00145
00146 extern void fatalerr(char *, ...);
00147 extern void warning(char *, ...);
00148 extern void warning1(char *, ...);
00149
00150 extern int rootBuild;