Rename 'ctx' back to 'context' in external API

Still keep things as 'ctx' internally so we don't have to worry about
typing it too often, but rename the user-visible API back as it was
kinda ugly.

This partially reverts e7bb1e5f.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-05-11 15:03:43 +01:00
parent f95b41131d
commit 7b00485a6b
25 changed files with 157 additions and 157 deletions

View File

@ -118,9 +118,9 @@ struct xkb_rule_names {
/**
* Opaque context object; may only be created, accessed, manipulated and
* destroyed through the xkb_ctx_*() API.
* destroyed through the xkb_context_*() API.
*/
struct xkb_ctx;
struct xkb_context;
/**
* Opaque keymap object; may only be created, accessed, manipulated and
@ -153,14 +153,14 @@ xkb_keysym_t
xkb_keysym_from_name(const char *s);
/**
* @defgroup ctx XKB contexts
* @defgroup context XKB contexts
* Every keymap compilation request must have an XKB context associated with
* it. The context keeps around state such as the include path.
*
* @{
*/
enum xkb_ctx_flags {
enum xkb_context_flags {
/** Create this context with an empty include path. */
XKB_CONTEXT_NO_DEFAULT_INCLUDES = 1,
};
@ -168,10 +168,10 @@ enum xkb_ctx_flags {
/**
* Returns a new XKB context, or NULL on failure. If successful, the caller
* holds a reference on the context, and must free it when finished with
* xkb_ctx_unref().
* xkb_context_unref().
*/
struct xkb_ctx *
xkb_ctx_new(enum xkb_ctx_flags flags);
struct xkb_context *
xkb_context_new(enum xkb_context_flags flags);
/**
* Appends a new entry to the include path used for keymap compilation.
@ -179,7 +179,7 @@ xkb_ctx_new(enum xkb_ctx_flags flags);
* inaccessible.
*/
int
xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path);
xkb_context_include_path_append(struct xkb_context *context, const char *path);
/**
* Appends the default include paths to the context's current include path.
@ -187,7 +187,7 @@ xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path);
* added.
*/
int
xkb_ctx_include_path_append_default(struct xkb_ctx *ctx);
xkb_context_include_path_append_default(struct xkb_context *context);
/**
* Removes all entries from the context's include path, and inserts the
@ -195,37 +195,37 @@ xkb_ctx_include_path_append_default(struct xkb_ctx *ctx);
* could not be added.
*/
int
xkb_ctx_include_path_reset_defaults(struct xkb_ctx *ctx);
xkb_context_include_path_reset_defaults(struct xkb_context *context);
/**
* Removes all entries from the context's include path.
*/
void
xkb_ctx_include_path_clear(struct xkb_ctx *ctx);
xkb_context_include_path_clear(struct xkb_context *context);
/**
* Returns the number of include paths currently active in the context.
*/
unsigned int
xkb_ctx_num_include_paths(struct xkb_ctx *ctx);
xkb_context_num_include_paths(struct xkb_context *context);
/**
* Returns the include path at the specified index within the context.
*/
const char *
xkb_ctx_include_path_get(struct xkb_ctx *ctx, unsigned int index);
xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
/**
* Takes a new reference on an XKB context.
*/
struct xkb_ctx *
xkb_ctx_ref(struct xkb_ctx *ctx);
struct xkb_context *
xkb_context_ref(struct xkb_context *context);
/**
* Releases a reference on an XKB context, and possibly frees it.
*/
void
xkb_ctx_unref(struct xkb_ctx *ctx);
xkb_context_unref(struct xkb_context *context);
/** @} */
@ -249,7 +249,7 @@ enum xkb_map_compile_flags {
* keymaps.
*/
struct xkb_keymap *
xkb_map_new_from_names(struct xkb_ctx *ctx,
xkb_map_new_from_names(struct xkb_context *context,
const struct xkb_rule_names *names,
enum xkb_map_compile_flags flags);
@ -263,7 +263,7 @@ enum xkb_keymap_format {
* file descriptor.
*/
struct xkb_keymap *
xkb_map_new_from_fd(struct xkb_ctx *ctx,
xkb_map_new_from_fd(struct xkb_context *context,
int fd, enum xkb_keymap_format format,
enum xkb_map_compile_flags flags);
@ -272,7 +272,7 @@ xkb_map_new_from_fd(struct xkb_ctx *ctx,
* enormous string.
*/
struct xkb_keymap *
xkb_map_new_from_string(struct xkb_ctx *ctx,
xkb_map_new_from_string(struct xkb_context *context,
const char *string,
enum xkb_keymap_format format,
enum xkb_map_compile_flags flags);

View File

@ -582,7 +582,7 @@ XkbcFreeIndicatorMaps(struct xkb_keymap *keymap)
}
struct xkb_keymap *
XkbcAllocKeyboard(struct xkb_ctx *ctx)
XkbcAllocKeyboard(struct xkb_context *ctx)
{
struct xkb_keymap *keymap;
@ -591,7 +591,7 @@ XkbcAllocKeyboard(struct xkb_ctx *ctx)
return NULL;
keymap->refcnt = 1;
keymap->ctx = xkb_ctx_ref(ctx);
keymap->ctx = xkb_context_ref(ctx);
return keymap;
}
@ -608,6 +608,6 @@ XkbcFreeKeyboard(struct xkb_keymap *keymap)
XkbcFreeIndicatorMaps(keymap);
XkbcFreeNames(keymap);
XkbcFreeControls(keymap);
xkb_ctx_unref(keymap->ctx);
xkb_context_unref(keymap->ctx);
free(keymap);
}

View File

@ -43,7 +43,7 @@ extern int
XkbcAllocIndicatorMaps(struct xkb_keymap *keymap);
extern struct xkb_keymap *
XkbcAllocKeyboard(struct xkb_ctx *ctx);
XkbcAllocKeyboard(struct xkb_context *ctx);
extern void
XkbcFreeKeyboard(struct xkb_keymap *keymap);

View File

@ -31,7 +31,7 @@
#include "xkb-priv.h"
#include "atom.h"
struct xkb_ctx {
struct xkb_context {
int refcnt;
char **include_paths;
@ -48,7 +48,7 @@ struct xkb_ctx {
* Append one directory to the context's include path.
*/
_X_EXPORT int
xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path)
xkb_context_include_path_append(struct xkb_context *ctx, const char *path)
{
struct stat stat_buf;
int err;
@ -87,13 +87,13 @@ xkb_ctx_include_path_append(struct xkb_ctx *ctx, const char *path)
* Append the default include directories to the context.
*/
_X_EXPORT int
xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
xkb_context_include_path_append_default(struct xkb_context *ctx)
{
const char *home = getenv("HOME");
char *user_path;
int err;
(void) xkb_ctx_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
(void) xkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
home = getenv("HOME");
if (!home)
@ -101,7 +101,7 @@ xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
err = asprintf(&user_path, "%s/.xkb", home);
if (err <= 0)
return 1;
(void) xkb_ctx_include_path_append(ctx, user_path);
(void) xkb_context_include_path_append(ctx, user_path);
free(user_path);
return 1;
@ -111,7 +111,7 @@ xkb_ctx_include_path_append_default(struct xkb_ctx *ctx)
* Remove all entries in the context's include path.
*/
_X_EXPORT void
xkb_ctx_include_path_clear(struct xkb_ctx *ctx)
xkb_context_include_path_clear(struct xkb_context *ctx)
{
int i;
@ -125,20 +125,20 @@ xkb_ctx_include_path_clear(struct xkb_ctx *ctx)
}
/**
* xkb_ctx_include_path_clear() + xkb_ctx_include_path_append_default()
* xkb_context_include_path_clear() + xkb_context_include_path_append_default()
*/
_X_EXPORT int
xkb_ctx_include_path_reset_defaults(struct xkb_ctx *ctx)
xkb_context_include_path_reset_defaults(struct xkb_context *ctx)
{
xkb_ctx_include_path_clear(ctx);
return xkb_ctx_include_path_append_default(ctx);
xkb_context_include_path_clear(ctx);
return xkb_context_include_path_append_default(ctx);
}
/**
* Returns the number of entries in the context's include path.
*/
_X_EXPORT unsigned int
xkb_ctx_num_include_paths(struct xkb_ctx *ctx)
xkb_context_num_include_paths(struct xkb_context *ctx)
{
return ctx->num_include_paths;
}
@ -148,16 +148,16 @@ xkb_ctx_num_include_paths(struct xkb_ctx *ctx)
* invalid index is passed.
*/
_X_EXPORT const char *
xkb_ctx_include_path_get(struct xkb_ctx *ctx, unsigned int idx)
xkb_context_include_path_get(struct xkb_context *ctx, unsigned int idx)
{
if (idx >= xkb_ctx_num_include_paths(ctx))
if (idx >= xkb_context_num_include_paths(ctx))
return NULL;
return ctx->include_paths[idx];
}
int
xkb_ctx_take_file_id(struct xkb_ctx *ctx)
xkb_context_take_file_id(struct xkb_context *ctx)
{
return ctx->file_id++;
}
@ -165,8 +165,8 @@ xkb_ctx_take_file_id(struct xkb_ctx *ctx)
/**
* Take a new reference on the context.
*/
_X_EXPORT struct xkb_ctx *
xkb_ctx_ref(struct xkb_ctx *ctx)
_X_EXPORT struct xkb_context *
xkb_context_ref(struct xkb_context *ctx)
{
ctx->refcnt++;
return ctx;
@ -177,12 +177,12 @@ xkb_ctx_ref(struct xkb_ctx *ctx)
* now 0.
*/
_X_EXPORT void
xkb_ctx_unref(struct xkb_ctx *ctx)
xkb_context_unref(struct xkb_context *ctx)
{
if (--ctx->refcnt > 0)
return;
xkb_ctx_include_path_clear(ctx);
xkb_context_include_path_clear(ctx);
atom_table_free(ctx->atom_table);
free(ctx);
}
@ -190,10 +190,10 @@ xkb_ctx_unref(struct xkb_ctx *ctx)
/**
* Create a new context.
*/
_X_EXPORT struct xkb_ctx *
xkb_ctx_new(enum xkb_ctx_flags flags)
_X_EXPORT struct xkb_context *
xkb_context_new(enum xkb_context_flags flags)
{
struct xkb_ctx *ctx = calloc(1, sizeof(*ctx));
struct xkb_context *ctx = calloc(1, sizeof(*ctx));
if (!ctx)
return NULL;
@ -201,14 +201,14 @@ xkb_ctx_new(enum xkb_ctx_flags flags)
ctx->refcnt = 1;
if (!(flags & XKB_CONTEXT_NO_DEFAULT_INCLUDES) &&
!xkb_ctx_include_path_append_default(ctx)) {
xkb_ctx_unref(ctx);
!xkb_context_include_path_append_default(ctx)) {
xkb_context_unref(ctx);
return NULL;
}
ctx->atom_table = atom_table_new();
if (!ctx->atom_table) {
xkb_ctx_unref(ctx);
xkb_context_unref(ctx);
return NULL;
}
@ -216,19 +216,19 @@ xkb_ctx_new(enum xkb_ctx_flags flags)
}
xkb_atom_t
xkb_atom_intern(struct xkb_ctx *ctx, const char *string)
xkb_atom_intern(struct xkb_context *ctx, const char *string)
{
return atom_intern(ctx->atom_table, string);
}
char *
xkb_atom_strdup(struct xkb_ctx *ctx, xkb_atom_t atom)
xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom)
{
return atom_strdup(ctx->atom_table, atom);
}
const char *
xkb_atom_text(struct xkb_ctx *ctx, xkb_atom_t atom)
xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom)
{
return atom_text(ctx->atom_table, atom);
}

View File

@ -361,7 +361,7 @@ struct xkb_controls {
/* Common keyboard description structure */
struct xkb_keymap {
struct xkb_ctx *ctx;
struct xkb_context *ctx;
unsigned int refcnt;
unsigned short flags;
@ -434,13 +434,13 @@ typedef uint32_t xkb_atom_t;
#define XKB_ATOM_NONE 0
xkb_atom_t
xkb_atom_intern(struct xkb_ctx *ctx, const char *string);
xkb_atom_intern(struct xkb_context *ctx, const char *string);
char *
xkb_atom_strdup(struct xkb_ctx *ctx, xkb_atom_t atom);
xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom);
const char *
xkb_atom_text(struct xkb_ctx *ctx, xkb_atom_t atom);
xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
extern unsigned int
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
@ -483,12 +483,12 @@ xkb_canonicalise_components(struct xkb_component_names *names,
* Geometry will be ignored since xkbcommon does not support it in any way.
*/
struct xkb_keymap *
xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
xkb_map_new_from_kccgst(struct xkb_context *ctx,
const struct xkb_component_names *kccgst,
enum xkb_map_compile_flags flags);
extern int
xkb_ctx_take_file_id(struct xkb_ctx *ctx);
xkb_context_take_file_id(struct xkb_context *ctx);
extern bool
XkbcComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type,

View File

@ -1085,7 +1085,7 @@ ApplyActionFactoryDefaults(union xkb_action * action)
}
static void
ActionsInit(struct xkb_ctx *ctx);
ActionsInit(struct xkb_context *ctx);
int
HandleActionDef(ExprDef * def,
@ -1249,7 +1249,7 @@ SetActionField(struct xkb_keymap *keymap,
/***====================================================================***/
static void
ActionsInit(struct xkb_ctx *ctx)
ActionsInit(struct xkb_context *ctx)
{
if (!actionsInitialized)
{

View File

@ -28,7 +28,7 @@
/***====================================================================***/
typedef bool (*IdentLookupFunc) (struct xkb_ctx *ctx, const void *priv,
typedef bool (*IdentLookupFunc) (struct xkb_context *ctx, const void *priv,
xkb_atom_t field, unsigned type,
ExprResult *val_rtrn);
@ -161,7 +161,7 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
}
static bool
SimpleLookup(struct xkb_ctx *ctx, const void *priv,
SimpleLookup(struct xkb_context *ctx, const void *priv,
xkb_atom_t field, unsigned type, ExprResult *val_rtrn)
{
const LookupEntry *entry;
@ -197,14 +197,14 @@ static const LookupEntry modIndexNames[] = {
};
bool
LookupModIndex(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn)
{
return SimpleLookup(ctx, modIndexNames, field, type, val_rtrn);
}
bool
LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn)
{
const char *str;
@ -227,7 +227,7 @@ LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
}
int
ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
int ok = 0;
@ -309,7 +309,7 @@ ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
int ok = 0;
@ -404,7 +404,7 @@ ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
ExprResult leftRtrn, rightRtrn;
@ -482,7 +482,7 @@ ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
* Cool.
*/
static int
ExprResolveIntegerLookup(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn, IdentLookupFunc lookup,
const void *lookupPriv)
{
@ -590,14 +590,14 @@ ExprResolveIntegerLookup(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveInteger(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, NULL, NULL);
}
int
ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
int ret;
@ -628,7 +628,7 @@ ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
int ret;
@ -659,7 +659,7 @@ ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
static const LookupEntry button_names[] = {
@ -677,7 +677,7 @@ ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
ExprResult leftRtrn, rightRtrn;
@ -762,7 +762,7 @@ ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
const char *bogus = NULL;
@ -826,7 +826,7 @@ ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
/***====================================================================***/
int
ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn, const LookupEntry *values)
{
if (expr->op != ExprIdent)
@ -856,7 +856,7 @@ ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
}
static int
ExprResolveMaskLookup(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn, IdentLookupFunc lookup,
const void *lookupPriv)
{
@ -954,14 +954,14 @@ ExprResolveMaskLookup(struct xkb_ctx *ctx, ExprDef *expr,
}
int
ExprResolveMask(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn, const LookupEntry *values)
{
return ExprResolveMaskLookup(ctx, expr, val_rtrn, SimpleLookup, values);
}
int
ExprResolveModMask(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
return ExprResolveMaskLookup(ctx, expr, val_rtrn, LookupModMask, NULL);
@ -976,7 +976,7 @@ ExprResolveVModMask(ExprDef *expr, ExprResult *val_rtrn,
}
int
ExprResolveKeySym(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn)
{
int ok = 0;

View File

@ -53,19 +53,19 @@ extern const char *
exprOpText(unsigned type);
extern bool
LookupModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn);
extern bool
LookupVModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn);
extern bool
LookupModIndex(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn);
extern int
ExprResolveModMask(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
@ -73,51 +73,51 @@ ExprResolveVModMask(ExprDef *expr, ExprResult *val_rtrn,
struct xkb_keymap *keymap);
extern int
ExprResolveBoolean(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveKeyCode(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveInteger(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveLevel(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveGroup(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveButton(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveFloat(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveString(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveKeyName(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
extern int
ExprResolveEnum(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn, const LookupEntry *values);
extern int
ExprResolveMask(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn, const LookupEntry *values);
extern int
ExprResolveKeySym(struct xkb_ctx *ctx, ExprDef *expr,
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
ExprResult *val_rtrn);
#endif /* EXPR_H */

View File

@ -40,7 +40,7 @@
/***====================================================================***/
void
ClearIndicatorMapInfo(struct xkb_ctx *ctx, LEDInfo * info)
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info)
{
info->name = xkb_atom_intern(ctx, "default");
info->indicator = _LED_NotBound;

View File

@ -54,7 +54,7 @@ typedef struct _LEDInfo
} LEDInfo;
extern void
ClearIndicatorMapInfo(struct xkb_ctx *ctx, LEDInfo *info);
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo *info);
extern LEDInfo *

View File

@ -33,7 +33,7 @@
* XkmKeyNamesIdx, etc.)
*/
struct xkb_keymap *
CompileKeymap(struct xkb_ctx *ctx, XkbFile *file)
CompileKeymap(struct xkb_context *ctx, XkbFile *file)
{
unsigned have;
bool ok;

View File

@ -44,7 +44,7 @@
* @return true on success or false otherwise.
*/
bool
ProcessIncludeFile(struct xkb_ctx *ctx,
ProcessIncludeFile(struct xkb_context *ctx,
IncludeStmt * stmt,
unsigned file_type,
XkbFile ** file_rtrn, unsigned *merge_rtrn)

View File

@ -682,7 +682,7 @@ EnsureSafeMapName(char *name)
}
XkbFile *
CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
CreateXKBFile(struct xkb_context *ctx, int type, char *name,
ParseCommon *defs, unsigned flags)
{
XkbFile *file;
@ -696,7 +696,7 @@ CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
file->topName = uDupString(name);
file->name = name;
file->defs = defs;
file->id = xkb_ctx_take_file_id(ctx);
file->id = xkb_context_take_file_id(ctx);
file->flags = flags;
}
return file;

View File

@ -33,7 +33,7 @@
#include "parser.h"
struct parser_param {
struct xkb_ctx *ctx;
struct xkb_context *ctx;
void *scanner;
XkbFile *rtrn;
};
@ -120,15 +120,15 @@ extern void
CheckDefaultMap(XkbFile *maps, const char *fileName);
extern XkbFile *
CreateXKBFile(struct xkb_ctx *ctx, int type, char *name,
CreateXKBFile(struct xkb_context *ctx, int type, char *name,
ParseCommon *defs, unsigned flags);
extern bool
XKBParseFile(struct xkb_ctx *ctx, FILE *file,
XKBParseFile(struct xkb_context *ctx, FILE *file,
const char *file_name, XkbFile **out);
extern bool
XKBParseString(struct xkb_ctx *context, const char *string,
XKBParseString(struct xkb_context *context, const char *string,
const char *file_name, XkbFile **out);
extern void

View File

@ -179,7 +179,7 @@ XkbDirectoryForInclude(unsigned type)
* pathRtrn is undefined.
*/
FILE *
XkbFindFileInPath(struct xkb_ctx *ctx,
XkbFindFileInPath(struct xkb_context *ctx,
const char *name, unsigned type, char **pathRtrn)
{
size_t i;
@ -189,21 +189,21 @@ XkbFindFileInPath(struct xkb_ctx *ctx,
const char *typeDir;
typeDir = XkbDirectoryForInclude(type);
for (i = 0; i < xkb_ctx_num_include_paths(ctx); i++)
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
{
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
xkb_ctx_include_path_get(ctx, i), typeDir, name);
xkb_context_include_path_get(ctx, i), typeDir, name);
if (ret >= (ssize_t)sizeof(buf))
{
ERROR("File name (%s/%s/%s) too long\n",
xkb_ctx_include_path_get(ctx, i), typeDir, name);
xkb_context_include_path_get(ctx, i), typeDir, name);
ACTION("Ignored\n");
continue;
}
file = fopen(buf, "r");
if (file == NULL) {
ERROR("Couldn't open file (%s/%s/%s): %s\n",
xkb_ctx_include_path_get(ctx, i), typeDir, name,
xkb_context_include_path_get(ctx, i), typeDir, name,
strerror(-errno));
ACTION("Ignored\n");
continue;

View File

@ -205,7 +205,7 @@ yyerror(struct YYLTYPE *loc, void *scanner, const char *msg)
}
bool
XKBParseString(struct xkb_ctx *ctx, const char *string,
XKBParseString(struct xkb_context *ctx, const char *string,
const char *file_name, XkbFile **out)
{
int ret;
@ -241,7 +241,7 @@ XKBParseString(struct xkb_ctx *ctx, const char *string,
}
bool
XKBParseFile(struct xkb_ctx *ctx, FILE *file,
XKBParseFile(struct xkb_context *ctx, FILE *file,
const char *file_name, XkbFile **out)
{
int ret;

View File

@ -190,7 +190,7 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
* undefined.
*/
bool
LookupVModMask(struct xkb_ctx *ctx, const void *priv, xkb_atom_t field,
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn)
{
if (LookupModMask(ctx, NULL, field, type, val_rtrn))

View File

@ -64,7 +64,7 @@ extern int
ReportBadField(const char *type, const char *field, const char *name);
extern bool
ProcessIncludeFile(struct xkb_ctx *ctx,
ProcessIncludeFile(struct xkb_context *ctx,
IncludeStmt *stmt, unsigned file_type, XkbFile **file_rtrn,
unsigned *merge_rtrn);
@ -84,7 +84,7 @@ extern const char *
XkbDirectoryForInclude(unsigned type);
extern FILE *
XkbFindFileInPath(struct xkb_ctx *ctx, const char *name,
XkbFindFileInPath(struct xkb_context *ctx, const char *name,
unsigned type, char **pathRtrn);
extern bool

View File

@ -34,7 +34,7 @@ unsigned int warningLevel = 0;
#define ISEMPTY(str) (!(str) || (strlen(str) == 0))
static XkbFile *
XkbKeymapFileFromComponents(struct xkb_ctx *ctx,
XkbKeymapFileFromComponents(struct xkb_context *ctx,
const struct xkb_component_names *ktcsg)
{
XkbFile *keycodes, *types, *compat, *symbols;
@ -65,7 +65,7 @@ XkbKeymapFileFromComponents(struct xkb_ctx *ctx,
}
static struct xkb_component_names *
XkbComponentsFromRules(struct xkb_ctx *ctx,
XkbComponentsFromRules(struct xkb_context *ctx,
const char *rules,
const XkbRF_VarDefsPtr defs)
{
@ -79,9 +79,9 @@ XkbComponentsFromRules(struct xkb_ctx *ctx,
if (!rulesFile) {
ERROR("could not find \"%s\" rules in XKB path\n", rules);
ERROR("%d include paths searched:\n",
xkb_ctx_num_include_paths(ctx));
for (i = 0; i < xkb_ctx_num_include_paths(ctx); i++)
ERROR("\t%s\n", xkb_ctx_include_path_get(ctx, i));
xkb_context_num_include_paths(ctx));
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
ERROR("\t%s\n", xkb_context_include_path_get(ctx, i));
return NULL;
}
@ -120,7 +120,7 @@ unwind_file:
}
_X_EXPORT struct xkb_keymap *
xkb_map_new_from_names(struct xkb_ctx *ctx,
xkb_map_new_from_names(struct xkb_context *ctx,
const struct xkb_rule_names *rmlvo,
enum xkb_map_compile_flags flags)
{
@ -192,7 +192,7 @@ XkbChooseMap(XkbFile *file, const char *name)
}
static struct xkb_keymap *
compile_keymap(struct xkb_ctx *ctx, XkbFile *file)
compile_keymap(struct xkb_context *ctx, XkbFile *file)
{
XkbFile *mapToUse;
struct xkb_keymap *keymap = NULL;
@ -214,7 +214,7 @@ err:
}
_X_EXPORT struct xkb_keymap *
xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
xkb_map_new_from_kccgst(struct xkb_context *ctx,
const struct xkb_component_names *kccgst,
enum xkb_map_compile_flags flags)
{
@ -254,7 +254,7 @@ xkb_map_new_from_kccgst(struct xkb_ctx *ctx,
}
_X_EXPORT struct xkb_keymap *
xkb_map_new_from_string(struct xkb_ctx *ctx,
xkb_map_new_from_string(struct xkb_context *ctx,
const char *string,
enum xkb_keymap_format format,
enum xkb_map_compile_flags flags)
@ -280,7 +280,7 @@ xkb_map_new_from_string(struct xkb_ctx *ctx,
}
_X_EXPORT struct xkb_keymap *
xkb_map_new_from_fd(struct xkb_ctx *ctx,
xkb_map_new_from_fd(struct xkb_context *ctx,
int fd,
enum xkb_keymap_format format,
enum xkb_map_compile_flags flags)

View File

@ -250,7 +250,7 @@ typedef struct _XkbFile
} XkbFile;
extern struct xkb_keymap *
CompileKeymap(struct xkb_ctx *ctx, XkbFile *file);
CompileKeymap(struct xkb_context *ctx, XkbFile *file);
extern bool
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);

View File

@ -30,13 +30,13 @@
int
main(void)
{
struct xkb_ctx *ctx = xkb_ctx_new(0);
struct xkb_context *context = xkb_context_new(0);
assert(ctx);
assert(context);
/* FIXME: Test include path stuff. */
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 0;
}

View File

@ -40,28 +40,28 @@ static int
test_file(const char *path)
{
int fd;
struct xkb_ctx *ctx;
struct xkb_context *context;
struct xkb_keymap *keymap;
fd = open(path, O_RDONLY);
assert(fd >= 0);
ctx = xkb_ctx_new(0);
assert(ctx);
context = xkb_context_new(0);
assert(context);
fprintf(stderr, "\nCompiling path: %s\n", path);
keymap = xkb_map_new_from_fd(ctx, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
keymap = xkb_map_new_from_fd(context, fd, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
close(fd);
if (!keymap) {
fprintf(stderr, "Failed to compile keymap\n");
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 0;
}
xkb_map_unref(keymap);
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 1;
}
@ -78,22 +78,22 @@ test_file_name(const char *file_name)
static int
test_string(const char *string)
{
struct xkb_ctx *ctx;
struct xkb_context *context;
struct xkb_keymap *keymap;
ctx = xkb_ctx_new(0);
assert(ctx);
context = xkb_context_new(0);
assert(context);
fprintf(stderr, "\nCompiling string\n");
keymap = xkb_map_new_from_string(ctx, string, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
keymap = xkb_map_new_from_string(context, string, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
if (!keymap) {
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 0;
}
xkb_map_unref(keymap);
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 1;
}

View File

@ -37,7 +37,7 @@ test_names(const char *keycodes, const char *types,
const char *compat, const char *symbols)
{
int ret = 1;
struct xkb_ctx *ctx;
struct xkb_context *context;
struct xkb_keymap *keymap;
struct xkb_component_names kccgst = {
.keymap = NULL,
@ -47,21 +47,21 @@ test_names(const char *keycodes, const char *types,
.symbols = strdup(symbols),
};
ctx = xkb_ctx_new(0);
assert(ctx);
context = xkb_context_new(0);
assert(context);
fprintf(stderr, "\nCompiling %s %s %s %s\n", kccgst.keycodes, kccgst.types,
kccgst.compat, kccgst.symbols);
keymap = xkb_map_new_from_kccgst(ctx, &kccgst, 0);
keymap = xkb_map_new_from_kccgst(context, &kccgst, 0);
if (!keymap) {
ret = 0;
goto err_ctx;
goto err_context;
}
xkb_map_unref(keymap);
err_ctx:
xkb_ctx_unref(ctx);
err_context:
xkb_context_unref(context);
free(kccgst.keycodes);
free(kccgst.types);
free(kccgst.compat);

View File

@ -33,7 +33,7 @@ static int
test_rmlvo(const char *rules, const char *model, const char *layout,
const char *variant, const char *options)
{
struct xkb_ctx *ctx;
struct xkb_context *context;
struct xkb_keymap *keymap;
struct xkb_rule_names rmlvo = {
.rules = rules,
@ -43,20 +43,20 @@ test_rmlvo(const char *rules, const char *model, const char *layout,
.options = options
};
ctx = xkb_ctx_new(0);
assert(ctx);
context = xkb_context_new(0);
assert(context);
fprintf(stderr, "\nCompiling %s %s %s %s %s\n", rmlvo.rules, rmlvo.model,
rmlvo.layout, rmlvo.variant, rmlvo.options);
keymap = xkb_map_new_from_names(ctx, &rmlvo, 0);
keymap = xkb_map_new_from_names(context, &rmlvo, 0);
if (!keymap) {
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 0;
}
xkb_map_unref(keymap);
xkb_ctx_unref(ctx);
xkb_context_unref(context);
return 1;
}

View File

@ -224,7 +224,7 @@ test_serialisation(struct xkb_keymap *keymap)
int
main(void)
{
struct xkb_ctx *ctx;
struct xkb_context *context;
struct xkb_keymap *keymap;
struct xkb_rule_names rmlvo = {
.rules = "evdev",
@ -234,15 +234,15 @@ main(void)
.options = NULL,
};
ctx = xkb_ctx_new(0);
assert(ctx);
context = xkb_context_new(0);
assert(context);
keymap = xkb_map_new_from_names(ctx, &rmlvo, 0);
keymap = xkb_map_new_from_names(context, &rmlvo, 0);
assert(keymap);
test_update_key(keymap);
test_serialisation(keymap);
xkb_map_unref(keymap);
xkb_ctx_unref(ctx);
xkb_context_unref(context);
}