Commit 037fc4f7c1361834c49b0fd33030949ee5a4003a
1 parent
03d44b56
Exists in
master
and in
5 other branches
Movendo statics para a estrutura de sessao
Showing
5 changed files
with
32 additions
and
24 deletions
Show diff stats
src/include/lib3270/session.h
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | #ifndef LIB3270_SESSION_H_INCLUDED |
33 | 33 | |
34 | 34 | #define LIB3270_SESSION_H_INCLUDED 1 |
35 | + #include <sys/time.h> | |
35 | 36 | |
36 | 37 | #define LIB3270_LUNAME_LENGTH 16 |
37 | 38 | #define LIB3270_FULL_MODEL_NAME_LENGTH 13 |
... | ... | @@ -99,6 +100,7 @@ |
99 | 100 | int onlcr : 1; |
100 | 101 | int bsd_tm : 1; |
101 | 102 | int syncing : 1; |
103 | + int reverse : 1; /**< reverse-input mode */ | |
102 | 104 | |
103 | 105 | char * oversize; |
104 | 106 | |
... | ... | @@ -171,6 +173,9 @@ |
171 | 173 | |
172 | 174 | // kybd.c |
173 | 175 | unsigned int kybdlock; |
176 | + unsigned char aid; /**< current attention ID */ | |
177 | + void * unlock_id; | |
178 | + time_t unlock_delay_time; | |
174 | 179 | |
175 | 180 | // Widget info |
176 | 181 | void * widget; | ... | ... |
src/lib3270/ctlr.c
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | #include "screenc.h" |
67 | 67 | |
68 | 68 | /* Externals: kybd.c */ |
69 | -extern unsigned char aid; | |
69 | +// extern unsigned char aid; | |
70 | 70 | |
71 | 71 | /* Globals */ |
72 | 72 | // int ROWS, COLS; |
... | ... | @@ -537,19 +537,19 @@ process_ds(unsigned char *buf, int buflen) |
537 | 537 | case CMD_RB: /* read buffer */ |
538 | 538 | case SNA_CMD_RB: |
539 | 539 | trace_ds("ReadBuffer\n"); |
540 | - ctlr_read_buffer(aid); | |
540 | + ctlr_read_buffer(h3270.aid); | |
541 | 541 | return PDS_OKAY_OUTPUT; |
542 | 542 | break; |
543 | 543 | case CMD_RM: /* read modifed */ |
544 | 544 | case SNA_CMD_RM: |
545 | 545 | trace_ds("ReadModified\n"); |
546 | - ctlr_read_modified(aid, False); | |
546 | + ctlr_read_modified(h3270.aid, False); | |
547 | 547 | return PDS_OKAY_OUTPUT; |
548 | 548 | break; |
549 | 549 | case CMD_RMA: /* read modifed all */ |
550 | 550 | case SNA_CMD_RMA: |
551 | 551 | trace_ds("ReadModifiedAll\n"); |
552 | - ctlr_read_modified(aid, True); | |
552 | + ctlr_read_modified(h3270.aid, True); | |
553 | 553 | return PDS_OKAY_OUTPUT; |
554 | 554 | break; |
555 | 555 | case CMD_WSF: /* write structured field */ |
... | ... | @@ -1105,7 +1105,7 @@ ctlr_erase_all_unprotected(void) |
1105 | 1105 | } else { |
1106 | 1106 | ctlr_clear(&h3270,True); |
1107 | 1107 | } |
1108 | - aid = AID_NO; | |
1108 | + h3270.aid = AID_NO; | |
1109 | 1109 | do_reset(&h3270,False); |
1110 | 1110 | ALL_CHANGED; |
1111 | 1111 | } |
... | ... | @@ -1862,7 +1862,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
1862 | 1862 | END_TEXT0; |
1863 | 1863 | trace_ds("\n"); |
1864 | 1864 | if (wcc_keyboard_restore) { |
1865 | - aid = AID_NO; | |
1865 | + h3270.aid = AID_NO; | |
1866 | 1866 | do_reset(&h3270,False); |
1867 | 1867 | } else if (h3270.kybdlock & KL_OIA_TWAIT) { |
1868 | 1868 | kybdlock_clr(KL_OIA_TWAIT, "ctlr_write"); |
... | ... | @@ -1986,7 +1986,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) |
1986 | 1986 | sscp_start = h3270.buffer_addr; |
1987 | 1987 | |
1988 | 1988 | /* Unlock the keyboard. */ |
1989 | - aid = AID_NO; | |
1989 | + h3270.aid = AID_NO; | |
1990 | 1990 | do_reset(&h3270,False); |
1991 | 1991 | |
1992 | 1992 | } | ... | ... |
src/lib3270/ft_dft.c
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | #include <errno.h> |
58 | 58 | // #include <malloc.h> |
59 | 59 | |
60 | -extern unsigned char aid; | |
60 | +// extern unsigned char aid; | |
61 | 61 | |
62 | 62 | /* Macros. */ |
63 | 63 | #define OPEN_MSG "FT:MSG" /* Open request for message */ |
... | ... | @@ -462,7 +462,7 @@ dft_get_request(void) |
462 | 462 | Replace(dft_savebuf, (unsigned char *)lib3270_malloc(dft_savebuf_max)); |
463 | 463 | } |
464 | 464 | (void) memcpy(dft_savebuf, obuf, dft_savebuf_len); |
465 | - aid = AID_SF; | |
465 | + h3270.aid = AID_SF; | |
466 | 466 | |
467 | 467 | /* Write the data. */ |
468 | 468 | net_output(); | ... | ... |
src/lib3270/kybd.c
... | ... | @@ -108,8 +108,8 @@ static unsigned char pa_xlate[] = { |
108 | 108 | }; |
109 | 109 | #define PF_SZ (sizeof(pf_xlate)/sizeof(pf_xlate[0])) |
110 | 110 | #define PA_SZ (sizeof(pa_xlate)/sizeof(pa_xlate[0])) |
111 | -static void * unlock_id; | |
112 | -static time_t unlock_delay_time; | |
111 | +// static void * unlock_id; | |
112 | +// static time_t unlock_delay_time; | |
113 | 113 | #define UNLOCK_MS 350 /* 0.35s after last unlock */ |
114 | 114 | static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped); |
115 | 115 | static Boolean flush_ta(void); |
... | ... | @@ -129,11 +129,11 @@ static struct xks { |
129 | 129 | KeySym assoc; |
130 | 130 | } *xk; |
131 | 131 | |
132 | -static Boolean reverse = False; /* reverse-input mode */ | |
132 | +// static Boolean reverse = False; /* reverse-input mode */ | |
133 | 133 | |
134 | 134 | /* Globals */ |
135 | 135 | // unsigned int kybdlock = KL_NOT_CONNECTED; |
136 | -unsigned char aid = AID_NO; /* current attention ID */ | |
136 | +//unsigned char aid = AID_NO; /* current attention ID */ | |
137 | 137 | |
138 | 138 | /* Composite key mappings. */ |
139 | 139 | |
... | ... | @@ -361,7 +361,7 @@ kybdlock_set(unsigned int bits, const char *cause unused) |
361 | 361 | #endif /*]*/ |
362 | 362 | if ((h3270.kybdlock ^ bits) & KL_DEFERRED_UNLOCK) { |
363 | 363 | /* Turned on deferred unlock. */ |
364 | - unlock_delay_time = time(NULL); | |
364 | + h3270.unlock_delay_time = time(NULL); | |
365 | 365 | } |
366 | 366 | h3270.kybdlock = n; |
367 | 367 | status_changed(&h3270,LIB3270_STATUS_KYBDLOCK); |
... | ... | @@ -381,7 +381,7 @@ kybdlock_clr(unsigned int bits, const char *cause unused) |
381 | 381 | #endif |
382 | 382 | if ((h3270.kybdlock ^ n) & KL_DEFERRED_UNLOCK) { |
383 | 383 | /* Turned off deferred unlock. */ |
384 | - unlock_delay_time = 0; | |
384 | + h3270.unlock_delay_time = 0; | |
385 | 385 | } |
386 | 386 | h3270.kybdlock = n; |
387 | 387 | status_changed(&h3270,LIB3270_STATUS_KYBDLOCK); |
... | ... | @@ -411,7 +411,7 @@ kybd_inhibit(Boolean inhibit) |
411 | 411 | void kybd_connect(H3270 *session, int connected, void *dunno) |
412 | 412 | { |
413 | 413 | if (session->kybdlock & KL_DEFERRED_UNLOCK) |
414 | - RemoveTimeOut(unlock_id); | |
414 | + RemoveTimeOut(session->unlock_id); | |
415 | 415 | |
416 | 416 | kybdlock_clr(-1, "kybd_connect"); |
417 | 417 | |
... | ... | @@ -430,7 +430,7 @@ void kybd_connect(H3270 *session, int connected, void *dunno) |
430 | 430 | void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) |
431 | 431 | { |
432 | 432 | if (session->kybdlock & KL_DEFERRED_UNLOCK) |
433 | - RemoveTimeOut(unlock_id); | |
433 | + RemoveTimeOut(session->unlock_id); | |
434 | 434 | kybdlock_clr(~KL_AWAITING_FIRST, "kybd_in3270"); |
435 | 435 | |
436 | 436 | /* There might be a macro pending. */ |
... | ... | @@ -542,8 +542,8 @@ static void key_AID(H3270 *session, unsigned char aid_code) |
542 | 542 | lib3270_set_toggle(&h3270,LIB3270_TOGGLE_INSERT,0); |
543 | 543 | kybdlock_set(KL_OIA_TWAIT | KL_OIA_LOCKED, "key_AID"); |
544 | 544 | } |
545 | - aid = aid_code; | |
546 | - ctlr_read_modified(aid, False); | |
545 | + h3270.aid = aid_code; | |
546 | + ctlr_read_modified(h3270.aid, False); | |
547 | 547 | ticking_start(&h3270,False); |
548 | 548 | status_ctlr_done(&h3270); |
549 | 549 | } |
... | ... | @@ -1489,7 +1489,7 @@ void do_reset(H3270 *session, Boolean explicit) |
1489 | 1489 | * keyboard now, or want to defer further into the future. |
1490 | 1490 | */ |
1491 | 1491 | if (session->kybdlock & KL_DEFERRED_UNLOCK) |
1492 | - RemoveTimeOut(unlock_id); | |
1492 | + RemoveTimeOut(session->unlock_id); | |
1493 | 1493 | |
1494 | 1494 | /* |
1495 | 1495 | * If explicit (from the keyboard), unlock the keyboard now. |
... | ... | @@ -1500,13 +1500,13 @@ void do_reset(H3270 *session, Boolean explicit) |
1500 | 1500 | || lib3270_get_ft_state(session) != LIB3270_FT_STATE_NONE |
1501 | 1501 | #endif /*]*/ |
1502 | 1502 | || (!session->unlock_delay) // && !sms_in_macro()) |
1503 | - || (unlock_delay_time != 0 && (time(NULL) - unlock_delay_time) > 1)) { | |
1503 | + || (session->unlock_delay_time != 0 && (time(NULL) - session->unlock_delay_time) > 1)) { | |
1504 | 1504 | kybdlock_clr(-1, "do_reset"); |
1505 | 1505 | } else if (session->kybdlock & |
1506 | 1506 | (KL_DEFERRED_UNLOCK | KL_OIA_TWAIT | KL_OIA_LOCKED | KL_AWAITING_FIRST)) { |
1507 | 1507 | kybdlock_clr(~KL_DEFERRED_UNLOCK, "do_reset"); |
1508 | 1508 | kybdlock_set(KL_DEFERRED_UNLOCK, "do_reset"); |
1509 | - unlock_id = AddTimeOut(UNLOCK_MS, session, defer_unlock); | |
1509 | + session->unlock_id = AddTimeOut(UNLOCK_MS, session, defer_unlock); | |
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | /* Clean up other modes. */ |
... | ... | @@ -1709,7 +1709,8 @@ LIB3270_ACTION( delete ) |
1709 | 1709 | #endif /*]*/ |
1710 | 1710 | if (!do_delete()) |
1711 | 1711 | return 0; |
1712 | - if (reverse) { | |
1712 | + if (hSession->reverse) | |
1713 | + { | |
1713 | 1714 | int baddr = hSession->cursor_addr; |
1714 | 1715 | |
1715 | 1716 | DEC_BA(baddr); |
... | ... | @@ -1737,7 +1738,7 @@ LIB3270_ACTION( backspace ) |
1737 | 1738 | return 0; |
1738 | 1739 | } |
1739 | 1740 | #endif /*]*/ |
1740 | - if (reverse) | |
1741 | + if (hSession->reverse) | |
1741 | 1742 | (void) do_delete(); |
1742 | 1743 | else if (!hSession->flipped) |
1743 | 1744 | do_left(); | ... | ... |
src/lib3270/session.c
... | ... | @@ -44,6 +44,7 @@ |
44 | 44 | #include "ctlrc.h" |
45 | 45 | #include "ftc.h" |
46 | 46 | #include "kybdc.h" |
47 | +#include "3270ds.h" | |
47 | 48 | |
48 | 49 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
49 | 50 | |
... | ... | @@ -195,6 +196,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
195 | 196 | hSession->cstate = LIB3270_NOT_CONNECTED; |
196 | 197 | hSession->oia_status = -1; |
197 | 198 | hSession->kybdlock = KL_NOT_CONNECTED; |
199 | + hSession->aid = AID_NO; | |
198 | 200 | |
199 | 201 | #ifdef _WIN32 |
200 | 202 | hSession->sockEvent = NULL; | ... | ... |