-typedef wx_wchar chr; /* the type itself */
-typedef unsigned long uchr; /* unsigned type that will hold a chr */
-typedef long celt; /* type to hold chr, MCCE number, or
- * NOCELT */
-
-#define NOCELT (-1) /* celt value which is not valid chr or
- * MCCE */
-#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr
- * literal */
-#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
-
-/* RN - the "not use sizeof() thing is really annoying!" */
-#if wxUSE_UNICODE
-# if defined(__WINDOWS__)
-# define CHRBITS 16
-# define CHR_MAX 0xfffe
-# else /* !__WINDOWS__ */
-# if defined(__MACH__)
-# define CHRBITS 32
-# define CHR_MAX 0xfffffffe
-# else /* !__MACH__ */
-# if !defined(SIZEOF_WCHAR_T)
-# define CHRBITS 16
-# define CHR_MAX 0xfffe
-# else /* defined(SIZEOF_WCHAR_T) */
-# define CHRBITS SIZEOF_WCHAR_T
-# define CHR_MAX ((1 << CHRBITS) - 1)
-# endif /* !defined(SIZEOF_WCHAR_T) */
-# endif /* defined(__MACH__) */
-# endif /* defined(__WINDOWS__) */
-#else /* !wxUSE_UNICODE */
-# define CHRBITS 8 /* bits in a chr; must not use sizeof */
-# define CHR_MAX 0xfe
-#endif /* wxUSE_UNICODE */
+typedef wxChar chr; /* the type itself */
+typedef int pchr; /* what it promotes to */
+typedef unsigned uchr; /* unsigned type that will hold a chr */
+typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
+#define NOCELT (-1) /* celt value which is not valid chr or MCCE */
+#define UCHAR(c) ((unsigned char) (c))
+#define CHR(c) (UCHAR(c)) /* turn char literal into chr literal */
+#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
+#if !wxUSE_UNICODE
+# define CHRBITS 8 /* bits in a chr; must not use sizeof */
+# define CHR_MIN 0x00 /* smallest and largest chr; the value */
+# define CHR_MAX 0xff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
+#elif SIZEOF_WCHAR_T == 4
+# define CHRBITS 32 /* bits in a chr; must not use sizeof */
+# define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
+# define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
+#else
+# define CHRBITS 16 /* bits in a chr; must not use sizeof */
+# define CHR_MIN 0x0000 /* smallest and largest chr; the value */
+# define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
+#endif