Compose: add iterator API
authorRan Benita <ran@unusedvar.com>
Mon, 25 Sep 2023 09:41:48 +0000 (11:41 +0200)
committerWismill <dev@wismill.eu>
Tue, 26 Sep 2023 07:02:45 +0000 (09:02 +0200)
commita17701327e4bc6daa54114041a9707e00e15d82c
treea1172e812314e1c7974d1d1b0a82c0ebfaa8ad4f
parentc0065c95a479c7111417a6547d26594a5e31378b
Compose: add iterator API

Allow users to iterate the entries in a compose table. This is useful
for other projects which want programmable access to the sequences,
without having to write their own parser.

- New API:
  - `xkb_compose_table_entry_sequence`;
  - `xkb_compose_table_entry_keysym`;
  - `xkb_compose_table_entry_utf8`;
  - `xkb_compose_table_iterator_new`;
  - `xkb_compose_table_iterator_free`;
  - `xkb_compose_table_iterator_next`.
- Add tests in `test/compose.c`.
- Add benchmark for compose traversal.
- `tools/compose.c`:
  - Print entries instead of just validating them.
  - Add `--file` option.
  - TODO: make this tool part of the xkbcli commands.

Co-authored-by: Pierre Le Marre <dev@wismill.eu>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Signed-off-by: Ran Benita <ran@unusedvar.com>
bench/compose-traversal.c [new file with mode: 0644]
include/xkbcommon/xkbcommon-compose.h
meson.build
src/compose/parser.c
src/compose/parser.h
src/compose/table.c
src/compose/table.h
src/darray.h
test/compose.c
tools/compose.c
xkbcommon.map