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
      (this will ensure a 'build failed' status in Travis)

  * bin/check.hb
  * tests/fixcase.hb
    ! fixed to the way search hits are replaced. Now it replaces
      only what it found and where it found it, instead of previous
      brute-force method of replacing each similar hit in the file,
      causing the errors experienced in 2013-04-05 16:24 UTC+0200.
      (plus also few similar cases in the past)

  * tests/fixcase.hb
    ! fixed to do comment only fix on .c files even when run in
      single file mode
This commit is contained in:
Viktor Szakats
2013-04-07 11:03:48 +02:00
parent e3da05e98c
commit e41b82be36
4 changed files with 71 additions and 40 deletions

View File

@@ -10,6 +10,23 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
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
(this will ensure a 'build failed' status in Travis)
* bin/check.hb
* tests/fixcase.hb
! fixed to the way search hits are replaced. Now it replaces
only what it found and where it found it, instead of previous
brute-force method of replacing each similar hit in the file,
causing the errors experienced in 2013-04-05 16:24 UTC+0200.
(plus also few similar cases in the past)
* tests/fixcase.hb
! fixed to do comment only fix on .c files even when run in
single file mode
2013-04-07 03:48 UTC+0200 Viktor Szakats (harbour syenar.net)
* package/mpkg_win_nightly.bat
! delete source zip before download

View File

@@ -770,7 +770,7 @@ STATIC FUNCTION FixFuncCase( cFileName )
LOCAL cFile
LOCAL cFileStripped
LOCAL a
LOCAL match
LOCAL cProper
LOCAL cOldCP
@@ -797,27 +797,31 @@ STATIC FUNCTION FixFuncCase( cFileName )
cOldCP := hb_cdpSelect( "EN" )
FOR EACH a IN hb_regexAll( "([A-Za-z] |[^A-Za-z_:]|^)([A-Za-z_][A-Za-z0-9_]+\()", cFileStripped,,,,, .T. )
IF Len( a[ 2 ] ) != 2 .OR. !( Left( a[ 2 ], 1 ) $ "D" /* "METHOD" */ )
cProper := ProperCase( hAll, hb_StrShrink( a[ 3 ] ) ) + "("
IF !( cProper == a[ 3 ] ) .AND. ;
#define _MATCH_cStr 1
#define _MATCH_nStart 2
#define _MATCH_nEnd 3
FOR EACH match IN hb_regexAll( "([A-Za-z] |[^A-Za-z_:]|^)([A-Za-z_][A-Za-z0-9_]+\()", cFileStripped,,,,, .F. )
IF Len( match[ 2 ][ _MATCH_cStr ] ) != 2 .OR. !( Left( match[ 2 ][ _MATCH_cStr ], 1 ) $ "D" /* "METHOD" */ )
cProper := ProperCase( hAll, hb_StrShrink( match[ 3 ][ _MATCH_cStr ] ) ) + "("
IF !( cProper == match[ 3 ][ _MATCH_cStr ] ) .AND. ;
!( Upper( cProper ) == Upper( "FILE(" ) ) .AND. ; /* interacts with "file(s)" text */
!( Upper( cProper ) == Upper( "TOKEN(" ) ) .AND. ; /* interacts with "token(s)" text */
!( Upper( cProper ) == Upper( "INT(" ) ) .AND. ; /* interacts with SQL statements */
( ! lPartial .OR. !( "|" + Lower( cProper ) + "|" $ Lower( "|Max(|Min(|FOpen(|Abs(|Log10(|GetEnv(|Sqrt(|Rand(|IsDigit(|IsAlpha(|" ) ) )
cFile := StrTran( cFile, a[ 1 ], StrTran( a[ 1 ], a[ 3 ], cProper ) )
? cFileName, a[ 3 ], cProper, "|" + a[ 1 ] + "|"
cFile := Left( cFile, match[ 3 ][ _MATCH_nStart ] - 1 ) + cProper + SubStr( cFile, match[ 3 ][ _MATCH_nEnd ] + 1 )
? cFileName, match[ 3 ][ _MATCH_cStr ], cProper, "|" + match[ 1 ][ _MATCH_cStr ] + "|"
nChanged++
ENDIF
ENDIF
NEXT
IF !( "hbclass.ch" $ cFileName ) .AND. ! lPartial
FOR EACH a IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .T. )
cProper := ProperCase( hAll, a[ 2 ] )
IF !( cProper == a[ 2 ] )
cFile := StrTran( cFile, a[ 1 ], StrTran( a[ 1 ], a[ 2 ], cProper ) )
OutStd( cFileName, a[ 2 ], cProper, "|" + a[ 1 ] + "|" + hb_eol() )
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() )
nChanged++
ENDIF
NEXT

View File

@@ -6,6 +6,6 @@ include $(ROOT)config/global.mk
ifneq ($(HB_NO_HBSCRIPT),yes)
first clean install::
$(if $(wildcard $(HB_HOST_BIN_DIR)/hbmk2$(HB_HOST_BIN_EXT)),-$(HB_HOST_BIN_DIR)/hbmk2$(HB_HOST_BIN_EXT) $(TOP)$(ROOT)contrib/make.hb $@,@$(ECHO) $(ECHOQUOTE)! Warning: hbmk2 not found, contrib/make.hb skipped.$(ECHOQUOTE))
$(if $(wildcard $(HB_HOST_BIN_DIR)/hbmk2$(HB_HOST_BIN_EXT)),$(HB_HOST_BIN_DIR)/hbmk2$(HB_HOST_BIN_EXT) $(TOP)$(ROOT)contrib/make.hb $@,@$(ECHO) $(ECHOQUOTE)! Warning: hbmk2 not found, contrib/make.hb skipped.$(ECHOQUOTE))
endif

View File

