From 5990d83012bd5131e62947fbbd82008bfd27e913 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 17 May 2012 13:09:40 +0000 Subject: [PATCH] Corrigindo tratamento da tecla F10 --- api.h | 10 ---------- ft.c | 4 ++-- glue.c | 4 ++-- paste.c | 2 +- screenc.h | 15 --------------- utf8.c | 187 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 6 files changed, 5 insertions(+), 217 deletions(-) diff --git a/api.h b/api.h index 5b04c80..efa0afb 100644 --- a/api.h +++ b/api.h @@ -88,16 +88,6 @@ #define CN ((char *) NULL) #endif - /* Debug & log */ /* - #if defined( DEBUG ) - #define Trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); - #elif !defined(Trace) - #define Trace( fmt, ... ) // __VA_ARGS__ - #define trace( fmt, ... ) // __VA_ARGS__ - #endif -*/ - #include // #define WriteLog(module,fmt, ...) lib3270_write_log(NULL,module,fmt,__VA_ARGS__) diff --git a/ft.c b/ft.c index 89299d9..19f63de 100644 --- a/ft.c +++ b/ft.c @@ -207,7 +207,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); unsigned int flen; -// Trace("%s(%s)",__FUNCTION__,local); +// trace("%s(%s)",__FUNCTION__,local); if(!lib3270_connected(session)) { *msg = N_( "Disconnected from host" ); @@ -331,7 +331,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); return NULL; } - Trace("Command: \"%s\"",buffer); + trace("Command: \"%s\"",buffer); (void) lib3270_emulate_input(NULL, buffer, strlen(buffer), False); diff --git a/glue.c b/glue.c index b58b0ca..2260d28 100644 --- a/glue.c +++ b/glue.c @@ -119,7 +119,7 @@ static void initialize(void) #ifdef DEBUG init_calls++; - Trace("Initializing library (calls: %d)",init_calls); + trace("Initializing library (calls: %d)",init_calls); #endif h3270.selected = 0; @@ -130,7 +130,7 @@ static void initialize(void) (void) get_version_info(); #endif - Trace("%s (init_calls: %d)",__FUNCTION__,init_calls); + trace("%s (init_calls: %d)",__FUNCTION__,init_calls); /* Set the defaults. */ // appres.mono = False; diff --git a/paste.c b/paste.c index 2d26de0..518f0e5 100644 --- a/paste.c +++ b/paste.c @@ -155,7 +155,7 @@ if(BA_TO_ROW(session->cursor_addr) != data->row) { - Trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr)); + trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr)); if(!remargin(session,data->orig_col)) return 0; data->row = BA_TO_ROW(session->cursor_addr); diff --git a/screenc.h b/screenc.h index 87671a5..8ca4d2d 100644 --- a/screenc.h +++ b/screenc.h @@ -51,21 +51,6 @@ LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); LIB3270_INTERNAL Boolean escaped; -/* -LIB3270_INTERNAL void Escape_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -LIB3270_INTERNAL void Help_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -LIB3270_INTERNAL void Redraw_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -LIB3270_INTERNAL void Trace_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -LIB3270_INTERNAL void Show_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -*/ - -/* -#if defined(WC3270) -LIB3270_INTERNAL void Paste_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -LIB3270_INTERNAL void Title_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated)); -LIB3270_INTERNAL int windows_cp; -#endif -*/ LIB3270_INTERNAL void screen_title(char *text); diff --git a/utf8.c b/utf8.c index 44a691b..1cdc8f2 100644 --- a/utf8.c +++ b/utf8.c @@ -337,156 +337,6 @@ static char *utf8_tab[U_MAX][96] = { }; /* - * Save the codeset from the locale, and set globals based on known values. - */ /* -void -set_codeset(char *codeset_name) -{ - char *new_codeset; - -#if defined(X3270_DBCS) - is_gb18030 = !strcasecmp(codeset_name, "gb18030"); -#endif - -#if !defined(TCL3270) - is_utf8 = (!strcasecmp(codeset_name, "utf-8") || - !strcasecmp(codeset_name, "utf8") || - !strcasecmp(codeset_name, "utf_8")); -#else - // - // tcl3270 is always in UTF-8 mode, because it needs to - // supply UTF-8 strings to libtcl. - // - is_utf8 = 1; -#endif - - Trace("%s locale_codeset: %p new_codeset: %p (%s)",__FUNCTION__,locale_codeset,codeset_name,codeset_name); - new_codeset = NewString(codeset_name); - Replace(locale_codeset, new_codeset); - Trace("%s",__FUNCTION__); -} -*/ - -/* - * Set globals based on an x3270 character set list. - * - * This defines the 'implied' 8-bit character set for code points 0xa0..0xff, - * used by utf8_expand() below. - * - * set_codeset, above, must be called _before_ this function. - */ /* -Boolean -utf8_set_display_charsets(char *cslist, char *csname) -{ - char *dup; - char *ptr; - char *tok; - int i; - - utf8_ix = -1; - -#if defined(X3270_DBCS) - if (strchr(cslist, '+') != CN) - dbcs = True; -#endif - - if (!is_utf8) { -#if defined(X3270_DBCS) - if (is_gb18030) { - // - // A convenient lie. - // If the locale is GB18030, use the UTF-8 - // expansion mechanism to translate 0xa0 through - // 0xff, using a table entry that expands to GB18030 - // multi-byte sequences rather than UTF-8. - // - // Note that there appears to be a bug in ncursesw - // (or something it depends on) that turns these - // characters into garbage. Hopefully this bug will - // be fixed and this code will start working properly. - // - // As a workarond, everything works properly in a - // Chinese UTF-8 locale. - // - utf8_ix = PSEUDO_GB18030; - } -#endif - return True; - } - -#if defined(X3270_DBCS) - // For DBCS, map 0xa0..0xff as Latin-1. - if (dbcs) { - utf8_ix = U_ISO8859_1; - return True; - } -#endif - - // Skip 3270cg sets. - ptr = dup = NewString(cslist); - while ((tok = strtok(ptr, ",")) != CN) { - ptr = NULL; - if (!strncasecmp(tok, "3270cg", 6)) - continue; - break; - } - if (tok == CN) { - popup_an_error(NULL,"Invalid displayCharset specification"); - lib3270_free(dup); - return False; - } - - // Look up the charset. - for (i = 0; dcs[i] != CN; i++) { - if (!strcasecmp(dcs[i], tok)) - break; - } - if (dcs[i] == CN) { - popup_an_error(NULL,"Unknown displayCharset specification '%s'", - csname); - lib3270_free(dup); - return False; - } - utf8_ix = i; - lib3270_free(dup); - return True; -} -*/ -/* Expand an 8-bit character in the 'implied' character set. */ -/* -char * utf8_expand(unsigned char c) -{ - static char nox[2]; - - if (c & 0x80) - { - if (utf8_ix >= 0) - { - if (c >= 0xa0) - return utf8_tab[utf8_ix][c - 0xa0]; - else - return " "; - } -#if defined(X3270_DBCS) - else if (dbcs) - { - // - // GB18030 it treated as a special case of UTF-8, - // above. GB2312 does not support these characters. - // Other DBCS encodings will need to be added as they - // are better understood. - // - return " "; - } -#endif - } - nox[0] = c; - nox[1] = '\0'; - return nox; -} -*/ - -/* * Look up a multi-byte UTF-8 string and return its value in the 'implied' * character set. * Returns 0 if the lookup fails. @@ -496,42 +346,5 @@ unsigned char utf8_lookup(char *mbs, enum ulfail *fail, int *consumed) if (fail != NULL) *fail = ULFAIL_NOUTF8; -/* - int i; - int mblen = strlen(mbs); - - if (utf8_ix < 0) - { - if (fail != NULL) - *fail = ULFAIL_NOUTF8; - return 0; - } - - for (i = 0; i < HI_SIZE; i++) - { - int tlen = strlen(utf8_tab[utf8_ix][i]); - - // Check for dummy " " entry. - if (tlen == 1) - continue; - - // Check for incomplete string. - if (mblen < tlen) - { - if (fail != NULL) - *fail = ULFAIL_INCOMPLETE; - return 0; - } - - if (!strncmp(mbs, utf8_tab[utf8_ix][i], tlen)) - { - if (consumed != NULL) - *consumed = tlen; - return 0xa0 + i; - } - } - if (fail != NULL) - *fail = ULFAIL_INVALID; -*/ return 0; } -- libgit2 0.21.2