From 15cea3807ff61832c629ecad58c857e88b6a172a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 7 Apr 2013 12:51:26 +0200 Subject: [PATCH] 2013-04-07 12:49 UTC+0200 Viktor Szakats (harbour syenar.net) * bin/check.hb * tests/fixcase.hb ! fixed another loop of regexp search and replace to only change exactly the item it found. It will fix some weird cases experienced in the past, f.e. in extras/httpsrv/uhttpd.prg --- ChangeLog.txt | 8 ++++++++ bin/check.hb | 10 +++++----- tests/fixcase.hb | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c4d8336a66..f322a2da11 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,14 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-07 12:49 UTC+0200 Viktor Szakats (harbour syenar.net) + * bin/check.hb + * tests/fixcase.hb + ! fixed another loop of regexp search and replace to only + change exactly the item it found. It will fix some + weird cases experienced in the past, + f.e. in extras/httpsrv/uhttpd.prg + 2013-04-07 10:59 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/Makefile ! do not ignore failures in contribs in GNU Make build process diff --git a/bin/check.hb b/bin/check.hb index 304b5cf086..f43f013285 100644 --- a/bin/check.hb +++ b/bin/check.hb @@ -817,11 +817,11 @@ STATIC FUNCTION FixFuncCase( cFileName ) NEXT IF !( "hbclass.ch" $ cFileName ) .AND. ! lPartial - FOR EACH match IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .T. ) - cProper := ProperCase( hAll, match[ 2 ] ) - IF !( cProper == match[ 2 ] ) - cFile := StrTran( cFile, match[ 1 ], StrTran( match[ 1 ], match[ 2 ], cProper ) ) - OutStd( cFileName, match[ 2 ], cProper, "|" + match[ 1 ] + "|" + hb_eol() ) + FOR EACH match IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .F. ) + cProper := ProperCase( hAll, match[ 2 ][ _MATCH_cStr ] ) + IF !( cProper == match[ 2 ][ _MATCH_cStr ] ) + cFile := Left( cFile, match[ 2 ][ _MATCH_nStart ] - 1 ) + cProper + SubStr( cFile, match[ 2 ][ _MATCH_nEnd ] + 1 ) + OutStd( cFileName, match[ 2 ][ _MATCH_cStr ], cProper, "|" + match[ 1 ][ _MATCH_cStr ] + "|" + hb_eol() ) nChanged++ ENDIF NEXT diff --git a/tests/fixcase.hb b/tests/fixcase.hb index 5f9a1dd62a..cc77f52281 100644 --- a/tests/fixcase.hb +++ b/tests/fixcase.hb @@ -169,11 +169,11 @@ STATIC PROCEDURE ProcFile( hAll, cFileName ) NEXT IF !( "hbclass.ch" $ cFileName ) .AND. ! lPartial - FOR EACH match IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .T. ) - cProper := ProperCase( hAll, match[ 2 ] ) - IF !( cProper == match[ 2 ] ) - cFile := StrTran( cFile, match[ 1 ], StrTran( match[ 1 ], match[ 2 ], cProper ) ) - ? cFileName, match[ 2 ], cProper, "|" + match[ 1 ] + "|" + FOR EACH match IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .F. ) + cProper := ProperCase( hAll, match[ 2 ][ _MATCH_cStr ] ) + IF !( cProper == match[ 2 ][ _MATCH_cStr ] ) + cFile := Left( cFile, match[ 2 ][ _MATCH_nStart ] - 1 ) + cProper + SubStr( cFile, match[ 2 ][ _MATCH_nEnd ] + 1 ) + OutStd( cFileName, match[ 2 ][ _MATCH_cStr ], cProper, "|" + match[ 1 ][ _MATCH_cStr ] + "|" + hb_eol() ) nChanged++ ENDIF NEXT