Commit 80332fed862e53eb0b1337889675dd7a20efe91d
1 parent
0188a99b
Exists in
master
and in
3 other branches
Corrigindo indicador de insert, movendo toggles para a estrutura de controle de sessao
Showing
13 changed files
with
105 additions
and
125 deletions
Show diff stats
ansi.c
@@ -1825,7 +1825,7 @@ ansi_send_pa(int nn) | @@ -1825,7 +1825,7 @@ ansi_send_pa(int nn) | ||
1825 | net_sends(fn_buf); | 1825 | net_sends(fn_buf); |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | -void toggle_lineWrap(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE type unused) | 1828 | +void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused) |
1829 | { | 1829 | { |
1830 | if (toggled(LIB3270_TOGGLE_LINE_WRAP)) | 1830 | if (toggled(LIB3270_TOGGLE_LINE_WRAP)) |
1831 | wraparound_mode = 1; | 1831 | wraparound_mode = 1; |
ansic.h
@@ -29,7 +29,7 @@ LIB3270_INTERNAL void ansi_send_pa(int nn); | @@ -29,7 +29,7 @@ LIB3270_INTERNAL void ansi_send_pa(int nn); | ||
29 | LIB3270_INTERNAL void ansi_send_pf(int nn); | 29 | LIB3270_INTERNAL void ansi_send_pf(int nn); |
30 | LIB3270_INTERNAL void ansi_send_right(void); | 30 | LIB3270_INTERNAL void ansi_send_right(void); |
31 | LIB3270_INTERNAL void ansi_send_up(void); | 31 | LIB3270_INTERNAL void ansi_send_up(void); |
32 | -LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE type); | 32 | +LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type); |
33 | 33 | ||
34 | #else /*][*/ | 34 | #else /*][*/ |
35 | 35 |
appres.h
@@ -24,18 +24,21 @@ | @@ -24,18 +24,21 @@ | ||
24 | 24 | ||
25 | /* Toggles */ | 25 | /* Toggles */ |
26 | 26 | ||
27 | +/* | ||
27 | struct toggle { | 28 | struct toggle { |
28 | - char value; /* toggle value */ | ||
29 | -// char changed; /* has the value changed since init */ | ||
30 | -// Widget w[2]; /* the menu item widgets */ | ||
31 | -// const char *label[2]; /* labels */ | ||
32 | - void (*upcall)(H3270 *, struct toggle *, LIB3270_TOGGLE_TYPE); /* change value */ | 29 | + char value; // toggle value |
30 | +// char changed; // has the value changed since init | ||
31 | +// Widget w[2]; // the menu item widgets | ||
32 | +// const char *label[2]; // labels | ||
33 | + void (*upcall)(H3270 *, struct toggle *, LIB3270_TOGGLE_TYPE); // change value | ||
33 | // void (*callback)(H3270 *, int, LIB3270_TOGGLE_TYPE); | 34 | // void (*callback)(H3270 *, int, LIB3270_TOGGLE_TYPE); |
34 | 35 | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | -#define toggled(ix) (appres.toggle[ix].value) | ||
38 | // #define toggle_toggle(t) { (t)->value = !(t)->value; } | 38 | // #define toggle_toggle(t) { (t)->value = !(t)->value; } |
39 | +*/ | ||
40 | + | ||
41 | +#define toggled(ix) lib3270_get_toggle(NULL,ix) | ||
39 | 42 | ||
40 | /* Application resources */ | 43 | /* Application resources */ |
41 | 44 | ||
@@ -184,7 +187,7 @@ typedef struct { | @@ -184,7 +187,7 @@ typedef struct { | ||
184 | char *proxy; | 187 | char *proxy; |
185 | 188 | ||
186 | /* Toggles */ | 189 | /* Toggles */ |
187 | - struct toggle toggle[N_TOGGLES]; | 190 | +// struct toggle toggle[N_TOGGLES]; |
188 | /* | 191 | /* |
189 | #if defined(X3270_DISPLAY) | 192 | #if defined(X3270_DISPLAY) |
190 | // Simple widget resources | 193 | // Simple widget resources |
@@ -234,4 +237,4 @@ extern AppRes appres; | @@ -234,4 +237,4 @@ extern AppRes appres; | ||
234 | #define N_( x ) x | 237 | #define N_( x ) x |
235 | #define MSG_( c, s ) s | 238 | #define MSG_( c, s ) s |
236 | 239 | ||
237 | -void toggle_rectselect(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | 240 | +void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); |
ctlr.c
@@ -2798,30 +2798,9 @@ static void ticking_stop(H3270 *session) | @@ -2798,30 +2798,9 @@ static void ticking_stop(H3270 *session) | ||
2798 | } | 2798 | } |
2799 | 2799 | ||
2800 | /* | 2800 | /* |
2801 | -void toggle_showTiming(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) | ||
2802 | -{ | ||
2803 | - if (!toggled(SHOW_TIMING)) | ||
2804 | - status_untiming(&h3270); | ||
2805 | -} | ||
2806 | -*/ | ||
2807 | - | ||
2808 | - | ||
2809 | -/* | ||
2810 | * No-op toggle. | 2801 | * No-op toggle. |
2811 | */ | 2802 | */ |
2812 | -void | ||
2813 | -toggle_nop(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) | 2803 | +void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) |
2814 | { | 2804 | { |
2815 | } | 2805 | } |
2816 | 2806 | ||
2817 | -/* | ||
2818 | -int ctlr_get_rows(void) | ||
2819 | -{ | ||
2820 | - return h3270.rows; | ||
2821 | -} | ||
2822 | - | ||
2823 | -int ctlr_get_cols(void) | ||
2824 | -{ | ||
2825 | - return h3270.cols; | ||
2826 | -} | ||
2827 | -*/ |
ctlrc.h
@@ -62,18 +62,18 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov | @@ -62,18 +62,18 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov | ||
62 | LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); | 62 | LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); |
63 | 63 | ||
64 | LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); | 64 | LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); |
65 | -LIB3270_INTERNAL void toggle_nop(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | ||
66 | -LIB3270_INTERNAL void toggle_showTiming(struct toggle *t, LIB3270_TOGGLE_TYPE tt); | 65 | +LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); |
66 | +LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); | ||
67 | 67 | ||
68 | enum dbcs_state { | 68 | enum dbcs_state { |
69 | DBCS_NONE = 0, /* position is not DBCS */ | 69 | DBCS_NONE = 0, /* position is not DBCS */ |
70 | - DBCS_LEFT, /* position is left half of DBCS character */ | ||
71 | - DBCS_RIGHT, /* position is right half of DBCS character */ | ||
72 | - DBCS_SI, /* position is SI terminating DBCS subfield */ | ||
73 | - DBCS_SB, /* position is SBCS character after the SI */ | 70 | + DBCS_LEFT, /* position is left half of DBCS character */ |
71 | + DBCS_RIGHT, /* position is right half of DBCS character */ | ||
72 | + DBCS_SI, /* position is SI terminating DBCS subfield */ | ||
73 | + DBCS_SB, /* position is SBCS character after the SI */ | ||
74 | DBCS_LEFT_WRAP, /* position is left half of split DBCS */ | 74 | DBCS_LEFT_WRAP, /* position is left half of split DBCS */ |
75 | DBCS_RIGHT_WRAP, /* position is right half of split DBCS */ | 75 | DBCS_RIGHT_WRAP, /* position is right half of split DBCS */ |
76 | - DBCS_DEAD /* position is dead left-half DBCS */ | 76 | + DBCS_DEAD /* position is dead left-half DBCS */ |
77 | }; | 77 | }; |
78 | #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP) | 78 | #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP) |
79 | #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP) | 79 | #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP) |
glue.c
@@ -127,7 +127,7 @@ static void initialize(void) | @@ -127,7 +127,7 @@ static void initialize(void) | ||
127 | 127 | ||
128 | h3270.selected = 0; | 128 | h3270.selected = 0; |
129 | h3270.select.begin = h3270.select.end = 0; | 129 | h3270.select.begin = h3270.select.end = 0; |
130 | - initialize_toggles(&h3270,appres.toggle); | 130 | +// initialize_toggles(&h3270); |
131 | 131 | ||
132 | #if defined(_WIN32) | 132 | #if defined(_WIN32) |
133 | (void) get_version_info(); | 133 | (void) get_version_info(); |
@@ -148,11 +148,13 @@ static void initialize(void) | @@ -148,11 +148,13 @@ static void initialize(void) | ||
148 | appres.modified_sel = False; | 148 | appres.modified_sel = False; |
149 | appres.apl_mode = False; | 149 | appres.apl_mode = False; |
150 | 150 | ||
151 | -#if defined(C3270) || defined(TCL3270) /*[*/ | ||
152 | -// appres.scripted = False; | ||
153 | -#else /*][*/ | 151 | +/* |
152 | +#if defined(C3270) || defined(TCL3270) | ||
153 | + appres.scripted = False; | ||
154 | +#else | ||
154 | appres.scripted = True; | 155 | appres.scripted = True; |
155 | -#endif /*]*/ | 156 | +#endif |
157 | +*/ | ||
156 | 158 | ||
157 | appres.numeric_lock = False; | 159 | appres.numeric_lock = False; |
158 | // appres.secure = False; | 160 | // appres.secure = False; |
@@ -193,9 +195,11 @@ static void initialize(void) | @@ -193,9 +195,11 @@ static void initialize(void) | ||
193 | appres.trace_dir = "/tmp"; | 195 | appres.trace_dir = "/tmp"; |
194 | #endif /*]*/ | 196 | #endif /*]*/ |
195 | 197 | ||
196 | -#if defined(X3270_DISPLAY) || defined(WC3270) /*[*/ | 198 | +/* |
199 | +#if defined(X3270_DISPLAY) || defined(WC3270) | ||
197 | appres.trace_monitor = True; | 200 | appres.trace_monitor = True; |
198 | -#endif /*]*/ | 201 | +#endif |
202 | +*/ | ||
199 | 203 | ||
200 | #endif /*]*/ | 204 | #endif /*]*/ |
201 | 205 | ||
@@ -227,17 +231,23 @@ static void initialize(void) | @@ -227,17 +231,23 @@ static void initialize(void) | ||
227 | appres.dft_buffer_size = DFT_BUF; | 231 | appres.dft_buffer_size = DFT_BUF; |
228 | #endif /*]*/ | 232 | #endif /*]*/ |
229 | 233 | ||
230 | -#if defined(C3270) && !defined(LIB3270) /*[*/ | 234 | +/* |
235 | +#if defined(C3270) && !defined(LIB3270) | ||
231 | appres.toggle[CURSOR_POS].value = True; | 236 | appres.toggle[CURSOR_POS].value = True; |
232 | -#endif /*]*/ | 237 | +#endif |
238 | +*/ | ||
233 | 239 | ||
234 | -#if defined(X3270_SCRIPT) || defined(TCL3270) /*[*/ | 240 | +/* |
241 | +#if defined(X3270_SCRIPT) || defined(TCL3270) | ||
235 | appres.toggle[AID_WAIT].value = True; | 242 | appres.toggle[AID_WAIT].value = True; |
236 | -#endif /*]*/ | 243 | +#endif |
244 | +*/ | ||
237 | 245 | ||
238 | -#if defined(C3270) && defined(X3270_SCRIPT) /*[*/ | 246 | +/* |
247 | +#if defined(C3270) && defined(X3270_SCRIPT) | ||
239 | appres.plugin_command = "x3270hist.pl"; | 248 | appres.plugin_command = "x3270hist.pl"; |
240 | -#endif /*]*/ | 249 | +#endif |
250 | +*/ | ||
241 | 251 | ||
242 | #if defined(C3270) && defined(_WIN32) /*[*/ | 252 | #if defined(C3270) && defined(_WIN32) /*[*/ |
243 | appres.highlight_underline = True; | 253 | appres.highlight_underline = True; |
init.c
@@ -49,7 +49,7 @@ void lib3270_session_free(H3270 *h) | @@ -49,7 +49,7 @@ void lib3270_session_free(H3270 *h) | ||
49 | if(lib3270_connected(h)) | 49 | if(lib3270_connected(h)) |
50 | lib3270_disconnect(h); | 50 | lib3270_disconnect(h); |
51 | 51 | ||
52 | - shutdown_toggles(h,appres.toggle); | 52 | + shutdown_toggles(h); |
53 | 53 | ||
54 | // Release state change callbacks | 54 | // Release state change callbacks |
55 | for(f=0;f<N_ST;f++) | 55 | for(f=0;f<N_ST;f++) |
@@ -112,6 +112,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -112,6 +112,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
112 | memset(hSession,0,sizeof(H3270)); | 112 | memset(hSession,0,sizeof(H3270)); |
113 | hSession->sz = sizeof(H3270); | 113 | hSession->sz = sizeof(H3270); |
114 | 114 | ||
115 | + // Initialize toggles | ||
116 | + initialize_toggles(hSession); | ||
117 | + | ||
115 | // Dummy calls to avoid "ifs" | 118 | // Dummy calls to avoid "ifs" |
116 | hSession->update = update_char; | 119 | hSession->update = update_char; |
117 | hSession->update_model = update_model; | 120 | hSession->update_model = update_model; |
kybd.c
@@ -2274,11 +2274,11 @@ LIB3270_ACTION( dup ) | @@ -2274,11 +2274,11 @@ LIB3270_ACTION( dup ) | ||
2274 | if (kybdlock) | 2274 | if (kybdlock) |
2275 | { | 2275 | { |
2276 | ENQUEUE_ACTION(lib3270_enter); | 2276 | ENQUEUE_ACTION(lib3270_enter); |
2277 | - return; | 2277 | + return 0; |
2278 | } | 2278 | } |
2279 | #if defined(X3270_ANSI) | 2279 | #if defined(X3270_ANSI) |
2280 | if (IN_ANSI) | 2280 | if (IN_ANSI) |
2281 | - return; | 2281 | + return 0; |
2282 | #endif | 2282 | #endif |
2283 | if (key_Character(EBC_dup, False, False, NULL)) | 2283 | if (key_Character(EBC_dup, False, False, NULL)) |
2284 | cursor_move(next_unprotected(hSession->cursor_addr)); | 2284 | cursor_move(next_unprotected(hSession->cursor_addr)); |
lib3270.cbp
@@ -7,8 +7,8 @@ | @@ -7,8 +7,8 @@ | ||
7 | <Option compiler="gcc" /> | 7 | <Option compiler="gcc" /> |
8 | <Build> | 8 | <Build> |
9 | <Target title="Debug"> | 9 | <Target title="Debug"> |
10 | - <Option output=".bin\Debug\lib3270" prefix_auto="1" extension_auto="1" /> | ||
11 | - <Option object_output=".obj\Debug\" /> | 10 | + <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" /> |
11 | + <Option object_output=".obj/Debug/" /> | ||
12 | <Option type="1" /> | 12 | <Option type="1" /> |
13 | <Option compiler="gcc" /> | 13 | <Option compiler="gcc" /> |
14 | <Option use_console_runner="0" /> | 14 | <Option use_console_runner="0" /> |
@@ -21,8 +21,8 @@ | @@ -21,8 +21,8 @@ | ||
21 | </Linker> | 21 | </Linker> |
22 | </Target> | 22 | </Target> |
23 | <Target title="Release"> | 23 | <Target title="Release"> |
24 | - <Option output=".bin\Release\lib3270" prefix_auto="1" extension_auto="1" /> | ||
25 | - <Option object_output=".obj\Release\" /> | 24 | + <Option output=".bin/Release/lib3270" prefix_auto="1" extension_auto="1" /> |
25 | + <Option object_output=".obj/Release/" /> | ||
26 | <Option type="3" /> | 26 | <Option type="3" /> |
27 | <Option compiler="gcc" /> | 27 | <Option compiler="gcc" /> |
28 | <Option createDefFile="1" /> | 28 | <Option createDefFile="1" /> |
@@ -35,8 +35,8 @@ | @@ -35,8 +35,8 @@ | ||
35 | </Linker> | 35 | </Linker> |
36 | </Target> | 36 | </Target> |
37 | <Target title="testprogram"> | 37 | <Target title="testprogram"> |
38 | - <Option output=".bin\Debug\lib3270" prefix_auto="1" extension_auto="1" /> | ||
39 | - <Option object_output=".obj\testprogram\" /> | 38 | + <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" /> |
39 | + <Option object_output=".obj/testprogram/" /> | ||
40 | <Option type="1" /> | 40 | <Option type="1" /> |
41 | <Option compiler="gcc" /> | 41 | <Option compiler="gcc" /> |
42 | <Option use_console_runner="0" /> | 42 | <Option use_console_runner="0" /> |
@@ -53,18 +53,18 @@ | @@ -53,18 +53,18 @@ | ||
53 | <Add option="-Wmissing-declarations" /> | 53 | <Add option="-Wmissing-declarations" /> |
54 | <Add option="-Wall" /> | 54 | <Add option="-Wall" /> |
55 | <Add option="-DLIB3270=1" /> | 55 | <Add option="-DLIB3270=1" /> |
56 | - <Add directory="..\include" /> | ||
57 | - <Add directory="..\include\lib3270" /> | 56 | + <Add directory="../include" /> |
57 | + <Add directory="../include/lib3270" /> | ||
58 | </Compiler> | 58 | </Compiler> |
59 | - <Unit filename="..\include\lib3270.h" /> | ||
60 | - <Unit filename="..\include\lib3270\action_table.h" /> | ||
61 | - <Unit filename="..\include\lib3270\actions.h" /> | ||
62 | - <Unit filename="..\include\lib3270\config.h.in" /> | ||
63 | - <Unit filename="..\include\lib3270\log.h" /> | ||
64 | - <Unit filename="..\include\lib3270\macros.h" /> | ||
65 | - <Unit filename="..\include\lib3270\popup.h" /> | ||
66 | - <Unit filename="..\include\lib3270\selection.h" /> | ||
67 | - <Unit filename="..\include\lib3270\session.h" /> | 59 | + <Unit filename="../include/lib3270.h" /> |
60 | + <Unit filename="../include/lib3270/action_table.h" /> | ||
61 | + <Unit filename="../include/lib3270/actions.h" /> | ||
62 | + <Unit filename="../include/lib3270/config.h.in" /> | ||
63 | + <Unit filename="../include/lib3270/log.h" /> | ||
64 | + <Unit filename="../include/lib3270/macros.h" /> | ||
65 | + <Unit filename="../include/lib3270/popup.h" /> | ||
66 | + <Unit filename="../include/lib3270/selection.h" /> | ||
67 | + <Unit filename="../include/lib3270/session.h" /> | ||
68 | <Unit filename="3270ds.h" /> | 68 | <Unit filename="3270ds.h" /> |
69 | <Unit filename="Makefile.in" /> | 69 | <Unit filename="Makefile.in" /> |
70 | <Unit filename="X11keysym.h" /> | 70 | <Unit filename="X11keysym.h" /> |
@@ -125,6 +125,9 @@ | @@ -125,6 +125,9 @@ | ||
125 | </Unit> | 125 | </Unit> |
126 | <Unit filename="hostc.h" /> | 126 | <Unit filename="hostc.h" /> |
127 | <Unit filename="icmdc.h" /> | 127 | <Unit filename="icmdc.h" /> |
128 | + <Unit filename="init.c"> | ||
129 | + <Option compilerVar="CC" /> | ||
130 | + </Unit> | ||
128 | <Unit filename="keypadc.h" /> | 131 | <Unit filename="keypadc.h" /> |
129 | <Unit filename="kybd.c"> | 132 | <Unit filename="kybd.c"> |
130 | <Option compilerVar="CC" /> | 133 | <Option compilerVar="CC" /> |
paste.c
@@ -81,6 +81,7 @@ | @@ -81,6 +81,7 @@ | ||
81 | #include "api.h" | 81 | #include "api.h" |
82 | 82 | ||
83 | #include <lib3270/popup.h> | 83 | #include <lib3270/popup.h> |
84 | +#include <lib3270/selection.h> | ||
84 | 85 | ||
85 | /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ | 86 | /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ |
86 | 87 | ||
@@ -234,7 +235,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | @@ -234,7 +235,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | ||
234 | return data.qtd; | 235 | return data.qtd; |
235 | } | 236 | } |
236 | 237 | ||
237 | -LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) | 238 | +LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str) |
238 | { | 239 | { |
239 | int sz; | 240 | int sz; |
240 | CHECK_SESSION_HANDLE(h); | 241 | CHECK_SESSION_HANDLE(h); |
@@ -262,9 +263,9 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) | @@ -262,9 +263,9 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) | ||
262 | return 0; | 263 | return 0; |
263 | } | 264 | } |
264 | 265 | ||
265 | - if(strlen(str) > sz) | 266 | + if(strlen((char *) str) > sz) |
266 | { | 267 | { |
267 | - h->paste_buffer = strdup(str+sz); | 268 | + h->paste_buffer = strdup((char *) (str+sz)); |
268 | return 1; | 269 | return 1; |
269 | } | 270 | } |
270 | 271 | ||
@@ -287,7 +288,7 @@ LIB3270_EXPORT int lib3270_pastenext(H3270 *h) | @@ -287,7 +288,7 @@ LIB3270_EXPORT int lib3270_pastenext(H3270 *h) | ||
287 | ptr = h->paste_buffer; | 288 | ptr = h->paste_buffer; |
288 | h->paste_buffer = NULL; | 289 | h->paste_buffer = NULL; |
289 | 290 | ||
290 | - rc = lib3270_paste(h,ptr); | 291 | + rc = lib3270_paste(h,(unsigned char *) ptr); |
291 | 292 | ||
292 | free(ptr); | 293 | free(ptr); |
293 | return rc; | 294 | return rc; |
selection.c
@@ -34,6 +34,8 @@ | @@ -34,6 +34,8 @@ | ||
34 | #include <lib3270/session.h> | 34 | #include <lib3270/session.h> |
35 | #include <lib3270/selection.h> | 35 | #include <lib3270/selection.h> |
36 | 36 | ||
37 | + static void update_selection(H3270 *session); | ||
38 | + | ||
37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 39 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
38 | 40 | ||
39 | static void get_selected_addr(H3270 *session, int *begin, int *end) | 41 | static void get_selected_addr(H3270 *session, int *begin, int *end) |
@@ -156,7 +158,7 @@ static void set_selected(H3270 *session) | @@ -156,7 +158,7 @@ static void set_selected(H3270 *session) | ||
156 | session->set_selection(session,1); | 158 | session->set_selection(session,1); |
157 | } | 159 | } |
158 | 160 | ||
159 | -void toggle_rectselect(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt) | 161 | +void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) |
160 | { | 162 | { |
161 | if(!session->selected) | 163 | if(!session->selected) |
162 | return; | 164 | return; |
@@ -303,7 +305,7 @@ LIB3270_ACTION( reselect ) | @@ -303,7 +305,7 @@ LIB3270_ACTION( reselect ) | ||
303 | CHECK_SESSION_HANDLE(hSession); | 305 | CHECK_SESSION_HANDLE(hSession); |
304 | 306 | ||
305 | if(!lib3270_connected(hSession) || hSession->select.begin == hSession->select.end || hSession->selected) | 307 | if(!lib3270_connected(hSession) || hSession->select.begin == hSession->select.end || hSession->selected) |
306 | - return; | 308 | + return 0; |
307 | 309 | ||
308 | update_selection(hSession); | 310 | update_selection(hSession); |
309 | set_selected(hSession); | 311 | set_selected(hSession); |
toggles.c
@@ -74,8 +74,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] = | @@ -74,8 +74,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] = | ||
74 | "keepselected", | 74 | "keepselected", |
75 | "underline", | 75 | "underline", |
76 | "autoconnect", | 76 | "autoconnect", |
77 | - "kpalternative", /**< Keypad +/- move to next/previous field */ | ||
78 | - "beep", /**< Beep on errors */ | 77 | + "kpalternative", /**< Keypad +/- move to next/previous field */ |
78 | + "beep", /**< Beep on errors */ | ||
79 | }; | 79 | }; |
80 | 80 | ||
81 | LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) | 81 | LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) |
@@ -84,14 +84,15 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE i | @@ -84,14 +84,15 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE i | ||
84 | 84 | ||
85 | if(ix < 0 || ix >= N_TOGGLES) | 85 | if(ix < 0 || ix >= N_TOGGLES) |
86 | return 0; | 86 | return 0; |
87 | - return (unsigned char) appres.toggle[ix].value != 0; | 87 | + return (unsigned char) session->toggle[ix].value != 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * Call the internal update routine | 91 | * Call the internal update routine |
92 | */ | 92 | */ |
93 | -static void toggle_notify(H3270 *session, struct toggle *t, LIB3270_TOGGLE ix) | 93 | +static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE ix) |
94 | { | 94 | { |
95 | + Trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); | ||
95 | t->upcall(session, t, TT_INTERACTIVE); | 96 | t->upcall(session, t, TT_INTERACTIVE); |
96 | 97 | ||
97 | if(session->update_toggle) | 98 | if(session->update_toggle) |
@@ -101,15 +102,15 @@ static void toggle_notify(H3270 *session, struct toggle *t, LIB3270_TOGGLE ix) | @@ -101,15 +102,15 @@ static void toggle_notify(H3270 *session, struct toggle *t, LIB3270_TOGGLE ix) | ||
101 | 102 | ||
102 | LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value) | 103 | LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value) |
103 | { | 104 | { |
104 | - char v = value ? True : False; | ||
105 | - struct toggle * t; | 105 | + char v = value ? True : False; |
106 | + struct lib3270_toggle * t; | ||
106 | 107 | ||
107 | CHECK_SESSION_HANDLE(session); | 108 | CHECK_SESSION_HANDLE(session); |
108 | 109 | ||
109 | if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) | 110 | if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) |
110 | return; | 111 | return; |
111 | 112 | ||
112 | - t = &appres.toggle[ix]; | 113 | + t = &session->toggle[ix]; |
113 | 114 | ||
114 | if(v == t->value) | 115 | if(v == t->value) |
115 | return; | 116 | return; |
@@ -121,14 +122,14 @@ LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int va | @@ -121,14 +122,14 @@ LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int va | ||
121 | 122 | ||
122 | LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) | 123 | LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) |
123 | { | 124 | { |
124 | - struct toggle *t; | 125 | + struct lib3270_toggle *t; |
125 | 126 | ||
126 | CHECK_SESSION_HANDLE(session); | 127 | CHECK_SESSION_HANDLE(session); |
127 | 128 | ||
128 | if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) | 129 | if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) |
129 | return 0; | 130 | return 0; |
130 | 131 | ||
131 | - t = &appres.toggle[ix]; | 132 | + t = &session->toggle[ix]; |
132 | 133 | ||
133 | t->value = t->value ? False : True; | 134 | t->value = t->value ? False : True; |
134 | toggle_notify(session,t,ix); | 135 | toggle_notify(session,t,ix); |
@@ -136,7 +137,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) | @@ -136,7 +137,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) | ||
136 | return (int) t->value; | 137 | return (int) t->value; |
137 | } | 138 | } |
138 | 139 | ||
139 | -static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt) | 140 | +static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) |
140 | { | 141 | { |
141 | screen_disp(session); | 142 | screen_disp(session); |
142 | } | 143 | } |
@@ -144,24 +145,24 @@ static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYP | @@ -144,24 +145,24 @@ static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYP | ||
144 | /* | 145 | /* |
145 | * Called from system initialization code to handle initial toggle settings. | 146 | * Called from system initialization code to handle initial toggle settings. |
146 | */ | 147 | */ |
147 | -void initialize_toggles(H3270 *session, struct toggle *toggle) | 148 | +void initialize_toggles(H3270 *session) |
148 | { | 149 | { |
149 | int f; | 150 | int f; |
150 | 151 | ||
151 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) | 152 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) |
152 | - toggle[f].upcall = toggle_nop; | 153 | + session->toggle[f].upcall = toggle_nop; |
153 | 154 | ||
154 | - toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect; | ||
155 | - toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase; | 155 | + session->toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect; |
156 | + session->toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase; | ||
156 | 157 | ||
157 | #if defined(X3270_TRACE) | 158 | #if defined(X3270_TRACE) |
158 | - toggle[LIB3270_TOGGLE_DS_TRACE].upcall = toggle_dsTrace; | ||
159 | - toggle[LIB3270_TOGGLE_SCREEN_TRACE].upcall = toggle_screenTrace; | ||
160 | - toggle[LIB3270_TOGGLE_EVENT_TRACE].upcall = toggle_eventTrace; | 159 | + session->toggle[LIB3270_TOGGLE_DS_TRACE].upcall = toggle_dsTrace; |
160 | + session->toggle[LIB3270_TOGGLE_SCREEN_TRACE].upcall = toggle_screenTrace; | ||
161 | + session->toggle[LIB3270_TOGGLE_EVENT_TRACE].upcall = toggle_eventTrace; | ||
161 | #endif | 162 | #endif |
162 | 163 | ||
163 | #if defined(X3270_ANSI) | 164 | #if defined(X3270_ANSI) |
164 | - toggle[LIB3270_TOGGLE_LINE_WRAP].upcall = toggle_lineWrap; | 165 | + session->toggle[LIB3270_TOGGLE_LINE_WRAP].upcall = toggle_lineWrap; |
165 | #endif | 166 | #endif |
166 | 167 | ||
167 | static const LIB3270_TOGGLE active_by_default[] = | 168 | static const LIB3270_TOGGLE active_by_default[] = |
@@ -173,14 +174,14 @@ void initialize_toggles(H3270 *session, struct toggle *toggle) | @@ -173,14 +174,14 @@ void initialize_toggles(H3270 *session, struct toggle *toggle) | ||
173 | 174 | ||
174 | for(f=0;f< (sizeof(active_by_default)/sizeof(active_by_default[0])); f++) | 175 | for(f=0;f< (sizeof(active_by_default)/sizeof(active_by_default[0])); f++) |
175 | { | 176 | { |
176 | - toggle[active_by_default[f]].value = True; | 177 | + session->toggle[active_by_default[f]].value = True; |
177 | } | 178 | } |
178 | 179 | ||
179 | 180 | ||
180 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) | 181 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) |
181 | { | 182 | { |
182 | - if(toggle[f].value) | ||
183 | - toggle[f].upcall(session,&toggle[f],TT_INITIAL); | 183 | + if(session->toggle[f].value) |
184 | + session->toggle[f].upcall(session,&session->toggle[f],TT_INITIAL); | ||
184 | } | 185 | } |
185 | 186 | ||
186 | } | 187 | } |
@@ -188,7 +189,7 @@ void initialize_toggles(H3270 *session, struct toggle *toggle) | @@ -188,7 +189,7 @@ void initialize_toggles(H3270 *session, struct toggle *toggle) | ||
188 | /* | 189 | /* |
189 | * Called from system exit code to handle toggles. | 190 | * Called from system exit code to handle toggles. |
190 | */ | 191 | */ |
191 | -void shutdown_toggles(H3270 *session, struct toggle *toggle) | 192 | +void shutdown_toggles(H3270 *session) |
192 | { | 193 | { |
193 | #if defined(X3270_TRACE) | 194 | #if defined(X3270_TRACE) |
194 | static const LIB3270_TOGGLE disable_on_shutdown[] = {DS_TRACE, EVENT_TRACE, SCREEN_TRACE}; | 195 | static const LIB3270_TOGGLE disable_on_shutdown[] = {DS_TRACE, EVENT_TRACE, SCREEN_TRACE}; |
@@ -198,7 +199,7 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle) | @@ -198,7 +199,7 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle) | ||
198 | for(f=0;f< (sizeof(disable_on_shutdown)/sizeof(disable_on_shutdown[0])); f++) | 199 | for(f=0;f< (sizeof(disable_on_shutdown)/sizeof(disable_on_shutdown[0])); f++) |
199 | { | 200 | { |
200 | LIB3270_TOGGLE ix = disable_on_shutdown[f]; | 201 | LIB3270_TOGGLE ix = disable_on_shutdown[f]; |
201 | - struct toggle * t = &toggle[ix]; | 202 | + struct toggle * t = &session->toggle[ix]; |
202 | 203 | ||
203 | if(t->value) | 204 | if(t->value) |
204 | { | 205 | { |
@@ -209,28 +210,6 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle) | @@ -209,28 +210,6 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle) | ||
209 | session->update_toggle(session,ix,t->value,TT_FINAL,toggle_names[ix]); | 210 | session->update_toggle(session,ix,t->value,TT_FINAL,toggle_names[ix]); |
210 | } | 211 | } |
211 | } | 212 | } |
212 | - | ||
213 | -/* | ||
214 | - // Clean up the data stream trace monitor window. | ||
215 | - if(toggle[DS_TRACE].value) | ||
216 | - { | ||
217 | - toggle[DS_TRACE].value = False; | ||
218 | - toggle_dsTrace(session, &toggle[DS_TRACE], TT_FINAL); | ||
219 | - } | ||
220 | - | ||
221 | - if(toggle[EVENT_TRACE].value) | ||
222 | - { | ||
223 | - toggle[EVENT_TRACE].value = False; | ||
224 | - toggle_dsTrace(session, &toggle[EVENT_TRACE], TT_FINAL); | ||
225 | - } | ||
226 | - | ||
227 | - // Clean up the screen trace file. | ||
228 | - if (toggle[SCREEN_TRACE].value) | ||
229 | - { | ||
230 | - toggle[SCREEN_TRACE].value = False; | ||
231 | - toggle_screenTrace(session, &toggle[SCREEN_TRACE], TT_FINAL); | ||
232 | - } | ||
233 | -*/ | ||
234 | #endif | 213 | #endif |
235 | } | 214 | } |
236 | 215 |
togglesc.h
@@ -25,5 +25,5 @@ | @@ -25,5 +25,5 @@ | ||
25 | 25 | ||
26 | // extern const char *toggle_names[N_TOGGLES]; | 26 | // extern const char *toggle_names[N_TOGGLES]; |
27 | 27 | ||
28 | - LIB3270_INTERNAL void initialize_toggles(H3270 *session, struct toggle *toggle); | ||
29 | - LIB3270_INTERNAL void shutdown_toggles(H3270 *session, struct toggle *toggle); | 28 | + LIB3270_INTERNAL void initialize_toggles(H3270 *session); |
29 | + LIB3270_INTERNAL void shutdown_toggles(H3270 *session); |