cosmetix in 'maxline'
[k8jam.git] / src / jam.h
blobf1b1705290ff3088ca65e532ed5e1a6c777d0090
1 /*
2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6 /*
7 * jam.h - includes and globals for jam
9 * 04/08/94 (seiwald) - Coherent/386 support added.
10 * 04/21/94 (seiwald) - DGUX is __DGUX__, not just __DGUX.
11 * 05/04/94 (seiwald) - new globs.jobs (-j jobs)
12 * 11/01/94 (wingerd) - let us define path of Jambase at compile time.
13 * 12/30/94 (wingerd) - changed command buffer size for NT (MS-DOS shell).
14 * 02/22/95 (seiwald) - Jambase now in /usr/local/lib.
15 * 04/30/95 (seiwald) - FreeBSD added. Live Free or Die.
16 * 05/10/95 (seiwald) - SPLITPATH character set up here.
17 * 08/20/95 (seiwald) - added LINUX.
18 * 08/21/95 (seiwald) - added NCR.
19 * 10/23/95 (seiwald) - added SCO.
20 * 01/03/96 (seiwald) - SINIX (nixdorf) added.
21 * 03/13/96 (seiwald) - Jambase now compiled in; remove JAMBASE variable.
22 * 04/29/96 (seiwald) - AIX now has 31 and 42 OSVERs.
23 * 11/21/96 (peterk) - added BeOS with MW CW mwcc
24 * 12/21/96 (seiwald) - OSPLAT now defined for NT.
25 * 07/19/99 (sickel) - Mac OS X Server and Client support added
26 * 02/22/01 (seiwald) - downshift paths on case-insensitive macintosh
27 * 03/23/01 (seiwald) - VMS C++ changes.
28 * 10/29/01 (brett) - More IA64 ifdefs for MS.
29 * 02/18/00 (belmonte)- Support for Cygwin.
30 * 09/12/00 (seiwald) - OSSYMS split to OSMAJOR/OSMINOR/OSPLAT
31 * 12/29/00 (seiwald) - OSVER dropped.
32 * 01/21/02 (seiwald) - new -q to quit quickly on build failure
33 * 03/16/02 (seiwald) - support for -g (reorder builds by source time)
34 * 03/20/02 (seiwald) - MINGW porting from Max Blagai
35 * 08/16/02 (seiwald) - BEOS porting from Ingo Weinhold
36 * 09/19/02 (seiwald) - new -d displays
37 * 11/05/02 (seiwald) - OSPLAT now set to sparc on solaris.
39 #ifndef JAMH_MAIN_H
40 #define JAMH_MAIN_H
42 #if defined(__GNUC__) && __GNUC__ > 2
43 # define JAMFA_PURE __attribute__((pure))
44 # define JAMFA_CONST __attribute__((const))
45 # define JAMFA_NORETURN __attribute__((noreturn))
46 # define JAMFA_PRINTF(m,n) __attribute__((format(printf, m, n)))
47 # define JAMFA_SENTINEL __attribute__((sentinel))
48 #else
49 # define JAMFA_PURE
50 # define JAMFA_CONST
51 # define JAMFA_NORETURN
52 # define JAMFA_PRINTF(m,n)
53 # define JAMFA_SENTINEL
54 #endif
57 /* Windows NT */
58 #ifdef NT
59 # include <fcntl.h>
60 # include <stdlib.h>
61 # include <stdio.h>
62 # include <ctype.h>
63 # include <malloc.h>
64 # include <memory.h>
65 # include <signal.h>
66 # include <string.h>
67 # include <time.h>
68 # define OSMAJOR "NT=true"
69 # define OSMINOR "OS=NT"
70 # define OS_NT
71 # define SPLITPATH ';'
72 # define MAXLINE 2046 /* longest 'together' actions */
73 /*# define USE_EXECNT*/
74 # define PATH_DELIM '\\'
75 # define DOWNSHIFT_PATHS
76 #endif
79 /* Windows MingW32 */
80 #ifdef MINGW
81 # include <fcntl.h>
82 # include <stdlib.h>
83 # include <stdio.h>
84 # include <ctype.h>
85 # include <malloc.h>
86 # include <memory.h>
87 # include <signal.h>
88 # include <string.h>
89 # include <time.h>
90 # define OSMAJOR "MINGW=true"
91 # define OSMINOR "OS=MINGW"
92 # define OS_NT
93 # define SPLITPATH ';'
94 # define MAXLINE 2046 /* longest 'together' actions */
95 # define PATH_DELIM '\\'
96 # define DOWNSHIFT_PATHS
97 #endif
100 /* God fearing UNIX */
101 #ifndef OSMINOR
102 # define OSMAJOR "UNIX=true"
103 # define USE_FILEUNIX
104 # define PATH_DELIM '/'
105 # ifdef __FreeBSD__
106 # define OSMINOR "OS=FREEBSD"
107 # define OS_FREEBSD
108 # endif
109 # ifdef linux
110 # define OSMINOR "OS=LINUX"
111 # define OS_LINUX
112 # endif
113 # ifdef __NetBSD__
114 # define unix
115 # define OSMINOR "OS=NETBSD"
116 # define OS_NETBSD
117 # define NO_VFORK
118 # endif
119 # ifdef __QNX__
120 # ifdef __QNXNTO__
121 # define OSMINOR "OS=QNXNTO"
122 # define OS_QNXNTO
123 # else
124 # define unix
125 # define OSMINOR "OS=QNX"
126 # define OS_QNX
127 # define NO_VFORK
128 # define MAXLINE 996
129 # endif
130 # endif
131 # ifdef __APPLE__
132 # define unix
133 # define OSMINOR "OS=MACOSX"
134 # define OS_MACOSX
135 # endif
136 # ifndef OSMINOR
137 # define OSMINOR "OS=UNKNOWN"
138 # endif
139 /* All the UNIX includes */
140 # include <sys/types.h>
141 # include <sys/stat.h>
142 # include <sys/file.h>
143 # include <fcntl.h>
144 # include <stdio.h>
145 # include <ctype.h>
146 # include <signal.h>
147 # include <string.h>
148 # include <time.h>
149 # ifndef OS_QNX
150 # include <memory.h>
151 # endif
152 # include <stdlib.h>
153 # if !defined(OS_FREEBSD) && !defined(OS_MACOSX)
154 # include <malloc.h>
155 # endif
156 # include <sys/types.h>
157 # include <sys/wait.h>
158 # include <unistd.h>
159 #endif
162 /* OSPLAT definitions - suppressed when it's a one-of-a-kind */
163 #if defined(_M_PPC) || \
164 defined(PPC) || \
165 defined(ppc) || \
166 defined(__powerpc__) || \
167 defined(__POWERPC__) || \
168 defined(__ppc__)
169 # define OSPLAT "OSPLAT=PPC"
170 #endif
172 #if defined(_i386_) || \
173 defined(__i386__) || \
174 defined(_M_IX86)
175 # if !defined(OS_FREEBSD)
176 # define OSPLAT "OSPLAT=X86"
177 # endif
178 #endif
180 #if defined(__x86_64__)
181 # ifdef OSPLAT
182 # undef OSPLAT
183 # endif
184 # define OSPLAT "OSPLAT=X86_64"
185 #endif
187 #ifdef __sparc__
188 # define OSPLAT "OSPLAT=SPARC"
189 #endif
191 #ifdef __mips__
192 # define OSPLAT "OSPLAT=MIPS"
193 #endif
195 #ifdef __arm__
196 # define OSPLAT "OSPLAT=ARM"
197 #endif
199 #if defined(__ia64__) || defined(__IA64__) || defined(_M_IA64)
200 # define OSPLAT "OSPLAT=IA64"
201 #endif
203 #ifdef __s390__
204 # define OSPLAT "OSPLAT=390"
205 #endif
207 #ifndef OSPLAT
208 # define OSPLAT ""
209 #endif
212 /* Jam implementation misc. */
213 /* longest 'together' actions' */
214 #ifndef MAXLINE
215 # define MAXLINE (10240)
216 #endif
218 #ifndef EXITOK
219 # define EXITOK (0)
220 # define EXITBAD (1)
221 #endif
223 #ifndef SPLITPATH
224 # define SPLITPATH ':'
225 #endif
228 /* You probably don't need to muck with these. */
229 #define MAXJPATH (8192) /* longest filename */
231 #define MAXJOBS (64) /* silently enforce -j limit */
232 #define MAXARGC (32) /* words in $(JAMSHELL) */
235 /* Jam private definitions below. */
236 #define DEBUG_MAX (16)
238 struct globs {
239 int noexec;
240 int jobs;
241 int quitquick;
242 int newestfirst; /* build newest sources first */
243 char debug[DEBUG_MAX];
244 FILE *cmdout; /* print cmds, not run them */
245 //#ifdef OPT_IMPROVED_PROGRESS_EXT
246 int updating; /* # targets we are updating */
247 void *progress; /* progress data (progress.h) */
248 //#endif
251 extern struct globs globs;
254 #define DEBUG_MAKE (globs.debug[1]) /* -da show actions when executed */
255 #define DEBUG_MAKEPROG (globs.debug[3]) /* -dm show progress of make0 */
257 #define DEBUG_EXECCMD (globs.debug[4]) /* show execcmds()'s work */
259 #define DEBUG_COMPILE (globs.debug[5]) /* show rule invocations */
261 #define DEBUG_HEADER (globs.debug[6]) /* show result of header scan */
262 #define DEBUG_BINDSCAN (globs.debug[6]) /* show result of dir scan */
263 #define DEBUG_SEARCH (globs.debug[6]) /* show attempts at binding */
265 #define DEBUG_VARSET (globs.debug[7]) /* show variable settings */
266 #define DEBUG_VARGET (globs.debug[8]) /* show variable fetches */
267 #define DEBUG_VAREXP (globs.debug[8]) /* show variable expansions */
268 #define DEBUG_IF (globs.debug[8]) /* show 'if' calculations */
269 #define DEBUG_LISTS (globs.debug[9]) /* show list manipulation */
270 #define DEBUG_MEM (globs.debug[9]) /* show memory use */
272 #define DEBUG_MAKEQ (globs.debug[11]) /* -da show even quiet actions */
273 #define DEBUG_EXEC (globs.debug[12]) /* -dx show text of actions */
274 #define DEBUG_DEPENDS (globs.debug[13]) /* -dd show dependency graph */
275 #define DEBUG_CAUSES (globs.debug[14]) /* -dc show dependency graph */
276 #define DEBUG_SCAN (globs.debug[15]) /* show scanner tokens */
279 extern void jambase_unpack (void);
282 #define JAM_OPT_SEMAPHORE
285 /******************************************************************************/
286 #include "re9.h"
289 typedef struct {
290 const char *restr; /* regexp string; DON'T DELETE, DON'T MOVE, DON'T CHANGE! */
291 re9_prog_t *re; /* compiled regexp */
292 int flags; /* flags for re9_execute() */
293 /*REGEXP9_DEBUG_MEMSIZE*/
294 int maxmem;
295 } regexp_t;
299 * regexp options:
300 * i: ignore case
301 * u: this is utf-8 string
302 * m: '.' matches newline
303 * default mode: non-utf-8 (it can be only reset with /.../u)
305 extern regexp_t *regexp_compile (const char *str, int flags);
306 extern int regexp_execute (regexp_t *re, const char *bol, re9_sub_t *mp, int ms);
307 extern void regexp_free (regexp_t *re);
308 extern void regexp_done (void);
311 #endif