Fixed MSVC related adjustments for Win32
This commit is contained in:
parent
253849ef65
commit
1c8c116321
@ -43,17 +43,25 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#if defined(__EMX__)
|
#if defined(__EMX__)
|
||||||
#include <sys/nls.h>
|
#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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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];
|
extern char tl[256], tu[256];
|
||||||
__inline__ int tolower(int c) { return tl[c]; }
|
__inline__ int tolower(int c) { return tl[c]; }
|
||||||
__inline__ int toupper(int c) { return tu[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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,10 +28,11 @@
|
|||||||
|
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <cctype>
|
||||||
|
#define __gctype_h // prevent gctype from being included
|
||||||
#include <gstrall.h>
|
#include <gstrall.h>
|
||||||
#include <gmemdbg.h>
|
#include <gmemdbg.h>
|
||||||
#include <gutlos.h>
|
#include <gutlos.h>
|
||||||
#include <gctype.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#ifndef __NO_MMSYSTEM
|
#ifndef __NO_MMSYSTEM
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
@ -143,8 +144,8 @@ int g_init_os(int flags) {
|
|||||||
setlocale(LC_CTYPE, locale);
|
setlocale(LC_CTYPE, locale);
|
||||||
#endif
|
#endif
|
||||||
for(i = 0; i < 256; i++) {
|
for(i = 0; i < 256; i++) {
|
||||||
tu[i] = (toupper)(i);
|
tu[i] = toupper(i);
|
||||||
tl[i] = (tolower)(i);
|
tl[i] = tolower(i);
|
||||||
CHAR chr = (CHAR)i;
|
CHAR chr = (CHAR)i;
|
||||||
MultiByteToWideChar(CP_OEMCP, MB_USEGLYPHCHARS, &chr, 1, oem2unicode+i, 1);
|
MultiByteToWideChar(CP_OEMCP, MB_USEGLYPHCHARS, &chr, 1, oem2unicode+i, 1);
|
||||||
}
|
}
|
||||||
@ -158,8 +159,8 @@ int g_init_os(int flags) {
|
|||||||
// tolower/toupper tables
|
// tolower/toupper tables
|
||||||
char src[2], dst[2], tst[2];
|
char src[2], dst[2], tst[2];
|
||||||
for(i = 0; i < 32; i++) {
|
for(i = 0; i < 32; i++) {
|
||||||
tu[i] = (toupper)(i);
|
tu[i] = toupper(i);
|
||||||
tl[i] = (tolower)(i);
|
tl[i] = tolower(i);
|
||||||
}
|
}
|
||||||
for(i = 32; i < 256; i++) {
|
for(i = 32; i < 256; i++) {
|
||||||
tu[i] = tl[i] = i;
|
tu[i] = tl[i] = i;
|
||||||
|
Reference in New Issue
Block a user