Source:NetHack 3.4.3/include/wceconf.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to include/wceconf.h from NetHack 3.4.3. To link to a particular line, write [[wceconf.h#line123]], for example.

  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. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

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