Core: Unicode support

git-svn-id: svn://ultimatepp.org/upp/trunk@11173 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-06-17 07:20:40 +00:00
parent fffccb8660
commit fab8fd6cd5
4 changed files with 44 additions and 21 deletions

View file

@ -2186,12 +2186,12 @@ void ConvertCharset(char *t, byte tcharset, const char *s, byte scharset, int n)
}
#ifdef flagSO
bool IsLetter(int c) { return (dword)c < 2048 ? uni__info[c] & 0xc0000000 : 0; }
bool IsUpper(int c) { return (dword)c < 2048 ? uni__info[c] & 0x40000000 : 0; }
bool IsLower(int c) { return (dword)c < 2048 ? uni__info[c] & 0x80000000 : 0; }
int ToUpper(int c) { return (dword)c < 2048 ? (uni__info[c] >> 11) & 2047 : ToUpperRest_(c); }
int ToLower(int c) { return (dword)c < 2048 ? uni__info[c] & 2047 : ToLowerRest_(c);; }
int ToLower(int c) { return (dword)c < 2048 ? uni__info[c] & 2047 : ToLowerRest_(c); }
int ToAscii(int c) { return (dword)c < 2048 ? (uni__info[c] >> 22) & 0x7f : ToAsciiRest_(c); }
bool IsUpper(int c) { return (dword)c < 2048 ? uni__info[c] & 0x40000000 : c != ToLower(c); }
bool IsLower(int c) { return (dword)c < 2048 ? uni__info[c] & 0x80000000 : c != ToUpper(c); }
bool IsLetter(int c) { return (dword)c < 2048 ? uni__info[c] & 0xc0000000 : IsLetter_(c); }
#endif
void ToUpper(wchar *t, const wchar *s, int len)

View file

@ -122,13 +122,17 @@ extern dword uni__info[2048];
dword ToUpperRest_(dword c);
dword ToLowerRest_(dword c);
dword ToAsciiRest_(dword c);
bool IsRTL_(dword c);
bool IsLetter_(dword c);
bool IsUpper_(dword c);
bool IsLower_(dword c);
inline bool IsLetter(int c) { return (dword)c < 2048 ? uni__info[c] & 0xc0000000 : 0; }
inline bool IsUpper(int c) { return (dword)c < 2048 ? uni__info[c] & 0x40000000 : 0; }
inline bool IsLower(int c) { return (dword)c < 2048 ? uni__info[c] & 0x80000000 : 0; }
inline int ToUpper(int c) { return (dword)c < 2048 ? (uni__info[c] >> 11) & 2047 : ToUpperRest_(c); }
inline int ToLower(int c) { return (dword)c < 2048 ? uni__info[c] & 2047 : ToLowerRest_(c); }
inline int ToAscii(int c) { return (dword)c < 2048 ? (uni__info[c] >> 22) & 0x7f : ToAsciiRest_(c); }
inline bool IsUpper(int c) { return (dword)c < 2048 ? uni__info[c] & 0x40000000 : c != ToLower(c); }
inline bool IsLower(int c) { return (dword)c < 2048 ? uni__info[c] & 0x80000000 : c != ToUpper(c); }
inline bool IsLetter(int c) { return (dword)c < 2048 ? uni__info[c] & 0xc0000000 : IsLetter_(c); }
#else
bool IsLetter(int c);
bool IsUpper(int c);
@ -138,6 +142,8 @@ int ToLower(int c);
int ToAscii(int c);
#endif
inline bool IsRTL(int c) { return (dword)c >= 1470 && IsRTL_(c); }
inline bool IsLetter(char c) { return IsLetter((byte) c); }//?????
inline bool IsUpper(char c) { return IsUpper((byte) c); }
inline bool IsLower(char c) { return IsLower((byte) c); }

View file

@ -67,7 +67,7 @@ void __LOGF__(const char *format, ...);
#define DUMPCC(c) UPP::DumpContainer2(VppLog() << #c << ':' << UPP::EOL, (c))
#define DUMPCCC(c) UPP::DumpContainer3(VppLog() << #c << ':' << UPP::EOL, (c))
#define DUMPM(c) UPP::DumpMap(VppLog() << #c << ':' << UPP::EOL, (c))
#define DUMPHEX(x) UPP::VppLog() << #x << " = "; UPP::LogHex(x)
#define DUMPHEX(x) UPP::VppLog() << #x << " = ", UPP::LogHex(x)
#define XASSERT(c, d) if(!bool(c)) { LOG("XASSERT failed"); LOGSRCPOS(); LOG(d); ASSERT(0); } else
#define NEVER() ASSERT(0)
#define NEVER_(msg) ASSERT_(0, msg)

File diff suppressed because one or more lines are too long