Blame src/libkeymap/keymap/common.h

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