Add function to obtain items from the diacritical table
authorAlexey Gladkov <gladkov.alexey@gmail.com>
Tue, 24 Jun 2014 23:41:46 +0000 (03:41 +0400)
committerAlexey Gladkov <gladkov.alexey@gmail.com>
Tue, 24 Jun 2014 23:54:30 +0000 (03:54 +0400)
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
src/libkeymap/keymap/kmap.h
src/libkeymap/kmap.c

index fccaa0f..d6fa969 100644 (file)
@@ -21,6 +21,7 @@ int lk_key_exists(struct lk_ctx *ctx,   unsigned int k_table, unsigned int k_ind
 int lk_get_func(struct lk_ctx *ctx, struct kbsentry *kbs);
 int lk_add_func(struct lk_ctx *ctx, struct kbsentry kbs);
 
+int lk_get_diacr(struct lk_ctx *ctx, unsigned int index, struct lk_kbdiacr *dcr);
 int lk_add_diacr(struct lk_ctx *ctx, struct lk_kbdiacr *dcr);
 int lk_add_compose(struct lk_ctx *ctx, struct lk_kbdiacr *dcr);
 
index 8bfc3be..531e6ba 100644 (file)
@@ -211,6 +211,24 @@ lk_add_func(struct lk_ctx *ctx, struct kbsentry kbs)
 }
 
 int
+lk_get_diacr(struct lk_ctx *ctx, unsigned int index, struct lk_kbdiacr *dcr)
+{
+       struct lk_kbdiacr *ptr;
+
+       ptr = lk_array_get_ptr(ctx->accent_table, index);
+       if (!ptr) {
+               ERR(ctx, _("Index %d in the accent table does not exist"), index);
+               return -1;
+       }
+
+       dcr->diacr  = ptr->diacr;
+       dcr->base   = ptr->base;
+       dcr->result = ptr->result;
+
+       return 0;
+}
+
+int
 lk_add_diacr(struct lk_ctx *ctx, struct lk_kbdiacr *dcr)
 {
        struct lk_kbdiacr *ptr;