2012-06-13 15:14 UTC+0200 Viktor Szakats (harbour syenar.net)
* INSTALL
* minor clarifications to INSTALL/TROUBLESHOOTING
* config/os2/watcom.mk
* config/wce/mingwarm.mk
* config/wce/msvcarm.mk
* config/wce/poccarm.mk
* config/win/bcc.mk
* config/win/mingw.mk
* config/win/msvc.mk
* config/win/pocc.mk
* config/win/watcom.mk
* config/win/xcc.mk
+ added std header paths to RC commands
* utils/hbmk2/Makefile
+ utils/hbmk2/hbmk2.rc
* utils/hbmk2/hbmk2.hbp
+ added std windows versioninfo and manifest to hbmk2
* utils/hbmk2/hbmk2.prg
+ utils/hbmk2/p_extdyn.hb
+ added almost complete hbrun functionality into hbmk2
to run it, type: 'hbmk2 .'
Missing is extension registration, plugins don't seem
to work yet, and I plan to switch from full screen
prompt to shell-like prompt. Plugin paths, extension
configuration, history on-disk files need further
polishing.
+ hbmk2 will act as a hbrun, if renamed to hbrun
* contrib/hbqt/qtcore/hbqt_misc.prg
+ added two TOFIXes for missing PROTECTED keyword
for two object variables of unknown purpose. Not
even HBQT developers know what it is, but without
it, HBQT breaks.
; Those who need "stable" hbqt (meaning "it builds")
Go to:
http://sourceforge.net/p/hbqt/
This commit is contained in:
@@ -16,6 +16,48 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-13 15:14 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* INSTALL
|
||||
* minor clarifications to INSTALL/TROUBLESHOOTING
|
||||
|
||||
* config/os2/watcom.mk
|
||||
* config/wce/mingwarm.mk
|
||||
* config/wce/msvcarm.mk
|
||||
* config/wce/poccarm.mk
|
||||
* config/win/bcc.mk
|
||||
* config/win/mingw.mk
|
||||
* config/win/msvc.mk
|
||||
* config/win/pocc.mk
|
||||
* config/win/watcom.mk
|
||||
* config/win/xcc.mk
|
||||
+ added std header paths to RC commands
|
||||
|
||||
* utils/hbmk2/Makefile
|
||||
+ utils/hbmk2/hbmk2.rc
|
||||
* utils/hbmk2/hbmk2.hbp
|
||||
+ added std windows versioninfo and manifest to hbmk2
|
||||
|
||||
* utils/hbmk2/hbmk2.prg
|
||||
+ utils/hbmk2/p_extdyn.hb
|
||||
+ added almost complete hbrun functionality into hbmk2
|
||||
to run it, type: 'hbmk2 .'
|
||||
Missing is extension registration, plugins don't seem
|
||||
to work yet, and I plan to switch from full screen
|
||||
prompt to shell-like prompt. Plugin paths, extension
|
||||
configuration, history on-disk files need further
|
||||
polishing.
|
||||
+ hbmk2 will act as a hbrun, if renamed to hbrun
|
||||
|
||||
* contrib/hbqt/qtcore/hbqt_misc.prg
|
||||
+ added two TOFIXes for missing PROTECTED keyword
|
||||
for two object variables of unknown purpose. Not
|
||||
even HBQT developers know what it is, but without
|
||||
it, HBQT breaks.
|
||||
|
||||
; Those who need "stable" hbqt (meaning "it builds")
|
||||
Go to:
|
||||
http://sourceforge.net/p/hbqt/
|
||||
|
||||
2012-06-13 15:17 UTC+0200 Francesco Perillo (fperillo at gmail.com)
|
||||
* Changelog
|
||||
* typo and missing description previous commit
|
||||
@@ -37,7 +79,7 @@
|
||||
- eliminated remmed code
|
||||
* contrib/hbqt/qtcore/hbqt_misc.prg
|
||||
* reverted last commit
|
||||
|
||||
|
||||
2012-06-13 12:34 UTC+0200 Viktor Szakats (vszakats syenar.net)
|
||||
* contrib/hbqt/qtcore/hbqt_bind.cpp
|
||||
! using core constant instead of arbirary buffer size
|
||||
|
||||
@@ -1292,8 +1292,8 @@ HARBOUR
|
||||
7. Remove any Harbour build settings documented in OPTIONS AVAILABLE WHEN
|
||||
BUILDING HARBOUR section.
|
||||
8. Try to do no or only small modifications at once to command examples
|
||||
included in this document. If it doesn't work, fall back to documented
|
||||
examples as is.
|
||||
included in EXAMPLES section of this document. If it doesn't work,
|
||||
fall back to documented examples _as is_.
|
||||
9. If everything fails and you are to report a problem to Harbour developers,
|
||||
make sure to include your OS version/language/CPU architecture,
|
||||
Harbour revision, C compiler name/release and version, environment
|
||||
@@ -1310,14 +1310,14 @@ HARBOUR
|
||||
10. Do not alter the directory layout and files in Harbour and 3rd party
|
||||
packages.
|
||||
11. If you are to report a build problem with a Harbour application,
|
||||
most of the above points apply, plus make sure to use '-trace'
|
||||
all of the above points apply, plus make sure to use '-trace'
|
||||
command line option when running hbmk2 and redirect the result to
|
||||
a file (see above how).
|
||||
It's a good idea to first remove all manual references to Harbour
|
||||
core components from make files and custom environment. F.e. it's
|
||||
It's good idea to first remove all manual references to Harbour
|
||||
core components from makefiles and custom environment. F.e. it's
|
||||
commom mistake to add C compiler header and/or lib dirs, Harbour core
|
||||
header and/or lib dirs, built-in constants to make files or environment.
|
||||
No such thing is necessary and all of these is automatically handled
|
||||
header and/or lib dirs, built-in constants to makefiles or environment.
|
||||
No such thing is necessary and all of these are automatically handled
|
||||
by hbmk2. IOW start simple and don't be overbusy with "fine-tuning"
|
||||
your configuration. If you need to, the problem is most probably
|
||||
elsewhere. It's also good idea to try with Harbour nightly binary or
|
||||
|
||||
@@ -62,7 +62,7 @@ endif
|
||||
|
||||
RC := wrc
|
||||
RC_OUT := -fo=
|
||||
RCFLAGS += -q -r -zm -bt=os2
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC) -q -r -zm -bt=os2
|
||||
|
||||
LD := wlink
|
||||
ifeq ($(HB_BUILD_DEBUG),yes)
|
||||
|
||||
@@ -41,7 +41,7 @@ endif
|
||||
|
||||
RC := $(HB_CCPATH)$(HB_CCPREFIX)windres
|
||||
RC_OUT := -o$(subst x,x, )
|
||||
RCFLAGS += -O coff
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC) -O coff
|
||||
|
||||
ifneq ($(filter $(HB_BUILD_STRIP),all lib),)
|
||||
ARSTRIP = && ${HB_CCPATH}${HB_CCPREFIX}strip -S $(LIB_DIR)/$@
|
||||
|
||||
@@ -82,6 +82,7 @@ endif
|
||||
|
||||
RC := rc.exe
|
||||
RC_OUT := -fo$(subst x,x, )
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC)
|
||||
ifeq ($(filter $(HB_COMPILER_VER),1200 1300 1310 1400 1500),)
|
||||
RCFLAGS += -nologo
|
||||
endif
|
||||
|
||||
@@ -38,6 +38,7 @@ endif
|
||||
|
||||
RC := porc.exe
|
||||
RC_OUT := -fo$(subst x,x, )
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC)
|
||||
|
||||
LD := polink.exe
|
||||
LD_OUT := -out:
|
||||
|
||||
@@ -60,6 +60,7 @@ endif
|
||||
|
||||
RC := brcc32.exe
|
||||
RC_OUT := -fo
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC)
|
||||
|
||||
LD := ilink32.exe
|
||||
LIBPATHS := $(foreach dir,$(LIB_DIR) $(3RDLIB_DIR),$(subst /,$(BACKSLASH),-L"$(dir)"))
|
||||
|
||||
@@ -84,7 +84,7 @@ endif
|
||||
|
||||
RC := $(HB_CCPATH)$(HB_CCPREFIX)windres
|
||||
RC_OUT := -o$(subst x,x, )
|
||||
RCFLAGS += -O coff
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC) -O coff
|
||||
|
||||
ifneq ($(filter $(HB_BUILD_STRIP),all lib),)
|
||||
ARSTRIP = && ${HB_CCPATH}${HB_CCPREFIX}strip -S $(LIB_DIR)/$@
|
||||
|
||||
@@ -63,6 +63,7 @@ endif
|
||||
|
||||
RC := rc.exe
|
||||
RC_OUT := -fo$(subst x,x, )
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC)
|
||||
# Windows SDK 7.0 also supports it, but we cannot detect it.
|
||||
ifeq ($(filter $(HB_COMPILER_VER),1200 1300 1310 1400 1500),)
|
||||
RCFLAGS += -nologo
|
||||
|
||||
@@ -37,6 +37,7 @@ endif
|
||||
|
||||
RC := porc.exe
|
||||
RC_OUT := -fo$(subst x,x, )
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC)
|
||||
|
||||
LD := polink.exe
|
||||
LD_OUT := -out:
|
||||
|
||||
@@ -56,7 +56,7 @@ endif
|
||||
|
||||
RC := wrc
|
||||
RC_OUT := -fo=
|
||||
RCFLAGS += -q -r -zm -bt=nt
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC) -q -r -zm -bt=nt
|
||||
|
||||
LD := wlink
|
||||
ifeq ($(HB_BUILD_DEBUG),yes)
|
||||
|
||||
@@ -41,6 +41,7 @@ endif
|
||||
|
||||
RC := xRC.exe
|
||||
RC_OUT := -fo$(subst x,x, )
|
||||
RCFLAGS += -I. -I$(HB_HOST_INC)
|
||||
|
||||
LD := xLink.exe
|
||||
LD_OUT := -out:
|
||||
|
||||
@@ -67,8 +67,8 @@ CREATE CLASS HbQtObjectHandler
|
||||
|
||||
VAR __hEvents PROTECTED INIT { => }
|
||||
|
||||
VAR __Slots
|
||||
VAR __Events
|
||||
VAR __Slots /* TOFIX: add PROTECTED or clean this mess */
|
||||
VAR __Events /* TOFIX: add PROTECTED or clean this mess */
|
||||
|
||||
METHOD connect( cnEvent, bBlock )
|
||||
METHOD disconnect( cnEvent )
|
||||
|
||||
@@ -9,6 +9,9 @@ include $(TOP)$(ROOT)config/global.mk
|
||||
PRG_SOURCES := \
|
||||
hbmk2.prg \
|
||||
|
||||
RC_SOURCES := \
|
||||
hbmk2.rc
|
||||
|
||||
PRG_MAIN := hbmk2.prg
|
||||
|
||||
LIBS = $(HB_LIBS_MT_NORDD)
|
||||
|
||||
@@ -15,4 +15,10 @@ hbmk2.%{hb_lng}.po
|
||||
-hbl=hbmk2.%{hb_lng}.hbl
|
||||
-lng=es_PE,hu_HU,pt_BR
|
||||
|
||||
# not using these together with .rc input, because some compilers (mingw)
|
||||
# do not support multiple .rc inputs
|
||||
#-icon={allwin}../../package/harb_win.ico
|
||||
#-icon={os2}../../package/harb_os2.ico
|
||||
hbmk2.rc
|
||||
|
||||
{!(HB_BUILD_DYN='no')&(win|wce|os2)}-shared
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://harbour-project.org
|
||||
*
|
||||
* Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
|
||||
* Copyright 2003-2007 Przemyslaw Czerpak <druzus@priv.onet.pl>
|
||||
* gcc and *nix configuration elements.
|
||||
* bash script with similar purpose for gcc family.
|
||||
* entry point override method and detection code for gcc.
|
||||
@@ -52,6 +52,7 @@
|
||||
* POTMerge(), LoadPOTFilesAsHash(), GenHBL() and AutoTrans().
|
||||
* (with local modifications by main author)
|
||||
* optimized header time scan algorithm
|
||||
* runner core logic
|
||||
*
|
||||
* See COPYING for licensing terms.
|
||||
*
|
||||
@@ -517,6 +518,14 @@ REQUEST hbmk_KEYW
|
||||
|
||||
#define PathMakeAbsolute( cPathR, cPathA ) hb_PathJoin( cPathA, cPathR )
|
||||
|
||||
/* NOTE: use hbextern library instead of #include "hbextern.ch"
|
||||
* in dynamic builds it will greatly reduce the size because
|
||||
* all function symbols will be registered by harbour shared
|
||||
* library (.dll, .so, .sl, .dyn, ...) not by this code
|
||||
*/
|
||||
|
||||
REQUEST __HB_EXTERN__ /* for runner and interactive shell */
|
||||
|
||||
/* Request some functions for plugins */
|
||||
REQUEST HBCLASS
|
||||
REQUEST __CLSLOCKDEF
|
||||
@@ -546,6 +555,15 @@ STATIC s_cDirBase_hbrun
|
||||
STATIC s_cProgName_hbrun
|
||||
STATIC s_hLibExtDyn := { => }
|
||||
|
||||
#define HB_HISTORY_LEN 500
|
||||
#define HB_LINE_LEN 256
|
||||
|
||||
STATIC s_nRow
|
||||
STATIC s_nCol := 0
|
||||
STATIC s_aHistory := {}
|
||||
STATIC s_lPreserveHistory := .T.
|
||||
STATIC s_lWasLoad := .F.
|
||||
|
||||
/* NOTE: Security token to protect against plugins accessing our
|
||||
internal structures referenced from context variable */
|
||||
STATIC s_cSecToken := NIL
|
||||
@@ -570,13 +588,11 @@ PROCEDURE _APPMAIN( ... )
|
||||
|
||||
/* Expand wildcard project specs */
|
||||
|
||||
IF PCount() >= 1
|
||||
tmp := Lower( hb_FNameExt( hb_PValue( 1 ) ) )
|
||||
IF tmp == ".hb" .OR. ;
|
||||
tmp == ".hrb"
|
||||
__hbrun_minimal( ... )
|
||||
QUIT
|
||||
ENDIF
|
||||
IF Lower( hb_FNameName( hb_argv( 0 ) ) ) == "hbrun" .OR. ;
|
||||
hb_PValue( 1 ) == "." .OR. ;
|
||||
"|" + Lower( hb_FNameExt( hb_PValue( 1 ) ) ) + "|" $ "|.hb|.hrb|"
|
||||
__hbrun_minimal( ... )
|
||||
QUIT
|
||||
ENDIF
|
||||
|
||||
aArgsProc := {}
|
||||
@@ -617,7 +633,7 @@ PROCEDURE _APPMAIN( ... )
|
||||
ENDIF
|
||||
|
||||
DO CASE
|
||||
CASE tmp == "harbour" ; hb_AIns( aArgsProc, 1, "-hbraw", .T. )
|
||||
CASE tmp == "harbour" ; hb_AIns( aArgsProc, 1, "-hbraw", .T. )
|
||||
CASE Right( tmp, 5 ) == "hbcmp" .OR. ;
|
||||
Left( tmp, 5 ) == "hbcmp" .OR. ;
|
||||
tmp == "clipper" ; hb_AIns( aArgsProc, 1, "-hbcmp", .T. )
|
||||
@@ -12046,7 +12062,7 @@ STATIC FUNCTION __hb_extern_gen( hbmk, aFuncList, cOutputName )
|
||||
|
||||
RETURN .F.
|
||||
|
||||
STATIC FUNCTION hbmk_CoreHeaderFilesMinimal()
|
||||
STATIC FUNCTION hbmk_CoreHeaderFiles()
|
||||
STATIC s_hHeaders := NIL
|
||||
|
||||
IF s_hHeaders == NIL
|
||||
@@ -12056,6 +12072,69 @@ STATIC FUNCTION hbmk_CoreHeaderFilesMinimal()
|
||||
#command ADD HEADER TO <hash> FILE <(cFile)> => ;
|
||||
#pragma __streaminclude <(cFile)> | <hash>\[ <(cFile)> \] := %s
|
||||
|
||||
#ifdef _HBMK_INCLUDE_ALL_CORE_HEADERS_
|
||||
ADD HEADER TO s_hHeaders FILE "achoice.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "assert.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "blob.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "box.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "button.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "color.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "common.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "dbedit.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "dbinfo.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "dbstruct.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "directry.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "error.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "fileio.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "getexit.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hb.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbclass.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbcom.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbdebug.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbdyn.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbextcdp.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbextern.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbextlng.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbgfx.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbgfxdef.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbgtinfo.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbhash.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbhrb.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbinkey.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hblang.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hblpp.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbmacro.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbmath.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbmemory.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbmemvar.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hboo.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbpers.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbsetup.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbsix.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbsocket.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbstdgen.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbsxdef.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbthread.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbtrace.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbusrrdd.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbver.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "hbzlib.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "inkey.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "memoedit.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "ord.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "rddsys.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "reserved.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "set.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "setcurs.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "simpleio.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "std.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "tbrowse.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "harbour.hbx"
|
||||
ADD HEADER TO s_hHeaders FILE "hbcpage.hbx"
|
||||
ADD HEADER TO s_hHeaders FILE "hblang.hbx"
|
||||
ADD HEADER TO s_hHeaders FILE "hbscalar.hbx"
|
||||
ADD HEADER TO s_hHeaders FILE "hbusrrdd.hbx"
|
||||
#else
|
||||
ADD HEADER TO s_hHeaders FILE "color.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "common.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "directry.ch"
|
||||
@@ -12067,6 +12146,7 @@ STATIC FUNCTION hbmk_CoreHeaderFilesMinimal()
|
||||
ADD HEADER TO s_hHeaders FILE "inkey.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "setcurs.ch"
|
||||
ADD HEADER TO s_hHeaders FILE "simpleio.ch"
|
||||
#endif
|
||||
|
||||
hb_HCaseMatch( s_hHeaders, .T. )
|
||||
ENDIF
|
||||
@@ -12075,19 +12155,32 @@ STATIC FUNCTION hbmk_CoreHeaderFilesMinimal()
|
||||
|
||||
/* Emulate a minimal hbrun */
|
||||
|
||||
#define _EXT_FILE_ "hbmk.ext"
|
||||
#define _EXT_ENV_ "HBMK_EXT"
|
||||
|
||||
STATIC PROCEDURE __hbrun_minimal( cFile, ... )
|
||||
LOCAL aDynamic := {}
|
||||
LOCAL hbmk
|
||||
LOCAL cHBC
|
||||
LOCAL cExt
|
||||
LOCAL tmp
|
||||
LOCAL l_cHB_INSTALL_PREFIX
|
||||
LOCAL aINCPATH
|
||||
|
||||
SetUILang( GetUILang() )
|
||||
|
||||
IF ! Empty( cFile := FindInPath( cFile ) )
|
||||
IF ! Empty( hb_FNameName( cFile ) ) .AND. ;
|
||||
! Empty( cFile := FindInPath( cFile ) )
|
||||
|
||||
SWITCH Lower( hb_FNameExt( cFile ) )
|
||||
cExt := Lower( hb_FNameExt( cFile ) )
|
||||
|
||||
IF !( cExt == ".hb" .OR. ;
|
||||
cExt == ".hrb" .OR. ;
|
||||
cExt == ".dbf" )
|
||||
cExt := __hbrun_FileSig( cFile )
|
||||
ENDIF
|
||||
|
||||
SWITCH cExt
|
||||
CASE ".hb"
|
||||
|
||||
hbmk := hbmk_new()
|
||||
@@ -12144,23 +12237,80 @@ STATIC PROCEDURE __hbrun_minimal( cFile, ... )
|
||||
__hbrun_extensions_dynamic_init( aDynamic )
|
||||
ENDIF
|
||||
|
||||
cFile := hb_compileBuf( hbmk_CoreHeaderFilesMinimal(), hb_ProgName(), "-n2", "-w", "-es2", "-q0", ;
|
||||
cFile := hb_compileBuf( hbmk_CoreHeaderFiles(), hb_ProgName(), "-n2", "-w", "-es2", "-q0", ;
|
||||
hb_ArrayToParams( aINCPATH ), "-D" + "__HBSCRIPT__HBRUN", cFile )
|
||||
IF cFile == NIL
|
||||
ErrorLevel( 1 )
|
||||
EXIT
|
||||
ENDIF
|
||||
CASE ".hrb"
|
||||
__hbrun_LoadExtDynamicFromFile( aDynamic, hb_DirBase() + _EXT_FILE_ )
|
||||
__hbrun_LoadExtDynamicFromString( aDynamic, GetEnv( _EXT_ENV_ ) )
|
||||
__hbrun_extensions_dynamic_init( aDynamic )
|
||||
s_cDirBase_hbrun := hb_DirBase()
|
||||
s_cProgName_hbrun := hb_ProgName()
|
||||
hb_argShift( .T. )
|
||||
hb_hrbRun( cFile, ... )
|
||||
EXIT
|
||||
CASE ".dbf"
|
||||
__hbrun_LoadExtDynamicFromFile( aDynamic, hb_DirBase() + _EXT_FILE_ )
|
||||
__hbrun_LoadExtDynamicFromString( aDynamic, GetEnv( _EXT_ENV_ ) )
|
||||
__hbrun_extensions_dynamic_init( aDynamic )
|
||||
__hbrun_shell( hb_AParams(), "USE " + cFile + " SHARED" )
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
ELSE
|
||||
__hbrun_LoadExtDynamicFromFile( aDynamic, hb_DirBase() + _EXT_FILE_ )
|
||||
__hbrun_LoadExtDynamicFromString( aDynamic, GetEnv( _EXT_ENV_ ) )
|
||||
__hbrun_extensions_dynamic_init( aDynamic )
|
||||
__hbrun_shell( hb_AParams() )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC FUNCTION __hbrun_FileSig( cFile )
|
||||
LOCAL hFile
|
||||
LOCAL cBuff, cSig, cExt
|
||||
|
||||
cExt := ".hb"
|
||||
hFile := FOpen( cFile, FO_READ )
|
||||
IF hFile != F_ERROR
|
||||
cSig := hb_hrbSignature()
|
||||
cBuff := Space( hb_BLen( cSig ) )
|
||||
FRead( hFile, @cBuff, hb_BLen( cBuff ) )
|
||||
FClose( hFile )
|
||||
IF cBuff == cSig
|
||||
cExt := ".hrb"
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN cExt
|
||||
|
||||
STATIC PROCEDURE __hbrun_LoadExtDynamicFromFile( aDynamic, cFileName )
|
||||
LOCAL cItem
|
||||
|
||||
FOR EACH cItem IN hb_ATokens( StrTran( MemoRead( cFileName ), Chr( 13 ) ), Chr( 10 ) )
|
||||
IF "#" $ cItem
|
||||
cItem := Left( cItem, At( "#", cItem ) - 1 )
|
||||
ENDIF
|
||||
IF ! Empty( cItem )
|
||||
AAdd( aDynamic, cItem )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE __hbrun_LoadExtDynamicFromString( aDynamic, cString )
|
||||
LOCAL cItem
|
||||
|
||||
FOR EACH cItem IN hb_ATokens( cString,, .T. )
|
||||
IF ! Empty( cItem )
|
||||
AAdd( aDynamic, cItem )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE __hbrun_LoadExtDynamicFromSource( aDynamic, cFileName )
|
||||
LOCAL cFile := MemoRead( cFileName )
|
||||
LOCAL pRegex
|
||||
@@ -12240,10 +12390,536 @@ STATIC FUNCTION __hbrun_extensions_get_list()
|
||||
|
||||
RETURN aName
|
||||
|
||||
#include "directry.ch"
|
||||
|
||||
#command ADD PLUGIN TO <hash> FILE <(cFile)> => ;
|
||||
#pragma __streaminclude <(cFile)> | <hash>\[ <(cFile)> \] := %s
|
||||
|
||||
FUNCTION __hbrun_plugins()
|
||||
LOCAL hPlugins := { => }
|
||||
LOCAL cExt
|
||||
LOCAL file
|
||||
|
||||
ADD PLUGIN TO hPlugins FILE "p_extdyn.hb"
|
||||
|
||||
FOR EACH cExt IN { "*.hb", "*.hrb" }
|
||||
FOR EACH file IN Directory( hb_DirBase() + cExt )
|
||||
hPlugins[ hb_DirBase() + file[ F_NAME ] ] := MemoRead( hb_DirBase() + file[ F_NAME ] ) /* TODO: decide where to load plugins from */
|
||||
NEXT
|
||||
NEXT
|
||||
|
||||
RETURN hPlugins
|
||||
|
||||
#define _PLUGIN_hHRB 1
|
||||
#define _PLUGIN_hMethods 2
|
||||
#define _PLUGIN_ctx 3
|
||||
#define _PLUGIN_cID 4
|
||||
#define _PLUGIN_MAX_ 4
|
||||
|
||||
STATIC FUNCTION __hbrun_plugins_load( hPlugins, aParams )
|
||||
LOCAL hConIO := {;
|
||||
"displine" => {| c | __hbrun_ToConsole( c ) } ,;
|
||||
"gethidden" => {|| __hbrun_GetHidden() } }
|
||||
|
||||
LOCAL plugin
|
||||
LOCAL plugins := {}
|
||||
LOCAL hHRBEntry
|
||||
LOCAL cFile
|
||||
|
||||
FOR EACH cFile IN hPlugins
|
||||
|
||||
plugin := Array( _PLUGIN_MAX_ )
|
||||
plugin[ _PLUGIN_hHRB ] := NIL
|
||||
|
||||
SWITCH Lower( hb_FNameExt( cFile:__enumKey() ) )
|
||||
CASE ".hb"
|
||||
CASE ".prg"
|
||||
cFile := hb_compileFromBuf( cFile, hbmk_CoreHeaderFiles(), hb_ProgName(), "-n2", "-w", "-es2", "-q0" )
|
||||
IF cFile == NIL
|
||||
EXIT
|
||||
ENDIF
|
||||
CASE ".hrb"
|
||||
BEGIN SEQUENCE WITH {| oErr | Break( oErr ) }
|
||||
plugin[ _PLUGIN_hHRB ] := hb_hrbLoad( HB_HRB_BIND_FORCELOCAL, cFile )
|
||||
IF Empty( hHRBEntry := hb_hrbGetFunSym( plugin[ _PLUGIN_hHRB ], "__hbrun_plugin" ) )
|
||||
plugin[ _PLUGIN_hHRB ] := NIL
|
||||
ENDIF
|
||||
RECOVER
|
||||
plugin[ _PLUGIN_hHRB ] := NIL
|
||||
END SEQUENCE
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
|
||||
IF ! Empty( plugin[ _PLUGIN_hHRB ] )
|
||||
plugin[ _PLUGIN_hMethods ] := Do( hHRBEntry )
|
||||
IF ! Empty( plugin[ _PLUGIN_hMethods ] )
|
||||
plugin[ _PLUGIN_ctx ] := Eval( plugin[ _PLUGIN_hMethods ][ "init" ], hConIO, aParams )
|
||||
IF ! Empty( plugin[ _PLUGIN_ctx ] )
|
||||
plugin[ _PLUGIN_cID ] := plugin[ _PLUGIN_hMethods ][ "id" ]
|
||||
IF ! Empty( plugin[ _PLUGIN_cID ] )
|
||||
AAdd( plugins, plugin )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN plugins
|
||||
|
||||
STATIC FUNCTION __hbrun_plugins_command( plugins, cCommand, cDomain )
|
||||
LOCAL plugin
|
||||
|
||||
FOR EACH plugin IN plugins
|
||||
IF Left( cCommand, Len( plugin[ _PLUGIN_cID ] ) + 1 ) == plugin[ _PLUGIN_cID ] + "."
|
||||
IF Eval( plugin[ _PLUGIN_hMethods ][ "cmd" ], plugin[ _PLUGIN_ctx ], SubStr( cCommand, Len( plugin[ _PLUGIN_cID ] ) + 2 ) )
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
ELSEIF cDomain == plugin[ _PLUGIN_cID ]
|
||||
IF Eval( plugin[ _PLUGIN_hMethods ][ "cmd" ], plugin[ _PLUGIN_ctx ], cCommand )
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN .F.
|
||||
|
||||
STATIC FUNCTION __hbrun_plugins_valid_id( plugins, cID )
|
||||
LOCAL plugin
|
||||
|
||||
FOR EACH plugin IN plugins
|
||||
IF plugin[ _PLUGIN_cID ] == cID
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN .F.
|
||||
|
||||
STATIC FUNCTION __hbrun_plugins_valid_id_list( plugins )
|
||||
LOCAL plugin
|
||||
LOCAL aList := {}
|
||||
|
||||
FOR EACH plugin IN plugins
|
||||
AAdd( aList, plugin[ _PLUGIN_cID ] )
|
||||
NEXT
|
||||
|
||||
RETURN aList
|
||||
|
||||
STATIC PROCEDURE __hbrun_plugins_unload( plugins )
|
||||
LOCAL plugin
|
||||
|
||||
FOR EACH plugin IN plugins
|
||||
Eval( plugin[ _PLUGIN_hMethods ][ "exit" ], plugin[ _PLUGIN_ctx ] )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
#include "color.ch"
|
||||
#include "inkey.ch"
|
||||
#include "setcurs.ch"
|
||||
|
||||
/* TODO: rewrite the full-screen prompt to be a simple stdout/stdin shell */
|
||||
STATIC PROCEDURE __hbrun_shell( aParams, cCommand )
|
||||
LOCAL GetList
|
||||
LOCAL cLine
|
||||
LOCAL nMaxRow, nMaxCol
|
||||
LOCAL nHistIndex
|
||||
LOCAL bKeyUP, bKeyDown, bKeyIns, bKeyResize
|
||||
LOCAL lResize := .F.
|
||||
LOCAL plugins
|
||||
|
||||
LOCAL cDomain := ""
|
||||
LOCAL tmp
|
||||
|
||||
hbrun_gtInteractive()
|
||||
|
||||
IF ! hb_gtInfo( HB_GTI_ISSCREENPOS )
|
||||
OutErr( "hbrun: Error: Interactive session not possible with " + hb_gtVersion( 0 ) + " terminal driver" + hb_eol() )
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
hb_gtInfo( HB_GTI_ICONRES, 1 )
|
||||
|
||||
CLEAR SCREEN
|
||||
SET SCOREBOARD OFF
|
||||
GetList := {}
|
||||
|
||||
__hbrun_HistoryLoad()
|
||||
|
||||
AAdd( s_aHistory, PadR( "quit", HB_LINE_LEN ) )
|
||||
nHistIndex := Len( s_aHistory ) + 1
|
||||
|
||||
IF HB_ISSTRING( cCommand )
|
||||
AAdd( s_aHistory, PadR( cCommand, HB_LINE_LEN ) )
|
||||
__hbrun_Info( cCommand )
|
||||
__hbrun_Exec( cCommand )
|
||||
ELSE
|
||||
cCommand := ""
|
||||
ENDIF
|
||||
|
||||
hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS )
|
||||
|
||||
SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } )
|
||||
|
||||
Set( _SET_EVENTMASK, hb_bitOr( INKEY_KEYBOARD, HB_INKEY_GTEVENT ) )
|
||||
|
||||
s_nRow := 2 + iif( Empty( __hbrun_extensions_get_list() ), 0, 1 )
|
||||
|
||||
plugins := __hbrun_plugins_load( __hbrun_plugins(), aParams )
|
||||
|
||||
DO WHILE .T.
|
||||
|
||||
IF cLine == NIL
|
||||
cLine := Space( HB_LINE_LEN )
|
||||
ENDIF
|
||||
|
||||
__hbrun_Info( cCommand )
|
||||
|
||||
nMaxRow := MaxRow()
|
||||
nMaxCol := MaxCol()
|
||||
@ nMaxRow, 0 SAY cDomain + "."
|
||||
@ nMaxRow, Col() GET cLine ;
|
||||
PICTURE "@KS" + hb_ntos( nMaxCol - Col() + 1 )
|
||||
|
||||
SetCursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) )
|
||||
|
||||
bKeyIns := SetKey( K_INS, ;
|
||||
{|| SetCursor( iif( ReadInsert( !ReadInsert() ), ;
|
||||
SC_NORMAL, SC_INSERT ) ) } )
|
||||
bKeyUp := SetKey( K_UP, ;
|
||||
{|| iif( nHistIndex > 1, ;
|
||||
cLine := s_aHistory[ --nHistIndex ], ) } )
|
||||
bKeyDown := SetKey( K_DOWN, ;
|
||||
{|| cLine := iif( nHistIndex < Len( s_aHistory ), ;
|
||||
s_aHistory[ ++nHistIndex ], ;
|
||||
( nHistIndex := Len( s_aHistory ) + 1, Space( HB_LINE_LEN ) ) ) } )
|
||||
bKeyResize := SetKey( HB_K_RESIZE,;
|
||||
{|| lResize := .T., hb_KeyPut( K_ENTER ) } )
|
||||
|
||||
READ
|
||||
|
||||
SetKey( K_DOWN, bKeyDown )
|
||||
SetKey( K_UP, bKeyUp )
|
||||
SetKey( K_INS, bKeyIns )
|
||||
SetKey( HB_K_RESIZE, bKeyResize )
|
||||
|
||||
IF LastKey() == K_ESC .OR. Empty( cLine ) .OR. ;
|
||||
( lResize .AND. LastKey() == K_ENTER )
|
||||
IF lResize
|
||||
lResize := .F.
|
||||
ELSE
|
||||
cLine := NIL
|
||||
ENDIF
|
||||
IF nMaxRow != MaxRow() .OR. nMaxCol != MaxCol()
|
||||
@ nMaxRow, 0 CLEAR
|
||||
ENDIF
|
||||
LOOP
|
||||
ENDIF
|
||||
|
||||
IF Empty( s_aHistory ) .OR. ! ATail( s_aHistory ) == cLine
|
||||
IF Len( s_aHistory ) < HB_HISTORY_LEN
|
||||
AAdd( s_aHistory, cLine )
|
||||
ELSE
|
||||
ADel( s_aHistory, 1 )
|
||||
s_aHistory[ Len( s_aHistory ) ] := cLine
|
||||
ENDIF
|
||||
ENDIF
|
||||
nHistIndex := Len( s_aHistory ) + 1
|
||||
|
||||
cCommand := AllTrim( cLine, " " )
|
||||
cLine := NIL
|
||||
@ nMaxRow, 0 CLEAR
|
||||
__hbrun_Info( cCommand )
|
||||
|
||||
IF ! Empty( cCommand )
|
||||
|
||||
IF Left( cCommand, 1 ) == "."
|
||||
IF cCommand == "."
|
||||
cDomain := ""
|
||||
ELSEIF __hbrun_plugins_valid_id( plugins, SubStr( cCommand, 2 ) )
|
||||
cDomain := SubStr( cCommand, 2 )
|
||||
ELSE
|
||||
FOR EACH tmp IN __hbrun_plugins_valid_id_list( plugins )
|
||||
__hbrun_ToConsole( "." + tmp )
|
||||
NEXT
|
||||
ENDIF
|
||||
ELSE
|
||||
IF ! __hbrun_plugins_command( plugins, cCommand, cDomain )
|
||||
__hbrun_Exec( cCommand )
|
||||
ENDIF
|
||||
|
||||
IF s_nRow >= MaxRow()
|
||||
Scroll( 2 + iif( Empty( __hbrun_extensions_get_list() ), 0, 1 ), 0, MaxRow(), MaxCol(), 1 )
|
||||
s_nRow := MaxRow() - 1
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDDO
|
||||
|
||||
__hbrun_plugins_unload( plugins )
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE __hbrun_ToConsole( cText )
|
||||
QQOut( cText + hb_eol() )
|
||||
RETURN
|
||||
|
||||
STATIC FUNCTION __hbrun_GetHidden()
|
||||
LOCAL GetList := {}
|
||||
LOCAL cPassword := Space( 128 )
|
||||
LOCAL nSavedRow
|
||||
LOCAL bKeyPaste
|
||||
|
||||
QQOut( "Enter password: " )
|
||||
|
||||
nSavedRow := Row()
|
||||
|
||||
AAdd( GetList, hb_Get():New( Row(), Col(), {| v | iif( PCount() == 0, cPassword, cPassword := v ) }, "cPassword", "@S" + hb_ntos( MaxCol() - Col() + 1 ), hb_ColorIndex( SetColor(), CLR_STANDARD ) + "," + hb_ColorIndex( SetColor(), CLR_STANDARD ) ) )
|
||||
ATail( GetList ):hideInput( .T. )
|
||||
ATail( GetList ):postBlock := {|| ! Empty( cPassword ) }
|
||||
ATail( GetList ):display()
|
||||
|
||||
SetCursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) )
|
||||
bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } )
|
||||
|
||||
READ
|
||||
|
||||
/* Positions the cursor on the line previously saved */
|
||||
SetPos( nSavedRow, MaxCol() - 1 )
|
||||
SetKey( K_ALT_V, bKeyPaste )
|
||||
|
||||
QQOut( hb_eol() )
|
||||
|
||||
RETURN AllTrim( cPassword )
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
STATIC PROCEDURE __hbrun_Info( cCommand )
|
||||
|
||||
IF cCommand != NIL
|
||||
hb_DispOutAt( 0, 0, "PP: " )
|
||||
hb_DispOutAt( 0, 4, PadR( cCommand, MaxCol() - 3 ), "N/R" )
|
||||
ENDIF
|
||||
IF Used()
|
||||
hb_DispOutAt( 1, 0, ;
|
||||
PadR( "RDD: " + PadR( rddName(), 6 ) + ;
|
||||
" | Area:" + Str( Select(), 3 ) + ;
|
||||
" | Dbf: " + PadR( Alias(), 10 ) + ;
|
||||
" | Index: " + PadR( ordName( IndexOrd() ), 8 ) + ;
|
||||
" | # " + Str( RecNo(), 7 ) + "/" + Str( RecCount(), 7 ), ;
|
||||
MaxCol() + 1 ), "N/BG" )
|
||||
ELSE
|
||||
hb_DispOutAt( 1, 0, ;
|
||||
PadR( "RDD: " + Space( 6 ) + ;
|
||||
" | Area:" + Space( 3 ) + ;
|
||||
" | Dbf: " + Space( 10 ) + ;
|
||||
" | Index: " + Space( 8 ) + ;
|
||||
" | # " + Space( 7 ) + "/" + Space( 7 ), ;
|
||||
MaxCol() + 1 ), "N/BG" )
|
||||
ENDIF
|
||||
IF s_lPreserveHistory
|
||||
hb_DispOutAt( 1, MaxCol(), "o", "R/BG" )
|
||||
ENDIF
|
||||
IF ! Empty( __hbrun_extensions_get_list() )
|
||||
hb_DispOutAt( 2, 0, PadR( "Ext: " + ArrayToList( __hbrun_extensions_get_list(), ", " ), MaxCol() + 1 ), "W/B" )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
STATIC PROCEDURE __hbrun_Err( oErr, cCommand )
|
||||
|
||||
LOCAL xArg, cMessage
|
||||
|
||||
cMessage := "Sorry, could not execute:;;" + cCommand + ";;"
|
||||
IF oErr:ClassName == "ERROR"
|
||||
cMessage += oErr:Description
|
||||
IF !Empty( oErr:Operation )
|
||||
cMessage += " " + oErr:Operation
|
||||
ENDIF
|
||||
IF HB_ISARRAY( oErr:Args ) .AND. Len( oErr:Args ) > 0
|
||||
cMessage += ";Arguments:"
|
||||
FOR EACH xArg IN oErr:Args
|
||||
cMessage += ";" + hb_CStr( xArg )
|
||||
NEXT
|
||||
ENDIF
|
||||
ELSEIF HB_ISSTRING( oErr )
|
||||
cMessage += oErr
|
||||
ENDIF
|
||||
cMessage += ";;" + ProcName( 2 ) + "(" + hb_ntos( ProcLine( 2 ) ) + ")"
|
||||
|
||||
Alert( cMessage )
|
||||
|
||||
Break( oErr )
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
STATIC PROCEDURE __hbrun_Exec( cCommand )
|
||||
LOCAL pHRB, cHRB, cFunc, bBlock, cEol, nRowMin
|
||||
|
||||
cEol := hb_eol()
|
||||
cFunc := "STATIC FUNC __HBDOT()" + cEol + ;
|
||||
"RETURN {||" + cEol + ;
|
||||
" " + cCommand + cEol + ;
|
||||
" RETURN __MVSETBASE()" + cEol + ;
|
||||
"}" + cEol
|
||||
|
||||
BEGIN SEQUENCE WITH {| oErr | __hbrun_Err( oErr, cCommand ) }
|
||||
|
||||
cHRB := hb_compileFromBuf( cFunc, hb_ProgName(), "-n2", "-q2" )
|
||||
IF cHRB == NIL
|
||||
Eval( ErrorBlock(), "Syntax error." )
|
||||
ELSE
|
||||
pHRB := hb_hrbLoad( cHRB )
|
||||
IF pHrb != NIL
|
||||
bBlock := hb_hrbDo( pHRB )
|
||||
DevPos( s_nRow, s_nCol )
|
||||
Eval( bBlock )
|
||||
s_nRow := Row()
|
||||
s_nCol := Col()
|
||||
nRowMin := 2 + iif( Empty( __hbrun_extensions_get_list() ), 0, 1 )
|
||||
IF s_nRow < nRowMin
|
||||
s_nRow := nRowMin
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
ENDSEQUENCE
|
||||
|
||||
__mvSetBase()
|
||||
|
||||
RETURN
|
||||
|
||||
#define _HISTORY_DISABLE_LINE "no"
|
||||
|
||||
EXIT PROCEDURE __hbrun_exit()
|
||||
|
||||
__hbrun_HistorySave()
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE __hbrun_HistoryLoad()
|
||||
LOCAL cHistory
|
||||
LOCAL cLine
|
||||
|
||||
s_lWasLoad := .T.
|
||||
|
||||
IF s_lPreserveHistory
|
||||
cHistory := StrTran( MemoRead( __hbrun_HistoryFileName() ), Chr( 13 ) )
|
||||
IF Left( cHistory, Len( _HISTORY_DISABLE_LINE + Chr( 10 ) ) ) == _HISTORY_DISABLE_LINE + Chr( 10 )
|
||||
s_lPreserveHistory := .F.
|
||||
ELSE
|
||||
FOR EACH cLine IN hb_ATokens( StrTran( cHistory, Chr( 13 ) ), Chr( 10 ) )
|
||||
IF ! Empty( cLine )
|
||||
AAdd( s_aHistory, PadR( cLine, HB_LINE_LEN ) )
|
||||
ENDIF
|
||||
NEXT
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE __hbrun_HistorySave()
|
||||
LOCAL cHistory
|
||||
LOCAL cLine
|
||||
|
||||
IF s_lWasLoad .AND. s_lPreserveHistory
|
||||
cHistory := ""
|
||||
FOR EACH cLine IN s_aHistory
|
||||
IF !( Lower( AllTrim( cLine ) ) == "quit" )
|
||||
cHistory += AllTrim( cLine ) + hb_eol()
|
||||
ENDIF
|
||||
NEXT
|
||||
hb_MemoWrit( __hbrun_HistoryFileName(), cHistory )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC FUNCTION __hbrun_HistoryFileName()
|
||||
LOCAL cEnvVar
|
||||
LOCAL cDir
|
||||
LOCAL cFileName
|
||||
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
cEnvVar := "APPDATA"
|
||||
#else
|
||||
cEnvVar := "HOME"
|
||||
#endif
|
||||
|
||||
#if defined( __PLATFORM__DOS )
|
||||
cFileName := "hbrunhst.ini"
|
||||
#else
|
||||
cFileName := ".hbrun_history"
|
||||
#endif
|
||||
|
||||
IF ! Empty( GetEnv( cEnvVar ) )
|
||||
#if defined( __PLATFORM__DOS )
|
||||
cDir := GetEnv( cEnvVar ) + hb_ps() + "~harbour"
|
||||
#else
|
||||
cDir := GetEnv( cEnvVar ) + hb_ps() + ".harbour"
|
||||
#endif
|
||||
ELSE
|
||||
cDir := hb_DirBase()
|
||||
ENDIF
|
||||
|
||||
IF ! hb_DirExists( cDir )
|
||||
hb_DirCreate( cDir )
|
||||
ENDIF
|
||||
|
||||
RETURN cDir + hb_ps() + cFileName
|
||||
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
|
||||
/* NOTE: Using an optional contrib component. Relying on it dynamically. */
|
||||
/* TODO: Use this, with some options. */
|
||||
|
||||
DYNAMIC win_regWrite
|
||||
DYNAMIC win_regDelete
|
||||
|
||||
STATIC FUNCTION __hbrun_win_reg_self( lRegister, lAllUser )
|
||||
IF ! __hbrun_extensions_dynamic_load( "hbwin" )
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
IF ! hb_IsFunction( "win_regWrite" ) .OR. ;
|
||||
! hb_IsFunction( "win_regDelete" )
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
RETURN __hbrun_win_reg_app( lRegister, lAllUser, hb_ProgName() )
|
||||
|
||||
STATIC FUNCTION __hbrun_win_reg_app( lRegister, lAllUser, cAppPath )
|
||||
LOCAL cHive := iif( HB_ISLOGICAL( lAllUser ) .AND. lAllUser, "HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER\Software\Classes" )
|
||||
LOCAL lSuccess := .T.
|
||||
LOCAL tmp
|
||||
|
||||
LOCAL aEntries := {;
|
||||
cHive + '\' , "" ,;
|
||||
cHive + '\.hb\' , "HarbourScript" ,;
|
||||
cHive + '\HarbourScript\' , "Harbour Script File" ,;
|
||||
cHive + '\HarbourScript\DefaultIcon\' , cAppPath + ",-1" ,;
|
||||
cHive + '\HarbourScript\Shell\' , "Run" ,;
|
||||
cHive + '\HarbourScript\Shell\Run\' , "" ,;
|
||||
cHive + '\HarbourScript\Shell\Run\Command\', cAppPath + ' "%1"' }
|
||||
|
||||
IF lRegister
|
||||
FOR tmp := 1 TO Len( aEntries ) STEP 2
|
||||
lSuccess := lSuccess .AND. win_regWrite( aEntries[ tmp ], aEntries[ tmp + 1 ] )
|
||||
NEXT
|
||||
ELSE
|
||||
FOR tmp := Len( aEntries ) - 1 TO 3 STEP -2
|
||||
lSuccess := win_regDelete( aEntries[ tmp ] )
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
RETURN lSuccess
|
||||
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
/* for interactive shell only. it's not yet implemented in hbmk2. */
|
||||
#if 0
|
||||
/* for interactive shell and running .hrb. Though it'd be
|
||||
much better if .hrb would natively support list of #require-ed
|
||||
modules, which could be queried and loaded. shell could
|
||||
support #require as well. */
|
||||
|
||||
/* Public hbrun API */
|
||||
FUNCTION hbrun_load( cName )
|
||||
@@ -12253,18 +12929,6 @@ FUNCTION hbrun_load( cName )
|
||||
FUNCTION hbrun_unload( cName )
|
||||
RETURN __hbrun_extensions_dynamic_unload( cName )
|
||||
|
||||
/* Public hbrun API */
|
||||
PROCEDURE hbrun_list()
|
||||
LOCAL cName
|
||||
|
||||
FOR EACH cName IN __hbrun_extensions_get_list()
|
||||
OutStd( cName + _OUT_EOL )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
#endif
|
||||
|
||||
/* Public hbrun API */
|
||||
FUNCTION hbrun_DirBase()
|
||||
RETURN s_cDirBase_hbrun
|
||||
|
||||
13
harbour/utils/hbmk2/hbmk2.rc
Normal file
13
harbour/utils/hbmk2/hbmk2.rc
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if defined( OS2 ) || defined( __OS2__ ) || defined( OS_2 )
|
||||
ICON 1 DISCARDABLE "../../package/harb_os2.ico"
|
||||
#else
|
||||
#if ! defined( __BORLANDC__ )
|
||||
1 ICON DISCARDABLE "../../package/harb_win.ico"
|
||||
#endif
|
||||
#include "../../package/harb_win.rc"
|
||||
__HB_CREATEPROCESS_MANIFEST_RESOURCE_ID __HB_RT_MANIFEST "../../package/harb_win.mft"
|
||||
#endif
|
||||
113
harbour/utils/hbmk2/p_extdyn.hb
Normal file
113
harbour/utils/hbmk2/p_extdyn.hb
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* extensions (dynamic manager plugin)
|
||||
*
|
||||
* Copyright 2012 Viktor Szakats (harbour syenar.net)
|
||||
* www - http://harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
FUNCTION __hbrun_plugin()
|
||||
RETURN {;
|
||||
"id" => "ext",;
|
||||
"init" => {| hConIO | __init( hConIO ) } ,;
|
||||
"exit" => {| context | HB_SYMBOL_UNUSED( context ) } ,;
|
||||
"cmd" => {| context, cCommand | __command( context, cCommand ) } }
|
||||
|
||||
STATIC FUNCTION __init( hConIO )
|
||||
RETURN { hConIO, { ;
|
||||
"load" => { "<name>" , "Load." , {| context, cCommand | load( context, cCommand ) } },;
|
||||
"unload" => { "<name>" , "Unload." , {| context, cCommand | unload( context, cCommand ) } },;
|
||||
"list" => { "" , "List." , {| context, cCommand | list( context ) } } } }
|
||||
|
||||
STATIC PROCEDURE __disp( context, cText )
|
||||
Eval( context[ 1 ][ "displine" ], cText )
|
||||
RETURN
|
||||
|
||||
STATIC FUNCTION __command( context, cCommand )
|
||||
LOCAL aCommand
|
||||
LOCAL nPos
|
||||
|
||||
IF ! Empty( context )
|
||||
aCommand := hb_ATokens( cCommand, " " )
|
||||
IF ! Empty( aCommand ) .AND. ( nPos := hb_HPos( context[ 2 ], Lower( aCommand[ 1 ] ) ) ) > 0
|
||||
Eval( hb_HValueAt( context[ 2 ], nPos )[ 3 ], context, cCommand )
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN .F.
|
||||
|
||||
/* Commands */
|
||||
|
||||
STATIC PROCEDURE load( context, cCommand )
|
||||
LOCAL aToken := hb_ATokens( cCommand, " " )
|
||||
LOCAL tmp
|
||||
|
||||
FOR tmp := 2 TO Len( aToken )
|
||||
__hbrun_extensions_dynamic_load( aToken[ tmp ] )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE unload( context, cCommand )
|
||||
LOCAL aToken := hb_ATokens( cCommand, " " )
|
||||
LOCAL tmp
|
||||
|
||||
FOR tmp := 2 TO Len( aToken )
|
||||
__hbrun_extensions_dynamic_unload( aToken[ tmp ] )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE list( context )
|
||||
LOCAL cName
|
||||
|
||||
FOR EACH cName IN __hbrun_extensions_get_list()
|
||||
__disp( context, cName )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
Reference in New Issue
Block a user