Commit cf6fe3dabf0b1d67a231e2ceb3a675af4513c127
1 parent
d7c6dace
Exists in
master
and in
3 other branches
Creating standard chained list managers.
Showing
11 changed files
with
287 additions
and
160 deletions
Show diff stats
lib3270.cbp
... | ... | @@ -113,6 +113,9 @@ |
113 | 113 | <Unit filename="src/core/keyboard/properties.c"> |
114 | 114 | <Option compilerVar="CC" /> |
115 | 115 | </Unit> |
116 | + <Unit filename="src/core/linkelist.c"> | |
117 | + <Option compilerVar="CC" /> | |
118 | + </Unit> | |
116 | 119 | <Unit filename="src/core/linux/connect.c"> |
117 | 120 | <Option compilerVar="CC" /> |
118 | 121 | </Unit> |
... | ... | @@ -248,6 +251,7 @@ |
248 | 251 | <Unit filename="src/include/lib3270/session.h" /> |
249 | 252 | <Unit filename="src/include/lib3270/toggle.h" /> |
250 | 253 | <Unit filename="src/include/lib3270/trace.h" /> |
254 | + <Unit filename="src/include/linkedlist.h" /> | |
251 | 255 | <Unit filename="src/include/localdefs.h" /> |
252 | 256 | <Unit filename="src/include/popupsc.h" /> |
253 | 257 | <Unit filename="src/include/proxyc.h" /> | ... | ... |
src/core/host.c
... | ... | @@ -174,97 +174,11 @@ void lib3270_set_disconnected(H3270 *hSession) |
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
177 | - * @brief Register a function interested in a state change. | |
178 | - * | |
179 | - * @param hSession Session handle. | |
180 | - * @param tx State ID | |
181 | - * @param func Callback | |
182 | - * @param data Data | |
183 | - * | |
184 | - * @return State change identifier. | |
185 | - * | |
186 | - */ | |
187 | -LIB3270_EXPORT const void * lib3270_register_schange(H3270 *hSession, LIB3270_STATE tx, void (*func)(H3270 *, int, void *),void *data) | |
188 | -{ | |
189 | - struct lib3270_state_callback *st; | |
190 | - | |
191 | - CHECK_SESSION_HANDLE(hSession); | |
192 | - | |
193 | - st = (struct lib3270_state_callback *) lib3270_malloc(sizeof(struct lib3270_state_callback)); | |
194 | - st->func = func; | |
195 | - st->data = data; | |
196 | - | |
197 | - if (hSession->listeners.state.last[tx]) | |
198 | - hSession->listeners.state.last[tx]->next = st; | |
199 | - else | |
200 | - hSession->listeners.state.callbacks[tx] = st; | |
201 | - | |
202 | - hSession->listeners.state.last[tx] = st; | |
203 | - | |
204 | - return (void *) st; | |
205 | - | |
206 | -} | |
207 | - | |
208 | -LIB3270_EXPORT int lib3270_unregister_schange(H3270 *hSession, LIB3270_STATE tx, const void * id) | |
209 | -{ | |
210 | - struct lib3270_state_callback *st; | |
211 | - struct lib3270_state_callback *prev = (struct lib3270_state_callback *) NULL; | |
212 | - | |
213 | -#ifdef DEBUG | |
214 | - { | |
215 | - debug("Before remove of %p (last=%p):",id,hSession->listeners.state.last[tx]); | |
216 | - | |
217 | - for (st = hSession->listeners.state.callbacks[tx]; st != (struct lib3270_state_callback *) NULL; st = (struct lib3270_state_callback *) st->next) | |
218 | - { | |
219 | - debug("%p",st); | |
220 | - } | |
221 | - } | |
222 | -#endif // DEBUG | |
223 | - | |
224 | - for (st = hSession->listeners.state.callbacks[tx]; st != (struct lib3270_state_callback *) NULL; st = (struct lib3270_state_callback *) st->next) | |
225 | - { | |
226 | - if (st == (struct lib3270_state_callback *)id) | |
227 | - break; | |
228 | - | |
229 | - prev = st; | |
230 | - } | |
231 | - | |
232 | - if (st == (struct lib3270_state_callback *)NULL) | |
233 | - { | |
234 | - lib3270_write_log(hSession,"lib3270","Invalid call to (%s): %p wasnt found in the list",__FUNCTION__,id); | |
235 | - return errno = ENOENT; | |
236 | - } | |
237 | - | |
238 | - if (prev != (struct lib3270_state_callback *) NULL) | |
239 | - prev->next = st->next; | |
240 | - else | |
241 | - hSession->listeners.state.callbacks[tx] = (struct lib3270_state_callback *) st->next; | |
242 | - | |
243 | - for(st = hSession->listeners.state.callbacks[tx]; st != (struct lib3270_state_callback *) NULL; st = (struct lib3270_state_callback *) st->next) | |
244 | - hSession->listeners.state.last[tx] = st; | |
245 | - | |
246 | - lib3270_free((void *) id); | |
247 | - | |
248 | -#ifdef DEBUG | |
249 | - { | |
250 | - debug("After Remove of %p (last=%p):",id,hSession->listeners.state.last[tx]); | |
251 | - | |
252 | - for (st = hSession->listeners.state.callbacks[tx]; st != (struct lib3270_state_callback *) NULL; st = (struct lib3270_state_callback *) st->next) | |
253 | - { | |
254 | - debug("%p",st); | |
255 | - } | |
256 | - } | |
257 | -#endif // DEBUG | |
258 | - | |
259 | - return 0; | |
260 | -} | |
261 | - | |
262 | - | |
263 | -/** | |
264 | 177 | * @brief Signal a state change. |
265 | 178 | */ |
266 | 179 | void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) |
267 | 180 | { |
181 | + /* | |
268 | 182 | #if defined(DEBUG) |
269 | 183 | static const char * state_name[LIB3270_STATE_USER] = |
270 | 184 | { |
... | ... | @@ -280,7 +194,16 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) |
280 | 194 | "LIB3270_STATE_CHARSET" |
281 | 195 | }; |
282 | 196 | #endif // DEBUG |
197 | + */ | |
198 | + | |
199 | + struct lib3270_linked_list_node * node; | |
200 | + | |
201 | + for(node = h->listeners.state[tx].first; node; node = node->next) | |
202 | + { | |
203 | + ((struct lib3270_state_callback *) node)->func(h,mode,node->userdata); | |
204 | + } | |
283 | 205 | |
206 | + /* | |
284 | 207 | struct lib3270_state_callback *st; |
285 | 208 | |
286 | 209 | CHECK_SESSION_HANDLE(h); |
... | ... | @@ -291,6 +214,7 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) |
291 | 214 | { |
292 | 215 | st->func(h,mode,st->data); |
293 | 216 | } |
217 | + */ | |
294 | 218 | |
295 | 219 | trace("%s ends",__FUNCTION__); |
296 | 220 | } | ... | ... |
src/core/keyboard/properties.c
... | ... | @@ -45,11 +45,22 @@ LIB3270_EXPORT int lib3270_set_lock_on_operator_error(H3270 *hSession, int enabl |
45 | 45 | return 0; |
46 | 46 | } |
47 | 47 | |
48 | +LIB3270_EXPORT int lib3270_set_numeric_lock(H3270 *hSession, int enable) | |
49 | +{ | |
50 | + hSession->numeric_lock = (enable ? 1 : 0); | |
51 | + return 0; | |
52 | +} | |
53 | + | |
48 | 54 | int lib3270_get_lock_on_operator_error(const H3270 *hSession) |
49 | 55 | { |
50 | 56 | return (int) hSession->oerr_lock; |
51 | 57 | } |
52 | 58 | |
59 | +int lib3270_get_numeric_lock(const H3270 *hSession) | |
60 | +{ | |
61 | + return (int) hSession->numeric_lock; | |
62 | +} | |
63 | + | |
53 | 64 | LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *hSession, unsigned int delay) |
54 | 65 | { |
55 | 66 | hSession->unlock_delay = (delay == 0 ? 0 : 1); | ... | ... |
... | ... | @@ -0,0 +1,139 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como linkedlist.c e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + | |
31 | +/** | |
32 | + * @brief Handle linked lists. | |
33 | + */ | |
34 | + | |
35 | + #include <lib3270.h> | |
36 | + #include <lib3270/log.h> | |
37 | + #include <linkedlist.h> | |
38 | + #include <string.h> | |
39 | + | |
40 | +/*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ | |
41 | + | |
42 | +void * lib3270_linked_list_append_node(struct lib3270_linked_list_head *head, size_t szBlock, void *userdata) | |
43 | +{ | |
44 | + struct lib3270_linked_list_node * node = lib3270_malloc(szBlock); | |
45 | + | |
46 | + memset(node,0,szBlock); | |
47 | + node->userdata = userdata; | |
48 | + | |
49 | + if(head->last) | |
50 | + { | |
51 | + head->last->next = node; | |
52 | + node->prev = head->last; | |
53 | + } | |
54 | + else | |
55 | + { | |
56 | + head->first = node; | |
57 | + } | |
58 | + | |
59 | + head->last = node; | |
60 | + | |
61 | +#ifdef DEBUG | |
62 | + { | |
63 | + struct lib3270_linked_list_node * dCurrent; | |
64 | + | |
65 | + debug("%s: head=%p first=%p last=%p", __FUNCTION__, head, head->first, head->last); | |
66 | + | |
67 | + for(dCurrent = head->first; dCurrent; dCurrent = dCurrent->next) | |
68 | + { | |
69 | + debug("node=%p prev=%p next=%p",dCurrent,dCurrent->prev,dCurrent->next); | |
70 | + } | |
71 | + | |
72 | + } | |
73 | +#endif // DEBUG | |
74 | + | |
75 | + return (void *) node; | |
76 | + | |
77 | +} | |
78 | + | |
79 | +int lib3270_linked_list_delete_node(struct lib3270_linked_list_head *head, const void *node) | |
80 | +{ | |
81 | + | |
82 | + struct lib3270_linked_list_node * current; | |
83 | + | |
84 | + for(current = head->first;current;current = current->next) | |
85 | + { | |
86 | + | |
87 | + if(current == node) | |
88 | + { | |
89 | + | |
90 | + if(current->prev) | |
91 | + current->prev->next = current->next; | |
92 | + else | |
93 | + head->first = current->next; | |
94 | + | |
95 | + if(current->next) | |
96 | + current->next->prev = current->prev; | |
97 | + else | |
98 | + head->last = current->prev; | |
99 | + | |
100 | + lib3270_free(current); | |
101 | + | |
102 | +#ifdef DEBUG | |
103 | + { | |
104 | + struct lib3270_linked_list_node * dCurrent; | |
105 | + | |
106 | + debug("%s: head=%p first=%p last=%p", __FUNCTION__, head, head->first, head->last); | |
107 | + | |
108 | + for(dCurrent = head->first; dCurrent; dCurrent = dCurrent->next) | |
109 | + { | |
110 | + debug("node=%p prev=%p next=%p",dCurrent,dCurrent->prev,dCurrent->next); | |
111 | + } | |
112 | + | |
113 | + } | |
114 | +#endif // DEBUG | |
115 | + | |
116 | + return 0; | |
117 | + | |
118 | + } | |
119 | + | |
120 | + } | |
121 | + | |
122 | + return errno = ENOENT; | |
123 | +} | |
124 | + | |
125 | +void lib3270_linked_list_free(struct lib3270_linked_list_head *head) | |
126 | +{ | |
127 | + struct lib3270_linked_list_node * node = head->first; | |
128 | + | |
129 | + while(node) | |
130 | + { | |
131 | + void * ptr = (void *) node; | |
132 | + node = node->next; | |
133 | + lib3270_free(ptr); | |
134 | + } | |
135 | + | |
136 | + head->first = head->last = NULL; | |
137 | + | |
138 | +} | |
139 | + | ... | ... |
src/core/properties/boolean.c
... | ... | @@ -163,6 +163,13 @@ |
163 | 163 | }, |
164 | 164 | |
165 | 165 | { |
166 | + .name = "numericlock", // Property name. | |
167 | + .description = N_( "numeric lock" ), // Property description. | |
168 | + .get = lib3270_get_numeric_lock, // Get value. | |
169 | + .set = lib3270_set_numeric_lock // Set value. | |
170 | + }, | |
171 | + | |
172 | + { | |
166 | 173 | .name = NULL, |
167 | 174 | .description = NULL, |
168 | 175 | .get = NULL, | ... | ... |
src/core/session.c
... | ... | @@ -91,25 +91,12 @@ void lib3270_session_free(H3270 *h) |
91 | 91 | |
92 | 92 | // Release state change callbacks |
93 | 93 | for(f=0;f<LIB3270_STATE_USER;f++) |
94 | - { | |
95 | - while(h->listeners.state.callbacks[f]) | |
96 | - { | |
97 | - struct lib3270_state_callback *next = h->listeners.state.callbacks[f]->next; | |
98 | - lib3270_free(h->listeners.state.callbacks[f]); | |
99 | - h->listeners.state.callbacks[f] = next; | |
100 | - } | |
101 | - } | |
94 | + lib3270_linked_list_free(&h->listeners.state[f]); | |
95 | + | |
102 | 96 | |
103 | 97 | // Release toggle change listeners. |
104 | 98 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) |
105 | - { | |
106 | - while(h->listeners.toggle.callbacks[f]) | |
107 | - { | |
108 | - struct lib3270_toggle_callback *next = h->listeners.toggle.callbacks[f]->next; | |
109 | - lib3270_free(h->listeners.toggle.callbacks[f]); | |
110 | - h->listeners.toggle.callbacks[f] = next; | |
111 | - } | |
112 | - } | |
99 | + lib3270_linked_list_free(&h->listeners.toggle[f]); | |
113 | 100 | |
114 | 101 | // Release memory |
115 | 102 | #define release_pointer(x) lib3270_free(x); x = NULL; | ... | ... |
src/core/toggles/getset.c
... | ... | @@ -57,18 +57,26 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_T |
57 | 57 | */ |
58 | 58 | static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_ID ix) |
59 | 59 | { |
60 | - struct lib3270_toggle_callback * st; | |
61 | - | |
62 | 60 | trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); |
61 | + | |
63 | 62 | t->upcall(session, t, LIB3270_TOGGLE_TYPE_INTERACTIVE); |
64 | 63 | |
65 | 64 | if(session->cbk.update_toggle) |
66 | 65 | session->cbk.update_toggle(session,ix,t->value,LIB3270_TOGGLE_TYPE_INTERACTIVE,toggle_descriptor[ix].name); |
67 | 66 | |
67 | + // Notify customers. | |
68 | + struct lib3270_linked_list_node * node; | |
69 | + for(node = session->listeners.toggle[ix].first; node; node = node->next) | |
70 | + { | |
71 | + ((struct lib3270_toggle_callback *) node)->func(session, ix, t->value, node->userdata); | |
72 | + } | |
73 | + | |
74 | + /* | |
68 | 75 | for(st = session->listeners.toggle.callbacks[ix]; st != (struct lib3270_toggle_callback *) NULL; st = (struct lib3270_toggle_callback *) st->next) |
69 | 76 | { |
70 | 77 | st->func(session, ix, t->value, st->data); |
71 | 78 | } |
79 | + */ | |
72 | 80 | |
73 | 81 | } |
74 | 82 | ... | ... |
src/core/toggles/listener.c
... | ... | @@ -46,20 +46,9 @@ |
46 | 46 | |
47 | 47 | LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LIB3270_TOGGLE_ID tx, void (*func)(H3270 *, LIB3270_TOGGLE_ID, char, void *),void *data) |
48 | 48 | { |
49 | - struct lib3270_toggle_callback *st; | |
49 | + struct lib3270_toggle_callback *st = (struct lib3270_toggle_callback *) lib3270_linked_list_append_node(&hSession->listeners.toggle[tx], sizeof(struct lib3270_toggle_callback), data); | |
50 | 50 | |
51 | - CHECK_SESSION_HANDLE(hSession); | |
52 | - | |
53 | - st = (struct lib3270_toggle_callback *) lib3270_malloc(sizeof(struct lib3270_toggle_callback)); | |
54 | - st->func = func; | |
55 | - st->data = data; | |
56 | - | |
57 | - if (hSession->listeners.toggle.last[tx]) | |
58 | - hSession->listeners.toggle.last[tx]->next = st; | |
59 | - else | |
60 | - hSession->listeners.toggle.callbacks[tx] = st; | |
61 | - | |
62 | - hSession->listeners.toggle.last[tx] = st; | |
51 | + st->func = func; | |
63 | 52 | |
64 | 53 | return (void *) st; |
65 | 54 | |
... | ... | @@ -67,33 +56,33 @@ LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LI |
67 | 56 | |
68 | 57 | LIB3270_EXPORT int lib3270_unregister_toggle_listener(H3270 *hSession, LIB3270_TOGGLE_ID tx, const void *id) |
69 | 58 | { |
70 | - struct lib3270_toggle_callback *st; | |
71 | - struct lib3270_toggle_callback *prev = (struct lib3270_toggle_callback *) NULL; | |
72 | - | |
73 | - for (st = hSession->listeners.toggle.callbacks[tx]; st != (struct lib3270_toggle_callback *) NULL; st = (struct lib3270_toggle_callback *) st->next) | |
74 | - { | |
75 | - if (st == (struct lib3270_toggle_callback *)id) | |
76 | - break; | |
59 | + return lib3270_linked_list_delete_node(&hSession->listeners.toggle[tx], id); | |
60 | +} | |
77 | 61 | |
78 | - prev = st; | |
79 | - } | |
62 | +/** | |
63 | + * @brief Register a function interested in a state change. | |
64 | + * | |
65 | + * @param hSession Session handle. | |
66 | + * @param tx State ID | |
67 | + * @param func Callback | |
68 | + * @param data Data | |
69 | + * | |
70 | + * @return State change identifier. | |
71 | + * | |
72 | + */ | |
73 | +LIB3270_EXPORT const void * lib3270_register_schange(H3270 *hSession, LIB3270_STATE tx, void (*func)(H3270 *, int, void *),void *data) | |
74 | +{ | |
75 | + struct lib3270_state_callback * st = (struct lib3270_state_callback *) lib3270_linked_list_append_node(&hSession->listeners.state[tx], sizeof(struct lib3270_state_callback), data); | |
80 | 76 | |
81 | - if (st == (struct lib3270_toggle_callback *)NULL) | |
82 | - { | |
83 | - lib3270_write_log(hSession,"lib3270","Invalid call to (%s): %p wasnt found in the list",__FUNCTION__,id); | |
84 | - return errno = ENOENT; | |
85 | - } | |
77 | + st->func = func; | |
86 | 78 | |
87 | - if (prev != (struct lib3270_toggle_callback *) NULL) | |
88 | - prev->next = st->next; | |
89 | - else | |
90 | - hSession->listeners.toggle.callbacks[tx] = (struct lib3270_toggle_callback *) st->next; | |
79 | + return (void *) st; | |
80 | +} | |
91 | 81 | |
92 | - for(st = hSession->listeners.toggle.callbacks[tx]; st != (struct lib3270_toggle_callback *) NULL; st = (struct lib3270_toggle_callback *) st->next) | |
93 | - hSession->listeners.toggle.last[tx] = st; | |
82 | +LIB3270_EXPORT int lib3270_unregister_schange(H3270 *hSession, LIB3270_STATE tx, const void * id) | |
83 | +{ | |
84 | + return lib3270_linked_list_delete_node(&hSession->listeners.state[tx], id); | |
85 | +} | |
94 | 86 | |
95 | - lib3270_free((void *) id); | |
96 | 87 | |
97 | - return 0; | |
98 | 88 | |
99 | -} | ... | ... |
src/include/lib3270-internals.h
... | ... | @@ -32,9 +32,9 @@ |
32 | 32 | #include <windows.h> |
33 | 33 | #endif // WIN32 |
34 | 34 | |
35 | -/* Autoconf settings. */ | |
36 | 35 | #include <config.h> /* autoconf settings */ |
37 | 36 | #include <lib3270.h> /* lib3270 API calls and defs */ |
37 | +#include <linkedlist.h> | |
38 | 38 | #include <lib3270/charset.h> |
39 | 39 | #include <lib3270/session.h> |
40 | 40 | // #include "api.h" |
... | ... | @@ -323,15 +323,15 @@ typedef struct _input_t |
323 | 323 | |
324 | 324 | struct lib3270_state_callback |
325 | 325 | { |
326 | - struct lib3270_state_callback * next; /**< @brief Next callback in chain */ | |
327 | - void * data; /**< @brief User data */ | |
328 | - void (*func)(H3270 *, int, void *); /**< @brief Function to call */ | |
326 | + LIB3270_LINKED_LIST_HEAD; | |
327 | + | |
328 | + void (*func)(H3270 *, int, void *); /**< @brief Function to call */ | |
329 | 329 | }; |
330 | 330 | |
331 | 331 | struct lib3270_toggle_callback |
332 | 332 | { |
333 | - struct lib3270_toggle_callback * next; /**< @brief Next callback in chain */ | |
334 | - void * data; /**< @brief User data */ | |
333 | + LIB3270_LINKED_LIST_HEAD; | |
334 | + | |
335 | 335 | void (*func)(H3270 *, LIB3270_TOGGLE_ID, char, void *); /**< @brief Function to call */ |
336 | 336 | }; |
337 | 337 | |
... | ... | @@ -695,22 +695,14 @@ struct _h3270 |
695 | 695 | void *userdata; |
696 | 696 | } trace; |
697 | 697 | |
698 | - // Listeners. | |
698 | + /// @brief Event Listeners. | |
699 | 699 | struct |
700 | 700 | { |
701 | - // State. | |
702 | - struct | |
703 | - { | |
704 | - struct lib3270_state_callback * callbacks[LIB3270_STATE_USER]; | |
705 | - struct lib3270_state_callback * last[LIB3270_STATE_USER]; | |
706 | - } state; | |
701 | + /// @brief State listeners. | |
702 | + struct lib3270_linked_list_head state[LIB3270_STATE_USER]; | |
707 | 703 | |
708 | - // Toggle change listeners | |
709 | - struct | |
710 | - { | |
711 | - struct lib3270_toggle_callback * callbacks[LIB3270_TOGGLE_COUNT]; | |
712 | - struct lib3270_toggle_callback * last[LIB3270_TOGGLE_COUNT]; | |
713 | - } toggle; | |
704 | + /// @brief Toggle listeners. | |
705 | + struct lib3270_linked_list_head toggle[LIB3270_TOGGLE_COUNT]; | |
714 | 706 | |
715 | 707 | } listeners; |
716 | 708 | ... | ... |
src/include/lib3270/keyboard.h
... | ... | @@ -85,6 +85,10 @@ |
85 | 85 | LIB3270_EXPORT int lib3270_set_lock_on_operator_error(H3270 *hSession, int enable); |
86 | 86 | LIB3270_EXPORT int lib3270_get_lock_on_operator_error(const H3270 *hSession); |
87 | 87 | |
88 | + LIB3270_EXPORT int lib3270_set_numeric_lock(H3270 *hSession, int enable); | |
89 | + LIB3270_EXPORT int lib3270_get_numeric_lock(const H3270 *hSession); | |
90 | + | |
91 | + | |
88 | 92 | #ifdef __cplusplus |
89 | 93 | } |
90 | 94 | #endif | ... | ... |
... | ... | @@ -0,0 +1,62 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como - e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | +/** | |
31 | + * @file linkedlist.h | |
32 | + * @brief Global declarations for linkedlist.c. | |
33 | + */ | |
34 | + | |
35 | +#ifndef LIB3270_LINKED_LIST_H_INCLUDED | |
36 | + | |
37 | + #define LIB3270_LINKED_LIST_H_INCLUDED | |
38 | + | |
39 | + #include <stddef.h> | |
40 | + #include <lib3270.h> | |
41 | + | |
42 | + #define LIB3270_LINKED_LIST_HEAD \ | |
43 | + struct lib3270_linked_list_node * prev; \ | |
44 | + struct lib3270_linked_list_node * next; \ | |
45 | + void * userdata; | |
46 | + | |
47 | + struct lib3270_linked_list_node | |
48 | + { | |
49 | + LIB3270_LINKED_LIST_HEAD | |
50 | + }; | |
51 | + | |
52 | + struct lib3270_linked_list_head | |
53 | + { | |
54 | + struct lib3270_linked_list_node * first; | |
55 | + struct lib3270_linked_list_node * last; | |
56 | + }; | |
57 | + | |
58 | + LIB3270_INTERNAL void * lib3270_linked_list_append_node(struct lib3270_linked_list_head *head, size_t szBlock, void *userdata); | |
59 | + LIB3270_INTERNAL int lib3270_linked_list_delete_node(struct lib3270_linked_list_head *head, const void *node); | |
60 | + LIB3270_INTERNAL void lib3270_linked_list_free(struct lib3270_linked_list_head *head); | |
61 | + | |
62 | +#endif // LIB3270_LINKED_LIST_H_INCLUDED | ... | ... |