libt3key
|
Data Structures | |
struct | t3_key_node_t |
A structure which is part of a singly linked list and contains a single key definition. More... | |
struct | t3_key_string_list_t |
A structure which is part of a singly linked list and contains a single string. More... | |
Macros | |
#define | T3_KEY_VERSION |
The version of libt3key encoded as a single integer. More... | |
Typedefs | |
typedef char | t3_bool |
A boolean type that does not clash with C++ or C99 bool. More... | |
Enumerations | |
enum | { t3_false, t3_true } |
Values for t3_bool , a boolean type that does not clash with C++ or C99 bool. More... | |
Functions | |
void | t3_key_free_map (const t3_key_node_t *list) |
Free a key map. More... | |
void | t3_key_free_names (const t3_key_string_list_t *list) |
Free a map names list. More... | |
char * | t3_key_get_best_map_name (const char *term, int *error) |
Get name of best map from database. More... | |
const t3_key_string_list_t * | t3_key_get_map_names (const char *term, int *error) |
Get map names from database. More... | |
const t3_key_node_t * | t3_key_get_named_node (const t3_key_node_t *map, const char *name) |
Get a named node from a map. More... | |
long | t3_key_get_version (void) |
Get the value of T3_KEY_VERSION corresponding to the actual used library. More... | |
const t3_key_node_t * | t3_key_load_map (const char *term, const char *map_name, int *error) |
Load a key map from database. More... | |
const char * | t3_key_strerror (int error) |
Get a string description for an error code. More... | |
Error codes (libt3key specific) | |
#define | T3_ERR_INVALID_FORMAT |
Error code: invalid key-database file format. More... | |
#define | T3_ERR_TERMINFO_UNKNOWN |
Error code: Required terminfo key not found in terminfo database. More... | |
#define | T3_ERR_NOMAP |
Error code: Key database contains no maps. More... | |
#define | T3_ERR_TRUNCATED_DB |
Error code: Key database is truncated. More... | |
#define | T3_ERR_READ_ERROR |
Error code: Error reading key database. More... | |
#define | T3_ERR_WRONG_VERSION |
Error code: Key database is of an unsupported version. More... | |
Error codes (T3 generic) | |
#define | T3_ERR_SUCCESS |
Error code: success. | |
#define | T3_ERR_ERRNO |
Error code: see errno . More... | |
#define | T3_ERR_EOF |
Error code: end of file reached. More... | |
#define | T3_ERR_UNKNOWN |
Error code: unkown error. More... | |
#define | T3_ERR_BAD_ARG |
Error code: bad argument. More... | |
#define | T3_ERR_OUT_OF_MEMORY |
Error code: out of memory. More... | |
#define | T3_ERR_TERMINFODB_NOT_FOUND |
Error code: no information found for the terminal in the terminfo database. More... | |
#define | T3_ERR_HARDCOPY_TERMINAL |
Error code: the file descriptor is a hard-copy terminal. More... | |
#define | T3_ERR_TERMINAL_TOO_LIMITED |
Error code: terminal provides too limited possibilities for the library to function. More... | |
#define | T3_ERR_NO_TERM |
Error code: no terminal given and TERM environment variable not set. More... | |
#define | T3_ERR_INTERNAL |
Error code: internal error in the library. More... | |
#define | T3_WARN_MIN |
Warning code: the smallest value returned as warning. More... | |
#define T3_ERR_BAD_ARG |
Error code: bad argument.
#define T3_ERR_EOF |
Error code: end of file reached.
#define T3_ERR_ERRNO |
Error code: see errno
.
#define T3_ERR_HARDCOPY_TERMINAL |
Error code: the file descriptor is a hard-copy terminal.
#define T3_ERR_INTERNAL |
Error code: internal error in the library.
#define T3_ERR_INVALID_FORMAT |
Error code: invalid key-database file format.
#define T3_ERR_NO_TERM |
Error code: no terminal given and TERM
environment variable not set.
#define T3_ERR_NOMAP |
Error code: Key database contains no maps.
#define T3_ERR_OUT_OF_MEMORY |
Error code: out of memory.
#define T3_ERR_READ_ERROR |
Error code: Error reading key database.
#define T3_ERR_TERMINAL_TOO_LIMITED |
Error code: terminal provides too limited possibilities for the library to function.
#define T3_ERR_TERMINFO_UNKNOWN |
Error code: Required terminfo key not found in terminfo database.
#define T3_ERR_TERMINFODB_NOT_FOUND |
Error code: no information found for the terminal in the terminfo database.
#define T3_ERR_TRUNCATED_DB |
Error code: Key database is truncated.
#define T3_ERR_UNKNOWN |
Error code: unkown error.
#define T3_ERR_WRONG_VERSION |
Error code: Key database is of an unsupported version.
#define T3_KEY_VERSION |
The version of libt3key encoded as a single integer.
The least significant 8 bits represent the patch level. The second 8 bits represent the minor version. The third 8 bits represent the major version.
At runtime, the value of T3_KEY_VERSION can be retrieved by calling t3_key_get_version.
#define T3_WARN_MIN |
Warning code: the smallest value returned as warning.
typedef char t3_bool |
A boolean type that does not clash with C++ or C99 bool.
anonymous enum |
void t3_key_free_map | ( | const t3_key_node_t * | list | ) |
Free a key map.
list | The list of keys to free. |
void t3_key_free_names | ( | const t3_key_string_list_t * | list | ) |
Free a map names list.
list | The list of map names to free. |
char* t3_key_get_best_map_name | ( | const char * | term, |
int * | error | ||
) |
Get name of best map from database.
term | The terminal name to use to find the key database. |
error | Location to store the error code. |
If term
is NULL
, the environment variable TERM is used to retrieve the terminal name. The name is allocated using malloc
.
const t3_key_string_list_t* t3_key_get_map_names | ( | const char * | term, |
int * | error | ||
) |
Get map names from database.
term | The terminal name to use to find the key database. |
error | Location to store the error code. |
If term
is NULL
, the environment variable TERM is used to retrieve the terminal name.
const t3_key_node_t* t3_key_get_named_node | ( | const t3_key_node_t * | map, |
const char * | name | ||
) |
Get a named node from a map.
map | The map to search. |
name | The name of the node to search for, or NULL to continue the last search. |
NULL
if no such node exists.Multiple nodes may exist with the same name. To retrieve all of them, t3_key_get_named_node may be called multiple times. The second and later calls must use the returned value as the map
parameter, and pass NULL
as name
.
long t3_key_get_version | ( | void | ) |
Get the value of T3_KEY_VERSION corresponding to the actual used library.
This function can be useful to determine at runtime what version of the library was linked to the program. Although currently there are no known uses for this information, future library additions may prompt library users to want to operate differently depending on the available features.
const t3_key_node_t* t3_key_load_map | ( | const char * | term, |
const char * | map_name, | ||
int * | error | ||
) |
Load a key map from database.
term | The terminal name to use to find the key database. |
map_name | Name of the map to load for the terminal. |
error | Location to store the error code. |
If term
is NULL
, the environment variable TERM
is used to retrieve the terminal name. The map_name
parameter indicates which map to load. If map_name
is NULL
, the map indicated by best in the database is used.
Before calling this function, you must ensure that the terminfo database has been initialised by calling one of setupterm
, initscr
, newterm
, setterm
, or the t3_term_init
function.
const char* t3_key_strerror | ( | int | error | ) |
Get a string description for an error code.
error | The error code returned by a function in libt3key. |