2012-12-01 12:17 UTC+0100 Viktor Szakats (harbour syenar.net)

* utils/hbmk2/hbmk2.prg
    + automatically define HBMK_HAS_<packagename> macro
      if a given package is linked or loaded when running
      as script. F.e. HBMK_HAS_HBGD. The macro will have
      the value zero if there is no version information
      about the package and it will be 0x010203 if there
      is, via .hbc version=x[.y[.z]] directive.

  * extras/httpsrv/modules/showcounter.prg
  * extras/httpsrv/modulesg.hbp
  * extras/httpsrv/uhttpd.prg
  * extras/httpsrv/uhttpdgd.hbp
    + use HBMK_HAS_* macro instead of manually rolled solution
This commit is contained in:
Viktor Szakats
2012-12-01 11:20:35 +00:00
parent dc75ee5604
commit bf2a4516c2
6 changed files with 55 additions and 18 deletions

View File

@@ -10,6 +10,21 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2012-12-01 12:17 UTC+0100 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/hbmk2.prg
+ automatically define HBMK_HAS_<packagename> macro
if a given package is linked or loaded when running
as script. F.e. HBMK_HAS_HBGD. The macro will have
the value zero if there is no version information
about the package and it will be 0x010203 if there
is, via .hbc version=x[.y[.z]] directive.
* extras/httpsrv/modules/showcounter.prg
* extras/httpsrv/modulesg.hbp
* extras/httpsrv/uhttpd.prg
* extras/httpsrv/uhttpdgd.hbp
+ use HBMK_HAS_* macro instead of manually rolled solution
2012-11-30 17:30 UTC+0100 Viktor Szakats (harbour syenar.net)
* extras/hbusb/hbusb.hbc
* extras/hbusb/tests/hbmk.hbm

View File

@@ -50,13 +50,11 @@
*
*/
#if defined( GD_SUPPORT )
#if defined( HBMK_HAS_HBGD )
MEMVAR _SERVER // defined in uHTTPD
MEMVAR _REQUEST // defined in uHTTPD
#include "gd.ch"
#define IMAGES_IN ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "contrib" + hb_ps() + "hbgd" + hb_ps() + "tests" + hb_ps() + "digits" + hb_ps()
#define IMAGES_OUT ( _SERVER[ "DOCUMENT_ROOT" ] + hb_ps() + "counter" + hb_ps() )

View File

@@ -3,4 +3,5 @@
#
@modules.hbp
hbgd.hbc -DGD_SUPPORT
hbgd.hbc

View File

@@ -94,7 +94,7 @@ REQUEST __HB_EXTERN__
#include "hbsocket.ch"
#ifdef GD_SUPPORT
#if defined( HBMK_HAS_HBGD )
// adding GD support
REQUEST GDIMAGE, GDIMAGECHAR, GDCHART
# define APP_GD_SUPPORT "_GD"

View File

@@ -4,4 +4,4 @@
@uhttpd.hbp
hbgd.hbc -DGD_SUPPORT
hbgd.hbc

View File

