From 8772ac697da9af645ce4ce9d73b6406f7d126f49 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 12 Jan 2003 14:59:54 +0000 Subject: [PATCH] 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.) git-svn-id: svn://svn.tartarus.org/sgt/putty@2565 cda61777-01e9-0310-a592-d414129be87e --- unicode.c | 18 +++++++++--------- unix/pterm.c | 2 +- unix/unix.h | 2 +- unix/uxucs.c | 6 +++--- window.c | 2 +- winstuff.h | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/unicode.c b/unicode.c index 11357e60..3c25c6ea 100644 --- a/unicode.c +++ b/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); -void init_ucs(void) +void init_ucs(Config *cfg) { int i, j; int used_dtf = 0; @@ -426,14 +426,14 @@ void init_ucs(void) tbuf[i] = i; /* 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) { font_codepage=0; dbcs_screenfont=0; } - if (cfg.vtmode == VT_OEMONLY) { + if (cfg->vtmode == VT_OEMONLY) { font_codepage = 437; dbcs_screenfont = 0; if (line_codepage <= 0) @@ -453,7 +453,7 @@ void init_ucs(void) if (font_codepage == 437) unitab_font[0] = unitab_font[255] = 0xFFFF; } - if (cfg.vtmode == VT_XWINDOWS) + if (cfg->vtmode == VT_XWINDOWS) memcpy(unitab_font + 1, unitab_xterm_std, sizeof(unitab_xterm_std)); @@ -461,14 +461,14 @@ void init_ucs(void) get_unitab(CP_OEMCP, unitab_oemcp, 1); /* 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)); else get_unitab(437, unitab_scoacs, 1); /* Collect line set ucs table */ 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 */ used_dtf = 1; @@ -535,14 +535,14 @@ void init_ucs(void) unitab_ctrl[i] = 0xFF; /* 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_line, unitab_font, ATTR_ACP); link_font(unitab_scoacs, 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_xterm, unitab_oemcp, ATTR_OEMCP); } @@ -555,7 +555,7 @@ void init_ucs(void) } /* Last chance, if !unicode then try poorman links. */ - if (cfg.vtmode != VT_UNICODE) { + if (cfg->vtmode != VT_UNICODE) { static char poorman_scoacs[] = "CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* "; static char poorman_latin1[] = diff --git a/unix/pterm.c b/unix/pterm.c index f0f71e83..9fea217c 100644 --- a/unix/pterm.c +++ b/unix/pterm.c @@ -2306,7 +2306,7 @@ int main(int argc, char **argv) inst->compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", 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); diff --git a/unix/unix.h b/unix/unix.h index 4e006eb6..a1b155a6 100644 --- a/unix/unix.h +++ b/unix/unix.h @@ -69,7 +69,7 @@ void (*putty_signal(int sig, void (*func)(int)))(int); /* * 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. diff --git a/unix/uxucs.c b/unix/uxucs.c index 01aae629..5b211498 100644 --- a/unix/uxucs.c +++ b/unix/uxucs.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. */ -int init_ucs(int font_charset) +int init_ucs(char *linecharset, int font_charset) { int i, ret = 0; @@ -120,9 +120,9 @@ int init_ucs(int font_charset) * line_codepage should be decoded from the specification in * cfg. */ - line_codepage = charset_from_mimeenc(cfg.line_codepage); + line_codepage = charset_from_mimeenc(linecharset); 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 diff --git a/window.c b/window.c index ebf554ea..cfb8eae4 100644 --- a/window.c +++ b/window.c @@ -1207,7 +1207,7 @@ static void init_fonts(int pick_width, int pick_height) } fontflag[0] = fontflag[1] = fontflag[2] = 1; - init_ucs(); + init_ucs(&cfg); } static void another_font(int fontno) diff --git a/winstuff.h b/winstuff.h index e58c12ef..9516675a 100644 --- a/winstuff.h +++ b/winstuff.h @@ -201,6 +201,6 @@ void EnableSizeTip(int bEnable); /* * Exports from unicode.c. */ -void init_ucs(void); +void init_ucs(Config *); #endif -- 2.11.0