security/nss/coreconf/mkdepend/def.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial