OSDN Git Service

fix #37913
[jnethack/source.git] / include / pcconf.h
1 /* NetHack 3.6  pcconf.h        $NHDT-Date: 1432512776 2015/05/25 00:12:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 #ifndef PCCONF_H
6 #define PCCONF_H
7
8 #define MICRO /* always define this! */
9
10 #ifdef MSDOS /* some of this material is MS-DOS specific */
11
12 /*
13  *  Automatic Defines:
14  *
15  *     __GO32__ is defined automatically by the djgpp port of gcc.
16  *     __DJGPP__ is defined automatically by djgpp version 2 and above.
17  *     _MSC_VER is defined automatically by Microsoft C.
18  *     __BORLANDC__ is defined automatically by Borland C.
19  *     __SC__ is defined automatically by Symantec C.
20  *      Note: 3.6.x was not verified with Symantec C.
21  */
22
23 /*
24  *  The following options are somewhat configurable depending on
25  *  your compiler.
26  */
27
28 /*
29  *  For pre-V7.0 Microsoft Compilers only, manually define OVERLAY here.
30  */
31
32 /*#define OVERLAY */ /* Manual overlay definition (MSC 6.0ax only) */
33
34 #ifndef __GO32__
35 #define MFLOPPY /* Support for floppy drives and ramdisks by dgk */
36 #endif
37
38 #define SHELL /* via exec of COMMAND.COM */
39
40 #ifdef __BORLANDC__
41 #define PCMUSIC /* Music option, enable very basic pc speaker music notes */
42 #endif
43
44 /*
45  * Screen control options
46  *
47  * You may uncomment:
48  *                     ANSI_DEFAULT
49  *                or   TERMLIB
50  *                or   ANSI_DEFAULT and TERMLIB
51  *                or   NO_TERMS
52  */
53
54 /* # define TERMLIB */ /* enable use of termcap file /etc/termcap */
55                        /* or ./termcap for MSDOS (SAC) */
56                        /* compile and link in Fred Fish's termcap library, */
57                        /* enclosed in TERMCAP.ARC, to use this */
58
59 /* # define ANSI_DEFAULT */ /* allows NetHack to run without a ./termcap */
60
61 #define NO_TERMS /* Allows Nethack to run without ansi.sys by linking */
62                  /* screen routines into the .exe     */
63
64 #ifdef NO_TERMS     /* if NO_TERMS select one screen package below */
65 #define SCREEN_BIOS /* Use bios calls for all screen control */
66 /* #define SCREEN_DJGPPFAST */ /* Use djgpp fast screen routines        */
67 #endif
68
69 /* # define PC9800 */ /* Allows NetHack to run on NEC PC-9800 machines */
70 /* Yamamoto Keizo */
71
72 /*
73  * PC video hardware support options (for graphical tile support)
74  *
75  * You may uncomment any/all of the options below.
76  *
77  */
78 #ifndef SUPPRESS_GRAPHICS
79 #if (defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)) && !defined(PC9800)
80 #ifdef USE_TILES
81 #define SCREEN_VGA /* Include VGA         graphics routines in the build */
82 #endif
83 #endif
84 #else
85 #undef NO_TERMS
86 #undef SCREEN_BIOS
87 #undef SCREEN_DJGPPFAST
88 #undef SCREEN_VGA
89 #undef TERMLIB
90 #define ANSI_DEFAULT
91 #endif
92
93 #define RANDOM /* have Berkeley random(3) */
94
95 #define MAIL /* Allows for fake mail daemon to deliver mail */
96              /* in the MSDOS version.  (For AMIGA MAIL see  */
97              /* amiconf.h).     In the future this will be the */
98              /* hook for mail reader implementation.        */
99
100 /* The following is needed for prototypes of certain functions */
101
102 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__SC__)
103 #include <process.h> /* Provides prototypes of exit(), spawn()      */
104 #endif
105
106 #if defined(_MSC_VER) && (_MSC_VER >= 7)
107 #include <sys/types.h>
108 #include <stdlib.h>
109 #ifdef strcmpi
110 #undef strcmpi
111 #endif
112 #include <string.h> /* Provides prototypes of strncmpi(), etc.     */
113 #include <conio.h>
114 #include <io.h>
115 #include <direct.h>
116 #define SIG_RET_TYPE void(__cdecl *)(int)
117 #define M(c) ((char) (0x80 | (c)))
118 #define vprintf printf
119 #define vfprintf fprintf
120 #define vsprintf sprintf
121 #endif
122
123 #if defined(__BORLANDC__) && defined(STRNCMPI)
124 #include <string.h> /* Provides prototypes of strncmpi(), etc.     */
125 #endif
126
127 #if defined(__DJGPP__)
128 #define _NAIVE_DOS_REGS
129 #include <stdlib.h>
130 #include <string.h> /* Provides prototypes of strncmpi(), etc.     */
131 #ifndef M
132 #define M(c) ((char) (0x80 | (c)))
133 #endif
134 #endif
135
136 /*
137  * On the VMS and unix, this option controls whether a delay is done by
138  * the clock, or whether it is done by excess output.  On the PC, however,
139  * there is always a clock to use for the delay.  The TIMED_DELAY option
140  * on MSDOS (without the termcap routines) is used to determine whether to
141  * include the delay routines in the code (and thus, provides a compile time
142  * method to turn off napping for visual effect).  However, it is also used
143  * in the music code to wait between different notes.  So it is needed in that
144  * case as well.
145
146  * Whereas on the VMS and unix, flags.nap is a run-time option controlling
147  * whether there is a delay by clock or by excess output, on MSDOS it is
148  * simply a flag to turn on or off napping for visual effects at run-time.
149  */
150
151 #define TIMED_DELAY /* enable the `timed_delay' run-time option */
152
153 #ifdef PCMUSIC
154 #define TIMED_DELAY /* need it anyway */
155 #endif
156 #define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR,      \
157                              LEVELDIR, SAVEDIR, BONESDIR, DATADIR,         \
158                              SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR. \
159                              */
160
161 #endif /* MSDOS configuration stuff */
162
163 #define PATHLEN 64  /* maximum pathlength */
164 #define FILENAME 80 /* maximum filename length (conservative) */
165 #ifndef MICRO_H
166 #include "micro.h" /* contains necessary externs for [os_name].c */
167 #endif
168
169 /* ===================================================
170  *  The remaining code shouldn't need modification.
171  */
172
173 #ifndef SYSTEM_H
174 #if !defined(_MSC_VER)
175 #include "system.h"
176 #endif
177 #endif
178
179 #ifdef __DJGPP__
180 #include <unistd.h> /* close(), etc. */
181 /* lock() in io.h interferes with lock[] in decl.h */
182 #define lock djlock
183 #include <io.h>
184 #undef lock
185 #include <pc.h> /* kbhit() */
186 #define PC_LOCKING
187 #define HOLD_LOCKFILE_OPEN
188 #define SELF_RECOVER /* NetHack itself can recover games */
189 #endif
190
191 #ifdef MSDOS
192 #ifndef EXEPATH
193 #define EXEPATH /* HACKDIR is .exe location if not explicitly defined */
194 #endif
195 #endif
196
197 #if defined(_MSC_VER) && defined(MSDOS)
198 #if (_MSC_VER >= 700) && !defined(FUNCTION_LEVEL_LINKING)
199 #ifndef MOVERLAY
200 #define MOVERLAY /* Microsoft's MOVE overlay system (MSC >= 7.0) */
201 #endif
202 #endif
203 #define PC_LOCKING
204 #endif
205
206 /* Borland Stuff */
207 #if defined(__BORLANDC__)
208 #if defined(__OVERLAY__) && !defined(VROOMM)
209 /* __OVERLAY__ is automatically defined by Borland C if overlay option is on
210  */
211 #define VROOMM /* Borland's VROOMM overlay system */
212 #endif
213 #if !defined(STKSIZ)
214 #define STKSIZ 5 * 1024 /* Use a default of 5K stack for Borland C      */
215                         /* This macro is used in any file that contains */
216                         /* a main() function.                           */
217 #endif
218 #define PC_LOCKING
219 #endif
220
221 #ifdef PC_LOCKING
222 #define HLOCK "NHPERM"
223 #endif
224
225 #ifndef index
226 #define index strchr
227 #endif
228 #ifndef rindex
229 #define rindex strrchr
230 #endif
231
232 #ifndef AMIGA
233 #include <time.h>
234 #endif
235
236 #ifdef RANDOM
237 /* Use the high quality random number routines. */
238 #define Rand() random()
239 #else
240 #define Rand() rand()
241 #endif
242
243 #ifndef TOS
244 #define FCMASK 0660 /* file creation mask */
245 #endif
246
247 #include <fcntl.h>
248
249 #ifdef MSDOS
250 #define TEXTCOLOR                /* */
251 #define PORT_HELP "msdoshlp.txt" /* msdos port specific help file */
252 #endif
253
254 /* Sanity check, do not modify these blocks. */
255
256 /* OVERLAY must be defined with MOVERLAY or VROOMM */
257 #if (defined(MOVERLAY) || defined(VROOMM))
258 #ifndef OVERLAY
259 #define OVERLAY
260 #endif
261 #endif
262
263 #if defined(FUNCTION_LEVEL_LINKING)
264 #define OVERLAY
265 #endif
266
267 #if defined(OVERLAY) && !defined(MOVERLAY) && !defined(VROOMM) \
268     && !defined(FUNCTION_LEVEL_LINKING)
269 #define USE_TRAMPOLI
270 #endif
271
272 #if defined(MSDOS) && defined(NO_TERMS)
273 #ifdef TERMLIB
274 #if defined(_MSC_VER) || defined(__SC__)
275 #pragma message("Warning -- TERMLIB defined with NO_TERMS in pcconf.h")
276 #pragma message("           Forcing undef of TERMLIB")
277 #endif
278 #undef TERMLIB
279 #endif
280 #ifdef ANSI_DEFAULT
281 #if defined(_MSC_VER) || defined(__SC__)
282 #pragma message("Warning -- ANSI_DEFAULT defined with NO_TERMS in pcconf.h")
283 #pragma message("           Forcing undef of ANSI_DEFAULT")
284 #endif
285 #undef ANSI_DEFAULT
286 #endif
287 /* only one screen package is allowed */
288 #if defined(SCREEN_BIOS) && defined(SCREEN_DJGPPFAST)
289 #if defined(_MSC_VER) || defined(__SC__)
290 #pragma message("Warning -- More than one screen package defined in pcconf.h")
291 #endif
292 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__SC__)
293 #if defined(SCREEN_DJGPPFAST)
294 #if defined(_MSC_VER) || defined(__SC__)
295 #pragma message("           Forcing undef of SCREEN_DJGPPFAST")
296 #endif
297 #undef SCREEN_DJGPPFAST /* Can't use djgpp fast with other compilers anyway \
298                            */
299 #endif
300 #else
301 /* djgpp C compiler     */
302 #if defined(SCREEN_BIOS)
303 #undef SCREEN_BIOS
304 #endif
305 #endif
306 #endif
307 #define ASCIIGRAPH
308 #ifdef TEXTCOLOR
309 #define VIDEOSHADES
310 #endif
311 /* SCREEN_8514, SCREEN_VESA are only placeholders presently - sub VGA instead
312  */
313 #if defined(SCREEN_8514) || defined(SCREEN_VESA)
314 #undef SCREEN_8514
315 #undef SCREEN_VESA
316 #define SCREEN_VGA
317 #endif
318 /* Graphical tile sanity checks */
319 #ifdef SCREEN_VGA
320 #define SIMULATE_CURSOR
321 #define POSITIONBAR
322 /* Select appropriate tile file format, and map size */
323 #define PLANAR_FILE
324 #define SMALL_MAP
325 #endif
326 #endif /* End of sanity check block */
327
328 #if defined(MSDOS) && defined(DLB)
329 #define FILENAME_CMP stricmp /* case insensitive */
330 #endif
331
332 #if defined(_MSC_VER) && (_MSC_VER >= 7)
333 #pragma warning(disable : 4131)
334 #pragma warning(disable : 4135)
335 #pragma warning(disable : 4309)
336 #pragma warning(disable : 4746)
337 #pragma warning(disable : 4761)
338 #endif
339
340 #ifdef TIMED_DELAY
341 #ifdef __DJGPP__
342 #define msleep(k) (void) usleep((k) *1000)
343 #endif
344 #ifdef __BORLANDC__
345 #define msleep(k) delay(k)
346 #endif
347 #ifdef __SC__
348 #define msleep(k) (void) usleep((long)((k) *1000))
349 #endif
350 #endif
351
352 #endif /* PCCONF_H */