-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtab.h
153 lines (126 loc) · 3.78 KB
/
gtab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
typedef enum {
GTAB_space_auto_first_none=0, // use the value set by .cin
GTAB_space_auto_first_any=1, // boshiamy, dayi
GTAB_space_auto_first_full=2, // simplex
GTAB_space_auto_first_nofull=4, // windows ar30 cj
GTAB_space_auto_first_dayi=8 // dayi: input:2 select:1
} GTAB_space_pressed_E;
typedef struct {
u_char key[4]; /* If I use u_long key, the struc size will be 8 */
u_char ch[CH_SZ];
} ITEM;
typedef struct {
u_char key[8]; /* If I use u_long key, the struc size will be 8 */
u_char ch[CH_SZ];
} ITEM64;
#define MAX_GTAB_QUICK_KEYS 46
typedef struct {
char quick1[MAX_GTAB_QUICK_KEYS][10][CH_SZ];
char quick2[MAX_GTAB_QUICK_KEYS][MAX_GTAB_QUICK_KEYS][10][CH_SZ];
} QUICK_KEYS;
enum {
FLAG_KEEP_KEY_CASE=1,
FLAG_GTAB_SYM_KBM=2, // auto close, auto switch to default input method
FLAG_PHRASE_AUTO_SKIP_ENDKEY=4,
FLAG_AUTO_SELECT_BY_PHRASE=8,
FLAG_GTAB_DISP_PARTIAL_MATCH=0x10,
FLAG_GTAB_DISP_FULL_MATCH=0x20,
FLAG_GTAB_VERTICAL_SELECTION=0x40,
FLAG_GTAB_PRESS_FULL_AUTO_SEND=0x80,
FLAG_GTAB_UNIQUE_AUTO_SEND=0x100,
};
enum {
GTAB_OPTION_AUTO=0,
GTAB_OPTION_YES=1,
GTAB_OPTION_NO=2,
};
#define MAX_SELKEY 16
struct TableHead {
int version;
u_int flag;
char cname[32]; /* prompt */
char selkey[12]; /* select keys */
GTAB_space_pressed_E space_style;
int KeyS; /* number of keys needed */
int MaxPress; /* Max len of keystroke ar30:4 changjei:5 */
int M_DUP_SEL; /* how many keys used to select */
int DefC; /* Defined characters */
QUICK_KEYS qkeys;
union {
struct {
char endkey[99];
char keybits;
char selkey2[10];
};
char dummy[128]; // for future use
};
};
#define KeyBits1(inm) (inm->keybits)
#define KeyBits (cur_inmd->keybits)
#define MAX_GTAB_KEYS (1<<KeyBits)
#define MAX_TAB_KEY_NUM (32/KeyBits)
#define MAX_TAB_KEY_NUM1(inm) (32/KeyBits1(inm))
#define MAX_TAB_KEY_NUM64 (64/KeyBits)
#define MAX_TAB_KEY_NUM641(inm) (64/KeyBits1(inm))
struct _GCIN_module_callback_functions;
typedef u_int gtab_idx1_t;
typedef struct {
ITEM *tbl;
ITEM64 *tbl64;
QUICK_KEYS *qkeys;
int use_quick;
u_int flag;
#define MAX_CNAME (4*CH_SZ+1)
char *cname;
char *keycol;
int KeyS; /* number of keys needed */
int MaxPress; /* Max len of keystrike ar30:5 changjei:5 */
int DefChars; /* defined chars */
char *keyname; // including ?*
char *keyname_lookup; // used by boshiamy only
gtab_idx1_t *idx1;
char *keymap;
char *selkey;
u_char *sel1st;
int M_DUP_SEL;
int phrnum;
int *phridx;
char *phrbuf;
char *filename, *filename_append;
time_t file_modify_time;
gboolean key64; // db is 64 bit-long key
gboolean disabled; // will not be display in the selection menu
int max_keyN;
char *endkey; // only pinin/ar30 use it
GTAB_space_pressed_E space_style;
char *icon;
u_char kmask, keybits, last_k_bitn, method_type;
char WILD_QUES, WILD_STAR;
struct _GCIN_module_callback_functions *mod_cb_funcs;
char key_ch, in_cycle;
} INMD;
enum {
method_type_GTAB=1,
method_type_PHO=3,
method_type_TSIN=6,
method_type_MODULE=12,
method_type_SYMBOL_TABLE=13,
method_type_EN=14,
};
extern INMD *inmd;
extern int inmdN;
u_int64_t CONVT2(INMD *inmd, int i);
extern INMD *cur_inmd;
void load_gtab_list(gboolean);
char current_method_type();
#define LAST_K_bitN (cur_inmd->last_k_bitn)
#define KEY_MASK ((1<<cur_inmd->keybits)-1);
#define GTAB_LIST "gtab.list"
#if 1
#define NEED_SWAP (__BYTE_ORDER == __BIG_ENDIAN && 0)
#else
#define NEED_SWAP (1)
#endif
#define tblch2(inm, i) (inm->key64 ? inm->tbl64[i].ch:inm->tbl[i].ch)
#define Max_tab_key_num1(inm) (inm->key64 ? MAX_TAB_KEY_NUM641(inm) : MAX_TAB_KEY_NUM1(inm))
#define Max_tab_key_num Max_tab_key_num1(cur_inmd)