Blame tests/libkeymap-dumpkeys.c
|
Packit Service |
50ad14 |
#include <stdio.h>
|
|
Packit Service |
50ad14 |
#include <stdlib.h>
|
|
Packit Service |
50ad14 |
#include <string.h>
|
|
Packit Service |
50ad14 |
#include <keymap.h>
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int main(int argc, char **argv)
|
|
Packit Service |
50ad14 |
{
|
|
Packit Service |
50ad14 |
lk_table_shape table;
|
|
Packit Service |
50ad14 |
char numeric;
|
|
Packit Service |
50ad14 |
struct lk_ctx *ctx;
|
|
Packit Service |
50ad14 |
lkfile_t f;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
if (argc == 1) {
|
|
Packit Service |
50ad14 |
printf("Usage: %s <keymap> <table_shape> <numeric>\n", argv[0]);
|
|
Packit Service |
50ad14 |
return 1;
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
if (!strcasecmp(argv[2], "FULL_TABLE"))
|
|
Packit Service |
50ad14 |
table = LK_SHAPE_FULL_TABLE;
|
|
Packit Service |
50ad14 |
else if (!strcasecmp(argv[2], "SEPARATE_LINES"))
|
|
Packit Service |
50ad14 |
table = LK_SHAPE_SEPARATE_LINES;
|
|
Packit Service |
50ad14 |
else if (!strcasecmp(argv[2], "UNTIL_HOLE"))
|
|
Packit Service |
50ad14 |
table = LK_SHAPE_UNTIL_HOLE;
|
|
Packit Service |
50ad14 |
else
|
|
Packit Service |
50ad14 |
table = LK_SHAPE_DEFAULT;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
numeric = (!strcasecmp(argv[3], "TRUE")) ? 1 : 0;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
ctx = lk_init();
|
|
Packit Service |
50ad14 |
lk_set_parser_flags(ctx, LK_FLAG_PREFER_UNICODE);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
f.pipe = 0;
|
|
Packit Service |
50ad14 |
strcpy(f.pathname, argv[1]);
|
|
Packit Service |
50ad14 |
f.fd = fopen(argv[1], "r");
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
lk_parse_keymap(ctx, &f);
|
|
Packit Service |
50ad14 |
lk_dump_keymap(ctx, stdout, table, numeric);
|
|
Packit Service |
50ad14 |
lk_dump_diacs(ctx, stdout);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
lk_free(ctx);
|
|
Packit Service |
50ad14 |
return 0;
|
|
Packit Service |
50ad14 |
}
|