option.c: fixed warnings
[k8jam.git] / src / jam.h
blob266b07ce4e5dcd8d98ed4d98832ee56c7720dc1a
1 /*
2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
3 * This file is part of Jam - see jam.c for Copyright information.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3 of the License ONLY.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * jam.h - includes and globals for jam
20 #ifndef JAMH_MAIN_H
21 #define JAMH_MAIN_H
23 #if defined(__GNUC__) && __GNUC__ > 2
24 # define JAMFA_PURE __attribute__((pure))
25 # define JAMFA_CONST
26 # define JAMFA_NORETURN __attribute__((noreturn))
27 # define JAMFA_PRINTF(m,n) __attribute__((format(printf, m, n)))
28 # define JAMFA_SENTINEL __attribute__((sentinel))
29 #else
30 # define JAMFA_PURE
31 # define JAMFA_CONST
32 # define JAMFA_NORETURN
33 # define JAMFA_PRINTF(m,n)
34 # define JAMFA_SENTINEL
35 #endif
38 /* Windows NT */
39 #ifdef NT
40 # include <fcntl.h>
41 # include <stdlib.h>
42 # include <stdio.h>
43 # include <ctype.h>
44 # include <malloc.h>
45 # include <memory.h>
46 # include <signal.h>
47 # include <string.h>
48 # include <time.h>
49 # define OSMAJOR "NT=true"
50 # define OSMINOR "OS=NT"
51 # define OS_NT
52 # define SPLITPATH ';'
53 # define MAXLINE 2046 /* longest 'together' actions */
54 /*# define USE_EXECNT*/
55 # define PATH_DELIM '\\'
56 # define DOWNSHIFT_PATHS
57 #endif
60 /* Windows MingW32 */
61 #ifdef MINGW
62 # include <fcntl.h>
63 # include <stdlib.h>
64 # include <stdio.h>
65 # include <ctype.h>
66 # include <malloc.h>
67 # include <memory.h>
68 # include <signal.h>
69 # include <string.h>
70 # include <time.h>
71 # define OSMAJOR "MINGW=true"
72 # define OSMINOR "OS=MINGW"
73 # define OS_NT
74 # define SPLITPATH ';'
75 # define MAXLINE 2046 /* longest 'together' actions */
76 # define PATH_DELIM '\\'
77 # define DOWNSHIFT_PATHS
78 #endif
81 /* God fearing UNIX */
82 #ifndef OSMINOR
83 # define OSMAJOR "UNIX=true"
84 # define USE_FILEUNIX
85 # define PATH_DELIM '/'
86 # ifdef __FreeBSD__
87 # define OSMINOR "OS=FREEBSD"
88 # define OS_FREEBSD
89 # endif
90 # ifdef linux
91 # define OSMINOR "OS=LINUX"
92 # define OS_LINUX
93 # endif
94 # ifdef __NetBSD__
95 # define unix
96 # define OSMINOR "OS=NETBSD"
97 # define OS_NETBSD
98 # define NO_VFORK
99 # endif
100 # ifdef __QNX__
101 # ifdef __QNXNTO__
102 # define OSMINOR "OS=QNXNTO"
103 # define OS_QNXNTO
104 # else
105 # define unix
106 # define OSMINOR "OS=QNX"
107 # define OS_QNX
108 # define NO_VFORK
109 # define MAXLINE 996
110 # endif
111 # endif
112 # ifdef __APPLE__
113 # define unix
114 # define OSMINOR "OS=MACOSX"
115 # define OS_MACOSX
116 # endif
117 # ifdef _AIX
118 # define OSMINOR "OS=AIX"
119 # endif
120 # ifndef OSMINOR
121 # define OSMINOR "OS=UNKNOWN"
122 # endif
123 /* All the UNIX includes */
124 # include <sys/types.h>
125 # include <sys/stat.h>
126 # include <sys/file.h>
127 # include <fcntl.h>
128 # include <stdio.h>
129 # include <ctype.h>
130 # include <signal.h>
131 # include <string.h>
132 # include <time.h>
133 # ifndef OS_QNX
134 # include <memory.h>
135 # endif
136 # include <stdlib.h>
137 # if !defined(OS_FREEBSD) && !defined(OS_MACOSX)
138 # include <malloc.h>
139 # endif
140 # include <sys/types.h>
141 # include <sys/wait.h>
142 # include <unistd.h>
143 #endif
146 /* OSPLAT definitions - suppressed when it's a one-of-a-kind */
147 #if defined(_M_PPC) || \
148 defined(PPC) || \
149 defined(ppc) || \
150 defined(__powerpc__) || \
151 defined(__POWERPC__) || \
152 defined(__ppc__)
153 # define OSPLAT "OSPLAT=PPC"
154 #endif
156 #if defined(_i386_) || \
157 defined(__i386__) || \
158 defined(_M_IX86)
159 # if !defined(OS_FREEBSD)
160 # define OSPLAT "OSPLAT=X86"
161 # endif
162 #endif
164 #if defined(__x86_64__)
165 # ifdef OSPLAT
166 # undef OSPLAT
167 # endif
168 # define OSPLAT "OSPLAT=X86_64"
169 #endif
171 #ifdef __sparc__
172 # define OSPLAT "OSPLAT=SPARC"
173 #endif
175 #ifdef __mips__
176 # define OSPLAT "OSPLAT=MIPS"
177 #endif
179 #ifdef __arm__
180 # define OSPLAT "OSPLAT=ARM"
181 #endif
183 #if defined(__ia64__) || defined(__IA64__) || defined(_M_IA64)
184 # define OSPLAT "OSPLAT=IA64"
185 #endif
187 #ifdef __s390__
188 # define OSPLAT "OSPLAT=390"
189 #endif
191 #if defined(__ppc64__)
192 # ifdef OSPLAT
193 # undef OSPLAT
194 # endif
195 # define OSPLAT "OSPLAT=PPC64"
196 #endif
198 #ifndef OSPLAT
199 # define OSPLAT ""
200 #endif
203 /* Jam implementation misc. */
204 /* longest 'together' actions' */
205 #ifndef MAXLINE
206 # define MAXLINE (10240)
207 #endif
209 #ifndef EXITOK
210 # define EXITOK (0)
211 # define EXITBAD (1)
212 #endif
214 #ifndef SPLITPATH
215 # define SPLITPATH ':'
216 #endif
219 /* You probably don't need to muck with these. */
220 #define MAXJPATH (8192) /* longest filename */
222 #define MAXJOBS (64) /* silently enforce -j limit */
223 #define MAXARGC (32) /* words in $(JAMSHELL) */
226 /* Jam private definitions below. */
227 #define DEBUG_MAX (16)
229 struct globs {
230 int noexec;
231 int jobs;
232 int quitquick;
233 int newestfirst; /* build newest sources first */
234 char debug[DEBUG_MAX];
235 FILE *cmdout; /* print cmds, not run them */
236 //#ifdef OPT_IMPROVED_PROGRESS_EXT
237 int updating; /* # targets we are updating */
238 void *progress; /* progress data (progress.h) */
239 //#endif
242 extern struct globs globs;
245 #define DEBUG_MAKE (globs.debug[1]) /* -da show actions when executed */
246 #define DEBUG_MAKEPROG (globs.debug[3]) /* -dm show progress of make0 */
248 #define DEBUG_EXECCMD (globs.debug[4]) /* show execcmds()'s work */
250 #define DEBUG_COMPILE (globs.debug[5]) /* show rule invocations */
252 #define DEBUG_HEADER (globs.debug[6]) /* show result of header scan */
253 #define DEBUG_BINDSCAN (globs.debug[6]) /* show result of dir scan */
254 #define DEBUG_SEARCH (globs.debug[6]) /* show attempts at binding */
256 #define DEBUG_VARSET (globs.debug[7]) /* show variable settings */
257 #define DEBUG_VARGET (globs.debug[8]) /* show variable fetches */
258 #define DEBUG_VAREXP (globs.debug[8]) /* show variable expansions */
259 #define DEBUG_IF (globs.debug[8]) /* show 'if' calculations */
260 #define DEBUG_LISTS (globs.debug[9]) /* show list manipulation */
261 #define DEBUG_MEM (globs.debug[9]) /* show memory use */
263 #define DEBUG_MAKEQ (globs.debug[11]) /* -da show even quiet actions */
264 #define DEBUG_EXEC (globs.debug[12]) /* -dx show text of actions */
265 #define DEBUG_DEPENDS (globs.debug[13]) /* -dd show dependency graph */
266 #define DEBUG_CAUSES (globs.debug[14]) /* -dc show dependency graph */
267 #define DEBUG_SCAN (globs.debug[15]) /* show scanner tokens */
270 extern void jambase_unpack (void);
273 #define JAM_OPT_SEMAPHORE
276 /******************************************************************************/
277 #include "re9.h"
280 typedef struct {
281 const char *restr; /* regexp string; DON'T DELETE, DON'T MOVE, DON'T CHANGE! */
282 re9_prog_t *re; /* compiled regexp */
283 int flags; /* flags for re9_execute() */
284 /*REGEXP9_DEBUG_MEMSIZE*/
285 int maxmem;
286 } regexp_t;
290 * regexp options:
291 * i: ignore case
292 * u: this is utf-8 string
293 * m: '.' matches newline
294 * default mode: non-utf-8 (it can be only reset with /.../u)
296 extern regexp_t *regexp_compile (const char *str, int flags);
297 extern int regexp_execute (regexp_t *re, const char *bol, re9_sub_t *mp, int ms);
298 extern void regexp_free (regexp_t *re);
299 extern void regexp_done (void);
302 #endif