Commit c5e8900674ca976a90cfc75b916180c04ac8e628

Authored by perry.werneck@gmail.com
1 parent 509952b6

Implementando temporização pelas funções do java

Showing 2 changed files with 62 additions and 38 deletions   Show diff stats
iocalls.c
... ... @@ -614,6 +614,16 @@ void remove_input_calls(H3270 *session)
614 614 }
615 615 }
616 616  
  617 +LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)), void (*rm)(void *timer))
  618 +{
  619 + if(add)
  620 + add_timeout = add;
  621 +
  622 + if(rm)
  623 + remove_timeout = rm;
  624 +
  625 +}
  626 +
617 627 LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk)
618 628 {
619 629 if(!cbk)
... ... @@ -622,11 +632,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk
622 632 if(cbk->sz != sizeof(struct lib3270_callbacks))
623 633 return EINVAL;
624 634  
625   - if(cbk->AddTimeOut)
626   - add_timeout = cbk->AddTimeOut;
627   -
628   - if(cbk->RemoveTimeOut)
629   - remove_timeout = cbk->RemoveTimeOut;
  635 + lib3270_register_time_handlers(cbk->AddTimeOut,cbk->RemoveTimeOut);
630 636  
631 637 if(cbk->AddInput)
632 638 add_input = cbk->AddInput;
... ...
kybdc.h
... ... @@ -19,39 +19,57 @@
19 19  
20 20 #ifndef KYBDC_H_INCLUDED
21 21  
22   -#define KYBDC_H_INCLUDED
23   -
24   -/* keyboard lock states */
25   -// LIB3270_INTERNAL unsigned int kybdlock;
26   -#define KL_OERR_MASK 0x000f
27   -#define KL_OERR_PROTECTED 1
28   -#define KL_OERR_NUMERIC 2
29   -#define KL_OERR_OVERFLOW 3
30   -#define KL_OERR_DBCS 4
31   -#define KL_NOT_CONNECTED 0x0010
32   -#define KL_AWAITING_FIRST 0x0020
33   -#define KL_OIA_TWAIT 0x0040
34   -#define KL_OIA_LOCKED 0x0080
35   -#define KL_DEFERRED_UNLOCK 0x0100
36   -#define KL_ENTER_INHIBIT 0x0200
37   -#define KL_SCROLLED 0x0400
38   -#define KL_OIA_MINUS 0x0800
39   -
40   -
41   -/* other functions */
42   -LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc);
43   -LIB3270_INTERNAL void clear_xks(void);
44   -LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit);
45   -LIB3270_INTERNAL void hex_input(char *s);
46   -LIB3270_INTERNAL void kybdlock_clr(H3270 *session, unsigned int bits, const char *cause);
47   -LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit);
48   -LIB3270_INTERNAL void kybd_init(void);
49   -LIB3270_INTERNAL int kybd_prime(void);
50   -LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock);
51   -LIB3270_INTERNAL Boolean run_ta(void);
52   -LIB3270_INTERNAL int state_from_keymap(char keymap[32]);
53   -LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno);
54   -LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno);
  22 + #define KYBDC_H_INCLUDED
  23 +
  24 + /* keyboard lock states */
  25 + typedef enum lib3270_kl_state
  26 + {
  27 + LIB3270_KL_OERR_MASK = 0x000f,
  28 + LIB3270_KL_OERR_PROTECTED = 0x0001,
  29 + LIB3270_KL_OERR_NUMERIC = 0x0002,
  30 + LIB3270_KL_OERR_OVERFLOW = 0x0003,
  31 + LIB3270_KL_OERR_DBCS = 0x0004,
  32 + LIB3270_KL_NOT_CONNECTED = 0x0010,
  33 + LIB3270_KL_AWAITING_FIRST = 0x0020,
  34 + LIB3270_KL_OIA_TWAIT = 0x0040,
  35 + LIB3270_KL_OIA_LOCKED = 0x0080,
  36 + LIB3270_KL_DEFERRED_UNLOCK = 0x0100,
  37 + LIB3270_KL_ENTER_INHIBIT = 0x0200,
  38 + LIB3270_KL_SCROLLED = 0x0400,
  39 + LIB3270_KL_OIA_MINUS = 0x0800
  40 +
  41 + } LIB3270_KL_STATE;
  42 +
  43 + #define KL_OERR_MASK LIB3270_KL_OERR_MASK
  44 + #define KL_OERR_PROTECTED LIB3270_KL_OERR_PROTECTED
  45 + #define KL_OERR_NUMERIC LIB3270_KL_OERR_NUMERIC
  46 + #define KL_OERR_OVERFLOW LIB3270_KL_OERR_OVERFLOW
  47 + #define KL_OERR_DBCS LIB3270_KL_OERR_DBCS
  48 + #define KL_NOT_CONNECTED LIB3270_KL_NOT_CONNECTED
  49 + #define KL_AWAITING_FIRST LIB3270_KL_AWAITING_FIRST
  50 + #define KL_OIA_TWAIT LIB3270_KL_OIA_TWAIT
  51 + #define KL_OIA_LOCKED LIB3270_KL_OIA_LOCKED
  52 + #define KL_DEFERRED_UNLOCK LIB3270_KL_DEFERRED_UNLOCK
  53 + #define KL_ENTER_INHIBIT LIB3270_KL_ENTER_INHIBIT
  54 + #define KL_SCROLLED LIB3270_KL_SCROLLED
  55 + #define KL_OIA_MINUS LIB3270_KL_OIA_MINUS
  56 +
  57 +
  58 +
  59 + /* other functions */
  60 + LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc);
  61 + LIB3270_INTERNAL void clear_xks(void);
  62 + LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit);
  63 + LIB3270_INTERNAL void hex_input(char *s);
  64 + LIB3270_INTERNAL void kybdlock_clr(H3270 *session, unsigned int bits, const char *cause);
  65 + LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit);
  66 + LIB3270_INTERNAL void kybd_init(void);
  67 + LIB3270_INTERNAL int kybd_prime(void);
  68 + LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock);
  69 + LIB3270_INTERNAL Boolean run_ta(void);
  70 + LIB3270_INTERNAL int state_from_keymap(char keymap[32]);
  71 + LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno);
  72 + LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno);
55 73  
56 74  
57 75 #endif /* KYBDC_H_INCLUDED */
... ...