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.
This commit is contained in:
Viktor Szakats
2009-07-04 07:17:00 +00:00
parent 077ed664b3
commit b88f31ce94
2 changed files with 31 additions and 21 deletions

View File

@@ -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.

View File

@@ -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