chiark / gitweb /
terminal: add parser state-machine
authorDavid Herrmann <dh.herrmann@gmail.com>
Sun, 15 Jun 2014 12:50:00 +0000 (14:50 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 18 Jul 2014 10:53:41 +0000 (12:53 +0200)
commit1c9633d669948155455e29b0c6e770995a8b1ca3
tree9fac4ba6ccdd564b36caa2363999667aa601f182
parent28622e8f5b28412d97bf2f3a5df49c419be1e2c5
terminal: add parser state-machine

The term-parser is used to parse any input from TTY-clients. It reads CSI,
DCS, OSC and ST control sequences and normal escape sequences. It doesn't
do anything with the parsed data besides detecting the sequence and
returning it. The caller has to react to them.

The parser also comes with its own UTF-8 helpers. The reason for that is
that we don't want to assert() or hard-fail on parsing errors. Instead,
we treat any invalid UTF-8 sequences as ISO-8859-1. This allows pasting
invalid data into a terminal (which cannot be controlled through the TTY,
anyway) and we still deal with it in a proper manner.
This is _required_ for 8-bit and 7-bit DEC modes (including the g0-g3
mappings), so it's not just an ugly fallback because we can (it's still
horribly ugly but at least we have an excuse).
.gitignore
Makefile.am
src/libsystemd-terminal/term-charset.c [new file with mode: 0644]
src/libsystemd-terminal/term-internal.h
src/libsystemd-terminal/term-parser.c [new file with mode: 0644]
src/libsystemd-terminal/test-term-parser.c [new file with mode: 0644]