Functions for initialization and release of resources as well as functions to handle parameters.
More...
#include <stdarg.h>
#include <keymap/context.h>
Go to the source code of this file.
|
struct lk_ctx * | lk_init (void) |
|
int | lk_free (struct lk_ctx *ctx) |
|
lk_flags | lk_get_parser_flags (struct lk_ctx *ctx) |
|
int | lk_set_parser_flags (struct lk_ctx *ctx, lk_flags flags) |
|
int | lk_get_log_priority (struct lk_ctx *ctx) |
|
int | lk_set_log_priority (struct lk_ctx *ctx, int priority) |
|
int | lk_set_log_fn (struct lk_ctx *ctx, void(*log_fn)(void *data, int priority, const char *file, int line, const char *fn, const char *format, va_list args), const void *data) |
|
Functions for initialization and release of resources as well as functions to handle parameters.
struct lk_ctx* lk_init |
( |
void |
| ) |
|
Initializes the structures necessary to read and/or parse keymap.
- Returns
- a pointer to keymap library context or NULL.
int lk_free |
( |
struct lk_ctx * |
ctx | ) |
|
Free keymap resources.
- Parameters
-
ctx | is a keymap library context. |
- Returns
- 0 on success, -1 on error
lk_flags lk_get_parser_flags |
( |
struct lk_ctx * |
ctx | ) |
|
Get the parser flags.
- Parameters
-
ctx | is a keymap library context. |
- Returns
- the current parser flags.
int lk_set_parser_flags |
( |
struct lk_ctx * |
ctx, |
|
|
lk_flags |
flags |
|
) |
| |
Set the parser flags.
- Parameters
-
ctx | is a keymap library context. |
flags | the new value of the flags. |
- Returns
- 0 on success, -1 on error.
int lk_get_log_priority |
( |
struct lk_ctx * |
ctx | ) |
|
Get the current logging priority.
- Parameters
-
ctx | is a keymap library context. |
- Returns
- the current logging priority or -1 on error.
int lk_set_log_priority |
( |
struct lk_ctx * |
ctx, |
|
|
int |
priority |
|
) |
| |
Set the current logging priority. The value controls which messages get logged.
- Parameters
-
ctx | is a keymap library context. |
- Returns
- the current logging priority.
int lk_set_log_fn |
( |
struct lk_ctx * |
ctx, |
|
|
void(*)(void *data, int priority, const char *file, int line, const char *fn, const char *format, va_list args) |
log_fn, |
|
|
const void * |
data |
|
) |
| |
The built-in logging writes to stderr. It can be overridden by a custom function to plug log messages into the user's logging functionality.
- Parameters
-
ctx | keymap library context |
log_fn | function to be called for logging messages |
data | data to pass to log function |
- Returns
- 0 on success, -1 on error.