Use an own 'UniChar' rather than 'wchar_t', which may not be large enough, depending on the platform.
Also split off UNICODE functionality from strlib.h into unicode.h. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3375 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1568,6 +1568,10 @@ SOURCE=..\..\src\libs\uio.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\src\libs\unicode.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\src\libs\vidlib.h
|
SOURCE=..\..\src\libs\vidlib.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
|
|
||||||
extern void FixContextFontEffect (void);
|
extern void FixContextFontEffect (void);
|
||||||
static inline TFB_Char *getCharFrame (FONT_DESC *fontPtr, wchar_t ch);
|
static inline TFB_Char *getCharFrame (FONT_DESC *fontPtr, UniChar ch);
|
||||||
|
|
||||||
|
|
||||||
FONT
|
FONT
|
||||||
@@ -119,7 +119,7 @@ TextRect (TEXT *lpText, RECT *pRect, BYTE *pdelta)
|
|||||||
{
|
{
|
||||||
COORD top_y, bot_y;
|
COORD top_y, bot_y;
|
||||||
SIZE width;
|
SIZE width;
|
||||||
wchar_t next_ch;
|
UniChar next_ch;
|
||||||
const unsigned char *pStr;
|
const unsigned char *pStr;
|
||||||
COUNT num_chars;
|
COUNT num_chars;
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ TextRect (TEXT *lpText, RECT *pRect, BYTE *pdelta)
|
|||||||
}
|
}
|
||||||
while (num_chars--)
|
while (num_chars--)
|
||||||
{
|
{
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
SIZE last_width;
|
SIZE last_width;
|
||||||
TFB_Char *charFrame;
|
TFB_Char *charFrame;
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr)
|
|||||||
FONT FontPtr;
|
FONT FontPtr;
|
||||||
|
|
||||||
COUNT num_chars;
|
COUNT num_chars;
|
||||||
wchar_t next_ch;
|
UniChar next_ch;
|
||||||
const unsigned char *pStr;
|
const unsigned char *pStr;
|
||||||
TEXT *TextPtr;
|
TEXT *TextPtr;
|
||||||
POINT origin;
|
POINT origin;
|
||||||
@@ -257,7 +257,7 @@ _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr)
|
|||||||
num_chars = 0;
|
num_chars = 0;
|
||||||
while (num_chars--)
|
while (num_chars--)
|
||||||
{
|
{
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
TFB_Char* fontChar;
|
TFB_Char* fontChar;
|
||||||
|
|
||||||
ch = next_ch;
|
ch = next_ch;
|
||||||
@@ -295,9 +295,9 @@ _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline TFB_Char *
|
static inline TFB_Char *
|
||||||
getCharFrame (FONT_DESC *fontPtr, wchar_t ch)
|
getCharFrame (FONT_DESC *fontPtr, UniChar ch)
|
||||||
{
|
{
|
||||||
wchar_t pageStart = ch & CHARACTER_PAGE_MASK;
|
UniChar pageStart = ch & CHARACTER_PAGE_MASK;
|
||||||
size_t charIndex;
|
size_t charIndex;
|
||||||
|
|
||||||
FONT_PAGE *page = fontPtr->fontPages;
|
FONT_PAGE *page = fontPtr->fontPages;
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
typedef struct FontPage
|
typedef struct FontPage
|
||||||
{
|
{
|
||||||
struct FontPage *next;
|
struct FontPage *next;
|
||||||
wchar_t pageStart;
|
UniChar pageStart;
|
||||||
#define CHARACTER_PAGE_MASK 0xff800
|
#define CHARACTER_PAGE_MASK 0xff800
|
||||||
wchar_t firstChar;
|
UniChar firstChar;
|
||||||
size_t numChars;
|
size_t numChars;
|
||||||
TFB_Char *charDesc;
|
TFB_Char *charDesc;
|
||||||
} FONT_PAGE;
|
} FONT_PAGE;
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ _ReleaseCelData (void *handle)
|
|||||||
|
|
||||||
typedef struct BuildCharDesc {
|
typedef struct BuildCharDesc {
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
wchar_t index;
|
UniChar index;
|
||||||
} BuildCharDesc;
|
} BuildCharDesc;
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
#include "libs/uio.h"
|
#include "libs/uio.h"
|
||||||
|
#include "libs/unicode.h"
|
||||||
|
|
||||||
|
|
||||||
extern BOOLEAN AnyButtonPress (BOOLEAN DetectSpecial);
|
extern BOOLEAN AnyButtonPress (BOOLEAN DetectSpecial);
|
||||||
@@ -43,8 +44,8 @@ extern volatile int GameActive;
|
|||||||
|
|
||||||
void EnterCharacterMode (void);
|
void EnterCharacterMode (void);
|
||||||
void ExitCharacterMode (void);
|
void ExitCharacterMode (void);
|
||||||
wchar_t GetNextCharacter (void);
|
UniChar GetNextCharacter (void);
|
||||||
wchar_t GetLastCharacter (void);
|
UniChar GetLastCharacter (void);
|
||||||
|
|
||||||
/* Interrogating the current key configuration */
|
/* Interrogating the current key configuration */
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
#define KBDBUFSIZE (1 << 8)
|
#define KBDBUFSIZE (1 << 8)
|
||||||
static int kbdhead=0, kbdtail=0;
|
static int kbdhead=0, kbdtail=0;
|
||||||
static wchar_t kbdbuf[KBDBUFSIZE];
|
static UniChar kbdbuf[KBDBUFSIZE];
|
||||||
static wchar_t lastchar;
|
static UniChar lastchar;
|
||||||
static int num_keys = 0;
|
static int num_keys = 0;
|
||||||
static int *kbdstate = NULL;
|
static int *kbdstate = NULL;
|
||||||
// Holds all SDL keys +1 for holding invalid values
|
// Holds all SDL keys +1 for holding invalid values
|
||||||
@@ -291,10 +291,10 @@ ExitCharacterMode (void)
|
|||||||
lastchar = 0;
|
lastchar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t
|
UniChar
|
||||||
GetNextCharacter (void)
|
GetNextCharacter (void)
|
||||||
{
|
{
|
||||||
wchar_t result;
|
UniChar result;
|
||||||
if (kbdhead == kbdtail)
|
if (kbdhead == kbdtail)
|
||||||
return 0;
|
return 0;
|
||||||
result = kbdbuf[kbdhead];
|
result = kbdbuf[kbdhead];
|
||||||
@@ -302,7 +302,7 @@ GetNextCharacter (void)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t
|
UniChar
|
||||||
GetLastCharacter (void)
|
GetLastCharacter (void)
|
||||||
{
|
{
|
||||||
return lastchar;
|
return lastchar;
|
||||||
@@ -353,7 +353,7 @@ ProcessInputEvent (const SDL_Event *Event)
|
|||||||
if (Event->type == SDL_KEYDOWN || Event->type == SDL_KEYUP)
|
if (Event->type == SDL_KEYDOWN || Event->type == SDL_KEYUP)
|
||||||
{ // process character input event, if any
|
{ // process character input event, if any
|
||||||
SDLKey k = Event->key.keysym.sym;
|
SDLKey k = Event->key.keysym.sym;
|
||||||
wchar_t map_key = Event->key.keysym.unicode;
|
UniChar map_key = Event->key.keysym.unicode;
|
||||||
|
|
||||||
if (k < 0 || k > num_keys)
|
if (k < 0 || k > num_keys)
|
||||||
k = num_keys; // for unknown keys
|
k = num_keys; // for unknown keys
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ resyncUTF8(const unsigned char **ptr) {
|
|||||||
// Returns 0 if the encoding is bad. This can be distinguished from the
|
// Returns 0 if the encoding is bad. This can be distinguished from the
|
||||||
// '\0' character by checking whether **ptr == '\0' before calling this
|
// '\0' character by checking whether **ptr == '\0' before calling this
|
||||||
// function.
|
// function.
|
||||||
wchar_t
|
UniChar
|
||||||
getCharFromString(const unsigned char **ptr) {
|
getCharFromString(const unsigned char **ptr) {
|
||||||
wchar_t result;
|
UniChar result;
|
||||||
|
|
||||||
if (**ptr < 0x80) {
|
if (**ptr < 0x80) {
|
||||||
// 0xxxxxxx, regular ASCII
|
// 0xxxxxxx, regular ASCII
|
||||||
@@ -126,7 +126,7 @@ err:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t
|
UniChar
|
||||||
getCharFromStringN(const unsigned char **ptr, const unsigned char *end) {
|
getCharFromStringN(const unsigned char **ptr, const unsigned char *end) {
|
||||||
size_t numBytes;
|
size_t numBytes;
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ getLineFromString(const unsigned char *start, const unsigned char **end,
|
|||||||
const unsigned char **startNext) {
|
const unsigned char **startNext) {
|
||||||
const unsigned char *ptr = start;
|
const unsigned char *ptr = start;
|
||||||
const unsigned char *lastPtr;
|
const unsigned char *lastPtr;
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
|
|
||||||
// Search for the first newline.
|
// Search for the first newline.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -215,7 +215,7 @@ getLineFromString(const unsigned char *start, const unsigned char **end,
|
|||||||
size_t
|
size_t
|
||||||
utf8StringCount(const unsigned char *start) {
|
utf8StringCount(const unsigned char *start) {
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ch = getCharFromString(&start);
|
ch = getCharFromString(&start);
|
||||||
@@ -228,7 +228,7 @@ utf8StringCount(const unsigned char *start) {
|
|||||||
size_t
|
size_t
|
||||||
utf8StringCountN(const unsigned char *start, const unsigned char *end) {
|
utf8StringCountN(const unsigned char *start, const unsigned char *end) {
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ch = getCharFromStringN(&start, end);
|
ch = getCharFromStringN(&start, end);
|
||||||
@@ -238,11 +238,11 @@ utf8StringCountN(const unsigned char *start, const unsigned char *end) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locates a wide char (ch) in a UTF-8 string (pStr)
|
// Locates a unicode character (ch) in a UTF-8 string (pStr)
|
||||||
// returns the char positions when found
|
// returns the char positions when found
|
||||||
// -1 when not found
|
// -1 when not found
|
||||||
int
|
int
|
||||||
utf8StringPos (const unsigned char *pStr, wchar_t ch)
|
utf8StringPos (const unsigned char *pStr, UniChar ch)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
@@ -278,9 +278,9 @@ int
|
|||||||
utf8StringCompare (const unsigned char *str1, const unsigned char *str2)
|
utf8StringCompare (const unsigned char *str1, const unsigned char *str2)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// wchar_t comparing version
|
// UniChar comparing version
|
||||||
wchar_t ch1;
|
UniChar ch1;
|
||||||
wchar_t ch2;
|
UniChar ch2;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@@ -321,7 +321,7 @@ utf8StringCompare (const unsigned char *str1, const unsigned char *str2)
|
|||||||
|
|
||||||
unsigned char *
|
unsigned char *
|
||||||
skipUTF8Chars(const unsigned char *ptr, size_t num) {
|
skipUTF8Chars(const unsigned char *ptr, size_t num) {
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
const unsigned char *oldPtr;
|
const unsigned char *oldPtr;
|
||||||
|
|
||||||
while (num--) {
|
while (num--) {
|
||||||
@@ -333,16 +333,16 @@ skipUTF8Chars(const unsigned char *ptr, size_t num) {
|
|||||||
return (unsigned char *) ptr;
|
return (unsigned char *) ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decodes a UTF-8 string (start) into a wide char string (wstr)
|
// Decodes a UTF-8 string (start) into a unicode character string (wstr)
|
||||||
// returns number of chars decoded and stored, not counting 0-term
|
// returns number of chars decoded and stored, not counting 0-term
|
||||||
// any chars that do not fit are truncated
|
// any chars that do not fit are truncated
|
||||||
// wide string term 0 is always appended, unless the destination
|
// wide string term 0 is always appended, unless the destination
|
||||||
// buffer is 0 chars long
|
// buffer is 0 chars long
|
||||||
size_t
|
size_t
|
||||||
getWideFromStringN(wchar_t *wstr, size_t maxcount,
|
getUniCharFromStringN(UniChar *wstr, size_t maxcount,
|
||||||
const unsigned char *start, const unsigned char *end)
|
const unsigned char *start, const unsigned char *end)
|
||||||
{
|
{
|
||||||
wchar_t *next;
|
UniChar *next;
|
||||||
|
|
||||||
if (maxcount == 0)
|
if (maxcount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -366,9 +366,10 @@ getWideFromStringN(wchar_t *wstr, size_t maxcount,
|
|||||||
// the only difference is that the source string (start) length is
|
// the only difference is that the source string (start) length is
|
||||||
// calculated by searching for 0-term
|
// calculated by searching for 0-term
|
||||||
size_t
|
size_t
|
||||||
getWideFromString(wchar_t *wstr, size_t maxcount, const unsigned char *start)
|
getUniCharFromString(UniChar *wstr, size_t maxcount,
|
||||||
|
const unsigned char *start)
|
||||||
{
|
{
|
||||||
wchar_t *next;
|
UniChar *next;
|
||||||
|
|
||||||
if (maxcount == 0)
|
if (maxcount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -394,12 +395,12 @@ getWideFromString(wchar_t *wstr, size_t maxcount, const unsigned char *start)
|
|||||||
// <0 : negative of bytes needed if buffer too small
|
// <0 : negative of bytes needed if buffer too small
|
||||||
// string term '\0' is *not* appended or counted
|
// string term '\0' is *not* appended or counted
|
||||||
int
|
int
|
||||||
getStringFromChar(unsigned char *ptr, size_t size, wchar_t ch)
|
getStringFromChar(unsigned char *ptr, size_t size, UniChar ch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static const struct range_def
|
static const struct range_def
|
||||||
{
|
{
|
||||||
wchar_t lim;
|
UniChar lim;
|
||||||
int marker;
|
int marker;
|
||||||
int mask;
|
int mask;
|
||||||
}
|
}
|
||||||
@@ -420,8 +421,8 @@ getStringFromChar(unsigned char *ptr, size_t size, wchar_t ch)
|
|||||||
;
|
;
|
||||||
if (def->mask == 0)
|
if (def->mask == 0)
|
||||||
{ // invalid or unsupported char
|
{ // invalid or unsupported char
|
||||||
log_add(log_Warning, "Warning: Invalid or unsupported wide char (%lu)",
|
log_add(log_Warning, "Warning: Invalid or unsupported unicode "
|
||||||
(unsigned long)ch);
|
"char (%lu)", (unsigned long) ch);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +455,7 @@ getStringFromChar(unsigned char *ptr, size_t size, wchar_t ch)
|
|||||||
// buffer is 0 bytes long
|
// buffer is 0 bytes long
|
||||||
size_t
|
size_t
|
||||||
getStringFromWideN(unsigned char *ptr, size_t size,
|
getStringFromWideN(unsigned char *ptr, size_t size,
|
||||||
const wchar_t *wstr, size_t count)
|
const UniChar *wstr, size_t count)
|
||||||
{
|
{
|
||||||
unsigned char *next;
|
unsigned char *next;
|
||||||
int used;
|
int used;
|
||||||
@@ -487,9 +488,9 @@ getStringFromWideN(unsigned char *ptr, size_t size,
|
|||||||
// the only difference is that the source string (wstr) length is
|
// the only difference is that the source string (wstr) length is
|
||||||
// calculated by searching for 0-term
|
// calculated by searching for 0-term
|
||||||
size_t
|
size_t
|
||||||
getStringFromWide(unsigned char *ptr, size_t size, const wchar_t *wstr)
|
getStringFromWide(unsigned char *ptr, size_t size, const UniChar *wstr)
|
||||||
{
|
{
|
||||||
const wchar_t *end;
|
const UniChar *end;
|
||||||
|
|
||||||
for (end = wstr; *end != 0; ++end)
|
for (end = wstr; *end != 0; ++end)
|
||||||
;
|
;
|
||||||
@@ -498,7 +499,7 @@ getStringFromWide(unsigned char *ptr, size_t size, const wchar_t *wstr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
isWideGraphChar(wchar_t ch)
|
UniChar_isGraph(UniChar ch)
|
||||||
{ // this is not technically sufficient, but close enough for us
|
{ // this is not technically sufficient, but close enough for us
|
||||||
// we'll consider all non-control (CO and C1) chars in 'graph' class
|
// we'll consider all non-control (CO and C1) chars in 'graph' class
|
||||||
// except for the "Private Use Area" (0xE000 - 0xF8FF)
|
// except for the "Private Use Area" (0xE000 - 0xF8FF)
|
||||||
@@ -512,23 +513,24 @@ isWideGraphChar(wchar_t ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
isWidePrintChar(wchar_t ch)
|
UniChar_isPrint(UniChar ch)
|
||||||
{ // this is not technically sufficient, but close enough for us
|
{ // this is not technically sufficient, but close enough for us
|
||||||
// chars in 'print' class are 'graph' + 'space' classes
|
// chars in 'print' class are 'graph' + 'space' classes
|
||||||
// the only space we currently have defined is 0x20
|
// the only space we currently have defined is 0x20
|
||||||
return (ch == 0x20) || isWideGraphChar(ch);
|
return (ch == 0x20) || UniChar_isGraph(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t
|
UniChar
|
||||||
toWideUpper(wchar_t ch)
|
UniChar_toUpper(UniChar ch)
|
||||||
{ // this is a very basic Latin-1 implementation
|
{ // this is a very basic Latin-1 implementation
|
||||||
// just to get things going
|
// just to get things going
|
||||||
return (ch < 0x100) ? toupper(ch) : ch;
|
return (ch < 0x100) ? (UniChar) toupper((int) ch) : ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t
|
UniChar
|
||||||
toWideLower(wchar_t ch)
|
UniChar_toLower(UniChar ch)
|
||||||
{ // this is a very basic Latin-1 implementation
|
{ // this is a very basic Latin-1 implementation
|
||||||
// just to get things going
|
// just to get things going
|
||||||
return (ch < 0x100) ? tolower(ch) : ch;
|
return (ch < 0x100) ? (UniChar) tolower((int) ch) : ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-32
@@ -22,6 +22,7 @@
|
|||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
#include "libs/uio.h"
|
#include "libs/uio.h"
|
||||||
|
#include "libs/unicode.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
@@ -57,42 +58,15 @@ extern STRINGPTR GetStringTimeStamp (STRING String);
|
|||||||
extern BOOLEAN GetStringContents (STRING String, STRINGPTR StringBuf,
|
extern BOOLEAN GetStringContents (STRING String, STRINGPTR StringBuf,
|
||||||
BOOLEAN AppendSpace);
|
BOOLEAN AppendSpace);
|
||||||
|
|
||||||
wchar_t getCharFromString(const unsigned char **ptr);
|
#define UNICHAR_DEGREE_SIGN 0x00b0
|
||||||
wchar_t getCharFromStringN(const unsigned char **ptr,
|
|
||||||
const unsigned char *end);
|
|
||||||
unsigned char *getLineFromString(const unsigned char *start,
|
|
||||||
const unsigned char **end, const unsigned char **startNext);
|
|
||||||
size_t utf8StringCount(const unsigned char *start);
|
|
||||||
size_t utf8StringCountN(const unsigned char *start,
|
|
||||||
const unsigned char *end);
|
|
||||||
int utf8StringPos (const unsigned char *pStr, wchar_t ch);
|
|
||||||
unsigned char *utf8StringCopy (unsigned char *dst, size_t size,
|
|
||||||
const unsigned char *src);
|
|
||||||
int utf8StringCompare (const unsigned char *str1, const unsigned char *str2);
|
|
||||||
unsigned char *skipUTF8Chars(const unsigned char *ptr, size_t num);
|
|
||||||
size_t getWideFromString(wchar_t *wstr, size_t maxcount,
|
|
||||||
const unsigned char *start);
|
|
||||||
size_t getWideFromStringN(wchar_t *wstr, size_t maxcount,
|
|
||||||
const unsigned char *start, const unsigned char *end);
|
|
||||||
int getStringFromChar(unsigned char *ptr, size_t size, wchar_t ch);
|
|
||||||
size_t getStringFromWideN(unsigned char *ptr, size_t size,
|
|
||||||
const wchar_t *wstr, size_t count);
|
|
||||||
size_t getStringFromWide(unsigned char *ptr, size_t size,
|
|
||||||
const wchar_t *wstr);
|
|
||||||
int isWideGraphChar(wchar_t ch);
|
|
||||||
int isWidePrintChar(wchar_t ch);
|
|
||||||
wchar_t toWideUpper(wchar_t ch);
|
|
||||||
wchar_t toWideLower(wchar_t ch);
|
|
||||||
|
|
||||||
#define WCHAR_DEGREE_SIGN 0x00b0
|
|
||||||
#define STR_DEGREE_SIGN "\xC2\xB0"
|
#define STR_DEGREE_SIGN "\xC2\xB0"
|
||||||
#define WCHAR_INFINITY_SIGN 0x221e
|
#define UNICHAR_INFINITY_SIGN 0x221e
|
||||||
#define STR_INFINITY_SIGN "\xE2\x88\x9E"
|
#define STR_INFINITY_SIGN "\xE2\x88\x9E"
|
||||||
#define WCHAR_EARTH_SIGN 0x2641
|
#define UNICHAR_EARTH_SIGN 0x2641
|
||||||
#define STR_EARTH_SIGN "\xE2\x99\x81"
|
#define STR_EARTH_SIGN "\xE2\x99\x81"
|
||||||
#define WCHAR_MIDDLE_DOT 0x00b7
|
#define UNICHAR_MIDDLE_DOT 0x00b7
|
||||||
#define STR_MIDDLE_DOT "\xC2\xB7"
|
#define STR_MIDDLE_DOT "\xC2\xB7"
|
||||||
#define WCHAR_BULLET 0x2022
|
#define UNICHAR_BULLET 0x2022
|
||||||
#define STR_BULLET "\xE2\x80\xA2"
|
#define STR_BULLET "\xE2\x80\xA2"
|
||||||
|
|
||||||
#endif /* _STRLIB_H */
|
#endif /* _STRLIB_H */
|
||||||
|
|||||||
+1
-1
@@ -323,7 +323,7 @@ getLineWithinWidth(TEXT *pText, const unsigned char **startNext,
|
|||||||
COUNT oldCount;
|
COUNT oldCount;
|
||||||
const unsigned char *ptr;
|
const unsigned char *ptr;
|
||||||
const unsigned char *wordStart;
|
const unsigned char *wordStart;
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
COUNT charCount;
|
COUNT charCount;
|
||||||
|
|
||||||
//GetContextClipRect (&rect);
|
//GetContextClipRect (&rect);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ JoyCharToLower (joy_char_t *outch, const joy_char_t *ch,
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
DoTextEntry (TEXTENTRY_STATE *pTES)
|
DoTextEntry (TEXTENTRY_STATE *pTES)
|
||||||
{
|
{
|
||||||
wchar_t ch;
|
UniChar ch;
|
||||||
UNICODE *pStr;
|
UNICODE *pStr;
|
||||||
UNICODE *CacheInsPt;
|
UNICODE *CacheInsPt;
|
||||||
int CacheCursorPos;
|
int CacheCursorPos;
|
||||||
@@ -209,7 +209,7 @@ DoTextEntry (TEXTENTRY_STATE *pTES)
|
|||||||
pTES->JoystickMode = FALSE;
|
pTES->JoystickMode = FALSE;
|
||||||
|
|
||||||
chsize = getStringFromChar (chbuf, sizeof (chbuf), ch);
|
chsize = getStringFromChar (chbuf, sizeof (chbuf), ch);
|
||||||
if (isWidePrintChar (ch) && chsize > 0)
|
if (UniChar_isPrint (ch) && chsize > 0)
|
||||||
{
|
{
|
||||||
if (pStr + len - pTES->BaseStr + chsize < pTES->MaxSize)
|
if (pStr + len - pTES->BaseStr + chsize < pTES->MaxSize)
|
||||||
{ // insert character, when fits
|
{ // insert character, when fits
|
||||||
|
|||||||
@@ -968,10 +968,10 @@ FindNextStarIndex (STAR_SEARCH_STATE *pSS, int from, BOOLEAN WithinClust)
|
|||||||
for (c = 0, sptr = pSS->Cluster, dptr = ClusterName;
|
for (c = 0, sptr = pSS->Cluster, dptr = ClusterName;
|
||||||
c < pSS->ClusterLen; ++c)
|
c < pSS->ClusterLen; ++c)
|
||||||
{
|
{
|
||||||
wchar_t sc = getCharFromString (&sptr);
|
UniChar sc = getCharFromString (&sptr);
|
||||||
wchar_t dc = getCharFromString (&dptr);
|
UniChar dc = getCharFromString (&dptr);
|
||||||
|
|
||||||
if (toWideUpper (sc) != toWideUpper (dc))
|
if (UniChar_toUpper (sc) != UniChar_toUpper (dc))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,10 +1010,10 @@ FindNextStarIndex (STAR_SEARCH_STATE *pSS, int from, BOOLEAN WithinClust)
|
|||||||
for (c = 0, sptr = pSS->Prefix, dptr = FullName;
|
for (c = 0, sptr = pSS->Prefix, dptr = FullName;
|
||||||
c < pSS->PrefixLen; ++c)
|
c < pSS->PrefixLen; ++c)
|
||||||
{
|
{
|
||||||
wchar_t sc = getCharFromString (&sptr);
|
UniChar sc = getCharFromString (&sptr);
|
||||||
wchar_t dc = getCharFromString (&dptr);
|
UniChar dc = getCharFromString (&dptr);
|
||||||
|
|
||||||
if (toWideUpper (sc) != toWideUpper (dc))
|
if (UniChar_toUpper (sc) != UniChar_toUpper (dc))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
BYTE ButtonState;
|
BYTE ButtonState;
|
||||||
int end_page_len;
|
int end_page_len;
|
||||||
UNICODE end_page_buf[200];
|
UNICODE end_page_buf[200];
|
||||||
wchar_t last_c;
|
UniChar last_c;
|
||||||
COUNT row_cells;
|
COUNT row_cells;
|
||||||
BOOLEAN Sleepy;
|
BOOLEAN Sleepy;
|
||||||
RECT r;
|
RECT r;
|
||||||
@@ -142,11 +142,11 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
{
|
{
|
||||||
COUNT word_chars;
|
COUNT word_chars;
|
||||||
const UNICODE *pStr;
|
const UNICODE *pStr;
|
||||||
wchar_t c;
|
UniChar c;
|
||||||
|
|
||||||
pStr = t.pStr;
|
pStr = t.pStr;
|
||||||
pNextStr = t.pStr;
|
pNextStr = t.pStr;
|
||||||
while (isWideGraphChar (getCharFromString (&pNextStr)))
|
while (UniChar_isGraph (getCharFromString (&pNextStr)))
|
||||||
pStr = pNextStr;
|
pStr = pNextStr;
|
||||||
|
|
||||||
word_chars = utf8StringCountN (t.pStr, pStr);
|
word_chars = utf8StringCountN (t.pStr, pStr);
|
||||||
|
|||||||
Reference in New Issue
Block a user