]> granicus.if.org Git - nethack/commitdiff
wchar follow-up (trunk only)
authornethack.allison <nethack.allison>
Thu, 26 Oct 2006 23:30:00 +0000 (23:30 +0000)
committernethack.allison <nethack.allison>
Thu, 26 Oct 2006 23:30:00 +0000 (23:30 +0000)
- ensure that wchar.h is included even if it is not included
from another system header file as it is on some platforms.

- attempt to make the NHWCHAR_P definition more appropriate
for more platforms.

include/global.h
include/tradstdc.h

index 9dba1ed8166bf3ee6f146a3068e3bee638540981..3c5b552424df7ff990226d731106dbdcc29eabb7 100644 (file)
@@ -69,6 +69,8 @@ typedef xchar boolean;                /* 0 or 1 */
 # define UNICODE_DRAWING       /* store drawing symbols in wchar_t data type     */
 # define UNICODE_WIDEWINPORT   /* store and render wide chars in window port     */
 /*# define UNICODE_PLAYERTEXT*/        /* not implemented - player input in wide chars */
+#include <limits.h>
+#include <wchar.h>
 #else
 # undef UNICODE_DRAWING
 # undef UNICODE_WIDEWINPORT
index 02a75bc39361ef55310852b52dde3047f2bf54fc..56d0d6717b0f1fc325061f7e663c60b31f5a6eb7 100644 (file)
@@ -264,7 +264,14 @@ typedef genericptr genericptr_t;   /* (void *) or (char *) */
 #  define SHORT_P int
 #  define BOOLEAN_P int
 #  define ALIGNTYP_P int
-#  define NHWCHAR_P int
+#  if defined(UNICODE_WIDEWINPORT) && defined(WCHAR_MAX)
+#   if WCHAR_MAX >= INT_MAX
+#    define NHWCHAR_P nhwchar
+#   endif
+#  endif
+#  ifndef NHWCHAR_P
+#   define NHWCHAR_P int
+#  endif
 # else
    /* Neither widened nor unwidened prototypes.  Argument list expansion
     * by FDECL/VDECL always empty; all xxx_P vanish so defs aren't needed. */