diff options
-rwxr-xr-x | ChangeLog | 138 | ||||
-rwxr-xr-x | LICENSE | 27 | ||||
-rwxr-xr-x | NEWS | 82 | ||||
-rwxr-xr-x | README | 108 | ||||
-rwxr-xr-x | windows/dev-cpp/rex_pcre.mak | 59 | ||||
-rwxr-xr-x | windows/dev-cpp/rex_spencer.mak | 57 |
6 files changed, 342 insertions, 129 deletions
@@ -1,7 +1,145 @@ +2007-01-02 Shmuel + + * common.c (CheckFunction, OptFunction): functions removed. + * lpcre.c (put_integer): function removed. + +2006-12-31 Shmuel + + * common.c (udata_tostring): function removed. + * lpcre.c (Lpcre_tostring): added handling of deleted userdatum. + * lposix.c (Posix_tostring): added handling of deleted userdatum. + * lpcre.c: [API change] method `exec' now supports "named subpatterns". + * test/all_test.lua: renamed to runtest.lua. + +2006-12-30 Shmuel + + * lpcre.c: [API change] `versionPCRE' renamed to `version'. + +2006-12-29 Shmuel + + * lpcre.c: [API change] removed support of PCRE callout. + * test/pcre_sets.lua: removed testing of PCRE callout. + +2006-12-27 Shmuel + + * lpcre_f.c (config): [API change] the function accepts one optional + argument (a table), like the `flags' function. + +2006-12-26 Shmuel + + * lpcre.c, lposix.c (gsub): [API change] method become function. + * test/*.lua: modifying tests to reflect methods become functions. + * lua/rex.lua: file deleted. + * lpcre.c (luaopen_rex_pcre): changed the condition for validating + run-time PCRE version. + * lpcre_f.c: added new flags for support of PCRE 7.0. + * lpcre.c, lposix.c (checkarg_gsub): if the 3-rd argument is of type + "number" then it is converted to string (as in string.gsub). + +2006-12-25 Shmuel + + * lpcre.c, lposix.c (match, find, gmatch, split): [API change] + methods become functions. + +2006-12-23 Shmuel + + * test/*.lua: refactoring. + +2006-12-22 Shmuel + + * lpcre.c, lposix.c (tfind and exec): [API change] + the return value of the underlying pcre_exec/regexec call + is not added in the case of successfull match. + * lpcre.c, lposix.c (gtfind): [API change] method removed. + * lpcre.c, lposix.c: Lrexlib 2.0 beta -> Lrexlib 2.0. + * test/luatest.lua (eq): bugfix. + * lua/*.lua: deleted all lua files except for rex.lua. + * lua/rex.lua: fully rewritten; now contains wrappers for all methods. + +2006-12-21 Shmuel + + * test/*.lua: added tests for `split' method. + * test/luatest.lua (print_results): function added. + * test/common_sets.lua: file added. + +2006-12-19 Shmuel + + * lpcre.lua: `split' method added. + * lposix.lua: `split' method added. + * test/framework.lua: renamed to luatest.lua. + +2006-12-15 Shmuel + + * test/*.lua: refactoring. + +2006-12-11 Shmuel + + * test/*.lua: refactoring; deleting files; adding new files. + +2006-12-10 Shmuel + + * lpcre.c, lposix.c: gmatch bug fixed. Test case added. + * lpcre.c, lposix.c: gtfind bug fixed. Test case added. + +2006-12-09 Shmuel + + * lua/gsub_test.lua, gsub_tstpsx.lua: 2 files deleted. + * lua/posix_sets.lua, pcre_sets.lua, framework.lua, all_test.lua: + 4 files added. + * lpcre.c, lposix.c, common.c, common.h: + an API alteration in gsub and gtfind methods: if a non-positive number + is supplied as the 'n' parameter, then no iterations are done. + Test cases added to *.lua test files. + +2006-12-07 Shmuel + + * lpcre.c, lposix.c (gsub): if parameter rep is a function, + and its 2-nd return value (if present) is a string "break", + then gsub immediately returns. + * test/*.lua: refactoring. + +2006-12-06 Shmuel + + * lpcre.c, lposix.c: refactoring. + +2006-12-05 Shmuel + + * lposix.c: cosmetics. + +2006-12-04 Shmuel + + * lpcre.c, lposix.c: introduced new macros: CAP_BEG, CAP_END and CAP_LEN. + * lpcre.c, lpcre_f.c, lposix.c: refactoring. + +2006-12-03 Shmuel + + * lpcre.c (Lpcre_gsub_func): an improvement. + * lposix.c (posix_gsub_func): an improvement. + * lpcre.c, lposix.c (gmatch, match, find): functions removed. + * lpcre.c, lposix.c: method tgfind renamed to gtfind. + * lpcre.c, lposix.c: gsub function become method. + * test/posix_test.lua, pcre_test.lua: removed tests for removed functions. + +2006-12-02 Shmuel + + * common.c, common.h (TBuffer): moved here from lpcre.c. + * common.c, common.h (TFreeList): helper class created. + * lpcre.c (Lpcre_gsub_func): many changes. + * lposix.c (posix_gsub_func): added function gsub. + * test/gsub_test.lua: added testing for the new written-in-C gsub. + * test/gsub_tstpsx.lua: file added. + * test/rex_.lua: file deleted. + +2006-12-01 Shmuel + + * lpcre.c (TBuffer): helper class created. + * lpcre.c (Lpcre_gsub_func): many changes. + 2006-11-30 Shmuel * lpcre.c (TExecData): struct renamed to TCallout. * lpcre.c (LpcreSetExecData): function renamed to SetupCallout. + * lpcre.c (Lpcre_gsub_func): added function gsub. 2006-11-29 Shmuel @@ -0,0 +1,27 @@ +License of Lrexlib release 2.0 +------------------------------ + +Copyright (C) Reuben Thomas 2000-2007 +Copyright (C) Shmuel Zeigerman 2004-2007 + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -1,44 +1,66 @@ +2007-01-xx Release 2.0 + + * Added functions: match, find, gmatch, gsub, split, config, plainfind. + + * Added methods: dfa_exec. + + * Removed methods: gmatch. + + * Renamed functions: + newPCRE, newPOSIX --> new. + flagsPCRE, flagsPOSIX --> flags. + versionPCRE --> version. + + * Renamed methods: match --> tfind. + + * Added test suite. + + * Added reference manual. + + 2004-12-19 Release 1.19 - * Added support for PCRE "named subpatterns" (thanks to Nick Gammon). + * Added support for PCRE "named subpatterns" (thanks to Nick Gammon). + + * Several minor improvements. - * Several minor improvements. 2004-08-25 Release 1.18 - * New lua function 'r:exec'. + * New lua function 'r:exec'. + + * New lua function 'r:__tostring'. - * New lua function 'r:__tostring'. + * A table returned by r:match() as its 3rd result has no "n" index + set anymore. Use table.getn instead. - * A table returned by r:match() as its 3rd result has no "n" index - set anymore. Use table.getn instead. + * Fixed the bug preventing compilation with the "basic" POSIX + regexp library. - * Fixed the bug preventing compilation with the "basic" POSIX - regexp library. + * Makefile improved. - * Makefile improved. + * Added file gsub.lua containing function 'generic_gsub'. - * Added file gsub.lua containing function 'generic_gsub'. 2004-07-16 Release 17 - - * New lua functions 'flagsPOSIX', 'flagsPCRE', 'versionPCRE'. - - * Lua functions 'newPCRE' and 'newPOSIX' accept an optional - 2nd argument ("compilation flags"). - - * Lua function 'newPCRE' accepts an optional 3rd argument - ("locale"). - - * Lua function 'r:match' accepts optional 2nd and 3rd - arguments ("startoffset" and "execution flags"). - - * Lua function 'r:gmatch' accepts an optional 2nd argument - ("execution flags"). - - * If a user-defined function passed to r:gmatch() as its - 2nd parameter returns true value, then r:gmatch() returns. - - * The table of substring matches contains false in the positions - correspondent to non-matched subpatterns. + + * New lua functions 'flagsPOSIX', 'flagsPCRE', 'versionPCRE'. + + * Lua functions 'newPCRE' and 'newPOSIX' accept an optional + 2nd argument ("compilation flags"). + + * Lua function 'newPCRE' accepts an optional 3rd argument + ("locale"). + + * Lua function 'r:match' accepts optional 2nd and 3rd + arguments ("startoffset" and "execution flags"). + + * Lua function 'r:gmatch' accepts an optional 2nd argument + ("execution flags"). + + * If a user-defined function passed to r:gmatch() as its + 2nd parameter returns true value, then r:gmatch() returns. + + * The table of substring matches contains false in the positions + correspondent to non-matched subpatterns. @@ -1,112 +1,22 @@ - Lua rexlib 1.20 - --------------- + Lua rexlib 2.0 + -------------- by Reuben Thomas (rrt@sc3d.org) and Shmuel Zeigerman (shmuz@actcom.co.il) [maintainer] -This archive contains the lrexlib regular expression library for Lua -5.1. The Makefile provided builds it into shared libraries called -rex_posix.so and rex_pcre.so, which can be used with require or -loadlib. +Lrexlib is a regular expression library for Lua 5.1. The makefiles +provided build it into shared libraries called rex_posix.so and +rex_pcre.so, which can be used with require or loadlib. -Lrexlib is copyright Reuben Thomas 2000-2006 and copyright Shmuel -Zeigerman 2004-2006, and is released under the MIT license, like Lua +Lrexlib is copyright Reuben Thomas 2000-2007 and copyright Shmuel +Zeigerman 2004-2007, and is released under the MIT license, like Lua (see http://www.lua.org/copyright.html for the full license; it's basically the same as the BSD license). There is no warranty. Please report bugs and make suggestions to the maintainer, or use the LuaForge trackers and mailing lists. -Thanks to Thatcher Ulrich for bug and warning fixes, and to Nick -Gammon for adding support for PCRE named subpatterns. +Thanks to Thatcher Ulrich for bug and warning fixes, +and to Nick Gammon for adding support for PCRE named subpatterns. - -Synopsis --------- - -The initialisation function (for use with loadlib) is luaopen_rex. - -The library provides POSIX and PCRE regular expression matching: - -rex.newPOSIX(p[, cf]) - returns a POSIX regular expression object for the pattern p, - subject to compilation flags cf (a number). - -rex.flagsPOSIX() - returns a table with available POSIX flags (numbers) keyed by - their names (strings). - -rex.newPCRE(p[, cf[, lo]]) - returns a PCRE regular expression object for the pattern p, - subject to compilation flags cf (a number) and locale lo (a - string). - -rex.flagsPCRE() - returns a table with available PCRE flags (numbers) keyed by - their names (strings). - -rex.versionPCRE() - returns a string containing version and release date of the - used PCRE library. - -r:match(s[, st[, ef[, co]]]) - returns - * the start and end point of the first match of the compiled - regexp r in the string s, starting from offset st (a - number), subject to execution flags ef (a number); - - * PCRE: callout function co may be specified. - - * substring matches ("captures" in Lua terminology) are - returned as a third result, in a table (this table - contains false in the positions where the corresponding - sub-pattern did not match); - - * PCRE: if named subpatterns are used then the table - also contains substring matches keyed by their - correspondent subpattern names (strings). - -r:exec(s[, st[, ef[, co]]]) - This function is like r:match except that a table returned - as a third result contains offsets of substring matches - rather than substring matches themselves. - - * PCRE: that table will not contain string keys, even if - named subpatterns are used. - - For example, if the whole match is at offsets 10,20 and - substring matches are at offsets 12,14 and 16,19 then the - function returns the following: 10, 20, { 12,14,16,19 }. - -r:dfa_exec(s[, st[, ef[, co]]]) ---PCRE 6.0 and higher only-- - -r:gmatch(s, f[, n[, ef]]) - Tries to match the regex r against s up to n times (or as - many as possible if n is either not given or is not a - positive number), subject to execution flags ef; - - Each time there is a match, f is called as f(m, t), where m - is the matched string and t is a table of substring matches - (this table contains false in the positions where the - corresponding sub-pattern did not match.); - - * PCRE: if "named subpatterns" are used then the table also - contains substring matches keyed by their correspondent - subpattern names (strings). - - If f returns a true value, then gmatch immediately returns; - gmatch returns the number of matches made. - -Optional arguments supplied as nil are treated as if they had been -omitted. Regular expression objects are automatically garbage -collected. - -If the library is compiled against Henry Spencer's regex library, then -regular expressions and the strings to match them against may contain -NULs. (For PCRE, strings to be matched may contain NULs but patterns -may not.) - -Easy loading and extra functionality is provided by lua/rex.lua (see -lua/rex.html for documentation). diff --git a/windows/dev-cpp/rex_pcre.mak b/windows/dev-cpp/rex_pcre.mak new file mode 100755 index 0000000..41c0311 --- /dev/null +++ b/windows/dev-cpp/rex_pcre.mak @@ -0,0 +1,59 @@ +# rex_pcre.dll + +# 1. Specify root directory of Dev-Cpp (MinGW) installation +# --------------------------------------------------------- +ROOT = C:/Dev-Cpp + +# 2. Specify Lua include directory and full name of Lua library +# ------------------------------------------------------------- +INC_LUA = C:/Progr/lib/lua/lua_5.1 +LIB_LUA = C:/Progr/lib/lua/lua_5.1/liblua5.1.a + +# 3. Specify PCRE include directory and full name of PCRE library +# --------------------------------------------------------------- +INC_REX = C:/Progr/lib/pcre/pcre_7.0 +LIB_REX = C:/Progr/lib/pcre/pcre_7.0/libpcre.a + +# 4. Specify target name without extension +# ---------------------------------------- +TRG = rex_pcre + +# -------------------- +# END OF USER SETTINGS +# -------------------- + +DEFS = -DREX_OPENLIB=luaopen_$(TRG) -DREX_LIBNAME=\"$(TRG)\" +CC = gcc.exe +OBJ = ./lpcre.o ./common.o ./lpcre_f.o +LINKOBJ = ./lpcre.o ./common.o ./lpcre_f.o +LIBS = -L"$(ROOT)/lib" --no-export-all-symbols --add-stdcall-alias $(LIB_LUA) $(LIB_REX) -s +INCS = -I"$(ROOT)/include" -I"$(INC_REX)" -I"$(INC_LUA)" +BIN = $(TRG).dll +CFLAGS = $(INCS) $(DEFS) +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before $(BIN) all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +DLLWRAP=dllwrap.exe +DEFFILE=lib$(TRG).def +STATICLIB=lib$(TRG).a + +$(BIN): $(LINKOBJ) + echo EXPORTS > $(DEFFILE) + echo luaopen_$(TRG) >> $(DEFFILE) + $(DLLWRAP) --def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN) + +./lpcre.o: ../../src/lpcre.c + $(CC) -c ../../src/lpcre.c -o ./lpcre.o $(CFLAGS) + +./common.o: ../../src/common.c + $(CC) -c ../../src/common.c -o ./common.o $(CFLAGS) + +./lpcre_f.o: ../../src/lpcre_f.c + $(CC) -c ../../src/lpcre_f.c -o ./lpcre_f.o $(CFLAGS) diff --git a/windows/dev-cpp/rex_spencer.mak b/windows/dev-cpp/rex_spencer.mak new file mode 100755 index 0000000..3ebe238 --- /dev/null +++ b/windows/dev-cpp/rex_spencer.mak @@ -0,0 +1,57 @@ +# rex_spencer.dll + +# 1. Specify root directory of Dev-Cpp (MinGW) installation +# --------------------------------------------------------- +ROOT = C:/Dev-Cpp + +# 2. Specify Lua include directory and full name of Lua library +# ------------------------------------------------------------- +INC_LUA = C:/Progr/lib/lua/lua_5.1 +LIB_LUA = C:/Progr/lib/lua/lua_5.1/liblua5.1.a + +# 3. Specify POSIX include directory and full name of POSIX library +# ----------------------------------------------------------------- +INC_REX = C:/Progr/lib/henry_spencer +LIB_REX = C:/Progr/lib/henry_spencer/librxspencer.dll.a + +# 4. Specify target name without extension +# ---------------------------------------- +TRG = rex_spencer + +# -------------------- +# END OF USER SETTINGS +# -------------------- + +DEFS = -DREX_OPENLIB=luaopen_$(TRG) -DREX_LIBNAME=\"$(TRG)\" +CC = gcc.exe +OBJ = ./lposix.o ./common.o +LINKOBJ = ./lposix.o ./common.o +LIBS = -L"$(ROOT)/lib" --no-export-all-symbols --add-stdcall-alias $(LIB_REX) $(LIB_LUA) -s +INCS = -I"$(ROOT)/include" -I"$(INC_LUA)" -I"$(INC_REX)" +BIN = $(TRG).dll +#CFLAGS = $(INCS) $(DEFS) -DREX_API=__declspec(dllexport) +CFLAGS = $(INCS) $(DEFS) +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before $(BIN) all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +DLLWRAP=dllwrap.exe +DEFFILE=lib$(TRG).def +STATICLIB=lib$(TRG).a + +$(BIN): $(LINKOBJ) + echo EXPORTS > $(DEFFILE) + echo luaopen_$(TRG) >> $(DEFFILE) + $(DLLWRAP) --def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN) + +./lposix.o: ../../src/lposix.c + $(CC) -c ../../src/lposix.c -o ./lposix.o $(CFLAGS) + +./common.o: ../../src/common.c + $(CC) -c ../../src/common.c -o ./common.o $(CFLAGS) |