The Unicode module no longer depends on `cfg', since it gets the
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 12 Jan 2003 14:59:54 +0000 (14:59 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 12 Jan 2003 14:59:54 +0000 (14:59 +0000)
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
unix/pterm.c
unix/unix.h
unix/uxucs.c
window.c
winstuff.h

index 11357e6..3c25c6e 100644 (file)
--- 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[] =
index f0f71e8..9fea217 100644 (file)
@@ -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);
 
index 4e006eb..a1b155a 100644 (file)
@@ -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.
index 01aae62..5b21149 100644 (file)
@@ -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
index ebf554e..cfb8eae 100644 (file)
--- 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)
index e58c12e..9516675 100644 (file)
@@ -201,6 +201,6 @@ void EnableSizeTip(int bEnable);
 /*
  * Exports from unicode.c.
  */
-void init_ucs(void);
+void init_ucs(Config *);
 
 #endif