From 29cd12b694e3706e29b8c693ddce854540f010b9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 13 Jul 2010 10:04:06 +0000 Subject: [PATCH] 2010-07-13 12:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/hbdoc.prg * include/hbextern.ch + Added __HBDOC_TOSOURCE( ) which is able to rebuild original HBDOC source from memory variable. ATM language information is lost in the process, this will have to be solved in the future. * utils/hbmk2/hbmk2.prg + Added experimental optimization to mingw build, where the compiler is called only once to compile all files. Since gcc doesn't have a switch for that, it's done in tricky way by changing directory and recalculating source dir relative from workdir. Now it's active by default, pls report any build errors, especially in multithreaded mode. * contrib/hbqt/generator/hbqtgen.prg * Cleanups * contrib/hbwin/win_shell.c ! Reverted previous patch 2010-07-13 08:55, it broke mingw builds. --- harbour/ChangeLog | 22 ++++++++++++ harbour/contrib/hbqt/generator/hbqtgen.prg | 21 ++++++------ harbour/contrib/hbwin/win_shell.c | 33 +++++------------- harbour/include/hbextern.ch | 1 + harbour/src/rtl/hbdoc.prg | 28 ++++++++++++++- harbour/utils/hbmk2/hbmk2.prg | 40 ++++++++++++++++++---- 6 files changed, 103 insertions(+), 42 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1dcda9b003..2d9810f583 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,28 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-13 12:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/hbdoc.prg + * include/hbextern.ch + + Added __HBDOC_TOSOURCE( ) which is able to + rebuild original HBDOC source from memory variable. + ATM language information is lost in the process, this + will have to be solved in the future. + + * utils/hbmk2/hbmk2.prg + + Added experimental optimization to mingw build, where the + compiler is called only once to compile all files. Since + gcc doesn't have a switch for that, it's done in tricky + way by changing directory and recalculating source dir + relative from workdir. Now it's active by default, pls + report any build errors, especially in multithreaded mode. + + * contrib/hbqt/generator/hbqtgen.prg + * Cleanups + + * contrib/hbwin/win_shell.c + ! Reverted previous patch 2010-07-13 08:55, it broke mingw builds. + 2010-07-13 08:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + tests/hbmk.hbm + Added hbmk2 automatic configuration to set warning level to 3. diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index e84f384796..c44714456a 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -1752,6 +1752,9 @@ STATIC FUNCTION Build_Class( cWidget, cls_, doc_, cPathOut, subCls_ ) /*----------------------------------------------------------------------*/ +#define QT_VER "4.5" +#define QT_WEB "http://doc.trolltech.com/" + STATIC FUNCTION Build_Document( cWidget, cls_, doc_, cPathDoc, subCls_, docum_ ) LOCAL cText, n, n1, n2, nLen, pWidget, cRet, cLib, cFile, i, cInherits LOCAL txt_:= {} @@ -1775,7 +1778,7 @@ STATIC FUNCTION Build_Document( cWidget, cls_, doc_, cPathDoc, subCls_, docum_ ) ENDIF aadd( txt_, '/* ' ) - aadd( txt_, ' * hbQTgen v1.0 - Harbour Callable Wrappers Generator for Qt v4.5.3+' ) + aadd( txt_, ' * hbQTgen v1.0 - Harbour Callable Wrappers Generator for Qt v4.5+' ) aadd( txt_, ' * Please do not modify this document as it is subject to change in future.' ) aadd( txt_, ' * Pritpal Bedi ' ) aadd( txt_, ' */ ' ) @@ -1790,7 +1793,7 @@ STATIC FUNCTION Build_Document( cWidget, cls_, doc_, cPathDoc, subCls_, docum_ ) aadd( txt_, ' $SUBCATEGORY$ ' ) aadd( txt_, ' ' + 'GUI' ) aadd( txt_, ' $EXTERNALLINK$' ) - aadd( txt_, ' ' + 'http://doc.trolltech.com/4.5/' + lower( cWidget ) + '.html' ) + aadd( txt_, ' ' + QT_WEB + QT_VER + '/' + lower( cWidget ) + '.html' ) aadd( txt_, ' $ONELINER$ ' ) aadd( txt_, ' ' + 'Creates a new ' + cWidget + ' object.' ) aadd( txt_, ' $INHERITS$ ' ) @@ -1843,13 +1846,13 @@ STATIC FUNCTION Build_Document( cWidget, cls_, doc_, cPathDoc, subCls_, docum_ ) aadd( txt_, ' $PLATFORMS$ ' ) aadd( txt_, ' ' + 'Windows, Linux, MacOS, OS2' ) aadd( txt_, ' $VERSION$ ' ) - aadd( txt_, ' ' + '4.5.3' ) + aadd( txt_, ' ' + '4.5 or upper' ) aadd( txt_, ' $FILES$ ' ) - aadd( txt_, ' ' + 'Prg Source : ' + 'contrib/hbqt' + iif( empty( cLib ), '', '/' + cLib ) + '/T' + cWidget + '.prg' ) - aadd( txt_, ' ' + 'C++ Wrappers : ' + 'contrib/hbqt' + iif( empty( cLib ), '', '/' + cLib ) + '/' + cWidget + '.cpp' ) + aadd( txt_, ' ' + 'Prg source : ' + 'contrib/hbqt' + iif( empty( cLib ), '', '/' + cLib ) + '/T' + cWidget + '.prg' ) + aadd( txt_, ' ' + 'C++ wrappers : ' + 'contrib/hbqt' + iif( empty( cLib ), '', '/' + cLib ) + '/' + cWidget + '.cpp' ) aadd( txt_, ' ' + 'Library : ' + 'hb' + cLib ) aadd( txt_, ' $SEEALSO$ ' ) - * aadd( txt_, ' ' + iif( empty( cInherits ), "", cInherits + ", " ) + 'http://doc.trolltech.com/4.5/' + lower( cWidget ) + '.html' ) + * aadd( txt_, ' ' + iif( empty( cInherits ), "", cInherits + ", " ) + QT_WEB + QT_VER + '/' + lower( cWidget ) + '.html' ) aadd( txt_, ' ' + cInherits ) aadd( txt_, ' $END$ ' ) aadd( txt_, ' */ ' ) @@ -1959,8 +1962,6 @@ STATIC FUNCTION Build_MakeFile( cpp_, prg_, cPathOut ) /*----------------------------------------------------------------------*/ #define CRLF chr( 13 )+chr( 10 ) -#define QT_VER "4.5" -#define QT_WEB "http://doc.trolltech.com/" FUNCTION Build_HTML( cWidget, aHM_, aHF_, cPathOut, docum_ ) LOCAL cFile := cPathOut + s_PathSep + 'html' + s_PathSep + cWidget + '.htm' @@ -1992,7 +1993,7 @@ FUNCTION Build_HTML( cWidget, aHM_, aHF_, cPathOut, docum_ ) /* Class Documentation */ s := "" + "CLASS REFERENCE" + "" aadd( aHtml, s ) - s := "" + "Source: /harbour/contrib/hbqt/T" + cWidget + ".prg" + "" + s := "" + "Source: /contrib/hbqt/T" + cWidget + ".prg" + "" aadd( aHtml, s ) s := QT_WEB + QT_VER + "/" + lower( cWidget ) + ".htm" s := "' + s + "" @@ -2036,7 +2037,7 @@ FUNCTION Build_HTML( cWidget, aHM_, aHF_, cPathOut, docum_ ) /* Function Documentation */ s := "" + "FUNCTIONS REFERENCE" + "" aadd( aHtml, s ) - s := "" + "Source: /harbour/contrib/hbqt/" + cWidget + ".cpp" + "" + s := "" + "Source: /contrib/hbqt/" + cWidget + ".cpp" + "" aadd( aHtml, s ) FOR j := 1 TO len( aHF_ ) s := "" diff --git a/harbour/contrib/hbwin/win_shell.c b/harbour/contrib/hbwin/win_shell.c index 789e2a9a60..3b529c443d 100644 --- a/harbour/contrib/hbwin/win_shell.c +++ b/harbour/contrib/hbwin/win_shell.c @@ -54,33 +54,16 @@ #undef _WIN32_IE #define _WIN32_IE 0x0500 /* request Windows 2000 features for NOTIFYICONDATA */ +/* This code uses named union so this declaration is necessary for + * compilers where nameless unions are default + */ +#if !defined( NONAMELESSUNION ) + #define NONAMELESSUNION +#endif + #include "hbwapi.h" #include "hbapiitm.h" -#if defined( __BORLANDC__ ) -# if !defined( NONAMELESSUNION ) -# define NONAMELESSUNION -# endif -# if defined( DUMMYUNIONNAME ) -# undef DUMMYUNIONNAME -# endif -# if defined( DUMMYUNIONNAME2 ) -# undef DUMMYUNIONNAME2 -# endif -# if defined( DUMMYUNIONNAME3 ) -# undef DUMMYUNIONNAME3 -# endif -# if defined( DUMMYUNIONNAME4 ) -# undef DUMMYUNIONNAME4 -# endif -# if defined( DUMMYUNIONNAME5 ) -# undef DUMMYUNIONNAME5 -# endif -# define HB_WIN_U( x, y, z ) x ## . ## y ## . ## z -#else -# define HB_WIN_U( x, y, z ) x ## . ## z -#endif - #include /* WIN_ShellNotifyIcon( [], [], [], [], @@ -109,7 +92,7 @@ HB_FUNC( WIN_SHELLNOTIFYICON ) { if( HB_ITEMCOPYSTR( hb_param( 7, HB_IT_ANY ), tnid.szInfo, HB_SIZEOFARRAY( tnid.szInfo ) ) > 0 ) tnid.uFlags |= NIF_INFO; - HB_WIN_U( tnid, DUMMYUNIONNAME, uTimeout ) = ( UINT ) hb_parni( 8 ); + tnid.u.uTimeout = ( UINT ) hb_parni( 8 ); if( HB_ITEMCOPYSTR( hb_param( 9, HB_IT_ANY ), tnid.szInfoTitle, HB_SIZEOFARRAY( tnid.szInfoTitle ) ) > 0 ) tnid.uFlags |= NIF_INFO; tnid.dwInfoFlags = ( DWORD ) hb_parnl( 10 ); diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 37cd32bb18..1f48904547 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -551,6 +551,7 @@ EXTERNAL __EINSTVAR52 EXTERNAL __EINSTVAR53 EXTERNAL __HBDOC_LOADDIR +EXTERNAL __HBDOC_TOSOURCE /* i18n */ EXTERNAL HB_I18N_GETTEXT diff --git a/harbour/src/rtl/hbdoc.prg b/harbour/src/rtl/hbdoc.prg index cfffa77c45..99b277c758 100644 --- a/harbour/src/rtl/hbdoc.prg +++ b/harbour/src/rtl/hbdoc.prg @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * NFDOC reader + * HBDOC reader * * Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) * www - http://harbour-project.org @@ -207,3 +207,29 @@ STATIC FUNCTION DirAddPathSep( cDir ) ENDIF RETURN cDir + +FUNCTION __hbdoc_ToSource( aEntry ) + LOCAL cSource := "" + LOCAL hEntry + LOCAL item + LOCAL cLine + + IF ISARRAY( aEntry ) + FOR EACH hEntry IN aEntry + cSource += "/* $DOC$" + hb_eol() + FOR EACH item IN hEntry + IF ISCHARACTER( item ) .AND. ; + !( Left( item:__enumKey(), 1 ) == "_" ) + cSource += " * $" + item:__enumKey() + "$" + hb_eol() + FOR EACH cLine IN hb_ATokens( StrTran( item, Chr( 13 ) ), Chr( 10 ) ) + cSource += " * " + cLine + hb_eol() + NEXT + ENDIF + NEXT + cSource += " * $END$" + hb_eol() + cSource += " */" + hb_eol() + cSource += hb_eol() + NEXT + ENDIF + + RETURN cSource diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 1e8d6977f0..7e2a070e9c 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -727,6 +727,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) LOCAL nOpt_Esc LOCAL nOpt_FNF LOCAL nCCompVer + LOCAL lCHD_Comp := .F. LOCAL cCommand LOCAL aCommand @@ -2916,7 +2917,12 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cOpt_CompC += " {FC}" cOptIncMask := "-I{DI}" IF ! Empty( hbmk[ _HBMK_cWorkDir ] ) - cOpt_CompC += " {IC} -o {OO}" + IF .T. /* EXPERIMENTAL */ + lCHD_Comp := .T. + cOpt_CompC += " {LC}" + ELSE + cOpt_CompC += " {IC} -o {OO}" + ENDIF AAdd( hbmk[ _HBMK_aOPTC ], "-pipe" ) ELSE cOpt_CompC += " {LC}" @@ -4943,7 +4949,16 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) aThreads := {} FOR EACH aTODO IN ArraySplit( l_aCGEN_TODO, l_nJOBS ) - cOpt_CompCLoop := AllTrim( StrTran( cOpt_CompC, "{LC}" , ArrayToList( aTODO,, nOpt_Esc, nOpt_FNF ) ) ) + IF lCHD_Comp + /* 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. ) ) ) + NEXT + cOpt_CompCLoop := AllTrim( StrTran( cOpt_CompC, "{LC}" , ArrayToList( tmp,, nOpt_Esc, nOpt_FNF ) ) ) + ELSE + cOpt_CompCLoop := AllTrim( StrTran( cOpt_CompC, "{LC}" , ArrayToList( aTODO,, nOpt_Esc, nOpt_FNF ) ) ) + ENDIF /* Handle moving the whole command line to a script, if requested. */ cScriptFile := NIL @@ -4977,9 +4992,9 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) IF ! hbmk[ _HBMK_lDONTEXEC ] IF hb_mtvm() .AND. Len( aTODO:__enumBase() ) > 1 - AAdd( aThreads, { hb_threadStart( @hb_processRun(), cCommand ), cCommand } ) + AAdd( aThreads, { hb_threadStart( @hbmk2_hb_processRunInDir(), iif( lCHD_Comp, hbmk[ _HBMK_cWorkDir ], NIL ), cCommand ), cCommand } ) ELSE - IF ( tmp := hb_processRun( cCommand ) ) != 0 + IF ( tmp := hbmk2_hb_processRunInDir( iif( lCHD_Comp, hbmk[ _HBMK_cWorkDir ], NIL ), 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 ) @@ -5515,6 +5530,21 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) RETURN hbmk[ _HBMK_nErrorLevel ] +STATIC FUNCTION hbmk2_hb_processRunInDir( cNewDir, ... ) + LOCAL cOldDir + LOCAL xRetVal + + IF cNewDir == NIL + RETURN hb_processRun( ... ) + ELSE + cOldDir := hb_pwd() + DirChange( cNewDir ) + xRetVal := hb_processRun( ... ) + DirChange( cOldDir ) + ENDIF + + RETURN xRetVal + STATIC PROCEDURE DoIMPLIB( hbmk, bBlk_ImpLib, cLibLibPrefix, cLibLibExt ) LOCAL cMakeImpLibDLL LOCAL tmp, tmp1 @@ -7292,8 +7322,6 @@ STATIC FUNCTION PathMakeAbsolute( cPathR, cPathA ) RETURN hb_FNameMerge( cDirA + cDirR, cNameR, cExtR ) -/* NOTE: Not used by hbmk2 code, but could be useful for - apps creating hbmk2 script/config files. [vszakats] */ STATIC FUNCTION PathMakeRelative( cPathBase, cPathTarget, lForceRelative ) LOCAL tmp