Add information about the total number of elements
authorAlexey Gladkov <gladkov.alexey@gmail.com>
Sat, 21 Jun 2014 22:50:46 +0000 (02:50 +0400)
committerAlexey Gladkov <gladkov.alexey@gmail.com>
Sun, 22 Jun 2014 21:16:51 +0000 (01:16 +0400)
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
src/libkeymap/keymap/dump.h
src/libkeymap/keymap/kmap.h
src/libkeymap/kmap.c
src/libkeymap/summary.c

index 8057e3a..a121e5c 100644 (file)
@@ -29,6 +29,10 @@ struct kmapinfo {
        size_t      keymaps_alloced; /**< Number of keymaps dynamically allocated */
        size_t      functions;       /**< Number of function keys */
        size_t      composes;        /**< Number of compose definitions in actual use */
+
+       size_t      keymaps_total;
+       size_t      functions_total;
+       size_t      composes_total;
 };
 
 /**
index b16d31f..e4dd90c 100644 (file)
@@ -11,8 +11,7 @@
 int lk_add_map(struct lk_ctx *ctx,   unsigned int k_table);
 int lk_map_exists(struct lk_ctx *ctx, unsigned int k_table);
 
-int lk_maps_total(struct lk_ctx *ctx);
-int lk_keys_total(struct lk_ctx *ctx, unsigned int k_table);
+int lk_get_keys_total(struct lk_ctx *ctx, unsigned int k_table);
 
 int lk_add_key(struct lk_ctx *ctx, unsigned int k_table, unsigned int k_index, int keycode);
 int lk_del_key(struct lk_ctx *ctx, unsigned int k_table, unsigned int k_index);
index 08978db..28b9098 100644 (file)
@@ -17,13 +17,7 @@ lk_map_exists(struct lk_ctx *ctx, unsigned int k_table)
 }
 
 int
-lk_maps_total(struct lk_ctx *ctx)
-{
-       return ctx->keymap->total;
-}
-
-int
-lk_keys_total(struct lk_ctx *ctx, unsigned int k_table)
+lk_get_keys_total(struct lk_ctx *ctx, unsigned int k_table)
 {
        struct lk_array *map;
        map = lk_array_get_ptr(ctx->keymap, k_table);
index ae36446..46df90d 100644 (file)
@@ -68,6 +68,10 @@ lk_get_kmapinfo(struct lk_ctx *ctx, struct kmapinfo *res)
        res->functions = ctx->func_table->count;
        res->composes  = ctx->accent_table->count;
 
+       res->keymaps_total   = ctx->keymap->total;
+       res->functions_total = ctx->func_table->total;
+       res->composes_total  = ctx->accent_table->total;
+
        res->keymaps_alloced = 0;
 
        for (i = 0; i < MAX_NR_KEYMAPS; i++) {