VirtualBox

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

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

Initial revision

  • 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#include "Xos.h"
30#include "Xfuncproto.h"
31#include <stdlib.h>
32#include <stdio.h>
33#include <string.h>
34#include <ctype.h>
35#if 0
36#ifndef X_NOT_POSIX
37#ifndef _POSIX_SOURCE
38#define _POSIX_SOURCE
39#endif
40#endif
41#endif
42#include <sys/types.h>
43#include <fcntl.h>
44#include <sys/stat.h>
45
46#define MAXDEFINES 512
47#define MAXFILES 1024
48#define MAXINCFILES 128 /* "-include" files */
49#define MAXDIRS 64
50#define SYMTABINC 10 /* must be > 1 for define() to work right */
51#define TRUE 1
52#define FALSE 0
53
54/* the following must match the directives table in main.c */
55#define IF 0
56#define IFDEF 1
57#define IFNDEF 2
58#define ELSE 3
59#define ENDIF 4
60#define DEFINE 5
61#define UNDEF 6
62#define INCLUDE 7
63#define LINE 8
64#define PRAGMA 9
65#define ERROR 10
66#define IDENT 11
67#define SCCS 12
68#define ELIF 13
69#define EJECT 14
70#define WARNING 15
71#define INCLUDENEXT 16
72#define IFFALSE 17 /* pseudo value --- never matched */
73#define ELIFFALSE 18 /* pseudo value --- never matched */
74#define INCLUDEDOT 19 /* pseudo value --- never matched */
75#define IFGUESSFALSE 20 /* pseudo value --- never matched */
76#define ELIFGUESSFALSE 21 /* pseudo value --- never matched */
77#define INCLUDENEXTDOT 22 /* pseudo value --- never matched */
78
79#ifdef DEBUG
80extern int _debugmask;
81/*
82 * debug levels are:
83 *
84 * 0 show ifn*(def)*,endif
85 * 1 trace defined/!defined
86 * 2 show #include
87 * 3 show #include SYMBOL
88 * 4-6 unused
89 */
90#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
91#else
92#define debug(level,arg) /**/
93#endif /* DEBUG */
94
95typedef unsigned char boolean;
96
97struct symtab {
98 char *s_name;
99 char *s_value;
100};
101
102/* possible i_flag */
103#define DEFCHECKED (1<<0) /* whether defines have been checked */
104#define NOTIFIED (1<<1) /* whether we have revealed includes */
105#define MARKED (1<<2) /* whether it's in the makefile */
106#define SEARCHED (1<<3) /* whether we have read this */
107#define FINISHED (1<<4) /* whether we are done reading this */
108#define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found
109 Can't use i_list if TRUE */
110struct inclist {
111 char *i_incstring; /* string from #include line */
112 char *i_file; /* path name of the include file */
113 struct inclist **i_list; /* list of files it itself includes */
114 int i_listlen; /* length of i_list */
115 struct symtab **i_defs; /* symbol table for this file and its
116 children when merged */
117 int i_ndefs; /* current # defines */
118 boolean *i_merged; /* whether we have merged child
119 defines */
120 unsigned char i_flags;
121};
122
123struct filepointer {
124 char *f_name;
125 char *f_p;
126 char *f_base;
127 char *f_end;
128 long f_len;
129 long f_line;
130 long cmdinc_count;
131 char **cmdinc_list;
132 long cmdinc_line;
133};
134
135#include <stdlib.h>
136#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
137char *malloc(), *realloc();
138#endif /* macII */
139
140char *copy(char *str);
141int match(char *str, char **list);
142char *base_name(char *file);
143char *getnextline(struct filepointer *fp);
144struct symtab **slookup(char *symbol, struct inclist *file);
145struct symtab **isdefined(char *symbol, struct inclist *file,
146 struct inclist **srcfile);
147struct symtab **fdefined(char *symbol, struct inclist *file,
148 struct inclist **srcfile);
149struct filepointer *getfile(char *file);
150void included_by(struct inclist *ip,
151 struct inclist *newfile);
152struct inclist *newinclude(char *newfile, char *incstring);
153void inc_clean (void);
154struct inclist *inc_path(char *file, char *include, int type);
155
156void freefile(struct filepointer *fp);
157
158void define2(char *name, char *val, struct inclist *file);
159void define(char *def, struct inclist *file);
160void undefine(char *symbol, struct inclist *file);
161int find_includes(struct filepointer *filep,
162 struct inclist *file,
163 struct inclist *file_red,
164 int recursion, boolean failOK);
165
166void recursive_pr_include(struct inclist *head,
167 char *file, char *base);
168void add_include(struct filepointer *filep,
169 struct inclist *file,
170 struct inclist *file_red,
171 char *include, int type,
172 boolean failOK);
173
174int cppsetup(char *filename,
175 char *line,
176 struct filepointer *filep,
177 struct inclist *inc);
178
179
180extern void fatalerr(char *, ...);
181extern void warning(char *, ...);
182extern 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