diff --git a/goldlib/gall/gctype.h b/goldlib/gall/gctype.h index 829db11..b909dd0 100644 --- a/goldlib/gall/gctype.h +++ b/goldlib/gall/gctype.h @@ -43,17 +43,25 @@ #include #if defined(__EMX__) #include -__inline__ int tolower(int a) { return _nls_tolower((unsigned char)(a)); } -__inline__ int toupper(int a) { return _nls_toupper((unsigned char)(a)); } -#elif defined(__WIN32__) #ifdef __cplusplus extern "C" { #endif +__inline__ int tolower(int a) { return _nls_tolower((unsigned char)(a)); } +__inline__ int toupper(int a) { return _nls_toupper((unsigned char)(a)); } +#ifdef __cplusplus +} +#endif +#elif defined(__WIN32__) +#ifdef __cplusplus +extern "C" { extern char tl[256], tu[256]; __inline__ int tolower(int c) { return tl[c]; } __inline__ int toupper(int c) { return tu[c]; } -#ifdef __cplusplus } +#else +extern char tl[256], tu[256]; +#define tolower(c) tl[(int)(unsigned char)c] +#define toupper(c) tu[(int)(unsigned char)c] #endif #endif diff --git a/goldlib/gall/gutlwin.cpp b/goldlib/gall/gutlwin.cpp index 81029a9..53ffaea 100644 --- a/goldlib/gall/gutlwin.cpp +++ b/goldlib/gall/gutlwin.cpp @@ -28,10 +28,11 @@ #include #include +#include +#define __gctype_h // prevent gctype from being included #include #include #include -#include #include #ifndef __NO_MMSYSTEM #include @@ -143,8 +144,8 @@ int g_init_os(int flags) { setlocale(LC_CTYPE, locale); #endif for(i = 0; i < 256; i++) { - tu[i] = (toupper)(i); - tl[i] = (tolower)(i); + tu[i] = toupper(i); + tl[i] = tolower(i); CHAR chr = (CHAR)i; MultiByteToWideChar(CP_OEMCP, MB_USEGLYPHCHARS, &chr, 1, oem2unicode+i, 1); } @@ -158,8 +159,8 @@ int g_init_os(int flags) { // tolower/toupper tables char src[2], dst[2], tst[2]; for(i = 0; i < 32; i++) { - tu[i] = (toupper)(i); - tl[i] = (tolower)(i); + tu[i] = toupper(i); + tl[i] = tolower(i); } for(i = 32; i < 256; i++) { tu[i] = tl[i] = i;