Fixed MSVC related adjustments for Win32
This commit is contained in:
parent
253849ef65
commit
1c8c116321
@ -43,17 +43,25 @@
|
||||
#include <ctype.h>
|
||||
#if defined(__EMX__)
|
||||
#include <sys/nls.h>
|
||||
__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
|
||||
|
||||
|
@ -28,10 +28,11 @@
|
||||
|
||||
#include <clocale>
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#define __gctype_h // prevent gctype from being included
|
||||
#include <gstrall.h>
|
||||
#include <gmemdbg.h>
|
||||
#include <gutlos.h>
|
||||
#include <gctype.h>
|
||||
#include <windows.h>
|
||||
#ifndef __NO_MMSYSTEM
|
||||
#include <mmsystem.h>
|
||||
@ -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;
|
||||
|
Reference in New Issue
Block a user