OSDN Git Service

upgrade to 3.6.2
[jnethack/source.git] / include / wceconf.h
1 /* NetHack 3.6  wceconf.h       $NHDT-Date: 1432512776 2015/05/25 00:12:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */
2 /* Copyright (C) 2001 by Alex Kompel     */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 #ifndef WCECONF_H
6 #define WCECONF_H
7
8 #pragma warning(disable : 4142) /* benign redefinition of type */
9
10 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
11
12 #include <windows.h>
13
14 /* Detect the target device */
15 #if defined(WIN32_PLATFORM_PSPC)
16 #if _WIN32_WCE >= 300
17 #define WIN_CE_POCKETPC
18 #else
19 #define WIN_CE_PS2xx
20 #endif
21 #elif defined(WIN32_PLATFORM_HPCPRO)
22 #define WIN_CE_HPCPRO
23 #elif defined(WIN32_PLATFORM_WFSP)
24 #define WIN_CE_SMARTPHONE
25 #else
26 #error "Unsupported Windows CE platform"
27 #endif
28
29 /* #define SHELL        /* nt use of pcsys routines caused a hang */
30
31 #define RANDOM    /* have Berkeley random(3) */
32 #define TEXTCOLOR /* Color text */
33
34 #define EXEPATH              /* Allow .exe location to be used as HACKDIR */
35 #define TRADITIONAL_GLYPHMAP /* Store glyph mappings at level change time */
36
37 #define PC_LOCKING /* Prevent overwrites of aborted or in-progress games */
38 /* without first receiving confirmation. */
39
40 #define SELF_RECOVER /* Allow the game itself to recover from an aborted \
41                         game */
42
43 #define NOTSTDC /* no strerror() */
44
45 #define USER_SOUNDS
46
47 /*
48  * -----------------------------------------------------------------
49  *  The remaining code shouldn't need modification.
50  * -----------------------------------------------------------------
51  */
52 /* #define SHORT_FILENAMES      /* All NT filesystems support long names now
53  */
54
55 #ifdef MICRO
56 #undef MICRO /* never define this! */
57 #endif
58
59 #define NOCWD_ASSUMPTIONS /* Always define this. There are assumptions that \
60                              it is defined for WIN32.                       \
61                              Allow paths to be specified for HACKDIR,       \
62                              LEVELDIR, SAVEDIR, BONESDIR, DATADIR,          \
63                              SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */
64 #define NO_TERMS
65 #define ASCIIGRAPH
66
67 #ifdef OPTIONS_USED
68 #undef OPTIONS_USED
69 #endif
70 #ifdef MSWIN_GRAPHICS
71 #define OPTIONS_USED "guioptions"
72 #else
73 #define OPTIONS_USED "ttyoptions"
74 #endif
75 #define OPTIONS_FILE OPTIONS_USED
76
77 #define PORT_HELP "porthelp"
78
79 #define SAFERHANGUP /* Define SAFERHANGUP to delay hangup processing   \
80                      * until the main command loop. 'safer' because it \
81                      * avoids certain cheats and also avoids losing    \
82                      * objects being thrown when the hangup occurs.    \
83                      */
84
85 #if defined(WIN_CE_POCKETPC)
86 #define PORT_CE_PLATFORM "Pocket PC"
87 #elif defined(WIN_CE_PS2xx)
88 #define PORT_CE_PLATFORM "Palm-size PC 2.11"
89 #elif defined(WIN_CE_HPCPRO)
90 #define PORT_CE_PLATFORM "H/PC Pro 2.11"
91 #elif defined(WIN_CE_SMARTPHONE)
92 #define PORT_CE_PLATFORM "Smartphone 2002"
93 #endif
94
95 #if defined(ARM)
96 #define PORT_CE_CPU "ARM"
97 #elif defined(PPC)
98 #define PORT_CE_CPU "PPC"
99 #elif defined(ALPHA)
100 #define PORT_CE_CPU "ALPHA"
101 #elif defined(SH3)
102 #define PORT_CE_CPU "SH3"
103 #elif defined(SH4)
104 #define PORT_CE_CPU "SH4"
105 #elif defined(MIPS)
106 #define PORT_CE_CPU "MIPS"
107 #elif defined(X86) || defined(_X86_)
108 #define PORT_CE_CPU "X86"
109 #else
110 #error Only ARM, PPC, ALPHA, SH3, SH4, MIPS and X86 supported
111 #endif
112
113 #define RUNTIME_PORT_ID /* trigger run-time port identification since \
114                            Makedefs is bootstrapped on a cross-platform. */
115
116 #include <string.h> /* Provides prototypes of strncmpi(), etc.     */
117 #ifdef STRNCMPI
118 #define strncmpi(a, b, c) _strnicmp(a, b, c)
119 #endif
120
121 #ifdef STRCMPI
122 #define strcmpi(a, b) _stricmp(a, b)
123 #define stricmp(a, b) _stricmp(a, b)
124 #endif
125
126 #include <stdlib.h>
127
128 #define PATHLEN BUFSZ  /* maximum pathlength */
129 #define FILENAME BUFSZ /* maximum filename length (conservative) */
130
131 #if defined(_MAX_PATH) && defined(_MAX_FNAME)
132 #if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ)
133 #undef PATHLEN
134 #undef FILENAME
135 #define PATHLEN _MAX_PATH
136 #define FILENAME _MAX_FNAME
137 #endif
138 #endif
139
140 #define NO_SIGNAL
141 #define index strchr
142 #define rindex strrchr
143 #define USE_STDARG
144
145 /* Use the high quality random number routines. */
146 #ifndef USE_ISAAC64
147 # ifdef RANDOM
148 #  define Rand() random()
149 # else
150 #  define Rand() rand()
151 # endif
152 #endif
153
154 #define FCMASK 0660 /* file creation mask */
155 #define regularize nt_regularize
156 #define HLOCK "NHPERM"
157
158 #ifndef M
159 #define M(c) ((char) (0x80 | (c)))
160 /* #define M(c)         ((c) - 128) */
161 #endif
162
163 #ifndef C
164 #define C(c) (0x1f & (c))
165 #endif
166
167 #if defined(DLB)
168 #define FILENAME_CMP _stricmp /* case insensitive */
169 #endif
170
171 #if 0
172 extern char levels[], bones[], permbones[],
173 #endif /* 0 */
174
175 /* this was part of the MICRO stuff in the past */
176 extern const char *alllevels, *allbones;
177 extern char hackdir[];
178 #define ABORT C('a')
179 #define getuid() 1
180 #define getlogin() ((char *) 0)
181 extern void NDECL(win32_abort);
182 #ifdef WIN32CON
183 extern void FDECL(nttty_preference_update, (const char *));
184 extern void NDECL(toggle_mouse_support);
185 #endif
186
187 #ifndef alloca
188 #define ALLOCA_HACK /* used in util/panic.c */
189 #endif
190
191 #ifdef _MSC_VER
192 #if 0
193 #pragma warning(disable : 4018) /* signed/unsigned mismatch */
194 #pragma warning(disable : 4305) /* init, conv from 'const int' to 'char' */
195 #endif
196 #pragma warning(disable : 4761) /* integral size mismatch in arg; conv \
197                                    supp*/
198 #ifdef YYPREFIX
199 #pragma warning(disable : 4102) /* unreferenced label */
200 #endif
201 #endif
202
203 /* UNICODE stuff */
204 #define NHSTR_BUFSIZE 255
205 #ifdef UNICODE
206 #define NH_W2A(w, a, cb) \
207     (WideCharToMultiByte(CP_ACP, 0, (w), -1, (a), (cb), NULL, NULL), (a))
208
209 #define NH_A2W(a, w, cb) \
210     (MultiByteToWideChar(CP_ACP, 0, (a), -1, (w), (cb)), (w))
211 #else
212 #define NH_W2A(w, a, cb) (strncpy((a), (w), (cb)))
213
214 #define NH_A2W(a, w, cb) (strncpy((w), (a), (cb)))
215 #endif
216
217 extern int FDECL(set_win32_option, (const char *, const char *));
218
219 /*
220  * 3.4.3 addition - Stuff to help the user with some common, yet significant
221  * errors
222  * Let's make it NOP for now
223  */
224 #define interject_assistance(_1, _2, _3, _4)
225 #define interject(_1)
226
227 /* Missing definitions */
228 extern int mswin_have_input();
229 #define kbhit mswin_have_input
230
231 #define getenv(a) ((char *) NULL)
232
233 /* __stdio.h__ */
234 #define perror(a)
235 #define freopen(a, b, c) fopen(a, b)
236 extern int isatty(int);
237
238 /* __time.h___ */
239 #ifndef _TIME_T_DEFINED
240 typedef __int64 time_t; /* time value */
241 #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
242 #endif
243
244 #ifndef _TM_DEFINED
245 struct tm {
246     int tm_sec;   /* seconds after the minute - [0,59] */
247     int tm_min;   /* minutes after the hour - [0,59] */
248     int tm_hour;  /* hours since midnight - [0,23] */
249     int tm_mday;  /* day of the month - [1,31] */
250     int tm_mon;   /* months since January - [0,11] */
251     int tm_year;  /* years since 1900 */
252     int tm_wday;  /* days since Sunday - [0,6] */
253     int tm_yday;  /* days since January 1 - [0,365] */
254     int tm_isdst; /* daylight savings time flag - - NOT IMPLEMENTED */
255 };
256 #define _TM_DEFINED
257 #endif
258
259 extern struct tm *__cdecl localtime(const time_t *);
260 extern time_t __cdecl time(time_t *);
261 extern time_t __cdecl mktime(struct tm *tb);
262
263 /* __stdio.h__ */
264 #ifndef BUFSIZ
265 #define BUFSIZ 255
266 #endif
267
268 #define rewind(stream) (void) fseek(stream, 0L, SEEK_SET)
269
270 /* __io.h__ */
271 typedef long off_t;
272
273 extern int __cdecl close(int);
274 extern int __cdecl creat(const char *, int);
275 extern int __cdecl eof(int);
276 extern long __cdecl lseek(int, long, int);
277 extern int __cdecl open(const char *, int, ...);
278 extern int __cdecl read(int, void *, unsigned int);
279 extern int __cdecl unlink(const char *);
280 extern int __cdecl write(int, const void *, unsigned int);
281 extern int __cdecl rename(const char *, const char *);
282 extern int __cdecl access(const char *, int);
283
284 #ifdef DeleteFile
285 #undef DeleteFile
286 #endif
287 #define DeleteFile(a) unlink(a)
288
289 int chdir(const char *dirname);
290 extern char *getcwd(char *buffer, int maxlen);
291
292 /* __stdlib.h__ */
293 #define abort() (void) TerminateProcess(GetCurrentProcess(), 0)
294 #ifndef strdup
295 #define strdup _strdup
296 #endif
297
298 /* sys/stat.h */
299 #define S_IWRITE GENERIC_WRITE
300 #define S_IREAD GENERIC_READ
301
302 /* CE 2.xx is missing even more stuff */
303 #if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
304 #define ZeroMemory(p, s) memset((p), 0, (s))
305
306 extern int __cdecl isupper(int c);
307 extern int __cdecl isdigit(int c);
308 extern int __cdecl isspace(int c);
309 extern int __cdecl isprint(int c);
310
311 extern char *__cdecl _strdup(const char *s);
312 extern char *__cdecl strrchr(const char *string, int c);
313 extern int __cdecl _stricmp(const char *a, const char *b);
314
315 extern FILE *__cdecl fopen(const char *filename, const char *mode);
316 extern int __cdecl fscanf(FILE *f, const char *format, ...);
317 extern int __cdecl fprintf(FILE *f, const char *format, ...);
318 extern int __cdecl vfprintf(FILE *f, const char *format, va_list args);
319 extern int __cdecl fgetc(FILE *f);
320 extern char *__cdecl fgets(char *s, int size, FILE *f);
321 extern int __cdecl printf(const char *format, ...);
322 extern int __cdecl vprintf(const char *format, va_list args);
323 extern int __cdecl puts(const char *s);
324 extern FILE *__cdecl _getstdfilex(int desc);
325 extern int __cdecl fclose(FILE *f);
326 extern size_t __cdecl fread(void *p, size_t size, size_t count, FILE *f);
327 extern size_t __cdecl fwrite(const void *p, size_t size, size_t count,
328                              FILE *f);
329 extern int __cdecl fflush(FILE *f);
330 extern int __cdecl feof(FILE *f);
331 extern int __cdecl fseek(FILE *f, long offset, int from);
332 extern long __cdecl ftell(FILE *f);
333
334 #endif
335
336 /* ARM - the processor; avoids conflict with ARM in hack.h */
337 #ifdef ARM
338 #undef ARM
339 #endif
340
341 /* leave - Windows CE defines leave as part of exception handling (__leave)
342    It conflicts with existing sources and since we don't use exceptions it is
343    safe
344    to undefine it */
345 #ifdef leave
346 #undef leave
347 #endif
348
349 #endif /* WCECONF_H */