2010-07-01 17:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* src/rtl/memvarhb.prg
    + Added file signature and version no. to .hbv files.
    ; Patch by Tamas Tevesz with a few modifications:
      - added high byte at 1st pos is signature
      - deleted RTEs in case of invalid file content on load
        (to mimic original __MVRESTORE() which is also silent)
      - minor optimization on signature checking.
    ; INCOMPATIBLE: The file format has changed so you won't be 
                    able to interchange it with previous 
                    versions of Harbour. Anyhow it's very new 
                    format, so this shouldn't affect many users.

  * utils/hbmk2/hbmk2.prg
  * utils/hbrun/hbrun.prg
    + Shows .hbs as support input file format (where applicable)
    ! Little fix in displaying options w/o description on help
      screen.

  * utils/hbrun/hbrun.prg
    + Added clipboard paste support with Alt+V key.

  * contrib/hbide/hbide.prg
    - Temply disabled reference to new-style embedded resources.
This commit is contained in:
Viktor Szakats
2010-07-01 15:35:07 +00:00
parent 2c0cb9109f
commit dd03d682f3
5 changed files with 79 additions and 35 deletions

View File

@@ -16,6 +16,31 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-07-01 17:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/memvarhb.prg
+ Added file signature and version no. to .hbv files.
; Patch by Tamas Tevesz with a few modifications:
- added high byte at 1st pos is signature
- deleted RTEs in case of invalid file content on load
(to mimic original __MVRESTORE() which is also silent)
- minor optimization on signature checking.
; INCOMPATIBLE: The file format has changed so you won't be
able to interchange it with previous
versions of Harbour. Anyhow it's very new
format, so this shouldn't affect many users.
* utils/hbmk2/hbmk2.prg
* utils/hbrun/hbrun.prg
+ Shows .hbs as support input file format (where applicable)
! Little fix in displaying options w/o description on help
screen.
* utils/hbrun/hbrun.prg
+ Added clipboard paste support with Alt+V key.
* contrib/hbide/hbide.prg
- Temply disabled reference to new-style embedded resources.
2010-07-01 10:05 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/gtsln/kbsln.c
* public variable hb_DeadKey made static and renamed to

View File

@@ -111,7 +111,7 @@ PROCEDURE Main( ... )
SET CENTURY ON
SET EPOCH TO 1970
/* TODO: activate */ hbqtres_HbIde()
/* TODO: activate */ /* hbqtres_HbIde() */
oIde := HbIde():new( hb_aParams() ):create()
oIde:destroy()

View File

@@ -55,7 +55,18 @@
#include "error.ch"
#include "fileio.ch"
#define _HBMEM_EXT ".hbv"
/*
* 'H', 'B', 'V' followed two-byte version number in network byte order (BE).
* Corresponding magic(5) rule:
* 0 string \xC0HBV
* 0x04 beshort x Harbour memory file version %d
* Until such time that the serialized format changes, and handling of
* previously-saved files is required, only a naive approach of using
* version 0 is taken.
*/
#define _HBMEM_SIGNATURE e"\xC0HBV" + Chr( 0 ) + Chr( 0 )
#define _HBMEM_EXT ".hbv"
FUNCTION HB_MVSAVE( cFileName, cMask, lIncludeMask )
LOCAL nCount
@@ -133,6 +144,7 @@ FUNCTION HB_MVSAVE( cFileName, cMask, lIncludeMask )
ENDDO
IF fhnd != F_ERROR
FWrite( fhnd, _HBMEM_SIGNATURE )
FWrite( fhnd, hb_serialize( aVars ) )
FClose( fhnd )
ENDIF
@@ -223,33 +235,40 @@ FUNCTION HB_MVRESTORE( cFileName, lAdditive, cMask, lIncludeMask )
RETURN .F.
ENDIF
cBuffer := Space( FSeek( fhnd, 0, FS_END ) )
FSeek( fhnd, 0, FS_SET )
FRead( fhnd, @cBuffer, Len( cBuffer ) )
FClose( fhnd )
aVars := hb_deserialize( cBuffer )
cBuffer := NIL
xValue := NIL
IF ISARRAY( aVars )
FOR EACH item IN aVars
IF ISARRAY( item ) .AND. Len( item ) == 2 .AND. ;
ISCHARACTER( item[ 1 ] ) .AND. ;
! Empty( item[ 1 ] )
cBuffer := Space( Len( _HBMEM_SIGNATURE ) )
FRead( fhnd, @cBuffer, Len( cBuffer ) )
IF cBuffer == _HBMEM_SIGNATURE
cName := item[ 1 ]
lMatch := hb_WildMatchI( cMask, cName )
IF iif( lIncludeMask, lMatch, ! lMatch )
IF xValue == NIL
xValue := item[ 2 ]
cBuffer := Space( FSeek( fhnd, 0, FS_END ) - Len( _HBMEM_SIGNATURE ) )
FSeek( fhnd, Len( _HBMEM_SIGNATURE ), FS_SET )
FRead( fhnd, @cBuffer, Len( cBuffer ) )
FClose( fhnd )
aVars := hb_deserialize( cBuffer )
cBuffer := NIL
IF ISARRAY( aVars )
FOR EACH item IN aVars
IF ISARRAY( item ) .AND. Len( item ) == 2 .AND. ;
ISCHARACTER( item[ 1 ] ) .AND. ;
! Empty( item[ 1 ] )
cName := item[ 1 ]
lMatch := hb_WildMatchI( cMask, cName )
IF iif( lIncludeMask, lMatch, ! lMatch )
IF xValue == NIL
xValue := item[ 2 ]
ENDIF
&cName := item[ 2 ]
ENDIF
&cName := item[ 2 ]
ENDIF
ENDIF
NEXT
__MVSETBASE()
NEXT
__MVSETBASE()
ENDIF
ELSE
FClose( fhnd )
ENDIF
RETURN xValue

