File indexing completed on 2018-03-02 18:44:42 UTC
view on githubraw file Latest commit c596602b on 2009-04-06 21:17:32 UTC
bf5846c3a1 Ed H*0001 /* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
0002
0003 /*
0004 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
0005 *
0006 * Redistribution and use in source and binary forms, with or without
0007 * modification, are permitted provided that the following conditions
0008 * are met:
0009 *
0010 * 1. Redistributions of source code must retain the above copyright
0011 * notice, this list of conditions and the following disclaimer.
0012 *
0013 * 2. Redistributions in binary form must reproduce the above copyright
0014 * notice, this list of conditions and the following disclaimer in
0015 * the documentation and/or other materials provided with the
0016 * distribution.
0017 *
0018 * 3. The name "Carnegie Mellon University" must not be used to
0019 * endorse or promote products derived from this software without
0020 * prior written permission. For permission or any other legal
0021 * details, please contact
0022 * Office of Technology Transfer
0023 * Carnegie Mellon University
0024 * 5000 Forbes Avenue
0025 * Pittsburgh, PA 15213-3890
0026 * (412) 268-4387, fax: (412) 268-7395
0027 * tech-transfer@andrew.cmu.edu
0028 *
0029 * 4. Redistributions of any form whatsoever must retain the following
0030 * acknowledgment:
0031 * "This product includes software developed by Computing Services
0032 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
0033 *
0034 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
0035 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
0036 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
0037 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0038 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
0039 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
0040 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0041 *
0042 */
0043 /*
0044
0045
0046
0047 Permission is hereby granted, free of charge, to any person obtaining a copy
0048 of this software and associated documentation files (the "Software"), to deal
0049 in the Software without restriction, including without limitation the rights
0050 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0051
0052 furnished to do so, subject to the following conditions:
0053
0054 The above copyright notice and this permission notice shall be included in
0055 all copies or substantial portions of the Software.
0056
0057 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0058 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0059 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0060 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0061 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0062
0063
0064 Except as contained in this notice, the name of the X Consortium shall not be
0065 used in advertising or otherwise to promote the sale, use or other dealings
0066 in this Software without prior written authorization from the X Consortium.
0067
0068
0069
0070 #include <stdio.h>
0071 #include <ctype.h>
0072 #include <sys/types.h>
0073 #include <fcntl.h>
0074 #include <sys/stat.h>
0075
b0867682b1 Ed H*0076 /* === EH3 ===
bf5846c3a1 Ed H*0077 #define MAXDEFINES 512
0078 #define MAXFILES 512
b0867682b1 Ed H*0079 === EH3 === */
59c0e9fb0d Ed H*0080 #define MAXDEFINES 8192
0081 #define MAXFILES 8192
b0867682b1 Ed H*0082 /* === EH3 === */
d5f1e20285 Ed H*0083 #define MAXDIRS 256
bf5846c3a1 Ed H*0084 #define SYMTABINC 10 /* must be > 1 for define() to work right */
0085 #define TRUE 1
0086 #define FALSE 0
0087
0088 /* the following must match the directives table in main.c */
0089 #define IF 0
0090 #define IFDEF 1
0091 #define IFNDEF 2
0092 #define ELSE 3
0093 #define ENDIF 4
0094 #define DEFINE 5
0095 #define UNDEF 6
0096 #define INCLUDE 7
0097 #define LINE 8
0098 #define PRAGMA 9
0099 #define ERROR 10
0100 #define IDENT 11
0101 #define SCCS 12
0102 #define ELIF 13
0103 #define EJECT 14
0104 #define IFFALSE 15 /* pseudo value --- never matched */
0105 #define ELIFFALSE 16 /* pseudo value --- never matched */
0106 #define INCLUDEDOT 17 /* pseudo value --- never matched */
0107 #define IFGUESSFALSE 18 /* pseudo value --- never matched */
0108 #define ELIFGUESSFALSE 19 /* pseudo value --- never matched */
0109
0110 #ifdef DEBUG
0111 extern int _debugmask;
0112 /*
0113 * debug levels are:
0114 *
0115 * 0 show ifn*(def)*,endif
0116 * 1 trace defined/
0117 * 2 show #include
0118 * 3 show #include SYMBOL
0119 * 4-6 unused
0120 */
0121 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
0122 #else
0123 #define debug(level,arg) /**/
0124 #endif /* DEBUG */
0125
0126 typedef unsigned char boolean;
0127
0128 struct symtab {
0129 char *s_name;
0130 char *s_value;
0131 };
0132
0133 struct inclist {
0134 char *i_incstring; /* string from #include line */
0135 char *i_file; /* path name of the include file */
0136 struct inclist **i_list; /* list of files it itself includes */
0137 int i_listlen; /* length of i_list */
0138 struct symtab *i_defs; /* symbol table for this file */
0139 int i_ndefs; /* current # defines */
0140 int i_deflen; /* amount of space in table */
0141 boolean i_defchecked; /* whether defines have been checked */
0142 boolean i_notified; /* whether we have revealed includes */
0143 boolean i_marked; /* whether it's in the makefile */
0144 boolean i_searched; /* whether we have read this */
0145 boolean i_included_sym; /* whether #include SYMBOL was found */
0146 /* Can't use i_list if TRUE */
0147 };
0148
0149 struct filepointer {
0150 char *f_p;
0151 char *f_base;
0152 char *f_end;
0153 long f_len;
0154 long f_line;
0155 };
0156
0157 #ifndef NO_STDLIB_H /* X_NOT_STDC_ENV */
0158 #include <stdlib.h>
0159 #if defined(macII) &&
0160
0161 #endif /* macII */
0162 #else
0163
0164
0165 #endif
0166
0167
0168
c596602bd4 Oliv*0169
bf5846c3a1 Ed H*0170 struct symtab *slookup();
0171 struct symtab *isdefined();
0172 struct symtab *fdefined();
0173 struct filepointer *getfile();
0174 struct inclist *newinclude();
0175 struct inclist *inc_path();
0176
0177 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
0178 extern fatalerr(char *, ...);
0179 extern warning(char *, ...);
0180 extern warning1(char *, ...);
0181 #endif