char long_info = 0;
char short_info = 0;
char numeric = 0;
- char table_shape = 0;
+ lk_table_shape table = LK_SHAPE_DEFAULT;
char funcs_only = 0;
char keys_only = 0;
char diac_only = 0;
numeric = 1;
break;
case 'f':
- table_shape = FULL_TABLE;
+ table = LK_SHAPE_FULL_TABLE;
break;
case '1':
- table_shape = SEPARATE_LINES;
+ table = LK_SHAPE_SEPARATE_LINES;
break;
case 'S':
- table_shape = atoi(optarg);
+ table = atoi(optarg);
break;
case 't':
funcs_only = 1;
if (!diac_only) {
#endif
if (!funcs_only) {
- lk_dump_keymap(&ctx, stdout, table_shape, numeric);
+ lk_dump_keymap(&ctx, stdout, table, numeric);
}
#ifdef KDGKBDIACR
}
}
void
-lk_dump_keys(struct lk_ctx *ctx, FILE *fd, char table_shape, char numeric)
+lk_dump_keys(struct lk_ctx *ctx, FILE *fd, lk_table_shape table, char numeric)
{
unsigned int i, j;
int buf[MAX_NR_KEYMAPS];
if (!keymapnr)
return;
- if (table_shape == FULL_TABLE || table_shape == SEPARATE_LINES)
+ if (table == LK_SHAPE_FULL_TABLE || table == LK_SHAPE_SEPARATE_LINES)
goto no_shorthands;
/* first pass: determine whether to set alt_is_meta */
all_holes = 0;
}
- if (all_holes && table_shape != FULL_TABLE)
+ if (all_holes && table != LK_SHAPE_FULL_TABLE)
continue;
- if (table_shape == FULL_TABLE) {
+ if (table == LK_SHAPE_FULL_TABLE) {
fprintf(fd, "keycode %3d =", i);
for (j = 0; j < keymapnr; j++)
continue;
}
- if (table_shape == SEPARATE_LINES) {
+ if (table == LK_SHAPE_SEPARATE_LINES) {
for (j = 0; j < keymapnr; j++) {
//if (buf[j] != K_HOLE)
print_bind(ctx, fd, buf[j], i, j, numeric);
} else {
for (j = 0;
j < keymapnr && buf[j] != K_HOLE &&
- (table_shape != UNTIL_HOLE || lk_map_exist(ctx, j));
+ (table != LK_SHAPE_UNTIL_HOLE || lk_map_exist(ctx, j));
j++) {
//print_bind(ctx, fd, buf[j], i, j, numeric);
print_keysym(ctx, fd, buf[j], numeric);
}
void
-lk_dump_keymap(struct lk_ctx *ctx, FILE *fd, char table_shape, char numeric)
+lk_dump_keymap(struct lk_ctx *ctx, FILE *fd, lk_table_shape table, char numeric)
{
lk_dump_keymaps(ctx, fd);
- lk_dump_keys(ctx, fd, table_shape, numeric);
+ lk_dump_keys(ctx, fd, table, numeric);
lk_dump_funcs(ctx, fd);
}
#include <keymap/context.h>
+typedef enum {
+ LK_SHAPE_DEFAULT = (1 << 1),
+ LK_SHAPE_FULL_TABLE = (1 << 2), /* one line for each keycode */
+ LK_SHAPE_SEPARATE_LINES = (1 << 3), /* one line for each (modifier,keycode) pair */
+ LK_SHAPE_UNTIL_HOLE = (1 << 4) /* one line for each keycode, until 1st hole */
+} lk_table_shape;
+
int lk_dump_bkeymap(struct lk_ctx *ctx, FILE *fd);
int lk_dump_ctable(struct lk_ctx *ctx, FILE *fd);
-void lk_dump_keymap(struct lk_ctx *ctx, FILE *fd, char table_shape, char numeric);
+void lk_dump_keymap(struct lk_ctx *ctx, FILE *fd, lk_table_shape table, char numeric);
+void lk_dump_keys(struct lk_ctx *ctx, FILE *fd, lk_table_shape table, char numeric);
void lk_dump_keymaps(struct lk_ctx *ctx, FILE *fd);
void lk_dump_funcs(struct lk_ctx *ctx, FILE *fd);
void lk_dump_diacs(struct lk_ctx *ctx, FILE *fd);
-#define DEFAULT 0
-#define FULL_TABLE 1 /* one line for each keycode */
-#define SEPARATE_LINES 2 /* one line for each (modifier,keycode) pair */
-#define UNTIL_HOLE 3 /* one line for each keycode, until 1st hole */
-
-void lk_dump_keys(struct lk_ctx *ctx, FILE *fd, char table_shape, char numeric);
-
void lk_dump_summary(struct lk_ctx *ctx, FILE *fd, int console);
void lk_dump_symbols(FILE *fd);
int main(int argc, char **argv)
{
- char table_shape, numeric;
+ lk_table_shape table;
+ char numeric;
struct lk_ctx ctx;
lkfile_t f;
return 1;
}
- if (!strcasecmp(argv[2], "FULL_TABLE")) table_shape = FULL_TABLE;
- else if (!strcasecmp(argv[2], "SEPARATE_LINES")) table_shape = SEPARATE_LINES;
- else if (!strcasecmp(argv[2], "UNTIL_HOLE")) table_shape = UNTIL_HOLE;
- else table_shape = DEFAULT;
+ if (!strcasecmp(argv[2], "FULL_TABLE")) table = LK_SHAPE_FULL_TABLE;
+ else if (!strcasecmp(argv[2], "SEPARATE_LINES")) table = LK_SHAPE_SEPARATE_LINES;
+ else if (!strcasecmp(argv[2], "UNTIL_HOLE")) table = LK_SHAPE_UNTIL_HOLE;
+ else table = LK_SHAPE_DEFAULT;
numeric = (!strcasecmp(argv[3], "TRUE")) ? 1 : 0;
f.fd = fopen( argv[1], "r");
lk_parse_keymap(&ctx, &f);
- lk_dump_keymap(&ctx, stdout, table_shape, numeric);
+ lk_dump_keymap(&ctx, stdout, table, numeric);
lk_dump_diacs(&ctx, stdout);
lk_free(&ctx);