Added more Chinese support

This commit is contained in:
Michiel Broek
2005-04-06 20:50:00 +00:00
parent e23af63d04
commit a256051f8a
11 changed files with 95 additions and 15 deletions

View File

@@ -279,16 +279,7 @@ void Chat(char *username, char *channel)
* Allow hi-ascii for multi-language.
*/
ch = testkey(exitinfo.iScreenLen -1, curpos + 2);
if (isprint(ch) || (ch > 0x7F)) {
alarm_on();
if (curpos < 77) {
PUTCHAR(ch);
sbuf[curpos] = ch;
curpos++;
} else {
PUTCHAR(7);
}
} else if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) {
if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) {
alarm_on();
if (curpos) {
curpos--;
@@ -297,6 +288,16 @@ void Chat(char *username, char *channel)
} else {
PUTCHAR(7);
}
/* if KEY_DEL isprint, do no output again */
} else if (isprint(ch) || traduce(&ch)) {
alarm_on();
if (curpos < 77) {
PUTCHAR(ch);
sbuf[curpos] = ch;
curpos++;
} else {
PUTCHAR(7);
}
} else if ((ch == '\r') && curpos) {
alarm_on();
sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf);

View File

@@ -212,7 +212,7 @@ void GetstrLC(char *sStr, int iMaxlen)
}
}
if (ch > 31 && ch < 127) {
if ((ch > 31 && ch < 127) || traduce(&ch)) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);

View File

@@ -295,7 +295,7 @@ int traduce(char *ch)
{
int i;
for (i = 0; i < 85; i++){
for (i = 0; i < 81; i++){
if ( Language(35)[i] == '\0' ) break;
if ( *ch == Language(35)[i] ){
if ( Language(36)[i] != '\0'){
@@ -303,7 +303,17 @@ int traduce(char *ch)
}
return TRUE;
}
}
for (i = 0; i < 81; i++){
if ( Language(33)[i] == '\0' ) break;
if ( *ch == Language(33)[i] ){
if ( Language(34)[i] != '\0'){
*ch = ( Language(34)[i] );
}
return TRUE;
}
}
return FALSE;
}
@@ -332,16 +342,15 @@ void GetstrP(char *sStr, int iMaxLen, int Position)
while (ch != KEY_ENTER) {
ch = Readkey();
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
if (iPos > 0) {
BackErase();
sStr[--iPos] = '\0';
} else
PUTCHAR('\007');
}
if ((ch > 31) || traduce(&ch)) {
/* if 13 < DEL < 127 , should not output again */
} else if ((ch > 31 && ch < 127) || traduce(&ch)) {
if (iPos <= iMaxLen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);