From b88f31ce94b1f5506203fb57a4498a7f04ec8a37 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 4 Jul 2009 07:17:00 +0000 Subject: [PATCH] 2009-07-04 09:13 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg * commandResult() merged into hbmk_run(). This also means that 'getFirstFunc()' will now use hb_process*() API on non-DOS platforms to retrieve stdout output of 'nm' command executed. ; Przemek, could you please review this logic? It may be wrong according to one of your recent mails. In this case, maybe the temp file method should be used on all platforms. --- harbour/ChangeLog | 12 +++++++++++ harbour/utils/hbmk2/hbmk2.prg | 40 +++++++++++++++++------------------ 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d58eda29dc..2ce43cde00 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,18 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-04 09:13 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + * commandResult() merged into hbmk_run(). + This also means that 'getFirstFunc()' will now use + hb_process*() API on non-DOS platforms to retrieve + stdout output of 'nm' command executed. + + ; Przemek, could you please review this logic? It may be + wrong according to one of your recent mails. In this + case, maybe the temp file method should be used on all + platforms. + 2009-07-04 08:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added command substitution support for DOS platform. diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index e1278278b2..613bc096b5 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -419,8 +419,21 @@ PROCEDURE Main( ... ) STATIC FUNCTION hbmk_run( hbmk, cCmd, cStdOut ) #if defined( __PLATFORM__DOS ) LOCAL nResult + LOCAL hFile + LOCAL cFileName IF PCount() >= 2 - cStdOut := commandResult( hbmk, cCmd, @nResult ) + hFile := hb_FTempCreateEx( @cFileName ) + IF hFile != F_ERROR + FClose( hFile ) + cCmd += ">" + cFileName + nResult := hb_run( cCmd ) + cStdOut := hb_MemoRead( cFileName ) + FErase( cFileName ) + ELSE + nResult := -1 + cStdOut := "" + hbmk_OutErr( hbmk, I_( "Error: Cannot create temporary file." ) ) + ENDIF RETURN nResult ENDIF RETURN hb_run( cCmd ) @@ -447,11 +460,13 @@ STATIC FUNCTION hbmk_run( hbmk, cCmd, cStdOut ) ENDIF ELSE result := -1 + IF PCount() >= 2 + cStdOut := "" + ENDIF ENDIF RETURN result STATIC FUNCTION hbmk_ReadHnd( hFile ) - LOCAL cBuffer := Space( 4096 ) LOCAL cString := "" LOCAL nLen @@ -5710,7 +5725,8 @@ STATIC FUNCTION getFirstFunc( hbmk, cFile ) ENDIF NEXT ELSEIF ! Empty( cExecNM := FindInPath( hbmk[ _HBMK_cCCPREFIX ] + "nm" ) ) - cFuncList := commandResult( hbmk, cExecNM + " " + cFile + " -g -n --defined-only -C" ) + cFuncList := "" + hbmk_run( hbmk, cExecNM + " " + cFile + " -g -n --defined-only -C", @cFuncList ) IF ( n := At( " T HB_FUN_", cFuncList ) ) != 0 n += 10 DO WHILE ( c := SubStr( cFuncList, n++, 1 ) ) == "_" .OR. ; @@ -5728,24 +5744,6 @@ STATIC FUNCTION getFirstFunc( hbmk, cFile ) RETURN cFuncName -STATIC FUNCTION commandResult( hbmk, cCommand, nResult ) - LOCAL hFile, cFileName, cResult - - hFile := hb_FTempCreateEx( @cFileName ) - - IF hFile != F_ERROR - FClose( hFile ) - cCommand += ">" + cFileName - nResult := hb_run( cCommand ) - cResult := hb_MemoRead( cFileName ) - FErase( cFileName ) - ELSE - nResult := -1 - hbmk_OutErr( hbmk, I_( "Error: Cannot create temporary file." ) ) - ENDIF - - RETURN cResult - STATIC PROCEDURE PlatformPRGFlags( hbmk, aOPTPRG ) LOCAL aUnd LOCAL aDef