View File

@@ -9944,9 +9944,9 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong )
{ "-depincpath=<d:i>" , I_( "<d> is the name of the dependency. Add <i> to the header detection path list" ) },;
{ "-depincpathlocal= <d:i>" , I_( "<d> is the name of the dependency. Add <i> to the header detection path list, where <i> is pointing to a directory local to the project and containing an embedded (or locally hosted) dependency." ) },;
NIL,;
{ "-plugin=<.prg|.hrb>", I_( "add plugin (EXPERIMENTAL)" ) },;
{ "-pi=<filename>" , I_( "pass input file to plugins (EXPERIMENTAL)" ) },;
{ "-pflag=<f>" , I_( "pass flag to plugins (EXPERIMENTAL)" ) },;
{ "-plugin= <.prg|.hbs|.hrb>", I_( "add plugin" ) },;
{ "-pi=<filename>" , I_( "pass input file to plugins" ) },;
{ "-pflag=<f>" , I_( "pass flag to plugins" ) },;
NIL,;
{ "Options below are available on command line only:" },;
NIL,;
@@ -10022,19 +10022,17 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong )
STATIC PROCEDURE OutOpt( hbmk, aOpt )
LOCAL nLine
LOCAL nLines
LOCAL tmp
IF Empty( aOpt )
OutStd( _OUT_EOL )
ELSE
IF Len( aOpt ) > 1
aOpt[ 2 ] := StrTran( aOpt[ 2 ], "\n", hb_osNewLine() )
nLines := MLCount( aOpt[ 2 ], hbmk[ _HBMK_nMaxCol ] - _OPT_WIDTH )
nLines := Max( MLCount( aOpt[ 2 ], hbmk[ _HBMK_nMaxCol ] - _OPT_WIDTH ),;
MLCount( aOpt[ 1 ], _OPT_WIDTH ) )
FOR nLine := 1 TO nLines
IF ! Empty( tmp := RTrim( MemoLine( aOpt[ 2 ], hbmk[ _HBMK_nMaxCol ] - _OPT_WIDTH, nLine ) ) )
OutStd( PadR( Space( 2 ) + MemoLine( aOpt[ 1 ], _OPT_WIDTH, nLine ), _OPT_WIDTH ) )
OutStd( tmp + _OUT_EOL )
ENDIF
OutStd( PadR( Space( 2 ) + MemoLine( aOpt[ 1 ], _OPT_WIDTH, nLine ), _OPT_WIDTH ) )
OutStd( RTrim( MemoLine( aOpt[ 2 ], hbmk[ _HBMK_nMaxCol ] - _OPT_WIDTH, nLine ) ) + _OUT_EOL )
NEXT
ELSE
OutStd( Space( 2 ) + aOpt[ 1 ] + _OUT_EOL )

View File

@@ -201,6 +201,8 @@ STATIC PROCEDURE hbrun_Prompt( cCommand )
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 ) )
DO WHILE .T.
@@ -240,7 +242,7 @@ STATIC PROCEDURE hbrun_Prompt( cCommand )
SetKey( HB_K_RESIZE, bKeyResize )
IF LastKey() == K_ESC .OR. EMPTY( cLine ) .OR. ;
( lResize .AND. LastKey() == K_ENTER )
( lResize .AND. LastKey() == K_ENTER )
IF lResize
lResize := .F.
ELSE
@@ -286,7 +288,7 @@ STATIC PROCEDURE hbrun_Usage()
"Copyright (c) 1999-2010, Przemyslaw Czerpak" + HB_OSNewLine() + ;
"http://harbour-project.org/" + HB_OSNewLine() +;
HB_OSNewLine() +;
"Syntax: hbrun [<hrbfile[.prg|.hrb]> [<parameters,...>]]" + HB_OSNewLine() )
"Syntax: hbrun [<file[.prg|.hbs|.hrb]> [<parameters,...>]]" + HB_OSNewLine() )
RETURN