From fb930b3083e70683a97d2e4c8659ca94e0aa422f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 7 Apr 2013 17:40:05 +0200 Subject: [PATCH] changed negative file-type filters for case fixing to positive one --- ChangeLog.txt | 6 ++++ bin/check.hb | 70 ++++++++++-------------------------------- tests/fixcase.hb | 80 ++++++++++++++++-------------------------------- 3 files changed, 48 insertions(+), 108 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index edfa370665..28efc6e356 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,12 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-07 17:39 UTC+0200 Viktor Szakats (harbour syenar.net) + * bin/check.hb + * tests/fixcase.hb + % changed negative file-type filters for case fixing to + positive one + 2013-04-07 13:09 UTC+0200 Viktor Szakats (harbour syenar.net) * bin/check.hb * tests/fixcase.hb diff --git a/bin/check.hb b/bin/check.hb index 3ed8e4338e..78c3346a1e 100644 --- a/bin/check.hb +++ b/bin/check.hb @@ -573,7 +573,10 @@ STATIC PROCEDURE ProcFile( cFileName ) ".h" => ".c", ; ".api" => ".c", ; ".txt" => { @FixFuncCase() }, ; + ".md" => ".txt", ; + ".po" => ".txt", ; ".prg" => { @FixFuncCase() /*, "hbformat %1$s" */ }, ; /* NOTE: hbformat has bugs which make it unsuitable for unattended use */ + ".hb" => ".prg", ; ".ch" => ".prg" } LOCAL aProc := hb_FNameExt( cFileName ) @@ -684,50 +687,11 @@ STATIC FUNCTION my_DirScanWorker( cMask, aList ) STATIC FUNCTION FixFuncCase( cFileName ) - STATIC sc_hExtExceptions := { ; - ".dll" =>, ; - ".dxe" =>, ; - ".dylib" =>, ; - ".so" =>, ; - ".sl" =>, ; - ".zip" =>, ; - ".7z" =>, ; - ".exe" =>, ; - ".o" =>, ; - ".obj" =>, ; - ".js" =>, ; - ".dif" =>, ; - ".exe" =>, ; - ".y" =>, ; - ".yyc" =>, ; - ".yyh" =>, ; - ".a" =>, ; - ".afm" =>, ; - ".bmp" =>, ; - ".dat" =>, ; - ".dbf" =>, ; - ".exe" =>, ; - ".frm" =>, ; - ".gif" =>, ; - ".icns" =>, ; - ".ico" =>, ; - ".jpg" =>, ; - ".lbl" =>, ; - ".lib" =>, ; - ".mdb" =>, ; - ".ng" =>, ; - ".odt" =>, ; - ".pdf" =>, ; - ".pfb" =>, ; - ".png" =>, ; - ".sq3" =>, ; - ".tif" => } - STATIC sc_hPartial := { ; - ".c" =>, ; - ".cpp" =>, ; - ".h" =>, ; - ".api" => } + ".c" =>, ; + ".cpp" =>, ; + ".h" =>, ; + ".api" => } STATIC sc_hFileExceptions := { ; "ChangeLog.txt" =>, ; @@ -753,16 +717,15 @@ STATIC FUNCTION FixFuncCase( cFileName ) "pcode.txt" => } STATIC sc_aMaskExceptions := { ; - "src/3rd/*" , ; - "contrib/3rd/*" , ; - "contrib/*/3rd/*" , ; - "contrib/xhb/thtm.prg" , ; - "contrib/hbnetio/tests/*" , ; - "extras/httpsrv/home/*" , ; - "tests/hbpptest/*" , ; - "tests/mt/*" , ; - "tests/multifnc/*" , ; - "tests/rddtest/*" } + "src/3rd/*" , ; + "contrib/3rd/*" , ; + "contrib/*/3rd/*" , ; + "contrib/hbnetio/tests/*" , ; + "extras/httpsrv/home/*" , ; + "tests/hbpptest/*" , ; + "tests/mt/*" , ; + "tests/multifnc/*" , ; + "tests/rddtest/*" } LOCAL hAll LOCAL cFile @@ -776,7 +739,6 @@ STATIC FUNCTION FixFuncCase( cFileName ) LOCAL nChanged := 0 IF Empty( hb_FNameExt( cFileName ) ) .OR. ; - hb_FNameExt( cFileName ) $ sc_hExtExceptions .OR. ; hb_FNameNameExt( cFileName ) $ sc_hFileExceptions .OR. ; AScan( sc_aMaskExceptions, {| tmp | hb_FileMatch( StrTran( cFileName, "\", "/" ), tmp ) } ) == 0 RETURN .F. diff --git a/tests/fixcase.hb b/tests/fixcase.hb index 805b686261..9abef50a2f 100644 --- a/tests/fixcase.hb +++ b/tests/fixcase.hb @@ -22,44 +22,17 @@ PROCEDURE Main( cFile ) - STATIC sc_hExtExceptions := { ; - ".dll" =>, ; - ".dxe" =>, ; - ".dylib" =>, ; - ".so" =>, ; - ".sl" =>, ; - ".zip" =>, ; - ".7z" =>, ; - ".exe" =>, ; - ".o" =>, ; - ".obj" =>, ; - ".js" =>, ; - ".dif" =>, ; - ".exe" =>, ; - ".y" =>, ; - ".yyc" =>, ; - ".yyh" =>, ; - ".a" =>, ; - ".afm" =>, ; - ".bmp" =>, ; - ".dat" =>, ; - ".dbf" =>, ; - ".exe" =>, ; - ".frm" =>, ; - ".gif" =>, ; - ".icns" =>, ; - ".ico" =>, ; - ".jpg" =>, ; - ".lbl" =>, ; - ".lib" =>, ; - ".mdb" =>, ; - ".ng" =>, ; - ".odt" =>, ; - ".pdf" =>, ; - ".pfb" =>, ; - ".png" =>, ; - ".sq3" =>, ; - ".tif" => } + STATIC sc_hTypes := { ; + ".c" =>, ; + ".cpp" =>, ; + ".h" =>, ; + ".api" =>, ; + ".ch" =>, ; + ".hb" =>, ; + ".po" =>, ; + ".prg" =>, ; + ".md" =>, } + ".txt" => } STATIC sc_hFileExceptions := { ; "ChangeLog.txt" =>, ; @@ -85,16 +58,16 @@ PROCEDURE Main( cFile ) "pcode.txt" => } STATIC sc_aMaskExceptions := { ; - "src/3rd/*" , ; - "contrib/3rd/*" , ; - "contrib/*/3rd/*" , ; - "contrib/xhb/thtm.prg" , ; - "contrib/hbnetio/tests/*" , ; - "extras/httpsrv/home/*" , ; - "tests/hbpptest/*" , ; - "tests/mt/*" , ; - "tests/multifnc/*" , ; - "tests/rddtest/*" } + "src/3rd/*" , ; + "contrib/3rd/*" , ; + "contrib/*/3rd/*" , ; + "contrib/xhb/thtm.prg" , ; + "contrib/hbnetio/tests/*" , ; + "extras/httpsrv/home/*" , ; + "tests/hbpptest/*" , ; + "tests/mt/*" , ; + "tests/multifnc/*" , ; + "tests/rddtest/*" } LOCAL aFile LOCAL cExt @@ -114,8 +87,7 @@ PROCEDURE Main( cFile ) cOldCWD := hb_cwd( _HBROOT_ ) FOR EACH aFile IN hb_DirScan( "", hb_osFileMask() ) cExt := hb_FNameExt( aFile[ F_NAME ] ) - IF ! Empty( cExt ) .AND. ; - !( cExt $ sc_hExtExceptions ) .AND. ; + IF cExt $ sc_hTypes .AND. ; !( hb_FNameNameExt( aFile[ F_NAME ] ) $ sc_hFileExceptions ) .AND. ; AScan( sc_aMaskExceptions, {| tmp | hb_FileMatch( StrTran( aFile[ F_NAME ], "\", "/" ), tmp ) } ) == 0 ProcFile( hAll, aFile[ F_NAME ] ) @@ -129,10 +101,10 @@ PROCEDURE Main( cFile ) STATIC PROCEDURE ProcFile( hAll, cFileName ) STATIC sc_hPartial := { ; - ".c" =>, ; - ".cpp" =>, ; - ".h" =>, ; - ".api" => } + ".c" =>, ; + ".cpp" =>, ; + ".h" =>, ; + ".api" => } LOCAL cFile := MemoRead( cFileName ) LOCAL cFileStripped