2012-12-04 00:51 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbrun/hbrun.hbp
* utils/hbmk2/hbmk2.prg
+ loading packages using ext.load, hbshell_ext_load(),
'hb_ext.ini'/'hb_extension' config files and HB_EXTENSION
envvar will now automatically load the packages'
standard headers and will properly set HBMK_HAS_* macros,
just like when running scripts or using .hbc files.
+ do not statically link contribs to hbrun when hbrun
is built dynamically. Instead, load default contribs
dynamically on startup (yes, performance will be worse.
If you don't like this, see 2012-12-03 15:17 UTC+0100).
This way these loaded packages will behave exactly the
same as any other dynamically loaded packages, f.e.
standard headers will be loaded and usable.
+ hbshell_include()/hbshell_uninclude() will now
load/unload core headers available in dot prompt.
+ 'hb.ch' core header is now loaded for scripts and dot
prompt by default. It means that K_ESC will now
return 27 and hb_gtInfo( HB_GTI_VERSION ) will work
as well, just like many other commonly used constants.
For a precise list, see the content of include/hb.ch.
If you don't like it, unload it from hbstart.hb using
hbshell_uninclude( "hb.ch" )
% use embedded headers when using the dot prompt.
* contrib/hbsms/sms.prg
* commented code cleanup
This commit is contained in:
@@ -10,6 +10,35 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2012-12-04 00:51 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbrun/hbrun.hbp
|
||||
* utils/hbmk2/hbmk2.prg
|
||||
+ loading packages using ext.load, hbshell_ext_load(),
|
||||
'hb_ext.ini'/'hb_extension' config files and HB_EXTENSION
|
||||
envvar will now automatically load the packages'
|
||||
standard headers and will properly set HBMK_HAS_* macros,
|
||||
just like when running scripts or using .hbc files.
|
||||
+ do not statically link contribs to hbrun when hbrun
|
||||
is built dynamically. Instead, load default contribs
|
||||
dynamically on startup (yes, performance will be worse.
|
||||
If you don't like this, see 2012-12-03 15:17 UTC+0100).
|
||||
This way these loaded packages will behave exactly the
|
||||
same as any other dynamically loaded packages, f.e.
|
||||
standard headers will be loaded and usable.
|
||||
+ hbshell_include()/hbshell_uninclude() will now
|
||||
load/unload core headers available in dot prompt.
|
||||
+ 'hb.ch' core header is now loaded for scripts and dot
|
||||
prompt by default. It means that K_ESC will now
|
||||
return 27 and hb_gtInfo( HB_GTI_VERSION ) will work
|
||||
as well, just like many other commonly used constants.
|
||||
For a precise list, see the content of include/hb.ch.
|
||||
If you don't like it, unload it from hbstart.hb using
|
||||
hbshell_uninclude( "hb.ch" )
|
||||
% use embedded headers when using the dot prompt.
|
||||
|
||||
* contrib/hbsms/sms.prg
|
||||
* commented code cleanup
|
||||
|
||||
2012-12-03 16:37 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
+ contrib/hbgt/tests/hbmk.hbm
|
||||
+ missing autohbm file
|
||||
|
||||
@@ -6,21 +6,24 @@
|
||||
|
||||
-o${hb_name}
|
||||
|
||||
# Build in shared mode for these platforms because
|
||||
# it's required for dynamic extension loading. (only
|
||||
# do that if HB_BUILD_CONTRIB_DYN is enabled, so there
|
||||
# are actual dynamic extensions to load.)
|
||||
{_HB_BUILD_&(!(HB_BUILD_DYN='no')&!(HB_BUILD_CONTRIB_DYN='no')&(win|wce|os2))}-shared
|
||||
|
||||
-DHBMK_WITH_ALL_EMBEDDED_HEADERS
|
||||
|
||||
-DHBMK_WITH_GTXWC{HBMK_WITH_GTXWC='yes'}
|
||||
-gtxwc{HBMK_WITH_GTXWC='yes'}
|
||||
|
||||
hbct.hbc -request=__HBEXTERN__HBCT__
|
||||
hbexpat.hbc -request=__HBEXTERN__HBEXPAT__
|
||||
hbmemio.hbc -request=__HBEXTERN__HBMEMIO__
|
||||
hbmzip.hbc -request=__HBEXTERN__HBMZIP__
|
||||
hbnetio.hbc -request=__HBEXTERN__HBNETIO__
|
||||
hbunix.hbc{unix} -request=__HBEXTERN__HBUNIX__{unix}
|
||||
hbwin.hbc{allwin} -request=__HBEXTERN__HBWIN__{allwin}
|
||||
# Build in shared mode for these platforms because
|
||||
# it's required for dynamic extension loading. (only
|
||||
# do that if HB_BUILD_CONTRIB_DYN is enabled, so there
|
||||
# are actual dynamic extensions to load.)
|
||||
{_HB_BUILD_&(!(HB_BUILD_DYN='no')&!(HB_BUILD_CONTRIB_DYN='no')&(win|wce|os2))}-env:__HBMKDYN=yes
|
||||
|
||||
{__HBMKDYN='yes'}-shared
|
||||
{__HBMKDYN='yes'}-DHBMK_WITH_EXTS=hbct|hbexpat|hbmemio|hbmzip|hbnetio|hbunix|hbunix|hbwin
|
||||
|
||||
{!(__HBMKDYN='yes')}hbct.hbc {!(__HBMKDYN='yes')}-request=__HBEXTERN__HBCT__
|
||||
{!(__HBMKDYN='yes')}hbexpat.hbc {!(__HBMKDYN='yes')}-request=__HBEXTERN__HBEXPAT__
|
||||
{!(__HBMKDYN='yes')}hbmemio.hbc {!(__HBMKDYN='yes')}-request=__HBEXTERN__HBMEMIO__
|
||||
{!(__HBMKDYN='yes')}hbmzip.hbc {!(__HBMKDYN='yes')}-request=__HBEXTERN__HBMZIP__
|
||||
{!(__HBMKDYN='yes')}hbnetio.hbc {!(__HBMKDYN='yes')}-request=__HBEXTERN__HBNETIO__
|
||||
{!(__HBMKDYN='yes')&unix}hbunix.hbc {!(__HBMKDYN='yes')&unix}-request=__HBEXTERN__HBUNIX__
|
||||
{!(__HBMKDYN='yes')&allwin}hbwin.hbc {!(__HBMKDYN='yes')&allwin}-request=__HBEXTERN__HBWIN__
|
||||
|
||||
@@ -257,10 +257,10 @@ FUNCTION smsctx_PIN( smsctx, cPIN )
|
||||
|
||||
RETURN cOldValue
|
||||
|
||||
/*
|
||||
#if 0
|
||||
STATIC FUNCTION StripCR( cString )
|
||||
RETURN StrTran( cString, Chr( 13 ) )
|
||||
*/
|
||||
#endif
|
||||
|
||||
STATIC FUNCTION StripCRLF( cString )
|
||||
RETURN StrTran( cString, Chr( 13 ) + Chr( 10 ) )
|
||||
|
||||
@@ -571,6 +571,11 @@ EXTERNAL hb_FSetAttr
|
||||
STATIC s_cDirBase_hbshell
|
||||
STATIC s_cProgName_hbshell
|
||||
STATIC s_hLibExt := { => }
|
||||
STATIC s_hCH := { => }
|
||||
STATIC s_hOPTPRG := { => }
|
||||
STATIC s_hINCPATH := { => }
|
||||
STATIC s_hCHCORE := { => }
|
||||
STATIC s_hbmk
|
||||
|
||||
#define HB_HISTORY_LEN 500
|
||||
#define HB_LINE_LEN 256
|
||||
@@ -12842,7 +12847,7 @@ STATIC PROCEDURE __hbshell( cFile, ... )
|
||||
|
||||
/* Detect Harbour dir layout */
|
||||
|
||||
hbmk := hbmk_new()
|
||||
hbmk := s_hbmk := hbmk_new()
|
||||
hbmk_init_stage2( hbmk )
|
||||
IF ! hbmk_harbour_dirlayout_detect( hbmk, @l_cHB_INSTALL_PREFIX, .T. )
|
||||
IF hb_Version( HB_VERSION_SHARED )
|
||||
@@ -12862,9 +12867,19 @@ STATIC PROCEDURE __hbshell( cFile, ... )
|
||||
'#require' keyword in script source, rendering these scripts
|
||||
non-portable. */
|
||||
|
||||
#if defined( HBMK_WITH_EXTS )
|
||||
#translate _HBMK_STRINGIFY( <x> ) => <"x">
|
||||
FOR EACH tmp IN hb_ATokens( _HBMK_STRINGIFY( HBMK_WITH_EXTS ), "|" )
|
||||
AAdd( aExtension, tmp )
|
||||
NEXT
|
||||
#endif
|
||||
__hbshell_LoadExtFromFile( aExtension, __hbshell_ConfigDir() + _EXT_FILE_ )
|
||||
__hbshell_LoadExtFromString( aExtension, GetEnv( _EXT_ENV_ ) )
|
||||
|
||||
/* Load default core headers for scripts and dot prompt */
|
||||
|
||||
hbshell_include( "hb.ch" )
|
||||
|
||||
/* Do the thing */
|
||||
|
||||
IF ! Empty( cFile )
|
||||
@@ -12909,7 +12924,7 @@ STATIC PROCEDURE __hbshell( cFile, ... )
|
||||
path list. For this we need to know where Harbour tree
|
||||
is located. */
|
||||
|
||||
/* NOTE: - most filters and macros in .hbc files won't work in this mode */
|
||||
/* NOTE: Most filters and macros in .hbc files won't work in this mode */
|
||||
|
||||
aOPTPRG := {}
|
||||
|
||||
@@ -12922,7 +12937,7 @@ STATIC PROCEDURE __hbshell( cFile, ... )
|
||||
NEXT
|
||||
|
||||
FOR EACH tmp IN hbmk[ _HBMK_aINCPATH ]
|
||||
AAdd( aOPTPRG, "-I" + tmp )
|
||||
AAdd( aOPTPRG, "-i" + tmp )
|
||||
NEXT
|
||||
|
||||
FOR EACH tmp IN hbmk[ _HBMK_aCH ]
|
||||
@@ -13087,9 +13102,28 @@ FUNCTION hbshell_ext_load( cName )
|
||||
LOCAL hLib
|
||||
LOCAL tmp
|
||||
|
||||
LOCAL cHBC
|
||||
LOCAL cVersion
|
||||
|
||||
IF ! Empty( cName )
|
||||
IF hb_Version( HB_VERSION_SHARED )
|
||||
IF !( cName $ s_hLibExt )
|
||||
|
||||
s_hbmk[ _HBMK_aINCPATH ] := {}
|
||||
s_hbmk[ _HBMK_aCH ] := {}
|
||||
|
||||
s_hINCPATH[ cName ] := {}
|
||||
s_hCH[ cName ] := {}
|
||||
s_hOPTPRG[ cName ] := {}
|
||||
|
||||
IF Empty( cVersion := HBC_Find( s_hbmk, cHBC := hb_FNameExtSet( cName, ".hbc" ) ) )
|
||||
OutErr( hb_StrFormat( I_( "Warning: Cannot find %1$s" ), cHBC ) + _OUT_EOL )
|
||||
ELSE
|
||||
AEval( s_hbmk[ _HBMK_aINCPATH ], {| tmp | AAdd( s_hINCPATH[ cName ], tmp ) } )
|
||||
AEval( s_hbmk[ _HBMK_aCH ], {| tmp | AAdd( s_hCH[ cName ], tmp ) } )
|
||||
AAddNew( s_hOPTPRG[ cName ], "-D" + hb_StrFormat( _HBMK_HAS_TPL_HBC, StrToDefine( cName ) ) + "=" + cVersion )
|
||||
ENDIF
|
||||
|
||||
cFileName := FindInPath( tmp := hb_libName( cName + hb_libPostfix() ), ;
|
||||
iif( hb_Version( HB_VERSION_UNIX_COMPAT ), GetEnv( "LD_LIBRARY_PATH" ), GetEnv( "PATH" ) ) )
|
||||
IF Empty( cFileName )
|
||||
@@ -13114,6 +13148,9 @@ FUNCTION hbshell_ext_load( cName )
|
||||
FUNCTION hbshell_ext_unload( cName )
|
||||
|
||||
IF cName $ s_hLibExt .AND. s_hLibExt[ cName ] != NIL
|
||||
hb_HDel( s_hINCPATH, cName )
|
||||
hb_HDel( s_hCH, cName )
|
||||
hb_HDel( s_hOPTPRG, cName )
|
||||
hb_HDel( s_hLibExt, cName )
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
@@ -13612,6 +13649,19 @@ STATIC PROCEDURE __hbshell_Err( oErr, cCommand )
|
||||
STATIC PROCEDURE __hbshell_Exec( cCommand )
|
||||
|
||||
LOCAL pHRB, cHRB, cFunc, bBlock, nRowMin
|
||||
LOCAL aOPTPRG := {}
|
||||
|
||||
IF ! Empty( s_hCHCORE )
|
||||
AAdd( aOPTPRG, "-i" + s_hbmk[ _HBMK_cHB_INSTALL_INC ] )
|
||||
hb_HEval( s_hCHCORE, {| tmp | AAdd( aOPTPRG, "-u+" + tmp ) } )
|
||||
ENDIF
|
||||
|
||||
hb_HEval( s_hINCPATH, {| cExt |
|
||||
AEval( s_hINCPATH[ cExt ], {| tmp | AAdd( aOPTPRG, "-i" + tmp ) } )
|
||||
AEval( s_hCH[ cExt ] , {| tmp | AAdd( aOPTPRG, "-u+" + tmp ) } )
|
||||
AEval( s_hOPTPRG[ cExt ] , {| tmp | AAdd( aOPTPRG, tmp ) } )
|
||||
RETURN NIL
|
||||
} )
|
||||
|
||||
cFunc := "STATIC FUNCTION __HBDOT()" + hb_eol() +;
|
||||
"RETURN {||" + hb_eol() +;
|
||||
@@ -13624,7 +13674,7 @@ STATIC PROCEDURE __hbshell_Exec( cCommand )
|
||||
BEGIN SEQUENCE WITH {| oErr | __hbshell_Err( oErr, cCommand ) }
|
||||
|
||||
/* We can use this function as this is a GPL licenced application */
|
||||
cHRB := hb_compileFromBuf( cFunc, hb_ProgName(), "-n2", "-q2" )
|
||||
cHRB := hb_compileFromBuf( cFunc, hbmk_CoreHeaderFiles(), hb_ProgName(), "-n2", "-q2", hb_ArrayToParams( aOPTPRG ) )
|
||||
IF Empty( cHRB )
|
||||
Eval( ErrorBlock(), I_( "Syntax error." ) )
|
||||
ELSE
|
||||
@@ -13852,6 +13902,46 @@ STATIC FUNCTION __hbshell_detect_GT( hHRB )
|
||||
modules, which could be queried and loaded. Shell prompt could
|
||||
support #require as well. */
|
||||
|
||||
/* Check if a header is a valid core one */
|
||||
STATIC FUNCTION __hbshell_TryHeader( cName )
|
||||
|
||||
LOCAL lRetVal := .F.
|
||||
|
||||
BEGIN SEQUENCE WITH {| oErr | Break( oErr ) }
|
||||
|
||||
IF ! Empty( hb_compileFromBuf( "", hbmk_CoreHeaderFiles(), hb_ProgName(), "-q2", ;
|
||||
"-i" + s_hbmk[ _HBMK_cHB_INSTALL_INC ], ;
|
||||
"-u+" + cName ) )
|
||||
lRetVal := .T.
|
||||
ENDIF
|
||||
|
||||
END /* SEQUENCE */
|
||||
|
||||
RETURN lRetVal
|
||||
|
||||
/* Public hbshell API usable in dot prompt and startup script */
|
||||
FUNCTION hbshell_include( cName )
|
||||
|
||||
cName := Lower( cName )
|
||||
|
||||
IF !( cName $ s_hCHCORE ) .AND. __hbshell_TryHeader( cName )
|
||||
s_hCHCORE[ cName ] := NIL
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
|
||||
RETURN .F.
|
||||
|
||||
FUNCTION hbshell_uninclude( cName )
|
||||
|
||||
cName := Lower( cName )
|
||||
|
||||
IF cName $ s_hCHCORE
|
||||
hb_HDel( s_hCHCORE, cName )
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
|
||||
RETURN .F.
|
||||
|
||||
/* Public hbshell API */
|
||||
FUNCTION hbshell_DirBase()
|
||||
RETURN s_cDirBase_hbshell
|
||||
|
||||
Reference in New Issue
Block a user