Commit 63165a77f95dc9b6099322624331c08cd2ae8429
1 parent
cfe92185
Exists in
master
and in
3 other branches
Trabalhando nas tabelas de conversao
Showing
8 changed files
with
59 additions
and
58 deletions
Show diff stats
ansi.c
... | ... | @@ -1090,16 +1090,16 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) |
1090 | 1090 | if (hSession->ansi_ch >= 0x5f && hSession->ansi_ch <= 0x7e) |
1091 | 1091 | ctlr_add(hSession,hSession->cursor_addr, (unsigned char)(hSession->ansi_ch - 0x5f),CS_LINEDRAW); |
1092 | 1092 | else |
1093 | - ctlr_add(hSession,hSession->cursor_addr, asc2ebc[hSession->ansi_ch], CS_BASE); | |
1093 | + ctlr_add(hSession,hSession->cursor_addr, hSession->charset.asc2ebc[hSession->ansi_ch], CS_BASE); | |
1094 | 1094 | break; |
1095 | 1095 | case CSD_UK: /* UK "A" */ |
1096 | 1096 | if (hSession->ansi_ch == '#') |
1097 | 1097 | ctlr_add(hSession,hSession->cursor_addr, 0x1e, CS_LINEDRAW); |
1098 | 1098 | else |
1099 | - ctlr_add(hSession,hSession->cursor_addr, asc2ebc[hSession->ansi_ch], CS_BASE); | |
1099 | + ctlr_add(hSession,hSession->cursor_addr, hSession->charset.asc2ebc[hSession->ansi_ch], CS_BASE); | |
1100 | 1100 | break; |
1101 | 1101 | case CSD_US: /* US "B" */ |
1102 | - ebc_ch = asc2ebc[hSession->ansi_ch]; | |
1102 | + ebc_ch = hSession->charset.asc2ebc[hSession->ansi_ch]; | |
1103 | 1103 | #if defined(X3270_DBCS) /*[*/ |
1104 | 1104 | d = ctlr_dbcs_state(cursor_addr); |
1105 | 1105 | if (dbcs) { | ... | ... |
charset.c
... | ... | @@ -91,13 +91,13 @@ static KeySym StringToKeysym(char *s); |
91 | 91 | static void charset_defaults(H3270 *hSession) |
92 | 92 | { |
93 | 93 | /* Go to defaults first. */ |
94 | - (void) memcpy((char *)ebc2cg, (const char *)ebc2cg0, 256); | |
95 | - (void) memcpy((char *)cg2ebc, (const char *)cg2ebc0, 256); | |
94 | + (void) memcpy((char *) hSession->charset.ebc2cg, (const char *)ebc2cg0, 256); | |
95 | + (void) memcpy((char *) hSession->charset.cg2ebc, (const char *)cg2ebc0, 256); | |
96 | 96 | (void) memcpy((char *) hSession->charset.ebc2asc, (const char *)ebc2asc0, 256); |
97 | - (void) memcpy((char *)asc2ebc, (const char *)asc2ebc0, 256); | |
97 | + (void) memcpy((char *) hSession->charset.asc2ebc, (const char *)asc2ebc0, 256); | |
98 | 98 | #if defined(X3270_FT) /*[*/ |
99 | - (void) memcpy((char *)ft2asc, (const char *)ft2asc0, 256); | |
100 | - (void) memcpy((char *)asc2ft, (const char *)asc2ft0, 256); | |
99 | + (void) memcpy((char *)hSession->charset.ft2asc, (const char *)ft2asc0, 256); | |
100 | + (void) memcpy((char *)hSession->charset.asc2ft, (const char *)asc2ft0, 256); | |
101 | 101 | #endif /*]*/ |
102 | 102 | clear_xks(); |
103 | 103 | } |
... | ... | @@ -118,25 +118,25 @@ struct charset_buffer |
118 | 118 | |
119 | 119 | static void save_charset(H3270 *hSession, struct charset_buffer *save) |
120 | 120 | { |
121 | - (void) memcpy((char *)save->ebc2cg, (char *)ebc2cg, 256); | |
122 | - (void) memcpy((char *)save->cg2ebc, (char *)cg2ebc, 256); | |
121 | + (void) memcpy((char *)save->ebc2cg, (char *) hSession->charset.ebc2cg, 256); | |
122 | + (void) memcpy((char *)save->cg2ebc, (char *) hSession->charset.cg2ebc, 256); | |
123 | 123 | (void) memcpy((char *)save->ebc2asc, (char *) hSession->charset.ebc2asc, 256); |
124 | - (void) memcpy((char *)save->asc2ebc, (char *)asc2ebc, 256); | |
124 | + (void) memcpy((char *)save->asc2ebc, (char *) hSession->charset.asc2ebc, 256); | |
125 | 125 | #if defined(X3270_FT) /*[*/ |
126 | - (void) memcpy((char *)save->ft2asc, (char *)ft2asc, 256); | |
127 | - (void) memcpy((char *)save->asc2ft, (char *)asc2ft, 256); | |
126 | + (void) memcpy((char *)save->ft2asc, (char *) hSession->charset.ft2asc, 256); | |
127 | + (void) memcpy((char *)save->asc2ft, (char *) hSession->charset.asc2ft, 256); | |
128 | 128 | #endif /*]*/ |
129 | 129 | } |
130 | 130 | |
131 | 131 | static void restore_charset(H3270 *hSession, struct charset_buffer *save) |
132 | 132 | { |
133 | - (void) memcpy((char *)ebc2cg, (char *)save->ebc2cg, 256); | |
134 | - (void) memcpy((char *)cg2ebc, (char *)save->cg2ebc, 256); | |
133 | + (void) memcpy((char *)hSession->charset.ebc2cg, (char *)save->ebc2cg, 256); | |
134 | + (void) memcpy((char *)hSession->charset.cg2ebc, (char *)save->cg2ebc, 256); | |
135 | 135 | (void) memcpy((char *)hSession->charset.ebc2asc, (char *)save->ebc2asc, 256); |
136 | - (void) memcpy((char *)asc2ebc, (char *)save->asc2ebc, 256); | |
136 | + (void) memcpy((char *)hSession->charset.asc2ebc, (char *)save->asc2ebc, 256); | |
137 | 137 | #if defined(X3270_FT) /*[*/ |
138 | - (void) memcpy((char *)ft2asc, (char *)save->ft2asc, 256); | |
139 | - (void) memcpy((char *)asc2ft, (char *)save->asc2ft, 256); | |
138 | + (void) memcpy((char *)hSession->charset.ft2asc, (char *)save->ft2asc, 256); | |
139 | + (void) memcpy((char *)hSession->charset.asc2ft, (char *)save->asc2ft, 256); | |
140 | 140 | #endif /*]*/ |
141 | 141 | } |
142 | 142 | |
... | ... | @@ -503,21 +503,21 @@ static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scop |
503 | 503 | if (cg2asc[cg] == iso || iso == 0) |
504 | 504 | { |
505 | 505 | /* well-defined */ |
506 | - ebc2cg[ebc] = cg; | |
506 | + hSession->charset.ebc2cg[ebc] = cg; | |
507 | 507 | if (!one_way) |
508 | - cg2ebc[cg] = ebc; | |
508 | + hSession->charset.cg2ebc[cg] = ebc; | |
509 | 509 | } |
510 | 510 | else |
511 | 511 | { |
512 | 512 | /* into a hole */ |
513 | - ebc2cg[ebc] = CG_boxsolid; | |
513 | + hSession->charset.ebc2cg[ebc] = CG_boxsolid; | |
514 | 514 | } |
515 | 515 | } |
516 | 516 | if (ebc > 0x40) |
517 | 517 | { |
518 | 518 | hSession->charset.ebc2asc[ebc] = iso; |
519 | 519 | if (!one_way) |
520 | - asc2ebc[iso] = ebc; | |
520 | + hSession->charset.asc2ebc[iso] = ebc; | |
521 | 521 | } |
522 | 522 | } |
523 | 523 | #if defined(X3270_FT) /*[*/ |
... | ... | @@ -537,8 +537,8 @@ static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scop |
537 | 537 | */ |
538 | 538 | aa = asc2ft0[ebc2asc0[ebc]]; |
539 | 539 | if (aa != ' ') { |
540 | - ft2asc[aa] = iso; | |
541 | - asc2ft[iso] = aa; | |
540 | + hSession->charset.ft2asc[aa] = iso; | |
541 | + hSession->charset.asc2ft[iso] = aa; | |
542 | 542 | } |
543 | 543 | } else if (scope == FT_ONLY) { |
544 | 544 | /* |
... | ... | @@ -548,8 +548,8 @@ static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scop |
548 | 548 | * and the ISO code that we would normally |
549 | 549 | * use to display that EBCDIC code. |
550 | 550 | */ |
551 | - ft2asc[iso] = hSession->charset.ebc2asc[ebc]; | |
552 | - asc2ft[hSession->charset.ebc2asc[ebc]] = iso; | |
551 | + hSession->charset.ft2asc[iso] = hSession->charset.ebc2asc[ebc]; | |
552 | + hSession->charset.asc2ft[hSession->charset.ebc2asc[ebc]] = iso; | |
553 | 553 | } |
554 | 554 | } |
555 | 555 | #endif /*]*/ |
... | ... | @@ -637,9 +637,9 @@ static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spe |
637 | 637 | |
638 | 638 | for (i = 0; i < 256; i++) { |
639 | 639 | if ((i & 0x7f) > 0x20 && i != 0x7f && |
640 | - asc2ebc[i] != 0 && | |
641 | - hSession->charset.ebc2asc[asc2ebc[i]] != i) { | |
642 | - asc2ebc[i] = 0; | |
640 | + hSession->charset.asc2ebc[i] != 0 && | |
641 | + hSession->charset.ebc2asc[hSession->charset.asc2ebc[i]] != i) { | |
642 | + hSession->charset.asc2ebc[i] = 0; | |
643 | 643 | } |
644 | 644 | } |
645 | 645 | } | ... | ... |
ft_cut.c
... | ... | @@ -194,7 +194,7 @@ static int upload_convert(H3270 *hSession, unsigned char *buf, int len) |
194 | 194 | if (ft->ascii_flag && ft->cr_flag && (c == '\r' || c == 0x1a)) |
195 | 195 | continue; |
196 | 196 | if (ft->ascii_flag && ft->remap_flag) |
197 | - c = ft2asc[c]; | |
197 | + c = hSession->charset.ft2asc[c]; | |
198 | 198 | *ob++ = c; |
199 | 199 | } |
200 | 200 | |
... | ... | @@ -206,6 +206,7 @@ static int upload_convert(H3270 *hSession, unsigned char *buf, int len) |
206 | 206 | */ |
207 | 207 | static int download_convert(H3270FT *ft, unsigned const char *buf, unsigned len, unsigned char *xobuf) |
208 | 208 | { |
209 | + H3270 *hSession = ft->host; | |
209 | 210 | unsigned char * ob0 = xobuf; |
210 | 211 | unsigned char * ob = ob0; |
211 | 212 | |
... | ... | @@ -230,7 +231,7 @@ static int download_convert(H3270FT *ft, unsigned const char *buf, unsigned len, |
230 | 231 | |
231 | 232 | /* Translate. */ |
232 | 233 | if (ft->ascii_flag && ft->remap_flag) |
233 | - c = asc2ft[c]; | |
234 | + c = hSession->charset.asc2ft[c]; | |
234 | 235 | |
235 | 236 | /* Quadrant already defined. */ |
236 | 237 | if (ft->quadrant >= 0) { |
... | ... | @@ -238,7 +239,7 @@ static int download_convert(H3270FT *ft, unsigned const char *buf, unsigned len, |
238 | 239 | if (ixp != (unsigned char *)NULL) |
239 | 240 | { |
240 | 241 | ix = ixp - conv[ft->quadrant].xlate; |
241 | - *ob++ = asc2ebc[(int)alphas[ix]]; | |
242 | + *ob++ = hSession->charset.asc2ebc[(int)alphas[ix]]; | |
242 | 243 | continue; |
243 | 244 | } |
244 | 245 | } |
... | ... | @@ -256,7 +257,7 @@ static int download_convert(H3270FT *ft, unsigned const char *buf, unsigned len, |
256 | 257 | continue; |
257 | 258 | ix = ixp - conv[ft->quadrant].xlate; |
258 | 259 | *ob++ = conv[ft->quadrant].selector; |
259 | - *ob++ = asc2ebc[(int)alphas[ix]]; | |
260 | + *ob++ = hSession->charset.asc2ebc[(int)alphas[ix]]; | |
260 | 261 | break; |
261 | 262 | } |
262 | 263 | if (ft->quadrant >= NQ) |
... | ... | @@ -433,9 +434,9 @@ static void cut_data_request(H3270 *hSession) |
433 | 434 | for (i = 0; i < count; i++) |
434 | 435 | cs ^= hSession->ea_buf[O_UP_DATA + i].cc; |
435 | 436 | |
436 | - ctlr_add(hSession,O_UP_CSUM, asc2ebc[(int)table6[cs & 0x3f]], 0); | |
437 | - ctlr_add(hSession,O_UP_LEN, asc2ebc[(int)table6[(count >> 6) & 0x3f]], 0); | |
438 | - ctlr_add(hSession,O_UP_LEN+1, asc2ebc[(int)table6[count & 0x3f]], 0); | |
437 | + ctlr_add(hSession,O_UP_CSUM, hSession->charset.asc2ebc[(int)table6[cs & 0x3f]], 0); | |
438 | + ctlr_add(hSession,O_UP_LEN, hSession->charset.asc2ebc[(int)table6[(count >> 6) & 0x3f]], 0); | |
439 | + ctlr_add(hSession,O_UP_LEN+1, hSession->charset.asc2ebc[(int)table6[count & 0x3f]], 0); | |
439 | 440 | |
440 | 441 | /* XXX: Change the data field attribute so it doesn't display. */ |
441 | 442 | attr = hSession->ea_buf[O_DR_SF].fa; | ... | ... |
ft_dft.c
... | ... | @@ -304,7 +304,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr) |
304 | 304 | |
305 | 305 | while (len--) |
306 | 306 | { |
307 | - *s = ft2asc[*s]; | |
307 | + *s = hSession->charset.ft2asc[*s]; | |
308 | 308 | s++; |
309 | 309 | } |
310 | 310 | } |
... | ... | @@ -413,7 +413,7 @@ static void dft_get_request(H3270 *hSession) |
413 | 413 | total_read++; |
414 | 414 | } |
415 | 415 | ft->ft_last_cr = (c == '\r') ? 1 : 0; |
416 | - *bufptr++ = ft->remap_flag? asc2ft[c]: c; | |
416 | + *bufptr++ = ft->remap_flag? hSession->charset.asc2ft[c]: c; | |
417 | 417 | numbytes--; |
418 | 418 | total_read++; |
419 | 419 | } else { |
... | ... | @@ -427,7 +427,7 @@ static void dft_get_request(H3270 *hSession) |
427 | 427 | int i = numread; |
428 | 428 | |
429 | 429 | while (i) { |
430 | - *s = asc2ft[*s]; | |
430 | + *s = hSession->charset.asc2ft[*s]; | |
431 | 431 | s++; |
432 | 432 | i--; |
433 | 433 | } | ... | ... |
kybd.c
... | ... | @@ -1030,7 +1030,7 @@ void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum |
1030 | 1030 | lib3270_trace_event(hSession," dropped (control char)\n"); |
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | - (void) key_Character(hSession, (int) asc2ebc[c], keytype == KT_GE, False, skipped); | |
1033 | + (void) key_Character(hSession, (int) hSession->charset.asc2ebc[c], keytype == KT_GE, False, skipped); | |
1034 | 1034 | } |
1035 | 1035 | #if defined(X3270_ANSI) /*[*/ |
1036 | 1036 | else if (IN_ANSI) | ... | ... |
... | ... | @@ -150,7 +150,7 @@ void do_qr_rpqnames(H3270 *hSession) |
150 | 150 | |
151 | 151 | /* Create fixed length portion - program id: x3270 */ |
152 | 152 | for (j = 0; j < 5; j++) { |
153 | - *hSession->obptr++ = asc2ebc[(int)"x3270"[j]]; | |
153 | + *hSession->obptr++ = hSession->charset.asc2ebc[(int)"x3270"[j]]; | |
154 | 154 | remaining--; |
155 | 155 | } |
156 | 156 | |
... | ... | @@ -202,7 +202,7 @@ void do_qr_rpqnames(H3270 *hSession) |
202 | 202 | { |
203 | 203 | for (i = 0; i < x; i++) |
204 | 204 | { |
205 | - *hSession->obptr++ = asc2ebc[(int)(*(build_rpq_version+i) & 0xff)]; | |
205 | + *hSession->obptr++ = hSession->charset.asc2ebc[(int)(*(build_rpq_version+i) & 0xff)]; | |
206 | 206 | } |
207 | 207 | } |
208 | 208 | break; |
... | ... | @@ -567,7 +567,7 @@ static int get_rpq_user(H3270 *hSession, unsigned char buf[], const int buflen) |
567 | 567 | if ((*rpqtext == '\\') && (*(rpqtext+1) != '\0')) |
568 | 568 | rpqtext++; |
569 | 569 | |
570 | - *buf++ = asc2ebc[(int)(*rpqtext & 0xff)]; | |
570 | + *buf++ = hSession->charset.asc2ebc[(int)(*rpqtext & 0xff)]; | |
571 | 571 | x++; |
572 | 572 | } |
573 | 573 | return x; | ... | ... |
tables.c
... | ... | @@ -434,12 +434,12 @@ const unsigned short asc2ft0[256] = { |
434 | 434 | |
435 | 435 | #endif /*]*/ |
436 | 436 | |
437 | -unsigned short ebc2cg[256]; | |
438 | -unsigned short cg2ebc[256]; | |
437 | +//unsigned short ebc2cg[256]; | |
438 | +//unsigned short cg2ebc[256]; | |
439 | 439 | // unsigned short ebc2asc[256]; |
440 | -unsigned short asc2ebc[256]; | |
441 | -unsigned short asc2ft[256]; | |
442 | -unsigned short ft2asc[256]; | |
440 | +// unsigned short asc2ebc[256]; | |
441 | +// unsigned short asc2ft[256]; | |
442 | +// unsigned short ft2asc[256]; | |
443 | 443 | |
444 | 444 | #ifdef EXTENDED_TABLES |
445 | 445 | unsigned short ebc2asc7[256]; |
... | ... | @@ -447,18 +447,18 @@ unsigned short ebc2asc7[256]; |
447 | 447 | LIB3270_INTERNAL void initialize_tables(H3270 *hSession) |
448 | 448 | { |
449 | 449 | /* Go to defaults first. */ |
450 | - memcpy(ebc2cg, ebc2cg0, sizeof(ebc2cg)); | |
451 | - memcpy(cg2ebc, cg2ebc0, sizeof(cg2ebc)); | |
450 | + memcpy(hSession->charset.ebc2cg, ebc2cg0, sizeof(hSession->charset.ebc2cg)); | |
451 | + memcpy(hSession->charset.cg2ebc, cg2ebc0, sizeof(hSession->charset.cg2ebc)); | |
452 | 452 | memcpy(hSession->charset.ebc2asc, ebc2asc0, sizeof(hSession->charset.ebc2asc)); |
453 | - memcpy(asc2ebc, asc2ebc0, sizeof(asc2ebc)); | |
453 | + memcpy(hSession->charset.asc2ebc, asc2ebc0, sizeof(hSession->charset.asc2ebc)); | |
454 | 454 | |
455 | 455 | #ifdef EXTENDED_TABLES |
456 | 456 | memcpy(ebc2asc7, ebc2asc70, sizeof(ebc2asc7)); |
457 | 457 | #endif // EXTENDED_TABLES |
458 | 458 | |
459 | 459 | #if defined(X3270_FT) /*[*/ |
460 | - memcpy(ft2asc, ft2asc0, sizeof(ft2asc)); | |
461 | - memcpy(asc2ft, asc2ft0, sizeof(asc2ft)); | |
460 | + memcpy(hSession->charset.ft2asc, ft2asc0, sizeof(hSession->charset.ft2asc)); | |
461 | + memcpy(hSession->charset.asc2ft, asc2ft0, sizeof(hSession->charset.asc2ft)); | |
462 | 462 | #endif /*]*/ |
463 | 463 | |
464 | 464 | } | ... | ... |
tablesc.h
... | ... | @@ -17,12 +17,12 @@ |
17 | 17 | * Global declarations for tables.c. |
18 | 18 | */ |
19 | 19 | LIB3270_INTERNAL void initialize_tables(H3270 *hSession); |
20 | -LIB3270_INTERNAL unsigned short ebc2cg[256]; | |
21 | -LIB3270_INTERNAL unsigned short cg2ebc[256]; | |
20 | +// LIB3270_INTERNAL unsigned short ebc2cg[256]; | |
21 | +// LIB3270_INTERNAL unsigned short cg2ebc[256]; | |
22 | 22 | // LIB3270_INTERNAL unsigned short ebc2asc[256]; |
23 | -LIB3270_INTERNAL unsigned short asc2ebc[256]; | |
24 | -LIB3270_INTERNAL unsigned short ft2asc[256]; | |
25 | -LIB3270_INTERNAL unsigned short asc2ft[256]; | |
23 | +// LIB3270_INTERNAL unsigned short asc2ebc[256]; | |
24 | +// LIB3270_INTERNAL unsigned short ft2asc[256]; | |
25 | +// LIB3270_INTERNAL unsigned short asc2ft[256]; | |
26 | 26 | |
27 | 27 | #ifdef EXTENDED_TABLES |
28 | 28 | LIB3270_INTERNAL unsigned short ebc2asc7[256]; | ... | ... |