def.h

Go to the documentation of this file.
00001 /* $XConsortium: def.h /main/30 1996/12/04 10:11:12 swick $ */
00002 /* $XFree86: xc/config/makedepend/def.h,v 3.3 1997/01/12 10:38:17 dawes Exp $ */
00003 /*
00004 
00005 Copyright (c) 1993, 1994  X Consortium
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00020 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 
00024 Except as contained in this notice, the name of the X Consortium shall not be
00025 used in advertising or otherwise to promote the sale, use or other dealings
00026 in this Software without prior written authorization from the X Consortium.
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 /* must be > 1 for define() to work right */
00047 #define TRUE      1
00048 #define FALSE     0
00049 
00050 /* the following must match the directives table in main.c */
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     /* pseudo value --- never matched */
00068 #define ELIFFALSE       17     /* pseudo value --- never matched */
00069 #define INCLUDEDOT      18     /* pseudo value --- never matched */
00070 #define IFGUESSFALSE    19     /* pseudo value --- never matched */
00071 #define ELIFGUESSFALSE  20     /* pseudo value --- never matched */
00072 
00073 #ifdef DEBUG
00074 extern int _debugmask;
00075 /*
00076  * debug levels are:
00077  *
00078  *     0 show ifn*(def)*,endif
00079  *     1 trace defined/!defined
00080  *     2 show #include
00081  *     3 show #include SYMBOL
00082  *     4-6 unused
00083  */
00084 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
00085 #else
00086 #define debug(level,arg) /**/
00087 #endif /* DEBUG */
00088 
00089 typedef unsigned char boolean;
00090 
00091 struct symtab {
00092    char *s_name;
00093    char *s_value;
00094 };
00095 
00096 /* possible i_flag */
00097 #define DEFCHECKED (1<<0) /* whether defines have been checked */
00098 #define NOTIFIED (1<<1) /* whether we have revealed includes */
00099 #define MARKED  (1<<2) /* whether it's in the makefile */
00100 #define SEARCHED (1<<3) /* whether we have read this */
00101 #define FINISHED (1<<4) /* whether we are done reading this */
00102 #define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found
00103 Can't use i_list if TRUE */
00104 struct inclist {
00105 char  *i_incstring; /* string from #include line */
00106 char  *i_file; /* path name of the include file */
00107 struct inclist **i_list; /* list of files it itself includes */
00108 int  i_listlen; /* length of i_list */
00109 struct symtab **i_defs; /* symbol table for this file and its
00110 children when merged */
00111 int  i_ndefs; /* current # defines */
00112 boolean  *i_merged;      /* whether we have merged child
00113 defines */
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__)  /* stdlib.h fails to define these */
00128 char *malloc(), *realloc();
00129 #endif /* macII */
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;

Generated on Tue Jul 5 14:10:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1