2013-04-05 02:57 UTC+0200 Viktor Szakats (harbour syenar.net)

* bin/check.hb
    ! fixed to use local implementation instead of hb_DirScan()
      which has known bug of missing extensionless files on win.
      (due to hb_FileMatch() problem)
    + added support to optimize images and uncrustify C source
      before upload (inactive yet)
    + added necessary exceptions now that extensionless files
      properly found
    + checks for filenames without extensions
    + checks for filenames with extensions not in .gitattributes

  * bin/commit.hb
    + show helpful advice when pre-commit hook check fails
    ! fixed to propely pick filenames that result from rename operations (for check)
    ! fixed to not pick filenames of deleted files (for check)

  * config/lang.hb
  * doc/en/lang.txt
  * include/hblang.hbx
  * src/lang/Makefile
  * src/lang/l_zh_tra.c -> src/lang/l_zh.c
  * src/rtl/langcomp.prg
    * Language renamed: zh_tra -> zh (in sync with recently laid rules)
      The 'REQUEST HB_LANG_*' value become INCOMPATIBLE compared
      to previous dev versions

  * src/rtl/cdpdet.prg
    + added 'zh' country code to codepage detection

  * contrib/make.hb
  * contrib/hbplist -> contrib/hbplist.txt
    * renamed to have an extension

  * contrib/hbrun/doc/_GENERATED_ -> contrib/hbrun/doc/_autogen.txt
  * utils/hbmk2/doc/_GENERATED_ -> utils/hbmk2/doc/_autogen.txt
    * renamed to have names fitting naming rules
    + added warning message inside

  - extras/httpsrv/logs/empty
    - deleted unnecessary file with non-compliant filename

  - tests/stripeol.hb
    % deleted, now similar functionality is implemented in bin/check.hb

  * .gitattributes
    ! added missing .log and .ucf

  * contrib/hbtinymt/3rd/tinymt/tinymt.hbp
    ! deleted SVN ID

  * debian/copyright
    ! synced with COPYING.txt

  * debian/postinst
  * debian/postrm
    ! deleted multiple EOL at EOF
This commit is contained in:
Viktor Szakats
2013-04-05 03:02:47 +02:00
parent 156423e40e
commit 38310bc781
23 changed files with 192 additions and 73 deletions

2
.gitattributes vendored
View File

@@ -23,6 +23,7 @@ ChangeLog.txt ident
*.in text
*.ini text
*.js text
*.log text
*.m text
*.md text
*.mft text
@@ -38,6 +39,7 @@ ChangeLog.txt ident
*.sx text
*.tpl text
*.txt text
*.ucf text
*.vbs text
*.xml text
*.xsl text

View File

@@ -10,6 +10,64 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-04-05 02:57 UTC+0200 Viktor Szakats (harbour syenar.net)
* bin/check.hb
! fixed to use local implementation instead of hb_DirScan()
which has known bug of missing extensionless files on win.
(due to hb_FileMatch() problem)
+ added support to optimize images and uncrustify C source
before upload (inactive yet)
+ added necessary exceptions now that extensionless files
properly found
+ checks for filenames without extensions
+ checks for filenames with extensions not in .gitattributes
* bin/commit.hb
+ show helpful advice when pre-commit hook check fails
! fixed to propely pick filenames that result from rename operations (for check)
! fixed to not pick filenames of deleted files (for check)
* config/lang.hb
* doc/en/lang.txt
* include/hblang.hbx
* src/lang/Makefile
* src/lang/l_zh_tra.c -> src/lang/l_zh.c
* src/rtl/langcomp.prg
* Language renamed: zh_tra -> zh (in sync with recently laid rules)
The 'REQUEST HB_LANG_*' value become INCOMPATIBLE compared
to previous dev versions
* src/rtl/cdpdet.prg
+ added 'zh' country code to codepage detection
* contrib/make.hb
* contrib/hbplist -> contrib/hbplist.txt
* renamed to have an extension
* contrib/hbrun/doc/_GENERATED_ -> contrib/hbrun/doc/_autogen.txt
* utils/hbmk2/doc/_GENERATED_ -> utils/hbmk2/doc/_autogen.txt
* renamed to have names fitting naming rules
+ added warning message inside
- extras/httpsrv/logs/empty
- deleted unnecessary file with non-compliant filename
- tests/stripeol.hb
% deleted, now similar functionality is implemented in bin/check.hb
* .gitattributes
! added missing .log and .ucf
* contrib/hbtinymt/3rd/tinymt/tinymt.hbp
! deleted SVN ID
* debian/copyright
! synced with COPYING.txt
* debian/postinst
* debian/postrm
! deleted multiple EOL at EOF
2013-04-04 16:09 UTC+0200 Viktor Szakats (harbour syenar.net)
* config/lang.hb
* utils/hbmk2/hbmk2.hbp

