Commit dfa26336b127c8a758c08095240592d3930c096e
1 parent
19db0d36
Exists in
master
and in
3 other branches
Refactoring the action table.
Showing
10 changed files
with
273 additions
and
167 deletions
Show diff stats
lib3270.cbp
... | ... | @@ -214,8 +214,6 @@ |
214 | 214 | <Unit filename="src/include/kybdc.h" /> |
215 | 215 | <Unit filename="src/include/lib3270-internals.h" /> |
216 | 216 | <Unit filename="src/include/lib3270.h" /> |
217 | - <Unit filename="src/include/lib3270/X11keysym.h" /> | |
218 | - <Unit filename="src/include/lib3270/action_table.h" /> | |
219 | 217 | <Unit filename="src/include/lib3270/actions.h" /> |
220 | 218 | <Unit filename="src/include/lib3270/charset.h" /> |
221 | 219 | <Unit filename="src/include/lib3270/filetransfer.h" /> | ... | ... |
src/core/actions/actions.c
... | ... | @@ -46,13 +46,15 @@ LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) |
46 | 46 | const LIB3270_ACTION_ENTRY *actions = lib3270_get_action_table(); |
47 | 47 | size_t f; |
48 | 48 | |
49 | - CHECK_SESSION_HANDLE(hSession); | |
50 | - | |
51 | 49 | for(f=0; actions[f].name; f++) |
52 | 50 | { |
53 | 51 | if(!strcasecmp(name,actions[f].name)) |
54 | 52 | { |
55 | - lib3270_trace_event(hSession,"Action: %s\n",actions[f].name); | |
53 | + lib3270_trace_event(hSession,"Action(%s): %s\n",actions[f].name, (actions[f].label ? actions[f].label : "")); | |
54 | + | |
55 | + if(!actions[f].enabled(hSession)) | |
56 | + return errno = EPERM; | |
57 | + | |
56 | 58 | return actions[f].call(hSession); |
57 | 59 | } |
58 | 60 | ... | ... |
src/core/actions/table.c
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple |
19 | 19 | * Place, Suite 330, Boston, MA, 02111-1307, USA |
20 | 20 | * |
21 | - * Este programa está nomeado como actions.c e possui - linhas de código. | |
21 | + * Este programa está nomeado como - e possui - linhas de código. | |
22 | 22 | * |
23 | 23 | * Contatos: |
24 | 24 | * |
... | ... | @@ -27,6 +27,11 @@ |
27 | 27 | * |
28 | 28 | */ |
29 | 29 | |
30 | +/** | |
31 | + * @brief Implements the action table. | |
32 | + * | |
33 | + */ | |
34 | + | |
30 | 35 | #include <lib3270-internals.h> |
31 | 36 | #include <lib3270/trace.h> |
32 | 37 | #include <lib3270/actions.h> |
... | ... | @@ -39,14 +44,19 @@ |
39 | 44 | return lib3270_save_all(hSession,NULL); |
40 | 45 | } |
41 | 46 | |
42 | - static int paste_file(H3270 *hSession) | |
47 | + static int save_selected(H3270 *hSession) | |
43 | 48 | { |
44 | - return lib3270_load(hSession,NULL); | |
49 | + return lib3270_save_selected(hSession,NULL); | |
45 | 50 | } |
46 | 51 | |
47 | - static int print(H3270 *hSession) | |
52 | + static int save_copy(H3270 *hSession) | |
48 | 53 | { |
49 | - return lib3270_print(hSession); | |
54 | + return lib3270_save_copy(hSession,NULL); | |
55 | + } | |
56 | + | |
57 | + static int paste_file(H3270 *hSession) | |
58 | + { | |
59 | + return lib3270_load(hSession,NULL); | |
50 | 60 | } |
51 | 61 | |
52 | 62 | static int connect_host(H3270 *hSession) |
... | ... | @@ -72,7 +82,8 @@ |
72 | 82 | "connect", |
73 | 83 | NULL, |
74 | 84 | N_( "Connect to host." ), |
75 | - connect_host | |
85 | + connect_host, | |
86 | + lib3270_is_disconnected | |
76 | 87 | }, |
77 | 88 | |
78 | 89 | { |
... | ... | @@ -81,7 +92,8 @@ |
81 | 92 | "disconnect", |
82 | 93 | NULL, |
83 | 94 | N_( "Disconnect from host." ), |
84 | - lib3270_disconnect | |
95 | + lib3270_disconnect, | |
96 | + lib3270_is_connected | |
85 | 97 | }, |
86 | 98 | |
87 | 99 | // |
... | ... | @@ -93,7 +105,8 @@ |
93 | 105 | NULL, |
94 | 106 | NULL, |
95 | 107 | N_( "Cursor up 1 position." ), |
96 | - lib3270_cursor_up | |
108 | + lib3270_cursor_up, | |
109 | + lib3270_is_connected | |
97 | 110 | }, |
98 | 111 | |
99 | 112 | { |
... | ... | @@ -102,7 +115,8 @@ |
102 | 115 | NULL, |
103 | 116 | NULL, |
104 | 117 | N_( "Cursor down 1 position." ), |
105 | - lib3270_cursor_down | |
118 | + lib3270_cursor_down, | |
119 | + lib3270_is_connected | |
106 | 120 | }, |
107 | 121 | |
108 | 122 | { |
... | ... | @@ -111,7 +125,8 @@ |
111 | 125 | NULL, |
112 | 126 | NULL, |
113 | 127 | N_( "Cursor left 1 position." ), |
114 | - lib3270_cursor_left | |
128 | + lib3270_cursor_left, | |
129 | + lib3270_is_connected | |
115 | 130 | }, |
116 | 131 | |
117 | 132 | { |
... | ... | @@ -120,7 +135,8 @@ |
120 | 135 | NULL, |
121 | 136 | NULL, |
122 | 137 | N_( "Cursor right 1 position." ), |
123 | - lib3270_cursor_right | |
138 | + lib3270_cursor_right, | |
139 | + lib3270_is_connected | |
124 | 140 | }, |
125 | 141 | |
126 | 142 | { |
... | ... | @@ -129,7 +145,8 @@ |
129 | 145 | NULL, |
130 | 146 | NULL, |
131 | 147 | N_( "Cursor to first field on next line or any lines after that." ), |
132 | - lib3270_newline | |
148 | + lib3270_newline, | |
149 | + lib3270_is_connected | |
133 | 150 | }, |
134 | 151 | |
135 | 152 | { |
... | ... | @@ -138,7 +155,8 @@ |
138 | 155 | NULL, |
139 | 156 | NULL, |
140 | 157 | N_( "Cursor to previous word." ), |
141 | - lib3270_previousword | |
158 | + lib3270_previousword, | |
159 | + lib3270_is_connected | |
142 | 160 | }, |
143 | 161 | |
144 | 162 | { |
... | ... | @@ -147,7 +165,8 @@ |
147 | 165 | NULL, |
148 | 166 | NULL, |
149 | 167 | N_( "Cursor to next unprotected word." ), |
150 | - lib3270_nextword | |
168 | + lib3270_nextword, | |
169 | + lib3270_is_connected | |
151 | 170 | }, |
152 | 171 | |
153 | 172 | // |
... | ... | @@ -159,7 +178,28 @@ |
159 | 178 | "document-save", |
160 | 179 | NULL, |
161 | 180 | N_( "Save screen." ), |
162 | - save_all | |
181 | + save_all, | |
182 | + lib3270_is_connected | |
183 | + }, | |
184 | + | |
185 | + { | |
186 | + "saveselected", | |
187 | + NULL, | |
188 | + NULL, | |
189 | + NULL, | |
190 | + N_( "Save selected area." ), | |
191 | + save_selected, | |
192 | + lib3270_has_selection | |
193 | + }, | |
194 | + | |
195 | + { | |
196 | + "savecopy", | |
197 | + NULL, | |
198 | + NULL, | |
199 | + NULL, | |
200 | + NULL, | |
201 | + save_copy, | |
202 | + lib3270_is_connected | |
163 | 203 | }, |
164 | 204 | |
165 | 205 | { |
... | ... | @@ -168,7 +208,8 @@ |
168 | 208 | "document-load", |
169 | 209 | NULL, |
170 | 210 | N_( "Paste file." ), |
171 | - paste_file | |
211 | + paste_file, | |
212 | + lib3270_is_connected | |
172 | 213 | }, |
173 | 214 | |
174 | 215 | // |
... | ... | @@ -180,16 +221,8 @@ |
180 | 221 | "edit-select-all", |
181 | 222 | NULL, |
182 | 223 | NULL, |
183 | - lib3270_select_all | |
184 | - }, | |
185 | - | |
186 | - { | |
187 | - "select_field", | |
188 | - "<Ctrl>f", | |
189 | - NULL, | |
190 | - NULL, | |
191 | - N_( "Select Field" ), | |
192 | - lib3270_select_field | |
224 | + lib3270_select_all, | |
225 | + lib3270_is_connected | |
193 | 226 | }, |
194 | 227 | |
195 | 228 | { |
... | ... | @@ -198,7 +231,8 @@ |
198 | 231 | NULL, |
199 | 232 | NULL, |
200 | 233 | N_( "Remove selection" ), |
201 | - lib3270_unselect | |
234 | + lib3270_unselect, | |
235 | + lib3270_has_selection | |
202 | 236 | }, |
203 | 237 | |
204 | 238 | { |
... | ... | @@ -207,20 +241,32 @@ |
207 | 241 | NULL, |
208 | 242 | NULL, |
209 | 243 | N_( "Reselect"), |
210 | - lib3270_reselect | |
244 | + lib3270_reselect, | |
245 | + lib3270_is_connected | |
211 | 246 | }, |
212 | 247 | |
213 | - | |
214 | 248 | // |
215 | 249 | // Field actions. |
216 | 250 | // |
217 | 251 | { |
252 | + "select_field", | |
253 | + "<Ctrl>f", | |
254 | + NULL, | |
255 | + NULL, | |
256 | + N_( "Select Field" ), | |
257 | + lib3270_select_field, | |
258 | + lib3270_is_formatted | |
259 | + }, | |
260 | + | |
261 | + | |
262 | + { | |
218 | 263 | "fieldend", |
219 | 264 | NULL, |
220 | 265 | NULL, |
221 | 266 | NULL, |
222 | 267 | N_( "Move the cursor to the first blank after the last nonblank in the field." ), |
223 | - lib3270_fieldend | |
268 | + lib3270_fieldend, | |
269 | + lib3270_is_formatted | |
224 | 270 | }, |
225 | 271 | |
226 | 272 | { |
... | ... | @@ -229,7 +275,8 @@ |
229 | 275 | "go-first", |
230 | 276 | NULL, |
231 | 277 | N_( "Move to first unprotected field on screen." ), |
232 | - lib3270_firstfield | |
278 | + lib3270_firstfield, | |
279 | + lib3270_is_formatted | |
233 | 280 | }, |
234 | 281 | |
235 | 282 | { |
... | ... | @@ -238,7 +285,8 @@ |
238 | 285 | "go-next", |
239 | 286 | NULL, |
240 | 287 | N_( "Tab forward to next field." ), |
241 | - lib3270_nextfield | |
288 | + lib3270_nextfield, | |
289 | + lib3270_is_formatted | |
242 | 290 | }, |
243 | 291 | |
244 | 292 | { |
... | ... | @@ -247,7 +295,8 @@ |
247 | 295 | "go-previous", |
248 | 296 | NULL, |
249 | 297 | N_( "Tab backward to previous field." ), |
250 | - lib3270_previousfield | |
298 | + lib3270_previousfield, | |
299 | + lib3270_is_formatted | |
251 | 300 | }, |
252 | 301 | |
253 | 302 | |
... | ... | @@ -260,7 +309,8 @@ |
260 | 309 | NULL, |
261 | 310 | NULL, |
262 | 311 | N_( "Backspaces the cursor until it hits the front of a word." ), |
263 | - lib3270_deleteword | |
312 | + lib3270_deleteword, | |
313 | + lib3270_is_connected | |
264 | 314 | }, |
265 | 315 | |
266 | 316 | { |
... | ... | @@ -269,7 +319,8 @@ |
269 | 319 | NULL, |
270 | 320 | NULL, |
271 | 321 | N_( "Delete field" ), |
272 | - lib3270_deletefield | |
322 | + lib3270_deletefield, | |
323 | + lib3270_is_formatted | |
273 | 324 | }, |
274 | 325 | |
275 | 326 | |
... | ... | @@ -279,7 +330,8 @@ |
279 | 330 | NULL, |
280 | 331 | NULL, |
281 | 332 | NULL, |
282 | - lib3270_eraseinput | |
333 | + lib3270_eraseinput, | |
334 | + lib3270_is_connected | |
283 | 335 | }, |
284 | 336 | |
285 | 337 | { |
... | ... | @@ -288,7 +340,8 @@ |
288 | 340 | NULL, |
289 | 341 | NULL, |
290 | 342 | N_( "Erase End Of Field Key." ), |
291 | - lib3270_eraseeof | |
343 | + lib3270_eraseeof, | |
344 | + lib3270_is_formatted | |
292 | 345 | }, |
293 | 346 | |
294 | 347 | { |
... | ... | @@ -297,7 +350,8 @@ |
297 | 350 | NULL, |
298 | 351 | NULL, |
299 | 352 | N_( "Erase End Of Line Key." ), |
300 | - lib3270_eraseeol | |
353 | + lib3270_eraseeol, | |
354 | + lib3270_is_connected | |
301 | 355 | }, |
302 | 356 | |
303 | 357 | { |
... | ... | @@ -306,7 +360,8 @@ |
306 | 360 | NULL, |
307 | 361 | NULL, |
308 | 362 | NULL, |
309 | - lib3270_erase | |
363 | + lib3270_erase, | |
364 | + lib3270_is_connected | |
310 | 365 | }, |
311 | 366 | |
312 | 367 | // |
... | ... | @@ -318,7 +373,8 @@ |
318 | 373 | NULL, |
319 | 374 | NULL, |
320 | 375 | N_( "Send an \"Enter\" action." ), |
321 | - lib3270_enter | |
376 | + lib3270_enter, | |
377 | + lib3270_is_connected | |
322 | 378 | }, |
323 | 379 | |
324 | 380 | |
... | ... | @@ -328,7 +384,8 @@ |
328 | 384 | NULL, |
329 | 385 | NULL, |
330 | 386 | NULL, |
331 | - lib3270_kybdreset | |
387 | + lib3270_kybdreset, | |
388 | + lib3270_is_connected | |
332 | 389 | }, |
333 | 390 | |
334 | 391 | { |
... | ... | @@ -337,7 +394,8 @@ |
337 | 394 | NULL, |
338 | 395 | NULL, |
339 | 396 | N_( "Clear AID key" ), |
340 | - lib3270_clear | |
397 | + lib3270_clear, | |
398 | + lib3270_is_connected | |
341 | 399 | }, |
342 | 400 | |
343 | 401 | |
... | ... | @@ -347,7 +405,8 @@ |
347 | 405 | NULL, |
348 | 406 | NULL, |
349 | 407 | NULL, |
350 | - lib3270_delete | |
408 | + lib3270_delete, | |
409 | + lib3270_is_connected | |
351 | 410 | }, |
352 | 411 | |
353 | 412 | { |
... | ... | @@ -356,7 +415,8 @@ |
356 | 415 | NULL, |
357 | 416 | NULL, |
358 | 417 | N_( "DUP key" ), |
359 | - lib3270_dup | |
418 | + lib3270_dup, | |
419 | + lib3270_is_connected | |
360 | 420 | }, |
361 | 421 | |
362 | 422 | { |
... | ... | @@ -365,7 +425,8 @@ |
365 | 425 | NULL, |
366 | 426 | NULL, |
367 | 427 | N_( "FM key" ), |
368 | - lib3270_fieldmark | |
428 | + lib3270_fieldmark, | |
429 | + lib3270_is_connected | |
369 | 430 | }, |
370 | 431 | |
371 | 432 | { |
... | ... | @@ -374,7 +435,8 @@ |
374 | 435 | NULL, |
375 | 436 | NULL, |
376 | 437 | N_( "3270-style backspace." ), |
377 | - lib3270_backspace | |
438 | + lib3270_backspace, | |
439 | + lib3270_is_connected | |
378 | 440 | }, |
379 | 441 | |
380 | 442 | { |
... | ... | @@ -382,8 +444,9 @@ |
382 | 444 | "<shift>Escape", |
383 | 445 | NULL, |
384 | 446 | NULL, |
385 | - "ATTN key, per RFC 2355. Sends IP, regardless.", | |
386 | - lib3270_attn | |
447 | + N_( "ATTN key, per RFC 2355. Sends IP, regardless." ), | |
448 | + lib3270_attn, | |
449 | + lib3270_is_connected | |
387 | 450 | }, |
388 | 451 | |
389 | 452 | { |
... | ... | @@ -392,7 +455,8 @@ |
392 | 455 | NULL, |
393 | 456 | NULL, |
394 | 457 | NULL, |
395 | - lib3270_break | |
458 | + lib3270_break, | |
459 | + lib3270_is_connected | |
396 | 460 | }, |
397 | 461 | |
398 | 462 | { |
... | ... | @@ -401,7 +465,8 @@ |
401 | 465 | NULL, |
402 | 466 | NULL, |
403 | 467 | NULL, |
404 | - lib3270_paste_next | |
468 | + lib3270_paste_next, | |
469 | + lib3270_is_connected | |
405 | 470 | }, |
406 | 471 | |
407 | 472 | { |
... | ... | @@ -410,7 +475,8 @@ |
410 | 475 | NULL, |
411 | 476 | NULL, |
412 | 477 | NULL, |
413 | - lib3270_sysreq | |
478 | + lib3270_sysreq, | |
479 | + lib3270_is_connected | |
414 | 480 | }, |
415 | 481 | |
416 | 482 | // |
... | ... | @@ -421,8 +487,39 @@ |
421 | 487 | "Print", |
422 | 488 | "document-print", |
423 | 489 | NULL, |
490 | + N_("If the terminal has selected area print tje selected area, if not, print all contents."), | |
491 | + lib3270_print, | |
492 | + lib3270_is_connected | |
493 | + }, | |
494 | + | |
495 | + { | |
496 | + "printall", | |
497 | + NULL, | |
498 | + NULL, | |
499 | + NULL, | |
500 | + N_("Print screen contents"), | |
501 | + lib3270_print_all, | |
502 | + lib3270_is_connected | |
503 | + }, | |
504 | + | |
505 | + { | |
506 | + "printselected", | |
507 | + NULL, | |
508 | + NULL, | |
424 | 509 | NULL, |
425 | ||
510 | + N_( "Print selected area." ), | |
511 | + lib3270_print_selected, | |
512 | + lib3270_has_selection | |
513 | + }, | |
514 | + | |
515 | + { | |
516 | + "printcopy", | |
517 | + NULL, | |
518 | + NULL, | |
519 | + NULL, | |
520 | + N_("Print copy (if available)"), | |
521 | + lib3270_print_copy, | |
522 | + lib3270_is_connected | |
426 | 523 | }, |
427 | 524 | |
428 | 525 | // |
... | ... | @@ -435,7 +532,8 @@ |
435 | 532 | NULL, |
436 | 533 | NULL, |
437 | 534 | NULL, |
438 | - lib3270_testpattern | |
535 | + lib3270_testpattern, | |
536 | + lib3270_is_disconnected | |
439 | 537 | }, |
440 | 538 | |
441 | 539 | { |
... | ... | @@ -444,7 +542,8 @@ |
444 | 542 | NULL, |
445 | 543 | NULL, |
446 | 544 | NULL, |
447 | - lib3270_charsettable | |
545 | + lib3270_charsettable, | |
546 | + lib3270_is_disconnected | |
448 | 547 | }, |
449 | 548 | |
450 | 549 | { |
... | ... | @@ -453,6 +552,7 @@ |
453 | 552 | NULL, |
454 | 553 | NULL, |
455 | 554 | NULL, |
555 | + NULL, | |
456 | 556 | NULL |
457 | 557 | } |
458 | 558 | }; | ... | ... |
src/core/ctlr.c
... | ... | @@ -318,10 +318,10 @@ static void ctlr_connect(H3270 *hSession, int GNUC_UNUSED(ignored), void GNUC_UN |
318 | 318 | hSession->crm_nattr = 0; |
319 | 319 | } |
320 | 320 | |
321 | -LIB3270_EXPORT int lib3270_get_is_formatted(const H3270 *hSession) | |
321 | +LIB3270_EXPORT int lib3270_is_formatted(const H3270 *hSession) | |
322 | 322 | { |
323 | 323 | if(check_online_session(hSession)) |
324 | - return -1; | |
324 | + return 0; | |
325 | 325 | |
326 | 326 | return hSession->formatted ? 1 : 0; |
327 | 327 | } | ... | ... |
src/core/properties/boolean.c
src/core/state.c
... | ... | @@ -51,7 +51,7 @@ LIB3270_EXPORT int lib3270_connected(const H3270 *h) |
51 | 51 | return ((int) h->cstate >= (int)LIB3270_CONNECTED_INITIAL); |
52 | 52 | } |
53 | 53 | |
54 | -LIB3270_EXPORT int lib3270_disconnected(const H3270 *h) | |
54 | +LIB3270_EXPORT int lib3270_is_disconnected(const H3270 *h) | |
55 | 55 | { |
56 | 56 | return ((int) h->cstate == (int)LIB3270_NOT_CONNECTED); |
57 | 57 | } | ... | ... |
... | ... | @@ -0,0 +1,95 @@ |
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. | |
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 actions.h 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 de Mendonça) | |
27 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + */ | |
31 | + | |
32 | + #error Deprecated | |
33 | + | |
34 | + /* | |
35 | + * Action call table. | |
36 | + * | |
37 | + * Usually this definitions are used to declare lib3270's action table but, | |
38 | + * if you redefine the creation macros it can be used to build a callback | |
39 | + * table for g_object_connect calls. | |
40 | + * | |
41 | + */ | |
42 | + | |
43 | + /* Keyboard actions */ | |
44 | + DECLARE_LIB3270_KEY_ACTION( enter, "Send an \"Enter\" action." ) | |
45 | + | |
46 | + DECLARE_LIB3270_FKEY_ACTION( pfkey, "" ) | |
47 | + DECLARE_LIB3270_FKEY_ACTION( pakey, "" ) | |
48 | + | |
49 | + /* Cursor movement */ | |
50 | + DECLARE_LIB3270_CURSOR_ACTION( up, "Cursor up 1 position." ) | |
51 | + DECLARE_LIB3270_CURSOR_ACTION( down, "Cursor down 1 position." ) | |
52 | + DECLARE_LIB3270_CURSOR_ACTION( left, "Cursor left 1 position." ) | |
53 | + DECLARE_LIB3270_CURSOR_ACTION( right, "Cursor right 1 position." ) | |
54 | + | |
55 | + DECLARE_LIB3270_ACTION( newline, "Cursor to first field on next line or any lines after that." ) | |
56 | + | |
57 | + /* Misc actions */ | |
58 | + DECLARE_LIB3270_ACTION( kybdreset, "" ) | |
59 | + DECLARE_LIB3270_ACTION( clear, "Clear AID key" ) | |
60 | + DECLARE_LIB3270_ACTION( eraseinput, "" ) | |
61 | + | |
62 | + DECLARE_LIB3270_ACTION( select_field, "" ) | |
63 | + DECLARE_LIB3270_ACTION( select_all, "" ) | |
64 | + DECLARE_LIB3270_ACTION( unselect, "" ) | |
65 | + DECLARE_LIB3270_ACTION( reselect, "" ) | |
66 | + | |
67 | + DECLARE_LIB3270_ACTION( eraseeof, "Erase End Of Field Key." ) | |
68 | + DECLARE_LIB3270_ACTION( eraseeol, "Erase End Of Line Key." ) | |
69 | + DECLARE_LIB3270_ACTION( erase, "" ) | |
70 | + DECLARE_LIB3270_ACTION( delete, "" ) | |
71 | + DECLARE_LIB3270_ACTION( dup, "DUP key" ) | |
72 | + DECLARE_LIB3270_ACTION( fieldmark, "FM key" ) | |
73 | + | |
74 | + DECLARE_LIB3270_ACTION( backspace, "3270-style backspace." ) | |
75 | + | |
76 | + DECLARE_LIB3270_ACTION( previousword, "Cursor to previous word." ) | |
77 | + DECLARE_LIB3270_ACTION( nextword, "Cursor to next unprotected word." ) | |
78 | + DECLARE_LIB3270_ACTION( fieldend, "Move the cursor to the first blank after the last nonblank in the field." ) | |
79 | + | |
80 | + DECLARE_LIB3270_ACTION( firstfield, "Move to first unprotected field on screen." ) | |
81 | + DECLARE_LIB3270_ACTION( nextfield, "" ) | |
82 | + DECLARE_LIB3270_ACTION( previousfield, "Tab backward to previous field." ) | |
83 | + | |
84 | + DECLARE_LIB3270_ACTION( attn, "ATTN key, per RFC 2355. Sends IP, regardless." ) | |
85 | + DECLARE_LIB3270_ACTION( break, "" ) | |
86 | + DECLARE_LIB3270_ACTION( pastenext, "" ) | |
87 | + | |
88 | + DECLARE_LIB3270_ACTION( deleteword, "Backspaces the cursor until it hits the front of a word (does a ^W)." ) | |
89 | + DECLARE_LIB3270_ACTION( deletefield, "Delete field key (does a ^U)." ) | |
90 | + DECLARE_LIB3270_ACTION( sysreq, "" ) | |
91 | + | |
92 | + DECLARE_LIB3270_ACTION( testpattern, "" ) | |
93 | + DECLARE_LIB3270_ACTION( charsettable, "" ) | |
94 | + | |
95 | + | ... | ... |
src/include/lib3270.h
... | ... | @@ -983,14 +983,15 @@ |
983 | 983 | |
984 | 984 | LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname); |
985 | 985 | |
986 | + LIB3270_EXPORT int lib3270_is_connected(const H3270 *h); | |
987 | + LIB3270_EXPORT int lib3270_is_disconnected(const H3270 *h); | |
988 | + | |
986 | 989 | LIB3270_EXPORT int lib3270_has_active_script(const H3270 *h); |
987 | 990 | LIB3270_EXPORT int lib3270_get_typeahead(const H3270 *h); |
988 | 991 | LIB3270_EXPORT int lib3270_get_undera(const H3270 *h); |
989 | 992 | LIB3270_EXPORT int lib3270_get_oia_box_solid(const H3270 *h); |
990 | 993 | LIB3270_EXPORT int lib3270_pconnected(const H3270 *h); |
991 | 994 | LIB3270_EXPORT int lib3270_half_connected(const H3270 *h); |
992 | - LIB3270_EXPORT int lib3270_connected(const H3270 *h); | |
993 | - LIB3270_EXPORT int lib3270_disconnected(const H3270 *h); | |
994 | 995 | LIB3270_EXPORT int lib3270_in_neither(const H3270 *h); |
995 | 996 | LIB3270_EXPORT int lib3270_in_ansi(const H3270 *h); |
996 | 997 | LIB3270_EXPORT int lib3270_in_3270(const H3270 *h); |
... | ... | @@ -1189,7 +1190,7 @@ |
1189 | 1190 | * @retval 0 Screen is not formatted. |
1190 | 1191 | * @retval 1 Screen is formatted. |
1191 | 1192 | */ |
1192 | - LIB3270_EXPORT int lib3270_get_is_formatted(const H3270 *hSession); | |
1193 | + LIB3270_EXPORT int lib3270_is_formatted(const H3270 *hSession); | |
1193 | 1194 | |
1194 | 1195 | /** |
1195 | 1196 | * @brief Get Check if the screen position is protected. | ... | ... |
src/include/lib3270/action_table.h
... | ... | @@ -1,95 +0,0 @@ |
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. | |
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 actions.h 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 de Mendonça) | |
27 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - */ | |
31 | - | |
32 | - #error Deprecated | |
33 | - | |
34 | - /* | |
35 | - * Action call table. | |
36 | - * | |
37 | - * Usually this definitions are used to declare lib3270's action table but, | |
38 | - * if you redefine the creation macros it can be used to build a callback | |
39 | - * table for g_object_connect calls. | |
40 | - * | |
41 | - */ | |
42 | - | |
43 | - /* Keyboard actions */ | |
44 | - DECLARE_LIB3270_KEY_ACTION( enter, "Send an \"Enter\" action." ) | |
45 | - | |
46 | - DECLARE_LIB3270_FKEY_ACTION( pfkey, "" ) | |
47 | - DECLARE_LIB3270_FKEY_ACTION( pakey, "" ) | |
48 | - | |
49 | - /* Cursor movement */ | |
50 | - DECLARE_LIB3270_CURSOR_ACTION( up, "Cursor up 1 position." ) | |
51 | - DECLARE_LIB3270_CURSOR_ACTION( down, "Cursor down 1 position." ) | |
52 | - DECLARE_LIB3270_CURSOR_ACTION( left, "Cursor left 1 position." ) | |
53 | - DECLARE_LIB3270_CURSOR_ACTION( right, "Cursor right 1 position." ) | |
54 | - | |
55 | - DECLARE_LIB3270_ACTION( newline, "Cursor to first field on next line or any lines after that." ) | |
56 | - | |
57 | - /* Misc actions */ | |
58 | - DECLARE_LIB3270_ACTION( kybdreset, "" ) | |
59 | - DECLARE_LIB3270_ACTION( clear, "Clear AID key" ) | |
60 | - DECLARE_LIB3270_ACTION( eraseinput, "" ) | |
61 | - | |
62 | - DECLARE_LIB3270_ACTION( select_field, "" ) | |
63 | - DECLARE_LIB3270_ACTION( select_all, "" ) | |
64 | - DECLARE_LIB3270_ACTION( unselect, "" ) | |
65 | - DECLARE_LIB3270_ACTION( reselect, "" ) | |
66 | - | |
67 | - DECLARE_LIB3270_ACTION( eraseeof, "Erase End Of Field Key." ) | |
68 | - DECLARE_LIB3270_ACTION( eraseeol, "Erase End Of Line Key." ) | |
69 | - DECLARE_LIB3270_ACTION( erase, "" ) | |
70 | - DECLARE_LIB3270_ACTION( delete, "" ) | |
71 | - DECLARE_LIB3270_ACTION( dup, "DUP key" ) | |
72 | - DECLARE_LIB3270_ACTION( fieldmark, "FM key" ) | |
73 | - | |
74 | - DECLARE_LIB3270_ACTION( backspace, "3270-style backspace." ) | |
75 | - | |
76 | - DECLARE_LIB3270_ACTION( previousword, "Cursor to previous word." ) | |
77 | - DECLARE_LIB3270_ACTION( nextword, "Cursor to next unprotected word." ) | |
78 | - DECLARE_LIB3270_ACTION( fieldend, "Move the cursor to the first blank after the last nonblank in the field." ) | |
79 | - | |
80 | - DECLARE_LIB3270_ACTION( firstfield, "Move to first unprotected field on screen." ) | |
81 | - DECLARE_LIB3270_ACTION( nextfield, "" ) | |
82 | - DECLARE_LIB3270_ACTION( previousfield, "Tab backward to previous field." ) | |
83 | - | |
84 | - DECLARE_LIB3270_ACTION( attn, "ATTN key, per RFC 2355. Sends IP, regardless." ) | |
85 | - DECLARE_LIB3270_ACTION( break, "" ) | |
86 | - DECLARE_LIB3270_ACTION( pastenext, "" ) | |
87 | - | |
88 | - DECLARE_LIB3270_ACTION( deleteword, "Backspaces the cursor until it hits the front of a word (does a ^W)." ) | |
89 | - DECLARE_LIB3270_ACTION( deletefield, "Delete field key (does a ^U)." ) | |
90 | - DECLARE_LIB3270_ACTION( sysreq, "" ) | |
91 | - | |
92 | - DECLARE_LIB3270_ACTION( testpattern, "" ) | |
93 | - DECLARE_LIB3270_ACTION( charsettable, "" ) | |
94 | - | |
95 | - |
src/include/lib3270/actions.h
... | ... | @@ -35,12 +35,13 @@ |
35 | 35 | |
36 | 36 | typedef struct _lib3270_action_entry |
37 | 37 | { |
38 | - const char *name; ///< @brief Action name. | |
39 | - const char *key; ///< @brief Default key (or NULL if no default). | |
40 | - const char *icon; ///< @brief Icon name (from https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) | |
41 | - const char *label; ///< @brief Label (or NULL). | |
42 | - const char *tooltip; ///< @brief Description (or NULL). | |
43 | - int (*call)(H3270 *hSession); ///< @brief lib3270 associated method. | |
38 | + const char *name; ///< @brief Action name. | |
39 | + const char *key; ///< @brief Default key (or NULL if no default). | |
40 | + const char *icon; ///< @brief Icon name (from https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) | |
41 | + const char *label; ///< @brief Button label (or NULL). | |
42 | + const char *summary; ///< @brief Short description (or NULL). | |
43 | + int (*call)(H3270 *hSession); ///< @brief lib3270 associated method. | |
44 | + int (*enabled)(const H3270 *hSession); ///< @brief Is the action enabled? | |
44 | 45 | } LIB3270_ACTION_ENTRY; |
45 | 46 | |
46 | 47 | /** |
... | ... | @@ -457,6 +458,10 @@ |
457 | 458 | * @param hSession TN3270 Session handle. |
458 | 459 | * @param name Name of the action to call. |
459 | 460 | * |
461 | + * @return The action return code. | |
462 | + * | |
463 | + * @retval EPERM Action is disabled. | |
464 | + * | |
460 | 465 | */ |
461 | 466 | LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); |
462 | 467 | ... | ... |