wceconf.h

Go to the documentation of this file.
00001 /* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
00002 /* Copyright (c) NetHack PC Development Team 1993, 1994.  */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 #ifndef WCECONF_H
00006 #define WCECONF_H
00007 
00008 #pragma warning(disable:4142) /* benign redefinition of type */
00009 
00010 #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
00011 
00012 #include <windows.h>
00013 
00014 /* Detect the targe device */
00015 #if defined(WIN32_PLATFORM_PSPC) 
00016 #       if _WIN32_WCE >= 300
00017 #               define WIN_CE_POCKETPC
00018 #       else
00019 #               define WIN_CE_PS2xx
00020 #       endif
00021 #elif defined(WIN32_PLATFORM_HPCPRO)
00022 #       define WIN_CE_HPCPRO
00023 #elif defined(WIN32_PLATFORM_WFSP)
00024 #       define WIN_CE_SMARTPHONE
00025 #else
00026 #       error "Unsupported Windows CE platform"
00027 #endif
00028 
00029 /* #define SHELL        /* nt use of pcsys routines caused a hang */
00030 
00031 #define RANDOM          /* have Berkeley random(3) */
00032 #define TEXTCOLOR       /* Color text */
00033 
00034 #define EXEPATH                 /* Allow .exe location to be used as HACKDIR */
00035 #define TRADITIONAL_GLYPHMAP    /* Store glyph mappings at level change time */
00036 
00037 #define PC_LOCKING              /* Prevent overwrites of aborted or in-progress games */
00038                                 /* without first receiving confirmation. */
00039 
00040 #define SELF_RECOVER            /* Allow the game itself to recover from an aborted game */
00041 
00042 #define NOTSTDC         /* no strerror() */
00043 
00044 #define USER_SOUNDS
00045 
00046 #define AUTOPICKUP_EXCEPTIONS
00047 
00048 /*
00049  * -----------------------------------------------------------------
00050  *  The remaining code shouldn't need modification.
00051  * -----------------------------------------------------------------
00052  */
00053 /* #define SHORT_FILENAMES      /* All NT filesystems support long names now */
00054 
00055 #ifdef MICRO
00056 #undef MICRO                    /* never define this! */
00057 #endif
00058 
00059 #define NOCWD_ASSUMPTIONS       /* Always define this. There are assumptions that
00060                                    it is defined for WIN32.
00061                                    Allow paths to be specified for HACKDIR,
00062                                    LEVELDIR, SAVEDIR, BONESDIR, DATADIR,
00063                                    SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */
00064 #define NO_TERMS
00065 #define ASCIIGRAPH
00066 
00067 #ifdef OPTIONS_USED
00068 #undef OPTIONS_USED
00069 #endif
00070 #ifdef MSWIN_GRAPHICS
00071 #define OPTIONS_USED    "guioptions"
00072 #else
00073 #define OPTIONS_USED    "ttyoptions"
00074 #endif
00075 #define OPTIONS_FILE OPTIONS_USED
00076 
00077 #define PORT_HELP       "porthelp"
00078 
00079 #if defined(WIN_CE_POCKETPC)
00080 #       define PORT_CE_PLATFORM "Pocket PC"
00081 #elif defined(WIN_CE_PS2xx)
00082 #       define PORT_CE_PLATFORM "Palm-size PC 2.11"
00083 #elif defined(WIN_CE_HPCPRO)
00084 #       define PORT_CE_PLATFORM "H/PC Pro 2.11"
00085 #elif defined(WIN_CE_SMARTPHONE)
00086 #       define PORT_CE_PLATFORM "Smartphone 2002"
00087 #endif
00088 
00089 #if defined(ARM)
00090 #       define PORT_CE_CPU "ARM"
00091 #elif defined(PPC)
00092 #       define PORT_CE_CPU "PPC"
00093 #elif defined(ALPHA)
00094 #       define PORT_CE_CPU "ALPHA"
00095 #elif defined(SH3)
00096 #       define PORT_CE_CPU "SH3"
00097 #elif defined(SH4)
00098 #       define PORT_CE_CPU "SH4"
00099 #elif defined(MIPS)
00100 #       define PORT_CE_CPU "MIPS"
00101 #elif defined(X86) || defined(_X86_)
00102 #       define PORT_CE_CPU "X86"
00103 #else
00104 #       error Only ARM, PPC, ALPHA, SH3, SH4, MIPS and X86 supported
00105 #endif
00106 
00107 #define RUNTIME_PORT_ID /* trigger run-time port identification since
00108                            Makedefs is bootstrapped on a cross-platform. */
00109 
00110 #include <string.h>     /* Provides prototypes of strncmpi(), etc.     */
00111 #ifdef STRNCMPI
00112 #define strncmpi(a,b,c) _strnicmp(a,b,c)
00113 #endif
00114 
00115 #ifdef STRCMPI
00116 #define strcmpi(a,b) _stricmp(a,b)
00117 #define stricmp(a,b) _stricmp(a,b)
00118 #endif
00119 
00120 #include <stdlib.h>
00121 
00122 #define PATHLEN         BUFSZ /* maximum pathlength */
00123 #define FILENAME        BUFSZ /* maximum filename length (conservative) */
00124 
00125 #if defined(_MAX_PATH) && defined(_MAX_FNAME)
00126 # if (_MAX_PATH < BUFSZ) && (_MAX_FNAME < BUFSZ)
00127 #undef PATHLEN
00128 #undef FILENAME
00129 #define PATHLEN         _MAX_PATH
00130 #define FILENAME        _MAX_FNAME
00131 # endif
00132 #endif
00133 
00134 
00135 #define NO_SIGNAL
00136 #define index   strchr
00137 #define rindex  strrchr
00138 #define USE_STDARG
00139 #ifdef RANDOM
00140 /* Use the high quality random number routines. */
00141 #define Rand()  random()
00142 #else
00143 #define Rand()  rand()
00144 #endif
00145 
00146 #define FCMASK  0660    /* file creation mask */
00147 #define regularize      nt_regularize
00148 #define HLOCK "NHPERM"
00149 
00150 #ifndef M
00151 #define M(c)            ((char) (0x80 | (c)))
00152 /* #define M(c)         ((c) - 128) */
00153 #endif
00154 
00155 #ifndef C
00156 #define C(c)            (0x1f & (c))
00157 #endif
00158 
00159 #if defined(DLB)
00160 #define FILENAME_CMP  _stricmp                /* case insensitive */
00161 #endif
00162 
00163 #if 0
00164 extern char levels[], bones[], permbones[],
00165 #endif /* 0 */
00166 
00167 /* this was part of the MICRO stuff in the past */
00168 extern const char *alllevels, *allbones;
00169 extern char hackdir[];
00170 #define ABORT C('a')
00171 #define getuid() 1
00172 #define getlogin() ((char *)0)
00173 extern void NDECL(win32_abort);
00174 #ifdef WIN32CON
00175 extern void FDECL(nttty_preference_update, (const char *));
00176 extern void NDECL(toggle_mouse_support);
00177 #endif
00178 
00179 #ifndef alloca
00180 #define ALLOCA_HACK     /* used in util/panic.c */
00181 #endif
00182 
00183 #ifndef REDO
00184 #undef  Getchar
00185 #define Getchar nhgetch
00186 #endif
00187 
00188 #ifdef _MSC_VER
00189 #if 0
00190 #pragma warning(disable:4018)   /* signed/unsigned mismatch */
00191 #pragma warning(disable:4305)   /* init, conv from 'const int' to 'char' */
00192 #endif
00193 #pragma warning(disable:4761)   /* integral size mismatch in arg; conv supp*/
00194 #ifdef YYPREFIX
00195 #pragma warning(disable:4102)   /* unreferenced label */
00196 #endif
00197 #endif
00198 
00199 /* UNICODE stuff */
00200 #define NHSTR_BUFSIZE   255
00201 #ifdef UNICODE
00202         #define NH_W2A(w, a, cb)     ( WideCharToMultiByte(                              \
00203                                                                                                    CP_ACP,                      \
00204                                                                                                    0,                           \
00205                                                                                                    (w),                           \
00206                                                                                                    -1,                          \
00207                                                                                                    (a),                           \
00208                                                                                                    (cb),                          \
00209                                                                                                    NULL,                        \
00210                                                                                                    NULL), (a) )
00211 
00212         #define NH_A2W(a, w, cb)     ( MultiByteToWideChar(                              \
00213                                                                                                    CP_ACP,                      \
00214                                                                                                    0,                           \
00215                                                                                                    (a),                           \
00216                                                                                                    -1,                          \
00217                                                                                                    (w),                           \
00218                                                                                                    (cb)), (w) )
00219 #else
00220         #define NH_W2A(w, a, cb)     (strncpy((a), (w), (cb)))
00221 
00222         #define NH_A2W(a, w, cb)     (strncpy((w), (a), (cb)))
00223 #endif
00224 
00225 extern int FDECL(set_win32_option, (const char *, const char *));
00226 
00227 /* 
00228  * 3.4.3 addition - Stuff to help the user with some common, yet significant errors 
00229  * Let's make it NOP for now
00230  */
00231 #define interject_assistance(_1,_2,_3,_4)
00232 #define interject(_1)
00233 
00234 /* Missing definitions */
00235 extern int              mswin_have_input();
00236 #define kbhit   mswin_have_input
00237 
00238 #define getenv(a) ((char*)NULL)
00239 
00240 /* __stdio.h__ */
00241 #define perror(a)
00242 #define freopen(a, b, c) fopen(a, b)
00243 extern int isatty(int);
00244 
00245 /* __time.h___ */
00246 #ifndef _TIME_T_DEFINED
00247 typedef __int64 time_t;        /* time value */
00248 #define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
00249 #endif
00250 
00251 #ifndef _TM_DEFINED
00252 struct tm {
00253         int tm_sec;     /* seconds after the minute - [0,59] */
00254         int tm_min;     /* minutes after the hour - [0,59] */
00255         int tm_hour;    /* hours since midnight - [0,23] */
00256         int tm_mday;    /* day of the month - [1,31] */
00257         int tm_mon;     /* months since January - [0,11] */
00258         int tm_year;    /* years since 1900 */
00259         int tm_wday;    /* days since Sunday - [0,6] */
00260         int tm_yday;    /* days since January 1 - [0,365] */
00261         int tm_isdst;   /* daylight savings time flag - - NOT IMPLEMENTED */
00262         };
00263 #define _TM_DEFINED
00264 #endif
00265 
00266 extern struct tm * __cdecl localtime(const time_t *);
00267 extern time_t __cdecl time(time_t *);
00268 
00269 /* __stdio.h__ */
00270 #ifndef BUFSIZ
00271 #define BUFSIZ 255
00272 #endif
00273 
00274 #define rewind(stream) (void)fseek( stream, 0L, SEEK_SET )
00275 
00276 /* __io.h__ */
00277 typedef long off_t;
00278 
00279 extern int __cdecl close(int);
00280 extern int __cdecl creat(const char *, int);
00281 extern int __cdecl eof(int);
00282 extern long __cdecl lseek(int, long, int);
00283 extern int __cdecl open(const char *, int, ...);
00284 extern int __cdecl read(int, void *, unsigned int);
00285 extern int __cdecl unlink(const char *);
00286 extern int __cdecl write(int, const void *, unsigned int);
00287 extern int __cdecl rename(const char *, const char *);
00288 extern int __cdecl access(const char *, int);
00289 
00290 #ifdef DeleteFile
00291 #undef DeleteFile
00292 #endif
00293 #define DeleteFile(a) unlink(a)
00294 
00295 int chdir( const char *dirname );
00296 extern char *getcwd( char *buffer, int maxlen );
00297 
00298 /* __stdlib.h__ */
00299 #define abort()  (void)TerminateProcess(GetCurrentProcess(), 0)
00300 #ifndef strdup
00301 #define strdup _strdup
00302 #endif
00303 
00304 /* sys/stat.h */
00305 #define S_IWRITE  GENERIC_WRITE
00306 #define S_IREAD   GENERIC_READ
00307 
00308 
00309 /* CE 2.xx is missing even more stuff */
00310 #if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
00311 #define ZeroMemory(p, s)         memset((p), 0, (s))
00312 
00313 extern int __cdecl isupper(int c);
00314 extern int __cdecl isdigit(int c);
00315 extern int __cdecl isspace(int c);
00316 extern int __cdecl isprint(int c);
00317 
00318 extern char* __cdecl _strdup(const char* s);
00319 extern char* __cdecl strrchr( const char *string, int c );
00320 extern int   __cdecl _stricmp(const char* a, const char* b);
00321 
00322 extern FILE * __cdecl fopen(const char* filename, const char *mode);
00323 extern int    __cdecl fscanf(FILE *f , const char *format, ...);
00324 extern int __cdecl fprintf(FILE *f , const char *format, ...);
00325 extern int    __cdecl vfprintf(FILE* f, const char *format, va_list args);
00326 extern int __cdecl fgetc(FILE * f);
00327 extern char * __cdecl fgets(char *s, int size, FILE *f);
00328 extern int    __cdecl printf(const char *format, ...);
00329 extern int    __cdecl vprintf(const char *format, va_list args);
00330 extern int    __cdecl puts(const char * s);
00331 extern FILE*  __cdecl _getstdfilex(int desc);
00332 extern int __cdecl fclose(FILE * f);
00333 extern size_t __cdecl fread(void *p, size_t size, size_t count, FILE *f);
00334 extern size_t __cdecl fwrite(const void *p, size_t size, size_t count, FILE * f);
00335 extern int    __cdecl fflush(FILE *f);
00336 extern int    __cdecl feof(FILE *f);
00337 extern int    __cdecl fseek(FILE *f, long offset, int from);
00338 extern long   __cdecl ftell(FILE * f);
00339 
00340 #endif
00341 
00342 /* ARM - the processor; avoids conflict with ARM in hack.h */
00343 # ifdef ARM
00344 # undef ARM
00345 # endif
00346 
00347 /* leave - Windows CE defines leave as part of exception handling (__leave)
00348    It confilicts with existing sources and since we don't use exceptions it is safe 
00349    to undefine it */
00350 # ifdef leave
00351 # undef leave
00352 # endif
00353 
00354 #endif /* WCECONF_H */