2 releases
0.1.1 | Oct 20, 2023 |
---|---|
0.1.0 | Oct 20, 2023 |
#1936 in Parser implementations
105KB
1.5K
SLoC
Compiled ncurses terminfo file parser.
Format Support
This crate handles the binary terminfo format used by modern versions of ncurses. It may work with other implementations of curses (e.g. NetBSD), but there are no guarantees. File an issue if you find a widely used alternative implementation.
This crate currently supports the following formats:
- ncurses pre-5.0 legacy format (SVr4 compatible)
- ncurses 5.0 user-defined capabilities format
- ncurses 6.1 32-bit integer format
While ncurses restricts the size of compiled entries to 4096 and 32768 bytes for the legacy and 32-bit integer formats respectively and further restricts the length of the name field to 512 bytes, this crate imposes no such restrictions. As there is no support for writing entries, this should pose no issues.
Portability
While the binary terminfo format is de-facto standard between Unix versions, and the
capability names are part of the X/Open standard, implementations do differ in the order the
capabilities are stored in the compiled files. This is why capability indices (see the
index
feature) are provided for ncurses specifically.
If you're using this crate for terminfo files compiled for a different implementation of curses, you will likely need different names and indices.
For more information, see term(5), section PORTABILITY.
Crate Features
index
Enabled by default.
The index
module provides efficient translation from capability names to indices and back.
The indices are based on ncurses. See portability for potential caveats.
The module uses large tables of strings, so you may get longer compile times or binary sizes.
expand
Enabled by default.
The [mod@expand
] module implements the tiparm()
function, enabling the
expansion of parameterized capability strings. Part of the X/Open curses standard. See the
expand!
macro for more information.
search
Enabled by default.
The search
module provides customizable searching for terminfo entries on the system.
It matches the search behaviour of ncurses by default. The hashed database storage introduced
in ncurses 5.6 is not supported.
Dependencies
~1–12MB
~80K SLoC