2012-11-21 01:07 UTC+0100 Viktor Szakats (harbour syenar.net)

* utils/hbmk2/hbmk2.prg
    + implemented theoretically correct solution to extract
      linker output _while_ displaying it. It means that
      missing function hinting feature doesn't require
      a second pass to the linker anymore.
    ; Please test on all platforms.
    ; For those two people interested, it will create output like this:
      ---
      hbmk2: Hint: Add option 'hbct.hbc' for missing function(s): CharMirr()
      hbmk2: Hint: Add option 'hbusb.hbc' for missing function(s): libusb_exit()
      hbmk2: Hint: Add option 'hbsms.hbc' for missing function(s): smsctx_PIN()
      hbmk2: Error: Referenced, missing, but unknown function(s): NOTANYWHERE()
      ---

  * extras/httpsrv/uhttpd.prg
    ! fixed some code for unicode
    % fixed to not call FCLOSE() on a HB_PROCESSOPEN() handle
    * use F_ERROR instead of -1 literal
    * commented code converted to #if 0/#endif guarded one

  * src/rtl/hbprocfn.c
    * formatting

  * tests/fixcase.hb
    * new extension exceptions
This commit is contained in:
Viktor Szakats
2012-11-21 00:16:52 +00:00
parent ba3ed238e1
commit 9c50617dbe
5 changed files with 74 additions and 30 deletions

View File

@@ -10,6 +10,33 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2012-11-21 01:07 UTC+0100 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/hbmk2.prg
+ implemented theoretically correct solution to extract
linker output _while_ displaying it. It means that
missing function hinting feature doesn't require
a second pass to the linker anymore.
; Please test on all platforms.
; For those two people interested, it will create output like this:
---
hbmk2: Hint: Add option 'hbct.hbc' for missing function(s): CharMirr()
hbmk2: Hint: Add option 'hbusb.hbc' for missing function(s): libusb_exit()
hbmk2: Hint: Add option 'hbsms.hbc' for missing function(s): smsctx_PIN()
hbmk2: Error: Referenced, missing, but unknown function(s): NOTANYWHERE()
---
* extras/httpsrv/uhttpd.prg
! fixed some code for unicode
% fixed to not call FCLOSE() on a HB_PROCESSOPEN() handle
* use F_ERROR instead of -1 literal
* commented code converted to #if 0/#endif guarded one
* src/rtl/hbprocfn.c
* formatting
* tests/fixcase.hb
* new extension exceptions
2012-11-21 00:14 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/gtwvg/gtwgud.c
* contrib/gtwvg/gtwvgd.c

View File

@@ -1517,7 +1517,7 @@ STATIC FUNCTION CGIExec( cProc, /*@*/ cOutPut )
// hb_ToOutDebug( "New 2 Path: %s\n\r", hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir() )
IF hProc > -1
IF hProc != F_ERROR
// hb_ToOutDebug( "Process handler: %s\n\r", hProc )
// hb_ToOutDebug( "Error: %s\n\r", FError() )
@@ -1536,21 +1536,21 @@ STATIC FUNCTION CGIExec( cProc, /*@*/ cOutPut )
// hb_ToOutDebug( "Reading output\n\r" )
cData := Space( 1000 )
cOutPut := ""
DO WHILE ( nLen := FRead( hOut, @cData, Len( cData ) ) ) > 0
cOutPut += SubStr( cData, 1, nLen )
DO WHILE ( nLen := FRead( hOut, @cData, hb_BLen( cData ) ) ) > 0
cOutPut += hb_BLeft( cData, nLen )
cData := Space( 1000 )
ENDDO
/*
#if 0
cData := Space( 1000 )
cError := ""
DO WHILE ( nLen := FRead( hErr, @cData, Len( cData ) ) ) > 0
cError += SubStr( cData, 1, nLen )
DO WHILE ( nLen := FRead( hErr, @cData, hb_BLen( cData ) ) ) > 0
cError += hb_BLeft( cData, nLen )
cData := Space( 1000 )
ENDDO
cOutPut += cError
*/
#endif
// hb_ToOutDebug( "Received: cOutPut = %s\n\r", cOutPut )
@@ -1570,7 +1570,6 @@ STATIC FUNCTION CGIExec( cProc, /*@*/ cOutPut )
nErrorLevel := nKillExit
ENDIF
FClose( hProc )
FClose( hIn )
FClose( hOut )
// FClose( hErr )

View File

