#ifndef __KDEFINES_H__
#define __KDEFINES_H__

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_MYSCANS 110 /* MUST be at least max from myscan.h + 1 ! */

#ifndef T_BOOL_DEFINED
#define T_BOOL_DEFINED
typedef unsigned short t_bool; /* Boolean ... why this way? 'cos function prototypes! */
#endif
typedef unsigned char t_tcode; /* T-code */
typedef unsigned short t_flags; /* shift flags */
typedef unsigned int t_complete; /* scan + ascii - retval from bioskey() */
typedef unsigned short t_scan; /* scan code (part of complete) */
typedef unsigned short t_ascii; /* ascii code (part of complete), also part of result */
typedef unsigned int t_key; /* result of our conversions (ascii + CTRL, ALT flag) */
typedef unsigned int t_raw; /* result from key_raw() */

typedef t_ascii t_key_table_elem; /* single table element for key layout */
#define KEY_TABLE_ELEMS MAX_MYSCANS

typedef struct {
	t_bool shift; /* shift'd ? */
	t_tcode tcode; /* which tcode compose? */
	t_ascii ascii; /* result of composition */
} t_composition; /* dead key composition */

typedef struct {
	t_ascii dead; /* for which deadkey is this tbl? */
	t_composition *codes; /* composition codes */
} t_compose_table; /* table for composing deadkey + char */

typedef struct {
	t_key_table_elem *plain_deadkey;
	t_key_table_elem *shift_deadkey;
	t_key_table_elem *plain;
	t_key_table_elem *shift;
	t_key_table_elem *ctrl;
	t_key_table_elem *alt;
	t_key_table_elem *ctrl_alt;
	t_compose_table *compose;
} t_key_layout; /* keyboard layout */

#ifdef __cplusplus
}
#endif

#endif

/* vim: set ts=4 cindent shiftwidth=4 tw=0 : */
