Commit db04ac3f34fcd73fd7f68ea6bd11f9ac20a8aabb
1 parent
35db594a
Exists in
master
and in
3 other branches
Updating timer calls.
Showing
12 changed files
with
60 additions
and
318 deletions
Show diff stats
lib3270.cbp
@@ -46,7 +46,6 @@ | @@ -46,7 +46,6 @@ | ||
46 | <Unit filename="src/include/ansic.h" /> | 46 | <Unit filename="src/include/ansic.h" /> |
47 | <Unit filename="src/include/api.h" /> | 47 | <Unit filename="src/include/api.h" /> |
48 | <Unit filename="src/include/aplc.h" /> | 48 | <Unit filename="src/include/aplc.h" /> |
49 | - <Unit filename="src/include/appres.h" /> | ||
50 | <Unit filename="src/include/arpa_telnet.h" /> | 49 | <Unit filename="src/include/arpa_telnet.h" /> |
51 | <Unit filename="src/include/cg.h" /> | 50 | <Unit filename="src/include/cg.h" /> |
52 | <Unit filename="src/include/childc.h" /> | 51 | <Unit filename="src/include/childc.h" /> |
src/include/appres.h
@@ -1,243 +0,0 @@ | @@ -1,243 +0,0 @@ | ||
1 | -/* | ||
2 | - * Modifications Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, | ||
3 | - * 2003, 2004, 2005, 2007 by Paul Mattes. | ||
4 | - * Copyright 1990 by Jeff Sparkes. | ||
5 | - * Permission to use, copy, modify, and distribute this software and its | ||
6 | - * documentation for any purpose and without fee is hereby granted, | ||
7 | - * provided that the above copyright notice appear in all copies and that | ||
8 | - * both that copyright notice and this permission notice appear in | ||
9 | - * supporting documentation. | ||
10 | - * | ||
11 | - * x3270, c3270, s3270 and tcl3270 are distributed in the hope that they will | ||
12 | - * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE | ||
14 | - * for more details. | ||
15 | - */ | ||
16 | - | ||
17 | -/* | ||
18 | - * appres.h | ||
19 | - * Application resource definitions for x3270, c3270, s3270 and | ||
20 | - * tcl3270. | ||
21 | - */ | ||
22 | - | ||
23 | -#include "toggle.h" | ||
24 | - | ||
25 | -/* Toggles */ | ||
26 | - | ||
27 | -/* | ||
28 | -struct toggle { | ||
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 | ||
34 | -// void (*callback)(H3270 *, int, LIB3270_TOGGLE_TYPE); | ||
35 | - | ||
36 | -}; | ||
37 | - | ||
38 | -// #define toggle_toggle(t) { (t)->value = !(t)->value; } | ||
39 | -*/ | ||
40 | - | ||
41 | -#error Deprecated | ||
42 | - | ||
43 | -#define toggled(ix) lib3270_get_toggle(NULL,ix) | ||
44 | - | ||
45 | -/* Application resources */ | ||
46 | - | ||
47 | -typedef struct { | ||
48 | - /* Basic colors */ | ||
49 | -// #if defined(X3270_DISPLAY) /*[*/ | ||
50 | -// Pixel foreground; | ||
51 | -// Pixel background; | ||
52 | -// #endif /*]*/ | ||
53 | - | ||
54 | - /* Options (not toggles) */ | ||
55 | -// char mono; | ||
56 | -// char extended; | ||
57 | -// char m3279; | ||
58 | -// char modified_sel; | ||
59 | -// char once; | ||
60 | -//#if defined(X3270_DISPLAY) /*[*/ | ||
61 | -// char visual_bell; | ||
62 | -// char menubar; | ||
63 | -// char active_icon; | ||
64 | -// char label_icon; | ||
65 | -// char invert_kpshift; | ||
66 | -// char use_cursor_color; | ||
67 | -// char allow_resize; | ||
68 | -// char no_other; | ||
69 | -// char do_confirms; | ||
70 | -// #if !defined(G3270) | ||
71 | -// char reconnect; | ||
72 | -// #endif | ||
73 | -// char visual_select; | ||
74 | -// char suppress_host; | ||
75 | -// char suppress_font_menu; | ||
76 | -//# if defined(X3270_KEYPAD) /*[*/ | ||
77 | -// char keypad_on; | ||
78 | -//# endif /*]*/ | ||
79 | -//#endif /*]*/ | ||
80 | -//#if defined(C3270) /*[*/ | ||
81 | -// char all_bold_on; | ||
82 | -// char curses_keypad; | ||
83 | -// char cbreak_mode; | ||
84 | -//#endif /*]*/ | ||
85 | -// char apl_mode; | ||
86 | -// char scripted; | ||
87 | -// char numeric_lock; | ||
88 | -// char secure; | ||
89 | -// char oerr_lock; | ||
90 | -// char typeahead; | ||
91 | -// char debug_tracing; | ||
92 | -// char disconnect_clear; | ||
93 | -// char highlight_bold; | ||
94 | -// char color8; | ||
95 | -// char bsd_tm; | ||
96 | -// char unlock_delay; | ||
97 | -// #if defined(X3270_SCRIPT) /*[*/ | ||
98 | -// char socket; | ||
99 | -// #endif /*]*/ | ||
100 | -// #if defined(C3270) && defined(_WIN32) /*[*/ | ||
101 | -// char highlight_underline; | ||
102 | -//#endif /*]*/ | ||
103 | - | ||
104 | - /* Named resources */ | ||
105 | -/* | ||
106 | -#if defined(X3270_KEYPAD) | ||
107 | - char *keypad; | ||
108 | -#endif | ||
109 | -*/ | ||
110 | -#if defined(X3270_DISPLAY) || defined(C3270) | ||
111 | -// char *key_map; | ||
112 | -// char *compose_map; | ||
113 | -// char *printer_lu; | ||
114 | -#endif | ||
115 | -/* | ||
116 | -#if defined(X3270_DISPLAY) | ||
117 | - char *efontname; | ||
118 | - char *fixed_size; | ||
119 | - char *debug_font; | ||
120 | - char *icon_font; | ||
121 | - char *icon_label_font; | ||
122 | - int save_lines; | ||
123 | - char *normal_name; | ||
124 | - char *select_name; | ||
125 | - char *bold_name; | ||
126 | - char *colorbg_name; | ||
127 | - char *keypadbg_name; | ||
128 | - char *selbg_name; | ||
129 | - char *cursor_color_name; | ||
130 | - char *color_scheme; | ||
131 | - int bell_volume; | ||
132 | - char *char_class; | ||
133 | - int modified_sel_color; | ||
134 | - int visual_select_color; | ||
135 | -#if defined(X3270_DBCS) | ||
136 | - char *input_method; | ||
137 | - char *preedit_type; | ||
138 | -#endif | ||
139 | -#endif | ||
140 | -*/ | ||
141 | -//#if defined(X3270_DBCS) | ||
142 | -// char *local_encoding; | ||
143 | -//#endif | ||
144 | - | ||
145 | -#if defined(C3270) /*[*/ | ||
146 | -// char *meta_escape; | ||
147 | -// char *all_bold; | ||
148 | -// char *altscreen; | ||
149 | -// char *defscreen; | ||
150 | -#endif /*]*/ | ||
151 | -// char *conf_dir; | ||
152 | - char *model; | ||
153 | -// char *hostsfile; | ||
154 | -// char *port; | ||
155 | -// char *charset; | ||
156 | -// char *termname; | ||
157 | -// char *login_macro; | ||
158 | -// char *macros; | ||
159 | -#if defined(X3270_TRACE) /*[*/ | ||
160 | -//#if !defined(_WIN32) | ||
161 | -// char *trace_dir; | ||
162 | -//#endif | ||
163 | -// char *trace_file; | ||
164 | -// char *screentrace_file; | ||
165 | -// char *trace_file_size; | ||
166 | -/* | ||
167 | -#if defined(X3270_DISPLAY) || defined(WC3270) | ||
168 | - char trace_monitor; | ||
169 | -#endif | ||
170 | -*/ | ||
171 | - | ||
172 | -#endif /*]*/ | ||
173 | -// char *oversize; | ||
174 | -#if defined(X3270_FT) /*[*/ | ||
175 | -// char *ft_command; | ||
176 | -// int dft_buffer_size; | ||
177 | -#endif /*]*/ | ||
178 | -// char *connectfile_name; | ||
179 | -// char *idle_command; | ||
180 | -// char idle_command_enabled; | ||
181 | -// char *idle_timeout; | ||
182 | - | ||
183 | -/* | ||
184 | -#if defined(X3270_SCRIPT) | ||
185 | - char *plugin_command; | ||
186 | -#endif | ||
187 | -*/ | ||
188 | - | ||
189 | -//#if defined(HAVE_LIBSSL) | ||
190 | -// char *cert_file; | ||
191 | -//#endif | ||
192 | -// char *proxy; | ||
193 | - | ||
194 | - /* Toggles */ | ||
195 | -// struct toggle toggle[N_TOGGLES]; | ||
196 | -/* | ||
197 | -#if defined(X3270_DISPLAY) | ||
198 | - // Simple widget resources | ||
199 | - Cursor normal_mcursor; | ||
200 | - Cursor wait_mcursor; | ||
201 | - Cursor locked_mcursor; | ||
202 | -#endif | ||
203 | -*/ | ||
204 | - | ||
205 | -/* | ||
206 | -#if defined(X3270_ANSI) | ||
207 | - // Line-mode TTY parameters | ||
208 | - char icrnl; | ||
209 | - char inlcr; | ||
210 | - char onlcr; | ||
211 | - char *erase; | ||
212 | - char *kill; | ||
213 | - char *werase; | ||
214 | - char *rprnt; | ||
215 | - char *lnext; | ||
216 | - char *intr; | ||
217 | - char *quit; | ||
218 | - char *eof; | ||
219 | -#endif | ||
220 | -*/ | ||
221 | - | ||
222 | -// #if defined(WC3270) /*[*/ | ||
223 | -// char *hostname; | ||
224 | -// #endif | ||
225 | - | ||
226 | -/* | ||
227 | -#if defined(WC3270) | ||
228 | - char *title; | ||
229 | -#endif | ||
230 | -*/ | ||
231 | - | ||
232 | -/* | ||
233 | -#if defined(USE_APP_DEFAULTS) | ||
234 | - // App-defaults version | ||
235 | - char *ad_version; | ||
236 | -#endif | ||
237 | -*/ | ||
238 | - | ||
239 | -} AppRes, *AppResptr; | ||
240 | - | ||
241 | -extern AppRes appres; | ||
242 | - | ||
243 | -void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); |
src/include/gluec.h
@@ -1,33 +0,0 @@ | @@ -1,33 +0,0 @@ | ||
1 | -/* | ||
2 | - * Copyright 2000 by Paul Mattes. | ||
3 | - * Permission to use, copy, modify, and distribute this software and its | ||
4 | - * documentation for any purpose and without fee is hereby granted, | ||
5 | - * provided that the above copyright notice appear in all copies and that | ||
6 | - * both that copyright notice and this permission notice appear in | ||
7 | - * supporting documentation. | ||
8 | - * | ||
9 | - * c3270, s3270 and tcl3270 are distributed in the hope that they will | ||
10 | - * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE | ||
12 | - * for more details. | ||
13 | - */ | ||
14 | - | ||
15 | -/* | ||
16 | - * gluec.h | ||
17 | - * Declarations for glue.c and XtGlue.c | ||
18 | - */ | ||
19 | - | ||
20 | -/* glue.c */ | ||
21 | -// extern int parse_command_line(int argc, const char **argv, const char **cl_hostname); | ||
22 | -// extern int parse_program_parameters(int argc, const char **argv); | ||
23 | -// LIB3270_INTERNAL void parse_xrm(const char *arg, const char *where); | ||
24 | -// LIB3270_INTERNAL void notify_ssl_error(H3270 *session, const char *title, const char *msg, const char *state, const char *alert); | ||
25 | - | ||
26 | -/* XtGlue.c */ | ||
27 | -// LIB3270_INTERNAL void (*Warning_redirect)(const char *); | ||
28 | - | ||
29 | -// #if !defined(_WIN32) | ||
30 | -// LIB3270_INTERNAL int select_setup(int *nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval **timeout, struct timeval *timebuf); | ||
31 | -// #endif | ||
32 | - | ||
33 | -#error Deprecated |
src/include/lib3270.h
@@ -833,8 +833,8 @@ | @@ -833,8 +833,8 @@ | ||
833 | { | 833 | { |
834 | unsigned short sz; | 834 | unsigned short sz; |
835 | 835 | ||
836 | - void * (*AddTimeOut)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)); | ||
837 | - void (*RemoveTimeOut)(H3270 *session, void *timer); | 836 | + void * (*AddTimer)(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)); |
837 | + void (*RemoveTimer)(H3270 *session, void *timer); | ||
838 | 838 | ||
839 | void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); | 839 | void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); |
840 | void (*remove_poll)(H3270 *session, void *id); | 840 | void (*remove_poll)(H3270 *session, void *id); |
@@ -864,7 +864,7 @@ | @@ -864,7 +864,7 @@ | ||
864 | * @param rm Callback for removing a timeout | 864 | * @param rm Callback for removing a timeout |
865 | * | 865 | * |
866 | */ | 866 | */ |
867 | - LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)); | 867 | + LIB3270_EXPORT void lib3270_register_timer_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)); |
868 | 868 | ||
869 | LIB3270_EXPORT void lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id)); | 869 | LIB3270_EXPORT void lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id)); |
870 | 870 |
src/include/utilc.h
@@ -41,8 +41,8 @@ LIB3270_INTERNAL void * AddOutput(int, H3270 *session, void (*fn)(H3270 *sessio | @@ -41,8 +41,8 @@ LIB3270_INTERNAL void * AddOutput(int, H3270 *session, void (*fn)(H3270 *sessio | ||
41 | LIB3270_INTERNAL void * AddExcept(int, H3270 *session, void (*fn)(H3270 *session)); | 41 | LIB3270_INTERNAL void * AddExcept(int, H3270 *session, void (*fn)(H3270 *session)); |
42 | 42 | ||
43 | LIB3270_INTERNAL void RemoveSource(H3270 *session, void *cookie); | 43 | LIB3270_INTERNAL void RemoveSource(H3270 *session, void *cookie); |
44 | -LIB3270_INTERNAL void * AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session)); | ||
45 | -LIB3270_INTERNAL void RemoveTimeOut(H3270 *session, void *cookie); | 44 | +LIB3270_INTERNAL void * AddTimer(unsigned long msec, H3270 *session, int (*fn)(H3270 *session)); |
45 | +LIB3270_INTERNAL void RemoveTimer(H3270 *session, void *cookie); | ||
46 | 46 | ||
47 | LIB3270_INTERNAL const char * KeysymToString(KeySym k); | 47 | LIB3270_INTERNAL const char * KeysymToString(KeySym k); |
48 | 48 |
src/lib3270/ctlr.c
@@ -2809,7 +2809,7 @@ delta_msec(struct timeval *t1, struct timeval *t0) | @@ -2809,7 +2809,7 @@ delta_msec(struct timeval *t1, struct timeval *t0) | ||
2809 | (t1->tv_usec - t0->tv_usec + 500) / 1000; | 2809 | (t1->tv_usec - t0->tv_usec + 500) / 1000; |
2810 | } | 2810 | } |
2811 | 2811 | ||
2812 | -static void keep_ticking(H3270 *hSession) | 2812 | +static int keep_ticking(H3270 *hSession) |
2813 | { | 2813 | { |
2814 | struct timeval t1; | 2814 | struct timeval t1; |
2815 | long msec; | 2815 | long msec; |
@@ -2821,8 +2821,9 @@ static void keep_ticking(H3270 *hSession) | @@ -2821,8 +2821,9 @@ static void keep_ticking(H3270 *hSession) | ||
2821 | msec = delta_msec(&hSession->t_want, &t1); | 2821 | msec = delta_msec(&hSession->t_want, &t1); |
2822 | } while (msec <= 0); | 2822 | } while (msec <= 0); |
2823 | 2823 | ||
2824 | - hSession->tick_id = AddTimeOut(msec, hSession, keep_ticking); | ||
2825 | status_timing(hSession,&hSession->t_start, &t1); | 2824 | status_timing(hSession,&hSession->t_start, &t1); |
2825 | + | ||
2826 | + return 1; | ||
2826 | } | 2827 | } |
2827 | 2828 | ||
2828 | void ticking_start(H3270 *hSession, Boolean anyway) | 2829 | void ticking_start(H3270 *hSession, Boolean anyway) |
@@ -2846,10 +2847,10 @@ void ticking_start(H3270 *hSession, Boolean anyway) | @@ -2846,10 +2847,10 @@ void ticking_start(H3270 *hSession, Boolean anyway) | ||
2846 | status_untiming(hSession); | 2847 | status_untiming(hSession); |
2847 | 2848 | ||
2848 | if (hSession->ticking) | 2849 | if (hSession->ticking) |
2849 | - RemoveTimeOut(hSession, hSession->tick_id); | 2850 | + RemoveTimer(hSession, hSession->tick_id); |
2850 | 2851 | ||
2851 | hSession->ticking = 1; | 2852 | hSession->ticking = 1; |
2852 | - hSession->tick_id = AddTimeOut(1000, hSession, keep_ticking); | 2853 | + hSession->tick_id = AddTimer(1000, hSession, keep_ticking); |
2853 | hSession->t_want = hSession->t_start; | 2854 | hSession->t_want = hSession->t_start; |
2854 | } | 2855 | } |
2855 | 2856 | ||
@@ -2875,7 +2876,7 @@ static void ticking_stop(H3270 *hSession) | @@ -2875,7 +2876,7 @@ static void ticking_stop(H3270 *hSession) | ||
2875 | 2876 | ||
2876 | if (!hSession->ticking) | 2877 | if (!hSession->ticking) |
2877 | return; | 2878 | return; |
2878 | - RemoveTimeOut(hSession, hSession->tick_id); | 2879 | + RemoveTimer(hSession, hSession->tick_id); |
2879 | hSession->ticking = 0; | 2880 | hSession->ticking = 0; |
2880 | status_timing(hSession,&hSession->t_start, &t1); | 2881 | status_timing(hSession,&hSession->t_start, &t1); |
2881 | } | 2882 | } |
src/lib3270/host.c
@@ -58,11 +58,12 @@ | @@ -58,11 +58,12 @@ | ||
58 | /** | 58 | /** |
59 | * @brief Called from timer to attempt an automatic reconnection. | 59 | * @brief Called from timer to attempt an automatic reconnection. |
60 | */ | 60 | */ |
61 | -void lib3270_reconnect(H3270 *hSession) | 61 | +int lib3270_reconnect(H3270 *hSession) |
62 | { | 62 | { |
63 | lib3270_write_log(hSession,"3270","Starting auto-reconnect on %s",lib3270_get_url(hSession)); | 63 | lib3270_write_log(hSession,"3270","Starting auto-reconnect on %s",lib3270_get_url(hSession)); |
64 | hSession->auto_reconnect_inprogress = 0; | 64 | hSession->auto_reconnect_inprogress = 0; |
65 | lib3270_connect(hSession,0); | 65 | lib3270_connect(hSession,0); |
66 | + return 0; | ||
66 | } | 67 | } |
67 | 68 | ||
68 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h) | 69 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h) |
@@ -85,7 +86,7 @@ int host_disconnect(H3270 *hSession, int failed) | @@ -85,7 +86,7 @@ int host_disconnect(H3270 *hSession, int failed) | ||
85 | { | 86 | { |
86 | /* Schedule an automatic reconnection. */ | 87 | /* Schedule an automatic reconnection. */ |
87 | hSession->auto_reconnect_inprogress = 1; | 88 | hSession->auto_reconnect_inprogress = 1; |
88 | - (void) AddTimeOut(failed ? RECONNECT_ERR_MS : RECONNECT_MS, hSession, lib3270_reconnect); | 89 | + (void) AddTimer(failed ? RECONNECT_ERR_MS : RECONNECT_MS, hSession, lib3270_reconnect); |
89 | } | 90 | } |
90 | 91 | ||
91 | /* | 92 | /* |
src/lib3270/iocalls.c
@@ -58,8 +58,8 @@ | @@ -58,8 +58,8 @@ | ||
58 | /*---[ Standard calls ]-------------------------------------------------------------------------------------*/ | 58 | /*---[ Standard calls ]-------------------------------------------------------------------------------------*/ |
59 | 59 | ||
60 | // Timeout calls | 60 | // Timeout calls |
61 | - static void internal_remove_timeout(H3270 *session, void *timer); | ||
62 | - static void * internal_add_timeout(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)); | 61 | + static void internal_remove_timer(H3270 *session, void *timer); |
62 | + static void * internal_add_timer(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)); | ||
63 | 63 | ||
64 | static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); | 64 | static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); |
65 | static void internal_remove_poll(H3270 *session, void *id); | 65 | static void internal_remove_poll(H3270 *session, void *id); |
@@ -74,11 +74,11 @@ | @@ -74,11 +74,11 @@ | ||
74 | 74 | ||
75 | /*---[ Active callbacks ]-----------------------------------------------------------------------------------*/ | 75 | /*---[ Active callbacks ]-----------------------------------------------------------------------------------*/ |
76 | 76 | ||
77 | - static void * (*add_timeout)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)) | ||
78 | - = internal_add_timeout; | 77 | + static void * (*add_timer)(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)) |
78 | + = internal_add_timer; | ||
79 | 79 | ||
80 | - static void (*remove_timeout)(H3270 *session, void *timer) | ||
81 | - = internal_remove_timeout; | 80 | + static void (*remove_timer)(H3270 *session, void *timer) |
81 | + = internal_remove_timer; | ||
82 | 82 | ||
83 | static void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata) | 83 | static void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata) |
84 | = internal_add_poll; | 84 | = internal_add_poll; |
@@ -124,7 +124,7 @@ static void ms_ts(unsigned long long *u) | @@ -124,7 +124,7 @@ static void ms_ts(unsigned long long *u) | ||
124 | } | 124 | } |
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | -static void * internal_add_timeout(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)) | 127 | +static void * internal_add_timer(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)) |
128 | { | 128 | { |
129 | timeout_t *t_new; | 129 | timeout_t *t_new; |
130 | timeout_t *t; | 130 | timeout_t *t; |
@@ -184,12 +184,12 @@ static void * internal_add_timeout(H3270 *session, unsigned long interval_ms, vo | @@ -184,12 +184,12 @@ static void * internal_add_timeout(H3270 *session, unsigned long interval_ms, vo | ||
184 | prev->next = t_new; | 184 | prev->next = t_new; |
185 | } | 185 | } |
186 | 186 | ||
187 | - trace("Timeout %p added with value %ld",t_new,interval_ms); | 187 | + trace("Timer %p added with value %ld",t_new,interval_ms); |
188 | 188 | ||
189 | return t_new; | 189 | return t_new; |
190 | } | 190 | } |
191 | 191 | ||
192 | -static void internal_remove_timeout(H3270 *session, void * timer) | 192 | +static void internal_remove_timer(H3270 *session, void * timer) |
193 | { | 193 | { |
194 | timeout_t *st = (timeout_t *)timer; | 194 | timeout_t *st = (timeout_t *)timer; |
195 | timeout_t *t; | 195 | timeout_t *t; |
@@ -354,22 +354,21 @@ static void internal_ring_bell(H3270 *session unused) | @@ -354,22 +354,21 @@ static void internal_ring_bell(H3270 *session unused) | ||
354 | 354 | ||
355 | /* External entry points */ | 355 | /* External entry points */ |
356 | 356 | ||
357 | -void * AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)) | 357 | +void * AddTimer(unsigned long interval_ms, H3270 *session, int (*proc)(H3270 *session)) |
358 | { | 358 | { |
359 | void *timer; | 359 | void *timer; |
360 | CHECK_SESSION_HANDLE(session); | 360 | CHECK_SESSION_HANDLE(session); |
361 | - timer = add_timeout(session,interval_ms,proc); | 361 | + timer = add_timer(session,interval_ms,proc); |
362 | trace("Timeout %p created with %ld ms",timer,interval_ms); | 362 | trace("Timeout %p created with %ld ms",timer,interval_ms); |
363 | return timer; | 363 | return timer; |
364 | } | 364 | } |
365 | 365 | ||
366 | -void RemoveTimeOut(H3270 *session, void * timer) | 366 | +void RemoveTimer(H3270 *session, void * timer) |
367 | { | 367 | { |
368 | if(!timer) | 368 | if(!timer) |
369 | return; | 369 | return; |
370 | - | ||
371 | trace("Removing timeout %p",timer); | 370 | trace("Removing timeout %p",timer); |
372 | - return remove_timeout(session, timer); | 371 | + return remove_timer(session, timer); |
373 | } | 372 | } |
374 | 373 | ||
375 | void x_except_on(H3270 *h) | 374 | void x_except_on(H3270 *h) |
@@ -410,13 +409,13 @@ void remove_input_calls(H3270 *session) | @@ -410,13 +409,13 @@ void remove_input_calls(H3270 *session) | ||
410 | } | 409 | } |
411 | } | 410 | } |
412 | 411 | ||
413 | -LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)) | 412 | +LIB3270_EXPORT void lib3270_register_timer_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)) |
414 | { | 413 | { |
415 | if(add) | 414 | if(add) |
416 | - add_timeout = add; | 415 | + add_timer = add; |
417 | 416 | ||
418 | if(rm) | 417 | if(rm) |
419 | - remove_timeout = rm; | 418 | + remove_timer = rm; |
420 | 419 | ||
421 | } | 420 | } |
422 | 421 | ||
@@ -433,7 +432,7 @@ LIB3270_EXPORT int lib3270_register_io_controller(const LIB3270_IO_CONTROLLER *c | @@ -433,7 +432,7 @@ LIB3270_EXPORT int lib3270_register_io_controller(const LIB3270_IO_CONTROLLER *c | ||
433 | if(!cbk || cbk->sz != sizeof(LIB3270_IO_CONTROLLER)) | 432 | if(!cbk || cbk->sz != sizeof(LIB3270_IO_CONTROLLER)) |
434 | return errno = EINVAL; | 433 | return errno = EINVAL; |
435 | 434 | ||
436 | - lib3270_register_time_handlers(cbk->AddTimeOut,cbk->RemoveTimeOut); | 435 | + lib3270_register_timer_handlers(cbk->AddTimer,cbk->RemoveTimer); |
437 | lib3270_register_fd_handlers(cbk->add_poll,cbk->remove_poll); | 436 | lib3270_register_fd_handlers(cbk->add_poll,cbk->remove_poll); |
438 | 437 | ||
439 | if(cbk->Wait) | 438 | if(cbk->Wait) |
src/lib3270/kybd.c
@@ -405,7 +405,7 @@ void kybd_inhibit(H3270 *session, Boolean inhibit) | @@ -405,7 +405,7 @@ void kybd_inhibit(H3270 *session, Boolean inhibit) | ||
405 | void kybd_connect(H3270 *session, int connected, void *dunno unused) | 405 | void kybd_connect(H3270 *session, int connected, void *dunno unused) |
406 | { | 406 | { |
407 | if (session->kybdlock & KL_DEFERRED_UNLOCK) | 407 | if (session->kybdlock & KL_DEFERRED_UNLOCK) |
408 | - RemoveTimeOut(session, session->unlock_id); | 408 | + RemoveTimer(session, session->unlock_id); |
409 | 409 | ||
410 | lib3270_kybdlock_clear(session, -1); | 410 | lib3270_kybdlock_clear(session, -1); |
411 | 411 | ||
@@ -427,7 +427,7 @@ void kybd_connect(H3270 *session, int connected, void *dunno unused) | @@ -427,7 +427,7 @@ void kybd_connect(H3270 *session, int connected, void *dunno unused) | ||
427 | void kybd_in3270(H3270 *hSession, int in3270 unused, void *dunno unused) | 427 | void kybd_in3270(H3270 *hSession, int in3270 unused, void *dunno unused) |
428 | { | 428 | { |
429 | if (hSession->kybdlock & KL_DEFERRED_UNLOCK) | 429 | if (hSession->kybdlock & KL_DEFERRED_UNLOCK) |
430 | - RemoveTimeOut(hSession, hSession->unlock_id); | 430 | + RemoveTimer(hSession, hSession->unlock_id); |
431 | 431 | ||
432 | lib3270_kybdlock_clear(hSession,~KL_AWAITING_FIRST); | 432 | lib3270_kybdlock_clear(hSession,~KL_AWAITING_FIRST); |
433 | 433 | ||
@@ -1111,13 +1111,13 @@ LIB3270_EXPORT int lib3270_previousfield(H3270 *hSession) | @@ -1111,13 +1111,13 @@ LIB3270_EXPORT int lib3270_previousfield(H3270 *hSession) | ||
1111 | * Deferred keyboard unlock. | 1111 | * Deferred keyboard unlock. |
1112 | */ | 1112 | */ |
1113 | 1113 | ||
1114 | -static void defer_unlock(H3270 *hSession) | 1114 | +static int defer_unlock(H3270 *hSession) |
1115 | { | 1115 | { |
1116 | -// trace("%s",__FUNCTION__); | ||
1117 | lib3270_kybdlock_clear(hSession,KL_DEFERRED_UNLOCK); | 1116 | lib3270_kybdlock_clear(hSession,KL_DEFERRED_UNLOCK); |
1118 | status_reset(hSession); | 1117 | status_reset(hSession); |
1119 | if(CONNECTED) | 1118 | if(CONNECTED) |
1120 | ps_process(hSession); | 1119 | ps_process(hSession); |
1120 | + return 0; | ||
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | /** | 1123 | /** |
@@ -1152,7 +1152,7 @@ void do_reset(H3270 *hSession, Boolean explicit) | @@ -1152,7 +1152,7 @@ void do_reset(H3270 *hSession, Boolean explicit) | ||
1152 | * keyboard now, or want to defer further into the future. | 1152 | * keyboard now, or want to defer further into the future. |
1153 | */ | 1153 | */ |
1154 | if (hSession->kybdlock & KL_DEFERRED_UNLOCK) | 1154 | if (hSession->kybdlock & KL_DEFERRED_UNLOCK) |
1155 | - RemoveTimeOut(hSession, hSession->unlock_id); | 1155 | + RemoveTimer(hSession, hSession->unlock_id); |
1156 | 1156 | ||
1157 | /* | 1157 | /* |
1158 | * If explicit (from the keyboard), unlock the keyboard now. | 1158 | * If explicit (from the keyboard), unlock the keyboard now. |
@@ -1169,7 +1169,7 @@ void do_reset(H3270 *hSession, Boolean explicit) | @@ -1169,7 +1169,7 @@ void do_reset(H3270 *hSession, Boolean explicit) | ||
1169 | 1169 | ||
1170 | if(hSession->unlock_delay_ms) | 1170 | if(hSession->unlock_delay_ms) |
1171 | { | 1171 | { |
1172 | - hSession->unlock_id = AddTimeOut(hSession->unlock_delay_ms, hSession, defer_unlock); | 1172 | + hSession->unlock_id = AddTimer(hSession->unlock_delay_ms, hSession, defer_unlock); |
1173 | } | 1173 | } |
1174 | else | 1174 | else |
1175 | { | 1175 | { |
src/lib3270/private.h
@@ -265,7 +265,7 @@ typedef struct timeout | @@ -265,7 +265,7 @@ typedef struct timeout | ||
265 | struct timeval tv; | 265 | struct timeval tv; |
266 | #endif /*]*/ | 266 | #endif /*]*/ |
267 | 267 | ||
268 | - void (*proc)(H3270 *session); | 268 | + int (*proc)(H3270 *session); |
269 | 269 | ||
270 | H3270 *session; | 270 | H3270 *session; |
271 | 271 | ||
@@ -301,8 +301,6 @@ struct _h3270 | @@ -301,8 +301,6 @@ struct _h3270 | ||
301 | { | 301 | { |
302 | struct lib3270_session_callbacks cbk; // Callback table - Always the first one. | 302 | struct lib3270_session_callbacks cbk; // Callback table - Always the first one. |
303 | 303 | ||
304 | -// unsigned short sz; /**< Struct size */ | ||
305 | - | ||
306 | // Session info | 304 | // Session info |
307 | char id; ///< @brief Session Identifier. | 305 | char id; ///< @brief Session Identifier. |
308 | 306 | ||
@@ -601,6 +599,8 @@ struct _h3270 | @@ -601,6 +599,8 @@ struct _h3270 | ||
601 | void * except; | 599 | void * except; |
602 | } xio; | 600 | } xio; |
603 | 601 | ||
602 | + size_t popups; ///< @brief Count open popups. | ||
603 | + | ||
604 | #ifdef HAVE_LIBSSL | 604 | #ifdef HAVE_LIBSSL |
605 | /// @brief SSL Data. | 605 | /// @brief SSL Data. |
606 | struct | 606 | struct |
@@ -647,7 +647,7 @@ LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block | @@ -647,7 +647,7 @@ LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block | ||
647 | /** | 647 | /** |
648 | * @brief Called from timer to attempt an automatic reconnection. | 648 | * @brief Called from timer to attempt an automatic reconnection. |
649 | */ | 649 | */ |
650 | -LIB3270_INTERNAL void lib3270_reconnect(H3270 *hSession); | 650 | +LIB3270_INTERNAL int lib3270_reconnect(H3270 *hSession); |
651 | 651 | ||
652 | #if defined(DEBUG) | 652 | #if defined(DEBUG) |
653 | #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__); | 653 | #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__); |
src/lib3270/screen.c
@@ -759,7 +759,9 @@ void Error(H3270 *session, const char *fmt, ...) | @@ -759,7 +759,9 @@ void Error(H3270 *session, const char *fmt, ...) | ||
759 | 759 | ||
760 | va_start(arg_ptr, fmt); | 760 | va_start(arg_ptr, fmt); |
761 | 761 | ||
762 | + session->popups++; | ||
762 | session->cbk.popup(session,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | 763 | session->cbk.popup(session,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); |
764 | + session->popups--; | ||
763 | 765 | ||
764 | va_end(arg_ptr); | 766 | va_end(arg_ptr); |
765 | 767 | ||
@@ -774,7 +776,11 @@ void Warning(H3270 *session, const char *fmt, ...) | @@ -774,7 +776,11 @@ void Warning(H3270 *session, const char *fmt, ...) | ||
774 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Warning",fmt); | 776 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Warning",fmt); |
775 | 777 | ||
776 | va_start(arg_ptr, fmt); | 778 | va_start(arg_ptr, fmt); |
779 | + | ||
780 | + session->popups++; | ||
777 | session->cbk.popup(session,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); | 781 | session->cbk.popup(session,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); |
782 | + session->popups--; | ||
783 | + | ||
778 | va_end(arg_ptr); | 784 | va_end(arg_ptr); |
779 | 785 | ||
780 | } | 786 | } |
@@ -789,7 +795,11 @@ void popup_an_error(H3270 *session, const char *fmt, ...) | @@ -789,7 +795,11 @@ void popup_an_error(H3270 *session, const char *fmt, ...) | ||
789 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt); | 795 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt); |
790 | 796 | ||
791 | va_start(args, fmt); | 797 | va_start(args, fmt); |
798 | + | ||
799 | + session->popups++; | ||
792 | session->cbk.popup(session,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); | 800 | session->cbk.popup(session,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); |
801 | + session->popups--; | ||
802 | + | ||
793 | va_end(args); | 803 | va_end(args); |
794 | 804 | ||
795 | } | 805 | } |
@@ -803,7 +813,11 @@ void popup_system_error(H3270 *session, const char *title, const char *message, | @@ -803,7 +813,11 @@ void popup_system_error(H3270 *session, const char *title, const char *message, | ||
803 | trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); | 813 | trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); |
804 | 814 | ||
805 | va_start(args, fmt); | 815 | va_start(args, fmt); |
816 | + | ||
817 | + session->popups++; | ||
806 | session->cbk.popup(session,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); | 818 | session->cbk.popup(session,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); |
819 | + session->popups--; | ||
820 | + | ||
807 | va_end(args); | 821 | va_end(args); |
808 | } | 822 | } |
809 | 823 | ||
@@ -924,7 +938,11 @@ LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , con | @@ -924,7 +938,11 @@ LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , con | ||
924 | LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list args) | 938 | LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list args) |
925 | { | 939 | { |
926 | CHECK_SESSION_HANDLE(session); | 940 | CHECK_SESSION_HANDLE(session); |
941 | + | ||
942 | + session->popups++; | ||
927 | session->cbk.popup(session,id,title ? title : _( "3270 Error" ), message,fmt,args); | 943 | session->cbk.popup(session,id,title ? title : _( "3270 Error" ), message,fmt,args); |
944 | + session->popups--; | ||
945 | + | ||
928 | } | 946 | } |
929 | 947 | ||
930 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) | 948 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) |
src/lib3270/toggles.c
@@ -352,7 +352,7 @@ static void toggle_reconnect(H3270 *hSession, struct lib3270_toggle *t unused, L | @@ -352,7 +352,7 @@ static void toggle_reconnect(H3270 *hSession, struct lib3270_toggle *t unused, L | ||
352 | /* Schedule an automatic reconnection. */ | 352 | /* Schedule an automatic reconnection. */ |
353 | lib3270_write_log(hSession,"toggle","Auto-reconnect toggle was activated when offline, reconnecting"); | 353 | lib3270_write_log(hSession,"toggle","Auto-reconnect toggle was activated when offline, reconnecting"); |
354 | hSession->auto_reconnect_inprogress = 1; | 354 | hSession->auto_reconnect_inprogress = 1; |
355 | - (void) AddTimeOut(RECONNECT_MS, hSession, lib3270_reconnect); | 355 | + (void) AddTimer(RECONNECT_MS, hSession, lib3270_reconnect); |
356 | } | 356 | } |
357 | 357 | ||
358 | } | 358 | } |