View File

@@ -25,9 +25,6 @@
*/
/* TODO: Apply transformations:
Uncrustify, hbformat,
pngout/pngcrush/optipng/advpng,
jpgoptim/jpegtran/jpegrescan,
css/html/xml format, etc */
#pragma -w3
@@ -49,10 +46,7 @@ FUNCTION CheckFileList( xName )
IF Empty( xName ) .OR. HB_ISARRAY( xName )
IF Empty( xName )
xName := hb_DirScan( "", hb_osFileMask() )
FOR EACH file IN xName
file := file[ F_NAME ]
NEXT
xName := my_DirScan( hb_osFileMask() )
ENDIF
FOR EACH file IN xName
IF ! CheckFile( file, @aErr )
@@ -72,6 +66,7 @@ STATIC FUNCTION CheckFile( cName, /* @ */ aErr, lApplyFixes )
LOCAL tmp
LOCAL cEOL
LOCAL lProcess
LOCAL lReBuild
LOCAL lRemoveEndingWhitespace
@@ -96,14 +91,21 @@ STATIC FUNCTION CheckFile( cName, /* @ */ aErr, lApplyFixes )
"*.md", ;
"*.html", ;
"*/hb-charmap.def", ; /* TOFIX: Use 8.3 name */
"debian/*", ;
"package/*", ;
"*/3rd/*", ;
"contrib/hbwin/*", ;
"contrib/rddads/unixutils.h", ;
"extras/httpsrv/*" }
LOCAL aCanHaveNoExtension := { ;
"Makefile", ;
".*", ;
"debian/*" }
LOCAL aCanHaveTab := { ;
"Makefile", ;
"debian/rules", ;
"*.mk", ;
"*.yyc", ;
"*.dif", ;
@@ -125,6 +127,13 @@ STATIC FUNCTION CheckFile( cName, /* @ */ aErr, lApplyFixes )
LOCAL aForcedLF := { ;
"*.sh" }
LOCAL hAllowedExt := LoadGitattributes()
/* TODO: extend as you go */
LOCAL hDoNotProcess := { ;
".c" => { "3rd", "include", "dlmalloc", "hvm", "sha1", "sha2" }, ;
".h" => { "3rd", "include" } }
hb_default( @lApplyFixes, .F. )
cName := hb_DirSepToOS( cName )
@@ -144,6 +153,14 @@ STATIC FUNCTION CheckFile( cName, /* @ */ aErr, lApplyFixes )
AAdd( aErr, "filename: non MS-DOS compatible" )
ENDIF
IF Empty( hb_FNameExt( cName ) )
IF ! FNameExc( cName, aCanHaveNoExtension )
AAdd( aErr, "filename: missing extension" )
ENDIF
ELSEIF ! hb_FNameExt( cName ) $ hAllowedExt
AAdd( aErr, "filename: unknown extension. Either change it or update .gitattributes." )
ENDIF
IF !( cName == Lower( cName ) ) .AND. ! FNameExc( cName, aCanBeUpper )
AAdd( aErr, "filename: non-lowercase" )
ENDIF
@@ -154,9 +171,16 @@ STATIC FUNCTION CheckFile( cName, /* @ */ aErr, lApplyFixes )
IF IsBinary( cFile )
IF lApplyFixes
IF hb_FNameExt( cFile ) == ".png"
OutStd( cFile + ": " + "content: optimizing" + hb_eol() )
hb_run( "optipng " + cFile )
lProcess := .T.
FOR EACH tmp IN hb_HGetDef( hDoNotProcess, hb_FNameExt( cName ), {} )
IF tmp $ cName
lProcess := .F.
EXIT
ENDIF
NEXT
IF lProcess
OutStd( cName + ": " + "content: processing" + hb_eol() )
ProcFile( cName )
ENDIF
ENDIF
ELSE
@@ -428,6 +452,31 @@ STATIC FUNCTION FNameExc( cName, aList )
RETURN .F.
STATIC PROCEDURE ProcFile( cFileName )
STATIC sc_hProc := { ;
".png" => { "avdpng -z -4 %1$s", "optipng -o7 %1$s" }, ;
".jpg" => { "jpegoptim --strip-all %1$s" }, ;
".c" => { "uncrustify -c bin/harbour.ucf %1$s" }, ;
".cpp" => ".c", ;
".h" => ".c" }
// NOTE: hbformat has bugs which make it unsuitable for unattended use
// ".prg" => { "hbformat %1$s" } }
LOCAL aProc := hb_FNameExt( cFileName )
LOCAL cCmd
DO WHILE HB_ISSTRING( aProc := hb_HGetDef( sc_hProc, aProc, NIL ) )
ENDDO
IF HB_ISARRAY( aProc )
FOR EACH cCmd IN aProc
hb_run( hb_StrFormat( hb_DirSepToOS( cCmd ), '"' + cFileName + '"' ) )
NEXT
ENDIF
RETURN
STATIC FUNCTION UTF8_BOM()
RETURN ;
hb_BChar( 0xEF ) + ;
@@ -467,3 +516,42 @@ STATIC FUNCTION LoadGitignore()
ENDIF
RETURN s_aIgnore
STATIC FUNCTION LoadGitattributes()
THREAD STATIC s_hExt := NIL
LOCAL cLine
LOCAL tmp
IF s_hExt == NIL
s_hExt := { => }
FOR EACH cLine IN hb_ATokens( StrTran( hb_MemoRead( ".gitattributes" ), Chr( 13 ) ), Chr( 10 ) )
IF Left( cLine, 2 ) == "*."
cLine := SubStr( cLine, 2 )
IF ( tmp := At( " ", cLine ) ) > 0
s_hExt[ RTrim( Left( cLine, tmp - 1 ) ) ] := NIL
ENDIF
ENDIF
NEXT
ENDIF
RETURN s_hExt
STATIC FUNCTION my_DirScan( cMask )
RETURN my_DirScanWorker( cMask, {} )
STATIC FUNCTION my_DirScanWorker( cMask, aList )
LOCAL file
FOR EACH file IN Directory( cMask, "D" )
IF file[ F_NAME ] == "." .OR. file[ F_NAME ] == ".."
ELSEIF "D" $ file[ F_ATTR ]
my_DirScanWorker( hb_FNameDir( cMask ) + file[ F_NAME ] + hb_ps() + hb_FNameNameExt( cMask ), aList )
ELSE
AAdd( aList, hb_FNameDir( cMask ) + file[ F_NAME ] )
ENDIF
NEXT
RETURN aList

View File

@@ -64,7 +64,7 @@ PROCEDURE Main()
IF "--hb-check-only" $ Lower( hb_CmdLine() )
IF AScan( aFiles, {| tmp | tmp == cLogName } ) == 0
OutStd( hb_ProgName() + ": " + hb_StrFormat( "%1$s not updated", cLogName ) + hb_eol() )
OutStd( hb_ProgName() + ": " + hb_StrFormat( "%1$s not updated. Run 'hbrun bin/commit' and retry.", cLogName ) + hb_eol() )
ErrorLevel( 3 )
RETURN
ENDIF
@@ -140,6 +140,9 @@ STATIC FUNCTION DoctorChanges( cVCS, aChanges, aFiles )
LOCAL cStart
LOCAL aNew := {}
LOCAL cFile
LOCAL tmp
ASort( aChanges,,, {| x, y | x < y } )
DO CASE
@@ -167,7 +170,9 @@ STATIC FUNCTION DoctorChanges( cVCS, aChanges, aFiles )
ENDSWITCH
IF ! Empty( cStart )
AAdd( aNew, " " + cStart + " " + StrTran( SubStr( cLine, 8 + 1 ), "\", "/" ) )
AAdd( aFiles, SubStr( cLine, 8 + 1 ) )
IF !( cStart == "-" )
AAdd( aFiles, SubStr( cLine, 8 + 1 ) )
ENDIF
ENDIF
ENDIF
NEXT
@@ -203,7 +208,13 @@ STATIC FUNCTION DoctorChanges( cVCS, aChanges, aFiles )
ENDSWITCH
IF ! Empty( cStart )
AAdd( aNew, " " + cStart + " " + StrTran( SubStr( cLine, 3 + 1 ), "\", "/" ) )
AAdd( aFiles, SubStr( cLine, 3 + 1 ) )
IF !( cStart == "-" )
cFile := SubStr( cLine, 3 + 1 )
IF ( tmp := At( " -> ", cFile ) ) > 0
cFile := SubStr( cFile, tmp + Len( " -> " ) )
ENDIF
AAdd( aFiles, cFile )
ENDIF
ENDIF
ENDIF
NEXT

View File

@@ -37,7 +37,6 @@
#include "directry.ch"
STATIC sc_hLangMapping := { ;
"zh_CN" => "zh_tra", ;
"zh_CN.GB2312" => "zh_sim", ;
"sr" => "sr_cyr", ;
"sr@latin" => "sr_lat" }

View File

@@ -0,0 +1,2 @@
These files are automatically generated,
do not edit them.

View File

@@ -1,6 +1,3 @@
#
# $Id: expat.hbp 16466 2011-03-11 00:28:04Z vszakats $
#
-stop{hbdyn}

View File

@@ -78,7 +78,7 @@ PROCEDURE Main( ... )
hProjectList := { => }
hb_HKeepOrder( hProjectList, .T. )
LoadProjectListFromFile( hProjectList, s_cHome + "hbplist" )
LoadProjectListFromFile( hProjectList, s_cHome + "hbplist.txt" )
LoadProjectListFromString( hProjectList, GetEnv( "HB_BUILD_ADDONS" ) )
aParams := hb_AParams()

14
debian/copyright vendored
View File

@@ -548,8 +548,8 @@ all use GNU GPL 2. Find it below:
------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA
@@ -557,7 +557,7 @@ all use GNU GPL 2. Find it below:
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -607,7 +607,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -806,7 +806,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -828,9 +828,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it

1
debian/postinst vendored
View File

@@ -19,4 +19,3 @@ esac
#DEBHELPER#
exit 0

1
debian/postrm vendored
View File

@@ -19,4 +19,3 @@ esac
#DEBHELPER#
exit 0

View File

@@ -187,8 +187,8 @@
Belorussian be
Bulgarian bg
Catalan ca
Chinese Traditional zh
Chinese Simplified zh_sim
Chinese Traditional zh_tra
Croatian hr
Czech cs
Dutch nl

View File

@@ -63,8 +63,8 @@ DYNAMIC HB_LANG_SR_LAT
DYNAMIC HB_LANG_SV
DYNAMIC HB_LANG_TR
DYNAMIC HB_LANG_UK
DYNAMIC HB_LANG_ZH
DYNAMIC HB_LANG_ZH_SIM
DYNAMIC HB_LANG_ZH_TRA
#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBLANG__REQUEST )
#uncommand DYNAMIC <fncs,...> => EXTERNAL <fncs>

View File

@@ -35,8 +35,8 @@ C_SOURCES := \
l_sv.c \
l_tr.c \
l_uk.c \
l_zh.c \
l_zh_sim.c \
l_zh_tra.c \
LIBNAME := hblang

View File

@@ -7,7 +7,7 @@ static HB_LANG s_lang =
{
/* Identification */
"zh_tra",
"zh",
"Chinese Traditional",
"中文繁體",
"",
@@ -146,5 +146,5 @@ static HB_LANG s_lang =
}
};
#define HB_LANG_ID ZH_TRA
#define HB_LANG_ID ZH
#include "hbmsgreg.h"

View File

@@ -463,6 +463,7 @@ STATIC FUNCTION __LangStdToCPCtryHb( cCtryStd )
CASE "zh-mo" ; EXIT
CASE "zh-sg" ; EXIT
CASE "zh-tw" ; EXIT
CASE "zh" ; EXIT
ENDSWITCH
ENDIF

View File

@@ -122,7 +122,7 @@ FUNCTION hb_langSelect( cLangID, cCP )
CASE "UADOS" ; cCPDef := "UA1125"; cLangIDBase := "uk" ; EXIT
CASE "UAKOI8" ; cCPDef := "UAKOI8"; cLangIDBase := "uk" ; EXIT
CASE "UAWIN" ; cCPDef := "UA1251"; cLangIDBase := "uk" ; EXIT
CASE "ZHB5" ; cCPDef := "BIG5" ; cLangIDBase := "zh_tra" ; EXIT
CASE "ZHB5" ; cCPDef := "BIG5" ; cLangIDBase := "zh" ; EXIT
CASE "ZHGB" ; cCPDef := "GBK" ; cLangIDBase := "zh_sim" ; EXIT
OTHERWISE
/* Case sensitive legacy IDs. Lowercase flavours denote new
@@ -388,7 +388,7 @@ STATIC FUNCTION __LangStdToLangHb( cLangStd )
CASE "zh-mo"
CASE "zh-sg"
CASE "zh-tw"
CASE "zh" ; cLangHb := "zh_tra" ; EXIT
CASE "zh" ; cLangHb := "zh" ; EXIT
ENDSWITCH
ENDIF

View File

@@ -1,39 +0,0 @@
/*
* Strips spaces at EOL text files.
*
* Copyright 2012 Viktor Szakats (harbour syenar.net)
* www - http://harbour-project.org
*
*/
#pragma -w3
#pragma -km+
#pragma -ko+
#include "directry.ch"
PROCEDURE Main( cMask )
LOCAL aFile
hb_default( @cMask, "*.txt" )
FOR EACH aFile IN Directory( hb_osFileMask() )
hb_MemoWrit( aFile[ F_NAME ], __stripeol( MemoRead( aFile[ F_NAME ] ) ) )
NEXT
RETURN
FUNCTION __stripeol( cFile )
LOCAL cOK := ""
LOCAL cLine
FOR EACH cLine IN hb_ATokens( StrTran( StrTran( cFile, Chr( 13 ) ), Chr( 9 ), " " ), Chr( 10 ) )
cOK += RTrim( cLine )
IF ! cLine:__enumIsLast()
cOK += hb_eol()
ENDIF
NEXT
RETURN cOK

View File

@@ -0,0 +1,2 @@
These files are automatically generated,
do not edit them.