@@ -261,6 +261,7 @@ EXTERNAL hbmk_KEYW
#define _HBMK_WITH_TPL "HBMK_WITH_%1$s"
#define _HBMK_HAS_TPL "HBMK_HAS_%1$s"
#define _HBMK_HAS_TPL_LOCAL "HBMK_HAS_%1$s_LOCAL"
#define _HBMK_HAS_TPL_HBC "HBMK_HAS_%1$s"
#define _HBMK_DIR_TPL "HBMK_DIR_%1$s"
#define _HBMK_PLUGIN "__HBSCRIPT__HBMK_PLUGIN"
#define _HBMK_SHELL "__HBSCRIPT__HBSHELL"
@@ -3232,7 +3233,7 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
cParam := tmp1 := MacroProc( hbmk, cParam, aParam[ _PAR_cFileName ] )
cParam := PathMakeAbsolute( PathSepToSelf( cParam ), aParam[ _PAR_cFileName ] )
IF ! Empty( cParam )
IF ! HBC_Find( hbmk, cParam )
IF Empty( HBC_Find( hbmk, cParam ) )
IF Empty( aParam[ _PAR_cFileName ] )
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Cannot find %1$s" ), tmp1 ) )
ELSE
@@ -5434,7 +5435,7 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel )
ELSE
_hbmk_OutStd( hbmk, hb_StrFormat( I_( "Triggered by '%1$s' header: %2$s" ), cParam:__enumKey(), cParam ) )
ENDIF
IF ! HBC_Find( hbmk, cParam )
IF Empty( HBC_Find( hbmk, cParam ) )
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Cannot find %1$s" ), cParam ) )
ENDIF
ENDIF
@@ -9772,10 +9773,10 @@ STATIC FUNCTION HBC_Find( hbmk, cFile, nNesting )
ENDIF
IF lFound
HBC_ProcessOne( hbmk, hb_PathNormalize( cFile ), nNesting )
RETURN HBC_ProcessOne( hbmk, hb_PathNormalize( cFile ), nNesting )
ENDIF
RETURN lFound
RETURN ""
STATIC FUNCTION AutoConfPathList()
@@ -9816,15 +9817,20 @@ STATIC FUNCTION HBC_ProcessOne( hbmk, cFileName, nNestingLevel )
LOCAL lFound
LOCAL tmp, tmp1
LOCAL nVersion
LOCAL cVersion
IF hbmk[ _HBMK_lInfo ]
_hbmk_OutStd( hbmk, hb_StrFormat( I_( "Processing: %1$s" ), cFileName ) )
ENDIF
IF ! hbmk_hb_FileExists( cFileName )
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Opening: %1$s" ), cFileName ) )
RETURN .F.
RETURN ""
ENDIF
nVersion := 0
AAddNew( hbmk[ _HBMK_aDEPTHBC ], { cFileName, nNestingLevel - 1 } )
cFile := hbmk_MemoRead( cFileName ) /* NOTE: Intentionally using hbmk_MemoRead() which handles EOF char. */
@@ -9942,7 +9948,7 @@ STATIC FUNCTION HBC_ProcessOne( hbmk, cFileName, nNestingLevel )
IF hb_FNameExt( cItem ) == ".hbc"
cItem := PathMakeAbsolute( PathSepToSelf( cItem ), hb_FNameDir( cFileName ) )
IF nNestingLevel < _HBMK_NEST_MAX
IF ! HBC_Find( hbmk, cItem, nNestingLevel + 1 )
IF Empty( HBC_Find( hbmk, cItem, nNestingLevel + 1 ) )
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Cannot find %1$s (referenced from %2$s)" ), tmp1, cFileName ) )
ENDIF
ELSE
@@ -9995,7 +10001,7 @@ STATIC FUNCTION HBC_ProcessOne( hbmk, cFileName, nNestingLevel )
cItem := hb_FNameExtSet( cItem, ".hbc" )
ENDIF
IF ! HBC_Find( hbmk, cItem, nNestingLevel + 1 )
IF Empty( HBC_Find( hbmk, cItem, nNestingLevel + 1 ) )
_hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Cannot find %1$s (referenced from %2$s)" ), tmp1, cFileName ) )
ENDIF
ELSE
@@ -10403,7 +10409,17 @@ STATIC FUNCTION HBC_ProcessOne( hbmk, cFileName, nNestingLevel )
CASE Lower( Left( cLine, Len( "version=" ) ) ) == "version=" ; cLine := SubStr( cLine, Len( "version=" ) + 1 )
/* Silently ignore */
/* x.y.z where x,y,z >= 0 <= 255 */
nVersion := 0
FOR EACH tmp IN ASize( hb_ATokens( cLine, "." ), 3 )
IF tmp != NIL
nVersion += Val( tmp )
ENDIF
IF tmp:__enumIndex() > 2
EXIT
ENDIF
nVersion *= 256
NEXT
CASE Lower( Left( cLine, Len( "keywords=" ) ) ) == "keywords=" ; cLine := SubStr( cLine, Len( "keywords=" ) + 1 )
@@ -10420,7 +10436,11 @@ STATIC FUNCTION HBC_ProcessOne( hbmk, cFileName, nNestingLevel )
ENDCASE
NEXT
RETURN .T.
cVersion := "0x" + hb_NumToHex( nVersion, 6 )
AAdd( hbmk[ _HBMK_aOPTPRG ], "-D" + hb_StrFormat( _HBMK_HAS_TPL_HBC, StrToDefine( hb_FNameName( cFileName ) ) ) + "=" + cVersion )
RETURN cVersion
STATIC FUNCTION IsGTRequested( hbmk, cWhichGT )
@@ -12811,6 +12831,7 @@ STATIC PROCEDURE __hbshell( cFile, ... )
LOCAL l_cHB_INSTALL_PREFIX
LOCAL aOPTPRG
LOCAL hHRB
LOCAL cVersion
s_cDirBase_hbshell := hb_DirBase()
s_cProgName_hbshell := hb_ProgName()
@@ -12890,14 +12911,16 @@ STATIC PROCEDURE __hbshell( cFile, ... )
/* NOTE: - most filters and macros in .hbc files won't work in this mode */
aOPTPRG := {}
FOR EACH tmp IN aExtension
IF ! HBC_Find( hbmk, cHBC := hb_FNameExtSet( tmp, ".hbc" ) )
IF Empty( cVersion := HBC_Find( hbmk, cHBC := hb_FNameExtSet( tmp, ".hbc" ) ) )
OutErr( hb_StrFormat( I_( "Warning: Cannot find %1$s" ), cHBC ) + _OUT_EOL )
ELSE
AAdd( aOPTPRG, "-D" + hb_StrFormat( _HBMK_HAS_TPL_HBC, StrToDefine( tmp ) ) + "=" + cVersion )
ENDIF
NEXT
aOPTPRG := {}
FOR EACH tmp IN hbmk[ _HBMK_aINCPATH ]
AAdd( aOPTPRG, "-I" + tmp )
NEXT