Commit 2a4054a8215d709267e2b574070fcc013209fb60
1 parent
cd3c0d8f
Exists in
master
and in
5 other branches
Isolando callbacks da estrutura principal.
Showing
23 changed files
with
276 additions
and
185 deletions
Show diff stats
src/classlib/remote.cc
| ... | ... | @@ -195,10 +195,8 @@ |
| 195 | 195 | |
| 196 | 196 | status = TransactNamedPipe(hPipe,(LPVOID) &packet, cbSize, &packet, sizeof(packet), &cbSize,NULL); |
| 197 | 197 | |
| 198 | - if(status) | |
| 199 | - return packet.rc; | |
| 200 | - | |
| 201 | - throw exception(GetLastError(),"%s","Transaction error"); | |
| 198 | + if(!status) | |
| 199 | + throw exception(GetLastError(),"%s","Transaction error"); | |
| 202 | 200 | |
| 203 | 201 | } |
| 204 | 202 | ... | ... |
src/classlib/session.cc
| ... | ... | @@ -48,7 +48,33 @@ |
| 48 | 48 | |
| 49 | 49 | #ifdef _WIN32 |
| 50 | 50 | |
| 51 | - #error Implementar | |
| 51 | + class recursive_mutex { | |
| 52 | + private: | |
| 53 | + HANDLE hMutex; | |
| 54 | + | |
| 55 | + public: | |
| 56 | + recursive_mutex() { | |
| 57 | + hMutex = CreateMutex(NULL,FALSE,NULL); | |
| 58 | + }; | |
| 59 | + | |
| 60 | + ~recursive_mutex() { | |
| 61 | + CloseHandle(hMutex); | |
| 62 | + }; | |
| 63 | + | |
| 64 | + void lock(void) { | |
| 65 | + WaitForSingleObject(hMutex,INFINITE); | |
| 66 | + }; | |
| 67 | + | |
| 68 | + void unlock(void) { | |
| 69 | + ReleaseMutex(hMutex); | |
| 70 | + }; | |
| 71 | + | |
| 72 | + bool try_lock(void) { | |
| 73 | + if(WaitForSingleObject(hMutex,1) == WAIT_OBJECT_0) | |
| 74 | + return true; | |
| 75 | + return false; | |
| 76 | + }; | |
| 77 | + }; | |
| 52 | 78 | |
| 53 | 79 | #else |
| 54 | 80 | ... | ... |
src/include/lib3270/session.h
| ... | ... | @@ -44,36 +44,81 @@ |
| 44 | 44 | #define LIB3270_TELNET_N_OPTS 256 |
| 45 | 45 | |
| 46 | 46 | /** extended attributes */ |
| 47 | + struct lib3270_ea; | |
| 48 | + struct lib3270_text; | |
| 49 | + | |
| 50 | + /* | |
| 47 | 51 | struct lib3270_ea |
| 48 | 52 | { |
| 49 | - unsigned char cc; /**< EBCDIC or ASCII character code */ | |
| 50 | - unsigned char fa; /**< field attribute, it nonzero */ | |
| 51 | - unsigned char fg; /**< foreground color (0x00 or 0xf<n>) */ | |
| 52 | - unsigned char bg; /**< background color (0x00 or 0xf<n>) */ | |
| 53 | - unsigned char gr; /**< ANSI graphics rendition bits */ | |
| 54 | - unsigned char cs; /**< character set (GE flag, or 0..2) */ | |
| 55 | - unsigned char ic; /**< input control (DBCS) */ | |
| 56 | - unsigned char db; /**< DBCS state */ | |
| 53 | + unsigned char cc; ///< @brief EBCDIC or ASCII character code | |
| 54 | + unsigned char fa; ///< @brief field attribute, it nonzero | |
| 55 | + unsigned char fg; ///< @brief foreground color (0x00 or 0xf<n>) | |
| 56 | + unsigned char bg; ///< @brief background color (0x00 or 0xf<n>) | |
| 57 | + unsigned char gr; ///< @brief ANSI graphics rendition bits | |
| 58 | + unsigned char cs; ///< @brief character set (GE flag, or 0..2) | |
| 59 | + unsigned char ic; ///< @brief input control (DBCS) | |
| 60 | + unsigned char db; ///< @brief DBCS state | |
| 57 | 61 | }; |
| 62 | + */ | |
| 58 | 63 | |
| 64 | + /* | |
| 59 | 65 | struct lib3270_text |
| 60 | 66 | { |
| 61 | - unsigned char chr; /**< ASCII character code */ | |
| 62 | - unsigned short attr; /**< Converted character attribute (color & etc) */ | |
| 67 | + unsigned char chr; ///< ASCII character code | |
| 68 | + unsigned short attr; ///< Converted character attribute (color & etc) | |
| 63 | 69 | }; |
| 70 | + */ | |
| 64 | 71 | |
| 65 | -#ifndef HEADER_SSL_H | |
| 66 | - #define SSL void | |
| 67 | -#endif // !HEADER_SSL_H | |
| 72 | + #ifndef HEADER_SSL_H | |
| 73 | + #define SSL void | |
| 74 | + #endif // !HEADER_SSL_H | |
| 68 | 75 | |
| 69 | -#ifndef LIB3270_TA | |
| 70 | - #define LIB3270_TA void | |
| 71 | -#endif // !LIB3270_TA | |
| 76 | + #ifndef LIB3270_TA | |
| 77 | + #define LIB3270_TA void | |
| 78 | + #endif // !LIB3270_TA | |
| 72 | 79 | |
| 73 | 80 | #define LIB3270_MB_MAX 16 |
| 74 | 81 | #define LIB3270_DEFAULT_CGEN 0x02b90000 |
| 75 | 82 | #define LIB3270_DEFAULT_CSET 0x00000025 |
| 76 | 83 | |
| 84 | + struct lib3270_session_callbacks | |
| 85 | + { | |
| 86 | + unsigned short sz; | |
| 87 | + | |
| 88 | + int (*write)(H3270 *hSession, unsigned const char *buf, int len); | |
| 89 | + void (*disconnect)(H3270 *hSession); | |
| 90 | + | |
| 91 | + void (*configure)(H3270 *session, unsigned short rows, unsigned short cols); | |
| 92 | + void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor); | |
| 93 | + void (*changed)(H3270 *session, int offset, int len); | |
| 94 | + void (*display)(H3270 *session); | |
| 95 | + void (*set_width)(H3270 *session, int width); | |
| 96 | + | |
| 97 | + void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); | |
| 98 | + void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on); | |
| 99 | + void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name); | |
| 100 | + void (*update_luname)(H3270 *session, const char *name); | |
| 101 | + void (*update_status)(H3270 *session, LIB3270_MESSAGE id); | |
| 102 | + void (*update_connect)(H3270 *session, unsigned char connected); | |
| 103 | + void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols); | |
| 104 | + void (*update_selection)(H3270 *session, int start, int end); | |
| 105 | + void (*update_ssl)(H3270 *session, LIB3270_SSL_STATE state); | |
| 106 | + | |
| 107 | + void (*set_timer)(H3270 *session, unsigned char on); | |
| 108 | + void (*erase)(H3270 *session); | |
| 109 | + void (*suspend)(H3270 *session); | |
| 110 | + void (*resume)(H3270 *session); | |
| 111 | + void (*cursor)(H3270 *session, LIB3270_CURSOR id); | |
| 112 | + void (*set_selection)(H3270 *session, unsigned char on); | |
| 113 | + void (*ctlr_done)(H3270 *session); | |
| 114 | + void (*autostart)(H3270 *session); | |
| 115 | + int (*print)(H3270 *session); | |
| 116 | + | |
| 117 | + void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); | |
| 118 | + | |
| 119 | + }; | |
| 120 | + | |
| 121 | + | |
| 77 | 122 | struct _h3270 |
| 78 | 123 | { |
| 79 | 124 | unsigned short sz; /**< Struct size */ |
| ... | ... | @@ -380,11 +425,13 @@ |
| 380 | 425 | unsigned long ssl_error; |
| 381 | 426 | SSL * ssl_con; |
| 382 | 427 | |
| 383 | - // State change callbacks. | |
| 384 | - struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER]; | |
| 385 | - struct lib3270_state_callback *st_last[LIB3270_STATE_USER]; | |
| 428 | + // Callbacks. | |
| 429 | + struct lib3270_state_callback * st_callbacks[LIB3270_STATE_USER]; | |
| 430 | + struct lib3270_state_callback * st_last[LIB3270_STATE_USER]; | |
| 431 | + struct lib3270_session_callbacks cbk; | |
| 386 | 432 | |
| 387 | 433 | // Session based callbacks |
| 434 | + /* | |
| 388 | 435 | int (*write)(H3270 *hSession, unsigned const char *buf, int len); |
| 389 | 436 | void (*disconnect)(H3270 *hSession); |
| 390 | 437 | |
| ... | ... | @@ -415,6 +462,7 @@ |
| 415 | 462 | int (*print)(H3270 *session); |
| 416 | 463 | |
| 417 | 464 | void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); |
| 465 | + */ | |
| 418 | 466 | |
| 419 | 467 | }; |
| 420 | 468 | ... | ... |
src/include/pw3270/hllapi.h
| ... | ... | @@ -169,6 +169,7 @@ extern "C" { |
| 169 | 169 | HLLAPI_API_CALL hllapi_cmp_text_at(WORD row, WORD col, LPSTR text); |
| 170 | 170 | HLLAPI_API_CALL hllapi_emulate_input(LPSTR buffer, WORD len, WORD pasting); |
| 171 | 171 | HLLAPI_API_CALL hllapi_wait_for_ready(WORD seconds); |
| 172 | + HLLAPI_API_CALL hllapi_wait_for_change(WORD seconds); | |
| 172 | 173 | HLLAPI_API_CALL hllapi_wait(WORD seconds); |
| 173 | 174 | HLLAPI_API_CALL hllapi_pfkey(WORD key); |
| 174 | 175 | HLLAPI_API_CALL hllapi_pakey(WORD key); |
| ... | ... | @@ -209,6 +210,7 @@ extern "C" { |
| 209 | 210 | HLLAPI_API_CALL hllapi_getcursor(); |
| 210 | 211 | HLLAPI_API_CALL hllapi_erase_eof(void); |
| 211 | 212 | HLLAPI_API_CALL hllapi_print(void); |
| 213 | + HLLAPI_API_CALL hllapi_set_unlock_delay(WORD ms); | |
| 212 | 214 | |
| 213 | 215 | #ifdef __cplusplus |
| 214 | 216 | } /* end of extern "C" */ | ... | ... |
src/include/pw3270/ipcpackets.h
src/lib3270/ansi.c
| ... | ... | @@ -618,7 +618,7 @@ static enum lib3270_ansi_state ansi_reset(H3270 *hSession, int ig1 unused, int i |
| 618 | 618 | ctlr_aclear(hSession, 0, hSession->rows * hSession->cols, 1); |
| 619 | 619 | ctlr_altbuffer(hSession,False); |
| 620 | 620 | ctlr_clear(hSession,False); |
| 621 | - hSession->set_width(hSession,80); | |
| 621 | + hSession->cbk.set_width(hSession,80); | |
| 622 | 622 | hSession->ansi_reset = 1; |
| 623 | 623 | } |
| 624 | 624 | hSession->pmi = 0; |
| ... | ... | @@ -1459,7 +1459,7 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1459 | 1459 | if(hSession->allow_wide_mode) |
| 1460 | 1460 | { |
| 1461 | 1461 | hSession->wide_mode = 1; |
| 1462 | - hSession->set_width(hSession,132); | |
| 1462 | + hSession->cbk.set_width(hSession,132); | |
| 1463 | 1463 | } |
| 1464 | 1464 | break; |
| 1465 | 1465 | case 7: /* wraparound mode */ |
| ... | ... | @@ -1493,7 +1493,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1493 | 1493 | if (hSession->allow_wide_mode) |
| 1494 | 1494 | { |
| 1495 | 1495 | hSession->wide_mode = 0; |
| 1496 | - hSession->set_width(hSession,80); | |
| 1496 | + hSession->cbk.set_width(hSession,80); | |
| 1497 | 1497 | } |
| 1498 | 1498 | break; |
| 1499 | 1499 | case 7: /* no wraparound mode */ |
| ... | ... | @@ -1556,7 +1556,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1556 | 1556 | if (hSession->allow_wide_mode) |
| 1557 | 1557 | { |
| 1558 | 1558 | hSession->wide_mode = hSession->saved_wide_mode; |
| 1559 | - hSession->set_width(hSession,hSession->wide_mode ? 132 : 80); | |
| 1559 | + hSession->cbk.set_width(hSession,hSession->wide_mode ? 132 : 80); | |
| 1560 | 1560 | } |
| 1561 | 1561 | break; |
| 1562 | 1562 | case 7: /* wraparound mode */ | ... | ... |
src/lib3270/charset.c
src/lib3270/ctlr.c
| ... | ... | @@ -95,9 +95,9 @@ static const unsigned char code_table[64] = |
| 95 | 95 | #define IsBlank(c) ((c == EBC_null) || (c == EBC_space)) |
| 96 | 96 | |
| 97 | 97 | |
| 98 | -#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->changed(h,0,(h)->rows*(h)->cols); | |
| 99 | -#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->changed(h,f,l) | |
| 100 | -#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->changed(h,n,n+1); | |
| 98 | +#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,0,(h)->rows*(h)->cols); | |
| 99 | +#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,f,l) | |
| 100 | +#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,n,n+1); | |
| 101 | 101 | |
| 102 | 102 | #define DECODE_BADDR(c1, c2) \ |
| 103 | 103 | ((((c1) & 0xC0) == 0x00) ? \ |
| ... | ... | @@ -379,16 +379,6 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) |
| 379 | 379 | static void set_formatted(H3270 *hSession, int state) |
| 380 | 380 | { |
| 381 | 381 | hSession->formatted = state; |
| 382 | -/* | |
| 383 | - int last = (int) hSession->formatted; | |
| 384 | - hSession->formatted = state; | |
| 385 | - | |
| 386 | - if( ((int) hSession->formatted) != last) | |
| 387 | - { | |
| 388 | - trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); | |
| 389 | - hSession->update_formatted(hSession,hSession->formatted); | |
| 390 | - } | |
| 391 | -*/ | |
| 392 | 382 | } |
| 393 | 383 | |
| 394 | 384 | /** |
| ... | ... | @@ -640,7 +630,7 @@ void ctlr_erase(H3270 *session, int alt) |
| 640 | 630 | |
| 641 | 631 | kybd_inhibit(session,False); |
| 642 | 632 | ctlr_clear(session,True); |
| 643 | - session->erase(session); | |
| 633 | + session->cbk.erase(session); | |
| 644 | 634 | |
| 645 | 635 | if(alt == session->screen_alt) |
| 646 | 636 | return; |
| ... | ... | @@ -648,7 +638,7 @@ void ctlr_erase(H3270 *session, int alt) |
| 648 | 638 | if (alt) |
| 649 | 639 | { |
| 650 | 640 | /* Going from 24x80 to maximum. */ |
| 651 | - session->display(session); | |
| 641 | + session->cbk.display(session); | |
| 652 | 642 | |
| 653 | 643 | set_viewsize(session,session->maxROWS,session->maxCOLS); |
| 654 | 644 | } |
| ... | ... | @@ -660,7 +650,7 @@ void ctlr_erase(H3270 *session, int alt) |
| 660 | 650 | if(session->vcontrol) |
| 661 | 651 | { |
| 662 | 652 | ctlr_blanks(session); |
| 663 | - session->display(session); | |
| 653 | + session->cbk.display(session); | |
| 664 | 654 | } |
| 665 | 655 | |
| 666 | 656 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_ALTSCREEN)) |
| ... | ... | @@ -2465,7 +2455,7 @@ void ctlr_clear(H3270 *session, Boolean can_snap) |
| 2465 | 2455 | session->sscp_start = 0; |
| 2466 | 2456 | |
| 2467 | 2457 | // ALL_CHANGED; |
| 2468 | - session->erase(session); | |
| 2458 | + session->cbk.erase(session); | |
| 2469 | 2459 | } |
| 2470 | 2460 | |
| 2471 | 2461 | /** |
| ... | ... | @@ -2700,7 +2690,7 @@ void ctlr_scroll(H3270 *hSession) |
| 2700 | 2690 | /* Clear the last line. */ |
| 2701 | 2691 | (void) memset((char *) &hSession->ea_buf[qty], 0, hSession->cols * sizeof(struct lib3270_ea)); |
| 2702 | 2692 | |
| 2703 | - hSession->display(hSession); | |
| 2693 | + hSession->cbk.display(hSession); | |
| 2704 | 2694 | |
| 2705 | 2695 | } |
| 2706 | 2696 | #endif /*]*/ |
| ... | ... | @@ -2845,10 +2835,10 @@ void ticking_start(H3270 *hSession, Boolean anyway) |
| 2845 | 2835 | { |
| 2846 | 2836 | CHECK_SESSION_HANDLE(hSession); |
| 2847 | 2837 | |
| 2848 | - if(hSession->set_timer) | |
| 2838 | + if(hSession->cbk.set_timer) | |
| 2849 | 2839 | { |
| 2850 | 2840 | if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) || anyway) |
| 2851 | - hSession->set_timer(hSession,1); | |
| 2841 | + hSession->cbk.set_timer(hSession,1); | |
| 2852 | 2842 | } |
| 2853 | 2843 | else |
| 2854 | 2844 | { |
| ... | ... | @@ -2875,9 +2865,9 @@ static void ticking_stop(H3270 *hSession) |
| 2875 | 2865 | { |
| 2876 | 2866 | CHECK_SESSION_HANDLE(hSession); |
| 2877 | 2867 | |
| 2878 | - if(hSession->set_timer) | |
| 2868 | + if(hSession->cbk.set_timer) | |
| 2879 | 2869 | { |
| 2880 | - hSession->set_timer(hSession,0); | |
| 2870 | + hSession->cbk.set_timer(hSession,0); | |
| 2881 | 2871 | } |
| 2882 | 2872 | else |
| 2883 | 2873 | { | ... | ... |
src/lib3270/host.c
| ... | ... | @@ -125,8 +125,8 @@ void lib3270_set_connected(H3270 *hSession) |
| 125 | 125 | hSession->starting = 1; // Enable autostart |
| 126 | 126 | |
| 127 | 127 | lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); |
| 128 | - if(hSession->update_connect) | |
| 129 | - hSession->update_connect(hSession,1); | |
| 128 | + if(hSession->cbk.update_connect) | |
| 129 | + hSession->cbk.update_connect(hSession,1); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | void lib3270_set_disconnected(H3270 *hSession) |
| ... | ... | @@ -143,10 +143,10 @@ void lib3270_set_disconnected(H3270 *hSession) |
| 143 | 143 | |
| 144 | 144 | status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); |
| 145 | 145 | |
| 146 | - if(hSession->update_connect) | |
| 147 | - hSession->update_connect(hSession,0); | |
| 146 | + if(hSession->cbk.update_connect) | |
| 147 | + hSession->cbk.update_connect(hSession,0); | |
| 148 | 148 | |
| 149 | - hSession->update_ssl(hSession,hSession->secure); | |
| 149 | + hSession->cbk.update_ssl(hSession,hSession->secure); | |
| 150 | 150 | |
| 151 | 151 | } |
| 152 | 152 | ... | ... |
src/lib3270/kybd.c
| ... | ... | @@ -1396,7 +1396,7 @@ LIB3270_ACTION( delete ) |
| 1396 | 1396 | if (!hSession->ea_buf[baddr].fa) |
| 1397 | 1397 | cursor_move(hSession,baddr); |
| 1398 | 1398 | } |
| 1399 | - hSession->display(hSession); | |
| 1399 | + hSession->cbk.display(hSession); | |
| 1400 | 1400 | return 0; |
| 1401 | 1401 | } |
| 1402 | 1402 | |
| ... | ... | @@ -1428,7 +1428,7 @@ LIB3270_ACTION( backspace ) |
| 1428 | 1428 | DEC_BA(baddr); |
| 1429 | 1429 | cursor_move(hSession,baddr); |
| 1430 | 1430 | } |
| 1431 | - hSession->display(hSession); | |
| 1431 | + hSession->cbk.display(hSession); | |
| 1432 | 1432 | return 0; |
| 1433 | 1433 | } |
| 1434 | 1434 | |
| ... | ... | @@ -1495,7 +1495,7 @@ static void do_erase(H3270 *hSession) |
| 1495 | 1495 | cursor_move(hSession,baddr); |
| 1496 | 1496 | (void) do_delete(hSession); |
| 1497 | 1497 | } |
| 1498 | - hSession->display(hSession); | |
| 1498 | + hSession->cbk.display(hSession); | |
| 1499 | 1499 | } |
| 1500 | 1500 | |
| 1501 | 1501 | LIB3270_ACTION( erase ) |
| ... | ... | @@ -1876,7 +1876,7 @@ LIB3270_ACTION( dup ) |
| 1876 | 1876 | #endif |
| 1877 | 1877 | if (key_Character(hSession, EBC_dup, False, False, NULL)) |
| 1878 | 1878 | { |
| 1879 | - hSession->display(hSession); | |
| 1879 | + hSession->cbk.display(hSession); | |
| 1880 | 1880 | cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); |
| 1881 | 1881 | } |
| 1882 | 1882 | |
| ... | ... | @@ -2036,7 +2036,7 @@ LIB3270_ACTION( eraseeol ) |
| 2036 | 2036 | hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; |
| 2037 | 2037 | } |
| 2038 | 2038 | (void) ctlr_dbcs_postprocess(hSession); |
| 2039 | - hSession->display(hSession); | |
| 2039 | + hSession->cbk.display(hSession); | |
| 2040 | 2040 | return 0; |
| 2041 | 2041 | } |
| 2042 | 2042 | |
| ... | ... | @@ -2093,7 +2093,7 @@ LIB3270_ACTION( eraseeof ) |
| 2093 | 2093 | hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; |
| 2094 | 2094 | } |
| 2095 | 2095 | (void) ctlr_dbcs_postprocess(hSession); |
| 2096 | - hSession->display(hSession); | |
| 2096 | + hSession->cbk.display(hSession); | |
| 2097 | 2097 | return 0; |
| 2098 | 2098 | } |
| 2099 | 2099 | |
| ... | ... | @@ -2149,7 +2149,7 @@ LIB3270_ACTION( eraseinput ) |
| 2149 | 2149 | ctlr_clear(hSession,True); |
| 2150 | 2150 | cursor_move(hSession,0); |
| 2151 | 2151 | } |
| 2152 | - hSession->display(hSession); | |
| 2152 | + hSession->cbk.display(hSession); | |
| 2153 | 2153 | return 0; |
| 2154 | 2154 | } |
| 2155 | 2155 | |
| ... | ... | @@ -2218,7 +2218,7 @@ LIB3270_ACTION( deleteword ) |
| 2218 | 2218 | else |
| 2219 | 2219 | do_erase(hSession); |
| 2220 | 2220 | } |
| 2221 | - hSession->display(hSession); | |
| 2221 | + hSession->cbk.display(hSession); | |
| 2222 | 2222 | return 0; |
| 2223 | 2223 | } |
| 2224 | 2224 | |
| ... | ... | @@ -2264,7 +2264,7 @@ LIB3270_ACTION( deletefield ) |
| 2264 | 2264 | ctlr_add(hSession,baddr, EBC_null, 0); |
| 2265 | 2265 | INC_BA(baddr); |
| 2266 | 2266 | } |
| 2267 | - hSession->display(hSession); | |
| 2267 | + hSession->cbk.display(hSession); | |
| 2268 | 2268 | return 0; |
| 2269 | 2269 | } |
| 2270 | 2270 | |
| ... | ... | @@ -2909,7 +2909,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len |
| 2909 | 2909 | break; |
| 2910 | 2910 | } |
| 2911 | 2911 | |
| 2912 | - hSession->display(hSession); | |
| 2912 | + hSession->cbk.display(hSession); | |
| 2913 | 2913 | return len; |
| 2914 | 2914 | } |
| 2915 | 2915 | ... | ... |
src/lib3270/paste.c
| ... | ... | @@ -238,12 +238,12 @@ LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, cons |
| 238 | 238 | |
| 239 | 239 | if(row >= 0 && col >= 0 && row <= hSession->rows && col <= hSession->cols) |
| 240 | 240 | { |
| 241 | - hSession->suspend(hSession); | |
| 241 | + hSession->cbk.suspend(hSession); | |
| 242 | 242 | |
| 243 | 243 | hSession->cursor_addr = (row * hSession->cols) + col; |
| 244 | 244 | rc = set_string(hSession, str); |
| 245 | 245 | |
| 246 | - hSession->resume(hSession); | |
| 246 | + hSession->cbk.resume(hSession); | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return rc; |
| ... | ... | @@ -268,9 +268,9 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *hSession, const unsigned char *str) |
| 268 | 268 | if(hSession->kybdlock) |
| 269 | 269 | return -EINVAL; |
| 270 | 270 | |
| 271 | - hSession->suspend(hSession); | |
| 271 | + hSession->cbk.suspend(hSession); | |
| 272 | 272 | rc = set_string(hSession, str); |
| 273 | - hSession->resume(hSession); | |
| 273 | + hSession->cbk.resume(hSession); | |
| 274 | 274 | |
| 275 | 275 | return rc; |
| 276 | 276 | } | ... | ... |
src/lib3270/private.h
| ... | ... | @@ -114,11 +114,6 @@ |
| 114 | 114 | #undef X3270_MENUS |
| 115 | 115 | #endif /*]*/ |
| 116 | 116 | |
| 117 | -/* Functions we may need to supply. */ | |
| 118 | -#if defined(NEED_STRTOK_R) /*[*/ | |
| 119 | - extern char *strtok_r(char *str, const char *sep, char **last); | |
| 120 | -#endif /*]*/ | |
| 121 | - | |
| 122 | 117 | /* types of internal actions */ |
| 123 | 118 | enum iaction { |
| 124 | 119 | IA_STRING, IA_PASTE, IA_REDRAW, |
| ... | ... | @@ -141,16 +136,6 @@ LIB3270_INTERNAL const char * build_rpq_revision; |
| 141 | 136 | #endif /*]*/ |
| 142 | 137 | |
| 143 | 138 | |
| 144 | -#if defined(X3270_DBCS) /*[*/ | |
| 145 | - LIB3270_INTERNAL char *full_efontname_dbcs; | |
| 146 | -#endif /*]*/ | |
| 147 | - | |
| 148 | - | |
| 149 | -/* keyboard modifer bitmap */ | |
| 150 | -#define ShiftKeyDown 0x01 | |
| 151 | -#define MetaKeyDown 0x02 | |
| 152 | -#define AltKeyDown 0x04 | |
| 153 | - | |
| 154 | 139 | /* toggle names */ |
| 155 | 140 | struct toggle_name { |
| 156 | 141 | const char *name; |
| ... | ... | @@ -226,6 +211,28 @@ LIB3270_INTERNAL struct _ansictl |
| 226 | 211 | char vlnext; |
| 227 | 212 | } ansictl; |
| 228 | 213 | |
| 214 | +/** extended attributes */ | |
| 215 | +struct lib3270_ea | |
| 216 | +{ | |
| 217 | + unsigned char cc; ///< @brief EBCDIC or ASCII character code | |
| 218 | + unsigned char fa; ///< @brief field attribute, it nonzero | |
| 219 | + unsigned char fg; ///< @brief foreground color (0x00 or 0xf<n>) | |
| 220 | + unsigned char bg; ///< @brief background color (0x00 or 0xf<n>) | |
| 221 | + unsigned char gr; ///< @brief ANSI graphics rendition bits | |
| 222 | + unsigned char cs; ///< @brief character set (GE flag, or 0..2) | |
| 223 | + unsigned char ic; ///< @brief input control (DBCS) | |
| 224 | + unsigned char db; ///< @brief DBCS state | |
| 225 | +}; | |
| 226 | + | |
| 227 | +struct lib3270_text | |
| 228 | +{ | |
| 229 | + unsigned char chr; ///< @brief ASCII character code | |
| 230 | + unsigned short attr; ///< @brief Converted character attribute (color & etc) | |
| 231 | +}; | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 229 | 236 | /* default charset translation tables */ |
| 230 | 237 | // LIB3270_INTERNAL const unsigned short ebc2asc0[256]; |
| 231 | 238 | // LIB3270_INTERNAL const unsigned short asc2ft0[256]; | ... | ... |
src/lib3270/screen.c
| ... | ... | @@ -104,7 +104,7 @@ static void addch(H3270 *session, int baddr, unsigned char c, unsigned short att |
| 104 | 104 | session->text[baddr].chr = c; |
| 105 | 105 | session->text[baddr].attr = attr; |
| 106 | 106 | |
| 107 | - session->update(session,baddr,c,attr,baddr == session->cursor_addr); | |
| 107 | + session->cbk.update(session,baddr,c,attr,baddr == session->cursor_addr); | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | LIB3270_EXPORT int lib3270_get_element(H3270 *h, int baddr, unsigned char *c, unsigned short *attr) |
| ... | ... | @@ -140,7 +140,7 @@ int screen_init(H3270 *session) |
| 140 | 140 | ctlr_reinit(session,-1); |
| 141 | 141 | |
| 142 | 142 | /* Finish screen initialization. */ |
| 143 | - session->suspend(session); | |
| 143 | + session->cbk.suspend(session); | |
| 144 | 144 | |
| 145 | 145 | return 0; |
| 146 | 146 | } |
| ... | ... | @@ -259,8 +259,8 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
| 259 | 259 | /* Update the model name. */ |
| 260 | 260 | (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,session->extended ? "-E" : ""); |
| 261 | 261 | |
| 262 | - trace("%s: %p",__FUNCTION__,session->update_model); | |
| 263 | - session->update_model(session, session->model_name,session->model_num,rows,cols); | |
| 262 | + trace("%s: %p",__FUNCTION__,session->cbk.update_model); | |
| 263 | + session->cbk.update_model(session, session->model_name,session->model_num,rows,cols); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) |
| ... | ... | @@ -355,7 +355,7 @@ void screen_update(H3270 *session, int bstart, int bend) |
| 355 | 355 | len++; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - session->changed(session,first,len); | |
| 358 | + session->cbk.changed(session,first,len); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | if(session->starting && session->formatted && !session->kybdlock && lib3270_in_3270(session)) |
| ... | ... | @@ -364,7 +364,7 @@ void screen_update(H3270 *session, int bstart, int bend) |
| 364 | 364 | |
| 365 | 365 | // cursor_move(session,next_unprotected(session,0)); |
| 366 | 366 | // lib3270_emulate_input(session,"\\n",-1,0); |
| 367 | - session->autostart(session); | |
| 367 | + session->cbk.autostart(session); | |
| 368 | 368 | |
| 369 | 369 | #ifdef DEBUG |
| 370 | 370 | { |
| ... | ... | @@ -416,7 +416,7 @@ LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *h, int row, int col) |
| 416 | 416 | if(baddr != h->cursor_addr) |
| 417 | 417 | { |
| 418 | 418 | h->cursor_addr = baddr; |
| 419 | - h->update_cursor(h,(unsigned short) row,(unsigned short) col,h->text[baddr].chr,h->text[baddr].attr); | |
| 419 | + h->cbk.update_cursor(h,(unsigned short) row,(unsigned short) col,h->text[baddr].chr,h->text[baddr].attr); | |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| ... | ... | @@ -434,7 +434,7 @@ int cursor_move(H3270 *h, int baddr) |
| 434 | 434 | if(baddr >= 0) |
| 435 | 435 | { |
| 436 | 436 | h->cursor_addr = baddr; |
| 437 | - h->update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); | |
| 437 | + h->cbk.update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | return ret; |
| ... | ... | @@ -447,7 +447,7 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on) |
| 447 | 447 | CHECK_SESSION_HANDLE(session); |
| 448 | 448 | |
| 449 | 449 | session->oia_flag[id] = (on != 0); |
| 450 | - session->update_oia(session,id,session->oia_flag[id]); | |
| 450 | + session->cbk.update_oia(session,id,session->oia_flag[id]); | |
| 451 | 451 | |
| 452 | 452 | } |
| 453 | 453 | |
| ... | ... | @@ -455,7 +455,7 @@ void status_ctlr_done(H3270 *session) |
| 455 | 455 | { |
| 456 | 456 | CHECK_SESSION_HANDLE(session); |
| 457 | 457 | set_status(session,OIA_FLAG_UNDERA,True); |
| 458 | - session->ctlr_done(session); | |
| 458 | + session->cbk.ctlr_done(session); | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | void status_oerr(H3270 *session, int error_type) |
| ... | ... | @@ -486,8 +486,8 @@ void status_oerr(H3270 *session, int error_type) |
| 486 | 486 | |
| 487 | 487 | void status_connecting(H3270 *session, Boolean on) |
| 488 | 488 | { |
| 489 | - if(session->cursor) | |
| 490 | - session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
| 489 | + if(session->cbk.cursor) | |
| 490 | + session->cbk.cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
| 491 | 491 | |
| 492 | 492 | status_changed(session, on ? LIB3270_MESSAGE_CONNECTING : LIB3270_MESSAGE_NONE); |
| 493 | 493 | } |
| ... | ... | @@ -506,12 +506,12 @@ void status_reset(H3270 *session) |
| 506 | 506 | } |
| 507 | 507 | else |
| 508 | 508 | { |
| 509 | - if(session->cursor) | |
| 510 | - session->cursor(session,CURSOR_MODE_NORMAL); | |
| 509 | + if(session->cbk.cursor) | |
| 510 | + session->cbk.cursor(session,CURSOR_MODE_NORMAL); | |
| 511 | 511 | status_changed(session,LIB3270_MESSAGE_NONE); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - session->display(session); | |
| 514 | + session->cbk.display(session); | |
| 515 | 515 | |
| 516 | 516 | } |
| 517 | 517 | |
| ... | ... | @@ -573,7 +573,7 @@ void status_changed(H3270 *session, LIB3270_STATUS id) |
| 573 | 573 | |
| 574 | 574 | session->oia_status = id; |
| 575 | 575 | |
| 576 | - session->update_status(session,id); | |
| 576 | + session->cbk.update_status(session,id); | |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | void status_twait(H3270 *session) |
| ... | ... | @@ -593,8 +593,8 @@ void set_viewsize(H3270 *session, int rows, int cols) |
| 593 | 593 | session->rows = rows; |
| 594 | 594 | session->cols = cols; |
| 595 | 595 | |
| 596 | - if(session->configure) | |
| 597 | - session->configure(session,session->rows,session->cols); | |
| 596 | + if(session->cbk.configure) | |
| 597 | + session->cbk.configure(session,session->rows,session->cols); | |
| 598 | 598 | |
| 599 | 599 | } |
| 600 | 600 | |
| ... | ... | @@ -602,8 +602,8 @@ void status_lu(H3270 *session, const char *lu) |
| 602 | 602 | { |
| 603 | 603 | CHECK_SESSION_HANDLE(session); |
| 604 | 604 | |
| 605 | - if(session->update_luname) | |
| 606 | - session->update_luname(session,lu); | |
| 605 | + if(session->cbk.update_luname) | |
| 606 | + session->cbk.update_luname(session,lu); | |
| 607 | 607 | |
| 608 | 608 | } |
| 609 | 609 | |
| ... | ... | @@ -660,8 +660,8 @@ void status_untiming(H3270 *session) |
| 660 | 660 | { |
| 661 | 661 | CHECK_SESSION_HANDLE(session); |
| 662 | 662 | |
| 663 | - if(session->set_timer) | |
| 664 | - session->set_timer(session,0); | |
| 663 | + if(session->cbk.set_timer) | |
| 664 | + session->cbk.set_timer(session,0); | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | static int logpopup(H3270 *session, void *widget, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) |
| ... | ... | @@ -740,8 +740,8 @@ void mcursor_set(H3270 *session,LIB3270_CURSOR m) |
| 740 | 740 | { |
| 741 | 741 | CHECK_SESSION_HANDLE(session); |
| 742 | 742 | |
| 743 | - if(session->cursor) | |
| 744 | - session->cursor(session,m); | |
| 743 | + if(session->cbk.cursor) | |
| 744 | + session->cbk.cursor(session,m); | |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | LIB3270_ACTION( testpattern ) |
| ... | ... | @@ -832,7 +832,7 @@ LIB3270_ACTION( testpattern ) |
| 832 | 832 | hSession->ea_buf[f].gr = gr[grpos]; |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | - hSession->display(hSession); | |
| 835 | + hSession->cbk.display(hSession); | |
| 836 | 836 | |
| 837 | 837 | return 0; |
| 838 | 838 | } | ... | ... |
src/lib3270/selection.c
| ... | ... | @@ -104,7 +104,7 @@ static void update_selected_rectangle(H3270 *session) |
| 104 | 104 | if(!(row >= p[0].row && row <= p[1].row && col >= p[0].col && col <= p[1].col) && (session->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
| 105 | 105 | { |
| 106 | 106 | session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; |
| 107 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 107 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 108 | 108 | } |
| 109 | 109 | baddr++; |
| 110 | 110 | } |
| ... | ... | @@ -119,7 +119,7 @@ static void update_selected_rectangle(H3270 *session) |
| 119 | 119 | if((row >= p[0].row && row <= p[1].row && col >= p[0].col && col <= p[1].col) && !(session->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
| 120 | 120 | { |
| 121 | 121 | session->text[baddr].attr |= LIB3270_ATTR_SELECTED; |
| 122 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 122 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 123 | 123 | } |
| 124 | 124 | baddr++; |
| 125 | 125 | } |
| ... | ... | @@ -140,7 +140,7 @@ static void update_selected_region(H3270 *session) |
| 140 | 140 | if(session->text[baddr].attr & LIB3270_ATTR_SELECTED) |
| 141 | 141 | { |
| 142 | 142 | session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; |
| 143 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 143 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| ... | ... | @@ -149,7 +149,7 @@ static void update_selected_region(H3270 *session) |
| 149 | 149 | if(session->text[baddr].attr & LIB3270_ATTR_SELECTED) |
| 150 | 150 | { |
| 151 | 151 | session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; |
| 152 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 152 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| ... | ... | @@ -159,7 +159,7 @@ static void update_selected_region(H3270 *session) |
| 159 | 159 | if(!(session->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
| 160 | 160 | { |
| 161 | 161 | session->text[baddr].attr |= LIB3270_ATTR_SELECTED; |
| 162 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 162 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| ... | ... | @@ -191,13 +191,13 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) |
| 191 | 191 | if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) |
| 192 | 192 | { |
| 193 | 193 | hSession->text[a].attr &= ~LIB3270_ATTR_SELECTED; |
| 194 | - if(hSession->update) | |
| 195 | - hSession->update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); | |
| 194 | + if(hSession->cbk.update) | |
| 195 | + hSession->cbk.update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); | |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - hSession->set_selection(hSession,0); | |
| 200 | - hSession->update_selection(hSession,-1,-1); | |
| 199 | + hSession->cbk.set_selection(hSession,0); | |
| 200 | + hSession->cbk.update_selection(hSession,-1,-1); | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return 0; |
| ... | ... | @@ -268,10 +268,10 @@ static void do_select(H3270 *h, int start, int end, int rect) |
| 268 | 268 | if(!h->selected) |
| 269 | 269 | { |
| 270 | 270 | h->selected = 1; |
| 271 | - h->set_selection(h,1); | |
| 271 | + h->cbk.set_selection(h,1); | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - h->update_selection(h,start,end); | |
| 274 | + h->cbk.update_selection(h,start,end); | |
| 275 | 275 | |
| 276 | 276 | } |
| 277 | 277 | |
| ... | ... | @@ -602,11 +602,11 @@ static void copy_chr(H3270 *hSession, int from, int to) |
| 602 | 602 | memcpy(&hSession->ea_buf[to], &hSession->ea_buf[from],sizeof(struct lib3270_ea)); |
| 603 | 603 | hSession->ea_buf[from].fa = 0; |
| 604 | 604 | |
| 605 | - hSession->update( hSession, | |
| 606 | - to, | |
| 607 | - hSession->text[to].chr, | |
| 608 | - hSession->text[to].attr, | |
| 609 | - to == hSession->cursor_addr ); | |
| 605 | + hSession->cbk.update( hSession, | |
| 606 | + to, | |
| 607 | + hSession->text[to].chr, | |
| 608 | + hSession->text[to].attr, | |
| 609 | + to == hSession->cursor_addr ); | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | static void clear_chr(H3270 *hSession, int baddr) |
| ... | ... | @@ -616,11 +616,11 @@ static void clear_chr(H3270 *hSession, int baddr) |
| 616 | 616 | hSession->ea_buf[baddr].cc = EBC_null; |
| 617 | 617 | hSession->ea_buf[baddr].cs = 0; |
| 618 | 618 | |
| 619 | - hSession->update( hSession, | |
| 620 | - baddr, | |
| 621 | - hSession->text[baddr].chr, | |
| 622 | - hSession->text[baddr].attr, | |
| 623 | - baddr == hSession->cursor_addr ); | |
| 619 | + hSession->cbk.update( hSession, | |
| 620 | + baddr, | |
| 621 | + hSession->text[baddr].chr, | |
| 622 | + hSession->text[baddr].attr, | |
| 623 | + baddr == hSession->cursor_addr ); | |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | int cut_addr(H3270 *hSession, int daddr, int saddr, int maxlen, int *sattr) |
| ... | ... | @@ -727,7 +727,7 @@ char * cut_text(H3270 *hSession, char tok) |
| 727 | 727 | if(!hSession->ea_buf[daddr].fa) |
| 728 | 728 | clear_chr(hSession,daddr); |
| 729 | 729 | |
| 730 | - hSession->changed(hSession,0,maxlen); | |
| 730 | + hSession->cbk.changed(hSession,0,maxlen); | |
| 731 | 731 | |
| 732 | 732 | lib3270_unselect(hSession); |
| 733 | 733 | return text; | ... | ... |
src/lib3270/session.c
| ... | ... | @@ -192,28 +192,28 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char |
| 192 | 192 | lib3270_set_host_charset(hSession,charset); |
| 193 | 193 | |
| 194 | 194 | // Default calls |
| 195 | - hSession->write = lib3270_sock_send; | |
| 196 | - hSession->disconnect = lib3270_sock_disconnect; | |
| 197 | - hSession->update = update_char; | |
| 198 | - hSession->update_model = update_model; | |
| 199 | - hSession->update_cursor = update_cursor; | |
| 200 | - hSession->set_selection = nop_char; | |
| 201 | - hSession->ctlr_done = nop; | |
| 202 | - hSession->changed = changed; | |
| 203 | - hSession->erase = screen_disp; | |
| 204 | - hSession->suspend = nop; | |
| 205 | - hSession->resume = screen_disp; | |
| 206 | - hSession->update_oia = update_oia; | |
| 207 | - hSession->update_selection = update_selection; | |
| 208 | - hSession->cursor = set_cursor; | |
| 209 | - hSession->message = message; | |
| 210 | - hSession->update_ssl = update_ssl; | |
| 211 | - hSession->display = screen_disp; | |
| 212 | - hSession->set_width = nop_int; | |
| 213 | - hSession->update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; | |
| 214 | - hSession->autostart = nop; | |
| 215 | - hSession->set_timer = set_timer; | |
| 216 | - hSession->print = print; | |
| 195 | + hSession->cbk.write = lib3270_sock_send; | |
| 196 | + hSession->cbk.disconnect = lib3270_sock_disconnect; | |
| 197 | + hSession->cbk.update = update_char; | |
| 198 | + hSession->cbk.update_model = update_model; | |
| 199 | + hSession->cbk.update_cursor = update_cursor; | |
| 200 | + hSession->cbk.set_selection = nop_char; | |
| 201 | + hSession->cbk.ctlr_done = nop; | |
| 202 | + hSession->cbk.changed = changed; | |
| 203 | + hSession->cbk.erase = screen_disp; | |
| 204 | + hSession->cbk.suspend = nop; | |
| 205 | + hSession->cbk.resume = screen_disp; | |
| 206 | + hSession->cbk.update_oia = update_oia; | |
| 207 | + hSession->cbk.update_selection = update_selection; | |
| 208 | + hSession->cbk.cursor = set_cursor; | |
| 209 | + hSession->cbk.message = message; | |
| 210 | + hSession->cbk.update_ssl = update_ssl; | |
| 211 | + hSession->cbk.display = screen_disp; | |
| 212 | + hSession->cbk.set_width = nop_int; | |
| 213 | + hSession->cbk.update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; | |
| 214 | + hSession->cbk.autostart = nop; | |
| 215 | + hSession->cbk.set_timer = set_timer; | |
| 216 | + hSession->cbk.print = print; | |
| 217 | 217 | |
| 218 | 218 | // Set the defaults. |
| 219 | 219 | hSession->extended = 1; | ... | ... |
src/lib3270/ssl.c
| ... | ... | @@ -450,5 +450,5 @@ void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state) |
| 450 | 450 | session->secure = state; |
| 451 | 451 | trace_dsn(session,"SSL state changes to %d\n",(int) state); |
| 452 | 452 | |
| 453 | - session->update_ssl(session,session->secure); | |
| 453 | + session->cbk.update_ssl(session,session->secure); | |
| 454 | 454 | } | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -931,7 +931,7 @@ void net_disconnect(H3270 *session) |
| 931 | 931 | set_ssl_state(session,LIB3270_SSL_UNSECURE); |
| 932 | 932 | #endif // HAVE_LIBSSL |
| 933 | 933 | |
| 934 | - session->disconnect(session); | |
| 934 | + session->cbk.disconnect(session); | |
| 935 | 935 | |
| 936 | 936 | trace_dsn(session,"SENT disconnect\n"); |
| 937 | 937 | |
| ... | ... | @@ -1032,7 +1032,7 @@ void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno) |
| 1032 | 1032 | { |
| 1033 | 1033 | (void) ERR_error_string(e, err_buf); |
| 1034 | 1034 | trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e,err_buf); |
| 1035 | - hSession->message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); | |
| 1035 | + hSession->cbk.message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); | |
| 1036 | 1036 | } |
| 1037 | 1037 | else |
| 1038 | 1038 | { |
| ... | ... | @@ -2054,7 +2054,7 @@ static void net_rawout(H3270 *hSession, unsigned const char *buf, size_t len) |
| 2054 | 2054 | |
| 2055 | 2055 | while (len) |
| 2056 | 2056 | { |
| 2057 | - int nw = hSession->write(hSession,buf,len); | |
| 2057 | + int nw = hSession->cbk.write(hSession,buf,len); | |
| 2058 | 2058 | |
| 2059 | 2059 | if (nw > 0) |
| 2060 | 2060 | { | ... | ... |
src/lib3270/toggles.c
| ... | ... | @@ -240,8 +240,8 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG |
| 240 | 240 | trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); |
| 241 | 241 | t->upcall(session, t, TT_INTERACTIVE); |
| 242 | 242 | |
| 243 | - if(session->update_toggle) | |
| 244 | - session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); | |
| 243 | + if(session->cbk.update_toggle) | |
| 244 | + session->cbk.update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); | |
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |
| ... | ... | @@ -291,7 +291,7 @@ static void toggle_altscreen(H3270 *session, struct lib3270_toggle *t, LIB3270_T |
| 291 | 291 | |
| 292 | 292 | static void toggle_redraw(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) |
| 293 | 293 | { |
| 294 | - session->display(session); | |
| 294 | + session->cbk.display(session); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /* | ... | ... |
src/lib3270/util.c
src/plugins/hllapi/calls.cc
| ... | ... | @@ -228,6 +228,13 @@ |
| 228 | 228 | return rc; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | + HLLAPI_API_CALL hllapi_set_unlock_delay(WORD ms) | |
| 232 | + { | |
| 233 | + session::get_default()->set_unlock_delay(ms); | |
| 234 | + return 0; | |
| 235 | + } | |
| 236 | + | |
| 237 | + | |
| 231 | 238 | HLLAPI_API_CALL hllapi_pfkey(WORD key) |
| 232 | 239 | { |
| 233 | 240 | return session::get_default()->pfkey(key); | ... | ... |
src/plugins/hllapi/hllapi.c
| ... | ... | @@ -507,6 +507,7 @@ static int reset_system(char *buffer, unsigned short *length, unsigned short *rc |
| 507 | 507 | return hllapi_reset(); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | + | |
| 510 | 511 | static int pause_system(char *buffer, unsigned short *length, unsigned short *rc) |
| 511 | 512 | { |
| 512 | 513 | if(!*length) |
| ... | ... | @@ -529,7 +530,10 @@ static int pause_system(char *buffer, unsigned short *length, unsigned short *rc |
| 529 | 530 | return hllapi_wait( (*length) / 2); |
| 530 | 531 | } |
| 531 | 532 | |
| 532 | - // Pause "flexivel", aguarda tela limpa | |
| 533 | + // Pause "flexivel", aguarda mudança no conteúdo da tela!!! | |
| 534 | + | |
| 535 | + #warning Mudar comportamento na lib! | |
| 536 | + | |
| 533 | 537 | return hllapi_wait_for_ready((*length) / 2); |
| 534 | 538 | } |
| 535 | 539 | |
| ... | ... | @@ -550,6 +554,11 @@ static int set_session_parameters(char *buffer, unsigned short *length, unsigned |
| 550 | 554 | // FPAUSE |
| 551 | 555 | pause_mode = PAUSE_MODE_FPAUSE; |
| 552 | 556 | } |
| 557 | + else if(!strncasecmp(buffer,"UNLOCKDELAY",*length)) | |
| 558 | + { | |
| 559 | + // UNLOCKDELAY | |
| 560 | + hllapi_set_unlock_delay((WORD) *rc); | |
| 561 | + } | |
| 553 | 562 | else |
| 554 | 563 | { |
| 555 | 564 | return HLLAPI_STATUS_BAD_PARAMETER; | ... | ... |
src/plugins/hllapi/pluginmain.c
| ... | ... | @@ -328,6 +328,11 @@ |
| 328 | 328 | send_result(source,lib3270_get_secure(lib3270_get_default_session_handle())); |
| 329 | 329 | break; |
| 330 | 330 | |
| 331 | + case HLLAPI_PACKET_SET_UNLOCK_DELAY: | |
| 332 | + lib3270_set_unlock_delay(lib3270_get_default_session_handle(),(unsigned short) ((struct hllapi_packet_set_int *) source->buffer)->value); | |
| 333 | + send_result(source,0); | |
| 334 | + break; | |
| 335 | + | |
| 331 | 336 | case HLLAPI_PACKET_SET_TOGGLE: |
| 332 | 337 | send_result(source,lib3270_set_toggle(lib3270_get_default_session_handle(), |
| 333 | 338 | (LIB3270_TOGGLE) ((struct hllapi_packet_set *) source->buffer)->id, | ... | ... |
src/pw3270/v3270/widget.c
| ... | ... | @@ -930,27 +930,27 @@ static void v3270_init(v3270 *widget) |
| 930 | 930 | |
| 931 | 931 | widget->host->user_data = widget; |
| 932 | 932 | |
| 933 | - widget->host->update = v3270_update_char; | |
| 934 | - widget->host->changed = changed; | |
| 935 | - widget->host->set_timer = set_timer; | |
| 936 | - | |
| 937 | - widget->host->set_selection = set_selection; | |
| 938 | - widget->host->update_selection = update_selection; | |
| 939 | - | |
| 940 | - widget->host->update_luname = update_luname; | |
| 941 | - widget->host->configure = update_screen_size; | |
| 942 | - widget->host->update_status = update_message; | |
| 943 | - widget->host->update_cursor = v3270_update_cursor; | |
| 944 | - widget->host->update_toggle = update_toggle; | |
| 945 | - widget->host->update_oia = v3270_update_oia; | |
| 946 | - widget->host->cursor = select_cursor; | |
| 947 | - widget->host->update_connect = update_connect; | |
| 948 | - widget->host->update_model = update_model; | |
| 949 | - widget->host->changed = changed; | |
| 950 | - widget->host->ctlr_done = ctlr_done; | |
| 951 | - widget->host->message = message; | |
| 952 | - widget->host->update_ssl = v3270_update_ssl; | |
| 953 | - widget->host->print = emit_print_signal; | |
| 933 | + widget->host->cbk.update = v3270_update_char; | |
| 934 | + widget->host->cbk.changed = changed; | |
| 935 | + widget->host->cbk.set_timer = set_timer; | |
| 936 | + | |
| 937 | + widget->host->cbk.set_selection = set_selection; | |
| 938 | + widget->host->cbk.update_selection = update_selection; | |
| 939 | + | |
| 940 | + widget->host->cbk.update_luname = update_luname; | |
| 941 | + widget->host->cbk.configure = update_screen_size; | |
| 942 | + widget->host->cbk.update_status = update_message; | |
| 943 | + widget->host->cbk.update_cursor = v3270_update_cursor; | |
| 944 | + widget->host->cbk.update_toggle = update_toggle; | |
| 945 | + widget->host->cbk.update_oia = v3270_update_oia; | |
| 946 | + widget->host->cbk.cursor = select_cursor; | |
| 947 | + widget->host->cbk.update_connect = update_connect; | |
| 948 | + widget->host->cbk.update_model = update_model; | |
| 949 | + widget->host->cbk.changed = changed; | |
| 950 | + widget->host->cbk.ctlr_done = ctlr_done; | |
| 951 | + widget->host->cbk.message = message; | |
| 952 | + widget->host->cbk.update_ssl = v3270_update_ssl; | |
| 953 | + widget->host->cbk.print = emit_print_signal; | |
| 954 | 954 | |
| 955 | 955 | |
| 956 | 956 | // Reset timer | ... | ... |