Commit 5990d83012bd5131e62947fbbd82008bfd27e913
1 parent
42c42795
Exists in
master
and in
3 other branches
Corrigindo tratamento da tecla F10
Showing
6 changed files
with
5 additions
and
217 deletions
Show diff stats
@@ -88,16 +88,6 @@ | @@ -88,16 +88,6 @@ | ||
88 | #define CN ((char *) NULL) | 88 | #define CN ((char *) NULL) |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | - /* Debug & log */ /* | ||
92 | - #if defined( DEBUG ) | ||
93 | - #define Trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | ||
94 | - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | ||
95 | - #elif !defined(Trace) | ||
96 | - #define Trace( fmt, ... ) // __VA_ARGS__ | ||
97 | - #define trace( fmt, ... ) // __VA_ARGS__ | ||
98 | - #endif | ||
99 | -*/ | ||
100 | - | ||
101 | #include <lib3270/log.h> | 91 | #include <lib3270/log.h> |
102 | 92 | ||
103 | // #define WriteLog(module,fmt, ...) lib3270_write_log(NULL,module,fmt,__VA_ARGS__) | 93 | // #define WriteLog(module,fmt, ...) lib3270_write_log(NULL,module,fmt,__VA_ARGS__) |
@@ -207,7 +207,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | @@ -207,7 +207,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | ||
207 | 207 | ||
208 | unsigned int flen; | 208 | unsigned int flen; |
209 | 209 | ||
210 | -// Trace("%s(%s)",__FUNCTION__,local); | 210 | +// trace("%s(%s)",__FUNCTION__,local); |
211 | if(!lib3270_connected(session)) | 211 | if(!lib3270_connected(session)) |
212 | { | 212 | { |
213 | *msg = N_( "Disconnected from host" ); | 213 | *msg = N_( "Disconnected from host" ); |
@@ -331,7 +331,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | @@ -331,7 +331,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | ||
331 | return NULL; | 331 | return NULL; |
332 | } | 332 | } |
333 | 333 | ||
334 | - Trace("Command: \"%s\"",buffer); | 334 | + trace("Command: \"%s\"",buffer); |
335 | 335 | ||
336 | (void) lib3270_emulate_input(NULL, buffer, strlen(buffer), False); | 336 | (void) lib3270_emulate_input(NULL, buffer, strlen(buffer), False); |
337 | 337 |
glue.c
@@ -119,7 +119,7 @@ static void initialize(void) | @@ -119,7 +119,7 @@ static void initialize(void) | ||
119 | 119 | ||
120 | #ifdef DEBUG | 120 | #ifdef DEBUG |
121 | init_calls++; | 121 | init_calls++; |
122 | - Trace("Initializing library (calls: %d)",init_calls); | 122 | + trace("Initializing library (calls: %d)",init_calls); |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | h3270.selected = 0; | 125 | h3270.selected = 0; |
@@ -130,7 +130,7 @@ static void initialize(void) | @@ -130,7 +130,7 @@ static void initialize(void) | ||
130 | (void) get_version_info(); | 130 | (void) get_version_info(); |
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | - Trace("%s (init_calls: %d)",__FUNCTION__,init_calls); | 133 | + trace("%s (init_calls: %d)",__FUNCTION__,init_calls); |
134 | 134 | ||
135 | /* Set the defaults. */ | 135 | /* Set the defaults. */ |
136 | // appres.mono = False; | 136 | // appres.mono = False; |
paste.c
@@ -155,7 +155,7 @@ | @@ -155,7 +155,7 @@ | ||
155 | 155 | ||
156 | if(BA_TO_ROW(session->cursor_addr) != data->row) | 156 | if(BA_TO_ROW(session->cursor_addr) != data->row) |
157 | { | 157 | { |
158 | - Trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr)); | 158 | + trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr)); |
159 | if(!remargin(session,data->orig_col)) | 159 | if(!remargin(session,data->orig_col)) |
160 | return 0; | 160 | return 0; |
161 | data->row = BA_TO_ROW(session->cursor_addr); | 161 | data->row = BA_TO_ROW(session->cursor_addr); |
screenc.h
@@ -51,21 +51,6 @@ LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); | @@ -51,21 +51,6 @@ LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); | ||
51 | 51 | ||
52 | LIB3270_INTERNAL Boolean escaped; | 52 | LIB3270_INTERNAL Boolean escaped; |
53 | 53 | ||
54 | -/* | ||
55 | -LIB3270_INTERNAL void Escape_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
56 | -LIB3270_INTERNAL void Help_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
57 | -LIB3270_INTERNAL void Redraw_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
58 | -LIB3270_INTERNAL void Trace_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
59 | -LIB3270_INTERNAL void Show_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
60 | -*/ | ||
61 | - | ||
62 | -/* | ||
63 | -#if defined(WC3270) | ||
64 | -LIB3270_INTERNAL void Paste_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
65 | -LIB3270_INTERNAL void Title_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); | ||
66 | -LIB3270_INTERNAL int windows_cp; | ||
67 | -#endif | ||
68 | -*/ | ||
69 | 54 | ||
70 | LIB3270_INTERNAL void screen_title(char *text); | 55 | LIB3270_INTERNAL void screen_title(char *text); |
71 | 56 |
utf8.c
@@ -337,156 +337,6 @@ static char *utf8_tab[U_MAX][96] = { | @@ -337,156 +337,6 @@ static char *utf8_tab[U_MAX][96] = { | ||
337 | }; | 337 | }; |
338 | 338 | ||
339 | /* | 339 | /* |
340 | - * Save the codeset from the locale, and set globals based on known values. | ||
341 | - */ /* | ||
342 | -void | ||
343 | -set_codeset(char *codeset_name) | ||
344 | -{ | ||
345 | - char *new_codeset; | ||
346 | - | ||
347 | -#if defined(X3270_DBCS) | ||
348 | - is_gb18030 = !strcasecmp(codeset_name, "gb18030"); | ||
349 | -#endif | ||
350 | - | ||
351 | -#if !defined(TCL3270) | ||
352 | - is_utf8 = (!strcasecmp(codeset_name, "utf-8") || | ||
353 | - !strcasecmp(codeset_name, "utf8") || | ||
354 | - !strcasecmp(codeset_name, "utf_8")); | ||
355 | -#else | ||
356 | - // | ||
357 | - // tcl3270 is always in UTF-8 mode, because it needs to | ||
358 | - // supply UTF-8 strings to libtcl. | ||
359 | - // | ||
360 | - is_utf8 = 1; | ||
361 | -#endif | ||
362 | - | ||
363 | - Trace("%s locale_codeset: %p new_codeset: %p (%s)",__FUNCTION__,locale_codeset,codeset_name,codeset_name); | ||
364 | - new_codeset = NewString(codeset_name); | ||
365 | - Replace(locale_codeset, new_codeset); | ||
366 | - Trace("%s",__FUNCTION__); | ||
367 | -} | ||
368 | -*/ | ||
369 | - | ||
370 | -/* | ||
371 | - * Set globals based on an x3270 character set list. | ||
372 | - * | ||
373 | - * This defines the 'implied' 8-bit character set for code points 0xa0..0xff, | ||
374 | - * used by utf8_expand() below. | ||
375 | - * | ||
376 | - * set_codeset, above, must be called _before_ this function. | ||
377 | - */ /* | ||
378 | -Boolean | ||
379 | -utf8_set_display_charsets(char *cslist, char *csname) | ||
380 | -{ | ||
381 | - char *dup; | ||
382 | - char *ptr; | ||
383 | - char *tok; | ||
384 | - int i; | ||
385 | - | ||
386 | - utf8_ix = -1; | ||
387 | - | ||
388 | -#if defined(X3270_DBCS) | ||
389 | - if (strchr(cslist, '+') != CN) | ||
390 | - dbcs = True; | ||
391 | -#endif | ||
392 | - | ||
393 | - if (!is_utf8) { | ||
394 | -#if defined(X3270_DBCS) | ||
395 | - if (is_gb18030) { | ||
396 | - // | ||
397 | - // A convenient lie. | ||
398 | - // If the locale is GB18030, use the UTF-8 | ||
399 | - // expansion mechanism to translate 0xa0 through | ||
400 | - // 0xff, using a table entry that expands to GB18030 | ||
401 | - // multi-byte sequences rather than UTF-8. | ||
402 | - // | ||
403 | - // Note that there appears to be a bug in ncursesw | ||
404 | - // (or something it depends on) that turns these | ||
405 | - // characters into garbage. Hopefully this bug will | ||
406 | - // be fixed and this code will start working properly. | ||
407 | - // | ||
408 | - // As a workarond, everything works properly in a | ||
409 | - // Chinese UTF-8 locale. | ||
410 | - // | ||
411 | - utf8_ix = PSEUDO_GB18030; | ||
412 | - } | ||
413 | -#endif | ||
414 | - return True; | ||
415 | - } | ||
416 | - | ||
417 | -#if defined(X3270_DBCS) | ||
418 | - // For DBCS, map 0xa0..0xff as Latin-1. | ||
419 | - if (dbcs) { | ||
420 | - utf8_ix = U_ISO8859_1; | ||
421 | - return True; | ||
422 | - } | ||
423 | -#endif | ||
424 | - | ||
425 | - // Skip 3270cg sets. | ||
426 | - ptr = dup = NewString(cslist); | ||
427 | - while ((tok = strtok(ptr, ",")) != CN) { | ||
428 | - ptr = NULL; | ||
429 | - if (!strncasecmp(tok, "3270cg", 6)) | ||
430 | - continue; | ||
431 | - break; | ||
432 | - } | ||
433 | - if (tok == CN) { | ||
434 | - popup_an_error(NULL,"Invalid displayCharset specification"); | ||
435 | - lib3270_free(dup); | ||
436 | - return False; | ||
437 | - } | ||
438 | - | ||
439 | - // Look up the charset. | ||
440 | - for (i = 0; dcs[i] != CN; i++) { | ||
441 | - if (!strcasecmp(dcs[i], tok)) | ||
442 | - break; | ||
443 | - } | ||
444 | - if (dcs[i] == CN) { | ||
445 | - popup_an_error(NULL,"Unknown displayCharset specification '%s'", | ||
446 | - csname); | ||
447 | - lib3270_free(dup); | ||
448 | - return False; | ||
449 | - } | ||
450 | - utf8_ix = i; | ||
451 | - lib3270_free(dup); | ||
452 | - return True; | ||
453 | -} | ||
454 | -*/ | ||
455 | -/* Expand an 8-bit character in the 'implied' character set. */ | ||
456 | -/* | ||
457 | -char * utf8_expand(unsigned char c) | ||
458 | -{ | ||
459 | - static char nox[2]; | ||
460 | - | ||
461 | - if (c & 0x80) | ||
462 | - { | ||
463 | - if (utf8_ix >= 0) | ||
464 | - { | ||
465 | - if (c >= 0xa0) | ||
466 | - return utf8_tab[utf8_ix][c - 0xa0]; | ||
467 | - else | ||
468 | - return " "; | ||
469 | - } | ||
470 | -#if defined(X3270_DBCS) | ||
471 | - else if (dbcs) | ||
472 | - { | ||
473 | - // | ||
474 | - // GB18030 it treated as a special case of UTF-8, | ||
475 | - // above. GB2312 does not support these characters. | ||
476 | - // Other DBCS encodings will need to be added as they | ||
477 | - // are better understood. | ||
478 | - // | ||
479 | - return " "; | ||
480 | - } | ||
481 | -#endif | ||
482 | - } | ||
483 | - nox[0] = c; | ||
484 | - nox[1] = '\0'; | ||
485 | - return nox; | ||
486 | -} | ||
487 | -*/ | ||
488 | - | ||
489 | -/* | ||
490 | * Look up a multi-byte UTF-8 string and return its value in the 'implied' | 340 | * Look up a multi-byte UTF-8 string and return its value in the 'implied' |
491 | * character set. | 341 | * character set. |
492 | * Returns 0 if the lookup fails. | 342 | * Returns 0 if the lookup fails. |
@@ -496,42 +346,5 @@ unsigned char utf8_lookup(char *mbs, enum ulfail *fail, int *consumed) | @@ -496,42 +346,5 @@ unsigned char utf8_lookup(char *mbs, enum ulfail *fail, int *consumed) | ||
496 | if (fail != NULL) | 346 | if (fail != NULL) |
497 | *fail = ULFAIL_NOUTF8; | 347 | *fail = ULFAIL_NOUTF8; |
498 | 348 | ||
499 | -/* | ||
500 | - int i; | ||
501 | - int mblen = strlen(mbs); | ||
502 | - | ||
503 | - if (utf8_ix < 0) | ||
504 | - { | ||
505 | - if (fail != NULL) | ||
506 | - *fail = ULFAIL_NOUTF8; | ||
507 | - return 0; | ||
508 | - } | ||
509 | - | ||
510 | - for (i = 0; i < HI_SIZE; i++) | ||
511 | - { | ||
512 | - int tlen = strlen(utf8_tab[utf8_ix][i]); | ||
513 | - | ||
514 | - // Check for dummy " " entry. | ||
515 | - if (tlen == 1) | ||
516 | - continue; | ||
517 | - | ||
518 | - // Check for incomplete string. | ||
519 | - if (mblen < tlen) | ||
520 | - { | ||
521 | - if (fail != NULL) | ||
522 | - *fail = ULFAIL_INCOMPLETE; | ||
523 | - return 0; | ||
524 | - } | ||
525 | - | ||
526 | - if (!strncmp(mbs, utf8_tab[utf8_ix][i], tlen)) | ||
527 | - { | ||
528 | - if (consumed != NULL) | ||
529 | - *consumed = tlen; | ||
530 | - return 0xa0 + i; | ||
531 | - } | ||
532 | - } | ||
533 | - if (fail != NULL) | ||
534 | - *fail = ULFAIL_INVALID; | ||
535 | -*/ | ||
536 | return 0; | 349 | return 0; |
537 | } | 350 | } |