2008-04-24 10:24 UTC+0100 Viktor Szakats (harbour.01 syenar hu)

* contrib/xhb/xhb.ch
   * contrib/xhb/xhbfunc.c
     ! xhb flavour of __KEYBOARD() synced with current xhb code.

   * contrib/hbmisc/hb_f.c
     ! Swapped C file seek constants to Harbour ones.
     * Minor cleanups and formatting.

   * source/rtl/tbrowse.prg
     ! Committed patch to ::setPosition() 
       submitted by Prezemek on the devl list.

   * source/rtl/tget.prg
     * Minor changes. Copyright updated.
This commit is contained in:
Viktor Szakats
2008-04-24 08:29:22 +00:00
parent ef43b0a9a1
commit 3ec42eca91
6 changed files with 64 additions and 66 deletions

View File

@@ -8,6 +8,22 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-04-24 10:24 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/xhb/xhb.ch
* contrib/xhb/xhbfunc.c
! xhb flavour of __KEYBOARD() synced with current xhb code.
* contrib/hbmisc/hb_f.c
! Swapped C file seek constants to Harbour ones.
* Minor cleanups and formatting.
* source/rtl/tbrowse.prg
! Committed patch to ::setPosition()
submitted by Prezemek on the devl list.
* source/rtl/tget.prg
* Minor changes. Copyright updated.
2008-04-23 22:31 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/rddads/adsfunc.c
+ Added these functions:

View File

