Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / soltools / mkdepend / def.h
blobfd3f34691128ff07d8da36e9ae4b5858bb9cfd82
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 #ifndef X_NOT_POSIX
48 #ifndef _POSIX_SOURCE
49 #define _POSIX_SOURCE
50 #endif
51 #endif
52 #include <sys/types.h>
53 #include <fcntl.h>
54 #include <sys/stat.h>
56 #ifndef S_IFDIR
57 #define S_IFDIR 0040000
58 #endif
60 #ifndef S_IFREG
61 #define S_IFREG 0100000
62 #endif
64 #define MAXFILES 65536
66 #define MAXDIRS 64
67 #define SYMHASHSEED 131 /* 131 1313 13131 ... */
68 #define SYMHASHMEMBERS 64 /* must be 2^x to work right */
69 #define TRUE 1
70 #define FALSE 0
72 /* the following must match the directives table in main.c */
73 #define IF 0
74 #define IFDEF 1
75 #define IFNDEF 2
76 #define ELSE 3
77 #define ENDIF 4
78 #define DEFINE 5
79 #define UNDEF 6
80 #define INCLUDE 7
81 #define LINE 8
82 #define PRAGMA 9
83 #define ERROR 10
84 #define IDENT 11
85 #define SCCS 12
86 #define ELIF 13
87 #define EJECT 14
88 #define IFFALSE 15 /* pseudo value --- never matched */
89 #define ELIFFALSE 16 /* pseudo value --- never matched */
90 #define INCLUDEDOT 17 /* pseudo value --- never matched */
91 #define IFGUESSFALSE 18 /* pseudo value --- never matched */
92 #define ELIFGUESSFALSE 19 /* pseudo value --- never matched */
94 #ifdef DEBUG
95 extern int _debugmask;
97 * debug levels are:
99 * 0 show ifn*(def)*,endif
100 * 1 trace defined/!defined
101 * 2 show #include
102 * 3 show #include SYMBOL
103 * 4-6 unused
105 #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
106 #else
107 #define debug(level,arg) /**/
108 #endif /* DEBUG */
110 // VG: a C++ class for information about directories
111 #include "collectdircontent.hxx"
113 typedef unsigned char boolean;
115 struct pair {
116 char *p_name;
117 char *p_value;
118 struct pair *p_next;
121 struct symhash {
122 struct pair *s_pairs[SYMHASHMEMBERS];
125 struct inclist {
126 char *i_incstring; /* string from #include line */
127 char *i_file; /* path name of the include file */
128 struct inclist **i_list; /* list of files it itself includes */
129 int i_listlen; /* length of i_list */
130 boolean i_notified; /* whether we have revealed includes */
131 boolean i_marked; /* whether it's in the makefile */
132 boolean i_searched; /* whether we have read this */
133 boolean i_included_sym; /* whether #include SYMBOL was found */
134 /* Can't use i_list if TRUE */
137 struct filepointer {
138 char *f_p;
139 char *f_base;
140 char *f_end;
141 long f_len;
142 long f_line;
145 #ifndef X_NOT_STDC_ENV
146 #include <stdlib.h>
147 #if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
148 char *malloc(), *realloc();
149 #endif /* macII */
150 #else
151 char *malloc();
152 char *realloc();
153 #endif
155 char *copy(char *);
156 char *base_name(char *);
157 char *get_line(struct filepointer *);
158 char *isdefined(char *);
159 struct filepointer *getfile(char *);
160 struct inclist *newinclude(char *newfile,
161 char *incstring);
162 struct inclist *inc_path(char *, char *, boolean,
163 struct IncludesCollection *);
165 void define( char *def, struct symhash **symbols );
166 void hash_define(char *name, char * val, struct symhash **symbols);
167 struct symhash *hash_copy( struct symhash *symbols );
168 void hash_free( struct symhash *symbols );
169 void freefile( struct filepointer * fp );
170 int find_includes(struct filepointer *filep, struct inclist *file,
171 struct inclist *file_red, int recursion, boolean failOK,
172 struct IncludesCollection* incCollection, struct symhash *symbols);
173 void included_by(struct inclist *ip,
174 struct inclist * newfile);
175 int cppsetup(char *line,
176 struct filepointer *filep, struct inclist *inc);
177 void add_include(struct filepointer *filep, struct inclist *file,
178 struct inclist *file_red, char *include, boolean dot, boolean failOK,
179 struct IncludesCollection* incCollection, struct symhash *symbols);
180 int match(char *str, char **list);
181 void recursive_pr_include(struct inclist *head, char *file,
182 char *base);
183 void recursive_pr_dummy(struct inclist *head, char *file);
184 void inc_clean(void);
186 void fatalerr(char *, ...);
187 void warning(char *, ...);
188 void warning1(char *, ...);
190 void convert_slashes(char *);
191 char *append_slash(char *);
193 extern char * directives[];
195 extern struct inclist * inclistp;
197 extern char * objprefix;
199 extern char * objsuffix;
201 extern boolean printed;
203 extern boolean verbose;
205 extern boolean show_where_not;
207 extern boolean warn_multiple;
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */