version 1.159, 2019/08/05 06:42:02 |
version 1.160, 2019/09/24 20:44:58 |
|
|
{ |
{ |
struct input_ctx *ictx = wp->ictx; |
struct input_ctx *ictx = wp->ictx; |
struct screen_write_ctx *sctx = &ictx->ctx; |
struct screen_write_ctx *sctx = &ictx->ctx; |
const struct input_transition *itr; |
const struct input_state *state = NULL; |
|
const struct input_transition *itr = NULL; |
size_t off = 0; |
size_t off = 0; |
|
|
if (len == 0) |
if (len == 0) |
|
|
ictx->ch = buf[off++]; |
ictx->ch = buf[off++]; |
|
|
/* Find the transition. */ |
/* Find the transition. */ |
itr = ictx->state->transitions; |
if (ictx->state != state || |
while (itr->first != -1 && itr->last != -1) { |
itr == NULL || |
if (ictx->ch >= itr->first && ictx->ch <= itr->last) |
ictx->ch < itr->first || |
break; |
ictx->ch > itr->last) { |
itr++; |
itr = ictx->state->transitions; |
|
while (itr->first != -1 && itr->last != -1) { |
|
if (ictx->ch >= itr->first && ictx->ch <= itr->last) |
|
break; |
|
itr++; |
|
} |
|
if (itr->first == -1 || itr->last == -1) { |
|
/* No transition? Eh? */ |
|
fatalx("no transition from state"); |
|
} |
} |
} |
if (itr->first == -1 || itr->last == -1) { |
state = ictx->state; |
/* No transition? Eh? */ |
|
fatalx("no transition from state"); |
|
} |
|
|
|
/* |
/* |
* Any state except print stops the current collection. This is |
* Any state except print stops the current collection. This is |