skissane / vtparse Goto Github PK
View Code? Open in Web Editor NEWThis project forked from haberman/vtparse
A library to parse terminal escape sequences exactly how the real hardware does.
Home Page: http://vt100.net/emu/dec_ansi_parser
This project forked from haberman/vtparse
A library to parse terminal escape sequences exactly how the real hardware does.
Home Page: http://vt100.net/emu/dec_ansi_parser
VTParse - an implementation of Paul Williams' DEC compatible state machine parser <http://www.vt100.net/emu/dec_ansi_parser> Author: Joshua Haberman <[email protected]> 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 <this will create the test program and libvtparse.a> I have only tested the build on Mac OS X and Linux, but it should build anywhere Ruby and GCC are available. Other C compilers should work as well, I just haven't tried them. TEST PROGRAM ============ The test program shows how to use vtparse. To see what kind of data is returned by the library, try: -------------------------------- $ vim > terminaloutput <type ':q<ENTER>' to exit vim, even though you won't see it> $ ./test < terminaloutput | head -16 Received action ESC_DISPATCH Char: 0x37 ('7') Received action CSI_DISPATCH Char: 0x68 ('h') 1 Intermediate chars: 0x3f ('?') 1 Parameters: 47 Received action CSI_DISPATCH Char: 0x68 ('h') 1 Intermediate chars: 0x3f ('?') 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. Currently there is no explicit character set support. I don't know enough about the relevant standards to know if vtparse should have character set support, or what that support would look like. Suggestions along this vein are very welcome! CREDITS ======= Thanks to Julian Scheid for several bugfixes and enhancements.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.