libkeymap 2.6.3 Library to manage the Linux keymaps

Functions
common.h File Reference

Functions for initialization and release of resources as well as functions to handle parameters. More...

`#include <stdarg.h>`
`#include <keymap/context.h>`
`#include <keymap/logging.h>`

Go to the source code of this file.

## Functions
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, lk_logger_t log_fn, const void *data)

## Detailed Description

Functions for initialization and release of resources as well as functions to handle parameters.

## Function Documentation

## ◆ lk_init()

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.

## ◆ lk_free()

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_get_parser_flags()

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.

## ◆ lk_set_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.

## ◆ lk_get_log_priority()

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.

## ◆ lk_set_log_priority()

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.

## ◆ lk_set_log_fn()

int lk_set_log_fn | ( | struct lk_ctx * | ctx,
|  | lk_logger_t | 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.