20000301-14:34 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-03-01 13:34:40 +00:00
parent 106f12dbca
commit ba890737e6
7 changed files with 137 additions and 167 deletions

View File

@@ -1,3 +1,16 @@
20000301-14:34 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/rtl/console.c
source/rtl/oldclear.c
% Removed more non-GTAPI branches.
* source/rtl/tgetlist.prg
% One FUNCTION converted to PROCEDURE
* source/rtl/setfunc.prg
* NOTE made more clear.
* source/rtl/setkey.prg
* Changed to three chars indentation
* source/rtl/arrays.c
* Minor change in comment.
20000301-10:15 GMT+2 Chen Kedem <niki@actcom.co.il>
* doc/en/ARRAY.TXT
* doc/en/BINNUM.TXT

View File

@@ -760,10 +760,6 @@ PHB_ITEM hb_arrayClone( PHB_ITEM pSrcArray )
return pDstArray;
}
/*
* HARBOUR
*/
/* This function creates an array item using 'iDimension' as an index
* to retrieve the number of elements from the parameter list.
*/
@@ -787,6 +783,10 @@ static void hb_arrayNewRagged( PHB_ITEM pArray, int iDimension )
}
}
/*
* HARBOUR
*/
HARBOUR HB_ARRAY( void )
{
int iPCount = hb_pcount();
@@ -994,6 +994,7 @@ HARBOUR HB_ACLONE( void )
if( pSrcArray && ! hb_arrayIsObject( pSrcArray ) )
{
PHB_ITEM pDstArray = hb_arrayClone( pSrcArray );
hb_itemReturn( pDstArray ); /* AClone() returns the new array */
hb_itemRelease( pDstArray );
}

View File

@@ -42,8 +42,8 @@
*
* Copyright 1999 David G. Holm <dholm@jsd-llc.com>
* adjust_pos(), hb_altout(), hb_devout(), HB_DEVOUT(), hb_devpos(),
* HB_DEVPOS(), hb_dispout(), HB___EJECT(), hb_max_col(), HB_MAXCOL(),
* hb_max_row(), HB_MAXROW(), hb_out(), hb_outerr(), HB_OUTERR(),
* HB_DEVPOS(), hb_dispout(), HB___EJECT(), HB_MAXCOL(),
* HB_MAXROW(), hb_out(), hb_outerr(), HB_OUTERR(),
* hb_outstd(), HB_OUTSTD(), HB_PCOL(), HB_PROW(), hb_setpos(),
* HB_SETPOS(), HB_SETPRC(), HB_SCROLL(), and hb_consoleInitialize()
*
@@ -163,9 +163,7 @@ void hb_consoleRelease( void )
s_szCrLf[ 0 ] = HB_CHAR_LF;
s_szCrLf[ 1 ] = '\0';
#ifdef HARBOUR_USE_GTAPI
hb_gtExit();
#endif
s_bInit = FALSE;
}
@@ -182,43 +180,18 @@ HARBOUR HB_HB_OSNEWLINE( void )
hb_retc( s_szCrLf );
}
USHORT hb_max_row( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_max_row()"));
#ifdef HARBOUR_USE_GTAPI
return hb_gtMaxRow();
#else
#if defined(HB_OS_UNIX_COMPATIBLE)
return 23;
#else
return 24;
#endif
#endif
}
USHORT hb_max_col( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_max_col()"));
#ifdef HARBOUR_USE_GTAPI
return hb_gtMaxCol();
#else
return 79;
#endif
}
#ifndef HARBOUR_USE_GTAPI
static void adjust_pos( char * pStr, ULONG ulLen, SHORT * row, SHORT * col, USHORT max_row, USHORT max_col )
static void adjust_pos( char * pStr, ULONG ulLen, SHORT * row, SHORT * col )
{
USHORT max_row = hb_gtMaxRow();
USHORT max_col = hb_gtMaxCol();
ULONG ulCount;
char * pPtr = pStr;
HB_TRACE(HB_TR_DEBUG, ("adjust_pos(%s, %lu, %p, %p, %hu, %hu)", pStr, ulLen, row, col, max_row, max_col));
HB_TRACE(HB_TR_DEBUG, ("adjust_pos(%s, %lu, %p, %p)", pStr, ulLen, row, col));
for( ulCount = 0; ulCount < ulLen; ulCount++ )
{
switch( *pPtr++ )
switch( *pStr++ )
{
case HB_CHAR_BEL:
break;
@@ -283,18 +256,16 @@ void hb_outstd( char * pStr, ULONG ulLen )
if( ulLen == 0 )
ulLen = strlen( pStr );
#ifdef HARBOUR_USE_GTAPI
if( s_bInit )
hb_gtPreExt();
#endif
user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( s_iFilenoStdout, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
#ifdef HARBOUR_USE_GTAPI
if( s_bInit )
{
#ifdef HARBOUR_USE_GTAPI
#ifndef __CYGWIN__
if( isatty( s_iFilenoStdout ) )
#endif
@@ -303,11 +274,11 @@ void hb_outstd( char * pStr, ULONG ulLen )
s_iDevCol = hb_gt_Col();
hb_gtSetPos( s_iDevRow, s_iDevCol );
}
#else
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol );
#endif
hb_gtPostExt();
}
#else
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol, hb_max_row(), hb_max_col() );
#endif
}
/* Output an item to STDERR */
@@ -320,18 +291,16 @@ void hb_outerr( char * pStr, ULONG ulLen )
if( ulLen == 0 )
ulLen = strlen( pStr );
#ifdef HARBOUR_USE_GTAPI
if( s_bInit )
hb_gtPreExt();
#endif
user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( s_iFilenoStderr, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
#ifdef HARBOUR_USE_GTAPI
if( s_bInit )
{
#ifdef HARBOUR_USE_GTAPI
#ifndef __CYGWIN__
if( isatty( s_iFilenoStdout ) )
#endif
@@ -340,11 +309,11 @@ void hb_outerr( char * pStr, ULONG ulLen )
s_iDevCol = hb_gt_Col();
hb_gtSetPos( s_iDevRow, s_iDevCol );
}
#else
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol );
#endif
hb_gtPostExt();
}
#else
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol, hb_max_row(), hb_max_col() );
#endif
}
/* Output an item to the screen and/or printer and/or alternate */
@@ -361,7 +330,7 @@ static void hb_altout( char * pStr, ULONG ulLen )
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( s_iFilenoStdout, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol, hb_max_row(), hb_max_col() );
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol );
#endif
}
@@ -414,7 +383,7 @@ static void hb_devout( char * pStr, ULONG ulLen )
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( s_iFilenoStdout, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol, hb_max_row(), hb_max_col() );
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol );
#endif
}
}
@@ -435,7 +404,7 @@ static void hb_dispout( char * pStr, ULONG ulLen )
user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( s_iFilenoStdout, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol, hb_max_row(), hb_max_col() );
adjust_pos( pStr, ulLen, &s_iDevRow, &s_iDevCol );
#endif
}
@@ -566,14 +535,12 @@ HARBOUR HB_SETPOS( void ) /* Sets the screen position */
/* Move the screen position to the right by one column */
HARBOUR HB_SETPOSBS( void )
{
#ifdef HARBOUR_USE_GTAPI
SHORT iRow, iCol;
/* NOTE: Clipper does no checks about reaching the border or anything.
[vszakats] */
hb_gtGetPos( &iRow, &iCol );
hb_gtSetPos( iRow, iCol + 1 );
#endif
}
HARBOUR HB_DEVPOS( void ) /* Sets the screen and/or printer position */
@@ -586,7 +553,6 @@ HARBOUR HB_DEVOUT( void ) /* writes a single value to the current device (screen
{
if( hb_pcount() >= 1 )
{
#ifdef HARBOUR_USE_GTAPI
if( ISCHAR( 2 ) )
{
char szOldColor[ CLR_STRLEN ];
@@ -600,9 +566,6 @@ HARBOUR HB_DEVOUT( void ) /* writes a single value to the current device (screen
}
else
hb_out( 1, hb_devout );
#else
hb_out( 1, hb_devout );
#endif
}
}
@@ -610,7 +573,6 @@ HARBOUR HB_DISPOUT( void ) /* writes a single value to the screen, but is not af
{
if( hb_pcount() >= 1 )
{
#ifdef HARBOUR_USE_GTAPI
if( ISCHAR( 2 ) )
{
char szOldColor[ CLR_STRLEN ];
@@ -624,9 +586,6 @@ HARBOUR HB_DISPOUT( void ) /* writes a single value to the screen, but is not af
}
else
hb_out( 1, hb_dispout );
#else
hb_out( 1, hb_devout );
#endif
}
}
@@ -639,7 +598,6 @@ HARBOUR HB_DISPOUTAT( void ) /* writes a single value to the screen at speficic
/* NOTE: Clipper does no checks here. [vszakats] */
hb_setpos( hb_parni( 1 ), hb_parni( 2 ) );
#ifdef HARBOUR_USE_GTAPI
if( ISCHAR( 4 ) )
{
char szOldColor[ CLR_STRLEN ];
@@ -653,9 +611,6 @@ HARBOUR HB_DISPOUTAT( void ) /* writes a single value to the screen at speficic
}
else
hb_out( 3, hb_dispout );
#else
hb_out( 3, hb_devout );
#endif
}
}
@@ -693,8 +648,8 @@ HARBOUR HB_SCROLL( void ) /* Scrolls a screen region (requires the GT API) */
{
USHORT top, left, bottom, right;
int iMR = hb_max_row();
int iMC = hb_max_col();
int iMR = hb_gtMaxRow();
int iMC = hb_gtMaxCol();
int i_top = ISNUM( 1 ) ? hb_parni( 1 ) : 0;
int i_left = ISNUM( 2 ) ? hb_parni( 2 ) : 0;
@@ -736,12 +691,12 @@ HARBOUR HB_SCROLL( void ) /* Scrolls a screen region (requires the GT API) */
HARBOUR HB_MAXROW( void ) /* Return the maximum screen row number (zero origin) */
{
hb_retni( hb_max_row() );
hb_retni( hb_gtMaxRow() );
}
HARBOUR HB_MAXCOL( void ) /* Return the maximum screen column number (zero origin) */
{
hb_retni( hb_max_col() );
hb_retni( hb_gtMaxCol() );
}
HARBOUR HB_ROW( void ) /* Return the current screen row position (zero origin) */
@@ -800,10 +755,10 @@ HARBOUR HB_DISPBOX( void )
if( i_left < 0 ) left = 0; else left = ( USHORT ) i_left;
if( i_bottom < 0 ) bottom = 0; else bottom = ( USHORT ) i_bottom;
if( i_right < 0 ) right = 0; else right = ( USHORT ) i_right;
if( top > hb_max_row() ) top = hb_max_row();
if( left > hb_max_col() ) left = hb_max_col();
if( bottom > hb_max_row() ) bottom = hb_max_row();
if( right > hb_max_col() ) right = hb_max_col();
if( top > hb_gtMaxRow() ) top = hb_gtMaxRow();
if( left > hb_gtMaxCol() ) left = hb_gtMaxCol();
if( bottom > hb_gtMaxRow() ) bottom = hb_gtMaxRow();
if( right > hb_gtMaxCol() ) right = hb_gtMaxCol();
/* Force the box to be drawn from top left to bottom right */
if( top > bottom )

View File

@@ -37,20 +37,16 @@
HARBOUR HB___ATCLEAR( void )
{
#ifdef HARBOUR_USE_GTAPI
if( hb_pcount() == 4 )
{
hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) );
hb_gtScroll( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), 0, 0 );
}
#endif
}
HARBOUR HB___CLEAR( void )
{
#ifdef HARBOUR_USE_GTAPI
hb_gtScroll( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), 0, 0 );
hb_gtSetPos( 0, 0 );
#endif
}

