Commit 04c0ee5c557d63f0eb15ac0e7f0496d0ae7a5a6f
1 parent
053ca75f
Exists in
master
and in
3 other branches
+ Changing the management method for the action tables.
Showing
13 changed files
with
466 additions
and
330 deletions
Show diff stats
lib3270.cbp
... | ... | @@ -163,6 +163,9 @@ |
163 | 163 | <Unit filename="src/lib3270/macros.c"> |
164 | 164 | <Option compilerVar="CC" /> |
165 | 165 | </Unit> |
166 | + <Unit filename="src/lib3270/mkactions/mkactions.c"> | |
167 | + <Option compilerVar="CC" /> | |
168 | + </Unit> | |
166 | 169 | <Unit filename="src/lib3270/mkfb/mkfb.c"> |
167 | 170 | <Option compilerVar="CC" /> |
168 | 171 | </Unit> | ... | ... |
src/include/lib3270/action_table.h
... | ... | @@ -39,53 +39,55 @@ |
39 | 39 | */ |
40 | 40 | |
41 | 41 | /* Keyboard actions */ |
42 | - DECLARE_LIB3270_KEY_ACTION( enter ) | |
42 | + DECLARE_LIB3270_KEY_ACTION( enter, "Send an \"Enter\" action." ) | |
43 | 43 | |
44 | - DECLARE_LIB3270_FKEY_ACTION( pfkey ) | |
45 | - DECLARE_LIB3270_FKEY_ACTION( pakey ) | |
44 | + DECLARE_LIB3270_FKEY_ACTION( pfkey, "" ) | |
45 | + DECLARE_LIB3270_FKEY_ACTION( pakey, "" ) | |
46 | 46 | |
47 | 47 | /* Cursor movement */ |
48 | - DECLARE_LIB3270_CURSOR_ACTION( up ) | |
49 | - DECLARE_LIB3270_CURSOR_ACTION( down ) | |
50 | - DECLARE_LIB3270_CURSOR_ACTION( left ) | |
51 | - DECLARE_LIB3270_CURSOR_ACTION( right ) | |
52 | - DECLARE_LIB3270_CURSOR_ACTION( newline ) | |
48 | + DECLARE_LIB3270_CURSOR_ACTION( up, "Cursor up 1 position." ) | |
49 | + DECLARE_LIB3270_CURSOR_ACTION( down, "Cursor down 1 position." ) | |
50 | + DECLARE_LIB3270_CURSOR_ACTION( left, "Cursor left 1 position." ) | |
51 | + DECLARE_LIB3270_CURSOR_ACTION( right, "Cursor right 1 position." ) | |
52 | + | |
53 | + DECLARE_LIB3270_ACTION( newline, "Cursor to first field on next line or any lines after that." ) | |
53 | 54 | |
54 | 55 | /* Misc actions */ |
55 | - DECLARE_LIB3270_ACTION( kybdreset ) | |
56 | - DECLARE_LIB3270_ACTION( clear ) | |
57 | - DECLARE_LIB3270_ACTION( eraseinput ) | |
58 | - | |
59 | - DECLARE_LIB3270_ACTION( select_field ) | |
60 | - DECLARE_LIB3270_ACTION( select_all ) | |
61 | - DECLARE_LIB3270_ACTION( unselect ) | |
62 | - DECLARE_LIB3270_ACTION( reselect ) | |
63 | - | |
64 | - DECLARE_LIB3270_ACTION( firstfield ) | |
65 | - DECLARE_LIB3270_ACTION( eraseeof ) | |
66 | - DECLARE_LIB3270_ACTION( eraseeol ) | |
67 | - DECLARE_LIB3270_ACTION( erase ) | |
68 | - DECLARE_LIB3270_ACTION( delete ) | |
69 | - DECLARE_LIB3270_ACTION( dup ) | |
70 | - DECLARE_LIB3270_ACTION( fieldmark ) | |
71 | - | |
72 | - DECLARE_LIB3270_ACTION( backspace ) | |
73 | - DECLARE_LIB3270_ACTION( previousword ) | |
74 | - DECLARE_LIB3270_ACTION( nextword ) | |
75 | - DECLARE_LIB3270_ACTION( fieldend ) | |
76 | - | |
77 | - DECLARE_LIB3270_ACTION( nextfield ) | |
78 | - DECLARE_LIB3270_ACTION( previousfield ) | |
79 | - | |
80 | - DECLARE_LIB3270_ACTION( attn ) | |
81 | - DECLARE_LIB3270_ACTION( break ) | |
82 | - DECLARE_LIB3270_ACTION( pastenext ) | |
83 | - | |
84 | - DECLARE_LIB3270_ACTION( deleteword ) | |
85 | - DECLARE_LIB3270_ACTION( deletefield ) | |
86 | - DECLARE_LIB3270_ACTION( sysreq ) | |
87 | - | |
88 | - DECLARE_LIB3270_ACTION( testpattern ) | |
89 | - DECLARE_LIB3270_ACTION( charsettable ) | |
56 | + DECLARE_LIB3270_ACTION( kybdreset, "" ) | |
57 | + DECLARE_LIB3270_ACTION( clear, "Clear AID key" ) | |
58 | + DECLARE_LIB3270_ACTION( eraseinput, "" ) | |
59 | + | |
60 | + DECLARE_LIB3270_ACTION( select_field, "" ) | |
61 | + DECLARE_LIB3270_ACTION( select_all, "" ) | |
62 | + DECLARE_LIB3270_ACTION( unselect, "" ) | |
63 | + DECLARE_LIB3270_ACTION( reselect, "" ) | |
64 | + | |
65 | + DECLARE_LIB3270_ACTION( eraseeof, "Erase End Of Field Key." ) | |
66 | + DECLARE_LIB3270_ACTION( eraseeol, "Erase End Of Line Key." ) | |
67 | + DECLARE_LIB3270_ACTION( erase, "" ) | |
68 | + DECLARE_LIB3270_ACTION( delete, "" ) | |
69 | + DECLARE_LIB3270_ACTION( dup, "DUP key" ) | |
70 | + DECLARE_LIB3270_ACTION( fieldmark, "FM key" ) | |
71 | + | |
72 | + DECLARE_LIB3270_ACTION( backspace, "3270-style backspace." ) | |
73 | + | |
74 | + DECLARE_LIB3270_ACTION( previousword, "Cursor to previous word." ) | |
75 | + DECLARE_LIB3270_ACTION( nextword, "Cursor to next unprotected word." ) | |
76 | + DECLARE_LIB3270_ACTION( fieldend, "Move the cursor to the first blank after the last nonblank in the field." ) | |
77 | + | |
78 | + DECLARE_LIB3270_ACTION( firstfield, "Move to first unprotected field on screen." ) | |
79 | + DECLARE_LIB3270_ACTION( nextfield, "" ) | |
80 | + DECLARE_LIB3270_ACTION( previousfield, "Tab backward to previous field." ) | |
81 | + | |
82 | + DECLARE_LIB3270_ACTION( attn, "ATTN key, per RFC 2355. Sends IP, regardless." ) | |
83 | + DECLARE_LIB3270_ACTION( break, "" ) | |
84 | + DECLARE_LIB3270_ACTION( pastenext, "" ) | |
85 | + | |
86 | + DECLARE_LIB3270_ACTION( deleteword, "Backspaces the cursor until it hits the front of a word (does a ^W)." ) | |
87 | + DECLARE_LIB3270_ACTION( deletefield, "Delete field key (does a ^U)." ) | |
88 | + DECLARE_LIB3270_ACTION( sysreq, "" ) | |
89 | + | |
90 | + DECLARE_LIB3270_ACTION( testpattern, "" ) | |
91 | + DECLARE_LIB3270_ACTION( charsettable, "" ) | |
90 | 92 | |
91 | 93 | ... | ... |
src/include/lib3270/actions.h
... | ... | @@ -1,58 +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 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | |
30 | - * | |
31 | - */ | |
32 | - | |
33 | -#ifdef __cplusplus | |
34 | - extern "C" { | |
35 | -#endif | |
36 | - | |
37 | - // Standard actions | |
38 | - #define DECLARE_LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); | |
39 | - #define LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) | |
40 | - | |
41 | - // Single key actions | |
42 | - #define DECLARE_LIB3270_KEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); | |
43 | - #define LIB3270_KEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) | |
44 | - | |
45 | - // Cursor actions | |
46 | - #define DECLARE_LIB3270_CURSOR_ACTION( name ) LIB3270_EXPORT int lib3270_cursor_ ## name (H3270 *hSession); | |
47 | - #define LIB3270_CURSOR_ACTION( name ) LIB3270_EXPORT int lib3270_cursor_ ## name (H3270 *hSession) | |
48 | - | |
49 | - // PF & PA key actions | |
50 | - #define DECLARE_LIB3270_FKEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession, int key); | |
51 | - #define LIB3270_FKEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession, int key) | |
52 | - | |
53 | - // Load action table entries | |
54 | - #include <lib3270/action_table.h> | |
55 | - | |
56 | -#ifdef __cplusplus | |
57 | - } | |
58 | -#endif |
src/lib3270/Makefile.in
... | ... | @@ -84,8 +84,8 @@ DEPENDS= \ |
84 | 84 | Makefile \ |
85 | 85 | ../include/*.h \ |
86 | 86 | ../include/lib3270/*.h \ |
87 | - ../lib3270/*.h | |
88 | - | |
87 | + ../lib3270/*.h \ | |
88 | + $(BASEDIR)/src/include/lib3270/actions.h | |
89 | 89 | |
90 | 90 | CFLAGS= \ |
91 | 91 | @CFLAGS@ \ |
... | ... | @@ -286,6 +286,21 @@ $(BASEDIR)/.tmp/$(LIBNAME)/fallbacks.c: \ |
286 | 286 | @$(HOST_CC) -g -o $(BINDIR)/mkfb@EXEEXT@ $(wildcard mkfb/*.c) |
287 | 287 | @$(BINDIR)/mkfb@EXEEXT@ -c X3270.xad $@ |
288 | 288 | |
289 | +$(BASEDIR)/src/include/lib3270/actions.h: \ | |
290 | + ../include/lib3270/action_table.h \ | |
291 | + $(wildcard mkactions/*.c) | |
292 | + | |
293 | + @$(MKDIR) `dirname $@` | |
294 | + @$(MKDIR) $(BINDIR) | |
295 | + @echo $< ... | |
296 | + @$(HOST_CC) \ | |
297 | + -g \ | |
298 | + -I../include \ | |
299 | + -DBUILD_DATE=`date +%Y%m%d` \ | |
300 | + -o $(BINDIR)/mkactions@EXEEXT@ \ | |
301 | + $(wildcard mkactions/*.c) | |
302 | + @$(BINDIR)/mkactions@EXEEXT@ -o $@ | |
303 | + | |
289 | 304 | $(POTDIR)/$(LIBNAME).pot: \ |
290 | 305 | $(foreach SRC, $(basename $(SOURCES)), $(POTDIR)/$(LIBNAME)/$(SRC).pot) |
291 | 306 | |
... | ... | @@ -369,6 +384,7 @@ cleanDebug: |
369 | 384 | |
370 | 385 | @rm -fr $(OBJDBG) |
371 | 386 | @rm -fr $(BINDBG) |
387 | + @rm -fr $(BASEDIR)/src/include/lib3270/actions.h | |
372 | 388 | |
373 | 389 | cleanRelease: |
374 | 390 | |
... | ... | @@ -376,6 +392,7 @@ cleanRelease: |
376 | 392 | @rm -fr $(BINRLS) |
377 | 393 | @rm -fr $(POTDIR) |
378 | 394 | @rm -f lib$(LIBNAME).pot |
395 | + @rm -fr $(BASEDIR)/src/include/lib3270/actions.h | |
379 | 396 | |
380 | 397 | clean: \ |
381 | 398 | cleanDebug \ | ... | ... |
src/lib3270/actions.c
... | ... | @@ -48,11 +48,11 @@ LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) |
48 | 48 | #undef DECLARE_LIB3270_CURSOR_ACTION |
49 | 49 | #undef DECLARE_LIB3270_FKEY_ACTION |
50 | 50 | |
51 | - #define DECLARE_LIB3270_ACTION( name ) { #name, lib3270_ ## name }, | |
52 | - #define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name ) { #name, lib3270_ ## name }, | |
53 | - #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name }, | |
54 | - #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name }, | |
55 | - #define DECLARE_LIB3270_FKEY_ACTION( name ) // name | |
51 | + #define DECLARE_LIB3270_ACTION( name, description ) { #name, lib3270_ ## name }, | |
52 | + #define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name, description ) { #name, lib3270_ ## name }, | |
53 | + #define DECLARE_LIB3270_KEY_ACTION( name, description ) { #name, lib3270_ ## name }, | |
54 | + #define DECLARE_LIB3270_CURSOR_ACTION( name, description ) { #name, lib3270_cursor_ ## name }, | |
55 | + #define DECLARE_LIB3270_FKEY_ACTION( name, description ) // name | |
56 | 56 | |
57 | 57 | static const struct _action |
58 | 58 | { | ... | ... |
src/lib3270/charset.c
... | ... | @@ -204,9 +204,9 @@ static const unsigned short asc2uc[UT_SIZE] = |
204 | 204 | |
205 | 205 | typedef struct _info |
206 | 206 | { |
207 | - const char * name; | |
208 | - unsigned long cgcsgid; | |
209 | - const unsigned short const * chr; | |
207 | + const char * name; | |
208 | + unsigned long cgcsgid; | |
209 | + const unsigned short * chr; | |
210 | 210 | } remap; |
211 | 211 | |
212 | 212 | static const remap charset[] = |
... | ... | @@ -214,7 +214,7 @@ static const remap charset[] = |
214 | 214 | { |
215 | 215 | "us", |
216 | 216 | LIB3270_DEFAULT_CGEN | LIB3270_DEFAULT_CSET, |
217 | - (const unsigned short const []) | |
217 | + (const unsigned short []) | |
218 | 218 | { |
219 | 219 | 0x0000, 0x0000 |
220 | 220 | } |
... | ... | @@ -223,7 +223,7 @@ static const remap charset[] = |
223 | 223 | { |
224 | 224 | "bracket", |
225 | 225 | LIB3270_DEFAULT_CGEN|LIB3270_DEFAULT_CSET, |
226 | - (const unsigned short const []) | |
226 | + (const unsigned short []) | |
227 | 227 | { |
228 | 228 | 0x00ad, '[', |
229 | 229 | 0x00ba, XK_Yacute, |
... | ... | @@ -236,7 +236,7 @@ static const remap charset[] = |
236 | 236 | { |
237 | 237 | "cp500", |
238 | 238 | LIB3270_DEFAULT_CGEN|0x000001F4, |
239 | - (const unsigned short const []) | |
239 | + (const unsigned short []) | |
240 | 240 | { |
241 | 241 | 0x004a, '[', |
242 | 242 | 0x004f, '!', |
... | ... | @@ -345,7 +345,7 @@ LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession) |
345 | 345 | return hSession->charset.host; |
346 | 346 | } |
347 | 347 | |
348 | -LIB3270_ACTION( charsettable ) | |
348 | +LIB3270_EXPORT int lib3270_charsettable(H3270 *hSession) | |
349 | 349 | { |
350 | 350 | static const char * hChars = "0123456789ABCDEF"; |
351 | 351 | static const char * label = "Name:"; | ... | ... |
src/lib3270/kybd.c
... | ... | @@ -51,31 +51,21 @@ struct ta; |
51 | 51 | #if defined(X3270_APL) /*[*/ |
52 | 52 | #define XK_APL |
53 | 53 | #endif /*]*/ |
54 | -// #include <X11/keysym.h> | |
55 | 54 | |
56 | 55 | #include <fcntl.h> |
57 | 56 | #include "3270ds.h" |
58 | -// #include "appres.h" | |
59 | -// #include "ctlr.h" | |
60 | 57 | #include "resources.h" |
61 | 58 | |
62 | -//#include "actionsc.h" | |
63 | 59 | #include "ansic.h" |
64 | -//#include "aplc.h" | |
65 | 60 | #include "ctlrc.h" |
66 | 61 | #include "ftc.h" |
67 | 62 | #include "hostc.h" |
68 | -// #include "keypadc.h" | |
69 | 63 | #include "kybdc.h" |
70 | 64 | #include "popupsc.h" |
71 | 65 | // #include "printc.h" |
72 | 66 | #include "screenc.h" |
73 | 67 | #include "screen.h" |
74 | -// #if defined(X3270_DISPLAY) /*[*/ | |
75 | -// #include "selectc.h" | |
76 | -// #endif /*]*/ | |
77 | 68 | #include "statusc.h" |
78 | -// #include "tablesc.h" | |
79 | 69 | #include "telnetc.h" |
80 | 70 | #include "togglesc.h" |
81 | 71 | #include "trace_dsc.h" |
... | ... | @@ -84,6 +74,9 @@ struct ta; |
84 | 74 | #if defined(X3270_DBCS) /*[*/ |
85 | 75 | #include "widec.h" |
86 | 76 | #endif /*]*/ |
77 | + | |
78 | +#include <lib3270/actions.h> | |
79 | + | |
87 | 80 | #include "api.h" |
88 | 81 | |
89 | 82 | |
... | ... | @@ -526,14 +519,15 @@ static void key_AID(H3270 *hSession, unsigned char aid_code) |
526 | 519 | status_ctlr_done(hSession); |
527 | 520 | } |
528 | 521 | |
529 | -LIB3270_FKEY_ACTION( pfkey ) | |
522 | +LIB3270_EXPORT int lib3270_pfkey(H3270 *hSession, int key) | |
530 | 523 | { |
524 | + FAIL_IF_NOT_ONLINE(hSession) | |
531 | 525 | |
532 | 526 | if (key < 1 || key > PF_SZ) |
533 | - return EINVAL; | |
527 | + return errno = EINVAL; | |
534 | 528 | |
535 | 529 | if (hSession->kybdlock & KL_OIA_MINUS) |
536 | - return -1; | |
530 | + return errno = EPERM; | |
537 | 531 | |
538 | 532 | if (hSession->kybdlock) |
539 | 533 | { |
... | ... | @@ -553,15 +547,17 @@ LIB3270_FKEY_ACTION( pfkey ) |
553 | 547 | return 0; |
554 | 548 | } |
555 | 549 | |
556 | -LIB3270_FKEY_ACTION( pakey ) | |
550 | +LIB3270_EXPORT int lib3270_pakey(H3270 *hSession, int key) | |
557 | 551 | { |
552 | + FAIL_IF_NOT_ONLINE(hSession) | |
553 | + | |
558 | 554 | if (key < 1 || key > PA_SZ) |
559 | 555 | { |
560 | - return EINVAL; | |
556 | + return errno = EINVAL; | |
561 | 557 | } |
562 | 558 | |
563 | 559 | if (hSession->kybdlock & KL_OIA_MINUS) |
564 | - return -1; | |
560 | + return errno = EPERM; | |
565 | 561 | else if (hSession->kybdlock) |
566 | 562 | enq_key(hSession,pa_xlate[key-1]); |
567 | 563 | else |
... | ... | @@ -570,23 +566,23 @@ LIB3270_FKEY_ACTION( pakey ) |
570 | 566 | return 0; |
571 | 567 | } |
572 | 568 | |
573 | -LIB3270_ACTION(break) | |
569 | +LIB3270_EXPORT int lib3270_break(H3270 *hSession) | |
574 | 570 | { |
575 | 571 | if (!IN_3270) |
576 | - return 0; | |
572 | + return errno = ENOTCONN; | |
577 | 573 | |
578 | 574 | net_break(hSession); |
579 | 575 | |
580 | 576 | return 0; |
581 | 577 | } |
582 | 578 | |
583 | -/* | |
584 | - * ATTN key, per RFC 2355. Sends IP, regardless. | |
579 | +/*** | |
580 | + * @brief ATTN key, per RFC 2355. Sends IP, regardless. | |
585 | 581 | */ |
586 | -LIB3270_ACTION(attn) | |
582 | +LIB3270_EXPORT int lib3270_attn(H3270 *hSession) | |
587 | 583 | { |
588 | 584 | if (!IN_3270) |
589 | - return 0; | |
585 | + return errno = ENOTCONN; | |
590 | 586 | |
591 | 587 | net_interrupt(hSession); |
592 | 588 | |
... | ... | @@ -1018,10 +1014,10 @@ void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum |
1018 | 1014 | } |
1019 | 1015 | } |
1020 | 1016 | |
1021 | -LIB3270_ACTION( nextfield ) | |
1017 | +LIB3270_EXPORT int lib3270_nextfield(H3270 *hSession) | |
1022 | 1018 | { |
1023 | 1019 | |
1024 | -// reset_idle_timer(); | |
1020 | + FAIL_IF_NOT_ONLINE(hSession); | |
1025 | 1021 | |
1026 | 1022 | if (hSession->kybdlock) |
1027 | 1023 | { |
... | ... | @@ -1060,16 +1056,15 @@ LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession) |
1060 | 1056 | return EINVAL; |
1061 | 1057 | } |
1062 | 1058 | |
1063 | - | |
1064 | -/* | |
1065 | - * Tab backward to previous field. | |
1059 | +/** | |
1060 | + * @brief Tab backward to previous field. | |
1066 | 1061 | */ |
1067 | -LIB3270_ACTION( previousfield ) | |
1062 | +LIB3270_EXPORT int lib3270_previousfield(H3270 *hSession) | |
1068 | 1063 | { |
1069 | 1064 | register int baddr, nbaddr; |
1070 | 1065 | int sbaddr; |
1071 | 1066 | |
1072 | -// reset_idle_timer(); | |
1067 | + FAIL_IF_NOT_ONLINE(hSession); | |
1073 | 1068 | |
1074 | 1069 | if (hSession->kybdlock) |
1075 | 1070 | { |
... | ... | @@ -1187,20 +1182,20 @@ void do_reset(H3270 *hSession, Boolean explicit) |
1187 | 1182 | |
1188 | 1183 | } |
1189 | 1184 | |
1190 | -LIB3270_ACTION( kybdreset ) | |
1185 | +LIB3270_EXPORT int lib3270_kybdreset(H3270 *hSession) | |
1191 | 1186 | { |
1192 | 1187 | lib3270_unselect(hSession); |
1193 | 1188 | do_reset(hSession,True); |
1194 | 1189 | return 0; |
1195 | 1190 | } |
1196 | 1191 | |
1197 | - | |
1198 | -/* | |
1199 | - * Move to first unprotected field on screen. | |
1192 | +/** | |
1193 | + * @brief Move to first unprotected field on screen. | |
1200 | 1194 | */ |
1201 | -LIB3270_ACTION( firstfield ) | |
1195 | +LIB3270_EXPORT int lib3270_firstfield(H3270 *hSession) | |
1202 | 1196 | { |
1203 | -// reset_idle_timer(); | |
1197 | + FAIL_IF_NOT_ONLINE(hSession); | |
1198 | + | |
1204 | 1199 | if (hSession->kybdlock) |
1205 | 1200 | { |
1206 | 1201 | ENQUEUE_ACTION(lib3270_firstfield); |
... | ... | @@ -1222,9 +1217,8 @@ LIB3270_ACTION( firstfield ) |
1222 | 1217 | return 0; |
1223 | 1218 | } |
1224 | 1219 | |
1225 | - | |
1226 | -/* | |
1227 | - * Cursor left 1 position. | |
1220 | +/** | |
1221 | + * @brief Cursor left 1 position. | |
1228 | 1222 | */ |
1229 | 1223 | static void do_left(H3270 *hSession) |
1230 | 1224 | { |
... | ... | @@ -1239,8 +1233,10 @@ static void do_left(H3270 *hSession) |
1239 | 1233 | cursor_move(hSession,baddr); |
1240 | 1234 | } |
1241 | 1235 | |
1242 | -LIB3270_CURSOR_ACTION( left ) | |
1236 | +LIB3270_EXPORT int lib3270_cursor_left(H3270 *hSession) | |
1243 | 1237 | { |
1238 | + FAIL_IF_NOT_ONLINE(hSession); | |
1239 | + | |
1244 | 1240 | if (hSession->kybdlock) |
1245 | 1241 | { |
1246 | 1242 | if(KYBDLOCK_IS_OERR(hSession)) |
... | ... | @@ -1278,9 +1274,8 @@ LIB3270_CURSOR_ACTION( left ) |
1278 | 1274 | return 0; |
1279 | 1275 | } |
1280 | 1276 | |
1281 | - | |
1282 | 1277 | /** |
1283 | - * Delete char key. | |
1278 | + * @brief Delete char key. | |
1284 | 1279 | * |
1285 | 1280 | * @param hSession Session handle |
1286 | 1281 | * |
... | ... | @@ -1375,8 +1370,10 @@ static Boolean do_delete(H3270 *hSession) |
1375 | 1370 | return True; |
1376 | 1371 | } |
1377 | 1372 | |
1378 | -LIB3270_ACTION( delete ) | |
1373 | +LIB3270_EXPORT int lib3270_delete(H3270 *hSession) | |
1379 | 1374 | { |
1375 | + FAIL_IF_NOT_ONLINE(hSession); | |
1376 | + | |
1380 | 1377 | if (hSession->kybdlock) |
1381 | 1378 | { |
1382 | 1379 | ENQUEUE_ACTION(lib3270_delete); |
... | ... | @@ -1403,12 +1400,13 @@ LIB3270_ACTION( delete ) |
1403 | 1400 | return 0; |
1404 | 1401 | } |
1405 | 1402 | |
1406 | - | |
1407 | -/* | |
1408 | - * 3270-style backspace. | |
1403 | +/** | |
1404 | + * @brief 3270-style backspace. | |
1409 | 1405 | */ |
1410 | -LIB3270_ACTION( backspace ) | |
1406 | +LIB3270_EXPORT int lib3270_backspace(H3270 *hSession) | |
1411 | 1407 | { |
1408 | + FAIL_IF_NOT_ONLINE(hSession); | |
1409 | + | |
1412 | 1410 | if (hSession->kybdlock) |
1413 | 1411 | { |
1414 | 1412 | ENQUEUE_ACTION( lib3270_backspace ); |
... | ... | @@ -1435,9 +1433,8 @@ LIB3270_ACTION( backspace ) |
1435 | 1433 | return 0; |
1436 | 1434 | } |
1437 | 1435 | |
1438 | - | |
1439 | -/* | |
1440 | - * Destructive backspace, like Unix "erase". | |
1436 | +/** | |
1437 | + * @brief Destructive backspace, like Unix "erase". | |
1441 | 1438 | */ |
1442 | 1439 | static void do_erase(H3270 *hSession) |
1443 | 1440 | { |
... | ... | @@ -1501,9 +1498,10 @@ static void do_erase(H3270 *hSession) |
1501 | 1498 | hSession->cbk.display(hSession); |
1502 | 1499 | } |
1503 | 1500 | |
1504 | -LIB3270_ACTION( erase ) | |
1501 | +int lib3270_erase(H3270 *hSession) | |
1505 | 1502 | { |
1506 | -// reset_idle_timer(); | |
1503 | + FAIL_IF_NOT_ONLINE(hSession); | |
1504 | + | |
1507 | 1505 | if (hSession->kybdlock) |
1508 | 1506 | { |
1509 | 1507 | ENQUEUE_ACTION(lib3270_erase); |
... | ... | @@ -1521,13 +1519,15 @@ LIB3270_ACTION( erase ) |
1521 | 1519 | } |
1522 | 1520 | |
1523 | 1521 | /** |
1524 | - * Cursor right 1 position. | |
1522 | + * @brief Cursor right 1 position. | |
1525 | 1523 | */ |
1526 | -LIB3270_CURSOR_ACTION( right ) | |
1524 | +LIB3270_EXPORT int lib3270_cursor_right(H3270 *hSession) | |
1527 | 1525 | { |
1528 | 1526 | register int baddr; |
1529 | 1527 | enum dbcs_state d; |
1530 | 1528 | |
1529 | + FAIL_IF_NOT_ONLINE(hSession); | |
1530 | + | |
1531 | 1531 | if (hSession->kybdlock) |
1532 | 1532 | { |
1533 | 1533 | if (KYBDLOCK_IS_OERR(hSession)) |
... | ... | @@ -1563,18 +1563,18 @@ LIB3270_CURSOR_ACTION( right ) |
1563 | 1563 | return 0; |
1564 | 1564 | } |
1565 | 1565 | |
1566 | - | |
1567 | -/* | |
1568 | - * Cursor to previous word. | |
1566 | +/** | |
1567 | + * @brief Cursor to previous word. | |
1569 | 1568 | */ |
1570 | -LIB3270_ACTION( previousword ) | |
1569 | +LIB3270_EXPORT int lib3270_previousword(H3270 *hSession) | |
1571 | 1570 | { |
1572 | 1571 | register int baddr; |
1573 | 1572 | int baddr0; |
1574 | 1573 | unsigned char c; |
1575 | 1574 | Boolean prot; |
1576 | 1575 | |
1577 | -// reset_idle_timer(); | |
1576 | + FAIL_IF_NOT_ONLINE(hSession); | |
1577 | + | |
1578 | 1578 | if (hSession->kybdlock) { |
1579 | 1579 | ENQUEUE_ACTION(lib3270_previousword); |
1580 | 1580 | // enq_ta(PreviousWord_action, CN, CN); |
... | ... | @@ -1688,15 +1688,16 @@ static int nt_word(H3270 *hSession, int baddr) |
1688 | 1688 | } |
1689 | 1689 | |
1690 | 1690 | |
1691 | -/* | |
1692 | - * Cursor to next unprotected word. | |
1691 | +/** | |
1692 | + * @brief Cursor to next unprotected word. | |
1693 | 1693 | */ |
1694 | -LIB3270_ACTION( nextword ) | |
1694 | +LIB3270_EXPORT int lib3270_nextword(H3270 *hSession) | |
1695 | 1695 | { |
1696 | 1696 | register int baddr; |
1697 | 1697 | unsigned char c; |
1698 | 1698 | |
1699 | -// reset_idle_timer(); | |
1699 | + FAIL_IF_NOT_ONLINE(hSession); | |
1700 | + | |
1700 | 1701 | if (hSession->kybdlock) { |
1701 | 1702 | ENQUEUE_ACTION( lib3270_nextword ); |
1702 | 1703 | // enq_ta(NextWord_action, CN, CN); |
... | ... | @@ -1753,19 +1754,15 @@ LIB3270_ACTION( nextword ) |
1753 | 1754 | return 0; |
1754 | 1755 | } |
1755 | 1756 | |
1756 | - | |
1757 | - | |
1758 | 1757 | /** |
1759 | - * Cursor up 1 position. | |
1760 | - * | |
1761 | - * @return 0 | |
1762 | - * | |
1758 | + * @brief Cursor up 1 position. | |
1763 | 1759 | */ |
1764 | -LIB3270_CURSOR_ACTION( up ) | |
1760 | +LIB3270_EXPORT int lib3270_cursor_up(H3270 *hSession) | |
1765 | 1761 | { |
1766 | 1762 | register int baddr; |
1767 | 1763 | |
1768 | -// reset_idle_timer(); | |
1764 | + FAIL_IF_NOT_ONLINE(hSession); | |
1765 | + | |
1769 | 1766 | if (hSession->kybdlock) |
1770 | 1767 | { |
1771 | 1768 | if (KYBDLOCK_IS_OERR(hSession)) |
... | ... | @@ -1794,16 +1791,15 @@ LIB3270_CURSOR_ACTION( up ) |
1794 | 1791 | } |
1795 | 1792 | |
1796 | 1793 | /** |
1797 | - * Cursor down 1 position. | |
1798 | - * | |
1799 | - * @return 0 | |
1794 | + * @brief Cursor down 1 position. | |
1800 | 1795 | * |
1801 | 1796 | */ |
1802 | -LIB3270_CURSOR_ACTION( down ) | |
1797 | +LIB3270_EXPORT int lib3270_cursor_down(H3270 *hSession) | |
1803 | 1798 | { |
1804 | 1799 | register int baddr; |
1805 | 1800 | |
1806 | -// reset_idle_timer(); | |
1801 | + FAIL_IF_NOT_ONLINE(hSession); | |
1802 | + | |
1807 | 1803 | if (hSession->kybdlock) |
1808 | 1804 | { |
1809 | 1805 | if (KYBDLOCK_IS_OERR(hSession)) |
... | ... | @@ -1829,18 +1825,19 @@ LIB3270_CURSOR_ACTION( down ) |
1829 | 1825 | return 0; |
1830 | 1826 | } |
1831 | 1827 | |
1832 | - | |
1833 | 1828 | /** |
1834 | - * Cursor to first field on next line or any lines after that. | |
1829 | + * @brief Cursor to first field on next line or any lines after that. | |
1835 | 1830 | */ |
1836 | -LIB3270_CURSOR_ACTION( newline ) | |
1831 | +LIB3270_EXPORT int lib3270_newline(H3270 *hSession) | |
1837 | 1832 | { |
1838 | 1833 | register int baddr, faddr; |
1839 | 1834 | register unsigned char fa; |
1840 | 1835 | |
1836 | + FAIL_IF_NOT_ONLINE(hSession); | |
1837 | + | |
1841 | 1838 | if (hSession->kybdlock) |
1842 | 1839 | { |
1843 | - ENQUEUE_ACTION(lib3270_cursor_newline); | |
1840 | + ENQUEUE_ACTION(lib3270_newline); | |
1844 | 1841 | return 0; |
1845 | 1842 | } |
1846 | 1843 | #if defined(X3270_ANSI) /*[*/ |
... | ... | @@ -1862,12 +1859,13 @@ LIB3270_CURSOR_ACTION( newline ) |
1862 | 1859 | return 0; |
1863 | 1860 | } |
1864 | 1861 | |
1865 | - | |
1866 | -/* | |
1867 | - * DUP key | |
1862 | +/** | |
1863 | + * @brief DUP key | |
1868 | 1864 | */ |
1869 | -LIB3270_ACTION( dup ) | |
1865 | +LIB3270_EXPORT int lib3270_dup(H3270 *hSession) | |
1870 | 1866 | { |
1867 | + FAIL_IF_NOT_ONLINE(hSession); | |
1868 | + | |
1871 | 1869 | if (hSession->kybdlock) |
1872 | 1870 | { |
1873 | 1871 | ENQUEUE_ACTION(lib3270_dup); |
... | ... | @@ -1886,11 +1884,13 @@ LIB3270_ACTION( dup ) |
1886 | 1884 | return 0; |
1887 | 1885 | } |
1888 | 1886 | |
1889 | -/* | |
1890 | - * FM key | |
1887 | +/** | |
1888 | + * @brief FM key | |
1891 | 1889 | */ |
1892 | -LIB3270_ACTION( fieldmark ) | |
1890 | +LIB3270_EXPORT int lib3270_fieldmark(H3270 *hSession) | |
1893 | 1891 | { |
1892 | + FAIL_IF_NOT_ONLINE(hSession); | |
1893 | + | |
1894 | 1894 | if (hSession->kybdlock) |
1895 | 1895 | { |
1896 | 1896 | ENQUEUE_ACTION(lib3270_fieldmark); |
... | ... | @@ -1906,36 +1906,50 @@ LIB3270_ACTION( fieldmark ) |
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | /** |
1909 | - * Send an "Enter" action. | |
1909 | + * @brief Send an "Enter" action. | |
1910 | 1910 | * |
1911 | 1911 | * Called when the user press the key enter. |
1912 | 1912 | * |
1913 | - * @return 0 if ok, -1 if the action can't be performed. | |
1914 | - * | |
1915 | 1913 | */ |
1916 | -LIB3270_KEY_ACTION( enter ) | |
1914 | +LIB3270_EXPORT int lib3270_enter(H3270 *hSession) | |
1917 | 1915 | { |
1916 | + FAIL_IF_NOT_ONLINE(hSession); | |
1917 | + | |
1918 | 1918 | trace("%s (kybdlock & KL_OIA_MINUS): %d kybdlock: %d",__FUNCTION__,(hSession->kybdlock & KL_OIA_MINUS),hSession->kybdlock); |
1919 | 1919 | |
1920 | 1920 | if (hSession->kybdlock & KL_OIA_MINUS) |
1921 | + { | |
1922 | + errno = EPERM; | |
1921 | 1923 | return -1; |
1924 | + } | |
1922 | 1925 | else if (hSession->kybdlock) |
1926 | + { | |
1923 | 1927 | ENQUEUE_ACTION(lib3270_enter); |
1928 | + } | |
1924 | 1929 | else |
1930 | + { | |
1925 | 1931 | key_AID(hSession,AID_ENTER); |
1932 | + } | |
1926 | 1933 | |
1927 | 1934 | return 0; |
1928 | 1935 | } |
1929 | 1936 | |
1930 | -LIB3270_ACTION( sysreq ) | |
1937 | +LIB3270_EXPORT int lib3270_sysreq(H3270 *hSession) | |
1931 | 1938 | { |
1932 | -// reset_idle_timer(); | |
1939 | + FAIL_IF_NOT_ONLINE(hSession); | |
1940 | + | |
1933 | 1941 | if (IN_ANSI) |
1942 | + { | |
1943 | + errno = ENOTCONN; | |
1934 | 1944 | return 0; |
1945 | + } | |
1946 | + | |
1935 | 1947 | #if defined(X3270_TN3270E) /*[*/ |
1936 | - if (IN_E) { | |
1948 | + if (IN_E) | |
1949 | + { | |
1937 | 1950 | net_abort(hSession); |
1938 | - } else | |
1951 | + } | |
1952 | + else | |
1939 | 1953 | #endif /*]*/ |
1940 | 1954 | { |
1941 | 1955 | if (hSession->kybdlock & KL_OIA_MINUS) |
... | ... | @@ -1945,14 +1959,14 @@ LIB3270_ACTION( sysreq ) |
1945 | 1959 | else |
1946 | 1960 | key_AID(hSession,AID_SYSREQ); |
1947 | 1961 | } |
1962 | + | |
1948 | 1963 | return 0; |
1949 | 1964 | } |
1950 | 1965 | |
1951 | - | |
1952 | -/* | |
1953 | - * Clear AID key | |
1966 | +/** | |
1967 | + * @brief Clear AID key | |
1954 | 1968 | */ |
1955 | -LIB3270_ACTION( clear ) | |
1969 | +LIB3270_EXPORT int lib3270_clear(H3270 *hSession) | |
1956 | 1970 | { |
1957 | 1971 | // reset_idle_timer(); |
1958 | 1972 | if (hSession->kybdlock & KL_OIA_MINUS) |
... | ... | @@ -1976,10 +1990,10 @@ LIB3270_ACTION( clear ) |
1976 | 1990 | } |
1977 | 1991 | |
1978 | 1992 | /** |
1979 | - * Erase End Of Line Key. | |
1993 | + * @brief Erase End Of Line Key. | |
1980 | 1994 | * |
1981 | 1995 | */ |
1982 | -LIB3270_ACTION( eraseeol ) | |
1996 | +LIB3270_EXPORT int lib3270_eraseeol(H3270 *hSession) | |
1983 | 1997 | { |
1984 | 1998 | register int baddr; |
1985 | 1999 | register unsigned char fa; |
... | ... | @@ -2044,10 +2058,10 @@ LIB3270_ACTION( eraseeol ) |
2044 | 2058 | } |
2045 | 2059 | |
2046 | 2060 | /** |
2047 | - * Erase End Of Field Key. | |
2061 | + * @brief Erase End Of Field Key. | |
2048 | 2062 | * |
2049 | 2063 | */ |
2050 | -LIB3270_ACTION( eraseeof ) | |
2064 | +LIB3270_EXPORT int lib3270_eraseeof(H3270 *hSession) | |
2051 | 2065 | { |
2052 | 2066 | register int baddr; |
2053 | 2067 | register unsigned char fa; |
... | ... | @@ -2100,7 +2114,7 @@ LIB3270_ACTION( eraseeof ) |
2100 | 2114 | return 0; |
2101 | 2115 | } |
2102 | 2116 | |
2103 | -LIB3270_ACTION( eraseinput ) | |
2117 | +LIB3270_EXPORT int lib3270_eraseinput(H3270 *hSession) | |
2104 | 2118 | { |
2105 | 2119 | register int baddr, sbaddr; |
2106 | 2120 | unsigned char fa; |
... | ... | @@ -2157,15 +2171,16 @@ LIB3270_ACTION( eraseinput ) |
2157 | 2171 | } |
2158 | 2172 | |
2159 | 2173 | |
2160 | - | |
2161 | -/* | |
2162 | - * Delete word key. Backspaces the cursor until it hits the front of a word, | |
2174 | +/** | |
2175 | + * @brief Delete word key. | |
2176 | + | |
2177 | + * Backspaces the cursor until it hits the front of a word, | |
2163 | 2178 | * deletes characters until it hits a blank or null, and deletes all of these |
2164 | 2179 | * but the last. |
2165 | 2180 | * |
2166 | 2181 | * Which is to say, does a ^W. |
2167 | 2182 | */ |
2168 | -LIB3270_ACTION( deleteword ) | |
2183 | +LIB3270_EXPORT int lib3270_deleteword(H3270 *hSession) | |
2169 | 2184 | { |
2170 | 2185 | register int baddr; |
2171 | 2186 | register unsigned char fa; |
... | ... | @@ -2225,14 +2240,16 @@ LIB3270_ACTION( deleteword ) |
2225 | 2240 | return 0; |
2226 | 2241 | } |
2227 | 2242 | |
2228 | -/* | |
2229 | - * Delete field key. Similar to EraseEOF, but it wipes out the entire field | |
2243 | +/** | |
2244 | + * @brief Delete field key. | |
2245 | + | |
2246 | + * Similar to EraseEOF, but it wipes out the entire field | |
2230 | 2247 | * rather than just to the right of the cursor, and it leaves the cursor at |
2231 | 2248 | * the front of the field. |
2232 | 2249 | * |
2233 | 2250 | * Which is to say, does a ^U. |
2234 | 2251 | */ |
2235 | -LIB3270_ACTION( deletefield ) | |
2252 | +LIB3270_EXPORT int lib3270_deletefield(H3270 *hSession) | |
2236 | 2253 | { |
2237 | 2254 | register int baddr; |
2238 | 2255 | register unsigned char fa; |
... | ... | @@ -2272,72 +2289,14 @@ LIB3270_ACTION( deletefield ) |
2272 | 2289 | } |
2273 | 2290 | |
2274 | 2291 | |
2275 | - | |
2276 | -/* | |
2277 | - * Set insert mode key. | |
2278 | - */ /* | |
2279 | -void | |
2280 | -Insert_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | |
2281 | -{ | |
2282 | -// reset_idle_timer(); | |
2283 | - if (kybdlock) { | |
2284 | - enq_ta(Insert_action, CN, CN); | |
2285 | - return; | |
2286 | - } | |
2287 | -#if defined(X3270_ANSI) | |
2288 | - if (IN_ANSI) | |
2289 | - return; | |
2290 | -#endif | |
2291 | - set_toggle(INSERT,True); | |
2292 | -} | |
2293 | -*/ | |
2294 | - | |
2295 | - | |
2296 | -/* | |
2297 | - * Toggle insert mode key. | |
2298 | - */ /* | |
2299 | -void | |
2300 | -ToggleInsert_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | |
2301 | -{ | |
2302 | -// reset_idle_timer(); | |
2303 | - if (kybdlock) { | |
2304 | - enq_ta(ToggleInsert_action, CN, CN); | |
2305 | - return; | |
2306 | - } | |
2307 | -#if defined(X3270_ANSI) | |
2308 | - if (IN_ANSI) | |
2309 | - return; | |
2310 | -#endif | |
2311 | - | |
2312 | - do_toggle(INSERT); | |
2313 | -} | |
2314 | -*/ | |
2315 | - | |
2316 | - | |
2317 | -/* | |
2318 | - * Toggle reverse mode key. | |
2319 | - */ /* | |
2320 | -void | |
2321 | -ToggleReverse_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | |
2322 | -{ | |
2323 | -// reset_idle_timer(); | |
2324 | - if (kybdlock) { | |
2325 | - enq_ta(ToggleReverse_action, CN, CN); | |
2326 | - return; | |
2327 | - } | |
2328 | -#if defined(X3270_ANSI) | |
2329 | - if (IN_ANSI) | |
2330 | - return; | |
2331 | -#endif | |
2332 | - reverse_mode(!reverse); | |
2333 | -} */ | |
2334 | - | |
2335 | - | |
2336 | -/* | |
2292 | +/** | |
2293 | + * @brief Move the cursor to the first blank after the last nonblank in the field. | |
2294 | + * | |
2337 | 2295 | * Move the cursor to the first blank after the last nonblank in the |
2338 | 2296 | * field, or if the field is full, to the last character in the field. |
2297 | + * | |
2339 | 2298 | */ |
2340 | -LIB3270_ACTION( fieldend ) | |
2299 | +LIB3270_EXPORT int lib3270_fieldend(H3270 *hSession) | |
2341 | 2300 | { |
2342 | 2301 | int baddr; |
2343 | 2302 | |
... | ... | @@ -2400,7 +2359,7 @@ int lib3270_get_field_end(H3270 *hSession, int baddr) |
2400 | 2359 | } |
2401 | 2360 | |
2402 | 2361 | /** |
2403 | - * PA key action for String actions | |
2362 | + * @brief PA key action for String actions. | |
2404 | 2363 | */ |
2405 | 2364 | static void do_pa(H3270 *hSession, unsigned n) |
2406 | 2365 | { |
... | ... | @@ -2415,7 +2374,7 @@ static void do_pa(H3270 *hSession, unsigned n) |
2415 | 2374 | } |
2416 | 2375 | |
2417 | 2376 | /** |
2418 | - * PF key action for String actions | |
2377 | + * @brief PF key action for String actions. | |
2419 | 2378 | */ |
2420 | 2379 | static void do_pf(H3270 *hSession, unsigned n) |
2421 | 2380 | { |
... | ... | @@ -2429,20 +2388,6 @@ static void do_pf(H3270 *hSession, unsigned n) |
2429 | 2388 | } |
2430 | 2389 | |
2431 | 2390 | /* |
2432 | - * Set or clear the keyboard scroll lock. | |
2433 | - */ /* | |
2434 | -void | |
2435 | -kybd_scroll_lock(Boolean lock) | |
2436 | -{ | |
2437 | - if (!IN_3270) | |
2438 | - return; | |
2439 | - if (lock) | |
2440 | - kybdlock_set(KL_SCROLLED, "kybd_scroll_lock"); | |
2441 | - else | |
2442 | - kybdlock_clr(hSession, KL_SCROLLED, "kybd_scroll_lock"); | |
2443 | -} */ | |
2444 | - | |
2445 | -/* | |
2446 | 2391 | * Move the cursor back within the legal paste area. |
2447 | 2392 | * Returns a Boolean indicating success. |
2448 | 2393 | */ | ... | ... |
src/lib3270/macros.c
... | ... | @@ -356,10 +356,10 @@ |
356 | 356 | } |
357 | 357 | action[] = |
358 | 358 | { |
359 | - #define DECLARE_LIB3270_ACTION( name ) { #name, lib3270_ ## name }, | |
360 | - #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name }, | |
361 | - #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name }, | |
362 | - #define DECLARE_LIB3270_FKEY_ACTION( name ) /* */ | |
359 | + #define DECLARE_LIB3270_ACTION( name, description ) { #name, lib3270_ ## name }, | |
360 | + #define DECLARE_LIB3270_KEY_ACTION( name, description ) { #name, lib3270_ ## name }, | |
361 | + #define DECLARE_LIB3270_CURSOR_ACTION( name, description ) { #name, lib3270_cursor_ ## name }, | |
362 | + #define DECLARE_LIB3270_FKEY_ACTION( name, description ) /* */ | |
363 | 363 | |
364 | 364 | #include <lib3270/action_table.h> |
365 | 365 | ... | ... |
... | ... | @@ -0,0 +1,189 @@ |
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 mkfb.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 | + * @brief Utility to create the actions definition files. | |
32 | + * | |
33 | + */ | |
34 | + | |
35 | +#include <getopt.h> | |
36 | +#include <stdio.h> | |
37 | + | |
38 | +#define DECLARE_LIB3270_ACTION( name, description ) \ | |
39 | + { \ | |
40 | + description, \ | |
41 | + NULL, \ | |
42 | + "LIB3270_EXPORT int lib3270_" # name "(H3270 *hSession);" \ | |
43 | + }, | |
44 | + | |
45 | +#define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name, description ) \ | |
46 | + { \ | |
47 | + description, \ | |
48 | + NULL, \ | |
49 | + "LIB3270_EXPORT int lib3270_" # name "(H3270 *hSession);" \ | |
50 | + }, | |
51 | + | |
52 | +#define DECLARE_LIB3270_KEY_ACTION( name, description ) \ | |
53 | + { \ | |
54 | + description, \ | |
55 | + NULL, \ | |
56 | + "LIB3270_EXPORT int lib3270_" # name "(H3270 *hSession);" \ | |
57 | + }, | |
58 | + | |
59 | +#define DECLARE_LIB3270_CURSOR_ACTION( name, description ) \ | |
60 | + { \ | |
61 | + description, \ | |
62 | + NULL, \ | |
63 | + "LIB3270_EXPORT int lib3270_cursor_" # name "(H3270 *hSession);" \ | |
64 | + }, | |
65 | + | |
66 | +#define DECLARE_LIB3270_FKEY_ACTION( name, description ) \ | |
67 | + { \ | |
68 | + description, \ | |
69 | + "keycode\tNumber of the " #name " to activate.", \ | |
70 | + "LIB3270_EXPORT int lib3270_" # name "(H3270 *hSession, int keycode);" \ | |
71 | + }, | |
72 | + | |
73 | + | |
74 | +static struct { | |
75 | + const char *description; | |
76 | + const char *args; | |
77 | + const char *prototype; | |
78 | +} actions[] = { | |
79 | + #include <lib3270/action_table.h> | |
80 | +}; | |
81 | + | |
82 | + | |
83 | +int main(int argc, char *argv[]) { | |
84 | + | |
85 | + enum _format { | |
86 | + FORMAT_HEADER | |
87 | + } format = FORMAT_HEADER; | |
88 | + | |
89 | + size_t ix; | |
90 | + | |
91 | + char * outfile = "actions.h"; | |
92 | + | |
93 | + //#pragma GCC diagnostic push | |
94 | + //#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |
95 | + static struct option options[] = { | |
96 | + { "outfile", required_argument, 0, 'o' }, | |
97 | + { 0, 0, 0, 0} | |
98 | + | |
99 | + }; | |
100 | + //#pragma GCC diagnostic pop | |
101 | + | |
102 | + int long_index =0; | |
103 | + int opt; | |
104 | + while((opt = getopt_long(argc, argv, "o:", options, &long_index )) != -1) { | |
105 | + | |
106 | + switch(opt) { | |
107 | + case 'o': // Pidfile | |
108 | + outfile = optarg; | |
109 | + break; | |
110 | + } | |
111 | + | |
112 | + } | |
113 | + | |
114 | + FILE *out = fopen(outfile,"w"); | |
115 | + | |
116 | + fprintf(out,"%s\n", | |
117 | + "/*\n" | |
118 | + " * Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270\n" | |
119 | + " * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a\n" | |
120 | + " * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.\n" | |
121 | + " *\n" | |
122 | + " * Copyright (C) <2008> <Banco do Brasil S.A.>\n" | |
123 | + " *\n" | |
124 | + " * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob\n" | |
125 | + " * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela\n" | |
126 | + " * Free Software Foundation.\n" | |
127 | + " *\n" | |
128 | + " * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER\n" | |
129 | + " * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO\n" | |
130 | + " * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para\n" | |
131 | + " * obter mais detalhes.\n" | |
132 | + " *\n" | |
133 | + " * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este\n" | |
134 | + " * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin\n" | |
135 | + " * St, Fifth Floor, Boston, MA 02110-1301 USA\n" | |
136 | + " *\n" | |
137 | + " * Contatos:\n" | |
138 | + " *\n" | |
139 | + " * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)\n" | |
140 | + " * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)\n" | |
141 | + " *\n" | |
142 | + " */\n\n" | |
143 | + ); | |
144 | + | |
145 | + if(format == FORMAT_HEADER) | |
146 | + { | |
147 | + | |
148 | + for(ix = 0; ix < (sizeof(actions)/sizeof(actions[0])); ix++) | |
149 | + { | |
150 | + fprintf(out, | |
151 | + "/**\n" | |
152 | + " *\n" | |
153 | + " * @brief %s\n" | |
154 | + " *\n" | |
155 | + " * @param hSession\tTN3270 Session handle.\n", | |
156 | + actions[ix].description | |
157 | + ); | |
158 | + | |
159 | + if(actions[ix].args) { | |
160 | + fprintf(out," * @param %s\n", actions[ix].args); | |
161 | + } | |
162 | + | |
163 | + fprintf(out, | |
164 | + " *\n" | |
165 | + " * @return 0 if Ok, non zero if not (sets errno)\n" | |
166 | + ); | |
167 | + | |
168 | + fprintf(out," *\n */\n %s\n\n",actions[ix].prototype); | |
169 | + } | |
170 | + | |
171 | + fprintf(out, | |
172 | + "/**\n" | |
173 | + " *\n" | |
174 | + " * @brief Call lib3270 action by name.\n" | |
175 | + " *\n" | |
176 | + " * @param hSession\tTN3270 Session handle.\n" | |
177 | + " * @param name\tName of the action to call.\n" | |
178 | + " *\n" | |
179 | + " */\n" | |
180 | + " LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name);\n" | |
181 | + ); | |
182 | + } | |
183 | + | |
184 | + fclose(out); | |
185 | + | |
186 | + return 0; | |
187 | +} | |
188 | + | |
189 | + | ... | ... |
... | ... | @@ -0,0 +1,45 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
2 | +<CodeBlocks_project_file> | |
3 | + <FileVersion major="1" minor="6" /> | |
4 | + <Project> | |
5 | + <Option title="LIB3270 Action Table Generator" /> | |
6 | + <Option pch_mode="2" /> | |
7 | + <Option compiler="gcc" /> | |
8 | + <Build> | |
9 | + <Target title="Debug"> | |
10 | + <Option output=".bin/Debug/mkactions" prefix_auto="1" extension_auto="1" /> | |
11 | + <Option object_output=".obj/Debug/" /> | |
12 | + <Option type="1" /> | |
13 | + <Option compiler="gcc" /> | |
14 | + <Compiler> | |
15 | + <Add option="-g" /> | |
16 | + </Compiler> | |
17 | + </Target> | |
18 | + <Target title="Release"> | |
19 | + <Option output=".bin/Release/mkactions" prefix_auto="1" extension_auto="1" /> | |
20 | + <Option object_output=".obj/Release/" /> | |
21 | + <Option type="1" /> | |
22 | + <Option compiler="gcc" /> | |
23 | + <Compiler> | |
24 | + <Add option="-O2" /> | |
25 | + </Compiler> | |
26 | + <Linker> | |
27 | + <Add option="-s" /> | |
28 | + </Linker> | |
29 | + </Target> | |
30 | + </Build> | |
31 | + <Compiler> | |
32 | + <Add option="-Wall" /> | |
33 | + <Add directory="../../include" /> | |
34 | + </Compiler> | |
35 | + <Unit filename="mkactions.c"> | |
36 | + <Option compilerVar="CC" /> | |
37 | + </Unit> | |
38 | + <Extensions> | |
39 | + <code_completion /> | |
40 | + <envvars /> | |
41 | + <debugger /> | |
42 | + <lib_finder disable_auto="1" /> | |
43 | + </Extensions> | |
44 | + </Project> | |
45 | +</CodeBlocks_project_file> | ... | ... |
src/lib3270/paste.c
... | ... | @@ -329,12 +329,12 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str) |
329 | 329 | return 0; |
330 | 330 | } |
331 | 331 | |
332 | -LIB3270_ACTION(pastenext) | |
332 | +LIB3270_EXPORT int lib3270_pastenext(H3270 *hSession) | |
333 | 333 | { |
334 | 334 | char * ptr; |
335 | 335 | int rc; |
336 | 336 | |
337 | - CHECK_SESSION_HANDLE(hSession); | |
337 | + FAIL_IF_NOT_ONLINE(hSession); | |
338 | 338 | |
339 | 339 | if(!(lib3270_connected(hSession) && hSession->paste_buffer)) |
340 | 340 | { | ... | ... |
src/lib3270/screen.c
... | ... | @@ -27,28 +27,23 @@ |
27 | 27 | * |
28 | 28 | */ |
29 | 29 | |
30 | -/* | |
31 | - * screen.c | |
32 | - * A callback based 3270 Terminal Emulator | |
33 | - * Screen drawing | |
30 | +/** | |
31 | + * @file screen.c | |
32 | + * | |
33 | + * @brief A callback based 3270 Terminal Emulator Screen drawing | |
34 | + * | |
34 | 35 | */ |
35 | 36 | |
36 | 37 | #include "private.h" |
37 | 38 | #include <signal.h> |
38 | -//#include "appres.h" | |
39 | 39 | #include "3270ds.h" |
40 | 40 | #include "resources.h" |
41 | -// #include "ctlr.h" | |
42 | - | |
43 | -//#include "actionsc.h" | |
44 | 41 | #include "ctlrc.h" |
45 | 42 | #include "hostc.h" |
46 | 43 | #include "kybdc.h" |
47 | 44 | #include "screenc.h" |
48 | -// #include "tablesc.h" | |
49 | 45 | #include "trace_dsc.h" |
50 | 46 | #include "utilc.h" |
51 | -// #include "w3miscc.h" | |
52 | 47 | #include "widec.h" |
53 | 48 | #include "xioc.h" |
54 | 49 | #include "screen.h" |
... | ... | @@ -56,7 +51,7 @@ |
56 | 51 | #include "statusc.h" |
57 | 52 | #include "togglesc.h" |
58 | 53 | #include "api.h" |
59 | -// #include "charsetc.h" | |
54 | +#include <lib3270/actions.h> | |
60 | 55 | |
61 | 56 | #if defined(_WIN32) |
62 | 57 | #include <windows.h> |
... | ... | @@ -825,7 +820,7 @@ void mcursor_set(H3270 *session,LIB3270_POINTER m) |
825 | 820 | } |
826 | 821 | } |
827 | 822 | |
828 | -LIB3270_ACTION( testpattern ) | |
823 | +LIB3270_EXPORT int lib3270_testpattern(H3270 *hSession) | |
829 | 824 | { |
830 | 825 | static const unsigned char text_pat[] = |
831 | 826 | { |
... | ... | @@ -887,7 +882,7 @@ LIB3270_ACTION( testpattern ) |
887 | 882 | int f; |
888 | 883 | int fg = COLOR_BLUE; |
889 | 884 | |
890 | - CHECK_SESSION_HANDLE(hSession); | |
885 | + FAIL_IF_NOT_ONLINE(hSession); | |
891 | 886 | |
892 | 887 | max = (hSession->maxROWS * hSession->maxCOLS); |
893 | 888 | for(f=0;f<max;f++) | ... | ... |
src/lib3270/selection.c
... | ... | @@ -28,8 +28,8 @@ |
28 | 28 | */ |
29 | 29 | |
30 | 30 | #include "private.h" |
31 | -// #include "appres.h" | |
32 | 31 | #include <lib3270.h> |
32 | + #include <lib3270/actions.h> | |
33 | 33 | #include <lib3270/session.h> |
34 | 34 | #include <lib3270/selection.h> |
35 | 35 | #include "3270ds.h" |
... | ... | @@ -353,20 +353,18 @@ LIB3270_EXPORT int lib3270_select_field(H3270 *hSession) |
353 | 353 | |
354 | 354 | LIB3270_EXPORT int lib3270_select_all(H3270 * hSession) |
355 | 355 | { |
356 | - CHECK_SESSION_HANDLE(hSession); | |
356 | + FAIL_IF_NOT_ONLINE(hSession); | |
357 | 357 | |
358 | 358 | do_select(hSession,0,(hSession->rows*hSession->cols)-1,0); |
359 | 359 | |
360 | 360 | return 0; |
361 | 361 | } |
362 | 362 | |
363 | -LIB3270_ACTION( reselect ) | |
363 | +LIB3270_EXPORT int lib3270_reselect(H3270 *hSession) | |
364 | 364 | { |
365 | -// int start, end; | |
366 | - | |
367 | - CHECK_SESSION_HANDLE(hSession); | |
365 | + FAIL_IF_NOT_ONLINE(hSession); | |
368 | 366 | |
369 | - if(!lib3270_connected(hSession) || hSession->select.start == hSession->select.end || hSession->selected) | |
367 | + if(hSession->select.start == hSession->select.end || hSession->selected) | |
370 | 368 | return 0; |
371 | 369 | |
372 | 370 | do_select(hSession, hSession->select.start,hSession->select.end,lib3270_get_toggle(hSession,LIB3270_TOGGLE_RECTANGLE_SELECT)); | ... | ... |