-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 asanine!" */
-#if wxUSE_UNICODE
-# define CHRBITS 32
+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 */