VirtualBox

source: kBuild/trunk/src/makedep/def.h@ 199

Last change on this file since 199 was 168, checked in by bird, 20 years ago

Merged in mozilla changes and config.

  • Property svn:eol-style set to native
File size: 5.8 KB
Line 
1/* $Xorg: def.h,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
2/*
3
4Copyright (c) 1993, 1994, 1998 The Open Group.
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25
26*/
27/* $XFree86: xc/config/makedepend/def.h,v 3.13tsi Exp $ */
28
29#ifndef NO_X11 /* from mozilla */
30#include "X11/Xos.h"
31#include "X11/Xfuncproto.h"
32#endif
33#include <stdlib.h>
34#include <stdio.h>
35#include <string.h>
36#include <ctype.h>
37#if 0
38#ifndef X_NOT_POSIX
39#ifndef _POSIX_SOURCE
40#define _POSIX_SOURCE
41#endif
42#endif
43#endif
44#include <sys/types.h>
45#include <fcntl.h>
46#include <sys/stat.h>
47
48#define MAXDEFINES 512
49#define MAXFILES 1024
50#define MAXINCFILES 128 /* "-include" files */
51#define MAXDIRS 64
52#define SYMTABINC 10 /* must be > 1 for define() to work right */
53#define TRUE 1
54#define FALSE 0
55
56/* the following must match the directives table in main.c */
57#define IF 0
58#define IFDEF 1
59#define IFNDEF 2
60#define ELSE 3
61#define ENDIF 4
62#define DEFINE 5
63#define UNDEF 6
64#define INCLUDE 7
65#define LINE 8
66#define PRAGMA 9
67#define ERROR 10
68#define IDENT 11
69#define SCCS 12
70#define ELIF 13
71#define EJECT 14
72#define WARNING 15
73#define INCLUDENEXT 16
74#define IFFALSE 17 /* pseudo value --- never matched */
75#define ELIFFALSE 18 /* pseudo value --- never matched */
76#define INCLUDEDOT 19 /* pseudo value --- never matched */
77#define IFGUESSFALSE 20 /* pseudo value --- never matched */
78#define ELIFGUESSFALSE 21 /* pseudo value --- never matched */
79#define INCLUDENEXTDOT 22 /* pseudo value --- never matched */
80
81#ifdef DEBUG
82extern int _debugmask;
83/*
84 * debug levels are:
85 *
86 * 0 show ifn*(def)*,endif
87 * 1 trace defined/!defined
88 * 2 show #include
89 * 3 show #include SYMBOL
90 * 4-6 unused
91 */
92#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
93#else
94#define debug(level,arg) /**/
95#endif /* DEBUG */
96
97typedef unsigned char boolean;
98
99struct symtab {
100 char *s_name;
101 char *s_value;
102};
103
104/* possible i_flag */
105#define DEFCHECKED (1<<0) /* whether defines have been checked */
106#define NOTIFIED (1<<1) /* whether we have revealed includes */
107#define MARKED (1<<2) /* whether it's in the makefile */
108#define SEARCHED (1<<3) /* whether we have read this */
109#define FINISHED (1<<4) /* whether we are done reading this */
110#define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found
111 Can't use i_list if TRUE */
112struct inclist {
113 char *i_incstring; /* string from #include line */
114 char *i_file; /* path name of the include file */
115 struct inclist **i_list; /* list of files it itself includes */
116 int i_listlen; /* length of i_list */
117 struct symtab **i_defs; /* symbol table for this file and its
118 children when merged */
119 int i_ndefs; /* current # defines */
120 boolean *i_merged; /* whether we have merged child
121 defines */
122 unsigned char i_flags;
123};
124
125struct filepointer {
126 char *f_name;
127 char *f_p;
128 char *f_base;
129 char *f_end;
130 long f_len;
131 long f_line;
132 long cmdinc_count;
133 char **cmdinc_list;
134 long cmdinc_line;
135};
136
137#include <stdlib.h>
138#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
139char *malloc(), *realloc();
140#endif /* macII */
141
142char *copy(char *str);
143int match(char *str, char **list);
144char *base_name(char *file);
145char *getnextline(struct filepointer *fp);
146struct symtab **slookup(char *symbol, struct inclist *file);
147struct symtab **isdefined(char *symbol, struct inclist *file,
148 struct inclist **srcfile);
149struct symtab **fdefined(char *symbol, struct inclist *file,
150 struct inclist **srcfile);
151struct filepointer *getfile(char *file);
152void included_by(struct inclist *ip,
153 struct inclist *newfile);
154struct inclist *newinclude(char *newfile, char *incstring);
155void inc_clean (void);
156struct inclist *inc_path(char *file, char *include, int type);
157
158void freefile(struct filepointer *fp);
159
160void define2(char *name, char *val, struct inclist *file);
161void define(char *def, struct inclist *file);
162void undefine(char *symbol, struct inclist *file);
163int find_includes(struct filepointer *filep,
164 struct inclist *file,
165 struct inclist *file_red,
166 int recursion, boolean failOK);
167
168void recursive_pr_include(struct inclist *head,
169 char *file, char *base);
170void add_include(struct filepointer *filep,
171 struct inclist *file,
172 struct inclist *file_red,
173 char *include, int type,
174 boolean failOK);
175
176int cppsetup(char *filename,
177 char *line,
178 struct filepointer *filep,
179 struct inclist *inc);
180
181
182extern void fatalerr(char *, ...);
183extern void warning(char *, ...);
184extern void warning1(char *, ...);
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette