mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-29 15:54:48 -05:00
The Unicode module no longer depends on `cfg', since it gets the
relevant bits of it passed in to init_ucs(). (Actually I pass in all of it in the Windows version, since it's a bit hairy in there.) [originally from svn r2565]
This commit is contained in:
parent
5ecbac2441
commit
ac2367bc72
18
unicode.c
18
unicode.c
@ -416,7 +416,7 @@ static const struct cp_list_item cp_list[] = {
|
|||||||
|
|
||||||
static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr);
|
static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr);
|
||||||
|
|
||||||
void init_ucs(void)
|
void init_ucs(Config *cfg)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int used_dtf = 0;
|
int used_dtf = 0;
|
||||||
@ -426,14 +426,14 @@ void init_ucs(void)
|
|||||||
tbuf[i] = i;
|
tbuf[i] = i;
|
||||||
|
|
||||||
/* Decide on the Line and Font codepages */
|
/* Decide on the Line and Font codepages */
|
||||||
line_codepage = decode_codepage(cfg.line_codepage);
|
line_codepage = decode_codepage(cfg->line_codepage);
|
||||||
|
|
||||||
if (font_codepage <= 0) {
|
if (font_codepage <= 0) {
|
||||||
font_codepage=0;
|
font_codepage=0;
|
||||||
dbcs_screenfont=0;
|
dbcs_screenfont=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg.vtmode == VT_OEMONLY) {
|
if (cfg->vtmode == VT_OEMONLY) {
|
||||||
font_codepage = 437;
|
font_codepage = 437;
|
||||||
dbcs_screenfont = 0;
|
dbcs_screenfont = 0;
|
||||||
if (line_codepage <= 0)
|
if (line_codepage <= 0)
|
||||||
@ -453,7 +453,7 @@ void init_ucs(void)
|
|||||||
if (font_codepage == 437)
|
if (font_codepage == 437)
|
||||||
unitab_font[0] = unitab_font[255] = 0xFFFF;
|
unitab_font[0] = unitab_font[255] = 0xFFFF;
|
||||||
}
|
}
|
||||||
if (cfg.vtmode == VT_XWINDOWS)
|
if (cfg->vtmode == VT_XWINDOWS)
|
||||||
memcpy(unitab_font + 1, unitab_xterm_std,
|
memcpy(unitab_font + 1, unitab_xterm_std,
|
||||||
sizeof(unitab_xterm_std));
|
sizeof(unitab_xterm_std));
|
||||||
|
|
||||||
@ -461,14 +461,14 @@ void init_ucs(void)
|
|||||||
get_unitab(CP_OEMCP, unitab_oemcp, 1);
|
get_unitab(CP_OEMCP, unitab_oemcp, 1);
|
||||||
|
|
||||||
/* Collect CP437 ucs table for SCO acs */
|
/* Collect CP437 ucs table for SCO acs */
|
||||||
if (cfg.vtmode == VT_OEMANSI || cfg.vtmode == VT_XWINDOWS)
|
if (cfg->vtmode == VT_OEMANSI || cfg->vtmode == VT_XWINDOWS)
|
||||||
memcpy(unitab_scoacs, unitab_oemcp, sizeof(unitab_scoacs));
|
memcpy(unitab_scoacs, unitab_oemcp, sizeof(unitab_scoacs));
|
||||||
else
|
else
|
||||||
get_unitab(437, unitab_scoacs, 1);
|
get_unitab(437, unitab_scoacs, 1);
|
||||||
|
|
||||||
/* Collect line set ucs table */
|
/* Collect line set ucs table */
|
||||||
if (line_codepage == font_codepage &&
|
if (line_codepage == font_codepage &&
|
||||||
(dbcs_screenfont || cfg.vtmode == VT_POORMAN || font_codepage==0)) {
|
(dbcs_screenfont || cfg->vtmode == VT_POORMAN || font_codepage==0)) {
|
||||||
|
|
||||||
/* For DBCS and POOR fonts force direct to font */
|
/* For DBCS and POOR fonts force direct to font */
|
||||||
used_dtf = 1;
|
used_dtf = 1;
|
||||||
@ -535,14 +535,14 @@ void init_ucs(void)
|
|||||||
unitab_ctrl[i] = 0xFF;
|
unitab_ctrl[i] = 0xFF;
|
||||||
|
|
||||||
/* Generate line->screen direct conversion links. */
|
/* Generate line->screen direct conversion links. */
|
||||||
if (cfg.vtmode == VT_OEMANSI || cfg.vtmode == VT_XWINDOWS)
|
if (cfg->vtmode == VT_OEMANSI || cfg->vtmode == VT_XWINDOWS)
|
||||||
link_font(unitab_scoacs, unitab_oemcp, ATTR_OEMCP);
|
link_font(unitab_scoacs, unitab_oemcp, ATTR_OEMCP);
|
||||||
|
|
||||||
link_font(unitab_line, unitab_font, ATTR_ACP);
|
link_font(unitab_line, unitab_font, ATTR_ACP);
|
||||||
link_font(unitab_scoacs, unitab_font, ATTR_ACP);
|
link_font(unitab_scoacs, unitab_font, ATTR_ACP);
|
||||||
link_font(unitab_xterm, unitab_font, ATTR_ACP);
|
link_font(unitab_xterm, unitab_font, ATTR_ACP);
|
||||||
|
|
||||||
if (cfg.vtmode == VT_OEMANSI || cfg.vtmode == VT_XWINDOWS) {
|
if (cfg->vtmode == VT_OEMANSI || cfg->vtmode == VT_XWINDOWS) {
|
||||||
link_font(unitab_line, unitab_oemcp, ATTR_OEMCP);
|
link_font(unitab_line, unitab_oemcp, ATTR_OEMCP);
|
||||||
link_font(unitab_xterm, unitab_oemcp, ATTR_OEMCP);
|
link_font(unitab_xterm, unitab_oemcp, ATTR_OEMCP);
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ void init_ucs(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Last chance, if !unicode then try poorman links. */
|
/* Last chance, if !unicode then try poorman links. */
|
||||||
if (cfg.vtmode != VT_UNICODE) {
|
if (cfg->vtmode != VT_UNICODE) {
|
||||||
static char poorman_scoacs[] =
|
static char poorman_scoacs[] =
|
||||||
"CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";
|
"CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";
|
||||||
static char poorman_latin1[] =
|
static char poorman_latin1[] =
|
||||||
|
@ -2306,7 +2306,7 @@ int main(int argc, char **argv)
|
|||||||
inst->compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", FALSE);
|
inst->compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", FALSE);
|
||||||
inst->utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
|
inst->utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
|
||||||
|
|
||||||
inst->direct_to_font = init_ucs(font_charset);
|
inst->direct_to_font = init_ucs(cfg.line_codepage, font_charset);
|
||||||
|
|
||||||
inst->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
inst->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void (*putty_signal(int sig, void (*func)(int)))(int);
|
|||||||
/*
|
/*
|
||||||
* Exports from unicode.c.
|
* Exports from unicode.c.
|
||||||
*/
|
*/
|
||||||
int init_ucs(int font_charset);
|
int init_ucs(char *line_codepage, int font_charset);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Spare function exported directly from uxnet.c.
|
* Spare function exported directly from uxnet.c.
|
||||||
|
@ -104,7 +104,7 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
|
|||||||
/*
|
/*
|
||||||
* Return value is TRUE if pterm is to run in direct-to-font mode.
|
* Return value is TRUE if pterm is to run in direct-to-font mode.
|
||||||
*/
|
*/
|
||||||
int init_ucs(int font_charset)
|
int init_ucs(char *linecharset, int font_charset)
|
||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
@ -120,9 +120,9 @@ int init_ucs(int font_charset)
|
|||||||
* line_codepage should be decoded from the specification in
|
* line_codepage should be decoded from the specification in
|
||||||
* cfg.
|
* cfg.
|
||||||
*/
|
*/
|
||||||
line_codepage = charset_from_mimeenc(cfg.line_codepage);
|
line_codepage = charset_from_mimeenc(linecharset);
|
||||||
if (line_codepage == CS_NONE)
|
if (line_codepage == CS_NONE)
|
||||||
line_codepage = charset_from_xenc(cfg.line_codepage);
|
line_codepage = charset_from_xenc(linecharset);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If line_codepage is _still_ CS_NONE, we assume we're using
|
* If line_codepage is _still_ CS_NONE, we assume we're using
|
||||||
|
2
window.c
2
window.c
@ -1207,7 +1207,7 @@ static void init_fonts(int pick_width, int pick_height)
|
|||||||
}
|
}
|
||||||
fontflag[0] = fontflag[1] = fontflag[2] = 1;
|
fontflag[0] = fontflag[1] = fontflag[2] = 1;
|
||||||
|
|
||||||
init_ucs();
|
init_ucs(&cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void another_font(int fontno)
|
static void another_font(int fontno)
|
||||||
|
@ -201,6 +201,6 @@ void EnableSizeTip(int bEnable);
|
|||||||
/*
|
/*
|
||||||
* Exports from unicode.c.
|
* Exports from unicode.c.
|
||||||
*/
|
*/
|
||||||
void init_ucs(void);
|
void init_ucs(Config *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user