Use only C89 commenting style in .h file, in case of C89 compilers or similar that want to link
This commit is contained in:
parent
0486ca8212
commit
242da047a0
54
termkey.h.in
54
termkey.h.in
|
@ -18,17 +18,17 @@ typedef enum {
|
||||||
TERMKEY_SYM_UNKNOWN = -1,
|
TERMKEY_SYM_UNKNOWN = -1,
|
||||||
TERMKEY_SYM_NONE = 0,
|
TERMKEY_SYM_NONE = 0,
|
||||||
|
|
||||||
// Special names in C0
|
/* Special names in C0 */
|
||||||
TERMKEY_SYM_BACKSPACE,
|
TERMKEY_SYM_BACKSPACE,
|
||||||
TERMKEY_SYM_TAB,
|
TERMKEY_SYM_TAB,
|
||||||
TERMKEY_SYM_ENTER,
|
TERMKEY_SYM_ENTER,
|
||||||
TERMKEY_SYM_ESCAPE,
|
TERMKEY_SYM_ESCAPE,
|
||||||
|
|
||||||
// Special names in G0
|
/* Special names in G0 */
|
||||||
TERMKEY_SYM_SPACE,
|
TERMKEY_SYM_SPACE,
|
||||||
TERMKEY_SYM_DEL,
|
TERMKEY_SYM_DEL,
|
||||||
|
|
||||||
// Special keys
|
/* Special keys */
|
||||||
TERMKEY_SYM_UP,
|
TERMKEY_SYM_UP,
|
||||||
TERMKEY_SYM_DOWN,
|
TERMKEY_SYM_DOWN,
|
||||||
TERMKEY_SYM_LEFT,
|
TERMKEY_SYM_LEFT,
|
||||||
|
@ -43,7 +43,7 @@ typedef enum {
|
||||||
TERMKEY_SYM_HOME,
|
TERMKEY_SYM_HOME,
|
||||||
TERMKEY_SYM_END,
|
TERMKEY_SYM_END,
|
||||||
|
|
||||||
// Special keys from terminfo
|
/* Special keys from terminfo */
|
||||||
TERMKEY_SYM_CANCEL,
|
TERMKEY_SYM_CANCEL,
|
||||||
TERMKEY_SYM_CLEAR,
|
TERMKEY_SYM_CLEAR,
|
||||||
TERMKEY_SYM_CLOSE,
|
TERMKEY_SYM_CLOSE,
|
||||||
|
@ -67,7 +67,7 @@ typedef enum {
|
||||||
TERMKEY_SYM_SUSPEND,
|
TERMKEY_SYM_SUSPEND,
|
||||||
TERMKEY_SYM_UNDO,
|
TERMKEY_SYM_UNDO,
|
||||||
|
|
||||||
// Numeric keypad special keys
|
/* Numeric keypad special keys */
|
||||||
TERMKEY_SYM_KP0,
|
TERMKEY_SYM_KP0,
|
||||||
TERMKEY_SYM_KP1,
|
TERMKEY_SYM_KP1,
|
||||||
TERMKEY_SYM_KP2,
|
TERMKEY_SYM_KP2,
|
||||||
|
@ -87,7 +87,7 @@ typedef enum {
|
||||||
TERMKEY_SYM_KPPERIOD,
|
TERMKEY_SYM_KPPERIOD,
|
||||||
TERMKEY_SYM_KPEQUALS,
|
TERMKEY_SYM_KPEQUALS,
|
||||||
|
|
||||||
// et cetera ad nauseum
|
/* et cetera ad nauseum */
|
||||||
TERMKEY_N_SYMS
|
TERMKEY_N_SYMS
|
||||||
} TermKeySym;
|
} TermKeySym;
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ enum {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TermKeyType type;
|
TermKeyType type;
|
||||||
union {
|
union {
|
||||||
long codepoint; // TERMKEY_TYPE_UNICODE
|
long codepoint; /* TERMKEY_TYPE_UNICODE */
|
||||||
int number; // TERMKEY_TYPE_FUNCTION
|
int number; /* TERMKEY_TYPE_FUNCTION */
|
||||||
TermKeySym sym; // TERMKEY_TYPE_KEYSYM
|
TermKeySym sym; /* TERMKEY_TYPE_KEYSYM */
|
||||||
char mouse[4]; // TERMKEY_TYPE_MOUSE
|
char mouse[4]; /* TERMKEY_TYPE_MOUSE */
|
||||||
// opaque. see termkey_interpret_mouse
|
/* opaque. see termkey_interpret_mouse */
|
||||||
} code;
|
} code;
|
||||||
|
|
||||||
int modifiers;
|
int modifiers;
|
||||||
|
@ -139,19 +139,19 @@ typedef struct {
|
||||||
typedef struct _TermKey TermKey;
|
typedef struct _TermKey TermKey;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TERMKEY_FLAG_NOINTERPRET = 1 << 0, // Do not interpret C0//DEL codes if possible
|
TERMKEY_FLAG_NOINTERPRET = 1 << 0, /* Do not interpret C0//DEL codes if possible */
|
||||||
TERMKEY_FLAG_CONVERTKP = 1 << 1, // Convert KP codes to regular keypresses
|
TERMKEY_FLAG_CONVERTKP = 1 << 1, /* Convert KP codes to regular keypresses */
|
||||||
TERMKEY_FLAG_RAW = 1 << 2, // Input is raw bytes, not UTF-8
|
TERMKEY_FLAG_RAW = 1 << 2, /* Input is raw bytes, not UTF-8 */
|
||||||
TERMKEY_FLAG_UTF8 = 1 << 3, // Input is definitely UTF-8
|
TERMKEY_FLAG_UTF8 = 1 << 3, /* Input is definitely UTF-8 */
|
||||||
TERMKEY_FLAG_NOTERMIOS = 1 << 4, // Do not make initial termios calls on construction
|
TERMKEY_FLAG_NOTERMIOS = 1 << 4, /* Do not make initial termios calls on construction */
|
||||||
TERMKEY_FLAG_SPACESYMBOL = 1 << 5, // Sets TERMKEY_CANON_SPACESYMBOL
|
TERMKEY_FLAG_SPACESYMBOL = 1 << 5, /* Sets TERMKEY_CANON_SPACESYMBOL */
|
||||||
TERMKEY_FLAG_CTRLC = 1 << 6, // Allow Ctrl-C to be read as normal, disabling SIGINT
|
TERMKEY_FLAG_CTRLC = 1 << 6, /* Allow Ctrl-C to be read as normal, disabling SIGINT */
|
||||||
TERMKEY_FLAG_EINTR = 1 << 7 // Return ERROR on signal (EINTR) rather than retry
|
TERMKEY_FLAG_EINTR = 1 << 7 /* Return ERROR on signal (EINTR) rather than retry */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TERMKEY_CANON_SPACESYMBOL = 1 << 0, // Space is symbolic rather than Unicode
|
TERMKEY_CANON_SPACESYMBOL = 1 << 0, /* Space is symbolic rather than Unicode */
|
||||||
TERMKEY_CANON_DELBS = 1 << 1, // Del is converted to Backspace
|
TERMKEY_CANON_DELBS = 1 << 1, /* Del is converted to Backspace */
|
||||||
};
|
};
|
||||||
|
|
||||||
void termkey_check_version(int major, int minor);
|
void termkey_check_version(int major, int minor);
|
||||||
|
@ -192,15 +192,15 @@ TermKeySym termkey_keyname2sym(TermKey *tk, const char *keyname);
|
||||||
TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKeyMouseEvent *event, int *button, int *line, int *col);
|
TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKeyMouseEvent *event, int *button, int *line, int *col);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TERMKEY_FORMAT_LONGMOD = 1 << 0, // Shift-... instead of S-...
|
TERMKEY_FORMAT_LONGMOD = 1 << 0, /* Shift-... instead of S-... */
|
||||||
TERMKEY_FORMAT_CARETCTRL = 1 << 1, // ^X instead of C-X
|
TERMKEY_FORMAT_CARETCTRL = 1 << 1, /* ^X instead of C-X */
|
||||||
TERMKEY_FORMAT_ALTISMETA = 1 << 2, // Meta- or M- instead of Alt- or A-
|
TERMKEY_FORMAT_ALTISMETA = 1 << 2, /* Meta- or M- instead of Alt- or A- */
|
||||||
TERMKEY_FORMAT_WRAPBRACKET = 1 << 3, // Wrap special keys in brackets like <Escape>
|
TERMKEY_FORMAT_WRAPBRACKET = 1 << 3, /* Wrap special keys in brackets like <Escape> */
|
||||||
|
|
||||||
TERMKEY_FORMAT_MOUSE_POS = 1 << 8 // Include mouse position if relevant; @ col,line
|
TERMKEY_FORMAT_MOUSE_POS = 1 << 8 /* Include mouse position if relevant; @ col,line */
|
||||||
} TermKeyFormat;
|
} TermKeyFormat;
|
||||||
|
|
||||||
// Some useful combinations
|
/* Some useful combinations */
|
||||||
|
|
||||||
#define TERMKEY_FORMAT_VIM (TERMKEY_FORMAT_ALTISMETA|TERMKEY_FORMAT_WRAPBRACKET)
|
#define TERMKEY_FORMAT_VIM (TERMKEY_FORMAT_ALTISMETA|TERMKEY_FORMAT_WRAPBRACKET)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue