Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Walter Waldo's port of Henry Spencer's regular expression library from Tcl. https://garyhouston.github.io/regex/
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Type||Name||Latest commit message||Commit time|
|Failed to load latest commit information.|
This is a port to make standalone available the Henry Spencer's Regex Library from Tcl 8.6a2. In the hope that the Tcl developers take this port as the base for their RE module, great effort was paid to not update the *.c files, sadly it was not possible. Some *.h files suffered dirty updates for the same reasons. To build and test make ./regtest_hsrex.sh To rebuild make clean make To build against the other library uncomment the proper line in the file regtest_hsrex.sh and execute again. # Either this one $CC -I. -I$H/inc -L. -lhsrex -o $rgbin $rgsrc # or this one #$CC -I. -I$H/inc -L. -lhswrex -DREGEX_WCHAR -o $rgbin $rgsrc You would like to test with debuging information. Uncomment the proper line in the Makefile and rebuild. # Either this one #CFLAGS = -DREGEX_STANDALONE -fPIC -DREG_DEBUG -g # Or this one CFLAGS = -DREGEX_STANDALONE -fPIC -D_NDEBUG -O3 Two libraries are provided, libhsrex.so and libhswrex.so. The first one is for ascii character code and the second one for wide characters. Both libraries were tested in Linux and Solaris. Compiling and runing in Window$ should be easy. The following entry point where defined in each library: re_comp() (re_wcomp() for wide char) to compile a RE re_exec() (re_wexec() for wide char) to parse data against a compiled RE. regfree() To dispose the memory of a compiled RE. regerror() Translates error codes to ascii strings. It is pretty easy to add support for a regcomp() regexec() front end. That front end functions should take care of UTF-8 to wide charater conversion, for instance. The regression test script regtest_hsrex.sh contains an example of how to use the libraries. It just test cases I was interested on. Adding more use cases to that script should be easy. Send any comments to Walter Waldo <firstname.lastname@example.org> Enjoy it, Walter Waldo.