Commit f7af7ca6b07710582aa673888bc7ee02e9e80d42
1 parent
3210508b
Exists in
master
and in
5 other branches
wip - Reduzindo tamanho da tabela de charsets
Showing
14 changed files
with
260 additions
and
350 deletions
Show diff stats
src/include/lib3270/config.h.in
src/include/lib3270/log.h
... | ... | @@ -42,7 +42,6 @@ |
42 | 42 | #define lib3270_write_log(s,m,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ ) |
43 | 43 | #define lib3270_write_rc(s,m,r,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ ) |
44 | 44 | #define lib3270_write_va_log(s,m,f,a) __android_log_vprint(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", a) |
45 | - #define trace(x, ...) __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__) | |
46 | 45 | |
47 | 46 | #else |
48 | 47 | |
... | ... | @@ -51,14 +50,14 @@ |
51 | 50 | LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5); |
52 | 51 | LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg); |
53 | 52 | |
54 | - #ifdef DEBUG | |
55 | - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
56 | - #else | |
57 | - #define trace(x, ...) // __VA_ARGS__ | |
58 | - #endif | |
59 | - | |
60 | 53 | #endif // ANDROID |
61 | 54 | |
55 | + #ifdef DEBUG | |
56 | + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
57 | + #else | |
58 | + #define trace(x, ...) // __VA_ARGS__ | |
59 | + #endif | |
60 | + | |
62 | 61 | #endif // LIB3270_LOG_H_INCLUDED |
63 | 62 | |
64 | 63 | ... | ... |
src/include/lib3270/session.h
... | ... | @@ -67,7 +67,9 @@ |
67 | 67 | #define LIB3270_TA void |
68 | 68 | #endif // !LIB3270_TA |
69 | 69 | |
70 | - #define LIB3270_MB_MAX 16 | |
70 | + #define LIB3270_MB_MAX 16 | |
71 | + #define LIB3270_DEFAULT_CGEN 0x02b90000 | |
72 | + #define LIB3270_DEFAULT_CSET 0x00000025 | |
71 | 73 | |
72 | 74 | struct _h3270 |
73 | 75 | { |
... | ... | @@ -107,6 +109,7 @@ |
107 | 109 | int trace_skipping : 1; |
108 | 110 | int need_tls_follows : 1; |
109 | 111 | int cut_xfer_in_progress : 1; |
112 | + int auto_keymap : 1; | |
110 | 113 | |
111 | 114 | char * oversize; |
112 | 115 | |
... | ... | @@ -264,6 +267,9 @@ |
264 | 267 | // ft_dft.c |
265 | 268 | int dft_buffersize; /**< Buffer size (LIMIN, LIMOUT) */ |
266 | 269 | |
270 | + // charset.c | |
271 | + unsigned long cgcsgid; | |
272 | + | |
267 | 273 | // rpq.c |
268 | 274 | int rpq_complained : 1; |
269 | 275 | #if !defined(_WIN32) | ... | ... |
src/lib3270/charset.c
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
19 | 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 | * |
21 | - * Este programa está nomeado como charset.c e possui 749 linhas de código. | |
21 | + * Este programa está nomeado como charset.c e possui - linhas de código. | |
22 | 22 | * |
23 | 23 | * Contatos: |
24 | 24 | * |
... | ... | @@ -26,7 +26,6 @@ |
26 | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
27 | 27 | * licinio@bb.com.br (Licínio Luis Branco) |
28 | 28 | * kraucer@bb.com.br (Kraucer Fernandes Mazuco) |
29 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | |
30 | 29 | * |
31 | 30 | */ |
32 | 31 | |
... | ... | @@ -49,12 +48,6 @@ |
49 | 48 | #include <stdlib.h> |
50 | 49 | #endif // !ANDROID |
51 | 50 | |
52 | -/* | |
53 | -#if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32)) | |
54 | -#include "screenc.h" | |
55 | -#endif | |
56 | -*/ | |
57 | - | |
58 | 51 | #include "tablesc.h" |
59 | 52 | #include "utf8c.h" |
60 | 53 | #include "utilc.h" |
... | ... | @@ -63,49 +56,31 @@ |
63 | 56 | |
64 | 57 | #include <errno.h> |
65 | 58 | |
66 | -//#include <locale.h> | |
67 | - | |
68 | -/* | |
69 | -#if !defined(_WIN32) | |
70 | -#include <langinfo.h> | |
71 | -#endif | |
72 | -*/ | |
73 | - | |
74 | -// #include <lib3270/api.h> | |
75 | - | |
76 | 59 | #define EURO_SUFFIX "-euro" |
77 | 60 | #define ES_SIZE (sizeof(EURO_SUFFIX) - 1) |
78 | 61 | |
79 | 62 | /* Globals. */ |
80 | -// static Boolean charset_changed = False; | |
81 | -#define DEFAULT_CGEN 0x02b90000 | |
82 | -#define DEFAULT_CSET 0x00000025 | |
83 | -unsigned long cgcsgid = DEFAULT_CGEN | DEFAULT_CSET; | |
84 | -unsigned long cgcsgid_dbcs = 0L; | |
63 | +// unsigned long cgcsgid = LIB3270_DEFAULT_CGEN | LIB3270_DEFAULT_CSET; | |
64 | +// unsigned long cgcsgid_dbcs = 0L; | |
85 | 65 | const char *default_display_charset = "3270cg-1a,3270cg-1,iso8859-1"; |
86 | -// char *converter_names; | |
87 | -char *encoding; | |
88 | - | |
89 | -/* | |
90 | -#if defined(X3270_DISPLAY) | |
91 | -unsigned char xk_selector = 0; | |
92 | -#endif | |
93 | -*/ | |
66 | +// char *encoding; | |
94 | 67 | |
95 | -unsigned char auto_keymap = 0; | |
68 | +// unsigned char auto_keymap = 0; | |
96 | 69 | |
97 | 70 | /* Statics. */ |
98 | 71 | static enum cs_result resource_charset(H3270 *hSession, const char *csname, char *cs, char *ftcs); |
72 | + | |
99 | 73 | typedef enum { CS_ONLY, FT_ONLY, BOTH } remap_scope; |
100 | -static enum cs_result remap_chars(const char *csname, char *spec, remap_scope scope, int *ne); | |
101 | -static void remap_one(unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); | |
74 | + | |
75 | +static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spec, remap_scope scope, int *ne); | |
76 | +static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); | |
102 | 77 | |
103 | 78 | #if defined(DEBUG_CHARSET) /*[*/ |
104 | 79 | static enum cs_result check_charset(void); |
105 | 80 | static char *char_if_ascii7(unsigned long l); |
106 | 81 | #endif /*]*/ |
107 | 82 | |
108 | -static void set_cgcsgids(const char *spec); | |
83 | +static void set_cgcsgids(H3270 *hSession, const char *spec); | |
109 | 84 | static int set_cgcsgid(char *spec, unsigned long *idp); |
110 | 85 | |
111 | 86 | static KeySym StringToKeysym(char *s); |
... | ... | @@ -113,54 +88,55 @@ static KeySym StringToKeysym(char *s); |
113 | 88 | // static void set_charset_name(char *csname); |
114 | 89 | // static char *charset_name = CN; |
115 | 90 | |
116 | -static void | |
117 | -charset_defaults(void) | |
91 | +static void charset_defaults(void) | |
118 | 92 | { |
119 | 93 | /* Go to defaults first. */ |
120 | - (void) memcpy((char *)ebc2cg, (char *)ebc2cg0, 256); | |
121 | - (void) memcpy((char *)cg2ebc, (char *)cg2ebc0, 256); | |
122 | - (void) memcpy((char *)ebc2asc, (char *)ebc2asc0, 256); | |
123 | - (void) memcpy((char *)asc2ebc, (char *)asc2ebc0, 256); | |
94 | + (void) memcpy((char *)ebc2cg, (const char *)ebc2cg0, 256); | |
95 | + (void) memcpy((char *)cg2ebc, (const char *)cg2ebc0, 256); | |
96 | + (void) memcpy((char *)ebc2asc, (const char *)ebc2asc0, 256); | |
97 | + (void) memcpy((char *)asc2ebc, (const char *)asc2ebc0, 256); | |
124 | 98 | #if defined(X3270_FT) /*[*/ |
125 | - (void) memcpy((char *)ft2asc, (char *)ft2asc0, 256); | |
126 | - (void) memcpy((char *)asc2ft, (char *)asc2ft0, 256); | |
99 | + (void) memcpy((char *)ft2asc, (const char *)ft2asc0, 256); | |
100 | + (void) memcpy((char *)asc2ft, (const char *)asc2ft0, 256); | |
127 | 101 | #endif /*]*/ |
128 | 102 | clear_xks(); |
129 | 103 | } |
130 | 104 | |
131 | -static unsigned char save_ebc2cg[256]; | |
132 | -static unsigned char save_cg2ebc[256]; | |
133 | -static unsigned char save_ebc2asc[256]; | |
134 | -static unsigned char save_asc2ebc[256]; | |
105 | +struct charset_buffer | |
106 | +{ | |
107 | + unsigned char ebc2cg[256]; | |
108 | + unsigned char cg2ebc[256]; | |
109 | + unsigned char ebc2asc[256]; | |
110 | + unsigned char asc2ebc[256]; | |
135 | 111 | |
136 | -#if defined(X3270_FT) /*[*/ | |
137 | -static unsigned char save_ft2asc[256]; | |
138 | -static unsigned char save_asc2ft[256]; | |
139 | -#endif /*]*/ | |
112 | + #if defined(X3270_FT) /*[*/ | |
113 | + unsigned char ft2asc[256]; | |
114 | + unsigned char asc2ft[256]; | |
115 | + #endif /*]*/ | |
116 | +}; | |
140 | 117 | |
141 | -static void | |
142 | -save_charset(void) | |
118 | + | |
119 | +static void save_charset(struct charset_buffer *save) | |
143 | 120 | { |
144 | - (void) memcpy((char *)save_ebc2cg, (char *)ebc2cg, 256); | |
145 | - (void) memcpy((char *)save_cg2ebc, (char *)cg2ebc, 256); | |
146 | - (void) memcpy((char *)save_ebc2asc, (char *)ebc2asc, 256); | |
147 | - (void) memcpy((char *)save_asc2ebc, (char *)asc2ebc, 256); | |
121 | + (void) memcpy((char *)save->ebc2cg, (char *)ebc2cg, 256); | |
122 | + (void) memcpy((char *)save->cg2ebc, (char *)cg2ebc, 256); | |
123 | + (void) memcpy((char *)save->ebc2asc, (char *)ebc2asc, 256); | |
124 | + (void) memcpy((char *)save->asc2ebc, (char *)asc2ebc, 256); | |
148 | 125 | #if defined(X3270_FT) /*[*/ |
149 | - (void) memcpy((char *)save_ft2asc, (char *)ft2asc, 256); | |
150 | - (void) memcpy((char *)save_asc2ft, (char *)asc2ft, 256); | |
126 | + (void) memcpy((char *)save->ft2asc, (char *)ft2asc, 256); | |
127 | + (void) memcpy((char *)save->asc2ft, (char *)asc2ft, 256); | |
151 | 128 | #endif /*]*/ |
152 | 129 | } |
153 | 130 | |
154 | -static void | |
155 | -restore_charset(void) | |
131 | +static void restore_charset(struct charset_buffer *save) | |
156 | 132 | { |
157 | - (void) memcpy((char *)ebc2cg, (char *)save_ebc2cg, 256); | |
158 | - (void) memcpy((char *)cg2ebc, (char *)save_cg2ebc, 256); | |
159 | - (void) memcpy((char *)ebc2asc, (char *)save_ebc2asc, 256); | |
160 | - (void) memcpy((char *)asc2ebc, (char *)save_asc2ebc, 256); | |
133 | + (void) memcpy((char *)ebc2cg, (char *)save->ebc2cg, 256); | |
134 | + (void) memcpy((char *)cg2ebc, (char *)save->cg2ebc, 256); | |
135 | + (void) memcpy((char *)ebc2asc, (char *)save->ebc2asc, 256); | |
136 | + (void) memcpy((char *)asc2ebc, (char *)save->asc2ebc, 256); | |
161 | 137 | #if defined(X3270_FT) /*[*/ |
162 | - (void) memcpy((char *)ft2asc, (char *)save_ft2asc, 256); | |
163 | - (void) memcpy((char *)asc2ft, (char *)save_asc2ft, 256); | |
138 | + (void) memcpy((char *)ft2asc, (char *)save->ft2asc, 256); | |
139 | + (void) memcpy((char *)asc2ft, (char *)save->asc2ft, 256); | |
164 | 140 | #endif /*]*/ |
165 | 141 | } |
166 | 142 | |
... | ... | @@ -207,14 +183,14 @@ enum cs_result charset_init(H3270 *hSession, const char *csname) |
207 | 183 | // const char *ftcs; |
208 | 184 | enum cs_result rc; |
209 | 185 | char *ccs, *cftcs; |
210 | - const char *ak; | |
211 | - | |
186 | + const char *ak; | |
187 | + struct charset_buffer save; | |
212 | 188 | |
213 | 189 | /* Do nothing, successfully. */ |
214 | 190 | if (csname == CN || !strcasecmp(csname, "us")) |
215 | 191 | { |
216 | 192 | charset_defaults(); |
217 | - set_cgcsgids(CN); | |
193 | + set_cgcsgids(hSession,CN); | |
218 | 194 | set_display_charset(hSession, "ISO-8859-1"); |
219 | 195 | return CS_OKAY; |
220 | 196 | } |
... | ... | @@ -244,15 +220,15 @@ enum cs_result charset_init(H3270 *hSession, const char *csname) |
244 | 220 | cftcs = lib3270_get_resource_string(hSession,"ftCharset",csname,NULL); |
245 | 221 | |
246 | 222 | /* Save the current definitions, and start over with the defaults. */ |
247 | - save_charset(); | |
223 | + save_charset(&save); | |
248 | 224 | charset_defaults(); |
249 | 225 | |
250 | 226 | /* Check for auto-keymap. */ |
251 | 227 | ak = lib3270_get_resource_string(hSession,"autoKeymap", csname, NULL); |
252 | 228 | if (ak != NULL) |
253 | - auto_keymap = !strcasecmp(ak, "true"); | |
229 | + hSession->auto_keymap = strcasecmp(ak, "true") ? 0 : 1; | |
254 | 230 | else |
255 | - auto_keymap = 0; | |
231 | + hSession->auto_keymap = 0; | |
256 | 232 | |
257 | 233 | /* Interpret them. */ |
258 | 234 | rc = resource_charset(hSession,csname, ccs, cftcs); |
... | ... | @@ -267,7 +243,7 @@ enum cs_result charset_init(H3270 *hSession, const char *csname) |
267 | 243 | #endif /*]*/ |
268 | 244 | |
269 | 245 | if (rc != CS_OKAY) |
270 | - restore_charset(); | |
246 | + restore_charset(&save); | |
271 | 247 | |
272 | 248 | /* |
273 | 249 | #if defined(X3270_DBCS) |
... | ... | @@ -291,9 +267,10 @@ enum cs_result charset_init(H3270 *hSession, const char *csname) |
291 | 267 | return rc; |
292 | 268 | } |
293 | 269 | |
294 | -/* Set a CGCSGID. Return 0 for success, -1 for failure. */ | |
295 | -static int | |
296 | -set_cgcsgid(char *spec, unsigned long *r) | |
270 | +/** | |
271 | + * Set a CGCSGID. Return 0 for success, -1 for failure. | |
272 | + */ | |
273 | +static int set_cgcsgid(char *spec, unsigned long *r) | |
297 | 274 | { |
298 | 275 | unsigned long cp; |
299 | 276 | char *ptr; |
... | ... | @@ -303,7 +280,7 @@ set_cgcsgid(char *spec, unsigned long *r) |
303 | 280 | ptr != spec && |
304 | 281 | *ptr == '\0') { |
305 | 282 | if (!(cp & ~0xffffL)) |
306 | - *r = DEFAULT_CGEN | cp; | |
283 | + *r = LIB3270_DEFAULT_CGEN | cp; | |
307 | 284 | else |
308 | 285 | *r = cp; |
309 | 286 | return 0; |
... | ... | @@ -312,7 +289,7 @@ set_cgcsgid(char *spec, unsigned long *r) |
312 | 289 | } |
313 | 290 | |
314 | 291 | /* Set the CGCSGIDs. */ |
315 | -static void set_cgcsgids(const char *spec) | |
292 | +static void set_cgcsgids(H3270 *hSession, const char *spec) | |
316 | 293 | { |
317 | 294 | int n_ids = 0; |
318 | 295 | char *spec_copy; |
... | ... | @@ -327,21 +304,21 @@ static void set_cgcsgids(const char *spec) |
327 | 304 | buf = CN; |
328 | 305 | switch (n_ids) { |
329 | 306 | case 0: |
330 | - idp = &cgcsgid; | |
307 | + idp = &hSession->cgcsgid; | |
331 | 308 | break; |
332 | 309 | #if defined(X3270_DBCS) /*[*/ |
333 | 310 | case 1: |
334 | - idp = &cgcsgid_dbcs; | |
311 | + idp = &hSession->cgcsgid_dbcs; | |
335 | 312 | break; |
336 | 313 | #endif /*]*/ |
337 | 314 | default: |
338 | - popup_an_error(NULL,"Extra CGCSGID(s), ignoring"); | |
315 | + popup_an_error(hSession,_( "Extra CGCSGID(s), ignoring" )); | |
339 | 316 | break; |
340 | 317 | } |
341 | 318 | if (idp == NULL) |
342 | 319 | break; |
343 | 320 | if (set_cgcsgid(token, idp) < 0) { |
344 | - popup_an_error(NULL,"Invalid CGCSGID '%s', ignoring",token); | |
321 | + popup_an_error(hSession,_( "Invalid CGCSGID '%s', ignoring" ),token); | |
345 | 322 | n_ids = -1; |
346 | 323 | break; |
347 | 324 | } |
... | ... | @@ -352,9 +329,9 @@ static void set_cgcsgids(const char *spec) |
352 | 329 | return; |
353 | 330 | } |
354 | 331 | |
355 | - cgcsgid = DEFAULT_CGEN | DEFAULT_CSET; | |
332 | + hSession->cgcsgid = LIB3270_DEFAULT_CGEN | LIB3270_DEFAULT_CSET; | |
356 | 333 | #if defined(X3270_DBCS) /*[*/ |
357 | - cgcsgid_dbcs = 0L; | |
334 | + hSession->cgcsgid_dbcs = 0L; | |
358 | 335 | #endif /*]*/ |
359 | 336 | } |
360 | 337 | |
... | ... | @@ -385,11 +362,11 @@ static enum cs_result resource_charset(H3270 *hSession, const char *csname, char |
385 | 362 | char * dcs; |
386 | 363 | |
387 | 364 | /* Interpret the spec. */ |
388 | - rc = remap_chars(csname, cs, (ftcs == NULL)? BOTH: CS_ONLY, &ne); | |
365 | + rc = remap_chars(hSession, csname, cs, (ftcs == NULL)? BOTH: CS_ONLY, &ne); | |
389 | 366 | if (rc != CS_OKAY) |
390 | 367 | return rc; |
391 | 368 | if (ftcs != NULL) { |
392 | - rc = remap_chars(csname, ftcs, FT_ONLY, &ne); | |
369 | + rc = remap_chars(hSession, csname, ftcs, FT_ONLY, &ne); | |
393 | 370 | if (rc != CS_OKAY) |
394 | 371 | return rc; |
395 | 372 | } |
... | ... | @@ -449,7 +426,7 @@ static enum cs_result resource_charset(H3270 *hSession, const char *csname, char |
449 | 426 | // set_cgcsgids(get_fresource("%s.%s", "codepage", csname)); |
450 | 427 | { |
451 | 428 | char *ptr = lib3270_get_resource_string(hSession,"codepage", csname, NULL); |
452 | - set_cgcsgids(ptr); | |
429 | + set_cgcsgids(hSession,ptr); | |
453 | 430 | lib3270_free(ptr); |
454 | 431 | } |
455 | 432 | |
... | ... | @@ -500,8 +477,7 @@ parse_keysym(char *s, Boolean extended) |
500 | 477 | } |
501 | 478 | |
502 | 479 | /* Process a single character definition. */ |
503 | -static void | |
504 | -remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) | |
480 | +static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) | |
505 | 481 | { |
506 | 482 | unsigned char cg; |
507 | 483 | |
... | ... | @@ -515,7 +491,7 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) |
515 | 491 | if (iso == 0x20) |
516 | 492 | one_way = True; |
517 | 493 | |
518 | - if (!auto_keymap || iso <= 0xff) { | |
494 | + if (!hSession->auto_keymap || iso <= 0xff) { | |
519 | 495 | #if defined(X3270_FT) /*[*/ |
520 | 496 | unsigned char aa; |
521 | 497 | #endif /*]*/ |
... | ... | @@ -524,17 +500,21 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) |
524 | 500 | if (iso <= 0xff) { |
525 | 501 | cg = asc2cg[iso]; |
526 | 502 | |
527 | - if (cg2asc[cg] == iso || iso == 0) { | |
503 | + if (cg2asc[cg] == iso || iso == 0) | |
504 | + { | |
528 | 505 | /* well-defined */ |
529 | 506 | ebc2cg[ebc] = cg; |
530 | 507 | if (!one_way) |
531 | 508 | cg2ebc[cg] = ebc; |
532 | - } else { | |
509 | + } | |
510 | + else | |
511 | + { | |
533 | 512 | /* into a hole */ |
534 | 513 | ebc2cg[ebc] = CG_boxsolid; |
535 | 514 | } |
536 | 515 | } |
537 | - if (ebc > 0x40) { | |
516 | + if (ebc > 0x40) | |
517 | + { | |
538 | 518 | ebc2asc[ebc] = iso; |
539 | 519 | if (!one_way) |
540 | 520 | asc2ebc[iso] = ebc; |
... | ... | @@ -579,9 +559,8 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) |
579 | 559 | } |
580 | 560 | } |
581 | 561 | |
582 | -/* | |
583 | - * Parse an EBCDIC character set map, a series of pairs of numeric EBCDIC codes | |
584 | - * and keysyms. | |
562 | +/** | |
563 | + * Parse an EBCDIC character set map, a series of pairs of numeric EBCDIC codes and keysyms. | |
585 | 564 | * |
586 | 565 | * If the keysym is in the range 1..255, it is a remapping of the EBCDIC code |
587 | 566 | * for a standard Latin-1 graphic, and the CG-to-EBCDIC map will be modified |
... | ... | @@ -592,7 +571,7 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) |
592 | 571 | * characters that replace certain standard Latin-1 graphics. The keysym |
593 | 572 | * will be entered into the extended keysym translation table. |
594 | 573 | */ |
595 | -static enum cs_result remap_chars(const char *csname, char *spec, remap_scope scope, int *ne) | |
574 | +static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spec, remap_scope scope, int *ne) | |
596 | 575 | { |
597 | 576 | char *s; |
598 | 577 | char *ebcs, *isos; |
... | ... | @@ -620,7 +599,7 @@ static enum cs_result remap_chars(const char *csname, char *spec, remap_scope sc |
620 | 599 | |
621 | 600 | while ((tok = strtok(s, " \t\n")) != CN) { |
622 | 601 | if (ebc >= 256) { |
623 | - popup_an_error(NULL,"Charset has more than 256 entries"); | |
602 | + popup_an_error(hSession,_( "Charset has more than 256 entries" )); | |
624 | 603 | rc = CS_BAD; |
625 | 604 | break; |
626 | 605 | } |
... | ... | @@ -634,20 +613,18 @@ static enum cs_result remap_chars(const char *csname, char *spec, remap_scope sc |
634 | 613 | if (strlen(tok) == 1) |
635 | 614 | iso = tok[0] & 0xff; |
636 | 615 | else { |
637 | - popup_an_error(NULL,"Invalid charset " | |
638 | - "entry '%s' (#%d)", | |
639 | - tok, ebc); | |
616 | + popup_an_error(hSession,_( "Invalid charset entry '%s' (#%d)" ),tok, ebc); | |
640 | 617 | rc = CS_BAD; |
641 | 618 | break; |
642 | 619 | } |
643 | 620 | } |
644 | - remap_one(ebc, iso, scope, one_way); | |
621 | + remap_one(hSession, ebc, iso, scope, one_way); | |
645 | 622 | |
646 | 623 | ebc++; |
647 | 624 | s = CN; |
648 | 625 | } |
649 | 626 | if (ebc != 256) { |
650 | - popup_an_error(NULL,"Charset has %d entries, need 256", ebc); | |
627 | + popup_an_error(NULL,_( "Charset has %d entries, need 256" ), ebc); | |
651 | 628 | rc = CS_BAD; |
652 | 629 | } else { |
653 | 630 | /* |
... | ... | @@ -680,12 +657,11 @@ static enum cs_result remap_chars(const char *csname, char *spec, remap_scope sc |
680 | 657 | ((ebc = strtoul(ebcs, &ptr, 0)), |
681 | 658 | ptr == ebcs || *ptr != '\0') || |
682 | 659 | (iso = parse_keysym(isos, True)) == NoSymbol) { |
683 | - popup_an_error(NULL,"Cannot parse %s \"%s\", entry %d", | |
684 | - ResCharset, csname, *ne); | |
660 | + popup_an_error(hSession,_( "Cannot parse %s \"%s\", entry %d" ), "charset", csname, *ne); | |
685 | 661 | rc = CS_BAD; |
686 | 662 | break; |
687 | 663 | } |
688 | - remap_one(ebc, iso, scope, one_way); | |
664 | + remap_one(hSession, ebc, iso, scope, one_way); | |
689 | 665 | } |
690 | 666 | } |
691 | 667 | lib3270_free(spec); | ... | ... |
src/lib3270/host.c
... | ... | @@ -746,7 +746,7 @@ LIB3270_EXPORT void lib3270_register_schange(H3270 *h, LIB3270_STATE_CHANGE tx, |
746 | 746 | /* Signal a state change. */ |
747 | 747 | void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) |
748 | 748 | { |
749 | -#if defined(DEBUG) || defined(ANDROID) | |
749 | +#if defined(DEBUG) | |
750 | 750 | |
751 | 751 | static const char * state_name[LIB3270_STATE_USER] = |
752 | 752 | { | ... | ... |
src/lib3270/html.c
... | ... | @@ -386,11 +386,6 @@ |
386 | 386 | else |
387 | 387 | { |
388 | 388 | append_element(&info,HTML_ELEMENT_LINE_BREAK); |
389 | -/* | |
390 | -#if defined(DEBUG) || defined(ANDROID) | |
391 | - append_string(&info,"\n"); | |
392 | -#endif // DEBUG | |
393 | -*/ | |
394 | 389 | } |
395 | 390 | |
396 | 391 | } |
... | ... | @@ -422,23 +417,6 @@ |
422 | 417 | |
423 | 418 | info.text = lib3270_realloc(info.text,strlen(info.text)+2); |
424 | 419 | |
425 | -/* | |
426 | -#if defined(DEBUG) || defined(ANDROID) | |
427 | - { | |
428 | - char *text = strdup(info.text); | |
429 | - char *save; | |
430 | - char *ptr; | |
431 | - | |
432 | - for(ptr=strtok_r(text,"\n",&save);ptr;ptr = strtok_r(NULL,"\n",&save)) | |
433 | - { | |
434 | - trace("%s",ptr); | |
435 | - } | |
436 | - | |
437 | - free(text); | |
438 | - } | |
439 | -#endif // DEBUG | |
440 | -*/ | |
441 | - | |
442 | 420 | return info.text; |
443 | 421 | } |
444 | 422 | ... | ... |
src/lib3270/kybd.c
... | ... | @@ -180,7 +180,7 @@ struct ta |
180 | 180 | */ |
181 | 181 | |
182 | 182 | |
183 | -#if defined(DEBUG) || defined(ANDROID) | |
183 | +#if defined(DEBUG) | |
184 | 184 | #define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL, #x) |
185 | 185 | #else |
186 | 186 | #define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL) |
... | ... | @@ -263,7 +263,7 @@ static int enq_chk(H3270 *hSession) |
263 | 263 | /* |
264 | 264 | * Put an action on the typeahead queue. |
265 | 265 | */ |
266 | -#if defined(DEBUG) || defined(ANDROID) | |
266 | +#if defined(DEBUG) | |
267 | 267 | static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), const char *parm1, const char *parm2, const char *name) |
268 | 268 | #else |
269 | 269 | static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), const char *parm1, const char *parm2) |
... | ... | @@ -758,7 +758,7 @@ static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean |
758 | 758 | |
759 | 759 | (void) sprintf(codename, "%d", code |(with_ge ? GE_WFLAG : 0) | (pasting ? PASTE_WFLAG : 0)); |
760 | 760 | |
761 | -#if defined(DEBUG) || defined(ANDROID) | |
761 | +#if defined(DEBUG) | |
762 | 762 | enq_ta(hSession,key_Character_wrapper, codename, CN, "key_Character_wrapper"); |
763 | 763 | #else |
764 | 764 | enq_ta(hSession,key_Character_wrapper, codename, CN); | ... | ... |
src/lib3270/proxy.c
... | ... | @@ -572,7 +572,7 @@ static int proxy_socks4(H3270 *hSession, int fd, char *host, unsigned short port |
572 | 572 | user = getenv("USER"); |
573 | 573 | if (user == CN) |
574 | 574 | user = "nobody"; |
575 | -#endif | |
575 | +#endif // ANDROID | |
576 | 576 | |
577 | 577 | /* Send the request to the server. */ |
578 | 578 | if (use_4a) { | ... | ... |
src/lib3270/screen.c
... | ... | @@ -613,21 +613,7 @@ void show_3270_popup_dialog(H3270 *session, LIB3270_NOTIFY type, const char *tit |
613 | 613 | |
614 | 614 | static int logpopup(H3270 *session, void *widget, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) |
615 | 615 | { |
616 | -#ifdef ANDROID | |
617 | - | |
618 | - char len = strlen(fmt); | |
619 | - char * mask = malloc(len+5); | |
620 | - strncpy(mask,fmt,len); | |
621 | - mask[len] = '\n'; | |
622 | - mask[len+1] = 0; | |
623 | - __android_log_vprint(ANDROID_LOG_VERBOSE, PACKAGE_NAME, mask, arg); | |
624 | - | |
625 | -#else | |
626 | - | |
627 | 616 | lib3270_write_va_log(session,"lib3270",fmt,arg); |
628 | - | |
629 | -#endif // ANDROID | |
630 | - | |
631 | 617 | return 0; |
632 | 618 | } |
633 | 619 | ... | ... |
src/lib3270/session.c
... | ... | @@ -44,6 +44,7 @@ |
44 | 44 | #include "ftc.h" |
45 | 45 | #include "kybdc.h" |
46 | 46 | #include "3270ds.h" |
47 | +#include "tablesc.h" | |
47 | 48 | |
48 | 49 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
49 | 50 | |
... | ... | @@ -130,20 +131,9 @@ static void set_cursor(H3270 *session, LIB3270_CURSOR id) |
130 | 131 | |
131 | 132 | static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *msg, const char *text) |
132 | 133 | { |
133 | -#ifdef ANDROID | |
134 | - | |
135 | - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title); | |
136 | - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",msg); | |
137 | - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",text); | |
138 | - | |
139 | -#else | |
140 | - | |
141 | 134 | lib3270_write_log(session,"%s",title); |
142 | 135 | lib3270_write_log(session,"%s",msg); |
143 | 136 | lib3270_write_log(session,"%s",text); |
144 | - | |
145 | -#endif // ANDROID | |
146 | - | |
147 | 137 | } |
148 | 138 | |
149 | 139 | static void update_ssl(H3270 *session, LIB3270_SSL_STATE state) |
... | ... | @@ -170,6 +160,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
170 | 160 | |
171 | 161 | memset(hSession,0,sizeof(H3270)); |
172 | 162 | hSession->sz = sizeof(H3270); |
163 | + initialize_tables(hSession); | |
173 | 164 | |
174 | 165 | // Default calls |
175 | 166 | hSession->write = lib3270_sock_send; |
... | ... | @@ -214,6 +205,8 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
214 | 205 | hSession->saved_wraparound_mode = 1; |
215 | 206 | hSession->once_cset = -1; |
216 | 207 | hSession->state = LIB3270_ANSI_STATE_DATA; |
208 | + hSession->cgcsgid = LIB3270_DEFAULT_CGEN | LIB3270_DEFAULT_CSET; | |
209 | + | |
217 | 210 | |
218 | 211 | for(f=0;f<4;f++) |
219 | 212 | hSession->csd[f] = hSession->saved_csd[f] = LIB3270_ANSI_CSD_US; | ... | ... |
src/lib3270/sf.c
... | ... | @@ -945,7 +945,7 @@ static void do_qr_charsets(H3270 *hSession) |
945 | 945 | *hSession->obptr++ = 0x00; /* SUBSN */ |
946 | 946 | } |
947 | 947 | #endif /*]*/ |
948 | - SET32(hSession->obptr, cgcsgid); /* CGCSGID */ | |
948 | + SET32(hSession->obptr, hSession->cgcsgid); /* CGCSGID */ | |
949 | 949 | if (!*standard_font) |
950 | 950 | { |
951 | 951 | /* special 3270 font, includes APL */ | ... | ... |
src/lib3270/tables.c
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | #include "globals.h" |
43 | 43 | #include "tablesc.h" |
44 | 44 | |
45 | -unsigned short asc2cg[256] = { | |
45 | +const unsigned short asc2cg[256] = { | |
46 | 46 | /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
47 | 47 | /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
48 | 48 | /*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
... | ... | @@ -76,7 +76,7 @@ unsigned short asc2cg[256] = { |
76 | 76 | /*f0*/ 0xf7, 0x5f, 0x43, 0x5d, 0x58, 0x46, 0x53, 0x9d, |
77 | 77 | /*f8*/ 0x9b, 0x44, 0x5e, 0x59, 0x4e, 0x49, 0xf9, 0x47 |
78 | 78 | }; |
79 | -unsigned short cg2asc[256] = { | |
79 | +const unsigned short cg2asc[256] = { | |
80 | 80 | /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xad, |
81 | 81 | /*08*/ 0x3e, 0x3c, 0x5b, 0x5d, 0x29, 0x28, 0x7d, 0x7b, |
82 | 82 | /*10*/ 0x20, 0x3d, 0x27, 0x22, 0x2f, 0x5c, 0x7c, 0xa6, |
... | ... | @@ -110,111 +110,112 @@ unsigned short cg2asc[256] = { |
110 | 110 | /*f0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf0, |
111 | 111 | /*f8*/ 0x20, 0xfe, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 |
112 | 112 | }; |
113 | -#define EBC2CG \ | |
114 | -/*00*/ 0x00, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, \ | |
115 | -/*08*/ 0xdf, 0xdf, 0xdf, 0xdf, 0x02, 0x03, 0x00, 0x00, \ | |
116 | -/*10*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0x04, 0xdf, 0xdf, \ | |
117 | -/*18*/ 0xdf, 0x05, 0xdf, 0xdf, 0x9f, 0xdf, 0x9e, 0xdf, \ | |
118 | -/*20*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, \ | |
119 | -/*28*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, \ | |
120 | -/*30*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, \ | |
121 | -/*38*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, \ | |
122 | -/*40*/ 0x10, 0x01, 0x55, 0x50, 0x40, 0x5a, 0x45, 0x9c, \ | |
123 | -/*48*/ 0x4f, 0x5f, 0x1b, 0x32, 0x09, 0x0d, 0x35, 0x16, \ | |
124 | -/*50*/ 0x30, 0x4a, 0x56, 0x51, 0x41, 0x5c, 0x57, 0x52, \ | |
125 | -/*58*/ 0x42, 0x2a, 0x19, 0x1a, 0xbf, 0x0c, 0xbe, 0x36, \ | |
126 | -/*60*/ 0x31, 0x14, 0x75, 0x70, 0x60, 0x7a, 0x65, 0xbc, \ | |
127 | -/*68*/ 0xbd, 0x7f, 0x17, 0x33, 0x2e, 0x2f, 0x08, 0x18, \ | |
128 | -/*70*/ 0x9b, 0x7b, 0x76, 0x71, 0x61, 0x7c, 0x77, 0x72, \ | |
129 | -/*78*/ 0x62, 0x3d, 0x34, 0x2c, 0x2d, 0x12, 0x11, 0x13, \ | |
130 | -/*80*/ 0xbb, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, \ | |
131 | -/*88*/ 0x87, 0x88, 0x6c, 0x6d, 0xf7, 0x49, 0xf9, 0xd6, \ | |
132 | -/*90*/ 0x38, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, \ | |
133 | -/*98*/ 0x90, 0x91, 0x6a, 0x6b, 0x9a, 0x3f, 0xba, 0x1f, \ | |
134 | -/*a0*/ 0x54, 0x3b, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, \ | |
135 | -/*a8*/ 0x98, 0x99, 0x6e, 0x6f, 0xd7, 0x48, 0xd9, 0xd1, \ | |
136 | -/*b0*/ 0x3a, 0x1c, 0x1d, 0x39, 0xd0, 0x2b, 0x1e, 0x4b, \ | |
137 | -/*b8*/ 0x4c, 0x4d, 0x0a, 0x0b, 0x37, 0x3c, 0x3e, 0x5b, \ | |
138 | -/*c0*/ 0x0f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, \ | |
139 | -/*c8*/ 0xa7, 0xa8, 0x07, 0x58, 0x53, 0x43, 0x5d, 0x46, \ | |
140 | -/*d0*/ 0x0e, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, \ | |
141 | -/*d8*/ 0xb0, 0xb1, 0x67, 0x59, 0x4e, 0x44, 0x5e, 0x47, \ | |
142 | -/*e0*/ 0x15, 0x9d, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, \ | |
143 | -/*e8*/ 0xb8, 0xb9, 0x68, 0x78, 0x73, 0x63, 0x7d, 0x66, \ | |
144 | -/*f0*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, \ | |
113 | + | |
114 | +const unsigned short ebc2cg0[256] = { | |
115 | +/*00*/ 0x00, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, | |
116 | +/*08*/ 0xdf, 0xdf, 0xdf, 0xdf, 0x02, 0x03, 0x00, 0x00, | |
117 | +/*10*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0x04, 0xdf, 0xdf, | |
118 | +/*18*/ 0xdf, 0x05, 0xdf, 0xdf, 0x9f, 0xdf, 0x9e, 0xdf, | |
119 | +/*20*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, | |
120 | +/*28*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, | |
121 | +/*30*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, | |
122 | +/*38*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, | |
123 | +/*40*/ 0x10, 0x01, 0x55, 0x50, 0x40, 0x5a, 0x45, 0x9c, | |
124 | +/*48*/ 0x4f, 0x5f, 0x1b, 0x32, 0x09, 0x0d, 0x35, 0x16, | |
125 | +/*50*/ 0x30, 0x4a, 0x56, 0x51, 0x41, 0x5c, 0x57, 0x52, | |
126 | +/*58*/ 0x42, 0x2a, 0x19, 0x1a, 0xbf, 0x0c, 0xbe, 0x36, | |
127 | +/*60*/ 0x31, 0x14, 0x75, 0x70, 0x60, 0x7a, 0x65, 0xbc, | |
128 | +/*68*/ 0xbd, 0x7f, 0x17, 0x33, 0x2e, 0x2f, 0x08, 0x18, | |
129 | +/*70*/ 0x9b, 0x7b, 0x76, 0x71, 0x61, 0x7c, 0x77, 0x72, | |
130 | +/*78*/ 0x62, 0x3d, 0x34, 0x2c, 0x2d, 0x12, 0x11, 0x13, | |
131 | +/*80*/ 0xbb, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, | |
132 | +/*88*/ 0x87, 0x88, 0x6c, 0x6d, 0xf7, 0x49, 0xf9, 0xd6, | |
133 | +/*90*/ 0x38, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
134 | +/*98*/ 0x90, 0x91, 0x6a, 0x6b, 0x9a, 0x3f, 0xba, 0x1f, | |
135 | +/*a0*/ 0x54, 0x3b, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, | |
136 | +/*a8*/ 0x98, 0x99, 0x6e, 0x6f, 0xd7, 0x48, 0xd9, 0xd1, | |
137 | +/*b0*/ 0x3a, 0x1c, 0x1d, 0x39, 0xd0, 0x2b, 0x1e, 0x4b, | |
138 | +/*b8*/ 0x4c, 0x4d, 0x0a, 0x0b, 0x37, 0x3c, 0x3e, 0x5b, | |
139 | +/*c0*/ 0x0f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, | |
140 | +/*c8*/ 0xa7, 0xa8, 0x07, 0x58, 0x53, 0x43, 0x5d, 0x46, | |
141 | +/*d0*/ 0x0e, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
142 | +/*d8*/ 0xb0, 0xb1, 0x67, 0x59, 0x4e, 0x44, 0x5e, 0x47, | |
143 | +/*e0*/ 0x15, 0x9d, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, | |
144 | +/*e8*/ 0xb8, 0xb9, 0x68, 0x78, 0x73, 0x63, 0x7d, 0x66, | |
145 | +/*f0*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, | |
145 | 146 | /*f8*/ 0x28, 0x29, 0x69, 0x79, 0x74, 0x64, 0x7e, 0x06 |
146 | -unsigned short ebc2cg[256] = { EBC2CG }; | |
147 | -unsigned short ebc2cg0[256] = { EBC2CG }; | |
148 | -#define CG2EBC \ | |
149 | -/*00*/ 0x00, 0x41, 0x0c, 0x0d, 0x15, 0x19, 0xff, 0xca, \ | |
150 | -/*08*/ 0x6e, 0x4c, 0xba, 0xbb, 0x5d, 0x4d, 0xd0, 0xc0, \ | |
151 | -/*10*/ 0x40, 0x7e, 0x7d, 0x7f, 0x61, 0xe0, 0x4f, 0x6a, \ | |
152 | -/*18*/ 0x6f, 0x5a, 0x5b, 0x4a, 0xb1, 0xb2, 0xb6, 0x9f, \ | |
153 | -/*20*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, \ | |
154 | -/*28*/ 0xf8, 0xf9, 0x59, 0xb5, 0x7b, 0x7c, 0x6c, 0x6d, \ | |
155 | -/*30*/ 0x50, 0x60, 0x4b, 0x6b, 0x7a, 0x4e, 0x5f, 0xbc, \ | |
156 | -/*38*/ 0x90, 0xb3, 0xb0, 0xa1, 0xbd, 0x79, 0xbe, 0x9d, \ | |
157 | -/*40*/ 0x44, 0x54, 0x58, 0xcd, 0xdd, 0x46, 0xcf, 0xdf, \ | |
158 | -/*48*/ 0xad, 0x8d, 0x51, 0xb7, 0xb8, 0xb9, 0xdc, 0x48, \ | |
159 | -/*50*/ 0x43, 0x53, 0x57, 0xcc, 0xa0, 0x42, 0x52, 0x56, \ | |
160 | -/*58*/ 0xcb, 0xdb, 0x45, 0xbf, 0x55, 0xce, 0xde, 0x49, \ | |
161 | -/*60*/ 0x64, 0x74, 0x78, 0xed, 0xfd, 0x66, 0xef, 0xda, \ | |
162 | -/*68*/ 0xea, 0xfa, 0x9a, 0x9b, 0x8a, 0x8b, 0xaa, 0xab, \ | |
163 | -/*70*/ 0x63, 0x73, 0x77, 0xec, 0xfc, 0x62, 0x72, 0x76, \ | |
164 | -/*78*/ 0xeb, 0xfb, 0x65, 0x71, 0x75, 0xee, 0xfe, 0x69, \ | |
165 | -/*80*/ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, \ | |
166 | -/*88*/ 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, \ | |
167 | -/*90*/ 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, \ | |
168 | -/*98*/ 0xa8, 0xa9, 0x9c, 0x70, 0x47, 0xe1, 0x1e, 0x1c, \ | |
169 | -/*a0*/ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, \ | |
170 | -/*a8*/ 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, \ | |
171 | -/*b0*/ 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, \ | |
172 | -/*b8*/ 0xe8, 0xe9, 0x9e, 0x80, 0x67, 0x68, 0x5e, 0x5c, \ | |
173 | -/*c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ | |
174 | -/*c8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ | |
175 | -/*d0*/ 0xb4, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x8f, 0xac, \ | |
176 | -/*d8*/ 0x00, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ | |
177 | -/*e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ | |
178 | -/*e8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ | |
179 | -/*f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, \ | |
147 | +}; | |
148 | + | |
149 | +const unsigned short cg2ebc0[256] = { | |
150 | +/*00*/ 0x00, 0x41, 0x0c, 0x0d, 0x15, 0x19, 0xff, 0xca, | |
151 | +/*08*/ 0x6e, 0x4c, 0xba, 0xbb, 0x5d, 0x4d, 0xd0, 0xc0, | |
152 | +/*10*/ 0x40, 0x7e, 0x7d, 0x7f, 0x61, 0xe0, 0x4f, 0x6a, | |
153 | +/*18*/ 0x6f, 0x5a, 0x5b, 0x4a, 0xb1, 0xb2, 0xb6, 0x9f, | |
154 | +/*20*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, | |
155 | +/*28*/ 0xf8, 0xf9, 0x59, 0xb5, 0x7b, 0x7c, 0x6c, 0x6d, | |
156 | +/*30*/ 0x50, 0x60, 0x4b, 0x6b, 0x7a, 0x4e, 0x5f, 0xbc, | |
157 | +/*38*/ 0x90, 0xb3, 0xb0, 0xa1, 0xbd, 0x79, 0xbe, 0x9d, | |
158 | +/*40*/ 0x44, 0x54, 0x58, 0xcd, 0xdd, 0x46, 0xcf, 0xdf, | |
159 | +/*48*/ 0xad, 0x8d, 0x51, 0xb7, 0xb8, 0xb9, 0xdc, 0x48, | |
160 | +/*50*/ 0x43, 0x53, 0x57, 0xcc, 0xa0, 0x42, 0x52, 0x56, | |
161 | +/*58*/ 0xcb, 0xdb, 0x45, 0xbf, 0x55, 0xce, 0xde, 0x49, | |
162 | +/*60*/ 0x64, 0x74, 0x78, 0xed, 0xfd, 0x66, 0xef, 0xda, | |
163 | +/*68*/ 0xea, 0xfa, 0x9a, 0x9b, 0x8a, 0x8b, 0xaa, 0xab, | |
164 | +/*70*/ 0x63, 0x73, 0x77, 0xec, 0xfc, 0x62, 0x72, 0x76, | |
165 | +/*78*/ 0xeb, 0xfb, 0x65, 0x71, 0x75, 0xee, 0xfe, 0x69, | |
166 | +/*80*/ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, | |
167 | +/*88*/ 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, | |
168 | +/*90*/ 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, | |
169 | +/*98*/ 0xa8, 0xa9, 0x9c, 0x70, 0x47, 0xe1, 0x1e, 0x1c, | |
170 | +/*a0*/ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, | |
171 | +/*a8*/ 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, | |
172 | +/*b0*/ 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, | |
173 | +/*b8*/ 0xe8, 0xe9, 0x9e, 0x80, 0x67, 0x68, 0x5e, 0x5c, | |
174 | +/*c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
175 | +/*c8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
176 | +/*d0*/ 0xb4, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x8f, 0xac, | |
177 | +/*d8*/ 0x00, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
178 | +/*e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
179 | +/*e8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
180 | +/*f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, | |
180 | 181 | /*f8*/ 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
181 | -unsigned short cg2ebc[256] = { CG2EBC }; | |
182 | -unsigned short cg2ebc0[256] = { CG2EBC }; | |
183 | -#define EBC2ASC \ | |
184 | -/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
185 | -/*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
186 | -/*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
187 | -/*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20, \ | |
188 | -/*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
189 | -/*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
190 | -/*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
191 | -/*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | |
192 | -/*40*/ 0x20, 0x20, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, \ | |
193 | -/*48*/ 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, \ | |
194 | -/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, \ | |
195 | -/*58*/ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, \ | |
196 | -/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, \ | |
197 | -/*68*/ 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, \ | |
198 | -/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, \ | |
199 | -/*78*/ 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, \ | |
200 | -/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, \ | |
201 | -/*88*/ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, \ | |
202 | -/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, \ | |
203 | -/*98*/ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, \ | |
204 | -/*a0*/ 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, \ | |
205 | -/*a8*/ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, \ | |
206 | -/*b0*/ 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, \ | |
207 | -/*b8*/ 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, \ | |
208 | -/*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, \ | |
209 | -/*c8*/ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, \ | |
210 | -/*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, \ | |
211 | -/*d8*/ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, \ | |
212 | -/*e0*/ 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, \ | |
213 | -/*e8*/ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, \ | |
214 | -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, \ | |
182 | +}; | |
183 | + | |
184 | +const unsigned short ebc2asc0[256] = { | |
185 | +/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
186 | +/*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
187 | +/*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
188 | +/*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20, | |
189 | +/*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
190 | +/*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
191 | +/*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
192 | +/*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
193 | +/*40*/ 0x20, 0x20, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, | |
194 | +/*48*/ 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, | |
195 | +/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, | |
196 | +/*58*/ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, | |
197 | +/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, | |
198 | +/*68*/ 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, | |
199 | +/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, | |
200 | +/*78*/ 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, | |
201 | +/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | |
202 | +/*88*/ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, | |
203 | +/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, | |
204 | +/*98*/ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, | |
205 | +/*a0*/ 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, | |
206 | +/*a8*/ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, | |
207 | +/*b0*/ 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, | |
208 | +/*b8*/ 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, | |
209 | +/*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | |
210 | +/*c8*/ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, | |
211 | +/*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, | |
212 | +/*d8*/ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, | |
213 | +/*e0*/ 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | |
214 | +/*e8*/ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, | |
215 | +/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | |
215 | 216 | /*f8*/ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x20 |
216 | -unsigned short ebc2asc[256] = { EBC2ASC }; | |
217 | -unsigned short ebc2asc0[256] = { EBC2ASC }; | |
217 | +}; | |
218 | + | |
218 | 219 | #define EBC2ASC7 \ |
219 | 220 | /*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ |
220 | 221 | /*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ |
... | ... | @@ -248,8 +249,9 @@ unsigned short ebc2asc0[256] = { EBC2ASC }; |
248 | 249 | /*e8*/ 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
249 | 250 | /*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, \ |
250 | 251 | /*f8*/ 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 |
251 | -unsigned short ebc2asc7[256] = { EBC2ASC7 }; | |
252 | -unsigned short ebc2asc70[256] = { EBC2ASC7 }; | |
252 | +const unsigned short ebc2asc7[256] = { EBC2ASC7 }; | |
253 | +const unsigned short ebc2asc70[256] = { EBC2ASC7 }; | |
254 | + | |
253 | 255 | #define ASC2EBC \ |
254 | 256 | /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
255 | 257 | /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ |
... | ... | @@ -283,45 +285,9 @@ unsigned short ebc2asc70[256] = { EBC2ASC7 }; |
283 | 285 | /*e8*/ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, \ |
284 | 286 | /*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, \ |
285 | 287 | /*f8*/ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf |
286 | -unsigned short asc2ebc[256] = { ASC2EBC }; | |
287 | -unsigned short asc2ebc0[256] = { ASC2EBC }; | |
288 | -#if defined(X3270_DISPLAY) /*[*/ | |
289 | -unsigned short cg2uc[256] = { | |
290 | -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | |
291 | -/*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
292 | -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | |
293 | -/*18*/ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
294 | -/*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, | |
295 | -/*28*/ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
296 | -/*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | |
297 | -/*38*/ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
298 | -/*40*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x47, | |
299 | -/*48*/ 0x48, 0x48, 0x7b, 0x4b, 0x4c, 0x4d, 0x74, 0xbd, | |
300 | -/*50*/ 0x70, 0x71, 0x72, 0x73, 0x54, 0x75, 0x76, 0x77, | |
301 | -/*58*/ 0x78, 0x79, 0x7a, 0x5b, 0x7c, 0x7d, 0x7e, 0x7f, | |
302 | -/*60*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | |
303 | -/*68*/ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
304 | -/*70*/ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, | |
305 | -/*78*/ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
306 | -/*80*/ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, | |
307 | -/*88*/ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
308 | -/*90*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, | |
309 | -/*98*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0x9d, 0x9e, 0x9f, | |
310 | -/*a0*/ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, | |
311 | -/*a8*/ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
312 | -/*b0*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, | |
313 | -/*b8*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
314 | -/*c0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | |
315 | -/*c8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
316 | -/*d0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, | |
317 | -/*d8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
318 | -/*e0*/ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, | |
319 | -/*e8*/ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
320 | -/*f0*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, | |
321 | -/*f8*/ 0xf8, 0xd9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff | |
322 | -}; | |
323 | -#endif /*]*/ | |
324 | -unsigned short ge2asc[256] = { | |
288 | +const unsigned short asc2ebc0[256] = { ASC2EBC }; | |
289 | + | |
290 | +const unsigned short ge2asc[256] = { | |
325 | 291 | /*00*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, |
326 | 292 | /*08*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, |
327 | 293 | /*10*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, |
... | ... | @@ -391,7 +357,7 @@ unsigned short ge2cg8[256] = { |
391 | 357 | /*f8*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf |
392 | 358 | }; |
393 | 359 | #endif /*[*/ |
394 | -unsigned short asc2uc[256] = { | |
360 | +const unsigned short asc2uc[256] = { | |
395 | 361 | /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
396 | 362 | /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
397 | 363 | /*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
... | ... | @@ -425,7 +391,7 @@ unsigned short asc2uc[256] = { |
425 | 391 | /*f0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, |
426 | 392 | /*f8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff |
427 | 393 | }; |
428 | -unsigned short ebc2uc[256] = { | |
394 | +const unsigned short ebc2uc[256] = { | |
429 | 395 | /*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
430 | 396 | /*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
431 | 397 | /*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
... | ... | @@ -477,8 +443,7 @@ unsigned short ebc2uc[256] = { |
477 | 443 | 0xa4,0xb5,0xa1,0xbf,0xd0,0xdd,0xde,0xae,0x5e,0xa3,0xa5,0xb7,0xa9,0xa7,0xb6,0xbc, \ |
478 | 444 | 0xbd,0xbe,0x5b,0x5d,0xaf,0xa8,0xb4,0xd7,0xad,0xf4,0xf6,0xf2,0xf3,0xf5,0xb9,0xfb, \ |
479 | 445 | 0xfc,0xf9,0xfa,0xff,0xb2,0xd4,0xd6,0xd2,0xd3,0xd5,0xb3,0xdb,0xdc,0xd9,0xda,0xff |
480 | -unsigned short ft2asc[256] = { FT2ASC }; | |
481 | -unsigned short ft2asc0[256] = { FT2ASC }; | |
446 | +const unsigned short ft2asc0[256] = { FT2ASC }; | |
482 | 447 | #define ASC2FT \ |
483 | 448 | 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, \ |
484 | 449 | 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, \ |
... | ... | @@ -496,6 +461,26 @@ unsigned short ft2asc0[256] = { FT2ASC }; |
496 | 461 | 0xd4,0xb9,0xf7,0xf8,0xf5,0xf9,0xf6,0xe7,0xc3,0xfd,0xfe,0xfb,0xfc,0xd5,0xd6,0xb1, \ |
497 | 462 | 0xa3,0xa4,0xa1,0xa5,0xa2,0xa6,0xcd,0xa7,0xac,0xa9,0xaa,0xab,0xb0,0xad,0xae,0xaf, \ |
498 | 463 | 0xc6,0xa8,0xeb,0xec,0xe9,0xed,0xea,0x9f,0xba,0xf1,0xf2,0xef,0xf0,0xc7,0xc8,0xf3 |
499 | -unsigned short asc2ft[256] = { ASC2FT }; | |
500 | -unsigned short asc2ft0[256] = { ASC2FT }; | |
464 | +const unsigned short asc2ft0[256] = { ASC2FT }; | |
501 | 465 | #endif /*]*/ |
466 | + | |
467 | +unsigned short ebc2cg[256]; | |
468 | +unsigned short cg2ebc[256]; | |
469 | +unsigned short ebc2asc[256]; | |
470 | +unsigned short asc2ebc[256]; | |
471 | +unsigned short asc2ft[256]; | |
472 | +unsigned short ft2asc[256]; | |
473 | + | |
474 | +LIB3270_INTERNAL void initialize_tables(H3270 *hSession) | |
475 | +{ | |
476 | + /* Go to defaults first. */ | |
477 | + memcpy(ebc2cg, ebc2cg0, sizeof(ebc2cg)); | |
478 | + memcpy(cg2ebc, cg2ebc0, sizeof(cg2ebc)); | |
479 | + memcpy(ebc2asc, ebc2asc0, sizeof(ebc2asc)); | |
480 | + memcpy(asc2ebc, asc2ebc0, sizeof(asc2ebc)); | |
481 | +#if defined(X3270_FT) /*[*/ | |
482 | + memcpy(ft2asc, ft2asc0, sizeof(ft2asc)); | |
483 | + memcpy(asc2ft, asc2ft0, sizeof(asc2ft)); | |
484 | +#endif /*]*/ | |
485 | + | |
486 | +} | ... | ... |
src/lib3270/tablesc.h
... | ... | @@ -16,25 +16,26 @@ |
16 | 16 | * tablesc.h |
17 | 17 | * Global declarations for tables.c. |
18 | 18 | */ |
19 | - | |
20 | -LIB3270_INTERNAL unsigned short asc2cg[256]; | |
21 | -LIB3270_INTERNAL unsigned short cg2asc[256]; | |
19 | +LIB3270_INTERNAL void initialize_tables(H3270 *hSession); | |
22 | 20 | LIB3270_INTERNAL unsigned short ebc2cg[256]; |
23 | -LIB3270_INTERNAL unsigned short ebc2cg0[256]; | |
24 | 21 | LIB3270_INTERNAL unsigned short cg2ebc[256]; |
25 | -LIB3270_INTERNAL unsigned short cg2ebc0[256]; | |
26 | 22 | LIB3270_INTERNAL unsigned short ebc2asc[256]; |
27 | -LIB3270_INTERNAL unsigned short ebc2asc0[256]; | |
28 | -LIB3270_INTERNAL unsigned short ebc2asc7[256]; | |
29 | -LIB3270_INTERNAL unsigned short ebc2asc70[256]; | |
30 | 23 | LIB3270_INTERNAL unsigned short asc2ebc[256]; |
31 | -LIB3270_INTERNAL unsigned short asc2ebc0[256]; | |
32 | -LIB3270_INTERNAL unsigned short cg2uc[256]; | |
33 | -LIB3270_INTERNAL unsigned short ge2asc[256]; | |
34 | -LIB3270_INTERNAL unsigned short ge2cg8[256]; | |
35 | -LIB3270_INTERNAL unsigned short asc2uc[256]; | |
36 | -LIB3270_INTERNAL unsigned short ebc2uc[256]; | |
37 | 24 | LIB3270_INTERNAL unsigned short ft2asc[256]; |
38 | -LIB3270_INTERNAL unsigned short ft2asc0[256]; | |
39 | 25 | LIB3270_INTERNAL unsigned short asc2ft[256]; |
40 | -LIB3270_INTERNAL unsigned short asc2ft0[256]; | |
26 | + | |
27 | +LIB3270_INTERNAL const unsigned short asc2cg[256]; | |
28 | +LIB3270_INTERNAL const unsigned short cg2asc[256]; | |
29 | +LIB3270_INTERNAL const unsigned short ebc2cg0[256]; | |
30 | +LIB3270_INTERNAL const unsigned short cg2ebc0[256]; | |
31 | +LIB3270_INTERNAL const unsigned short ebc2asc0[256]; | |
32 | +LIB3270_INTERNAL const unsigned short ebc2asc7[256]; | |
33 | +LIB3270_INTERNAL const unsigned short ebc2asc70[256]; | |
34 | +LIB3270_INTERNAL const unsigned short asc2ebc0[256]; | |
35 | +// LIB3270_INTERNAL const unsigned short cg2uc[256]; | |
36 | +LIB3270_INTERNAL const unsigned short ge2asc[256]; | |
37 | +LIB3270_INTERNAL const unsigned short ge2cg8[256]; | |
38 | +LIB3270_INTERNAL const unsigned short asc2uc[256]; | |
39 | +LIB3270_INTERNAL const unsigned short ebc2uc[256]; | |
40 | +LIB3270_INTERNAL const unsigned short ft2asc0[256]; | |
41 | +LIB3270_INTERNAL const unsigned short asc2ft0[256]; | ... | ... |
src/lib3270/util.c
... | ... | @@ -929,20 +929,6 @@ LIB3270_EXPORT void * lib3270_malloc(int len) |
929 | 929 | return r; |
930 | 930 | } |
931 | 931 | |
932 | -/* | |
933 | -void * Calloc(size_t nelem, size_t elsize) | |
934 | -{ | |
935 | - int sz = nelem * elsize; | |
936 | - char * r = malloc(sz); | |
937 | - | |
938 | - if(!r) | |
939 | - Error(NULL,"Out of memory in %s",__FUNCTION__); | |
940 | - | |
941 | - memset(r, 0, sz); | |
942 | - return r; | |
943 | -} | |
944 | -*/ | |
945 | - | |
946 | 932 | LIB3270_EXPORT char * lib3270_get_resource_string(H3270 *hSession, const char *first_element, ...) |
947 | 933 | { |
948 | 934 | #ifdef ANDROID | ... | ... |