Commit 4e294695735102572114de41dfc340dfd0bd3df2
1 parent
c72aba7b
Exists in
master
and in
5 other branches
Removendo funções de charse sem uso já que toda a tradução para UTF-8 é feita pelo gtk
Showing
3 changed files
with
54 additions
and
62 deletions
Show diff stats
src/lib3270/charset.c
... | ... | @@ -90,9 +90,9 @@ static char *char_if_ascii7(unsigned long l); |
90 | 90 | #endif /*]*/ |
91 | 91 | static void set_cgcsgids(char *spec); |
92 | 92 | static int set_cgcsgid(char *spec, unsigned long *idp); |
93 | -static void set_charset_name(char *csname); | |
94 | 93 | |
95 | -static char *charset_name = CN; | |
94 | +// static void set_charset_name(char *csname); | |
95 | +// static char *charset_name = CN; | |
96 | 96 | |
97 | 97 | static void |
98 | 98 | charset_defaults(void) |
... | ... | @@ -187,27 +187,30 @@ enum cs_result charset_init(H3270 *session, char *csname) |
187 | 187 | char *xks; |
188 | 188 | #endif /*]*/ |
189 | 189 | char *ak; |
190 | -#if !defined(_WIN32) /*[*/ | |
190 | + | |
191 | +/* | |
192 | +#if !defined(_WIN32) | |
191 | 193 | char *codeset_name; |
192 | -#endif /*]*/ | |
194 | +#endif | |
193 | 195 | |
194 | -#if !defined(_WIN32) /*[*/ | |
195 | - /* Get all of the locale stuff right. */ | |
196 | -// setlocale(LC_ALL, ""); | |
196 | +#if !defined(_WIN32) | |
197 | + // Get all of the locale stuff right. | |
197 | 198 | |
198 | - /* Figure out the locale code set (character set encoding). */ | |
199 | + // Figure out the locale code set (character set encoding). | |
199 | 200 | codeset_name = nl_langinfo(CODESET); |
200 | 201 | Trace("codeset_name: %s",codeset_name); |
201 | 202 | set_codeset(codeset_name); |
202 | -#endif /*]*/ | |
203 | +#endif | |
204 | +*/ | |
205 | + | |
203 | 206 | |
204 | 207 | /* Do nothing, successfully. */ |
205 | - if (csname == CN || !strcasecmp(csname, "us")) { | |
208 | + if (csname == CN || !strcasecmp(csname, "us")) | |
209 | + { | |
206 | 210 | charset_defaults(); |
207 | 211 | set_cgcsgids(CN); |
208 | - set_charset_name(CN); | |
212 | +// set_charset_name(CN); | |
209 | 213 | set_display_charset(session, "ISO-8859-1"); |
210 | - | |
211 | 214 | return CS_OKAY; |
212 | 215 | } |
213 | 216 | |
... | ... | @@ -265,15 +268,16 @@ enum cs_result charset_init(H3270 *session, char *csname) |
265 | 268 | } |
266 | 269 | #endif /*]*/ |
267 | 270 | |
268 | -#if defined(X3270_DISPLAY) /*[*/ | |
269 | - /* Check for an XK selector. */ | |
271 | +/* | |
272 | +#if defined(X3270_DISPLAY) | |
273 | + // Check for an XK selector. | |
270 | 274 | xks = get_fresource("%s.%s", ResXkSelector, csname); |
271 | 275 | if (xks != NULL) |
272 | 276 | xk_selector = (unsigned char) strtoul(xks, NULL, 0); |
273 | 277 | else |
274 | 278 | xk_selector = 0; |
275 | -#endif /*]*/ | |
276 | - | |
279 | +#endif | |
280 | +*/ | |
277 | 281 | return rc; |
278 | 282 | } |
279 | 283 | |
... | ... | @@ -345,7 +349,7 @@ set_cgcsgids(char *spec) |
345 | 349 | #endif /*]*/ |
346 | 350 | } |
347 | 351 | |
348 | -/* Set the global charset name. */ | |
352 | +/* Set the global charset name. */ /* | |
349 | 353 | static void |
350 | 354 | set_charset_name(char *csname) |
351 | 355 | { |
... | ... | @@ -360,6 +364,7 @@ set_charset_name(char *csname) |
360 | 364 | charset_changed = True; |
361 | 365 | } |
362 | 366 | } |
367 | +*/ | |
363 | 368 | |
364 | 369 | /* Define a charset from resources. */ |
365 | 370 | static enum cs_result resource_charset(char *csname, char *cs, char *ftcs) |
... | ... | @@ -368,9 +373,7 @@ static enum cs_result resource_charset(char *csname, char *cs, char *ftcs) |
368 | 373 | int ne = 0; |
369 | 374 | char *rcs = CN; |
370 | 375 | int n_rcs = 0; |
371 | -#if defined(_WIN32) /*[*/ | |
372 | 376 | char *dcs; |
373 | -#endif /*]*/ | |
374 | 377 | |
375 | 378 | /* Interpret the spec. */ |
376 | 379 | rc = remap_chars(csname, cs, (ftcs == NULL)? BOTH: CS_ONLY, &ne); |
... | ... | @@ -414,17 +417,7 @@ static enum cs_result resource_charset(char *csname, char *cs, char *ftcs) |
414 | 417 | } |
415 | 418 | #endif /*]*/ |
416 | 419 | |
417 | - | |
418 | 420 | /* |
419 | -#if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32) && !defined(LIB3270)) | |
420 | - if (!screen_new_display_charsets( | |
421 | - rcs? rcs: default_display_charset, | |
422 | - csname)) { | |
423 | - return CS_PREREQ; | |
424 | - } | |
425 | -#else | |
426 | -*/ | |
427 | - | |
428 | 421 | #if !defined(_WIN32) |
429 | 422 | utf8_set_display_charsets(rcs? rcs: default_display_charset, csname); |
430 | 423 | #endif |
... | ... | @@ -434,25 +427,20 @@ static enum cs_result resource_charset(char *csname, char *cs, char *ftcs) |
434 | 427 | else |
435 | 428 | dbcs = False; |
436 | 429 | #endif |
437 | -/* #endif */ | |
430 | +*/ | |
438 | 431 | |
439 | 432 | /* Set up the cgcsgid. */ |
440 | 433 | set_cgcsgids(get_fresource("%s.%s", ResCodepage, csname)); |
441 | 434 | |
442 | -#if defined(_WIN32) /*[*/ | |
443 | - /* See about changing the console output code page. */ | |
444 | - dcs = get_fresource("%s.%s", ResDisplayCharset, csname); | |
445 | - if (dcs != NULL) | |
446 | - { | |
447 | - set_display_charset(dcs); | |
448 | - } else | |
449 | - { | |
450 | - set_display_charset("ISO-8859-1"); | |
451 | - } | |
452 | -#endif /*]*/ | |
435 | + dcs = get_fresource("%s.%s", ResDisplayCharset, csname); | |
436 | + | |
437 | + if (dcs != NULL) | |
438 | + set_display_charset(&h3270,dcs); | |
439 | + else | |
440 | + set_display_charset(&h3270,"ISO-8859-1"); | |
453 | 441 | |
454 | 442 | /* Set up the character set name. */ |
455 | - set_charset_name(csname); | |
443 | +// set_charset_name(csname); | |
456 | 444 | |
457 | 445 | return CS_OKAY; |
458 | 446 | } | ... | ... |
src/lib3270/print.c
... | ... | @@ -264,7 +264,7 @@ fprint_screen(FILE *f, Boolean even_if_empty, Boolean use_html) |
264 | 264 | " <table border=0>" |
265 | 265 | "<tr bgcolor=black><td>" |
266 | 266 | "<pre><font color=%s>%s", |
267 | - locale_codeset, | |
267 | + lib3270_get_charset(&h3270), | |
268 | 268 | html_color(current_color), |
269 | 269 | current_high? "<b>": ""); |
270 | 270 | } | ... | ... |
src/lib3270/util.c
... | ... | @@ -882,17 +882,17 @@ rpf_free(rpf_t *r) |
882 | 882 | r->cur_len = 0; |
883 | 883 | } |
884 | 884 | |
885 | -#if defined(X3270_DISPLAY) /*[*/ | |
885 | +/* | |
886 | +#if defined(X3270_DISPLAY) | |
886 | 887 | |
887 | -/* Glue between x3270 and the X libraries. */ | |
888 | +// Glue between x3270 and the X libraries. | |
888 | 889 | |
889 | -/* | |
890 | - * A way to work around problems with Xt resources. It seems to be impossible | |
891 | - * to get arbitrarily named resources. Someday this should be hacked to | |
892 | - * add classes too. | |
893 | - */ | |
894 | -char * | |
895 | -get_resource(const char *name) | |
890 | +// | |
891 | +// A way to work around problems with Xt resources. It seems to be impossible | |
892 | +// to get arbitrarily named resources. Someday this should be hacked to | |
893 | +// add classes too. | |
894 | +// | |
895 | +char * get_resource(const char *name) | |
896 | 896 | { |
897 | 897 | XrmValue value; |
898 | 898 | char *type; |
... | ... | @@ -903,12 +903,15 @@ get_resource(const char *name) |
903 | 903 | if ((XrmGetResource(rdb, str, 0, &type, &value) == True) && *value.addr) |
904 | 904 | r = value.addr; |
905 | 905 | XtFree(str); |
906 | + | |
907 | + lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,r); | |
908 | + | |
906 | 909 | return r; |
907 | 910 | } |
908 | 911 | |
909 | -/* | |
910 | - * Input callbacks. | |
911 | - */ | |
912 | +// | |
913 | +// Input callbacks. | |
914 | +// | |
912 | 915 | typedef void voidfn(void); |
913 | 916 | |
914 | 917 | typedef struct iorec { |
... | ... | @@ -1001,9 +1004,9 @@ RemoveInput(unsigned long cookie) |
1001 | 1004 | } |
1002 | 1005 | } |
1003 | 1006 | |
1004 | -/* | |
1005 | - * Timer callbacks. | |
1006 | - */ | |
1007 | +// | |
1008 | +/ Timer callbacks. | |
1009 | +// | |
1007 | 1010 | |
1008 | 1011 | typedef struct torec { |
1009 | 1012 | voidfn *fn; |
... | ... | @@ -1029,17 +1032,17 @@ to_fn(XtPointer closure, XtIntervalId *id) |
1029 | 1032 | |
1030 | 1033 | if (torec != NULL) { |
1031 | 1034 | |
1032 | - /* Remember the record. */ | |
1035 | + // Remember the record. | |
1033 | 1036 | fn = torec->fn; |
1034 | 1037 | |
1035 | - /* Free the record. */ | |
1038 | + // Free the record. | |
1036 | 1039 | if (prev != NULL) |
1037 | 1040 | prev->next = torec->next; |
1038 | 1041 | else |
1039 | 1042 | torecs = torec->next; |
1040 | 1043 | XtFree((XtPointer)torec); |
1041 | 1044 | |
1042 | - /* Call the function. */ | |
1045 | + // Call the function. | |
1043 | 1046 | (*fn)(); |
1044 | 1047 | } |
1045 | 1048 | } |
... | ... | @@ -1087,4 +1090,5 @@ StringToKeysym(char *s) |
1087 | 1090 | { |
1088 | 1091 | return XStringToKeysym(s); |
1089 | 1092 | } |
1090 | -#endif /*]*/ | |
1093 | +#endif | |
1094 | +*/ | ... | ... |