@@ -59,7 +59,7 @@
HB_FUNC( HB_PROCESSOPEN )
{
const char *szName = hb_parc( 1 );
const char * szName = hb_parc( 1 );
PHB_ITEM pStdIn = hb_param( 2, HB_IT_BYREF );
PHB_ITEM pStdOut = hb_param( 3, HB_IT_BYREF );
PHB_ITEM pStdErr = hb_param( 4, HB_IT_BYREF );

View File

@@ -29,6 +29,8 @@ PROCEDURE Main()
LOCAL hExtExceptions := { ;
hb_libExt() => NIL, ;
".zip" => NIL, ;
".7z" => NIL, ;
".exe" => NIL, ;
".o" => NIL, ;
".js" => NIL, ;
".dif" => NIL, ;
@@ -102,7 +104,8 @@ PROCEDURE Main()
FOR EACH aFile IN hb_DirScan( "", hb_osFileMask() )
cExt := hb_FNameExt( aFile[ F_NAME ] )
IF !( hb_FNameExt( aFile[ F_NAME ] ) $ hExtExceptions ) .AND. ;
IF ! Empty( hb_FNameExt( aFile[ F_NAME ] ) ) .AND. ;
!( hb_FNameExt( aFile[ F_NAME ] ) $ hExtExceptions ) .AND. ;
!( hb_FNameNameExt( aFile[ F_NAME ] ) $ hFileExceptions ) .AND. ;
AScan( aMaskExceptions, {| tmp | hb_FileMatch( StrTran( aFile[ F_NAME ], "\", "/" ), tmp ) } ) == 0
ProcFile( hAll, aFile[ F_NAME ] )

View File

@@ -134,8 +134,6 @@
On IA64 Windows: msvcia64, msvc, msvc64, mingw, mingw64, ...
*/
#define _HBMK_LIB_HINTS_
#ifndef _HBMK_EMBEDDED_
#include "hbextcdp.ch"
@@ -1331,9 +1329,7 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
LOCAL lHBMAINDLLP
#ifdef _HBMK_LIB_HINTS_
LOCAL cStdOut, cStdErr
#endif
LOCAL cStdOutErr
IF s_cSecToken == NIL
s_cSecToken := StrZero( hb_rand32(), 10, 0 )
@@ -6611,7 +6607,7 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
ENDIF
ENDIF
IF ! hbmk[ _HBMK_lDONTEXEC ] .AND. ( tmp := hb_processRun( cCommand ) ) != 0
IF ! hbmk[ _HBMK_lDONTEXEC ] .AND. ( tmp := hbmk_hb_processRunCatch( cCommand, @cStdOutErr ) ) != 0
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Running linker. %1$d" ), tmp ) )
IF ! hbmk[ _HBMK_lQuiet ]
OutErr( cCommand + _OUT_EOL )
@@ -6620,14 +6616,11 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
hbmk[ _HBMK_nErrorLevel ] := _ERRLEV_RUNLINKER
ENDIF
#ifdef _HBMK_LIB_HINTS_
/* Run failed linker command again to
analyze its output and present hints */
IF ! hbmk[ _HBMK_lQuiet ] .AND. ! hbmk[ _HBMK_lIGNOREERROR ]
hb_processRun( cCommand,, @cStdOut, @cStdErr )
AdviseMissingLibs( hbmk, cStdOut + hb_eol() + cStdErr )
IF ! hbmk[ _HBMK_lQuiet ]
AdviseMissingLibs( hbmk, cStdOutErr )
ENDIF
#endif
ENDIF
IF ! Empty( cScriptFile )
@@ -6733,7 +6726,7 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
ENDIF
ENDIF
IF ! hbmk[ _HBMK_lDONTEXEC ] .AND. ( tmp := hb_processRun( cCommand ) ) != 0
IF ! hbmk[ _HBMK_lDONTEXEC ] .AND. ( tmp := hbmk_hb_processRunCatch( cCommand, @cStdOutErr ) ) != 0
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Running dynamic lib link command. %1$d" ), tmp ) )
IF ! hbmk[ _HBMK_lQuiet ]
OutErr( cCommand + _OUT_EOL )
@@ -6742,14 +6735,11 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
hbmk[ _HBMK_nErrorLevel ] := _ERRLEV_RUNLINKER
ENDIF
#ifdef _HBMK_LIB_HINTS_
/* Run failed linker command again to
analyze its output and present hints */
IF ! hbmk[ _HBMK_lQuiet ] .AND. ! hbmk[ _HBMK_lIGNOREERROR ]
hb_processRun( cCommand,, @cStdOut, @cStdErr )
AdviseMissingLibs( hbmk, cStdOut + hb_eol() + cStdErr )
IF ! hbmk[ _HBMK_lQuiet ]
AdviseMissingLibs( hbmk, cStdOutErr )
ENDIF
#endif
ENDIF
IF ! Empty( cScriptFile )
@@ -12249,7 +12239,34 @@ STATIC FUNCTION Apple_App_Template_Info_plist()
</plist>
#pragma __endtext
#ifdef _HBMK_LIB_HINTS_
STATIC FUNCTION hbmk_hb_processRunCatch( cCommand, /* @ */ cStdOutErr )
LOCAL hProc
LOCAL hOutErr
LOCAL cData
LOCAL cChunk
LOCAL nLen
LOCAL nErrorLevel
cStdOutErr := ""
IF ( hProc := hb_processOpen( cCommand,, @hOutErr, @hOutErr ) ) != F_ERROR
cData := Space( 1024 )
DO WHILE ( nLen := FRead( hOutErr, @cData, hb_BLen( cData ) ) ) > 0
OutStd( cChunk := hb_BLeft( cData, nLen ) )
cStdOutErr += cChunk
ENDDO
nErrorLevel := hb_processValue( hProc )
FClose( hOutErr )
ELSE
nErrorLevel := -999
ENDIF
RETURN nErrorLevel
STATIC PROCEDURE AdviseMissingLibs( hbmk, cOutput )
@@ -12407,8 +12424,6 @@ STATIC FUNCTION GetListOfFunctionsKnownLoadHBX( cFileName, cRoot, hAll )
RETURN aDynamic
#endif
STATIC FUNCTION mk_extern( hbmk, cInputName, cBin_LibHBX, cOpt_LibHBX, cLibHBX_Regex, cOutputName )
LOCAL aExtern