Commit graph

10 commits

Author SHA1 Message Date
Artturin
3a7ea1f44b scripts: generate-builtin-terminfo: fix syntax error 2024-05-01 21:18:41 +03:00
Daniel Eklöf
3c4669061b
scripts: generate-builtin-terminfo: use \xNN for control characters
Instead of emitting raw control characters (for e.g. bel, cub1 and
kbs), use \xNN C string escapes.
2024-04-30 10:50:31 +02:00
Daniel Eklöf
a3debf7741
dcs: xtgettcap: always reply with tigetstr(3) formatted "strings"
That is, instead of sometimes replying with a "source" encoded
string (where e.g. '\E' are returned just like that, and not as an
actual ESC), always unescape all string values.

This also includes \n \r \t \b \f \s, \^ \\ \ \:, as well as ^x-styled
escapes.

Closes #1701
2024-04-27 09:38:55 +02:00
Daniel Eklöf
f359a8d6bc
scripts: generate-builtin-terminfo: escape fixes
* Remove ‘:’ escaping only in raw (non-parameterized) sequences
* Double-escape *all* escape characters in parameterized sequences
2022-10-05 16:53:55 +02:00
Daniel Eklöf
fd743b5173
scripts: generate-builtin-terminfo: double-escape backslash in ST
Fixes an issue with XTGETTCAP, where escape sequences terminated with
ST, and containing parameters were missing a trailing backslash.
2022-10-05 16:53:54 +02:00
Daniel Eklöf
88c3128515
scripts: generate-builtin-terminfo: add synthetic ‘name’ capability
Same as ‘TN’; reports the terminfo name.
2022-09-28 21:09:35 +02:00
Daniel Eklöf
5a032c4c6f
xtgettcap: switch from a table based internal structure, to a single char array
Having the builtin terminfo DB as a table, with one entry per
capability/value pair was ineffective memory-wise - we ended up adding
~20K to the final binary size.

This patch changes the internal representation from a table, to a
single NULL-separated (and NULL-terminated) char array:

  cap1-name \0 cap1-value \0 cap2-name \0 cap2-value \0

The capabilities are still sorted; to lookup a capability we need to
scan from the beginning until we either find a match, or until the
capabilities from the DB sort higher (lexicographically) than the
searched-for capability.

The terminfo char array is 3.3K - more better than before.
2022-01-13 13:42:12 +01:00
Daniel Eklöf
44aad0941f
dcs: xtgettcap: handle boolean capabilities
Reply with DCS 1 + r <cap> ST
2022-01-13 13:42:11 +01:00
Daniel Eklöf
7feab6092c
scripts: generate-builtin-terminfo: add custom capability ‘Co’
This is a “special feature”, similar to “TN” and “RGB”:

   Co for termcap colors (or colors for terminfo colors)
2022-01-13 13:42:11 +01:00
Daniel Eklöf
b8fc56ecb4
script: add generate-builtin-terminfo.py
This script parses a terminfo source file and generates a C header
file with a static struct containing terminfo names and their values.

The table is sorted on the capability names
2022-01-13 13:42:11 +01:00