2012-06-15 03:17 UTC+0200 Viktor Szakats (harbour syenar.net)
* bin/3rdpatch.hb
* contrib/make.hb
* changed to be executed by hbmk2
- contrib/hbrun/extdyn.prg
- contrib/hbrun/hbrun.prg
- contrib/hbrun/hbrun.rc
- contrib/hbrun/headers.prg
- contrib/hbrun/p_ext.hb
- contrib/hbrun/plugins.prg
* contrib/hbrun/hbrun.hbp
% changed to use hbmk2 sources and make file to build hbrun,
implementing the build method described in previous ChangeLog
entry. The lost feature is netio management plugin, which
is now not loaded by default. Plus, since this is a static
build, dynamic extensions don't work.
* contrib/make.hb
* src/pp/ppcore.c
* deleted reference to hbrun in comment
* contrib/hbnetio/utils/hbnetio/netiocon.prg
* contrib/hbnetio/utils/hbnetio/netiomgm.hb
* __hbrun_plugin() -> __hbshell_plugin()
* INSTALL
* minor in previous change
This commit is contained in:
@@ -16,6 +16,35 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-15 03:17 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* bin/3rdpatch.hb
|
||||
* contrib/make.hb
|
||||
* changed to be executed by hbmk2
|
||||
|
||||
- contrib/hbrun/extdyn.prg
|
||||
- contrib/hbrun/hbrun.prg
|
||||
- contrib/hbrun/hbrun.rc
|
||||
- contrib/hbrun/headers.prg
|
||||
- contrib/hbrun/p_ext.hb
|
||||
- contrib/hbrun/plugins.prg
|
||||
* contrib/hbrun/hbrun.hbp
|
||||
% changed to use hbmk2 sources and make file to build hbrun,
|
||||
implementing the build method described in previous ChangeLog
|
||||
entry. The lost feature is netio management plugin, which
|
||||
is now not loaded by default. Plus, since this is a static
|
||||
build, dynamic extensions don't work.
|
||||
|
||||
* contrib/make.hb
|
||||
* src/pp/ppcore.c
|
||||
* deleted reference to hbrun in comment
|
||||
|
||||
* contrib/hbnetio/utils/hbnetio/netiocon.prg
|
||||
* contrib/hbnetio/utils/hbnetio/netiomgm.hb
|
||||
* __hbrun_plugin() -> __hbshell_plugin()
|
||||
|
||||
* INSTALL
|
||||
* minor in previous change
|
||||
|
||||
2012-06-15 02:26 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/make.hb
|
||||
* contrib/hbrun/hbrun.hbp
|
||||
|
||||
@@ -1362,14 +1362,14 @@ HARBOUR
|
||||
- To run the interactive shell ('dot' prompt):
|
||||
'hbmk2 .'
|
||||
- To run a Harbour script:
|
||||
'hbmk2 script.hb [<options>]'
|
||||
'hbmk2 script.hb [<parameters>]'
|
||||
|
||||
Examples to build and run Harbour portable binary (aka precompiled script):
|
||||
|
||||
- To build:
|
||||
'hbmk2 -gh script.hb'
|
||||
- To run result of above:
|
||||
'hbmk2 script.hrb [<options>]'
|
||||
'hbmk2 script.hrb [<parameters>]'
|
||||
|
||||
Examples to build a Harbour application:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/hbrun --hb:gtcgi
|
||||
#!/usr/bin/hbmk2
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ PROCEDURE hbnetiocon_cmdUI( cIP, nPort, cPassword )
|
||||
|
||||
LOCAL lQuit
|
||||
|
||||
LOCAL netclictrl := __hbrun_plugin()
|
||||
LOCAL netclictrl := __hbshell_plugin()
|
||||
LOCAL netclictx
|
||||
LOCAL netcliID
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#define _NETIOCLI_hConIO 8
|
||||
#define _NETIOCLI_MAX_ 8
|
||||
|
||||
FUNCTION __hbrun_plugin()
|
||||
FUNCTION __hbshell_plugin()
|
||||
RETURN {;
|
||||
"id" => "netio",;
|
||||
"init" => {| hConIO, ... | hbnetiocon_init( hConIO, ... ) } ,;
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* extensions (dynamic + core)
|
||||
*
|
||||
* Copyright 2011 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbver.ch"
|
||||
|
||||
STATIC s_hLib := { => }
|
||||
|
||||
PROCEDURE __hbrun_extensions_dynamic_init( aDynamic )
|
||||
LOCAL tmp
|
||||
LOCAL nCount
|
||||
LOCAL cName
|
||||
|
||||
nCount := __dynsCount()
|
||||
FOR tmp := 1 TO nCount
|
||||
cName := __dynsGetName( tmp )
|
||||
IF Left( cName, Len( "__HBEXTERN__" ) ) == "__HBEXTERN__" .AND. ;
|
||||
!( "|" + cName + "|" $ "|__HBEXTERN__HBCPAGE__|" )
|
||||
s_hLib[ Lower( SubStr( cName, Len( "__HBEXTERN__" ) + 1, Len( cName ) - Len( "__HBEXTERN__" ) - Len( "__" ) ) ) ] := NIL
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
IF ! Empty( aDynamic )
|
||||
FOR EACH cName IN aDynamic
|
||||
__hbrun_extensions_dynamic_load( cName )
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
/* Requires hbrun to be built in -shared mode */
|
||||
|
||||
PROCEDURE __hbrun_extensions_dynamic_load( cName )
|
||||
LOCAL cFileName
|
||||
LOCAL hLib
|
||||
|
||||
IF ! Empty( cName )
|
||||
IF hb_Version( HB_VERSION_SHARED )
|
||||
IF !( cName $ s_hLib )
|
||||
cFileName := __hbrun_FindInPath( hb_libName( cName + hb_libPostfix() ),;
|
||||
iif( hb_Version( HB_VERSION_UNIX_COMPAT ), GetEnv( "LD_LIBRARY_PATH" ), GetEnv( "PATH" ) ) )
|
||||
IF ! Empty( cFileName )
|
||||
hLib := hb_libLoad( cFileName )
|
||||
IF ! Empty( hLib )
|
||||
s_hLib[ cName ] := hLib
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
ELSE
|
||||
OutErr( hb_StrFormat( "Cannot load %1$s. Requires -shared hbrun build.", cName ) + hb_eol() )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
PROCEDURE __hbrun_extensions_dynamic_unload( cName )
|
||||
|
||||
IF cName $ s_hLib .AND. s_hLib[ cName ] != NIL
|
||||
hb_HDel( s_hLib, cName )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
FUNCTION __hbrun_extensions_get_list()
|
||||
LOCAL aName := Array( Len( s_hLib ) )
|
||||
LOCAL hLib
|
||||
|
||||
FOR EACH hLib IN s_hLib
|
||||
aName[ hLib:__enumIndex() ] := hLib:__enumKey() + iif( Empty( hLib ), "", "*" )
|
||||
NEXT
|
||||
|
||||
ASort( aName )
|
||||
|
||||
RETURN aName
|
||||
@@ -2,43 +2,13 @@
|
||||
# $Id$
|
||||
#
|
||||
|
||||
-w3 -es2 -l
|
||||
-kmo
|
||||
@../../utils/hbmk2/hbmk2.hbp
|
||||
|
||||
-o${hb_name}
|
||||
|
||||
-DHBRUN_WITH_HEADERS
|
||||
-static
|
||||
|
||||
-head=dep
|
||||
|
||||
-cflag=-Zm200{wce&allmsvc}
|
||||
|
||||
# required by some plugins (f.e. netio management console)
|
||||
-mt
|
||||
|
||||
hbrun.prg
|
||||
|
||||
headers.prg
|
||||
plugins.prg
|
||||
extdyn.prg
|
||||
|
||||
-lhbpmcom{dos}
|
||||
|
||||
# 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
|
||||
hbrun.rc
|
||||
|
||||
# Plugins
|
||||
|
||||
-I.
|
||||
-I../hbnetio/utils/hbnetio
|
||||
|
||||
# Here comes the list of contribs linked in:
|
||||
# - Make sure to keep it in sync with pullext.prg.
|
||||
# - Do not add contribs which have external dependencies.
|
||||
# (not in the public SVN that is)
|
||||
-DHBMK_WITH_ALL_EMBEDDED_HEADERS
|
||||
|
||||
hbct.hbc -request=__HBEXTERN__HBCT__
|
||||
hbexpat.hbc -request=__HBEXTERN__HBEXPAT__
|
||||
@@ -47,9 +17,3 @@ 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 the
|
||||
# it's required for dynamic extension loading. (only
|
||||
# do that if HB_BUILD_CONTRIB_DYN is enabled, so there
|
||||
# are actually some dynamic extensions to load.)
|
||||
{_HB_BUILD_&(!(HB_BUILD_DYN='no')&!(HB_BUILD_CONTRIB_DYN='no')&(win|wce|os2))}-shared
|
||||
|
||||
@@ -1,878 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* "DOt Prompt" Console and .prg/.hrb runner for the Harbour Language
|
||||
*
|
||||
* Copyright 2008-2012 Viktor Szakats (harbour syenar.net)
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "color.ch"
|
||||
#include "fileio.ch"
|
||||
#include "inkey.ch"
|
||||
#include "setcurs.ch"
|
||||
|
||||
#include "hbgtinfo.ch"
|
||||
#include "hbhrb.ch"
|
||||
|
||||
/* 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__
|
||||
|
||||
REQUEST HB_GT_CGI
|
||||
REQUEST HB_GT_PCA
|
||||
REQUEST HB_GT_STD
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
REQUEST HB_GT_WVT
|
||||
#endif
|
||||
|
||||
#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.
|
||||
|
||||
STATIC s_cDirBase
|
||||
STATIC s_cProgName
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
#if defined( __PLATFORM__DOS )
|
||||
# define _EXT_FILE_ "hb_ext.ini"
|
||||
#else
|
||||
# define _EXT_FILE_ "hb_extension"
|
||||
#endif
|
||||
#define _EXT_ENV_ "HB_EXTENSION"
|
||||
|
||||
PROCEDURE _APPMAIN( cFile, ... )
|
||||
LOCAL cExt
|
||||
LOCAL hHeaders
|
||||
|
||||
LOCAL aDynamic
|
||||
|
||||
hb_cdpSelect( "UTF8EX" )
|
||||
|
||||
/* Configure terminal and OS codepage */
|
||||
hb_SetTermCP( hb_cdpTerm() )
|
||||
Set( _SET_OSCODEPAGE, hb_cdpOS() )
|
||||
|
||||
aDynamic := {}
|
||||
|
||||
LoadExtDynamicFromFile( aDynamic, __hbrun_ConfigDir() + _EXT_FILE_ )
|
||||
LoadExtDynamicFromString( aDynamic, GetEnv( _EXT_ENV_ ) )
|
||||
|
||||
/* TODO: Rework parameter handling */
|
||||
IF PCount() > 0
|
||||
SWITCH Lower( cFile )
|
||||
CASE "-?"
|
||||
CASE "-h"
|
||||
CASE "--help"
|
||||
CASE "/?"
|
||||
CASE "/h"
|
||||
hbrun_Usage()
|
||||
EXIT
|
||||
CASE "-v"
|
||||
CASE "/v"
|
||||
hbrun_Prompt( hb_AParams(), "? hb_version()" )
|
||||
EXIT
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
CASE "-r"
|
||||
CASE "-ra"
|
||||
CASE "/r"
|
||||
CASE "/ra"
|
||||
IF win_reg_self( .T., Right( Lower( cFile ), 1 ) == "a" )
|
||||
OutStd( "hbrun: Harbour Script File registered" + hb_eol() )
|
||||
ELSE
|
||||
OutErr( "hbrun: Error: Registering Harbour Script File" + hb_eol() )
|
||||
ENDIF
|
||||
EXIT
|
||||
CASE "-u"
|
||||
CASE "-ua"
|
||||
CASE "/u"
|
||||
CASE "/ua"
|
||||
IF win_reg_self( .F., Right( Lower( cFile ), 1 ) == "a" )
|
||||
OutStd( "hbrun: Harbour Script File unregistered" + hb_eol() )
|
||||
ELSE
|
||||
OutErr( "hbrun: Error: Unregistering Harbour Script File" + hb_eol() )
|
||||
ENDIF
|
||||
EXIT
|
||||
#endif
|
||||
CASE "-p"
|
||||
CASE "/p"
|
||||
s_lPreserveHistory := .F.
|
||||
hbrun_extensionlist_init( aDynamic )
|
||||
hbrun_Prompt( hb_AParams() )
|
||||
EXIT
|
||||
OTHERWISE
|
||||
IF Left( cFile, 2 ) == "--"
|
||||
hbrun_extensionlist_init( aDynamic )
|
||||
hbrun_Prompt( hb_AParams() )
|
||||
EXIT
|
||||
ELSE
|
||||
cFile := __hbrun_FindInPath( cFile )
|
||||
IF ! Empty( cFile )
|
||||
hb_FNameSplit( cFile, NIL, NIL, @cExt )
|
||||
cExt := Lower( cExt )
|
||||
SWITCH cExt
|
||||
CASE ".hb"
|
||||
CASE ".prg"
|
||||
CASE ".hrb"
|
||||
CASE ".dbf"
|
||||
EXIT
|
||||
OTHERWISE
|
||||
cExt := hbrun_FileSig( cFile )
|
||||
ENDSWITCH
|
||||
SWITCH cExt
|
||||
CASE ".dbf"
|
||||
hbrun_extensionlist_init( aDynamic )
|
||||
hbrun_Prompt( hb_AParams(), "USE " + cFile + " SHARED" )
|
||||
EXIT
|
||||
CASE ".hb"
|
||||
CASE ".prg"
|
||||
IF Empty( GetEnv( "HBRUN_NOHEAD" ) )
|
||||
hHeaders := __hbrun_CoreHeaderFiles() /* add core header files */
|
||||
ENDIF
|
||||
|
||||
LoadExtDynamicFromSource( aDynamic, cFile )
|
||||
|
||||
cFile := hb_compileBuf( hHeaders, hb_ProgName(), "-n2", "-w", "-es2", "-q0", ;
|
||||
"-I" + hb_FNameDir( cFile ), "-D" + "__HBSCRIPT__HBSHELL", cFile )
|
||||
IF cFile == NIL
|
||||
ErrorLevel( 1 )
|
||||
EXIT
|
||||
ENDIF
|
||||
OTHERWISE
|
||||
hbrun_extensionlist_init( aDynamic )
|
||||
s_cDirBase := hb_DirBase()
|
||||
s_cProgName := hb_ProgName()
|
||||
hb_argShift( .T. )
|
||||
hb_hrbRun( cFile, ... )
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDSWITCH
|
||||
ELSE
|
||||
hbrun_extensionlist_init( aDynamic )
|
||||
hbrun_Prompt( hb_AParams() )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
/* Public hbshell API */
|
||||
FUNCTION hbshell_DirBase()
|
||||
RETURN s_cDirBase
|
||||
|
||||
FUNCTION hbshell_ProgName()
|
||||
RETURN s_cProgName
|
||||
|
||||
INIT PROCEDURE ClipInit()
|
||||
|
||||
hb_cdpSelect( "UTF8EX" )
|
||||
|
||||
RETURN
|
||||
|
||||
EXIT PROCEDURE hbrun_exit()
|
||||
|
||||
hbrun_HistorySave()
|
||||
|
||||
RETURN
|
||||
|
||||
FUNCTION __hbrun_ConfigDir()
|
||||
LOCAL cEnvVar
|
||||
LOCAL cDir
|
||||
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
cEnvVar := "APPDATA"
|
||||
#else
|
||||
cEnvVar := "HOME"
|
||||
#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()
|
||||
|
||||
STATIC PROCEDURE 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 LoadExtDynamicFromString( aDynamic, cString )
|
||||
LOCAL cItem
|
||||
|
||||
FOR EACH cItem IN hb_ATokens( cString,, .T. )
|
||||
IF ! Empty( cItem )
|
||||
AAdd( aDynamic, cItem )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE LoadExtDynamicFromSource( aDynamic, cFileName )
|
||||
LOCAL cFile := MemoRead( cFileName )
|
||||
LOCAL pRegex
|
||||
LOCAL tmp
|
||||
|
||||
tmp := hb_cdpSelect( "EN" )
|
||||
pRegex := hb_regexComp( '(^|;)[[:blank:]]*#[[:blank:]]*(require)[[:blank:]]*(\".+?\"'+"|'.+?'"+')',;
|
||||
.F. /* lCaseSensitive */,;
|
||||
.T. /* lNewLine */ )
|
||||
hb_cdpSelect( tmp )
|
||||
|
||||
FOR EACH tmp IN hb_regexAll( pRegex, cFile, ;
|
||||
NIL /* lCaseSensitive */, ;
|
||||
NIL /* lNewLine */, NIL, ;
|
||||
NIL /* nGetMatch */, ;
|
||||
.T. /* lOnlyMatch */ )
|
||||
AAdd( aDynamic, SubStr( ATail( tmp ), 2, Len( ATail( tmp ) ) - 2 ) /* Last group in match marker */ )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE hbrun_extensionlist_init( aDynamic )
|
||||
STATIC s_lInit := .F.
|
||||
|
||||
IF ! s_lInit
|
||||
IF hb_IsFunction( "__hbrun_extensions_static_init" )
|
||||
Do( "__hbrun_extensions_static_init" )
|
||||
ENDIF
|
||||
__hbrun_extensions_dynamic_init( aDynamic )
|
||||
s_lInit := .T.
|
||||
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
|
||||
|
||||
#define _PLUGIN_hHRB 1
|
||||
#define _PLUGIN_hMethods 2
|
||||
#define _PLUGIN_ctx 3
|
||||
#define _PLUGIN_cID 4
|
||||
#define _PLUGIN_MAX_ 4
|
||||
|
||||
STATIC FUNCTION 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, __hbrun_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 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 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 plugins_valid_id_list( plugins )
|
||||
LOCAL plugin
|
||||
LOCAL aList := {}
|
||||
|
||||
FOR EACH plugin IN plugins
|
||||
AAdd( aList, plugin[ _PLUGIN_cID ] )
|
||||
NEXT
|
||||
|
||||
RETURN aList
|
||||
|
||||
STATIC PROCEDURE plugins_unload( plugins )
|
||||
LOCAL plugin
|
||||
|
||||
FOR EACH plugin IN plugins
|
||||
Eval( plugin[ _PLUGIN_hMethods ][ "exit" ], plugin[ _PLUGIN_ctx ] )
|
||||
NEXT
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC PROCEDURE hbrun_Prompt( 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
|
||||
|
||||
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 := 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 plugins_valid_id( plugins, SubStr( cCommand, 2 ) )
|
||||
cDomain := SubStr( cCommand, 2 )
|
||||
ELSE
|
||||
FOR EACH tmp IN plugins_valid_id_list( plugins )
|
||||
hbrun_ToConsole( "." + tmp )
|
||||
NEXT
|
||||
ENDIF
|
||||
ELSE
|
||||
IF ! 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
|
||||
|
||||
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_Usage()
|
||||
|
||||
OutStd( 'Harbour "DOt Prompt" Console / runner ' + HBRawVersion() + hb_eol() +;
|
||||
"Copyright (c) 1999-2012, Przemyslaw Czerpak, Viktor Szakats" + hb_eol() + ;
|
||||
"http://harbour-project.org/" + hb_eol() +;
|
||||
hb_eol() +;
|
||||
"Syntax: hbrun [<file[.hb|.prg|.hrb]> [<parameters,...>]]" + hb_eol() )
|
||||
|
||||
RETURN
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
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
|
||||
|
||||
hb_DispOutAt( 2, 0, PadR( "Ext: " + ArrayToList( __hbrun_extensions_get_list() ), MaxCol() + 1 ), "W/B" )
|
||||
|
||||
RETURN
|
||||
|
||||
STATIC FUNCTION ArrayToList( array )
|
||||
LOCAL cString := ""
|
||||
LOCAL tmp
|
||||
|
||||
FOR tmp := 1 TO Len( array )
|
||||
cString += array[ tmp ]
|
||||
IF tmp < Len( array )
|
||||
cString += ", "
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN cString
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
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 FUNCTION __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
|
||||
|
||||
STATIC FUNCTION HBRawVersion()
|
||||
RETURN StrTran( Version(), "Harbour " )
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
#define _HISTORY_DISABLE_LINE "no"
|
||||
|
||||
#if defined( __PLATFORM__DOS )
|
||||
# define _FNAME_HISTORY_ "hbhist.ini"
|
||||
#else
|
||||
# define _FNAME_HISTORY_ ".hb_history"
|
||||
#endif
|
||||
|
||||
STATIC PROCEDURE hbrun_HistoryLoad()
|
||||
LOCAL cHistory
|
||||
LOCAL cLine
|
||||
|
||||
s_lWasLoad := .T.
|
||||
|
||||
IF s_lPreserveHistory
|
||||
cHistory := StrTran( MemoRead( __hbrun_ConfigDir() + _FNAME_HISTORY_ ), 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
|
||||
LOCAL cDir
|
||||
|
||||
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
|
||||
IF ! hb_DirExists( cDir := __hbrun_ConfigDir() )
|
||||
hb_DirCreate( cDir )
|
||||
ENDIF
|
||||
hb_MemoWrit( cDir + _FNAME_HISTORY_, cHistory )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
FUNCTION __hbrun_FindInPath( cFileName, xPath )
|
||||
LOCAL cDir
|
||||
LOCAL cName
|
||||
LOCAL cExt
|
||||
LOCAL cFullName
|
||||
LOCAL aExt
|
||||
|
||||
hb_FNameSplit( cFileName, @cDir, @cName, @cExt )
|
||||
aExt := iif( Empty( cExt ), { ".hb", ".hrb" }, { cExt } )
|
||||
|
||||
FOR EACH cExt IN aExt
|
||||
/* Check original filename (in supplied path or current dir) */
|
||||
IF hb_FileExists( cFullName := hb_FNameMerge( cDir, cName, cExt ) )
|
||||
RETURN cFullName
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
IF Empty( cDir )
|
||||
IF ! Empty( cDir := hb_DirBase() )
|
||||
/* Check in the dir of this executable. */
|
||||
FOR EACH cExt IN aExt
|
||||
IF hb_FileExists( cFullName := hb_FNameMerge( cDir, cName, cExt ) )
|
||||
RETURN cFullName
|
||||
ENDIF
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
IF ! HB_ISSTRING( xPath ) .AND. ;
|
||||
! HB_ISARRAY( xPath )
|
||||
xPath := GetEnv( "PATH" )
|
||||
ENDIF
|
||||
|
||||
IF HB_ISSTRING( xPath )
|
||||
#if defined( __PLATFORM__WINDOWS ) .OR. ;
|
||||
defined( __PLATFORM__DOS ) .OR. ;
|
||||
defined( __PLATFORM__OS2 )
|
||||
xPath := hb_ATokens( xPath, hb_osPathListSeparator(), .T., .T. )
|
||||
#else
|
||||
xPath := hb_ATokens( xPath, hb_osPathListSeparator() )
|
||||
#endif
|
||||
ENDIF
|
||||
|
||||
FOR EACH cExt IN aExt
|
||||
/* Check in the PATH. */
|
||||
FOR EACH cDir IN xPath
|
||||
IF Left( cDir, 1 ) == '"' .AND. Right( cDir, 1 ) == '"'
|
||||
cDir := SubStr( cDir, 2, Len( cDir ) - 2 )
|
||||
ENDIF
|
||||
IF ! Empty( cDir )
|
||||
IF hb_FileExists( cFullName := hb_FNameMerge( cDir, cName, cExt ) )
|
||||
RETURN cFullName
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
RETURN NIL
|
||||
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
|
||||
STATIC FUNCTION win_reg_self( lRegister, lAllUser )
|
||||
RETURN win_reg_app( lRegister, lAllUser, hb_ProgName() )
|
||||
|
||||
STATIC FUNCTION 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
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* $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
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* header puller
|
||||
*
|
||||
* Copyright 2010-2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* command to store header files in hash array */
|
||||
#command ADD HEADER TO <hash> FILE <(cFile)> => ;
|
||||
#pragma __streaminclude <(cFile)> | <hash>\[ <(cFile)> \] := %s
|
||||
|
||||
FUNCTION __hbrun_CoreHeaderFiles()
|
||||
STATIC s_hHeaders
|
||||
|
||||
#ifdef HBRUN_WITH_HEADERS
|
||||
|
||||
IF s_hHeaders == NIL
|
||||
s_hHeaders := { => }
|
||||
|
||||
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"
|
||||
|
||||
hb_HCaseMatch( s_hHeaders, .T. )
|
||||
ENDIF
|
||||
|
||||
#endif /* HBRUN_WITH_HEADERS */
|
||||
|
||||
RETURN s_hHeaders
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* $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
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* plugin container
|
||||
*
|
||||
* Copyright 2011 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "directry.ch"
|
||||
|
||||
#command ADD PLUGIN TO <hash> FILE <(cFile)> => ;
|
||||
#pragma __streaminclude <(cFile)> | <hash>\[ <(cFile)> \] := %s
|
||||
|
||||
FUNCTION __hbrun_plugins()
|
||||
LOCAL hPlugins := { => }
|
||||
LOCAL cDir
|
||||
LOCAL cExt
|
||||
LOCAL file
|
||||
|
||||
ADD PLUGIN TO hPlugins FILE "netiomgm.hb"
|
||||
ADD PLUGIN TO hPlugins FILE "p_ext.hb"
|
||||
|
||||
cDir := __hbrun_ConfigDir()
|
||||
|
||||
FOR EACH cExt IN { "*.hb", "*.hrb" }
|
||||
FOR EACH file IN Directory( cDir + cExt )
|
||||
hPlugins[ cDir + file[ F_NAME ] ] := MemoRead( cDir + file[ F_NAME ] )
|
||||
NEXT
|
||||
NEXT
|
||||
|
||||
RETURN hPlugins
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/hbrun --hb:gtcgi
|
||||
#!/usr/bin/hbmk2
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
@@ -267,8 +267,8 @@ PROCEDURE GNUMake( aParams, hProjectList )
|
||||
AScanL( aGNUMakeParams, "install" ) > AScanL( aGNUMakeParams, "clean" )
|
||||
/* Use rebuild mode. This is needed because the clean phase
|
||||
might not have been called previously by GNU Make, f.e.
|
||||
because hbrun or hbmk2 wasn't available. -rebuildall is
|
||||
costless, so we do it to make sure to build cleanly.
|
||||
because hbmk2 wasn't available. -rebuildall is costless,
|
||||
so we do it to make sure to build cleanly.
|
||||
[vszakats] */
|
||||
nAction := _ACT_INC_REBUILD_INST
|
||||
ELSE
|
||||
|
||||
@@ -5265,7 +5265,7 @@ static void hb_pp_preprocessToken( PHB_PP_STATE pState )
|
||||
}
|
||||
else if( hb_pp_tokenValueCmp( pToken, "REQUIRE", HB_PP_CMP_STD ) )
|
||||
{
|
||||
/* do nothing. this directive is processed by hbrun and hbmk2 to
|
||||
/* do nothing. this directive is processed by hbmk2 to
|
||||
pull in external modules. */
|
||||
}
|
||||
else if( hb_pp_tokenValueCmp( pToken, "STDOUT", HB_PP_CMP_DBASE ) )
|
||||
|
||||
Reference in New Issue
Block a user