Commit 2a0b0d588d8f952dfbc52b124c7ec5acf75d656f

Authored by perry.werneck@gmail.com
1 parent 1f1de3e1

Implementando redesenho pela biblioteca ao mudar o toggle "monocase", incluindo …

…gravação no log quando a lib pede por "resources"
src/lib3270/api.h
... ... @@ -90,8 +90,7 @@
90 90  
91 91 /* Debug & log */
92 92 #if defined( DEBUG )
93   - #define Trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); \
94   - WriteLog("TRACE", "%s(%d) " fmt , __FILE__, __LINE__, __VA_ARGS__ )
  93 + #define Trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr);
95 94 #else
96 95 #define Trace( fmt, ... ) /* __VA_ARGS__ */
97 96 #endif
... ...
src/lib3270/appres.h
... ... @@ -143,7 +143,7 @@ typedef struct {
143 143 #endif /*]*/
144 144 char *conf_dir;
145 145 char *model;
146   - char *hostsfile;
  146 +// char *hostsfile;
147 147 char *port;
148 148 char *charset;
149 149 char *termname;
... ... @@ -156,9 +156,12 @@ typedef struct {
156 156 char *trace_file;
157 157 char *screentrace_file;
158 158 char *trace_file_size;
159   -#if defined(X3270_DISPLAY) || defined(WC3270) /*[*/
  159 +/*
  160 +#if defined(X3270_DISPLAY) || defined(WC3270)
160 161 char trace_monitor;
161   -#endif /*]*/
  162 +#endif
  163 +*/
  164 +
162 165 #endif /*]*/
163 166 char *oversize;
164 167 #if defined(X3270_FT) /*[*/
... ... @@ -169,9 +172,13 @@ typedef struct {
169 172 char *idle_command;
170 173 char idle_command_enabled;
171 174 char *idle_timeout;
172   -#if defined(X3270_SCRIPT) /*[*/
  175 +
  176 +/*
  177 +#if defined(X3270_SCRIPT)
173 178 char *plugin_command;
174   -#endif /*]*/
  179 +#endif
  180 +*/
  181 +
175 182 #if defined(HAVE_LIBSSL) /*[*/
176 183 char *cert_file;
177 184 #endif /*]*/
... ... @@ -206,14 +213,18 @@ typedef struct {
206 213 char *hostname;
207 214 #endif
208 215  
209   -#if defined(WC3270) /*[*/
  216 +/*
  217 +#if defined(WC3270)
210 218 char *title;
211   -#endif /*]*/
  219 +#endif
  220 +*/
212 221  
213   -#if defined(USE_APP_DEFAULTS) /*[*/
214   - /* App-defaults version */
  222 +/*
  223 +#if defined(USE_APP_DEFAULTS)
  224 + // App-defaults version
215 225 char *ad_version;
216   -#endif /*]*/
  226 +#endif
  227 +*/
217 228  
218 229 } AppRes, *AppResptr;
219 230  
... ...
src/lib3270/glue.c
... ... @@ -357,7 +357,7 @@ static void initialize(void)
357 357 #endif /*]*/
358 358  
359 359 appres.model = "";
360   - appres.hostsfile = CN;
  360 +// appres.hostsfile = CN;
361 361 appres.port = "telnet";
362 362  
363 363 #if !defined(_WIN32) /*[*/
... ... @@ -490,7 +490,7 @@ static const struct lib3270_option options[] =
490 490 #if defined(X3270_TRACE) /*[*/
491 491 { OptDsTrace, OPT_BOOLEAN, True, ResDsTrace, toggle_offset(DS_TRACE), NULL },
492 492 #endif /*]*/
493   - { OptHostsFile,OPT_STRING, False, ResHostsFile, offset(hostsfile), NULL },
  493 +// { OptHostsFile,OPT_STRING, False, ResHostsFile, offset(hostsfile), NULL },
494 494 //#if defined(C3270)
495 495 // { OptKeymap, OPT_STRING, False, ResKeymap, offset(key_map), N_( "Specifies a keymap name and optional modifiers." ) },
496 496 // #endif
... ... @@ -647,7 +647,7 @@ static struct {
647 647 #if defined(WC3270) /*[*/
648 648 { "hostname", offset(hostname), XRM_STRING },
649 649 #endif /*]*/
650   - { ResHostsFile, offset(hostsfile), XRM_STRING },
  650 +// { ResHostsFile, offset(hostsfile), XRM_STRING },
651 651 #if defined(X3270_ANSI) /*[*/
652 652 { ResIcrnl, offset(icrnl), XRM_BOOLEAN },
653 653 { ResInlcr, offset(inlcr), XRM_BOOLEAN },
... ...
src/lib3270/resources.c
... ... @@ -125,30 +125,39 @@ add_resource(const char *name, char *value)
125 125 drdb_next = &d->next;
126 126 }
127 127  
128   -char *
129   -get_resource(const char *name)
  128 +const char * get_resource(const char *name)
130 129 {
131 130 struct dresource *d;
132 131 int i;
133 132  
134   - for (d = drdb; d != NULL; d = d->next) {
135   - if (!strcmp(d->name, name)) {
  133 + for (d = drdb; d != NULL; d = d->next)
  134 + {
  135 + if (!strcmp(d->name, name))
  136 + {
  137 + lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,d->value);
136 138 return d->value;
137 139 }
138 140 }
139 141  
140   - for (i = 0; fallbacks[i] != NULL; i++) {
141   - if (!strncmp(fallbacks[i], name, strlen(name)) &&
142   - *(fallbacks[i] + strlen(name)) == ':') {
143   - return fallbacks[i] + strlen(name) + 2;
  142 + for (i = 0; fallbacks[i] != NULL; i++)
  143 + {
  144 + if (!strncmp(fallbacks[i], name, strlen(name)) && *(fallbacks[i] + strlen(name)) == ':')
  145 + {
  146 + const char *ret = fallbacks[i] + strlen(name) + 2;
  147 + lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,ret);
  148 + return ret;
144 149 }
145 150 }
146   -#if defined(C3270) /*[*/
147   - for (i = 0; rdb[i].name != (char *)NULL; i++) {
148   - if (!strcmp(rdb[i].name, name)) {
  151 +
  152 +#if defined(C3270)
  153 + for (i = 0; rdb[i].name != (char *)NULL; i++)
  154 + {
  155 + if (!strcmp(rdb[i].name, name))
  156 + {
  157 + lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,rdb[i].value);
149 158 return rdb[i].value;
150 159 }
151 160 }
152   -#endif /*]*/
  161 +#endif
153 162 return NULL;
154 163 }
... ...
src/lib3270/screen.c
... ... @@ -45,9 +45,7 @@
45 45 #include "actionsc.h"
46 46 #include "ctlrc.h"
47 47 #include "hostc.h"
48   -// #include "keymapc.h"
49 48 #include "kybdc.h"
50   -// #include "macrosc.h"
51 49 #include "screenc.h"
52 50 #include "tablesc.h"
53 51 #include "trace_dsc.h"
... ... @@ -329,7 +327,7 @@ static void screen_update(H3270 *session, int bstart, int bend)
329 327 a = color_from_fa(fa);
330 328 fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay
331 329  
332   - Trace("%s ea_buf=%p",__FUNCTION__,ea_buf);
  330 +// Trace("%s ea_buf=%p",__FUNCTION__,ea_buf);
333 331  
334 332 for(baddr = bstart; baddr < bend; baddr++)
335 333 {
... ...
src/lib3270/toggles.c
... ... @@ -142,6 +142,11 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix)
142 142 return 0;
143 143 }
144 144  
  145 +static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt)
  146 +{
  147 + screen_disp(session);
  148 +}
  149 +
145 150 /*
146 151 * Called from system initialization code to handle initial toggle settings.
147 152 */
... ... @@ -155,7 +160,8 @@ void initialize_toggles(H3270 *session, struct toggle *toggle)
155 160 toggle[f].upcall = toggle_nop;
156 161 }
157 162  
158   - toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect;
  163 + toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect;
  164 + toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase;
159 165  
160 166 #if defined(X3270_TRACE)
161 167 toggle[DS_TRACE].upcall = toggle_dsTrace;
... ...