Index: libuhpgl.h =================================================================== --- libuhpgl.h (revision 14924) +++ libuhpgl.h (revision 14925) @@ -126,6 +126,7 @@ /* current state: read-only for the caller, written by the lib */ struct { int pen; /* selected pen [0..255] */ + int pen_speed; unsigned pen_down:1; /* whether pen is down (drawing) */ uhpgl_point_t at; /* last known coordinate of the pen */ int ct; /* Chord Tolerance */ Index: parse.c =================================================================== --- parse.c (revision 14924) +++ parse.c (revision 14925) @@ -34,6 +34,7 @@ ST_INST, ST_INST_END, ST_NUMBERS_OR_END, + ST_SPC_NUMBERS_OR_END, ST_NUMBERS, ST_ESCAPED } state_t; @@ -260,6 +261,9 @@ /* prepare to read coords */ p->state = ST_NUMBERS; return 0; + case inst2num('V','S'): + p->state = ST_SPC_NUMBERS_OR_END; + return 0; } return error(ctx, "unimplemented instruction"); } @@ -356,6 +360,13 @@ return 0; } return error(ctx, "PT needs 1 argument"); + case inst2num('V','S'): + if ((p->argc == 1) && (is_last)) { + ctx->state.pen_speed = p->argv[0]; + p->state = ST_INST_END; + return 0; + } + return error(ctx, "VS needs 1 argument"); } return error(ctx, "unimplemented coord instruction"); } @@ -417,6 +428,11 @@ return error(ctx, "Expected semicolon to terminate instruction"); p->state = ST_IDLE; return 0; + case ST_SPC_NUMBERS_OR_END: + if (c == ' ') + return 0; + p->state = ST_NUMBERS; + /* fall thru: number */ case ST_NUMBERS_OR_END: if (c == ';') goto got_end;