Remove macII support
[oweals/cde.git] / cde / config / makedepend / def.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: def.h /main/32 1998/03/25 08:17:45 kaleb $ */
24 /*
25
26 Copyright (c) 1993, 1994, 1998 The Open Group.
27
28 All Rights Reserved.
29
30 The above copyright notice and this permission notice shall be included in
31 all copies or substantial portions of the Software.
32
33 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
36 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
37 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
38 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
40 Except as contained in this notice, the name of The Open Group shall not be
41 used in advertising or otherwise to promote the sale, use or other dealings
42 in this Software without prior written authorization from The Open Group.
43
44 */
45
46 #include "Xos.h"
47 #include "Xfuncproto.h"
48 #include <stdio.h>
49 #include <ctype.h>
50 #ifndef X_NOT_POSIX
51 #ifndef _POSIX_SOURCE
52 #define _POSIX_SOURCE
53 #endif
54 #endif
55 #include <sys/types.h>
56 #include <fcntl.h>
57 #include <sys/stat.h>
58
59 #define MAXDEFINES      512
60 #define MAXFILES        1024
61 #define MAXDIRS         64
62 #define SYMTABINC       10      /* must be > 1 for define() to work right */
63 #define TRUE            1
64 #define FALSE           0
65
66 /* the following must match the directives table in main.c */
67 #define IF              0
68 #define IFDEF           1
69 #define IFNDEF          2
70 #define ELSE            3
71 #define ENDIF           4
72 #define DEFINE          5
73 #define UNDEF           6
74 #define INCLUDE         7
75 #define LINE            8
76 #define PRAGMA          9
77 #define ERROR           10
78 #define IDENT           11
79 #define SCCS            12
80 #define ELIF            13
81 #define EJECT           14
82 #define WARNING         15
83 #define IFFALSE         16     /* pseudo value --- never matched */
84 #define ELIFFALSE       17     /* pseudo value --- never matched */
85 #define INCLUDEDOT      18     /* pseudo value --- never matched */
86 #define IFGUESSFALSE    19     /* pseudo value --- never matched */
87 #define ELIFGUESSFALSE  20     /* pseudo value --- never matched */
88
89 #ifdef DEBUG
90 extern int      _debugmask;
91 /*
92  * debug levels are:
93  * 
94  *     0        show ifn*(def)*,endif
95  *     1        trace defined/!defined
96  *     2        show #include
97  *     3        show #include SYMBOL
98  *     4-6      unused
99  */
100 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
101 #else
102 #define debug(level,arg) /**/
103 #endif /* DEBUG */
104
105 typedef unsigned char boolean;
106
107 struct symtab {
108         char    *s_name;
109         char    *s_value;
110 };
111
112 /* possible i_flag */
113 #define DEFCHECKED      (1<<0)  /* whether defines have been checked */
114 #define NOTIFIED        (1<<1)  /* whether we have revealed includes */
115 #define MARKED          (1<<2)  /* whether it's in the makefile */
116 #define SEARCHED        (1<<3)  /* whether we have read this */
117 #define FINISHED        (1<<4)  /* whether we are done reading this */
118 #define INCLUDED_SYM    (1<<5)  /* whether #include SYMBOL was found
119                                    Can't use i_list if TRUE */
120 struct  inclist {
121         char            *i_incstring;   /* string from #include line */
122         char            *i_file;        /* path name of the include file */
123         struct inclist  **i_list;       /* list of files it itself includes */
124         int             i_listlen;      /* length of i_list */
125         struct symtab   **i_defs;       /* symbol table for this file and its
126                                            children when merged */
127         int             i_ndefs;        /* current # defines */
128         boolean         *i_merged;      /* whether we have merged child
129                                            defines */
130         unsigned char   i_flags;
131 };
132
133 struct filepointer {
134         char    *f_p;
135         char    *f_base;
136         char    *f_end;
137         long    f_len;
138         long    f_line;
139 };
140
141 #ifndef X_NOT_STDC_ENV
142 #include <stdlib.h>
143 #else
144 char                    *malloc();
145 char                    *realloc();
146 #endif
147
148 int                     match();
149 char                    *copy();
150 char                    *base_name();
151 char                    *our_getline();
152 struct symtab           **slookup();
153 struct symtab           **isdefined();
154 struct symtab           **fdefined();
155 struct filepointer      *getfile();
156 void                    included_by();
157 struct inclist          *newinclude();
158 void                    inc_clean();
159 struct inclist          *inc_path();
160 void                    freefile();
161 void                    define2();
162 void                    define();
163 int                     find_includes();
164 void                    recursive_pr_include();
165 void                    add_include();
166 int                     cppsetup();
167
168 #if NeedVarargsPrototypes
169 extern void fatalerr(char *, ...);
170 extern void warning(char *, ...);
171 extern void warning1(char *, ...);
172 #endif