Commit a69adbf73432f584f994dff938fdb59bfb987bfb
1 parent
af218e9a
Exists in
master
and in
5 other branches
Removendo funções de charset antigas
Showing
6 changed files
with
128 additions
and
228 deletions
Show diff stats
src/lib3270/charset.c
... | ... | @@ -36,6 +36,8 @@ |
36 | 36 | |
37 | 37 | #include "globals.h" |
38 | 38 | |
39 | +/* | |
40 | + | |
39 | 41 | #include "resources.h" |
40 | 42 | // #include "appres.h" |
41 | 43 | #include "cg.h" |
... | ... | @@ -59,15 +61,10 @@ |
59 | 61 | #define EURO_SUFFIX "-euro" |
60 | 62 | #define ES_SIZE (sizeof(EURO_SUFFIX) - 1) |
61 | 63 | |
62 | -/* Globals. */ | |
63 | -// unsigned long cgcsgid = LIB3270_DEFAULT_CGEN | LIB3270_DEFAULT_CSET; | |
64 | -// unsigned long cgcsgid_dbcs = 0L; | |
64 | +// Globals. | |
65 | 65 | const char *default_display_charset = "3270cg-1a,3270cg-1,iso8859-1"; |
66 | -// char *encoding; | |
67 | 66 | |
68 | -// unsigned char auto_keymap = 0; | |
69 | - | |
70 | -/* Statics. */ | |
67 | +// Statics. | |
71 | 68 | static enum cs_result resource_charset(H3270 *hSession, const char *csname, char *cs, char *ftcs); |
72 | 69 | |
73 | 70 | typedef enum { CS_ONLY, FT_ONLY, BOTH } remap_scope; |
... | ... | @@ -75,20 +72,16 @@ typedef enum { CS_ONLY, FT_ONLY, BOTH } remap_scope; |
75 | 72 | static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spec, remap_scope scope, int *ne); |
76 | 73 | static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); |
77 | 74 | |
78 | -#if defined(DEBUG_CHARSET) /*[*/ | |
75 | +#if defined(DEBUG_CHARSET) | |
79 | 76 | static enum cs_result check_charset(void); |
80 | 77 | static char *char_if_ascii7(unsigned long l); |
81 | -#endif /*]*/ | |
78 | +#endif | |
82 | 79 | |
83 | 80 | static void set_cgcsgids(H3270 *hSession, const char *spec); |
84 | 81 | static int set_cgcsgid(char *spec, unsigned long *idp); |
85 | 82 | |
86 | 83 | static KeySym StringToKeysym(char *s); |
87 | 84 | |
88 | -// static void set_charset_name(char *csname); | |
89 | -// static char *charset_name = CN; | |
90 | - | |
91 | - | |
92 | 85 | struct charset_buffer |
93 | 86 | { |
94 | 87 | unsigned char ebc2cg[256]; |
... | ... | @@ -96,10 +89,10 @@ struct charset_buffer |
96 | 89 | unsigned char ebc2asc[256]; |
97 | 90 | unsigned char asc2ebc[256]; |
98 | 91 | |
99 | - #if defined(X3270_FT) /*[*/ | |
92 | + #if defined(X3270_FT) | |
100 | 93 | unsigned char ft2asc[256]; |
101 | 94 | unsigned char asc2ft[256]; |
102 | - #endif /*]*/ | |
95 | + #endif | |
103 | 96 | }; |
104 | 97 | |
105 | 98 | |
... | ... | @@ -109,10 +102,10 @@ static void save_charset(H3270 *hSession, struct charset_buffer *save) |
109 | 102 | (void) memcpy((char *)save->cg2ebc, (char *) hSession->charset.cg2ebc, 256); |
110 | 103 | (void) memcpy((char *)save->ebc2asc, (char *) hSession->charset.ebc2asc, 256); |
111 | 104 | (void) memcpy((char *)save->asc2ebc, (char *) hSession->charset.asc2ebc, 256); |
112 | -#if defined(X3270_FT) /*[*/ | |
105 | +#if defined(X3270_FT) | |
113 | 106 | (void) memcpy((char *)save->ft2asc, (char *) hSession->charset.ft2asc, 256); |
114 | 107 | (void) memcpy((char *)save->asc2ft, (char *) hSession->charset.asc2ft, 256); |
115 | -#endif /*]*/ | |
108 | +#endif | |
116 | 109 | } |
117 | 110 | |
118 | 111 | static void restore_charset(H3270 *hSession, struct charset_buffer *save) |
... | ... | @@ -121,59 +114,23 @@ static void restore_charset(H3270 *hSession, struct charset_buffer *save) |
121 | 114 | (void) memcpy((char *)hSession->charset.cg2ebc, (char *)save->cg2ebc, 256); |
122 | 115 | (void) memcpy((char *)hSession->charset.ebc2asc, (char *)save->ebc2asc, 256); |
123 | 116 | (void) memcpy((char *)hSession->charset.asc2ebc, (char *)save->asc2ebc, 256); |
124 | -#if defined(X3270_FT) /*[*/ | |
117 | +#if defined(X3270_FT) | |
125 | 118 | (void) memcpy((char *)hSession->charset.ft2asc, (char *)save->ft2asc, 256); |
126 | 119 | (void) memcpy((char *)hSession->charset.asc2ft, (char *)save->asc2ft, 256); |
127 | -#endif /*]*/ | |
128 | -} | |
129 | - | |
130 | -/* Get a character set definition. */ | |
131 | -/* | |
132 | -static char * get_charset_def(const char *csname) | |
133 | -{ | |
134 | - return get_fresource("%s.%s", "charset", csname); | |
120 | +#endif | |
135 | 121 | } |
136 | -*/ | |
137 | 122 | |
138 | -/* | |
139 | -#if defined(X3270_DBCS) | |
140 | 123 | // |
141 | -// Initialize the DBCS conversion functions, based on resource values. | |
124 | +// Change character sets. | |
142 | 125 | // |
143 | -static int | |
144 | -wide_resource_init(char *csname) | |
145 | -{ | |
146 | - char *cn, *en; | |
147 | - | |
148 | - cn = get_fresource("%s.%s", "dbcsConverters", csname); | |
149 | - if (cn == CN) | |
150 | - return 0; | |
151 | - | |
152 | - en = get_fresource("%s.%s", "localEncoding", csname); | |
153 | - if (en == CN) | |
154 | - en = appres.local_encoding; | |
155 | - Replace(converter_names, cn); | |
156 | - Replace(encoding, en); | |
157 | - | |
158 | - return wide_init(cn, en); | |
159 | - | |
160 | -} | |
161 | -#endif | |
162 | -*/ | |
163 | - | |
164 | -/* | |
165 | - * Change character sets. | |
166 | - */ | |
167 | 126 | enum cs_result charset_init(H3270 *hSession, const char *csname) |
168 | 127 | { |
169 | -// char *cs; | |
170 | -// const char *ftcs; | |
171 | 128 | enum cs_result rc; |
172 | 129 | char *ccs, *cftcs; |
173 | 130 | const char *ak; |
174 | 131 | struct charset_buffer save; |
175 | 132 | |
176 | - /* Do nothing, successfully. */ | |
133 | + // Do nothing, successfully. | |
177 | 134 | if (csname == CN || !strcasecmp(csname, "us")) |
178 | 135 | { |
179 | 136 | charset_defaults(hSession); |
... | ... | @@ -182,81 +139,50 @@ enum cs_result charset_init(H3270 *hSession, const char *csname) |
182 | 139 | return CS_OKAY; |
183 | 140 | } |
184 | 141 | |
185 | - /* Figure out if it's already in a resource or in a file. */ | |
142 | + // Figure out if it's already in a resource or in a file. | |
186 | 143 | #ifdef ANDROID |
187 | 144 | ccs = strdup("0xad: [ \n 0xba: Yacute \n0xbd: ] \n 0xbb: diaeresis \n"); |
188 | 145 | #else |
189 | 146 | ccs = lib3270_get_resource_string(hSession,"charset", csname, NULL); |
190 | 147 | #endif |
191 | -/* | |
192 | - if (cs == CN && strlen(csname) > ES_SIZE && !strcasecmp(csname + strlen(csname) - ES_SIZE, EURO_SUFFIX)) | |
193 | - { | |
194 | - char *basename = | |
195 | - lib3270_free(cs); | |
196 | - | |
197 | - // Grab the non-Euro definition. | |
198 | - basename = xs_buffer("%.*s", (int) (strlen(csname) - ES_SIZE), csname); | |
199 | - cs = get_charset_def(basename); | |
200 | - lib3270_free(basename); | |
201 | - } | |
202 | -*/ | |
203 | 148 | if (!ccs) |
204 | 149 | return CS_NOTFOUND; |
205 | 150 | |
206 | - /* Grab the File Transfer character set. */ | |
151 | + // Grab the File Transfer character set. | |
207 | 152 | cftcs = lib3270_get_resource_string(hSession,"ftCharset",csname,NULL); |
208 | 153 | |
209 | - /* Save the current definitions, and start over with the defaults. */ | |
154 | + // Save the current definitions, and start over with the defaults. | |
210 | 155 | save_charset(hSession,&save); |
211 | 156 | charset_defaults(hSession); |
212 | 157 | |
213 | - /* Check for auto-keymap. */ | |
158 | + // Check for auto-keymap. | |
214 | 159 | ak = lib3270_get_resource_string(hSession,"autoKeymap", csname, NULL); |
215 | 160 | if (ak != NULL) |
216 | 161 | hSession->auto_keymap = strcasecmp(ak, "true") ? 0 : 1; |
217 | 162 | else |
218 | 163 | hSession->auto_keymap = 0; |
219 | 164 | |
220 | - /* Interpret them. */ | |
165 | + // Interpret them. | |
221 | 166 | rc = resource_charset(hSession,csname, ccs, cftcs); |
222 | 167 | |
223 | - /* Free them. */ | |
168 | + // Free them. | |
224 | 169 | lib3270_free(ccs); |
225 | 170 | lib3270_free(cftcs); |
226 | 171 | |
227 | -#if defined(DEBUG_CHARSET) /*[*/ | |
172 | +#if defined(DEBUG_CHARSET) | |
228 | 173 | if (rc == CS_OKAY) |
229 | 174 | rc = check_charset(); |
230 | -#endif /*]*/ | |
175 | +#endif | |
231 | 176 | |
232 | 177 | if (rc != CS_OKAY) |
233 | 178 | restore_charset(hSession,&save); |
234 | 179 | |
235 | -/* | |
236 | -#if defined(X3270_DBCS) | |
237 | - else if (wide_resource_init(csname) < 0) { | |
238 | - restore_charset(); | |
239 | - return CS_NOTFOUND; | |
240 | - } | |
241 | -#endif | |
242 | -*/ | |
243 | - | |
244 | -/* | |
245 | -#if defined(X3270_DISPLAY) | |
246 | - // Check for an XK selector. | |
247 | - xks = get_fresource("%s.%s", ResXkSelector, csname); | |
248 | - if (xks != NULL) | |
249 | - xk_selector = (unsigned char) strtoul(xks, NULL, 0); | |
250 | - else | |
251 | - xk_selector = 0; | |
252 | -#endif | |
253 | -*/ | |
254 | 180 | return rc; |
255 | 181 | } |
256 | 182 | |
257 | -/** | |
258 | - * Set a CGCSGID. Return 0 for success, -1 for failure. | |
259 | - */ | |
183 | +// | |
184 | +// Set a CGCSGID. Return 0 for success, -1 for failure. | |
185 | +// | |
260 | 186 | static int set_cgcsgid(char *spec, unsigned long *r) |
261 | 187 | { |
262 | 188 | unsigned long cp; |
... | ... | @@ -275,7 +201,7 @@ static int set_cgcsgid(char *spec, unsigned long *r) |
275 | 201 | return -1; |
276 | 202 | } |
277 | 203 | |
278 | -/* Set the CGCSGIDs. */ | |
204 | +// Set the CGCSGIDs. | |
279 | 205 | static void set_cgcsgids(H3270 *hSession, const char *spec) |
280 | 206 | { |
281 | 207 | int n_ids = 0; |
... | ... | @@ -293,11 +219,11 @@ static void set_cgcsgids(H3270 *hSession, const char *spec) |
293 | 219 | case 0: |
294 | 220 | idp = &hSession->cgcsgid; |
295 | 221 | break; |
296 | -#if defined(X3270_DBCS) /*[*/ | |
222 | +#if defined(X3270_DBCS) | |
297 | 223 | case 1: |
298 | 224 | idp = &hSession->cgcsgid_dbcs; |
299 | 225 | break; |
300 | -#endif /*]*/ | |
226 | +#endif | |
301 | 227 | default: |
302 | 228 | popup_an_error(hSession,_( "Extra CGCSGID(s), ignoring" )); |
303 | 229 | break; |
... | ... | @@ -317,29 +243,12 @@ static void set_cgcsgids(H3270 *hSession, const char *spec) |
317 | 243 | } |
318 | 244 | |
319 | 245 | hSession->cgcsgid = LIB3270_DEFAULT_CGEN | LIB3270_DEFAULT_CSET; |
320 | -#if defined(X3270_DBCS) /*[*/ | |
246 | +#if defined(X3270_DBCS) | |
321 | 247 | hSession->cgcsgid_dbcs = 0L; |
322 | -#endif /*]*/ | |
323 | -} | |
324 | - | |
325 | -/* Set the global charset name. */ /* | |
326 | -static void | |
327 | -set_charset_name(char *csname) | |
328 | -{ | |
329 | - if (csname == CN) { | |
330 | - Replace(charset_name, NewString("us")); | |
331 | - charset_changed = False; | |
332 | - return; | |
333 | - } | |
334 | - if ((charset_name != CN && strcmp(charset_name, csname)) || | |
335 | - (appres.charset != CN && strcmp(appres.charset, csname))) { | |
336 | - Replace(charset_name, NewString(csname)); | |
337 | - charset_changed = True; | |
338 | - } | |
248 | +#endif | |
339 | 249 | } |
340 | -*/ | |
341 | 250 | |
342 | -/* Define a charset from resources. */ | |
251 | +// Define a charset from resources. | |
343 | 252 | static enum cs_result resource_charset(H3270 *hSession, const char *csname, char *cs, char *ftcs) |
344 | 253 | { |
345 | 254 | enum cs_result rc; |
... | ... | @@ -348,7 +257,7 @@ static enum cs_result resource_charset(H3270 *hSession, const char *csname, char |
348 | 257 | int n_rcs = 0; |
349 | 258 | char * dcs; |
350 | 259 | |
351 | - /* Interpret the spec. */ | |
260 | + // Interpret the spec. | |
352 | 261 | rc = remap_chars(hSession, csname, cs, (ftcs == NULL)? BOTH: CS_ONLY, &ne); |
353 | 262 | if (rc != CS_OKAY) |
354 | 263 | return rc; |
... | ... | @@ -358,10 +267,9 @@ static enum cs_result resource_charset(H3270 *hSession, const char *csname, char |
358 | 267 | return rc; |
359 | 268 | } |
360 | 269 | |
361 | -// rcs = get_fresource("%s.%s", "displayCharset", csname); | |
362 | 270 | rcs = lib3270_get_resource_string(hSession,"displayCharset", csname, NULL); |
363 | 271 | |
364 | - /* Isolate the pieces. */ | |
272 | + // Isolate the pieces. | |
365 | 273 | if (rcs != CN) |
366 | 274 | { |
367 | 275 | char *buf, *token; |
... | ... | @@ -387,29 +295,7 @@ static enum cs_result resource_charset(H3270 *hSession, const char *csname, char |
387 | 295 | |
388 | 296 | lib3270_free(rcs); |
389 | 297 | |
390 | -/* | |
391 | -#if defined(X3270_DBCS) | |
392 | - // Can't swap DBCS modes while connected. | |
393 | - if (IN_3270 && (n_rcs == 2) != dbcs) { | |
394 | - popup_an_error(NULL,"Can't change DBCS modes while connected"); | |
395 | - return CS_ILLEGAL; | |
396 | - } | |
397 | -#endif | |
398 | -*/ | |
399 | - | |
400 | -/* | |
401 | -#if !defined(_WIN32) | |
402 | - utf8_set_display_charsets(rcs? rcs: default_display_charset, csname); | |
403 | -#endif | |
404 | -#if defined(X3270_DBCS) | |
405 | - if (n_rcs > 1) | |
406 | - dbcs = True; | |
407 | - else | |
408 | - dbcs = False; | |
409 | -#endif | |
410 | -*/ | |
411 | - | |
412 | - /* Set up the cgcsgid. */ | |
298 | + // Set up the cgcsgid. | |
413 | 299 | // set_cgcsgids(get_fresource("%s.%s", "codepage", csname)); |
414 | 300 | { |
415 | 301 | char *ptr = lib3270_get_resource_string(hSession,"codepage", csname, NULL); |
... | ... | @@ -427,16 +313,16 @@ static enum cs_result resource_charset(H3270 *hSession, const char *csname, char |
427 | 313 | |
428 | 314 | lib3270_free(dcs); |
429 | 315 | |
430 | - /* Set up the character set name. */ | |
316 | + // Set up the character set name. | |
431 | 317 | // set_charset_name(csname); |
432 | 318 | |
433 | 319 | return CS_OKAY; |
434 | 320 | } |
435 | 321 | |
436 | -/* | |
437 | - * Map a keysym name or literal string into a character. | |
438 | - * Returns NoSymbol if there is a problem. | |
439 | - */ | |
322 | +// | |
323 | +// Map a keysym name or literal string into a character. | |
324 | +//Returns NoSymbol if there is a problem. | |
325 | +// | |
440 | 326 | static KeySym |
441 | 327 | parse_keysym(char *s, Boolean extended) |
442 | 328 | { |
... | ... | @@ -463,25 +349,25 @@ parse_keysym(char *s, Boolean extended) |
463 | 349 | return k; |
464 | 350 | } |
465 | 351 | |
466 | -/* Process a single character definition. */ | |
352 | +// Process a single character definition. | |
467 | 353 | static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) |
468 | 354 | { |
469 | 355 | unsigned char cg; |
470 | 356 | |
471 | - /* Ignore mappings of EBCDIC control codes and the space character. */ | |
357 | + // Ignore mappings of EBCDIC control codes and the space character. | |
472 | 358 | if (ebc <= 0x40) |
473 | 359 | return; |
474 | 360 | |
475 | - /* If they want to map to a NULL or a blank, make it a one-way blank. */ | |
361 | + // If they want to map to a NULL or a blank, make it a one-way blank. | |
476 | 362 | if (iso == 0x0) |
477 | 363 | iso = 0x20; |
478 | 364 | if (iso == 0x20) |
479 | 365 | one_way = True; |
480 | 366 | |
481 | 367 | if (!hSession->auto_keymap || iso <= 0xff) { |
482 | -#if defined(X3270_FT) /*[*/ | |
368 | +#if defined(X3270_FT) | |
483 | 369 | unsigned char aa; |
484 | -#endif /*]*/ | |
370 | +#endif | |
485 | 371 | |
486 | 372 | if (scope == BOTH || scope == CS_ONLY) { |
487 | 373 | if (iso <= 0xff) { |
... | ... | @@ -489,14 +375,14 @@ static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scop |
489 | 375 | |
490 | 376 | if (hSession->charset.cg2asc[cg] == iso || iso == 0) |
491 | 377 | { |
492 | - /* well-defined */ | |
378 | + // well-defined | |
493 | 379 | hSession->charset.ebc2cg[ebc] = cg; |
494 | 380 | if (!one_way) |
495 | 381 | hSession->charset.cg2ebc[cg] = ebc; |
496 | 382 | } |
497 | 383 | else |
498 | 384 | { |
499 | - /* into a hole */ | |
385 | + // into a hole | |
500 | 386 | hSession->charset.ebc2cg[ebc] = CG_boxsolid; |
501 | 387 | } |
502 | 388 | } |
... | ... | @@ -507,57 +393,57 @@ static void remap_one(H3270 *hSession, unsigned char ebc, KeySym iso, remap_scop |
507 | 393 | hSession->charset.asc2ebc[iso] = ebc; |
508 | 394 | } |
509 | 395 | } |
510 | -#if defined(X3270_FT) /*[*/ | |
396 | +#if defined(X3270_FT) | |
511 | 397 | if (iso <= 0xff && ebc > 0x40) { |
512 | - /* Change the file transfer translation table. */ | |
398 | + // Change the file transfer translation table. | |
513 | 399 | if (scope == BOTH) { |
514 | - /* | |
515 | - * We have an alternate mapping of an EBCDIC | |
516 | - * code to an ASCII code. Modify the existing | |
517 | - * ASCII(ft)-to-ASCII(desired) maps. | |
518 | - * | |
519 | - * This is done by figuring out which ASCII | |
520 | - * code the host usually translates the given | |
521 | - * EBCDIC code to (asc2ft0[ebc2asc0[ebc]]). | |
522 | - * Now we want to translate that code to the | |
523 | - * given ISO code, and vice-versa. | |
524 | - */ | |
400 | + // | |
401 | + // We have an alternate mapping of an EBCDIC | |
402 | + // code to an ASCII code. Modify the existing | |
403 | + // ASCII(ft)-to-ASCII(desired) maps. | |
404 | + // | |
405 | + // This is done by figuring out which ASCII | |
406 | + // code the host usually translates the given | |
407 | + // EBCDIC code to (asc2ft0[ebc2asc0[ebc]]). | |
408 | + // Now we want to translate that code to the | |
409 | + // given ISO code, and vice-versa. | |
410 | + // | |
525 | 411 | aa = asc2ft0[ebc2asc0[ebc]]; |
526 | 412 | if (aa != ' ') { |
527 | 413 | hSession->charset.ft2asc[aa] = iso; |
528 | 414 | hSession->charset.asc2ft[iso] = aa; |
529 | 415 | } |
530 | 416 | } else if (scope == FT_ONLY) { |
531 | - /* | |
532 | - * We have a map of how the host translates | |
533 | - * the given EBCDIC code to an ASCII code. | |
534 | - * Generate the translation between that code | |
535 | - * and the ISO code that we would normally | |
536 | - * use to display that EBCDIC code. | |
537 | - */ | |
417 | + // | |
418 | + // We have a map of how the host translates | |
419 | + // the given EBCDIC code to an ASCII code. | |
420 | + // Generate the translation between that code | |
421 | + // and the ISO code that we would normally | |
422 | + // use to display that EBCDIC code. | |
423 | + // | |
538 | 424 | hSession->charset.ft2asc[iso] = hSession->charset.ebc2asc[ebc]; |
539 | 425 | hSession->charset.asc2ft[hSession->charset.ebc2asc[ebc]] = iso; |
540 | 426 | } |
541 | 427 | } |
542 | -#endif /*]*/ | |
428 | +#endif | |
543 | 429 | } else { |
544 | - /* Auto-keymap. */ | |
430 | + // Auto-keymap. | |
545 | 431 | add_xk(iso, (KeySym)hSession->charset.ebc2asc[ebc]); |
546 | 432 | } |
547 | 433 | } |
548 | 434 | |
549 | -/** | |
550 | - * Parse an EBCDIC character set map, a series of pairs of numeric EBCDIC codes and keysyms. | |
551 | - * | |
552 | - * If the keysym is in the range 1..255, it is a remapping of the EBCDIC code | |
553 | - * for a standard Latin-1 graphic, and the CG-to-EBCDIC map will be modified | |
554 | - * to match. | |
555 | - * | |
556 | - * Otherwise (keysym > 255), it is a definition for the EBCDIC code to use for | |
557 | - * a multibyte keysym. This is intended for 8-bit fonts that with special | |
558 | - * characters that replace certain standard Latin-1 graphics. The keysym | |
559 | - * will be entered into the extended keysym translation table. | |
560 | - */ | |
435 | +// | |
436 | +// Parse an EBCDIC character set map, a series of pairs of numeric EBCDIC codes and keysyms. | |
437 | +// | |
438 | +// If the keysym is in the range 1..255, it is a remapping of the EBCDIC code | |
439 | +// for a standard Latin-1 graphic, and the CG-to-EBCDIC map will be modified | |
440 | +// to match. | |
441 | +// | |
442 | +// Otherwise (keysym > 255), it is a definition for the EBCDIC code to use for | |
443 | +// a multibyte keysym. This is intended for 8-bit fonts that with special | |
444 | +// characters that replace certain standard Latin-1 graphics. The keysym | |
445 | +// will be entered into the extended keysym translation table. | |
446 | +// | |
561 | 447 | static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spec, remap_scope scope, int *ne) |
562 | 448 | { |
563 | 449 | char *s; |
... | ... | @@ -569,7 +455,7 @@ static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spe |
569 | 455 | Boolean is_table = False; |
570 | 456 | Boolean one_way = False; |
571 | 457 | |
572 | - /* Pick apart a copy of the spec. */ | |
458 | + // Pick apart a copy of the spec. | |
573 | 459 | s = spec = NewString(spec); |
574 | 460 | while (isspace(*s)) { |
575 | 461 | s++; |
... | ... | @@ -614,12 +500,12 @@ static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spe |
614 | 500 | popup_an_error(NULL,_( "Charset has %d entries, need 256" ), ebc); |
615 | 501 | rc = CS_BAD; |
616 | 502 | } else { |
617 | - /* | |
618 | - * The entire EBCDIC-to-ASCII mapping has been defined. | |
619 | - * Make sure that any printable ASCII character that | |
620 | - * doesn't now map back onto itself is mapped onto an | |
621 | - * EBCDIC NUL. | |
622 | - */ | |
503 | + // | |
504 | + // The entire EBCDIC-to-ASCII mapping has been defined. | |
505 | + // Make sure that any printable ASCII character that | |
506 | + // doesn't now map back onto itself is mapped onto an | |
507 | + // EBCDIC NUL. | |
508 | + // | |
623 | 509 | int i; |
624 | 510 | |
625 | 511 | for (i = 0; i < 256; i++) { |
... | ... | @@ -655,7 +541,7 @@ static enum cs_result remap_chars(H3270 *hSession, const char *csname, char *spe |
655 | 541 | return rc; |
656 | 542 | } |
657 | 543 | |
658 | -#if defined(DEBUG_CHARSET) /*[*/ | |
544 | +#if defined(DEBUG_CHARSET) | |
659 | 545 | static char * |
660 | 546 | char_if_ascii7(unsigned long l) |
661 | 547 | { |
... | ... | @@ -667,15 +553,15 @@ char_if_ascii7(unsigned long l) |
667 | 553 | } else |
668 | 554 | return ""; |
669 | 555 | } |
670 | -#endif /*]*/ | |
556 | +#endif | |
671 | 557 | |
672 | 558 | |
673 | -#if defined(DEBUG_CHARSET) /*[*/ | |
674 | -/* | |
675 | - * Verify that a character set is not ambiguous. | |
676 | - * (All this checks is that multiple EBCDIC codes map onto the same ISO code. | |
677 | - * Hmm. God, I find the CG stuff confusing.) | |
678 | - */ | |
559 | +#if defined(DEBUG_CHARSET) | |
560 | +// | |
561 | +// Verify that a character set is not ambiguous. | |
562 | +// (All this checks is that multiple EBCDIC codes map onto the same ISO code. | |
563 | +// Hmm. God, I find the CG stuff confusing.) | |
564 | +// | |
679 | 565 | static enum cs_result |
680 | 566 | check_charset(void) |
681 | 567 | { |
... | ... | @@ -706,24 +592,13 @@ check_charset(void) |
706 | 592 | } |
707 | 593 | return rc; |
708 | 594 | } |
709 | -#endif /*]*/ | |
595 | +#endif | |
710 | 596 | |
711 | 597 | void set_display_charset(H3270 *session, const char *dcs) |
712 | 598 | { |
713 | 599 | session->charset.display = strdup(dcs); |
714 | 600 | } |
715 | 601 | |
716 | -LIB3270_EXPORT const char * lib3270_get_default_charset(void) | |
717 | -{ | |
718 | - return "ISO-8859-1"; | |
719 | -} | |
720 | - | |
721 | -LIB3270_EXPORT const char * lib3270_get_charset(H3270 *hSession) | |
722 | -{ | |
723 | - CHECK_SESSION_HANDLE(hSession); | |
724 | - return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; | |
725 | -} | |
726 | - | |
727 | 602 | static KeySym StringToKeysym(char *s) |
728 | 603 | { |
729 | 604 | static struct |
... | ... | @@ -952,3 +827,17 @@ static KeySym StringToKeysym(char *s) |
952 | 827 | } |
953 | 828 | return NoSymbol; |
954 | 829 | } |
830 | + | |
831 | +*/ | |
832 | + | |
833 | +LIB3270_EXPORT const char * lib3270_get_default_charset(void) | |
834 | +{ | |
835 | + return "ISO-8859-1"; | |
836 | +} | |
837 | + | |
838 | +LIB3270_EXPORT const char * lib3270_get_charset(H3270 *hSession) | |
839 | +{ | |
840 | + CHECK_SESSION_HANDLE(hSession); | |
841 | + return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; | |
842 | +} | |
843 | + | ... | ... |
src/lib3270/kybd.c
... | ... | @@ -130,12 +130,14 @@ Boolean key_WCharacter(unsigned char code[], Boolean *skipped); |
130 | 130 | #endif |
131 | 131 | */ |
132 | 132 | |
133 | +/* | |
133 | 134 | static int nxk = 0; |
134 | 135 | static struct xks |
135 | 136 | { |
136 | 137 | KeySym key; |
137 | 138 | KeySym assoc; |
138 | 139 | } *xk; |
140 | +*/ | |
139 | 141 | |
140 | 142 | // static Boolean reverse = False; /* reverse-input mode */ |
141 | 143 | |
... | ... | @@ -3070,6 +3072,7 @@ MyStringToKeysym(char *s, enum keytype *keytypep) |
3070 | 3072 | */ |
3071 | 3073 | |
3072 | 3074 | /* Add a key to the extended association table. */ |
3075 | +/* | |
3073 | 3076 | void |
3074 | 3077 | add_xk(KeySym key, KeySym assoc) |
3075 | 3078 | { |
... | ... | @@ -3085,10 +3088,11 @@ add_xk(KeySym key, KeySym assoc) |
3085 | 3088 | xk[nxk].assoc = assoc; |
3086 | 3089 | nxk++; |
3087 | 3090 | } |
3091 | +*/ | |
3088 | 3092 | |
3089 | 3093 | /* Clear the extended association table. */ |
3090 | -void | |
3091 | -clear_xks(void) | |
3094 | +/* | |
3095 | +void clear_xks(void) | |
3092 | 3096 | { |
3093 | 3097 | if (nxk) { |
3094 | 3098 | lib3270_free(xk); |
... | ... | @@ -3096,5 +3100,6 @@ clear_xks(void) |
3096 | 3100 | nxk = 0; |
3097 | 3101 | } |
3098 | 3102 | } |
3103 | +*/ | |
3099 | 3104 | |
3100 | 3105 | ... | ... |
src/lib3270/session.c
... | ... | @@ -324,13 +324,14 @@ H3270 * lib3270_session_new(const char *model) |
324 | 324 | if(screen_init(hSession)) |
325 | 325 | return NULL; |
326 | 326 | |
327 | +/* | |
327 | 328 | trace("Charset: %s",hSession->charset.host); |
328 | 329 | if (charset_init(hSession,hSession->charset.host) != CS_OKAY) |
329 | 330 | { |
330 | 331 | Warning(hSession, _( "Cannot find charset \"%s\", using defaults" ), hSession->charset.host); |
331 | 332 | (void) charset_init(hSession,CN); |
332 | 333 | } |
333 | - | |
334 | +*/ | |
334 | 335 | trace("%s: Initializing KYBD",__FUNCTION__); |
335 | 336 | lib3270_register_schange(hSession,LIB3270_STATE_CONNECT,kybd_connect,NULL); |
336 | 337 | lib3270_register_schange(hSession,LIB3270_STATE_3270_MODE,kybd_in3270,NULL); | ... | ... |
src/lib3270/tables.c
... | ... | @@ -40,6 +40,7 @@ |
40 | 40 | |
41 | 41 | #include "globals.h" |
42 | 42 | #include "tablesc.h" |
43 | +#include "kybdc.h" | |
43 | 44 | |
44 | 45 | static const unsigned short asc2cg[256] = { |
45 | 46 | /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
... | ... | @@ -458,6 +459,7 @@ LIB3270_INTERNAL void initialize_tables(H3270 *hSession) |
458 | 459 | memcpy(hSession->charset.cg2asc, cg2asc, sizeof(hSession->charset.cg2asc)); |
459 | 460 | |
460 | 461 | #ifdef EXTENDED_TABLES |
462 | + #error Need implementation to the new format | |
461 | 463 | memcpy(ebc2asc7, ebc2asc70, sizeof(ebc2asc7)); |
462 | 464 | #endif // EXTENDED_TABLES |
463 | 465 | |
... | ... | @@ -479,5 +481,5 @@ void charset_defaults(H3270 *hSession) |
479 | 481 | (void) memcpy((char *)hSession->charset.ft2asc, (const char *)ft2asc0, 256); |
480 | 482 | (void) memcpy((char *)hSession->charset.asc2ft, (const char *)asc2ft0, 256); |
481 | 483 | #endif /*]*/ |
482 | - clear_xks(); | |
484 | + // clear_xks(); | |
483 | 485 | } | ... | ... |
src/lib3270/util.c
... | ... | @@ -952,7 +952,7 @@ LIB3270_EXPORT void * lib3270_strdup(const char *str) |
952 | 952 | return r; |
953 | 953 | } |
954 | 954 | |
955 | - | |
955 | +/* | |
956 | 956 | LIB3270_EXPORT char * lib3270_get_resource_string(H3270 *hSession, const char *first_element, ...) |
957 | 957 | { |
958 | 958 | #ifdef ANDROID |
... | ... | @@ -993,6 +993,7 @@ LIB3270_EXPORT char * lib3270_get_resource_string(H3270 *hSession, const char *f |
993 | 993 | #endif |
994 | 994 | return NULL; |
995 | 995 | } |
996 | +*/ | |
996 | 997 | |
997 | 998 | LIB3270_EXPORT const char * lib3270_get_version(void) |
998 | 999 | { |
... | ... | @@ -1048,3 +1049,5 @@ int gettimeofday(struct timeval *tv, void *ignored) |
1048 | 1049 | trace("%s(%p)",__FUNCTION__,h); |
1049 | 1050 | return h->print(h); |
1050 | 1051 | } |
1052 | + | |
1053 | + | ... | ... |
src/pw3270/hostdialog.c
... | ... | @@ -140,7 +140,7 @@ |
140 | 140 | int iHostType = 0; |
141 | 141 | int iColorTable = 0; |
142 | 142 | #if GTK_CHECK_VERSION(3,0,0) |
143 | - GtkGrid * grid = gtk_grid_new(); | |
143 | + GtkGrid * grid = GTK_GRID(gtk_grid_new()); | |
144 | 144 | #else |
145 | 145 | GtkTable * table = GTK_TABLE(gtk_table_new(3,4,FALSE)); |
146 | 146 | #endif // GTK_CHECK_VERSION |
... | ... | @@ -235,7 +235,7 @@ |
235 | 235 | GtkWidget * expander = gtk_expander_new_with_mnemonic(_( "_Host options")); |
236 | 236 | |
237 | 237 | #if GTK_CHECK_VERSION(3,0,0) |
238 | - GtkGrid * container = gtk_grid_new(); | |
238 | + GtkGrid * container = GTK_GRID(gtk_grid_new()); | |
239 | 239 | |
240 | 240 | gtk_grid_set_column_spacing(container,5); |
241 | 241 | gtk_grid_set_row_spacing(container,3); | ... | ... |