Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
def.h
Go to the documentation of this file.
1/* $XConsortium: def.h /main/30 1996/12/04 10:11:12 swick $ */
2/* $XFree86: xc/config/makedepend/def.h,v 3.3 1997/01/12 10:38:17 dawes Exp $ */
3/*
4
5Copyright (c) 1993, 1994 X Consortium
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in
15all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of the X Consortium shall not be
25used in advertising or otherwise to promote the sale, use or other dealings
26in this Software without prior written authorization from the X Consortium.
27
28*/
29
30#ifndef X_NOT_POSIX
31#ifndef _POSIX_SOURCE
32#define _POSIX_SOURCE
33#endif
34#endif
35#if defined(__APPLE__) && !defined(_DARWIN_C_SOURCE)
36#define _DARWIN_C_SOURCE
37#endif
38#include <stdio.h>
39#ifndef X_NOT_STDC_ENV
40#include <string.h>
41#endif
42#include <ctype.h>
43#include <sys/types.h>
44#include <fcntl.h>
45#include <sys/stat.h>
46
47#define MAXFILES 4096
48#define MAXDIRS 4096
49#define SYMTABINC 10 /* must be > 1 for define() to work right */
50#define TRUE 1
51#define FALSE 0
52
53/* the following must match the directives table in main.c */
54#define IF 0
55#define IFDEF 1
56#define IFNDEF 2
57#define ELSE 3
58#define ENDIF 4
59#define DEFINE 5
60#define UNDEF 6
61#define INCLUDE 7
62#define LINE 8
63#define PRAGMA 9
64#define ERROR 10
65#define IDENT 11
66#define SCCS 12
67#define ELIF 13
68#define EJECT 14
69#define WARNING 15
70#define IFFALSE 16 /* pseudo value --- never matched */
71#define ELIFFALSE 17 /* pseudo value --- never matched */
72#define INCLUDEDOT 18 /* pseudo value --- never matched */
73#define IFGUESSFALSE 19 /* pseudo value --- never matched */
74#define ELIFGUESSFALSE 20 /* pseudo value --- never matched */
75
76#ifdef DEBUG
77extern int _debugmask;
78/*
79 * debug levels are:
80 *
81 * 0 show ifn*(def)*,endif
82 * 1 trace defined/!defined
83 * 2 show #include
84 * 3 show #include SYMBOL
85 * 4-6 unused
86 */
87#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
88#else
89#define debug(level,arg) /**/
90#endif /* DEBUG */
91
92typedef unsigned char boolean;
93
94struct symtab {
95 char *s_name;
96 char *s_value;
97};
98
99/* possible i_flag */
100#define DEFCHECKED (1<<0) /* whether defines have been checked */
101#define NOTIFIED (1<<1) /* whether we have revealed includes */
102#define MARKED (1<<2) /* whether it's in the makefile */
103#define SEARCHED (1<<3) /* whether we have read this */
104#define FINISHED (1<<4) /* whether we are done reading this */
105#define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found
106Can't use i_list if TRUE */
107struct inclist {
108char *i_incstring; /* string from #include line */
109char *i_file; /* path name of the include file */
110struct inclist **i_list; /* list of files it itself includes */
111int i_listlen; /* length of i_list */
112struct symtab **i_defs; /* symbol table for this file and its
113children when merged */
114int i_ndefs; /* current # defines */
115boolean *i_merged; /* whether we have merged child
116defines */
117unsigned char i_flags;
118};
121char *f_p;
122char *f_base;
123char *f_end;
124long f_len;
125long f_line;
126};
127
128#ifndef X_NOT_STDC_ENV
129#include <stdlib.h>
130#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
131char *malloc(), *realloc();
132#endif /* macII */
133#else
134char *malloc();
135char *realloc();
136#endif
138char *copy(char*);
139char *base_name(char*);
140char *rgetline(struct filepointer*);
141struct symtab **slookup(char*, struct inclist*);
142struct symtab **isdefined(char*,struct inclist*, struct inclist**);
143struct symtab **fdefined(char *, struct inclist *, struct inclist **);
144struct filepointer *getfile(char*);
145struct inclist *newinclude(char*,char*);
146struct inclist *inc_path(char*, char*, boolean);
147void undefine_all(struct inclist *);
148
149extern void fatalerr(char *, ...);
150extern void warning(char *, ...);
151extern void warning1(char *, ...);
152
153extern int rootBuild;
char boolean
Definition ZInflate.c:223
#define realloc
Definition civetweb.c:1577
#define malloc
Definition civetweb.c:1575
void undefine_all(struct inclist *)
char * copy(char *)
struct inclist * inc_path(char *, char *, boolean)
Definition include.c:234
void warning1(char *,...)
Definition main.c:772
struct symtab ** isdefined(char *, struct inclist *, struct inclist **)
char * rgetline(struct filepointer *)
struct inclist * newinclude(char *, char *)
struct filepointer * getfile(char *)
Definition main.c:525
char * base_name(char *)
struct symtab ** slookup(char *, struct inclist *)
struct symtab ** fdefined(char *, struct inclist *, struct inclist **)
int rootBuild
Definition mainroot.cxx:47
void fatalerr(char *,...)
Definition main.c:751
void warning(char *,...)
Definition main.c:761
long f_line
Definition def.h:124
char * f_base
Definition def.h:121
char * f_p
Definition def.h:120
char * f_end
Definition def.h:122
long f_len
Definition def.h:123
Definition def.h:106
struct symtab ** i_defs
Definition def.h:111
int i_listlen
Definition def.h:110
int i_ndefs
Definition def.h:113
boolean * i_merged
Definition def.h:114
unsigned char i_flags
Definition def.h:116
char * i_incstring
Definition def.h:107
char * i_file
Definition def.h:108
struct inclist ** i_list
Definition def.h:109
Definition def.h:94
char * s_value
Definition def.h:96
char * s_name
Definition def.h:95