From 682f23e7bb4a52bedf46eff5c4859e1308eda124 Mon Sep 17 00:00:00 2001 From: Michał Cichoń Date: Tue, 25 Aug 2015 19:56:24 +0200 Subject: Update build ref --- vtparse/src/README | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 vtparse/src/README (limited to 'vtparse/src/README') diff --git a/vtparse/src/README b/vtparse/src/README new file mode 100644 index 0000000..9b24113 --- /dev/null +++ b/vtparse/src/README @@ -0,0 +1,67 @@ + +VTParse - an implementation of Paul Williams' DEC compatible state machine parser + + +Author: Joshua Haberman + +This code is in the public domain. + +BUILDING +======== + +Ruby is required at build time to generate the tables in C. To build the library +and test program, just type make: + +$ make +ruby vtparse_gen_c_tables.rb +Wrote vtparse_table.h +Wrote vtparse_table.c +gcc -o test vtparse_test.c vtparse.c vtparse_table.c + +TEST PROGRAM +============ + +The test program shows how to use vtparse. To see what kind of data is returned +by the library, try: + +-------------------------------- + +$ vim > terminaloutput +' to exit vim, even though you won't see it> +$ ./test < terminaloutput | head -14 +Received action ESC_DISPATCH, char=0x37 +Intermediate chars: '' +0 Parameters: + +Received action CSI_DISPATCH, char=0x68 +Intermediate chars: '???' +1 Parameters: + 47 + +Received action CSI_DISPATCH, char=0x68 +Intermediate chars: '???' +1 Parameters: + 1 + +--------------------------------- + +VERIFYING +========= + +You can also verify the validity of the state tables by running: + +$ ruby vtparse_check_tables.rb +Tables had all necessary transitions defined. + +This checks to make sure that state transitions are defined for all states, for all +characters 0-0xA0. + + +TODO +==== + +One possible enhancement is to allow the client to pass a return value from the +callback to say "stop parsing." The vtparse() function could return the number +of bytes consumed from the input buffer. This would be quite simple to do if +someone needed this functionality, but I don't, so I didn't bother. + -- cgit v1.2.3