Add ISO8859-2 / CP852 translation courtesy of Jaromir Filsak

[originally from svn r695]
This commit is contained in:
Simon Tatham 2000-10-09 16:29:12 +00:00
Родитель 3e7c4813d7
Коммит 7b444de332
4 изменённых файлов: 55 добавлений и 4 удалений

Просмотреть файл

@ -194,6 +194,7 @@ typedef struct {
VT_Mode vtmode;
int xlat_enablekoiwin;
int xlat_88592w1250;
int xlat_88592cp852;
int xlat_capslockcyr;
} Config;

Просмотреть файл

@ -128,6 +128,7 @@ void save_settings (char *section, int do_host, Config *cfg) {
}
write_setting_i (sesskey, "KoiWinXlat", cfg->xlat_enablekoiwin);
write_setting_i (sesskey, "88592Xlat", cfg->xlat_88592w1250);
write_setting_i (sesskey, "88592-CP852", cfg->xlat_88592cp852);
write_setting_i (sesskey, "CapsLockCyr", cfg->xlat_capslockcyr);
write_setting_i (sesskey, "ScrollBar", cfg->scrollbar);
write_setting_i (sesskey, "ScrollOnKey", cfg->scroll_on_key);
@ -272,6 +273,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
}
gppi (sesskey, "KoiWinXlat", 0, &cfg->xlat_enablekoiwin);
gppi (sesskey, "88592Xlat", 0, &cfg->xlat_88592w1250);
gppi (sesskey, "88592-CP852", 0, &cfg->xlat_88592cp852);
gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
gppi (sesskey, "ScrollBar", 1, &cfg->scrollbar);
gppi (sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);

Просмотреть файл

@ -997,6 +997,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_NOXLAT,
IDC_KOI8WIN1251,
IDC_88592WIN1250,
IDC_88592CP852,
IDC_CAPSLOCKCYR,
IDC_VTSTATIC,
IDC_VTXWINDOWS,
@ -1152,8 +1153,9 @@ static void init_dlg_ctrls(HWND hwnd) {
SetDlgItemInt (hwnd, IDC_GVALUE, cfg.colours[0][1], FALSE);
SetDlgItemInt (hwnd, IDC_BVALUE, cfg.colours[0][2], FALSE);
CheckRadioButton (hwnd, IDC_NOXLAT, IDC_88592WIN1250,
CheckRadioButton (hwnd, IDC_NOXLAT, IDC_88592CP852,
cfg.xlat_88592w1250 ? IDC_88592WIN1250 :
cfg.xlat_88592cp852 ? IDC_88592CP852 :
cfg.xlat_enablekoiwin ? IDC_KOI8WIN1251 :
IDC_NOXLAT);
CheckDlgButton (hwnd, IDC_CAPSLOCKCYR, cfg.xlat_capslockcyr);
@ -1440,7 +1442,8 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
"Character set translation:", IDC_XLATSTATIC,
"&None", IDC_NOXLAT,
"&KOI8 / Win-1251", IDC_KOI8WIN1251,
"&ISO-8859-2 / Win-1250", IDC_88592WIN1250, NULL);
"&ISO-8859-2 / Win-1250", IDC_88592WIN1250,
"&ISO-8859-2 / CP852", IDC_88592CP852, NULL);
endbox(&cp);
beginbox(&cp, "Enable character set translation on input data",
IDC_BOX_TRANSLATION3, IDC_BOXT_TRANSLATION3);
@ -2221,10 +2224,13 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
case IDC_NOXLAT:
case IDC_KOI8WIN1251:
case IDC_88592WIN1250:
case IDC_88592CP852:
cfg.xlat_enablekoiwin =
IsDlgButtonChecked (hwnd, IDC_KOI8WIN1251);
cfg.xlat_88592w1250 =
IsDlgButtonChecked (hwnd, IDC_88592WIN1250);
cfg.xlat_88592cp852 =
IsDlgButtonChecked (hwnd, IDC_88592CP852);
break;
case IDC_CAPSLOCKCYR:
if (HIWORD(wParam) == BN_CLICKED ||

46
xlat.c
Просмотреть файл

@ -89,12 +89,54 @@ static unsigned char xlatISO88592toWIN1250[] =
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
static unsigned char xlatISO88592toCP852[] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
242, 32, 34, 32, 34, 46, 43, 35, 32, 47,138, 60,151,141,166,141,
032, 34, 34, 34, 34,254, 45, 45, 32,126,154, 62,152,157,167,171,
255,164,244,157,207,149,151,245,249,230,184,155,141,240,166,189,
248,165,247,136,239,150,152,243,242,231,173,156,171,241,167,190,
232,181,182,198,142,145,143,128,172,144,168,211,183,214,215,210,
209,227,213,224,226,138,153,158,252,222,233,235,154,237,221,225,
234,160,131,199,132,146,134,135,159,130,169,137,216,161,140,212,
208,228,229,162,147,139,148,246,253,133,163,251,129,236,238,250,
};
static unsigned char xlatCP852toISO88592[] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
199,252,233,226,228,249,230,231,179,235,138,245,238,141,196,198,
201,197,229,244,246,165,181,140,156,214,154,171,187,157,215,232,
225,237,243,250,161,177,142,158,202,234,170,159,200,186,174,175,
176,177,178,179,180,193,194,204,170,185,186,187,188,175,191,191,
192,193,194,195,196,197,195,227,200,201,202,203,204,205,206,164,
240,208,207,203,239,210,205,206,236,217,218,219,220,222,217,223,
211,223,212,209,241,242,169,185,192,218,224,219,253,221,254,180,
173,189,128,183,162,167,247,178,176,168,255,251,216,248,149,160,
};
unsigned char xlat_kbd2tty(unsigned char c)
{
if(cfg.xlat_enablekoiwin)
return win2koi[c];
else if (cfg.xlat_88592w1250)
return xlatWIN1250toISO88592[c];
else if (cfg.xlat_88592cp852)
return xlatCP852toISO88592[c];
return c;
}
@ -102,8 +144,8 @@ unsigned char xlat_tty2scr(unsigned char c)
{
if(cfg.xlat_enablekoiwin)
return koi2win[c];
else if (cfg.xlat_88592w1250)
return xlatISO88592toWIN1250[c];
else if (cfg.xlat_88592cp852)
return xlatISO88592toCP852[c];
return c;
}