From d73a26421c64e77224b96384e674557d7090c738 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 12 Dec 2011 20:13:31 +0000 Subject: [PATCH] 2011-12-12 21:13 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/contrib/xhb/regexrpl.prg ! fixed hb_regexReplace() * harbour/doc/locks.txt ! typo * harbour/doc/Makefile * added locks.txt --- harbour/ChangeLog | 8 ++++++++ harbour/contrib/xhb/regexrpl.prg | 28 +++++++++++++--------------- harbour/doc/Makefile | 1 + harbour/doc/locks.txt | 2 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b3622b64bc..7789b3be42 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-12-12 21:13 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/contrib/xhb/regexrpl.prg + ! fixed hb_regexReplace() + * harbour/doc/locks.txt + ! typo + * harbour/doc/Makefile + * added locks.txt + 2011-12-12 11:54 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/wvggenrc.prg * contrib/gtwvg/wvglistb.prg diff --git a/harbour/contrib/xhb/regexrpl.prg b/harbour/contrib/xhb/regexrpl.prg index 70d77341ef..a40567cf50 100644 --- a/harbour/contrib/xhb/regexrpl.prg +++ b/harbour/contrib/xhb/regexrpl.prg @@ -64,24 +64,22 @@ FUNCTION hb_RegexReplace( cRegex, cString, cReplace, lCaseSensitive, lNewLine, n //LOCAL nEnd aMatches := HB_RegExAll( cRegEx, cString, lCaseSensitive, lNewLine, nMaxMatches, nGetMatch, .F. ) + cReturn := cString IF ! Empty( aMatches ) - cReturn := cString FOR EACH aMatch IN aMatches - //TraceLog( "ValToPrg( aMatch ), cReturn", ValToPrg( aMatch ), cReturn ) - IF Len( aMatch ) == 3 // if regex matches I must have an array of 3 elements - cSearch := aMatch[ MATCH_STRING ] - nStart := aMatch[ MATCH_START ] - //nEnd := aMatch[ MATCH_END ] - nLenSearch := Len( cSearch ) //nEnd - nStart + 1 - nLenReplace := Len( cReplace ) - //TraceLog( "SubStr( cString, nStart, nLenSearch )", ; - // SubStr( cString, nStart - nOffSet, nLenSearch ) ) - cReturn := Stuff( cReturn, nStart - nOffSet, nLenSearch, cReplace ) - nOffSet += nLenSearch - nLenReplace - //TraceLog( "cSearch, nStart, nEnd, nLenSearch, nLenReplace, nOffSet, cReturn",; - // cSearch, nStart, nEnd, nLenSearch, nLenReplace, nOffSet, cReturn ) - ENDIF + IF ValType( aMatch ) == "A" .AND. Len( aMatch ) == 1 .AND. ; + ValType( aMatch[1] ) == "A" + aMatch := aMatch[1] + ENDIF + IF Len( aMatch ) == 3 // if regex matches I must have an array of 3 elements + cSearch := aMatch[ MATCH_STRING ] + nStart := aMatch[ MATCH_START ] + nLenSearch := Len( cSearch ) + nLenReplace := Len( cReplace ) + cReturn := Stuff( cReturn, nStart - nOffSet, nLenSearch, cReplace ) + nOffSet += nLenSearch - nLenReplace + ENDIF NEXT ENDIF diff --git a/harbour/doc/Makefile b/harbour/doc/Makefile index 7e2219bc52..b83f8362b8 100644 --- a/harbour/doc/Makefile +++ b/harbour/doc/Makefile @@ -20,6 +20,7 @@ DOC_FILES := \ howtorel.txt \ howtosvn.txt \ inet.txt \ + locks.txt \ pcode.txt \ pp.txt \ pragma.txt \ diff --git a/harbour/doc/locks.txt b/harbour/doc/locks.txt index 4a8703f863..26b5a643af 100644 --- a/harbour/doc/locks.txt +++ b/harbour/doc/locks.txt @@ -48,7 +48,7 @@ Commands: SET LOCKSTYLE [TO] CLIPPER52 | FOXPRO | SIX or: SET( _SET_LOCKSTYLE, 1 ) -set this offset is to 0x10000000 keeping the same algorithm +set this offset to 0x10000000 keeping the same algorithm for record locking what is incompatible with any other locking schemes known by me. For sure it's not compatible with [V]FP locking (see details about this locking scheme below).