OSDN Git Service

fix sokoban defs
[nethackexpress/trunk.git] / include / wceconf.h
1 /* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
2 /* Copyright (c) NetHack PC Development Team 1993, 1994.  */
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 targe 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 game */
41
42 #define NOTSTDC         /* no strerror() */
43
44 #define USER_SOUNDS
45
46 #define AUTOPICKUP_EXCEPTIONS
47
48 /*
49  * -----------------------------------------------------------------
50  *  The remaining code shouldn't need modification.
51  * -----------------------------------------------------------------
52  */
53 /* #define SHORT_FILENAMES      /* All NT filesystems support long names now */
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 #if defined(WIN_CE_POCKETPC)
80 #       define PORT_CE_PLATFORM "Pocket PC"
81 #elif defined(WIN_CE_PS2xx)
82 #       define PORT_CE_PLATFORM "Palm-size PC 2.11"
83 #elif defined(WIN_CE_HPCPRO)
84 #       define PORT_CE_PLATFORM "H/PC Pro 2.11"
85 #elif defined(WIN_CE_SMARTPHONE)
86 #       define PORT_CE_PLATFORM "Smartphone 2002"
87 #endif
88
89 #if defined(ARM)
90 #       define PORT_CE_CPU "ARM"
91 #elif defined(PPC)
92 #       define PORT_CE_CPU "PPC"
93 #elif defined(ALPHA)
94 #       define PORT_CE_CPU "ALPHA"
95 #elif defined(SH3)
96 #       define PORT_CE_CPU "SH3"
97 #elif defined(SH4)
98 #       define PORT_CE_CPU "SH4"
99 #elif defined(MIPS)
100 #       define PORT_CE_CPU "MIPS"
101 #elif defined(X86) || defined(_X86_)
102 #       define PORT_CE_CPU "X86"
103 #else
104 #       error Only ARM, PPC, ALPHA, SH3, SH4, MIPS and X86 supported
105 #endif
106
107 #define RUNTIME_PORT_ID /* trigger run-time port identification since
108                            Makedefs is bootstrapped on a cross-platform. */
109
110 #include <string.h>     /* Provides prototypes of strncmpi(), etc.     */
111 #ifdef STRNCMPI
112 #define strncmpi(a,b,c) _strnicmp(a,b,c)
113 #endif
114
115 #ifdef STRCMPI
116 #define strcmpi(a,b) _stricmp(a,b)
117 #define stricmp(a,b) _stricmp(a,b)
118 #endif
119
120 #include <stdlib.h>
121
122 #define PATHLEN         BUFSZ /* maximum pathlength */
123 #define FILENAME        BUFSZ /* maximum filename length (conservative) */
124
125 #if defined(_MAX_PATH) && defined(_MAX_FNAME)
126 # if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ)
127 #undef PATHLEN
128 #undef FILENAME
129 #define PATHLEN         _MAX_PATH
130 #define FILENAME        _MAX_FNAME
131 # endif
132 #endif
133
134
135 #define NO_SIGNAL
136 #define index   strchr
137 #define rindex  strrchr
138 #define USE_STDARG
139 #ifdef RANDOM
140 /* Use the high quality random number routines. */
141 #define Rand()  random()
142 #else
143 #define Rand()  rand()
144 #endif
145
146 #define FCMASK  0660    /* file creation mask */
147 #define regularize      nt_regularize
148 #define HLOCK "NHPERM"
149
150 #ifndef M
151 #define M(c)            ((char) (0x80 | (c)))
152 /* #define M(c)         ((c) - 128) */
153 #endif
154
155 #ifndef C
156 #define C(c)            (0x1f & (c))
157 #endif
158
159 #if defined(DLB)
160 #define FILENAME_CMP  _stricmp                /* case insensitive */
161 #endif
162
163 #if 0
164 extern char levels[], bones[], permbones[],
165 #endif /* 0 */
166
167 /* this was part of the MICRO stuff in the past */
168 extern const char *alllevels, *allbones;
169 extern char hackdir[];
170 #define ABORT C('a')
171 #define getuid() 1
172 #define getlogin() ((char *)0)
173 extern void NDECL(win32_abort);
174 #ifdef WIN32CON
175 extern void FDECL(nttty_preference_update, (const char *));
176 extern void NDECL(toggle_mouse_support);
177 #endif
178
179 #ifndef alloca
180 #define ALLOCA_HACK     /* used in util/panic.c */
181 #endif
182
183 #ifndef REDO
184 #undef  Getchar
185 #define Getchar nhgetch
186 #endif
187
188 #ifdef _MSC_VER
189 #if 0
190 #pragma warning(disable:4018)   /* signed/unsigned mismatch */
191 #pragma warning(disable:4305)   /* init, conv from 'const int' to 'char' */
192 #endif
193 #pragma warning(disable:4761)   /* integral size mismatch in arg; conv supp*/
194 #ifdef YYPREFIX
195 #pragma warning(disable:4102)   /* unreferenced label */
196 #endif
197 #endif
198
199 /* UNICODE stuff */
200 #define NHSTR_BUFSIZE   255
201 #ifdef UNICODE
202         #define NH_W2A(w, a, cb)     ( WideCharToMultiByte(                              \
203                                                                                                    CP_ACP,                      \
204                                                                                                    0,                           \
205                                                                                                    (w),                           \
206                                                                                                    -1,                          \
207                                                                                                    (a),                           \
208                                                                                                    (cb),                          \
209                                                                                                    NULL,                        \
210                                                                                                    NULL), (a) )
211
212         #define NH_A2W(a, w, cb)     ( MultiByteToWideChar(                              \
213                                                                                                    CP_ACP,                      \
214                                                                                                    0,                           \
215                                                                                                    (a),                           \
216                                                                                                    -1,                          \
217                                                                                                    (w),                           \
218                                                                                                    (cb)), (w) )
219 #else
220         #define NH_W2A(w, a, cb)     (strncpy((a), (w), (cb)))
221
222         #define NH_A2W(a, w, cb)     (strncpy((w), (a), (cb)))
223 #endif
224
225 extern int FDECL(set_win32_option, (const char *, const char *));
226
227 /* 
228  * 3.4.3 addition - Stuff to help the user with some common, yet significant errors 
229  * Let's make it NOP for now
230  */
231 #define interject_assistance(_1,_2,_3,_4)
232 #define interject(_1)
233
234 /* Missing definitions */
235 extern int              mswin_have_input();
236 #define kbhit   mswin_have_input
237
238 #define getenv(a) ((char*)NULL)
239
240 /* __stdio.h__ */
241 #define perror(a)
242 #define freopen(a, b, c) fopen(a, b)
243 extern int isatty(int);
244
245 /* __time.h___ */
246 #ifndef _TIME_T_DEFINED
247 typedef __int64 time_t;        /* time value */
248 #define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
249 #endif
250
251 #ifndef _TM_DEFINED
252 struct tm {
253         int tm_sec;     /* seconds after the minute - [0,59] */
254         int tm_min;     /* minutes after the hour - [0,59] */
255         int tm_hour;    /* hours since midnight - [0,23] */
256         int tm_mday;    /* day of the month - [1,31] */
257         int tm_mon;     /* months since January - [0,11] */
258         int tm_year;    /* years since 1900 */
259         int tm_wday;    /* days since Sunday - [0,6] */
260         int tm_yday;    /* days since January 1 - [0,365] */
261         int tm_isdst;   /* daylight savings time flag - - NOT IMPLEMENTED */
262         };
263 #define _TM_DEFINED
264 #endif
265
266 extern struct tm * __cdecl localtime(const time_t *);
267 extern time_t __cdecl time(time_t *);
268
269 /* __stdio.h__ */
270 #ifndef BUFSIZ
271 #define BUFSIZ 255
272 #endif
273
274 #define rewind(stream) (void)fseek( stream, 0L, SEEK_SET )
275
276 /* __io.h__ */
277 typedef long off_t;
278
279 extern int __cdecl close(int);
280 extern int __cdecl creat(const char *, int);
281 extern int __cdecl eof(int);
282 extern long __cdecl lseek(int, long, int);
283 extern int __cdecl open(const char *, int, ...);
284 extern int __cdecl read(int, void *, unsigned int);
285 extern int __cdecl unlink(const char *);
286 extern int __cdecl write(int, const void *, unsigned int);
287 extern int __cdecl rename(const char *, const char *);
288 extern int __cdecl access(const char *, int);
289
290 #ifdef DeleteFile
291 #undef DeleteFile
292 #endif
293 #define DeleteFile(a) unlink(a)
294
295 int chdir( const char *dirname );
296 extern char *getcwd( char *buffer, int maxlen );
297
298 /* __stdlib.h__ */
299 #define abort()  (void)TerminateProcess(GetCurrentProcess(), 0)
300 #ifndef strdup
301 #define strdup _strdup
302 #endif
303
304 /* sys/stat.h */
305 #define S_IWRITE  GENERIC_WRITE
306 #define S_IREAD   GENERIC_READ
307
308
309 /* CE 2.xx is missing even more stuff */
310 #if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
311 #define ZeroMemory(p, s)         memset((p), 0, (s))
312
313 extern int __cdecl isupper(int c);
314 extern int __cdecl isdigit(int c);
315 extern int __cdecl isspace(int c);
316 extern int __cdecl isprint(int c);
317
318 extern char* __cdecl _strdup(const char* s);
319 extern char* __cdecl strrchr( const char *string, int c );
320 extern int   __cdecl _stricmp(const char* a, const char* b);
321
322 extern FILE * __cdecl fopen(const char* filename, const char *mode);
323 extern int    __cdecl fscanf(FILE *f , const char *format, ...);
324 extern int __cdecl fprintf(FILE *f , const char *format, ...);
325 extern int    __cdecl vfprintf(FILE* f, const char *format, va_list args);
326 extern int __cdecl fgetc(FILE * f);
327 extern char * __cdecl fgets(char *s, int size, FILE *f);
328 extern int    __cdecl printf(const char *format, ...);
329 extern int    __cdecl vprintf(const char *format, va_list args);
330 extern int    __cdecl puts(const char * s);
331 extern FILE*  __cdecl _getstdfilex(int desc);
332 extern int __cdecl fclose(FILE * f);
333 extern size_t __cdecl fread(void *p, size_t size, size_t count, FILE *f);
334 extern size_t __cdecl fwrite(const void *p, size_t size, size_t count, FILE * f);
335 extern int    __cdecl fflush(FILE *f);
336 extern int    __cdecl feof(FILE *f);
337 extern int    __cdecl fseek(FILE *f, long offset, int from);
338 extern long   __cdecl ftell(FILE * f);
339
340 #endif
341
342 /* ARM - the processor; avoids conflict with ARM in hack.h */
343 # ifdef ARM
344 # undef ARM
345 # endif
346
347 /* leave - Windows CE defines leave as part of exception handling (__leave)
348    It confilicts with existing sources and since we don't use exceptions it is safe 
349    to undefine it */
350 # ifdef leave
351 # undef leave
352 # endif
353
354 #endif /* WCECONF_H */