2 * VTParse - an implementation of Paul Williams' DEC compatible state machine parser
4 * Author: Joshua Haberman <joshua@reverberate.org>
6 * This code is in the public domain.
12 void parser_callback(vtparse_t
*parser
, vtparse_action_t action
, unsigned char ch
)
16 printf("Received action %s, char=0x%02x\n", ACTION_NAMES
[action
]);
17 printf("Intermediate chars: '%s'\n", parser
->intermediate_chars
);
18 printf("%d Parameters:\n", parser
->num_params
);
19 for(i
= 0; i
< parser
->num_params
; i
++)
20 printf("\t%d\n", parser
->params
[i
]);
26 unsigned char buf
[1024];
30 vtparse_init(&parser
, parser_callback
);
33 bytes
= read(0, buf
, 1024);
34 vtparse(&parser
, buf
, bytes
);