From 07bd2875b66d9388f6014e89891784037a5579df Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 3 Jul 2009 19:11:55 +0000 Subject: [PATCH] 2009-07-03 21:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * make_gnu.bat - Deleted pocc64 autodetection. With newer versions this wouldn't work just mask normal pocc autodetection. * contrib/xhb/hboutdbg.c % Cast. * utils/hbmk2/hbmk2.prg + Added support for `` type of macro in all options where regular macros are accepted. It's now possible to use this in an .hbp file: -cflag={unix&gcc}"`wx-config --cflags`" --- harbour/ChangeLog | 14 +++++++++++ harbour/contrib/xhb/hboutdbg.c | 2 +- harbour/make_gnu.bat | 1 - harbour/utils/hbmk2/hbmk2.prg | 43 ++++++++++++++++++++++++++++++---- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1ee0a89001..bfd4a2fe59 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-03 21:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * make_gnu.bat + - Deleted pocc64 autodetection. With newer versions this wouldn't + work just mask normal pocc autodetection. + + * contrib/xhb/hboutdbg.c + % Cast. + + * utils/hbmk2/hbmk2.prg + + Added support for `` type of macro + in all options where regular macros are accepted. + It's now possible to use this in an .hbp file: + -cflag={unix&gcc}"`wx-config --cflags`" + 2009-07-03 18:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/rtl/fscopy.c * source/rtl/copyfile.c diff --git a/harbour/contrib/xhb/hboutdbg.c b/harbour/contrib/xhb/hboutdbg.c index ec4c7534cd..c831a00e8c 100644 --- a/harbour/contrib/xhb/hboutdbg.c +++ b/harbour/contrib/xhb/hboutdbg.c @@ -105,7 +105,7 @@ static void debugInit( void ) if( iFifoResult == 0 || iFifoResult == EEXIST ) { if( strlen( pFileName->szName ) > 20 ) - ( ( char * ) pFileName->szName )[ 20 ] = 0; + pFileName->szName[ 20 ] = '\0'; hb_snprintf( szDebugTitle, sizeof( szDebugTitle ), "%s - Debug", pFileName->szName ); diff --git a/harbour/make_gnu.bat b/harbour/make_gnu.bat index 0e73e453c3..cdfc59f036 100644 --- a/harbour/make_gnu.bat +++ b/harbour/make_gnu.bat @@ -59,7 +59,6 @@ if "%HB_COMPILER%" == "" set HB_COMPILER=djgpp call :COMP_DET_ONE icl.exe icc win call :COMP_DET_ONE cl.exe msvc win call :COMP_DET_ONE bcc32.exe bcc win - call :COMP_DET_ONE porc64.exe pocc64 win call :COMP_DET_ONE pocc.exe pocc win call :COMP_DET_ONE xcc.exe xcc win call :COMP_DET_ONE x86_64-w64-mingw32-gcc.exe mingw64 win x86_64-w64-mingw32- diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 47395271ef..28dcc24aaa 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -412,19 +412,43 @@ PROCEDURE Main( ... ) #endif -STATIC FUNCTION hbmk_run( cCmd ) +STATIC FUNCTION hbmk_run( cCmd, cStdOut ) #if defined( __PLATFORM__DOS ) RETURN hb_run( cCmd ) #else - LOCAL h := hb_ProcessOpen( cCmd ) + LOCAL hStdOut + LOCAL h LOCAL result + IF PCount() >= 2 + h := hb_ProcessOpen( cCmd,, @hStdOut ) + ELSE + h := hb_ProcessOpen( cCmd ) + ENDIF IF h != F_ERROR + IF PCount() >= 2 + cStdOut := hbmk_ReadHnd( hStdOut ) + ENDIF result := hb_ProcessValue( h ) hb_ProcessClose( h, .T. ) + IF PCount() >= 2 + FClose( hStdOut ) + ENDIF ELSE result := -1 ENDIF RETURN result + +STATIC FUNCTION hbmk_ReadHnd( hFile ) + + LOCAL cBuffer := Space( 4096 ) + LOCAL cString := "" + LOCAL nLen + + DO WHILE ( nLen := FRead( hFile, @cBuffer, Len( cBuffer ) ) ) > 0 + cString += Left( cBuffer, nLen ) + ENDDO + + RETURN cString #endif STATIC PROCEDURE hbmk_COMP_Setup( cARCH, cCOMP, cBasePath ) @@ -5537,6 +5561,8 @@ STATIC FUNCTION MacroProc( hbmk, cString, cFileName, lLateMode ) LOCAL cStart + LOCAL cStdOut + IF lLateMode == NIL .OR. ! lLateMode cStart := _MACRO_NORM_PREFIX + _MACRO_OPEN ELSE @@ -5544,9 +5570,9 @@ STATIC FUNCTION MacroProc( hbmk, cString, cFileName, lLateMode ) ENDIF DO WHILE ( nStart := At( cStart, cString ) ) > 0 .AND. ; - ( nEnd := hb_At( _MACRO_CLOSE, cString, nStart ) ) > 0 + ( nEnd := hb_At( _MACRO_CLOSE, cString, nStart + 1 ) ) > 0 - cMacro := Upper( SubStr( cString, nStart + 2, nEnd - nStart - 2 ) ) + cMacro := Upper( SubStr( cString, nStart + Len( cStart ), nEnd - nStart - ( ( Len( cStart ) + Len( _MACRO_CLOSE ) - 1 ) ) ) ) SWITCH cMacro CASE "HB_ROOT" @@ -5597,6 +5623,14 @@ STATIC FUNCTION MacroProc( hbmk, cString, cFileName, lLateMode ) cString := Left( cString, nStart - 1 ) + cMacro + SubStr( cString, nEnd + 1 ) ENDDO + DO WHILE ( nStart := At( "`", cString ) ) > 0 .AND. ; + ( nEnd := hb_At( "`", cString, nStart + 1 ) ) > 0 + cMacro := SubStr( cString, nStart + Len( "`" ), nEnd - nStart - ( Len( "`" ) + Len( "`" ) - 1 ) ) + cStdOut := "" + hbmk_run( cMacro, @cStdOut ) + cString := Left( cString, nStart - 1 ) + cStdOut + SubStr( cString, nEnd + 1 ) + ENDDO + RETURN cString STATIC FUNCTION TimeElapsed( nStartSec, nEndSec ) @@ -6652,6 +6686,7 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong ) I_( ".hbc options (they should come in separate lines): libs=[], hbcs=[<.hbc file[s]>], gt=[gtname], prgflags=[Harbour flags], cflags=[C compiler flags], resflags=[resource compiler flags], ldflags=[linker flags], libpaths=[paths], sources=[source files], incpaths=[paths], inctrypaths=[paths], instpaths=[paths], gui|mt|shared|nulrdd|debug|opt|map|strip|run|inc=[yes|no], compr=[yes|no|def|min|max], head=[off|partial|full], skip=[yes|no], echo=\nLines starting with '#' char are ignored" ),; I_( "Platform filters are accepted in each .hbc line and with several options.\nFilter format: {[!][||]}. Filters can be combined using '&', '|' operators and grouped by parantheses. Ex.: {win}, {gcc}, {linux|darwin}, {win&!pocc}, {(win|linux)&!watcom}, {unix&mt&gui}, -cflag={win}-DMYDEF, -stop{dos}, -stop{!allwin}, {allpocc|allgcc|allmingw|unix}, {allmsvc}, {x86|x86_64|ia64|arm}, {debug|nodebug|gui|std|mt|st|xhb}" ),; I_( "Certain .hbc lines (libs=, hbcs=, prgflags=, cflags=, ldflags=, libpaths=, inctrypaths=, instpaths=, echo=) and corresponding command line parameters will accept macros: ${hb_root}, ${hb_dir}, ${hb_name}, ${hb_arch}, ${hb_comp}, ${hb_cpu}, ${hb_bin}, ${hb_lib}, ${hb_dyn}, ${hb_inc}, ${}. libpaths= also accepts %{hb_name} which translates to the name of the .hbc file under search." ),; + I_( "Options accepting macros are also accepting embedded commanded enclosed inside `` chars: `wx-config --libs`." ),; I_( "Defaults and feature support vary by architecture/compiler." ) } DEFAULT lLong TO .F.