From 762526485113ea711dcf322063b1f3c6dc3e753e Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 22 Feb 2020 11:30:30 +0100 Subject: sixel: clean up state machine Use proper state names, and implement the state machine using switch statements. --- terminal.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 05b9b00b..882abfba 100644 --- a/terminal.h +++ b/terminal.h @@ -355,7 +355,12 @@ struct terminal { } delayed_render_timer; struct { - enum { SIXEL_GROUND, SIXEL_REPEAT, SIXEL_RASTER, SIXEL_COLOR, SIXEL_COLOR_SPEC} state; + enum { + SIXEL_DECSIXEL, /* DECSIXEL body part ", $, -, ? ... ~ */ + SIXEL_DECGRA, /* DECGRA Set Raster Attributes " Pan; Pad; Ph; Pv */ + SIXEL_DECGRI, /* DECGRI Graphics Repeat Introducer ! Pn Ch */ + SIXEL_DECGCI, /* DECGCI Graphics Color Introducer # Pc; Pu; Px; Py; Pz */ + } state; struct coord pos; /* Current sixel coordinate */ int color_idx; /* Current palette index */ @@ -368,8 +373,8 @@ struct terminal { int height; /* Image height, in pixels */ } image; - unsigned params[4]; /* Collected parmaeters, for RASTER, COLOR_SPEC */ - unsigned int param; /* Currently collecting parameter, for RASTER, COLOR_SPEC and REPEAT */ + unsigned params[5]; /* Collected parmaeters, for RASTER, COLOR_SPEC */ + unsigned param; /* Currently collecting parameter, for RASTER, COLOR_SPEC and REPEAT */ unsigned param_idx; /* Parameters seen */ } sixel; -- cgit v1.3