From a3ebb728d0aa5f93da3dab024f20c894f429eb7f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 5 May 2009 14:59:12 +0000 Subject: [PATCH] 2009-05-05 17:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcomp.h * harbour/source/compiler/hbmain.c * harbour/source/compiler/hbcomp.c * harbour/source/compiler/compi18n.c * changed -j/ and -j behavior when more the one .prg file is compiled. Now when / is used then it's respected by all compiler .prg modules. When is used then only single .pot file is generated but it contains i18n entries from all compiled .prg modules. * harbour/ChangeLog + added two thanks notes, one to Miguel and using HeapAlloc() and second to Walter Negro for his DATETIME work in xHarbour what gives valuable test platform for Harbour and was important inspiration for Harbour TIMESTAMP implementation. --- harbour/ChangeLog | 22 ++++++++++++++++++++++ harbour/include/hbcomp.h | 2 +- harbour/source/compiler/compi18n.c | 10 ++++++++-- harbour/source/compiler/hbcomp.c | 12 ++++++++---- harbour/source/compiler/hbmain.c | 18 +++++++++--------- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 31214d29c0..2ca785305a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-05 17:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbcomp.h + * harbour/source/compiler/hbmain.c + * harbour/source/compiler/hbcomp.c + * harbour/source/compiler/compi18n.c + * changed -j/ and -j behavior when more the one .prg file + is compiled. Now when / is used then it's respected by all + compiler .prg modules. When is used then only single .pot + file is generated but it contains i18n entries from all compiled + .prg modules. + + * harbour/ChangeLog + + added two thanks notes, one to Miguel and using HeapAlloc() and + second to Walter Negro for his DATETIME work in xHarbour what gives + valuable test platform for Harbour and was important inspiration for + Harbour TIMESTAMP implementation. + 2009-05-04 17:52 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/gtwvg.h * harbour/contrib/gtwvg/hbgtwvg.ch @@ -5984,6 +6001,9 @@ Warning: this implementation is not xHarbour compatible. There are many important differences. Mostly on C level and used API. Please be careful in porting xHarbour source code to Harbour. + Many thanks to Walter Negro for his DATETIME implementation in xHarbour + which allowed me to tests some different aspects of DAYTIME/TIMESTAMP + behavior and was important inspiration for this job. 2009-03-21 15:44 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * contrib/hbtpathy/tpwin.c @@ -16320,6 +16340,8 @@ * use HeapAlloc( GetProcessHeap(), ... ) instead of LocalAlloc() when HB_FM_WIN32_ALLOC macro is set - Toninho's tests show that it's a little bit more efficient - thanks. + Thanks also to Miguel Angel Marchuet which 1-st used HeapAlloc() + in xHarbour. 2009-01-09 17:59 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbct/ftoc.c diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 65794dd928..66b77335cc 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -349,7 +349,7 @@ extern void hb_compIdentifierClose( HB_COMP_DECL ); /* release the table of iden /* compi18n.c */ extern void hb_compI18nFree( HB_COMP_DECL ); -extern BOOL hb_compI18nSave( HB_COMP_DECL ); +extern BOOL hb_compI18nSave( HB_COMP_DECL, BOOL fFinal ); extern void hb_compI18nAdd( HB_COMP_DECL, const char* szText, const char* szContext, const char * szModule, UINT uiLine ); extern void hb_compI18nAddPlural( HB_COMP_DECL, const char** szTexts, ULONG ulCount, const char* szContext, const char * szModule, UINT uiLine ); diff --git a/harbour/source/compiler/compi18n.c b/harbour/source/compiler/compi18n.c index 6fec5efd00..8ebe4f053f 100644 --- a/harbour/source/compiler/compi18n.c +++ b/harbour/source/compiler/compi18n.c @@ -254,7 +254,7 @@ static void hb_compI18nEscapeString( FILE* file, const char* szText ) } } -BOOL hb_compI18nSave( HB_COMP_DECL ) +BOOL hb_compI18nSave( HB_COMP_DECL, BOOL fFinal ) { PHB_I18NTABLE pI18n; PHB_I18NSTRING pString; @@ -268,7 +268,8 @@ BOOL hb_compI18nSave( HB_COMP_DECL ) if( !pI18n ) return FALSE; - FileName.szPath = FileName.szName = FileName.szExtension = FileName.szDrive = NULL; + FileName.szPath = FileName.szName = FileName.szExtension = + FileName.szDrive = NULL; if( HB_COMP_PARAM->pOutPath ) { @@ -293,6 +294,11 @@ BOOL hb_compI18nSave( HB_COMP_DECL ) if( ! FileName.szName ) FileName.szName = HB_COMP_PARAM->pFileName->szName; + else if( ! fFinal ) + /* The exact file name was given generate single .pot file for + * all compiled .prg files in final phase. + */ + return FALSE; if( ! FileName.szExtension ) FileName.szExtension = ".pot"; diff --git a/harbour/source/compiler/hbcomp.c b/harbour/source/compiler/hbcomp.c index e2292c79eb..9663ac41a5 100644 --- a/harbour/source/compiler/hbcomp.c +++ b/harbour/source/compiler/hbcomp.c @@ -247,6 +247,7 @@ HB_COMP_PTR hb_comp_new( void ) void hb_comp_free( HB_COMP_PTR pComp ) { + hb_compI18nFree( pComp ); hb_compCompileEnd( pComp ); hb_compParserStop( pComp ); @@ -295,14 +296,17 @@ void hb_comp_free( HB_COMP_PTR pComp ) if( pComp->szStdCh ) hb_xfree( pComp->szStdCh ); - if( HB_COMP_PARAM->iStdChExt > 0 ) + if( pComp->iStdChExt > 0 ) { do - hb_xfree( HB_COMP_PARAM->szStdChExt[ --HB_COMP_PARAM->iStdChExt ] ); - while( HB_COMP_PARAM->iStdChExt != 0 ); - hb_xfree( HB_COMP_PARAM->szStdChExt ); + hb_xfree( pComp->szStdChExt[ --pComp->iStdChExt ] ); + while( pComp->iStdChExt != 0 ); + hb_xfree( pComp->szStdChExt ); } + if( pComp->pI18nFileName ) + hb_xfree( pComp->pI18nFileName ); + hb_xfree( pComp ); } diff --git a/harbour/source/compiler/hbmain.c b/harbour/source/compiler/hbmain.c index 67158d645a..5ef505a577 100644 --- a/harbour/source/compiler/hbmain.c +++ b/harbour/source/compiler/hbmain.c @@ -156,6 +156,9 @@ int hb_compMain( int argc, char * const argv[], BYTE ** pBufPtr, ULONG * pulSize if( HB_COMP_PARAM->iErrorCount > 0 ) iStatus = EXIT_FAILURE; + if( iStatus == EXIT_SUCCESS ) + hb_compI18nSave( HB_COMP_PARAM, TRUE ); + if( pBufPtr && pulSize ) { if( iStatus == EXIT_SUCCESS ) @@ -3814,14 +3817,6 @@ static void hb_compAddInitFunc( HB_COMP_DECL, PFUNCTION pFunc ) void hb_compCompileEnd( HB_COMP_DECL ) { - hb_compI18nFree( HB_COMP_PARAM ); - - if( HB_COMP_PARAM->pI18nFileName ) - { - hb_xfree( HB_COMP_PARAM->pI18nFileName ); - HB_COMP_PARAM->pI18nFileName = NULL; - } - if( HB_COMP_PARAM->pMainFileName ) { if( HB_COMP_PARAM->pFileName != HB_COMP_PARAM->pMainFileName ) @@ -4190,7 +4185,12 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, int iFileType ) } hb_compGenOutput( HB_COMP_PARAM, HB_COMP_PARAM->iLanguage ); - hb_compI18nSave( HB_COMP_PARAM ); + } + + if( ! bSkipGen && HB_COMP_PARAM->iErrorCount == 0 ) + { + if( hb_compI18nSave( HB_COMP_PARAM, FALSE ) ) + hb_compI18nFree( HB_COMP_PARAM ); } } }