2009-06-23 11:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/bin/hb-func.sh
  * harbour/utils/hbmk2/hbmk2.prg
    * updated automatic first function detection to decode non symbol
      characters in C function names
This commit is contained in:
Przemyslaw Czerpak
2009-06-23 09:56:44 +00:00
parent da656fbc14
commit f604930a1e
3 changed files with 36 additions and 4 deletions

View File

@@ -17,6 +17,12 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-23 11:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-func.sh
* harbour/utils/hbmk2/hbmk2.prg
* updated automatic first function detection to decode non symbol
characters in C function names
2009-06-23 10:57 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* examples/hboleold/hboleold.hbp
+ examples/hboleold/tests/hbmk.hbm

View File

@@ -673,6 +673,9 @@ hb_lnk_request()
echo " hb_gt_szNameDefault = \\"\$gt\\";"
fi
if [ -n "\${HB_MAIN_FUNC}" ]; then
if [ \${HB_MAIN_FUNC} != \${HB_MAIN_FUNC/x/y} ]; then
HB_MAIN_FUNC=\`echo "\${HB_MAIN_FUNC}"|sed -e 's/x\\(..\\)/\\\\\\\\x\\1" "/'\`
fi
echo " hb_vmSetLinkedMain( \\"\${HB_MAIN_FUNC}\\" );"
fi
echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )"

View File

@@ -3251,6 +3251,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 )
'' + hb_osNewLine() +;
'#include "hbapi.h"' + hb_osNewLine() )
IF ! Empty( array )
AEval( array, {|tmp, i| array[ i ] := FuncNameEncode( tmp ) } )
FWrite( fhnd, '' + hb_osNewLine() )
AEval( array, {|tmp| FWrite( fhnd, 'HB_FUNC_EXTERN( ' + tmp + ' );' + hb_osNewLine() ) } )
FWrite( fhnd, '' + hb_osNewLine() )
@@ -5475,10 +5476,10 @@ STATIC FUNCTION TimeElapsed( nStartSec, nEndSec )
RETURN Round( ( nEndSec - iif( nEndSec < nStartSec, nStartSec - 86399, nStartSec ) ), 1 )
STATIC FUNCTION IsValidHarbourID( cName )
LOCAL tmp
LOCAL c
IF HB_ISFIRSTIDCHAR( Left( cName, 1 ) )
FOR tmp := 2 TO Len( cName )
IF ! HB_ISNEXTIDCHAR( SubStr( cName, tmp, 1 ) )
FOR EACH c IN SubStr( cName, 2 )
IF ! HB_ISNEXTIDCHAR( c )
RETURN .F.
ENDIF
NEXT
@@ -5486,6 +5487,23 @@ STATIC FUNCTION IsValidHarbourID( cName )
ENDIF
RETURN .F.
STATIC FUNCTION FuncNameEncode( cName )
LOCAL cResult, c
cResult := ""
FOR EACH c IN cName
IF c == "_" .OR. IsAlpha( c ) .OR. ( ! cResult == "" .AND. IsDigit( c ) )
cResult += c
ELSE
cResult += "x" + Lower( HB_NumToHex( Asc( c ), 2 ) )
ENDIF
NEXT
RETURN cResult
STATIC FUNCTION IsHexDigit( c )
RETURN c $ "0123456789ABCDEFabcdef"
/* in GCC LD (except DJGPP) the order of registering init function
* does not depend directly on the order of linked files. If we want
* to inform HVM about valid startup function then we should try to
@@ -5514,7 +5532,12 @@ STATIC FUNCTION getFirstFunc( hbmk, cFile )
IF ( n := At( " T HB_FUN_", cFuncList ) ) != 0
n += 10
DO WHILE ( c := SubStr( cFuncList, n++, 1 ) ) == "_" .OR. ;
IsDigit( c ) .OR. IsAlpha( c )
IsDigit( c ) .OR. IsAlpha( c )
IF c == "x" .AND. IsHexDigit( SubStr( cFuncList, n, 1 ) ) .AND. ;
IsHexDigit( SubStr( cFuncList, n + 1, 1 ) )
c := HB_HexToNum( SubStr( cFuncList, n, 2 ) )
n += 2
ENDIF
cFuncName += c
ENDDO
ENDIF