bump product version to 4.1.6.2
[LibreOffice.git] / soltools / mkdepend / def.h
blobdcb3c1ff923ddfdaa5e3cd44db3e7563af1744bf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
3 /*
5 Copyright (c) 1993, 1994 X Consortium
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
30 #ifndef NO_X11
31 #include <X11/Xosdefs.h>
32 #ifdef WIN32
33 #include <X11/Xw32defs.h>
34 #endif
35 #ifndef SUNOS4
36 #include <X11/Xfuncproto.h>
37 #endif /* SUNOS4 */
38 #endif /* NO_X11 */
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43 #ifndef _MSC_VER
44 #include <unistd.h>
45 #endif
47 #include <ctype.h>
48 #ifndef X_NOT_POSIX
49 #ifndef _POSIX_SOURCE
50 #define _POSIX_SOURCE
51 #endif
52 #endif
53 #include <sys/types.h>
54 #include <fcntl.h>
55 #include <sys/stat.h>
57 #ifndef S_IFDIR
58 #define S_IFDIR 0040000
59 #endif
61 #ifndef S_IFREG
62 #define S_IFREG 0100000
63 #endif
65 #define MAXDEFINES 512
66 #define MAXFILES 65536
68 #define MAXDIRS 64
69 #define SYMHASHSEED 131 /* 131 1313 13131 ... */
70 #define SYMHASHMEMBERS 64 /* must be 2^x to work right */
71 #define TRUE 1
72 #define FALSE 0
74 /* the following must match the directives table in main.c */
75 #define IF 0
76 #define IFDEF 1
77 #define IFNDEF 2
78 #define ELSE 3
79 #define ENDIF 4
80 #define DEFINE 5
81 #define UNDEF 6
82 #define INCLUDE 7
83 #define LINE 8
84 #define PRAGMA 9
85 #define ERROR 10
86 #define IDENT 11
87 #define SCCS 12
88 #define ELIF 13
89 #define EJECT 14
90 #define IFFALSE 15 /* pseudo value --- never matched */
91 #define ELIFFALSE 16 /* pseudo value --- never matched */
92 #define INCLUDEDOT 17 /* pseudo value --- never matched */
93 #define IFGUESSFALSE 18 /* pseudo value --- never matched */
94 #define ELIFGUESSFALSE 19 /* pseudo value --- never matched */
96 #ifdef DEBUG
97 extern int _debugmask;
99 * debug levels are:
101 * 0 show ifn*(def)*,endif
102 * 1 trace defined/!defined
103 * 2 show #include
104 * 3 show #include SYMBOL
105 * 4-6 unused
107 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
108 #else
109 #define debug(level,arg) /**/
110 #endif /* DEBUG */
112 // VG: a C++ class for information about directories
113 #include "collectdircontent.hxx"
115 typedef unsigned char boolean;
117 struct pair {
118 char *p_name;
119 char *p_value;
120 struct pair *p_next;
123 struct symhash {
124 struct pair *s_pairs[SYMHASHMEMBERS];
127 struct inclist {
128 char *i_incstring; /* string from #include line */
129 char *i_file; /* path name of the include file */
130 struct inclist **i_list; /* list of files it itself includes */
131 int i_listlen; /* length of i_list */
132 boolean i_defchecked; /* whether defines have been checked */
133 boolean i_notified; /* whether we have revealed includes */
134 boolean i_marked; /* whether it's in the makefile */
135 boolean i_searched; /* whether we have read this */
136 boolean i_included_sym; /* whether #include SYMBOL was found */
137 /* Can't use i_list if TRUE */
140 struct filepointer {
141 char *f_p;
142 char *f_base;
143 char *f_end;
144 long f_len;
145 long f_line;
148 #ifndef X_NOT_STDC_ENV
149 #include <stdlib.h>
150 #if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
151 char *malloc(), *realloc();
152 #endif /* macII */
153 #else
154 char *malloc();
155 char *realloc();
156 #endif
158 char *copy(char *);
159 char *base_name(char *);
160 char *get_line(struct filepointer *);
161 char *isdefined(char *);
162 struct filepointer *getfile(char *);
163 struct inclist *newinclude(register char *newfile,
164 register char *incstring);
165 struct inclist *inc_path(char *, char *, boolean,
166 struct IncludesCollection *);
168 void define( char *def, struct symhash **symbols );
169 void hash_define(char *name, char * val, struct symhash **symbols);
170 struct symhash *hash_copy( struct symhash *symbols );
171 void hash_free( struct symhash *symbols );
172 void freefile( struct filepointer * fp );
173 int find_includes(struct filepointer *filep, struct inclist *file,
174 struct inclist *file_red, int recursion, boolean failOK,
175 struct IncludesCollection* incCollection, struct symhash *symbols);
176 void included_by(register struct inclist *ip,
177 register struct inclist * newfile);
178 int cppsetup(register char *line,
179 register struct filepointer *filep, register struct inclist *inc);
180 void add_include(struct filepointer *filep, struct inclist *file,
181 struct inclist *file_red, char *include, boolean dot, boolean failOK,
182 struct IncludesCollection* incCollection, struct symhash *symbols);
183 int match(register char *str, register char **list);
184 void recursive_pr_include(register struct inclist *head, register char *file,
185 register char *base);
186 void recursive_pr_dummy(register struct inclist *head, register char *file);
187 void inc_clean();
189 void fatalerr(char *, ...);
190 void warning(char *, ...);
191 void warning1(char *, ...);
193 void convert_slashes(char *);
194 char *append_slash(char *);
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */