aboutsummaryrefslogtreecommitdiff
path: root/jim-regexp.c
AgeCommit message (Collapse)AuthorFilesLines
2021-01-10package: add ABI version checkingSteve Bennett1-3/+1
jim.h now includes JIM_ABI_VERSION that should be incremented whenever the ABI changes. Then all loadable modules should call Jim_CheckAbiVersion() to make sure they are loaded against the correct version. Add Jim_PackageProvideCheck() that does both Jim_CheckAbiVersion() and Jim_PackageProvide() to simplify the implementation of loadable extensions. Also rename the "big" sqlite3 extension to just sqlite to avoid a naming conflict with the smaller jim-sqlite3 extension. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-07-31jimregexp: rename local regex functionsSteve Bennett1-8/+12
Avoid possible problems with when linking by renaming local regex to jim_regcomp, jim_regexec, etc. Fixes: #163 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04regsub: Fix regsub -all with \ASteve Bennett1-1/+8
regsub -all matches \A against the start of each match, but correctly handle a pattern like ^ which does not advance the match Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-28regexp: Fix -indices in the utf-8 caseSteve Bennett1-1/+1
The calculation of the end index was wrong. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-27regexp -indices should return character indicesSteve Bennett1-8/+7
Not byte indices Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-27regexp, regsub: -start is a character indexSteve Bennett1-1/+4
Not a byte index Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-09-16remove special regexpValue internal repSteve Bennett1-6/+10
To avoid an explosion of different internal rep structures, simply use the existing ptrIntValue for jim-regexp Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-02-02regexp: Enable additional regexp/regsub testsSteve Bennett1-2/+2
Many Tcl regexp tests now work correctly with Jim regexp Also update regsub/regexp wrong # args error message to match Tcl 8.6 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2015-12-13regsub: fix substitution with a trailing backslashSteve Bennett1-1/+4
Should just replace with the bare backslash, not backslash '\0' Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-21many comment changes, some small code changesSteve Bennett1-1/+5
Sweep through and clean up all (most) of the comments in the code. While there, adjust some variable and function names to be more consistent, and make a few small code changes - again, mostly for consistency. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-24Create build-jim-ext for building extensionsSteve Bennett1-1/+1
Simplifies the process of building loadable extensions Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-12Remove all trailing whitespace in sourceSteve Bennett1-5/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-27Fix object leak in regexp/regsubSteve Bennett1-4/+2
During internal rep change to regex Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-01Add Jim_String() macroSteve Bennett1-5/+5
It is very common to get the string value without the length. Jim_String() is a macro which does that. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-19jim-regexp.c also needs jimautoconf.hSteve Bennett1-0/+1
Otherwise built-in regex impl. conflicts with externl regex Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17POSIX-compatible regex interfaceSteve Bennett1-1/+1
With some ARE extensions Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Mark some more static data as constSteve Bennett1-2/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Switch regexp/regsub to use Jim_GetEnum()Steve Bennett1-52/+76
Provides a better error message on wrong args and allows abbreviations. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Fix some outlier issues with regexp/regsubSteve Bennett1-12/+29
Use number of paren expressions with regexp -inline Fix a problem with regexp -start and an anchored search Fix regexp -inline -indices Fix regexp matching with an empty pattern (e.g. ^) Fix some cases where regsub -all did not return all results Fix some regsub cases with an empty pattern Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Allow regexp/regsub -start to be an indexSteve Bennett1-4/+11
Allows, e.g. -start end-4 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Fix regexp -all -line with an anchored searchSteve Bennett1-3/+5
Need to set REG_NOTBOL on subsequent calls to regexec() Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Licence wording updates.Steve Bennett1-2/+0
Per v0.51, don't refer to the FreeBSD licence Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix regsub to support strings with embedded nullsSteve Bennett1-15/+16
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix -Wshadow warningsSteve Bennett1-6/+6
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Ensure that Tcl extensions can be built-in or externalSteve Bennett1-0/+3
All C extensions must call Jim_PackageProvide() make-c-ext ensures that Tcl extensions call Jim_PackageProvide() if compiled in. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up some debuggingSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Make sure all static data is marked read-onlySteve Bennett1-1/+1
This reduces the size of the non-shared data segment Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett1-26/+40
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to jim configureSteve Bennett1-1/+0
Create and use config.h Check for backtrace, fork, vfork, syslog, regcomp and others Disable extensions which require missing functions/features Check for one arg vs. two arg mkdir() Distinguish between mingw and native windows The aio extension has reduced functionality for ANSI C only Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improve documentation, remove debuggingSteve Bennett1-2/+2
Completely document new regexp and regsub features Remove some old, commented-out debugging Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add Jim_SetResultFormatted() for simplied messagesSteve Bennett1-10/+3
Makes creating error messages much simpler Also convert a couple of long if/else to switch Also some error message improvements Also fix some memory leaks
2010-10-15Various general fixes and cleanupsSteve Bennett1-2/+0
Add lsearch -command, update case to use lsearch Rename tcl6.tcl to tclcompat.tcl Remove // style comments Expand some tabs to spaces Fix some compiler warnings Remove some unused functions Don't close fd=-1 in exec
2010-10-15Allow regsub to return the result as a stringSteve Bennett1-13/+18
From Tcl 8.4 (see TIP 76: http://www.tcl.tk/cgi-bin/tct/tip/76.html)
2010-10-15Build improvements, bug fixes and compiler warningsSteve Bennett1-1/+2
Remove unimplemented 'after restart|expire' from eventloop Allow libjim to be build as a shared library On some platforms, regex.h needs stdlib.h first Use ualarm() only for times < 1 second Fix warnings found by clang static analyser *: printf/syslog %m isn't portable *: some variables set but never read *: some possible null pointer references (although mostly impossible) *: also minor fixes to jim unit tests Fix 'syslog -options <n>' Must null terminate readlink() result
2010-10-15Bugs, features and testsSteve Bennett1-21/+51
source fails with zero length file unknown can't be called recursively *: This can be useful when using unknown to dynamically load code, which may in turn want to dynamically load code *: Limit it to 50 recursions though Allow string greater/less comparison *: Comparing two strings for order did not work Implement file join *: It's not to hard and is handy when working with the current dir, "" Don't omit [unknown] completely from stack trace *: Since we lose valuable informtion, just omit the name Fix return from case Turn regexp patterns into real objects *: Thus caching the compiled regexps Allow error to rethrow an error Replace bcopy() with more standard memcpy() Fixes to parray, improve errorInfo *: errorInfo takes an optional stack trace Add tests for rethrowing errors via errorInfo Fix ndelay *: Was looking at wrong param *: Also fix usage/help for aio.socket Package should be able to call exit *: Currently any return from a package is changed to JIM_ERR Line counting is incorrect for backlash newline
2010-10-15Build fixes, better Jim_EvalFile()Steve Bennett1-8/+2
*: make-c-ext is now make-c-ext.tcl *: build doc/Tcl.html with asciidoc *: Jim_SetIntResult -> Jim_SetResultInt *: Jim_EvalFile() now reads the file contents in one go
2010-10-15Convert package to use jim-subcmdSteve Bennett1-481/+481
Also, no need to install tcl extensions Display any errors from loading static extensions
2010-10-15Make static extensions buildSteve Bennett1-1/+1
Also clean up some white space
2010-10-15Strip out unneeded junk from JimSteve Bennett1-2/+1
Nvp, getopt, move interactive processing to jim-interactive.c
2010-10-15Cutover to new workware fork of Jim TclSteve Bennett1-482/+482
Note that this commit removes some files and undoes some commits which will be reapplied later. This is the easiest way to switch across. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-02-21dos2unix: convert to unix line endingsØyvind Harboe1-482/+482
To ease rebasing Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-02-01Bring corrected license as mentioned in freebsd/...Wojciech A. Koszek1-1/+1
Remove "FreeBSD license" statements, since it's not a correct term I believe. Small cleanup while being here.
2010-02-01Revert "Bring correct license -- I think freebsd/ directory has an agreements"Wojciech A. Koszek1-1/+1
This reverts commit 1e2fdd7d9e877fbe2c88a4c32f098ce1e575dc1d.
2010-02-01Bring correct license -- I think freebsd/ directory has an agreementsWojciech A. Koszek1-1/+1
for relicensing all files within Jim project. "FreeBSD license" isn't correct term, so basically remove it. Try to make the whole place consistent.
2008-11-062008-11-05 Steve Bennett <steveb@workware.net.au>oharboe1-0/+482
* jim-regexp.c: Add regexp extension for regexp and regsub commands