2 VTParse - an implementation of Paul Williams' DEC compatible state machine parser
3 <http://www.vt100.net/emu/dec_ansi_parser>
5 Author: Joshua Haberman <joshua@reverberate.org>
7 This code is in the public domain.
12 Ruby is required at build time to generate the tables in C. To build the library
13 and test program, just type make:
16 <this will create the test program and libvtparse.a>
18 I have only tested the build on Mac OS X and Linux, but it should build anywhere
19 Ruby and GCC are available. Other C compilers should work as well, I just haven't
25 The test program shows how to use vtparse. To see what kind of data is returned
28 --------------------------------
30 $ vim > terminaloutput
31 <type ':q<ENTER>' to exit vim, even though you won't see it>
32 $ ./test < terminaloutput | head -16
33 Received action ESC_DISPATCH
36 Received action CSI_DISPATCH
43 Received action CSI_DISPATCH
50 ---------------------------------
55 You can also verify the validity of the state tables by running:
57 $ ruby vtparse_check_tables.rb
58 Tables had all necessary transitions defined.
60 This checks to make sure that state transitions are defined for all states, for all
67 One possible enhancement is to allow the client to pass a return value from the
68 callback to say "stop parsing." The vtparse() function could return the number
69 of bytes consumed from the input buffer. This would be quite simple to do if
70 someone needed this functionality, but I don't, so I didn't bother.
72 Currently there is no explicit character set support. I don't know enough about
73 the relevant standards to know if vtparse should have character set support, or
74 what that support would look like. Suggestions along this vein are very welcome!
79 Thanks to Julian Scheid for several bugfixes and enhancements.