From ec5c6619dc7a84b7b1bf3a2866da7df05748e97e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 14 Jul 2010 08:14:32 +0000 Subject: [PATCH] 2010-07-14 10:10 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbapicdp.h * src/rtl/cdpapi.c * src/rtl/cdpapihb.c + tests/utf8at.prg + Added hb_cdpUTF8StringAt() ; Patch by Carlos Bacco. Many thanks! * include/hbextern.ch * include/hbapicdp.h * src/rtl/cdpapi.c * src/rtl/cdpapihb.c ; my modifications to above patch: - Using HB_BOOL instead of int for flag value. % HB_UTF8AT(), HB_UTF8RAT() optimized to use hb_param(), plus optimized out variables. ! HB_UTF8AT(), HB_UTF8RAT() fixed 'nEnd < nStart' case. ! Some formatting. + Added new functions to hbextern.ch. * tests/utf8at.prg * Changed to use UTF8 string as base. * Avoiding "OEM" and "ANSI" Microsoft misleading terms, using standard CP names instead. ! Using HB_TRANSLATE() to convert between CPs (instead of non-portable, Windows-only HB_OEMTOANSI()/HB_ANSITOOEM() functions). * Formatting. * Using '?' instead of QOUT(), plus added simpleio.ch to allow redirection of output. * contrib/make.hbs * Minor step to make dependency evaluation and automatic sorting of components for build. * utils/hbmk2/hbmk2.pt_BR.po * utils/hbmk2/hbmk2.hu_HU.po * utils/hbmk2/hbmk2.prg + Added -vcshead support for Monotone version control software. % Cleaned and optimized "in dir" C compiler run mode. (currently used by mingw) ! Fixed "in dir" C compiler run mode when using -jobs= option for multithreaded builds. % Little optimization to --hbinfo option. --- harbour/ChangeLog | 48 +++++++++++- harbour/contrib/make.hbs | 12 +++ harbour/include/hbapicdp.h | 1 + harbour/include/hbextern.ch | 2 + harbour/src/rtl/cdpapi.c | 78 ++++++++++++++++++ harbour/src/rtl/cdpapihb.c | 48 ++++++++++++ harbour/tests/utf8at.prg | 50 ++++++++++++ harbour/utils/hbmk2/hbmk2.hu_HU.po | 4 +- harbour/utils/hbmk2/hbmk2.prg | 122 +++++++++++++++++++---------- harbour/utils/hbmk2/hbmk2.pt_BR.po | 4 +- 10 files changed, 321 insertions(+), 48 deletions(-) create mode 100644 harbour/tests/utf8at.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b63d6aa37f..5d8de05c0e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,52 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-14 10:10 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hbapicdp.h + * src/rtl/cdpapi.c + * src/rtl/cdpapihb.c + + tests/utf8at.prg + + Added hb_cdpUTF8StringAt() + ; Patch by Carlos Bacco. Many thanks! + + * include/hbextern.ch + * include/hbapicdp.h + * src/rtl/cdpapi.c + * src/rtl/cdpapihb.c + ; my modifications to above patch: + - Using HB_BOOL instead of int for flag value. + % HB_UTF8AT(), HB_UTF8RAT() optimized to use hb_param(), + plus optimized out variables. + ! HB_UTF8AT(), HB_UTF8RAT() fixed 'nEnd < nStart' case. + ! Some formatting. + + Added new functions to hbextern.ch. + + * tests/utf8at.prg + * Changed to use UTF8 string as base. + * Avoiding "OEM" and "ANSI" Microsoft misleading terms, + using standard CP names instead. + ! Using HB_TRANSLATE() to convert between CPs (instead + of non-portable, Windows-only HB_OEMTOANSI()/HB_ANSITOOEM() + functions). + * Formatting. + * Using '?' instead of QOUT(), plus added simpleio.ch to + allow redirection of output. + + * contrib/make.hbs + * Minor step to make dependency evaluation and automatic + sorting of components for build. + + * utils/hbmk2/hbmk2.pt_BR.po + * utils/hbmk2/hbmk2.hu_HU.po + * utils/hbmk2/hbmk2.prg + + Added -vcshead support for Monotone version control + software. + % Cleaned and optimized "in dir" C compiler run mode. + (currently used by mingw) + ! Fixed "in dir" C compiler run mode when using -jobs= + option for multithreaded builds. + % Little optimization to --hbinfo option. + 2010-07-13 19:24 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + contrib/hbide/dbstruct.ui + contrib/hbide/resources/dbstruct.png @@ -114,7 +160,7 @@ 2010-07-12 22:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/make.hbs + Added support for HB_CONTRIBS ennvar which is to replace - HB_CONTRIBLIBS eventuaally. + HB_CONTRIBLIBS eventually. * contrib/hbqt/generator/hbqtgen.prg * contrib/hbqt/hbqt.ch diff --git a/harbour/contrib/make.hbs b/harbour/contrib/make.hbs index 33d5cdbc03..9eca4acfff 100755 --- a/harbour/contrib/make.hbs +++ b/harbour/contrib/make.hbs @@ -444,6 +444,18 @@ PROCEDURE GNUMake( ... ) aUtils,; hb_ATokens( GetEnv( "HB_BUILD_ADDONS" ),, .T. ) } + OutStd( "! Calculating sorting order for contribs..." + hb_eol() ) + + FOR EACH aList IN aAll + FOR EACH cProject IN aList + IF ! Empty( cProject ) + call_hbmk2_dept( s_cRoot + "bin" + hb_ps(), s_cBase + cProject, @cType ) + ENDIF + NEXT + NEXT + + OutStd( "! Building contribs..." + hb_eol() ) + FOR EACH aList IN aAll FOR EACH cProject IN aList diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index a3db8f759c..b52059a518 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -367,6 +367,7 @@ extern HB_EXPORT HB_UCHAR hb_cdpGetChar( PHB_CODEPAGE cdp, HB_BOOL fCtrl, HB extern HB_EXPORT HB_BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, HB_BOOL fCtrl, HB_UCHAR ch, int * n, HB_WCHAR * pwc ); extern HB_EXPORT HB_SIZE hb_cdpUTF8StringLength( const char * pSrc, HB_SIZE nLen ); +extern HB_EXPORT HB_SIZE hb_cdpUTF8StringAt( const char * szNeedle, HB_SIZE nLenN, const char * szHaystack, HB_SIZE nLenH, HB_SIZE nStart, HB_SIZE nEnd, HB_BOOL fReverse ); extern HB_EXPORT HB_SIZE hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE nLen, HB_SIZE nPos ); extern HB_EXPORT char * hb_cdpUTF8StringSubstr( const char * pSrc, HB_SIZE nLen, HB_SIZE nFrom, HB_SIZE nCount, HB_SIZE * pnDest ); diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 1f48904547..89934315c3 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -817,6 +817,8 @@ EXTERNAL HB_TRANSLATE EXTERNAL HB_STRTOUTF8 EXTERNAL HB_UTF8TOSTR EXTERNAL HB_UTF8LEN +EXTERNAL HB_UTF8AT +EXTERNAL HB_UTF8RAT EXTERNAL HB_UTF8LEFT EXTERNAL HB_UTF8RIGHT EXTERNAL HB_UTF8PEEK diff --git a/harbour/src/rtl/cdpapi.c b/harbour/src/rtl/cdpapi.c index 685147c07b..ab9ca7a989 100644 --- a/harbour/src/rtl/cdpapi.c +++ b/harbour/src/rtl/cdpapi.c @@ -708,6 +708,84 @@ HB_SIZE hb_cdpUTF8StringLength( const char * pSrc, HB_SIZE nLen ) return nDst; } +HB_SIZE hb_cdpUTF8StringAt( const char * szNeedle, HB_SIZE nLenN, + const char * szHaystack, HB_SIZE nLenH, + HB_SIZE nStart, HB_SIZE nEnd, HB_BOOL fReverse ) +{ + HB_SIZE nPosN = 0; + HB_SIZE nPosH = 0; + HB_SIZE nPosX = 0; + HB_SIZE nPos = 0; + HB_SIZE nRAt = 0; + HB_SIZE nAt = 0; + + HB_WCHAR wcN = 0; + HB_WCHAR wcH = 0; + int nN = 0; + int nH = 0; + + while( nPosH < nLenH && nPosN < nLenN && nPos < nEnd ) + { + do + { + if( !hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) szHaystack[ nPosH++ ], &nH, &wcH ) ) + { + --nPosH; + nH = 0; + } + } while( nH ); + + if( ++nPos < nStart ) + continue; + + do + { + if( !hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) szNeedle[ nPosN++ ], &nN, &wcN ) ) + { + --nPosN; + nN = 0; + } + } while( nN ); + + if( wcH == wcN ) + { + if( nAt == 0 ) + { + nAt = nPos; + nPosX = nPosH; + } + + if( nPosN == nLenN ) + { + if( fReverse ) + { + nRAt = nAt; + nPos = nAt; + nAt = 0; + nPosH = nPosX; + nPosX = 0; + nPosN = 0; + } + else + return nAt; + } + } + else + { + if( nAt ) + { + nPos = nAt; + nAt = 0; + nPosH = nPosX; + nPosX = 0; + } + nPosN = 0; + } + } + + return nRAt; +} + HB_SIZE hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE nLen, HB_SIZE nPos ) { if( nLen ) diff --git a/harbour/src/rtl/cdpapihb.c b/harbour/src/rtl/cdpapihb.c index 72d21ede16..4ee4fbf715 100644 --- a/harbour/src/rtl/cdpapihb.c +++ b/harbour/src/rtl/cdpapihb.c @@ -264,6 +264,54 @@ HB_FUNC( HB_UTF8TOSTR ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +HB_FUNC( HB_UTF8AT ) +{ + PHB_ITEM pSub = hb_param( 1, HB_IT_STRING ); + PHB_ITEM pText = hb_param( 2, HB_IT_STRING ); + + if( pText && pSub ) + { + HB_SIZE nTextLength = hb_itemGetCLen( pText ); + HB_SIZE nStart = hb_parnsdef( 3, 1 ); + HB_SIZE nEnd = hb_parnsdef( 4, nTextLength ); /* nTextLength can be > UTF8 len. No problem.*/ + + if( nEnd < nStart ) + hb_retns( 0 ); + else + hb_retns( hb_cdpUTF8StringAt( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ), + hb_itemGetCPtr( pText ), nTextLength, nStart, nEnd, HB_FALSE ) ); + } + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} + +/* + * NOTE: In HB_UTF8RAT we are still traversing from + * left to right, as it would be required anyway to + * determine the real string length. [bacco] + */ + +HB_FUNC( HB_UTF8RAT ) +{ + PHB_ITEM pSub = hb_param( 1, HB_IT_STRING ); + PHB_ITEM pText = hb_param( 2, HB_IT_STRING ); + + if( pText && pSub ) + { + HB_SIZE nTextLength = hb_itemGetCLen( pText ); + HB_SIZE nStart = hb_parnsdef( 3, 1 ); + HB_SIZE nEnd = hb_parnsdef( 4, nTextLength ); /* nTextLength can be > UTF8 len. No problem.*/ + + if( nEnd < nStart ) + hb_retns( 0 ); + else + hb_retns( hb_cdpUTF8StringAt( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ), + hb_itemGetCPtr( pText ), nTextLength, nStart, nEnd, HB_TRUE ) ); + } + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} + HB_FUNC( HB_UTF8SUBSTR ) { const char * szString = hb_parc( 1 ); diff --git a/harbour/tests/utf8at.prg b/harbour/tests/utf8at.prg new file mode 100644 index 0000000000..ae6c9faab9 --- /dev/null +++ b/harbour/tests/utf8at.prg @@ -0,0 +1,50 @@ +/* + * $Id$ + */ + +/* WARNING: UTF-8 strings */ + +/* hb_utf8at / hb_utf8rat test + UTF8 Aware hb_at()/hb_rat() */ + +#include "simpleio.ch" + +REQUEST HB_CODEPAGE_FR850 +REQUEST HB_CODEPAGE_FRISO + +PROCEDURE Main() + + LOCAL u := "Une rêve est la moitié d'une réalité." + LOCAL i := hb_translate( u, "UTF8", "FRISO" ) + LOCAL d := hb_translate( u, "UTF8", "FR850" ) + + LOCAL uu :="é" + LOCAL ii := hb_translate( uu, "UTF8", "FRISO" ) + LOCAL dd := hb_translate( uu, "UTF8", "FR850" ) + + LOCAL l := Len( uu ) + 2 + + ? "ISO-8859-1 -", PadR( ii, l ), "=>", i + ? + ? "CP850 -", PadR( dd, l ), "=>", d + ? + ? "UTF-8 -", PadR( uu, l ), "=>", u + ? + ? at( ii, i ), rat( ii, i ), "- ISO-8859-1 at/rat" + ? hb_at( ii, i ), hb_rat( ii, i ), "- ISO-8859-1 hb_at/rat" + ? hb_utf8at( ii, i ), hb_utf8rat( ii, i ), "- ISO-8859-1 hb_utf8at/rat" + ? at( dd, d ), rat( dd, d ), "- CP850 at/rat" + ? hb_at( dd, d ), hb_rat( dd, d ), "- CP850 hb_at/rat" + ? hb_utf8at( dd, d ), hb_utf8rat( dd, d ), "- CP850 hb_utf8at/rat" + ? at( uu, u ), rat( uu, u ), "- UTF-8 at/rat" + ? hb_at( uu, u ), hb_rat( uu, u ), "- UTF-8 hb_at/rat" + ? hb_utf8at( uu, u ), hb_utf8rat( uu, u ), "- UTF-8 hb_utf8at/rat" + ? + ? hb_at( ii, i, 33 ), hb_rat( ii, i, 33 ), hb_at( ii, i, , 33 ), hb_rat( ii, i, , 33 ), "- ISO-8859-1 hb_at/rat" + ? hb_utf8at( ii, i, 33 ), hb_utf8rat( ii, i, 33 ), hb_utf8at( ii, i, , 33 ), hb_utf8rat( ii, i, , 33 ), "- ISO-8859-1 hb_utf8at/rat" + ? hb_at( dd, d, 33 ), hb_rat( dd, d, 33 ), hb_at( dd, d, , 33 ), hb_rat( dd, d, , 33 ), "- CP850 hb_at/rat" + ? hb_utf8at( dd, d, 33 ), hb_utf8rat( dd, d, 33 ), hb_utf8at( dd, d, , 33 ), hb_utf8rat( dd, d, , 33 ), "- CP850 hb_utf8at/rat" + ? hb_at( uu, u, 33 ), hb_rat( uu, u, 33 ), hb_at( uu, u, , 33 ), hb_rat( uu, u, , 33 ), "- UTF-8 hb_at/rat" + ? hb_utf8at( uu, u, 33 ), hb_utf8rat( uu, u, 33 ), hb_utf8at( uu, u, , 33 ), hb_utf8rat( uu, u, , 33 ), "- UTF-8 hb_utf8at/rat" + + RETURN diff --git a/harbour/utils/hbmk2/hbmk2.hu_HU.po b/harbour/utils/hbmk2/hbmk2.hu_HU.po index eeeb3cee44..9f749c08ce 100644 --- a/harbour/utils/hbmk2/hbmk2.hu_HU.po +++ b/harbour/utils/hbmk2/hbmk2.hu_HU.po @@ -824,8 +824,8 @@ msgstr "hozzon l #: hbmk2.prg:7941 #, c-format -msgid "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial, Bazaar and Fossil are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" -msgstr "hozzon létre egy .ch fejlécet a helyi források verziókövetõ (VCS) adatbázisbeli adataival. SVN, CVS, Git, Mercurial, Bazaar és Fossil támogatottak. Generált fejléc _HBMK_VCS_TYPE_ makrója adja vissza a VCS típusát, míg _HBMK_VCS_ID_ az aktuális állapot egyedi azonosítóját" +msgid "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial, Bazaar, Fossil and Monotone are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" +msgstr "hozzon létre egy .ch fejlécet a helyi források verziókövetõ (VCS) adatbázisbeli adataival. SVN, CVS, Git, Mercurial, Bazaar, Fossil és Monotone támogatottak. Generált fejléc _HBMK_VCS_TYPE_ makrója adja vissza a VCS típusát, míg _HBMK_VCS_ID_ az aktuális állapot egyedi azonosítóját" #: hbmk2.prg:6846 #, c-format diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index f897825a6e..e992ee80d1 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -728,6 +728,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) LOCAL nOpt_FNF LOCAL nCCompVer LOCAL lCHD_Comp := .F. + LOCAL cCHD_DirOld LOCAL cCommand LOCAL aCommand @@ -4151,30 +4152,6 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) l_aPRG_TODO := hbmk[ _HBMK_aPRG ] ENDIF - /* Header paths */ - - IF ! lSkipBuild .AND. ! lStopAfterInit - FOR EACH tmp IN hbmk[ _HBMK_aINCPATH ] - IF ! Empty( tmp ) - /* Different escaping for internal and external compiler. */ - IF hbmk[ _HBMK_nHBMODE ] == _HBMODE_NATIVE - AAdd( hbmk[ _HBMK_aOPTPRG ], "-i" + tmp ) - ELSE - AAdd( hbmk[ _HBMK_aOPTPRG ], "-i" + FNameEscape( tmp, hbmk[ _HBMK_nCmd_Esc ] ) ) - ENDIF - IF ! hbmk[ _HBMK_lStopAfterHarbour ] - IF lCHD_Comp - /* Convert source filenames relative to the target dir */ - AAdd( hbmk[ _HBMK_aOPTC ], StrTran( cOptIncMask, "{DI}", FNameEscape( PathMakeAbsolute( tmp, DirAddPathSep( PathMakeRelative( PathNormalize( PathMakeAbsolute( hbmk[ _HBMK_cWorkDir ], hb_pwd() ) ), hb_pwd(), .T. ) ) ), hbmk[ _HBMK_nCmd_Esc ], hbmk[ _HBMK_nCmd_FNF ] ) ) ) - ELSE - AAdd( hbmk[ _HBMK_aOPTC ], StrTran( cOptIncMask, "{DI}", FNameEscape( tmp, hbmk[ _HBMK_nCmd_Esc ], hbmk[ _HBMK_nCmd_FNF ] ) ) ) - ENDIF - AAdd( hbmk[ _HBMK_aOPTRES ], StrTran( cOptIncMask, "{DI}", FNameEscape( tmp, hbmk[ _HBMK_nCmd_Esc ], hbmk[ _HBMK_nCmd_FNF ] ) ) ) - ENDIF - ENDIF - NEXT - ENDIF - /* Dump hbmk2 build information */ IF lDumpInfo @@ -4190,6 +4167,33 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) RETURN 0 ENDIF + /* Header paths */ + + IF ! lSkipBuild .AND. ! lStopAfterInit + IF lCHD_Comp + tmp2 := DirAddPathSep( PathMakeRelative( PathNormalize( PathMakeAbsolute( hbmk[ _HBMK_cWorkDir ], hb_pwd() ) ), hb_pwd(), .T. ) ) + ENDIF + FOR EACH tmp IN hbmk[ _HBMK_aINCPATH ] + IF ! Empty( tmp ) + /* Different escaping for internal and external compiler. */ + IF hbmk[ _HBMK_nHBMODE ] == _HBMODE_NATIVE + AAdd( hbmk[ _HBMK_aOPTPRG ], "-i" + tmp ) + ELSE + AAdd( hbmk[ _HBMK_aOPTPRG ], "-i" + FNameEscape( tmp, hbmk[ _HBMK_nCmd_Esc ] ) ) + ENDIF + IF ! hbmk[ _HBMK_lStopAfterHarbour ] + IF lCHD_Comp + /* Rebase source dirs relative to the target dir */ + AAdd( hbmk[ _HBMK_aOPTC ], StrTran( cOptIncMask, "{DI}", FNameEscape( PathNormalize( PathMakeAbsolute( tmp, tmp2 ) ), hbmk[ _HBMK_nCmd_Esc ], hbmk[ _HBMK_nCmd_FNF ] ) ) ) + ELSE + AAdd( hbmk[ _HBMK_aOPTC ], StrTran( cOptIncMask, "{DI}", FNameEscape( tmp, hbmk[ _HBMK_nCmd_Esc ], hbmk[ _HBMK_nCmd_FNF ] ) ) ) + ENDIF + AAdd( hbmk[ _HBMK_aOPTRES ], StrTran( cOptIncMask, "{DI}", FNameEscape( tmp, hbmk[ _HBMK_nCmd_Esc ], hbmk[ _HBMK_nCmd_FNF ] ) ) ) + ENDIF + ENDIF + NEXT + ENDIF + /* Check if we've found all dependencies */ IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! hbmk[ _HBMK_lStopAfterHarbour ] @@ -4951,6 +4955,19 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cOpt_CompC := StrTran( cOpt_CompC, "{OO}" , FNameEscape( FNameExtSet( hbmk[ _HBMK_cPROGNAME ], cObjExt ), nOpt_Esc, nOpt_FNF ) ) cOpt_CompC := StrTran( cOpt_CompC, "{OW}" , FNameEscape( hbmk[ _HBMK_cWorkDir ], nOpt_Esc, nOpt_FNF ) ) + IF lCHD_Comp + tmp2 := DirAddPathSep( PathMakeRelative( PathNormalize( PathMakeAbsolute( hbmk[ _HBMK_cWorkDir ], hb_pwd() ) ), hb_pwd(), .T. ) ) + IF hbmk[ _HBMK_lDONTEXEC ] + cCHD_DirOld := NIL + ELSE + cCHD_DirOld := hb_pwd() + IF hbmk[ _HBMK_lTRACE ] .AND. hbmk[ _HBMK_lInfo ] + hbmk_OutStd( hbmk, hb_StrFormat( I_( "'cd' to: %1$s" ), hbmk[ _HBMK_cWorkDir ] ) ) + ENDIF + DirChange( hbmk[ _HBMK_cWorkDir ] ) + ENDIF + ENDIF + aThreads := {} FOR EACH aTODO IN ArraySplit( l_aCGEN_TODO, l_nJOBS ) @@ -4958,7 +4975,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) /* Convert source filenames relative to the target dir */ tmp := AClone( aTODO ) FOR EACH tmp1 IN tmp - tmp1 := PathMakeAbsolute( tmp1, DirAddPathSep( PathMakeRelative( PathNormalize( PathMakeAbsolute( hbmk[ _HBMK_cWorkDir ], hb_pwd() ) ), hb_pwd(), .T. ) ) ) + tmp1 := PathMakeAbsolute( tmp1, tmp2 ) NEXT cOpt_CompCLoop := AllTrim( StrTran( cOpt_CompC, "{LC}" , ArrayToList( tmp,, nOpt_Esc, nOpt_FNF ) ) ) ELSE @@ -4997,9 +5014,9 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) IF ! hbmk[ _HBMK_lDONTEXEC ] IF hb_mtvm() .AND. Len( aTODO:__enumBase() ) > 1 - AAdd( aThreads, { hb_threadStart( @hbmk2_hb_processRunInDir(), iif( lCHD_Comp, hbmk[ _HBMK_cWorkDir ], NIL ), cCommand ), cCommand } ) + AAdd( aThreads, { hb_threadStart( @hb_processRun(), cCommand ), cCommand } ) ELSE - IF ( tmp := hbmk2_hb_processRunInDir( iif( lCHD_Comp, hbmk[ _HBMK_cWorkDir ], NIL ), cCommand ) ) != 0 + IF ( tmp := hb_processRun( cCommand ) ) != 0 hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Running C/C++ compiler. %1$s" ), hb_ntos( tmp ) ) ) IF ! hbmk[ _HBMK_lQuiet ] OutErr( cCommand + _OUT_EOL ) @@ -5035,6 +5052,13 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) ENDIF NEXT ENDIF + + IF lCHD_Comp .AND. cCHD_DirOld != NIL + DirChange( cCHD_DirOld ) + IF hbmk[ _HBMK_lTRACE ] .AND. hbmk[ _HBMK_lInfo ] + hbmk_OutStd( hbmk, I_( "'cd' back." ) ) + ENDIF + ENDIF ENDIF ELSE hbmk_OutErr( hbmk, I_( "Error: C/C++ command is not implemented for this platform/compiler." ) ) @@ -5535,21 +5559,6 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) RETURN hbmk[ _HBMK_nErrorLevel ] -STATIC FUNCTION hbmk2_hb_processRunInDir( cNewDir, ... ) - LOCAL cOldDir - LOCAL nRetVal - - IF cNewDir == NIL - RETURN hb_processRun( ... ) - ELSE - cOldDir := hb_pwd() - DirChange( cNewDir ) - nRetVal := hb_processRun( ... ) - DirChange( cOldDir ) - ENDIF - - RETURN nRetVal - STATIC PROCEDURE DoIMPLIB( hbmk, bBlk_ImpLib, cLibLibPrefix, cLibLibExt ) LOCAL cMakeImpLibDLL LOCAL tmp, tmp1 @@ -9477,6 +9486,7 @@ STATIC FUNCTION win_implib_command_msvc( hbmk, cCommand, cSourceDLL, cTargetLib, #define _VCS_CVS 4 #define _VCS_BAZAAR 5 #define _VCS_FOSSIL 6 +#define _VCS_MONOTONE 7 STATIC FUNCTION VCSDetect( cDir ) @@ -9492,6 +9502,7 @@ STATIC FUNCTION VCSDetect( cDir ) CASE hb_DirExists( cDir + ".hg" ) ; RETURN _VCS_MERCURIAL CASE hb_DirExists( cDir + ".bzr" ) ; RETURN _VCS_BAZAAR CASE hb_FileExists( cDir + "_FOSSIL_" ) ; RETURN _VCS_FOSSIL + CASE hb_DirExists( cDir + "_MTN" ) ; RETURN _VCS_MONOTONE CASE hb_DirExists( cDir + "CVS" ) ; RETURN _VCS_CVS CASE hb_DirExists( cDir + "_svn" ) ; RETURN _VCS_SVN /* NOTE: When SVN_ASP_DOT_NET_HACK envvar is set. [vszakats] */ ENDCASE @@ -9530,6 +9541,10 @@ STATIC FUNCTION VCSID( cDir, cVCSHEAD, /* @ */ cType ) cType := "fossil" cCommand := "fossil info" EXIT + CASE _VCS_MONOTONE + cType := "monotone" + cCommand := "mtn status" + EXIT OTHERWISE /* No version control system detected, roll our own. */ cType := "hbmk" @@ -9608,6 +9623,27 @@ STATIC FUNCTION VCSID( cDir, cVCSHEAD, /* @ */ cType ) ENDIF ENDIF EXIT + CASE _VCS_MONOTONE + /* ---------------------------------------------------------------------- + Revision: c79f2332a1e9036bb52ac1f412b92e6a69fc9071 + Parent: bf8b93290ea4e8e946961f51c47f8f4638f65372 + Author: ??? + Date: 2010.07.14. 1:11:47 + Branch: free.lp.se:LPlib + + Changes against parent bf8b93290ea4e8e946961f51c47f8f4638f65372 + + no changes + */ + tmp := At( "Revision:", cStdOut ) + IF tmp > 0 + cStdOut := StrTran( LTrim( SubStr( cStdOut, tmp + Len( "Revision:" ) ) ), Chr( 13 ) ) + tmp := At( Chr( 10 ), cStdOut ) + IF tmp > 0 + cResult := Left( cStdOut, tmp - 1 ) + ENDIF + ENDIF + EXIT ENDSWITCH ENDIF ENDIF @@ -10306,7 +10342,7 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong ) { "-[no]warn[=lev]" , I_( "set C compiler warning level\n can be: max, yes, low, no, def (default: yes)" ) },; { "-[no]compr[=lev]" , I_( "compress executable/dynamic lib (needs UPX)\n can be: min, max, def" ) },; { "-[no]run" , I_( "run/do not run output executable" ) },; - { "-vcshead=" , I_( "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial, Bazaar and Fossil are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" ) },; + { "-vcshead=" , I_( "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial, Bazaar, Fossil and Monotone are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" ) },; { "-tshead=" , I_( "generate .ch header file with timestamp information. Generated header will define macros _HBMK_BUILD_DATE_, _HBMK_BUILD_TIME_, _HBMK_BUILD_TIMESTAMP_ with the date/time of build" ) },; { "-icon=" , I_( "set as application icon. should be a supported format on the target platform" ) },; { "-instfile=" , I_( "add in to the list of files to be copied to path specified by -instpath option. is an optional copy group, it must be at least two characters long." ) },; diff --git a/harbour/utils/hbmk2/hbmk2.pt_BR.po b/harbour/utils/hbmk2/hbmk2.pt_BR.po index 4ec4c03a58..9b7123e124 100644 --- a/harbour/utils/hbmk2/hbmk2.pt_BR.po +++ b/harbour/utils/hbmk2/hbmk2.pt_BR.po @@ -885,8 +885,8 @@ msgstr "O arquivo de configura #: hbmk2.prg:7942 #, c-format -msgid "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial, Bazaar and Fossil are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" -msgstr "gera um arquivo .ch com informações do repositório local. SVN, CVS, Git, Mercurial, Bazaar e Fossil estão entre as ferramentas atualmente suportadas. O arquivo gerado conterá a diretriva _HBMK_VCS_TYPE_ com o nome do VCS detectado e _HBMK_VCS_ID_ com o unique ID do repositório local" +msgid "generate .ch header file with local repository information. SVN, CVS, Git, Mercurial, Bazaar, Fossil and Monotone are currently supported. Generated header will define macro _HBMK_VCS_TYPE_ with the name of detected VCS and _HBMK_VCS_ID_ with the unique ID of local repository" +msgstr "gera um arquivo .ch com informações do repositório local. SVN, CVS, Git, Mercurial, Bazaar, Fossil e Monotone estão entre as ferramentas atualmente suportadas. O arquivo gerado conterá a diretriva _HBMK_VCS_TYPE_ com o nome do VCS detectado e _HBMK_VCS_ID_ com o unique ID do repositório local" #: hbmk2.prg:5805 #, c-format