@@ -26,8 +26,12 @@ PROCEDURE Main( cFile )
LOCAL hAll := { => }
LOCAL hExtExceptions := { ;
hb_libExt() =>, ;
STATIC sc_hExtExceptions := { ;
".dll" =>, ;
".dxe" =>, ;
".dylib" =>, ;
".so" =>, ;
".sl" =>, ;
".zip" =>, ;
".7z" =>, ;
".exe" =>, ;
@@ -61,12 +65,7 @@ PROCEDURE Main( cFile )
".sq3" =>, ;
".tif" => }
LOCAL hPartial := { ;
".c" =>, ;
".h" =>, ;
".api" => }
LOCAL hFileExceptions := { ;
STATIC sc_hFileExceptions := { ;
"ChangeLog.txt" =>, ;
"std.ch" =>, ;
"wcecon.prg" =>, ;
@@ -91,7 +90,7 @@ PROCEDURE Main( cFile )
"tracing.txt" =>, ;
"pcode.txt" => }
LOCAL aMaskExceptions := { ;
STATIC sc_aMaskExceptions := { ;
"src/3rd/*" , ;
"contrib/3rd/*" , ;
"contrib/*/3rd/*" , ;
@@ -115,27 +114,34 @@ PROCEDURE Main( cFile )
FOR EACH aFile IN hb_DirScan( "", hb_osFileMask() )
cExt := hb_FNameExt( aFile[ F_NAME ] )
IF ! Empty( cExt ) .AND. ;
!( cExt $ hExtExceptions ) .AND. ;
!( hb_FNameNameExt( aFile[ F_NAME ] ) $ hFileExceptions ) .AND. ;
AScan( aMaskExceptions, {| tmp | hb_FileMatch( StrTran( aFile[ F_NAME ], "\", "/" ), tmp ) } ) == 0
ProcFile( hAll, aFile[ F_NAME ], cExt $ hPartial )
!( cExt $ sc_hExtExceptions ) .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 ] )
ENDIF
NEXT
ENDIF
RETURN
STATIC PROCEDURE ProcFile( hAll, cFileName, lPartial )
STATIC PROCEDURE ProcFile( hAll, cFileName )
STATIC sc_hPartial := { ;
".c" =>, ;
".cpp" =>, ;
".h" =>, ;
".api" => }
LOCAL cFile := MemoRead( cFileName )
LOCAL cFileStripped
LOCAL a
LOCAL match
LOCAL cProper
LOCAL lPartial
LOCAL nChanged := 0
hb_default( @lPartial, .F. )
lPartial := hb_FNameExt( cFileName ) $ sc_hPartial
IF lPartial
cFileStripped := GetCComments( cFile )
@@ -143,27 +149,31 @@ STATIC PROCEDURE ProcFile( hAll, cFileName, lPartial )
cFileStripped := cFile
ENDIF
FOR EACH a IN hb_regexAll( "([A-Za-z] |[^A-Za-z_:]|^)([A-Za-z_][A-Za-z0-9_]+\()", cFileStripped,,,,, .T. )
IF Len( a[ 2 ] ) != 2 .OR. !( Left( a[ 2 ], 1 ) $ "D" /* "METHOD" */ )
cProper := ProperCase( hAll, hb_StrShrink( a[ 3 ] ) ) + "("
IF !( cProper == a[ 3 ] ) .AND. ;
#define _MATCH_cStr 1
#define _MATCH_nStart 2
#define _MATCH_nEnd 3
FOR EACH match IN hb_regexAll( "([A-Za-z] |[^A-Za-z_:]|^)([A-Za-z_][A-Za-z0-9_]+\()", cFileStripped,,,,, .F. )
IF Len( match[ 2 ][ _MATCH_cStr ] ) != 2 .OR. !( Left( match[ 2 ][ _MATCH_cStr ], 1 ) $ "D" /* "METHOD" */ )
cProper := ProperCase( hAll, hb_StrShrink( match[ 3 ][ _MATCH_cStr ] ) ) + "("
IF !( cProper == match[ 3 ][ _MATCH_cStr ] ) .AND. ;
!( Upper( cProper ) == Upper( "FILE(" ) ) .AND. ; /* interacts with "file(s)" text */
!( Upper( cProper ) == Upper( "TOKEN(" ) ) .AND. ; /* interacts with "token(s)" text */
!( Upper( cProper ) == Upper( "INT(" ) ) .AND. ; /* interacts with SQL statements */
( ! lPartial .OR. !( "|" + Lower( cProper ) + "|" $ Lower( "|Max(|Min(|FOpen(|Abs(|Log10(|GetEnv(|Sqrt(|Rand(|IsDigit(|IsAlpha(|" ) ) )
cFile := StrTran( cFile, a[ 1 ], StrTran( a[ 1 ], a[ 3 ], cProper ) )
? cFileName, a[ 3 ], cProper, "|" + a[ 1 ] + "|"
cFile := Left( cFile, match[ 3 ][ _MATCH_nStart ] - 1 ) + cProper + SubStr( cFile, match[ 3 ][ _MATCH_nEnd ] + 1 )
? cFileName, match[ 3 ][ _MATCH_cStr ], cProper, "|" + match[ 1 ][ _MATCH_cStr ] + "|"
nChanged++
ENDIF
ENDIF
NEXT
IF !( "hbclass.ch" $ cFileName ) .AND. ! lPartial
FOR EACH a IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .T. )
cProper := ProperCase( hAll, a[ 2 ] )
IF !( cProper == a[ 2 ] )
cFile := StrTran( cFile, a[ 1 ], StrTran( a[ 1 ], a[ 2 ], cProper ) )
? cFileName, a[ 2 ], cProper, "|" + a[ 1 ] + "|"
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 ] + "|"
nChanged++
ENDIF
NEXT