@@ -72,7 +72,6 @@ static int isEof[10];
HB_FUNC( HB_FUSE )
{
PHB_ITEM arg1_it = hb_param(1,HB_IT_STRING);
PHB_ITEM arg2_it = hb_param(2,HB_IT_NUMERIC);
int open_flags;
@@ -89,22 +88,22 @@ HB_FUNC( HB_FUSE )
recno[area] = 1;
b = ( char * )hb_xgrab( b_size );
c = ( char * )hb_xgrab( c_size );
lastbyte[area] = hb_fsSeek( handles[area], 0L, SEEK_END );
lastbyte[area] = hb_fsSeek( handles[area], 0L, FS_END );
isEof[area] = (lastbyte[area] == 0);
hb_retni( handles[area] );
}
else {
hb_fsClose( handles[area] );
hb_xfree( b ) ;
hb_xfree( c ) ;
hb_retni( 1 ) ;
recno[area] = 0L ;
offset[area] = 0L ;
handles[area] = 0 ;
last_rec[area] = 0L ;
last_off[area] = 0L ;
lastbyte[area] = 0L ;
isEof[area] = 0 ;
hb_xfree( b );
hb_xfree( c );
hb_retni( 1 );
recno[area] = 0L;
offset[area] = 0L;
handles[area] = 0;
last_rec[area] = 0L;
last_off[area] = 0L;
lastbyte[area] = 0L;
isEof[area] = 0;
}
}
@@ -117,17 +116,7 @@ HB_FUNC( HB_FRECNO )
HB_FUNC( HB_FSKIP )
{
PHB_ITEM arg1_it = hb_param(1,HB_IT_NUMERIC);
int nskip;
if( arg1_it )
nskip = hb_parni(1);
else
nskip = 1;
hb_hbfskip(nskip);
hb_hbfskip( ISNUM( 1 ) ? hb_parni(1) : 1 );
}
static long hb_hbfskip( int recs )
@@ -136,12 +125,11 @@ static long hb_hbfskip( int recs )
long read_len;
long x, y;
HB_TRACE(HB_TR_DEBUG, ("hb_hbskip(%d)", recs));
if ( recs > 0 ) {
for (y = 0; y < recs; y++ ) {
hb_fsSeek( handles[area], offset[area], SEEK_SET );
hb_fsSeek( handles[area], offset[area], FS_SET );
read_len = hb_fsRead( handles[area], ( BYTE * ) b, b_size );
for (x = 0; x < read_len; x++ ) {
if ( ((*(b + x) == 13) && (*(b + x + 1) == 10)) ||
@@ -175,7 +163,7 @@ static long hb_hbfskip( int recs )
read_len = b_size;
}
hb_fsSeek( handles[area], read_pos, SEEK_SET );
hb_fsSeek( handles[area], read_pos, FS_SET );
read_len = hb_fsRead( handles[area], ( BYTE * ) b, ( USHORT )read_len );
for (x = read_len - 4; x >= 0; x-- ) {
@@ -200,11 +188,10 @@ static long hb_hbfskip( int recs )
HB_FUNC( HB_FREADLN )
{
int x;
long read;
hb_fsSeek( handles[area], offset[area], SEEK_SET );
hb_fsSeek( handles[area], offset[area], FS_SET );
read = hb_fsRead( handles[area], ( BYTE * ) b, b_size );
for ( x = 0; x < b_size; x++ ) {
@@ -225,7 +212,6 @@ HB_FUNC( HB_FEOF )
HB_FUNC( HB_FGOTO )
{
long target;
long last;
@@ -265,7 +251,7 @@ HB_FUNC( HB_FGOBOTTOM )
last = offset[area];
do {
hb_fsSeek( handles[area], offset[area], SEEK_SET );
hb_fsSeek( handles[area], offset[area], FS_SET );
len = hb_fsRead( handles[area], ( BYTE * ) c, c_size );
for ( x = 0; x < len; x++ ) {
if ( ((*(c + x) == 13) && (*(c + x + 1) == 10)) ||
@@ -328,7 +314,6 @@ HB_FUNC( HB_FINFO ) /* used for debugging */
hb_storni( offset[area], -1, 4);
hb_storni( lastbyte[area], -1, 5);
hb_storl ( isEof[area], -1, 6);
}
HB_FUNC( HB_FREADANDSKIP )
@@ -352,7 +337,7 @@ HB_FUNC( HB_FREADANDSKIP )
long read;
BOOL bInField = 0, bHasCRLF = FALSE;
hb_fsSeek( handles[area], offset[area], SEEK_SET );
hb_fsSeek( handles[area], offset[area], FS_SET );
read = hb_fsRead( handles[area], ( BYTE * ) b, b_size );
while ( x < read )
@@ -385,6 +370,4 @@ HB_FUNC( HB_FREADANDSKIP )
isEof[area] = (lastbyte[area] <= offset[area] + 1) ;
hb_retclen( b, x - (bHasCRLF ? 2 : 0) );
}

View File

@@ -61,7 +61,7 @@
#pragma -ks+
REQUEST XHB_LIB
#xtranslate __Keyboard([<k>]) => xhb__Keyboard(<k>)
#xtranslate __Keyboard([<x,...>]) => xhb__Keyboard(<x>)
#endif
#endif /* __HARBOUR__ */

View File

@@ -59,30 +59,40 @@ HB_FUNC_EXTERN( __KEYBOARD );
HB_FUNC( XHB__KEYBOARD )
{
/* Clear the typeahead buffer without reallocating the keyboard buffer */
if( !hb_parl( 2 ) )
{
hb_inkeyReset();
}
if( ISCHAR( 1 ) )
{
HB_FUNC_EXEC( __KEYBOARD );
hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ) );
}
else if( ISNUM( 1 ) )
{
hb_inkeyReset();
hb_inkeyPut( hb_parni(1) );
hb_inkeySetText( NULL, ( ULONG ) hb_parnl( 1 ) );
}
else if( ISARRAY( 1 ) )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
ULONG ulElements = hb_arrayLen( pArray ), ulIndex;
hb_inkeyReset();
ULONG ulIndex;
ULONG ulElements = hb_arrayLen( pArray );
for( ulIndex = 1; ulIndex <= ulElements; ulIndex++ )
{
if( hb_arrayGetType( pArray, ulIndex ) & HB_IT_NUMERIC )
hb_inkeyPut( hb_arrayGetNI( pArray, ulIndex ) );
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, ulIndex );
if ( HB_IS_NUMBER( pItem ) )
{
hb_inkeySetText( NULL, ( ULONG ) hb_itemGetNL( pItem ) );
}
else if ( HB_IS_STRING( pItem ) )
{
hb_inkeySetText( ( const char * ) hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ) );
}
}
}
else
hb_inkeyReset();
}
HB_FUNC_EXTERN( HB_DESERIALIZE );

View File

@@ -725,7 +725,7 @@ METHOD setPosition( nPos ) CLASS TBROWSE
::nBufferPos := nRowCount
ENDIF
nPos := 0
WHILE ( nPos := AScan( ::aCellStatus, _TBR_NONE, nPos, ::nBufferPos - nPos ) ) != 0
WHILE ( nPos := AScan( ::aCellStatus, _TBR_NONE, nPos + 1, ::nBufferPos - nPos ) ) != 0
::aCellStatus[ nPos ] := _TBR_UNDEF
::aDispStatus[ nPos ] := .T.
ENDDO

View File

@@ -6,6 +6,7 @@
* Harbour Project source code:
* Get Class
*
* Copyright 2007-2008 Viktor Szakats <viktor.szakats@syenar.hu>
* Copyright 1999 Ignacio Ortiz de Z£niga <ignacio@fivetech.com>
* www - http://www.harbour-project.org
*
@@ -50,18 +51,6 @@
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
*
* Copyright 2007 Viktor Szakats <viktor.szakats@syenar.hu>
* Several smaller methods and lots of fixes using
* regression/unit testing.
*
* See doc/license.txt for licensing terms.
*
*/
#include "hbclass.ch"
#include "hblang.ch"
@@ -441,6 +430,14 @@ METHOD setFocus() CLASS Get
::cType := ValType( xVarGet )
::picture := ::cPicture
::cBuffer := ::PutMask( xVarGet, .F. )
::lChanged := .F.
::lClear := ( "K" $ ::cPicFunc .OR. ::cType == "N" )
::lEdit := .F.
::Pos := 1
::lMinusPrinted := .F.
::lMinus := .F.
IF ::cType == "N"
::decPos := At( iif( ::lPicDecRev .OR. "E" $ ::cPicFunc, ",", "." ), ::cBuffer )
@@ -451,14 +448,6 @@ METHOD setFocus() CLASS Get
ELSE
::decPos := 0 /* ; CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */
ENDIF
::lChanged := .F.
::lClear := ( "K" $ ::cPicFunc .OR. ::cType == "N" )
::lEdit := .F.
::Pos := 1
::lMinusPrinted := .F.
::lMinus := .F.
::display()