Commit ddbc24c6ed8bf060a2bf551970954a92bfcf0145
1 parent
04acfdec
Exists in
master
Implementacao de funcoes para ativacao dos callbacks.
Showing
5 changed files
with
86 additions
and
72 deletions
Show diff stats
src/lib/keymap.c
| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | #include "statusc.h" |
| 31 | 31 | #include "trace_dsc.h" |
| 32 | 32 | #include "utilc.h" |
| 33 | +#include "lib3270.h" | |
| 33 | 34 | |
| 34 | 35 | #undef COLS |
| 35 | 36 | extern int cCOLS; |
| ... | ... | @@ -66,8 +67,7 @@ struct keymap { |
| 66 | 67 | |
| 67 | 68 | #define IS_INACTIVE(k) ((k)->hints[0] & KM_INACTIVE) |
| 68 | 69 | |
| 69 | -KEYBOARD_INFO *keyboard_info_3270 = 0; | |
| 70 | - | |
| 70 | +const KEYBOARD_INFO *keyboard_info_3270 = 0; | |
| 71 | 71 | |
| 72 | 72 | static struct keymap *master_keymap = NULL; |
| 73 | 73 | static struct keymap **nextk = &master_keymap; |
| ... | ... | @@ -812,3 +812,10 @@ keymap_dump(void) |
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | } |
| 815 | + | |
| 816 | +int set_3270_keyboard(const KEYBOARD_INFO *kbd) | |
| 817 | +{ | |
| 818 | + keyboard_info_3270 = kbd; | |
| 819 | + return 0; | |
| 820 | +} | |
| 821 | + | ... | ... |
src/lib/keymapc.h
| ... | ... | @@ -13,6 +13,8 @@ |
| 13 | 13 | |
| 14 | 14 | /* c3270 version of keymapc.h */ |
| 15 | 15 | |
| 16 | +#include "lib3270.h" | |
| 17 | + | |
| 16 | 18 | #define KM_CTRL 0x0001 |
| 17 | 19 | #define KM_META 0x0002 |
| 18 | 20 | |
| ... | ... | @@ -21,24 +23,5 @@ extern char *lookup_key(int k); |
| 21 | 23 | extern void keymap_dump(void); |
| 22 | 24 | extern const char *decode_key(int k, int hint, char *buf); |
| 23 | 25 | |
| 24 | -#pragma pack(1) | |
| 25 | - | |
| 26 | -typedef struct _keytable | |
| 27 | -{ | |
| 28 | - const char *name; | |
| 29 | - int code; | |
| 30 | -} KEYTABLE; | |
| 31 | - | |
| 32 | -typedef struct _keyboard_info | |
| 33 | -{ | |
| 34 | - unsigned short sz; | |
| 35 | - unsigned short magic; | |
| 36 | - | |
| 37 | - void (*beep)(void); | |
| 38 | - | |
| 39 | - const KEYTABLE *keys; | |
| 40 | -} KEYBOARD_INFO; | |
| 41 | - | |
| 42 | -#pragma pack() | |
| 43 | 26 | |
| 44 | 27 | ... | ... |
src/lib/lib3270.h
| ... | ... | @@ -12,15 +12,79 @@ |
| 12 | 12 | * for more details. |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -/* Non-display version of screen.h */ | |
| 16 | 15 | |
| 16 | +#ifndef LIB3270_INCLUDED | |
| 17 | + | |
| 18 | +#define LIB3270_INCLUDED | |
| 17 | 19 | |
| 18 | 20 | #ifdef __cplusplus |
| 19 | 21 | extern "C" { |
| 20 | 22 | #endif |
| 21 | 23 | |
| 24 | + | |
| 25 | +#pragma pack(1) | |
| 26 | + | |
| 27 | +#define SCREEN_MAGIC 0x4871 | |
| 28 | + | |
| 29 | +typedef struct _screen_callback | |
| 30 | +{ | |
| 31 | + unsigned short sz; | |
| 32 | + unsigned short magic; | |
| 33 | + | |
| 34 | + void (*screen_init)(void); | |
| 35 | + void (*screen_disp)(Boolean erasing unused); | |
| 36 | + void (*screen_suspend)(void); | |
| 37 | + void (*screen_resume)(void); | |
| 38 | + | |
| 39 | + void (*cursor_move)(int baddr); | |
| 40 | + void (*toggle_monocase)(struct toggle *t unused, enum toggle_type tt unused); | |
| 41 | + | |
| 42 | + void (*status_ctlr_done)(void); | |
| 43 | + void (*status_insert_mode)(Boolean on); | |
| 44 | + void (*status_minus)(void); | |
| 45 | + void (*status_oerr)(int error_type); | |
| 46 | + void (*status_reset)(void); | |
| 47 | + void (*status_reverse_mode)(Boolean on); | |
| 48 | + void (*status_syswait)(void); | |
| 49 | + void (*status_twait)(void); | |
| 50 | + void (*status_typeahead)(Boolean on); | |
| 51 | + void (*status_compose)(Boolean on, unsigned char c, enum keytype keytype); | |
| 52 | + void (*status_lu)(const char *lu); | |
| 53 | + | |
| 54 | + void (*ring_bell)(void); | |
| 55 | + void (*screen_flip)(void); | |
| 56 | + void (*screen_width)(int width); | |
| 57 | + | |
| 58 | + void (*Redraw_action)(Widget w, XEvent *event, String *params, Cardinal *num_params); | |
| 59 | + | |
| 60 | +} SCREEN_CALLBACK; | |
| 61 | + | |
| 62 | +typedef struct _keytable | |
| 63 | +{ | |
| 64 | + const char *name; | |
| 65 | + int code; | |
| 66 | +} KEYTABLE; | |
| 67 | + | |
| 68 | +typedef struct _keyboard_info | |
| 69 | +{ | |
| 70 | + unsigned short sz; | |
| 71 | + unsigned short magic; | |
| 72 | + | |
| 73 | + void (*beep)(void); | |
| 74 | + | |
| 75 | + const KEYTABLE *keys; | |
| 76 | +} KEYBOARD_INFO; | |
| 77 | + | |
| 78 | +#pragma pack() | |
| 79 | + | |
| 80 | +int set_3270_screen(const SCREEN_CALLBACK *scr); | |
| 81 | +int set_3270_keyboard(const KEYBOARD_INFO *kbd); | |
| 22 | 82 | int run_emulator(const char *cl_hostname); |
| 23 | 83 | |
| 84 | + | |
| 24 | 85 | #ifdef __cplusplus |
| 25 | 86 | } |
| 26 | 87 | #endif |
| 88 | + | |
| 89 | + | |
| 90 | +#endif // LIB3270_INCLUDED | ... | ... |
src/lib/screen.c
| ... | ... | @@ -36,12 +36,19 @@ |
| 36 | 36 | #include "utilc.h" |
| 37 | 37 | #include "widec.h" |
| 38 | 38 | #include "xioc.h" |
| 39 | +#include "lib3270.h" | |
| 39 | 40 | |
| 40 | 41 | /*---[ Publics ]--------------------------------------------------------------*/ |
| 41 | 42 | |
| 42 | -SCREEN_CALLBACK *screen_callbacks_3270 = 0; | |
| 43 | -Boolean escaped = True; | |
| 43 | +const SCREEN_CALLBACK *screen_callbacks_3270 = 0; | |
| 44 | +Boolean escaped = True; | |
| 44 | 45 | |
| 46 | +/* Set callback structure */ | |
| 47 | +int set_3270_screen(const SCREEN_CALLBACK *scr) | |
| 48 | +{ | |
| 49 | + screen_callbacks_3270 = scr; | |
| 50 | + return 0; | |
| 51 | +} | |
| 45 | 52 | |
| 46 | 53 | /* Initialize the screen. */ |
| 47 | 54 | void screen_init(void) | ... | ... |
src/lib/screenc.h
| ... | ... | @@ -13,47 +13,7 @@ |
| 13 | 13 | |
| 14 | 14 | /* c3270 version of screenc.h */ |
| 15 | 15 | |
| 16 | - | |
| 17 | -#pragma pack(1) | |
| 18 | - | |
| 19 | -#define SCREEN_MAGIC 0x4871 | |
| 20 | - | |
| 21 | -typedef struct _screen_callback | |
| 22 | -{ | |
| 23 | - unsigned short sz; | |
| 24 | - unsigned short magic; | |
| 25 | - | |
| 26 | - void (*screen_init)(void); | |
| 27 | - void (*screen_disp)(Boolean erasing unused); | |
| 28 | - void (*screen_suspend)(void); | |
| 29 | - void (*screen_resume)(void); | |
| 30 | - | |
| 31 | - void (*cursor_move)(int baddr); | |
| 32 | - void (*toggle_monocase)(struct toggle *t unused, enum toggle_type tt unused); | |
| 33 | - | |
| 34 | - void (*status_ctlr_done)(void); | |
| 35 | - void (*status_insert_mode)(Boolean on); | |
| 36 | - void (*status_minus)(void); | |
| 37 | - void (*status_oerr)(int error_type); | |
| 38 | - void (*status_reset)(void); | |
| 39 | - void (*status_reverse_mode)(Boolean on); | |
| 40 | - void (*status_syswait)(void); | |
| 41 | - void (*status_twait)(void); | |
| 42 | - void (*status_typeahead)(Boolean on); | |
| 43 | - void (*status_compose)(Boolean on, unsigned char c, enum keytype keytype); | |
| 44 | - void (*status_lu)(const char *lu); | |
| 45 | - | |
| 46 | - void (*ring_bell)(void); | |
| 47 | - void (*screen_flip)(void); | |
| 48 | - void (*screen_width)(int width); | |
| 49 | - | |
| 50 | - void (*Redraw_action)(Widget w, XEvent *event, String *params, Cardinal *num_params); | |
| 51 | - | |
| 52 | -} SCREEN_CALLBACK; | |
| 53 | - | |
| 54 | -#pragma pack() | |
| 55 | - | |
| 56 | -extern SCREEN_CALLBACK *screen_callbacks_3270; | |
| 16 | +#include "lib3270.h" | |
| 57 | 17 | |
| 58 | 18 | #define blink_start() |
| 59 | 19 | #define display_heightMM() 100 |
| ... | ... | @@ -67,18 +27,11 @@ extern SCREEN_CALLBACK *screen_callbacks_3270; |
| 67 | 27 | #define screen_scroll() |
| 68 | 28 | |
| 69 | 29 | extern void cursor_move(int baddr); |
| 70 | -extern void cursor_move(int baddr); | |
| 71 | 30 | extern void ring_bell(void); |
| 72 | -extern void ring_bell(void); | |
| 73 | -extern void screen_132(void); | |
| 74 | 31 | extern void screen_132(void); |
| 75 | 32 | extern void screen_80(void); |
| 76 | -extern void screen_80(void); | |
| 77 | -extern void screen_disp(Boolean erasing); | |
| 78 | 33 | extern void screen_disp(Boolean erasing); |
| 79 | 34 | extern void screen_init(void); |
| 80 | -extern void screen_init(void); | |
| 81 | -extern void screen_flip(void); | |
| 82 | 35 | extern void screen_flip(void); |
| 83 | 36 | extern void screen_resume(void); |
| 84 | 37 | extern void screen_suspend(void); | ... | ... |