View File

@@ -38,7 +38,8 @@
PROCEDURE __SetFunction( nFunctionKey, cString )
/* NOTE: CA-Cl*pper will not handle F11 and F12 here. */
/* NOTE: CA-Cl*pper will not handle F11 and F12 here.
This is a Harbour extension. [vszakats] */
DO CASE
CASE nFunctionKey == 1 ; nFunctionKey := K_F1

View File

@@ -36,10 +36,10 @@
/*
* ChangeLog:
*
* V 1.1 A White Fixed wrong parameter aClone() bug in SetKeySave()
* Added SetKeyCheck()
* Added SetKeyGet()
* V 1.0 A White Initial version, submitted to Harbour Projects
* V 1.1 A White Fixed wrong parameter aClone() bug in SetKeySave()
* Added SetKeyCheck()
* Added SetKeyGet()
* V 1.0 A White Initial version, submitted to Harbour Projects
*
*/
@@ -50,102 +50,106 @@
#define BLOCK 2
#define CONDITION 3
static s_aSetKeys := {} // holds array of hot-key id, code-block, activation-block
// holds array of hot-key id, code-block, activation-block
static s_aSetKeys := {}
Function SetKey( anKey, bBlock, bCondition )
local nFound, bReturn, aKey
if ISARRAY( anKey )
aEval( anKey, {|x| setKey( x, bBlock, bCondition ) } )
elseif ISNUMBER( anKey ) .and. anKey <> 0
if ( nFound := aScan( s_aSetKeys, {|x| x[ KEY ] == anKey } ) ) == 0
if ISBLOCK( bBlock )
aAdd( s_aSetKeys, { anKey, bBlock, bCondition } )
local nFound
local bReturn
local aKey
if ISARRAY( anKey )
aEval( anKey, {|x| setKey( x, bBlock, bCondition ) } )
elseif ISNUMBER( anKey ) .and. anKey <> 0
if ( nFound := aScan( s_aSetKeys, {|x| x[ KEY ] == anKey } ) ) == 0
if ISBLOCK( bBlock )
aAdd( s_aSetKeys, { anKey, bBlock, bCondition } )
endif
else
aKey := s_aSetKeys[ nFound ]
if aKey[ CONDITION ] == NIL .or. eval( aKey[ CONDITION ], anKey )
bReturn := aKey[ BLOCK ]
endif
if ISBLOCK( bBlock )
aKey[ BLOCK ] := bBlock
aKey[ CONDITION ] := bCondition
elseif pcount() > 1 .and. bBlock == NIL
aSize( aDel( s_aSetKeys, nFound ), len( s_aSetKeys ) - 1 )
endif
endif
else
aKey := s_aSetKeys[ nFound ]
if aKey[ CONDITION ] == NIL .or. eval( aKey[ CONDITION ], anKey )
bReturn := aKey[ BLOCK ]
endif
if ISBLOCK( bBlock )
aKey[ BLOCK ] := bBlock
aKey[ CONDITION ] := bCondition
elseif pcount() > 1 .and. bBlock == NIL
aSize( aDel( s_aSetKeys, nFound ), len( s_aSetKeys ) - 1 )
endif
endif
endif
endif
return bReturn
Function HB_SetKeyGet( nKey, bCondition )
local nFound
local nFound
if ISNUMBER( nKey ) .and. nKey <> 0
if ( nFound := aScan( s_aSetKeys, {|x| x[ KEY ] == nKey } ) ) == 0
bCondition := NIL
else
bCondition := s_aSetKeys[ nFound, CONDITION ]
return s_aSetKeys[ nFound, BLOCK ]
endif
endif
if ISNUMBER( nKey ) .and. nKey <> 0
if ( nFound := aScan( s_aSetKeys, {|x| x[ KEY ] == nKey } ) ) == 0
bCondition := NIL
else
bCondition := s_aSetKeys[ nFound, CONDITION ]
return s_aSetKeys[ nFound, BLOCK ]
endif
endif
return NIL //bReturn
return NIL
Function HB_SetKeySave( OldKeys )
local aReturn := aClone( s_aSetKeys )
if pcount() != 0 .or. ISARRAY( OldKeys )
if OldKeys == NIL
s_aSetKeys := {}
else
s_aSetKeys := aClone( OldKeys )
endif
endif
local aReturn := aClone( s_aSetKeys )
if pcount() != 0 .or. ISARRAY( OldKeys )
if OldKeys == NIL
s_aSetKeys := {}
else
s_aSetKeys := aClone( OldKeys )
endif
endif
return aReturn
Function HB_SetKeyCheck( nKey, p1, p2, p3 )
local nFound, aKey, bBlock
if ( nFound := aScan( s_aSetKeys, {|x| x[ KEY ] == nKey } ) ) > 0
aKey := s_aSetKeys[ nFound ]
bBLock := aKey[ BLOCK ]
if aKey[ CONDITION ] == NIL .or. eval( aKey[ CONDITION ], nKey )
// is this overkill? if a code-block checks its own pcount(),
// passing nil parameters would skew the count!
do case
case pcount() == 1 ; eval( bBlock, nKey )
case pcount() == 2 ; eval( bBlock, p1, nKey )
case pcount() == 3 ; eval( bBlock, p1, p2, nKey )
otherwise ; eval( bBlock, p1, p2, p3, nKey )
end case
return .t.
endif
endif
local nFound
local aKey
local bBlock
if ( nFound := aScan( s_aSetKeys, {|x| x[ KEY ] == nKey } ) ) > 0
aKey := s_aSetKeys[ nFound ]
bBLock := aKey[ BLOCK ]
if aKey[ CONDITION ] == NIL .or. eval( aKey[ CONDITION ], nKey )
// is this overkill? if a code-block checks its own pcount(),
// passing nil parameters would skew the count!
do case
case pcount() == 1 ; eval( bBlock, nKey )
case pcount() == 2 ; eval( bBlock, p1, nKey )
case pcount() == 3 ; eval( bBlock, p1, p2, nKey )
otherwise ; eval( bBlock, p1, p2, p3, nKey )
end case
return .t.
endif
endif
return .f.

View File

@@ -659,11 +659,11 @@ function Updated()
return .f.
function GetApplyKey( oGet, nKey )
procedure GetApplyKey( oGet, nKey )
if s_oGetListActive != nil
s_oGetListActive:oGet := oGet
s_oGetListActive:GetApplyKey( nKey )
endif
return nil
return