dcs: initial handling of DCS in general

Add data structure to term->vt. This structure tracks the free-form
data that is passed-through, and the handler to call at the end.

Intermediates and parameters are collected by the normal VT
parser. Then, when we enter the passthrough state, we call dcs_hook().

This function checks the intermediate(s) and parameters, and selects
the appropriate unhook handler (and optionally does some execution
already).

In passthrough mode, we simply append strings to an internal
buffer. This might have to be changed in the future, if we need to
support a DCS that needs to execute as we go.

In unhook (i.e. when the DCS is terminated), we execute the unhook
handler.

As a proof-of-concept, handlers for BSU/ESU (Begin/End Synchronized
Update) has been added (but are left unimplemented).
This commit is contained in:
Daniel Eklöf 2020-01-12 11:55:22 +01:00
parent 0b30316261
commit 5a6cbb8c3e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 106 additions and 0 deletions

8
dcs.h Normal file
View file

@ -0,0 +1,8 @@
#pragma once
#include <stdbool.h>
#include "terminal.h"
void dcs_hook(struct terminal *term, uint8_t final);
void dcs_put(struct terminal *term, uint8_t c);
void dcs_unhook(struct terminal *term);