diff --git a/charset.c b/charset.c index 2eb719f..9f9d6f8 100644 --- a/charset.c +++ b/charset.c @@ -88,19 +88,6 @@ static KeySym StringToKeysym(char *s); // static void set_charset_name(char *csname); // static char *charset_name = CN; -static void charset_defaults(H3270 *hSession) -{ - /* Go to defaults first. */ - (void) memcpy((char *) hSession->charset.ebc2cg, (const char *)ebc2cg0, 256); - (void) memcpy((char *) hSession->charset.cg2ebc, (const char *)cg2ebc0, 256); - (void) memcpy((char *) hSession->charset.ebc2asc, (const char *)ebc2asc0, 256); - (void) memcpy((char *) hSession->charset.asc2ebc, (const char *)asc2ebc0, 256); -#if defined(X3270_FT) /*[*/ - (void) memcpy((char *)hSession->charset.ft2asc, (const char *)ft2asc0, 256); - (void) memcpy((char *)hSession->charset.asc2ft, (const char *)asc2ft0, 256); -#endif /*]*/ - clear_xks(); -} struct charset_buffer { @@ -498,9 +485,9 @@ static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scop if (scope == BOTH || scope == CS_ONLY) { if (iso <= 0xff) { - cg = asc2cg[iso]; + cg = hSession->charset.asc2cg[iso]; - if (cg2asc[cg] == iso || iso == 0) + if (hSession->charset.cg2asc[cg] == iso || iso == 0) { /* well-defined */ hSession->charset.ebc2cg[ebc] = cg; diff --git a/screen.c b/screen.c index fa9aca2..4de1e3b 100644 --- a/screen.c +++ b/screen.c @@ -337,7 +337,7 @@ void screen_update(H3270 *session, int bstart, int bend) else { if(lib3270_get_toggle(session,LIB3270_TOGGLE_MONOCASE)) - addch(session,baddr,asc2uc[session->charset.ebc2asc[session->ea_buf[baddr].cc]],attr,&first,&last); + addch(session,baddr,session->charset.asc2uc[session->charset.ebc2asc[session->ea_buf[baddr].cc]],attr,&first,&last); else addch(session,baddr,session->charset.ebc2asc[session->ea_buf[baddr].cc],attr,&first,&last); } diff --git a/tables.c b/tables.c index bb5c969..f4c63bf 100644 --- a/tables.c +++ b/tables.c @@ -41,7 +41,7 @@ #include "globals.h" #include "tablesc.h" -const unsigned short asc2cg[256] = { +static const unsigned short asc2cg[256] = { /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -75,7 +75,8 @@ const unsigned short asc2cg[256] = { /*f0*/ 0xf7, 0x5f, 0x43, 0x5d, 0x58, 0x46, 0x53, 0x9d, /*f8*/ 0x9b, 0x44, 0x5e, 0x59, 0x4e, 0x49, 0xf9, 0x47 }; -const unsigned short cg2asc[256] = { + +static const unsigned short cg2asc[256] = { /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xad, /*08*/ 0x3e, 0x3c, 0x5b, 0x5d, 0x29, 0x28, 0x7d, 0x7b, /*10*/ 0x20, 0x3d, 0x27, 0x22, 0x2f, 0x5c, 0x7c, 0xa6, @@ -110,7 +111,7 @@ const unsigned short cg2asc[256] = { /*f8*/ 0x20, 0xfe, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; -const unsigned short ebc2cg0[256] = { +static const unsigned short ebc2cg0[256] = { /*00*/ 0x00, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, /*08*/ 0xdf, 0xdf, 0xdf, 0xdf, 0x02, 0x03, 0x00, 0x00, /*10*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0x04, 0xdf, 0xdf, @@ -145,7 +146,7 @@ const unsigned short ebc2cg0[256] = { /*f8*/ 0x28, 0x29, 0x69, 0x79, 0x74, 0x64, 0x7e, 0x06 }; -const unsigned short cg2ebc0[256] = { +static const unsigned short cg2ebc0[256] = { /*00*/ 0x00, 0x41, 0x0c, 0x0d, 0x15, 0x19, 0xff, 0xca, /*08*/ 0x6e, 0x4c, 0xba, 0xbb, 0x5d, 0x4d, 0xd0, 0xc0, /*10*/ 0x40, 0x7e, 0x7d, 0x7f, 0x61, 0xe0, 0x4f, 0x6a, @@ -216,7 +217,7 @@ const unsigned short ebc2asc0[256] = { }; #ifdef EXTENDED_TABLES -const unsigned short ebc2asc70[256] = { +static const unsigned short ebc2asc70[256] = { /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, @@ -252,7 +253,7 @@ const unsigned short ebc2asc70[256] = { }; #endif // EXTENDED_TABLES -const unsigned short asc2ebc0[256] = { +static const unsigned short asc2ebc0[256] = { /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -288,7 +289,7 @@ const unsigned short asc2ebc0[256] = { }; #ifdef EXTENDED_TABLES -const unsigned short ge2asc[256] = { +static const unsigned short ge2asc[256] = { /*00*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /*08*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /*10*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, @@ -324,7 +325,7 @@ const unsigned short ge2asc[256] = { }; #endif // EXTENDED_TABLES -const unsigned short asc2uc[256] = { +static const unsigned short asc2uc[256] = { /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -358,7 +359,8 @@ const unsigned short asc2uc[256] = { /*f0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /*f8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff }; -const unsigned short ebc2uc[256] = { + +static const unsigned short ebc2uc[256] = { /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -394,7 +396,7 @@ const unsigned short ebc2uc[256] = { }; #if defined(X3270_FT) /*[*/ -const unsigned short ft2asc0[256] = { +static const unsigned short ft2asc0[256] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, @@ -451,6 +453,9 @@ LIB3270_INTERNAL void initialize_tables(H3270 *hSession) memcpy(hSession->charset.cg2ebc, cg2ebc0, sizeof(hSession->charset.cg2ebc)); memcpy(hSession->charset.ebc2asc, ebc2asc0, sizeof(hSession->charset.ebc2asc)); memcpy(hSession->charset.asc2ebc, asc2ebc0, sizeof(hSession->charset.asc2ebc)); + memcpy(hSession->charset.asc2uc, asc2uc, sizeof(hSession->charset.asc2uc)); + memcpy(hSession->charset.asc2cg, asc2cg, sizeof(hSession->charset.asc2cg)); + memcpy(hSession->charset.cg2asc, cg2asc, sizeof(hSession->charset.cg2asc)); #ifdef EXTENDED_TABLES memcpy(ebc2asc7, ebc2asc70, sizeof(ebc2asc7)); @@ -462,3 +467,17 @@ LIB3270_INTERNAL void initialize_tables(H3270 *hSession) #endif /*]*/ } + +void charset_defaults(H3270 *hSession) +{ + /* Go to defaults first. */ + (void) memcpy((char *) hSession->charset.ebc2cg, (const char *)ebc2cg0, 256); + (void) memcpy((char *) hSession->charset.cg2ebc, (const char *)cg2ebc0, 256); + (void) memcpy((char *) hSession->charset.ebc2asc, (const char *)ebc2asc0, 256); + (void) memcpy((char *) hSession->charset.asc2ebc, (const char *)asc2ebc0, 256); +#if defined(X3270_FT) /*[*/ + (void) memcpy((char *)hSession->charset.ft2asc, (const char *)ft2asc0, 256); + (void) memcpy((char *)hSession->charset.asc2ft, (const char *)asc2ft0, 256); +#endif /*]*/ + clear_xks(); +} diff --git a/tablesc.h b/tablesc.h index a57beac..05beccd 100644 --- a/tablesc.h +++ b/tablesc.h @@ -17,6 +17,8 @@ * Global declarations for tables.c. */ LIB3270_INTERNAL void initialize_tables(H3270 *hSession); +LIB3270_INTERNAL void charset_defaults(H3270 *hSession); + // LIB3270_INTERNAL unsigned short ebc2cg[256]; // LIB3270_INTERNAL unsigned short cg2ebc[256]; // LIB3270_INTERNAL unsigned short ebc2asc[256]; @@ -25,18 +27,18 @@ LIB3270_INTERNAL void initialize_tables(H3270 *hSession); // LIB3270_INTERNAL unsigned short asc2ft[256]; #ifdef EXTENDED_TABLES -LIB3270_INTERNAL unsigned short ebc2asc7[256]; -LIB3270_INTERNAL const unsigned short ebc2asc70[256]; -LIB3270_INTERNAL const unsigned short ge2asc[256]; +// LIB3270_INTERNAL unsigned short ebc2asc7[256]; +// LIB3270_INTERNAL const unsigned short ebc2asc70[256]; +// LIB3270_INTERNAL const unsigned short ge2asc[256]; #endif // EXTENDED_TABLES -LIB3270_INTERNAL const unsigned short asc2cg[256]; -LIB3270_INTERNAL const unsigned short cg2asc[256]; -LIB3270_INTERNAL const unsigned short ebc2cg0[256]; -LIB3270_INTERNAL const unsigned short cg2ebc0[256]; -LIB3270_INTERNAL const unsigned short ebc2asc0[256]; -LIB3270_INTERNAL const unsigned short asc2ebc0[256]; -LIB3270_INTERNAL const unsigned short asc2uc[256]; -LIB3270_INTERNAL const unsigned short ebc2uc[256]; -LIB3270_INTERNAL const unsigned short ft2asc0[256]; -LIB3270_INTERNAL const unsigned short asc2ft0[256]; +// LIB3270_INTERNAL const unsigned short asc2cg[256]; +// LIB3270_INTERNAL const unsigned short cg2asc[256]; +// LIB3270_INTERNAL const unsigned short ebc2cg0[256]; +// LIB3270_INTERNAL const unsigned short cg2ebc0[256]; + LIB3270_INTERNAL const unsigned short ebc2asc0[256]; +// LIB3270_INTERNAL const unsigned short asc2ebc0[256]; +// LIB3270_INTERNAL const unsigned short asc2uc[256]; +// LIB3270_INTERNAL const unsigned short ebc2uc[256]; +// LIB3270_INTERNAL const unsigned short ft2asc0[256]; + LIB3270_INTERNAL const unsigned short asc2ft0[256]; diff --git a/telnet.c b/telnet.c index 1c1d553..c38a361 100644 --- a/telnet.c +++ b/telnet.c @@ -1966,7 +1966,7 @@ static void process_bind(H3270 *hSession, unsigned char *buf, int buflen) if (namelen > BIND_PLU_NAME_MAX) namelen = BIND_PLU_NAME_MAX; for (i = 0; i < namelen; i++) { - hSession->plu_name[i] = ebc2asc0[buf[BIND_OFF_PLU_NAME + i]]; + hSession->plu_name[i] = hSession->charset.ebc2asc[buf[BIND_OFF_PLU_NAME + i]]; } } #endif /*]*/ -- libgit2 0.21.2