2006-07-07 12:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/libct/ctwfunc.c
    + added missing header note

  * harbour/include/hbapigt.h
  * harbour/include/hbgtcore.h
  * harbour/include/hbgtinfo.ch
  * harbour/source/rtl/gtapi.c
  * harbour/source/rtl/hbgtcore.c
  * harbour/source/rtl/gtcgi/gtcgi.c
  * harbour/source/rtl/gtcrs/gtcrs.c
  * harbour/source/rtl/gtpca/gtpca.c
  * harbour/source/rtl/gtsln/gtsln.c
  * harbour/source/rtl/gtstd/gtstd.c
    * started basic modifications for multi CDP unicode screen buffer
      added hb_gtSetFlag(), removed hb_gt_SetCompatBuffer(),
      added GTI_STDOUTCON, GTI_STDERRCON, etc.

  * harbour/source/vm/arrays.c
    ! fixed bug I introduce recently in AEVAL and additional range checking
    * minor optimizations in ASCAN
This commit is contained in:
Przemyslaw Czerpak
2006-07-07 10:13:23 +00:00
parent 941c119340
commit e4f4ea7783
13 changed files with 247 additions and 199 deletions

View File

@@ -8,6 +8,28 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* harbour/source/vm/classes.c
+ added HB_ARRAY_OBJ() and changed HB_IS_OBJECT() to use it
instead of HB_OBJ_CLASS() - it allows to use HB_IS_OBJECT()
without including hbapicls.h
2006-07-07 12:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/libct/ctwfunc.c
+ added missing header note
* harbour/include/hbapigt.h
* harbour/include/hbgtcore.h
* harbour/include/hbgtinfo.ch
* harbour/source/rtl/gtapi.c
* harbour/source/rtl/hbgtcore.c
* harbour/source/rtl/gtcgi/gtcgi.c
* harbour/source/rtl/gtcrs/gtcrs.c
* harbour/source/rtl/gtpca/gtpca.c
* harbour/source/rtl/gtsln/gtsln.c
* harbour/source/rtl/gtstd/gtstd.c
* started basic modifications for multi CDP unicode screen buffer
added hb_gtSetFlag(), removed hb_gt_SetCompatBuffer(),
added GTI_STDOUTCON, GTI_STDERRCON, etc.
* harbour/source/vm/arrays.c
! fixed bug I introduce recently in AEVAL and additional range checking

View File

@@ -1,3 +1,55 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Clipper Tools like window system
*
* Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.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 "hbapi.h"
#include "hbapigt.h"
#include "ctwin.h"

View File

@@ -193,6 +193,7 @@ extern HB_EXPORT ERRCODE hb_gtOutErr( BYTE * pbyStr, ULONG ulLen );
extern HB_EXPORT ERRCODE hb_gtSetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox );
extern HB_EXPORT ERRCODE hb_gtSetKeyCP( char * pszTermCDP, char * pszHostCDP );
extern HB_EXPORT ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo );
extern HB_EXPORT int hb_gtSetFlag( int iType, int iNewValue );
extern HB_EXPORT int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor );
extern HB_EXPORT ERRCODE hb_gtGfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth );

View File

@@ -169,7 +169,6 @@ typedef struct
BOOL (* GetBlink) ( void );
void (* SetBlink) ( BOOL );
void (* SetSnowFlag) ( BOOL );
void (* SetCompatBuffer) ( BOOL );
char * (* Version) ( int );
BOOL (* Suspend) ( void );
BOOL (* Resume) ( void );
@@ -180,6 +179,7 @@ typedef struct
void (* Tone) ( double, double );
void (* Bell) ( void );
BOOL (* Info) ( int, PHB_GT_INFO );
BOOL (* SetFlag) ( int, int );
/* internationalization */
BOOL (* SetDispCP) ( char *, char *, BOOL );
@@ -332,7 +332,6 @@ extern BOOL hb_gt_PutScrChar( int iRow, int iCol, BYTE bColor, BYTE bAttr, USH
extern BOOL hb_gt_GetBlink( void );
extern void hb_gt_SetBlink( BOOL fBlink );
extern void hb_gt_SetSnowFlag( BOOL fNoSnow );
extern void hb_gt_SetCompatBuffer( BOOL fCompat );
extern void hb_gt_DispBegin( void );
extern void hb_gt_DispEnd( void );
extern int hb_gt_DispCount( void );
@@ -377,6 +376,7 @@ extern void hb_gt_OutErr( BYTE * pbyStr, ULONG ulLen );
extern BOOL hb_gt_SetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox );
extern BOOL hb_gt_SetKeyCP( char * pszTermCDP, char * pszHostCDP );
extern BOOL hb_gt_Info( int iType, PHB_GT_INFO pInfo );
extern int hb_gt_SetFlag( int iType, int iNewValue );
extern int hb_gt_ReadKey( int iEventMask );
extern void hb_mouse_Init( void );
extern void hb_mouse_Exit( void );
@@ -435,7 +435,6 @@ extern void hb_gt_WhoCares( void * pCargo );
#define HB_GTSUPER_GETBLINK() (HB_GTSUPER)->GetBlink()
#define HB_GTSUPER_SETBLINK(b) (HB_GTSUPER)->SetBlink(b)
#define HB_GTSUPER_SETSNOWFLAG(b) (HB_GTSUPER)->SetSnowFlag(b)
#define HB_GTSUPER_SETCOMPATBUFFER(b) (HB_GTSUPER)->SetCompatBuffer(b)
#define HB_GTSUPER_DISPBEGIN() (HB_GTSUPER)->DispBegin()
#define HB_GTSUPER_DISPEND() (HB_GTSUPER)->DispEnd()
#define HB_GTSUPER_DISPCOUNT() (HB_GTSUPER)->DispCount()
@@ -480,6 +479,7 @@ extern void hb_gt_WhoCares( void * pCargo );
#define HB_GTSUPER_SETDISPCP(t,h,b) (HB_GTSUPER)->SetDispCP(t,h,b)
#define HB_GTSUPER_SETKEYCP(t,h) (HB_GTSUPER)->SetKeyCP(t,h)
#define HB_GTSUPER_INFO(i,p) (HB_GTSUPER)->Info(i,p)
#define HB_GTSUPER_SETFLAG(i,f) (HB_GTSUPER)->Info(i,f)
#define HB_GTSUPER_READKEY(m) (HB_GTSUPER)->ReadKey(m)
#define HB_GTSUPER_MOUSEINIT() (HB_GTSUPER)->MouseInit()
#define HB_GTSUPER_MOUSEEXIT() (HB_GTSUPER)->MouseExit()

View File

@@ -110,6 +110,10 @@
#define GTI_VIEWPORTHEIGHT 36 /* Current viewport height:for current mode */
#define GTI_VIEWPORTWIDTH 37 /* Current viewport width:either win or full scrn */
#define GTI_STDOUTCON 38 /* redirect STDOUT to console */
#define GTI_STDERRCON 39 /* redirect STDERR to console */
/* these are used _by_ MaxRow/Col */
#define GTI_WINDOW 0 /* Maximum window size ('window' in CT terms) */
#define GTI_SCREEN 1 /* Maximum screen size ('Screen' in CT terms) */

View File

@@ -334,15 +334,6 @@ HB_EXPORT ERRCODE hb_gtSetSnowFlag( BOOL fNoSnow )
return SUCCESS;
}
HB_EXPORT ERRCODE hb_gtSetCompatBuffer( BOOL fCompat )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gtSetCompatBuffer(%d)", (int) fCompat));
hb_gt_SetCompatBuffer( fCompat );
return SUCCESS;
}
HB_EXPORT ERRCODE hb_gtRectSize( int iTop, int iLeft, int iBottom, int iRight, ULONG * pulBuffSize )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gtRectSize(%d, %d, %d, %d, %p)", iTop, iLeft, iBottom, iRight, pulBuffSize));
@@ -608,6 +599,11 @@ ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo )
return FAILURE;
}
int hb_gtSetFlag( int iType, int iNewValue )
{
return hb_gt_SetFlag( iType, iNewValue );
}
int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor )
{
int iResult;

View File

@@ -124,6 +124,7 @@ static void hb_gt_cgi_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE
hb_fsSetDevMode( s_hFilenoStdout, FD_BINARY );
HB_GTSUPER_INIT( hFilenoStdin, hFilenoStdout, hFilenoStderr );
hb_gt_SetFlag( GTI_STDOUTCON, TRUE );
}
static void hb_gt_cgi_Exit( void )

View File

@@ -2469,7 +2469,7 @@ static void hb_gt_crs_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE
add_new_ioBase( ioBase );
HB_GTSUPER_INIT( hFilenoStdin, hFilenoStdout, hFilenoStderr );
HB_GTSUPER_RESIZE( s_ioBase->maxrow, s_ioBase->maxcol );
hb_gt_SetCompatBuffer( FALSE );
hb_gt_SetFlag( GTI_COMPATBUFFER, FALSE );
hb_gt_SetBlink( TRUE );
}
}

View File

@@ -492,6 +492,8 @@ static void hb_gt_pca_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE
}
HB_GTSUPER_RESIZE( iRows, iCols );
hb_gt_SetFlag( GTI_STDOUTCON, TRUE );
hb_gt_SetFlag( GTI_STDERRCON, s_bStderrConsole );
hb_gt_pca_AnsiInit();
hb_gt_pca_AnsiGetCurPos( &s_iRow, &s_iCol );
@@ -771,26 +773,6 @@ static BOOL hb_gt_pca_Resume()
return TRUE;
}
static void hb_gt_pca_OutStd( BYTE * pbyStr, ULONG ulLen )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_OutStd(%s,%lu)", pbyStr, ulLen ) );
if( s_bStdoutConsole )
hb_gt_WriteCon( pbyStr, ulLen );
else
HB_GTSUPER_OUTSTD( pbyStr, ulLen );
}
static void hb_gt_pca_OutErr( BYTE * pbyStr, ULONG ulLen )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_OutErr(%s,%lu)", pbyStr, ulLen ) );
if( s_bStderrConsole )
hb_gt_WriteCon( pbyStr, ulLen );
else
HB_GTSUPER_OUTERR( pbyStr, ulLen );
}
static BOOL hb_gt_pca_SetDispCP( char *pszTermCDP, char *pszHostCDP, BOOL fBox )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_SetDispCP(%s,%s,%d)", pszTermCDP, pszHostCDP, (int) fBox ) );
@@ -940,8 +922,6 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
pFuncTable->Version = hb_gt_pca_Version;
pFuncTable->Suspend = hb_gt_pca_Suspend;
pFuncTable->Resume = hb_gt_pca_Resume;
pFuncTable->OutStd = hb_gt_pca_OutStd;
pFuncTable->OutErr = hb_gt_pca_OutErr;
pFuncTable->SetDispCP = hb_gt_pca_SetDispCP;
pFuncTable->SetKeyCP = hb_gt_pca_SetKeyCP;
pFuncTable->Tone = hb_gt_pca_Tone;

View File

@@ -689,7 +689,10 @@ static void hb_gt_sln_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE
hb_gt_sln_mouse_Init();
HB_GTSUPER_INIT( hFilenoStdin, hFilenoStdout, hFilenoStderr );
HB_GTSUPER_RESIZE( SLtt_Screen_Rows, SLtt_Screen_Cols );
hb_gt_SetCompatBuffer( FALSE );
hb_gt_SetFlag( GTI_COMPATBUFFER, FALSE );
hb_gt_SetFlag( GTI_STDOUTCON, s_fStdOutTTY );
hb_gt_SetFlag( GTI_STDERRCON, s_fStdErrTTY );
hb_gt_SetBlink( TRUE );
hb_gt_SetPos( SLsmg_get_row(), SLsmg_get_column() );
}
@@ -814,37 +817,6 @@ static char * hb_gt_sln_Version( int iType )
/* *********************************************************************** */
static void hb_gt_sln_OutStd( BYTE * pbyStr, ULONG ulLen )
{
if( s_fStdOutTTY )
{
SLsmg_set_color( ( int )( ( unsigned char )( hb_gt_GetColor() - 7 ) ) );
SLsmg_write_nchars( ( char * ) pbyStr, ulLen );
SLsmg_refresh();
}
else
HB_GTSUPER_OUTSTD( pbyStr, ulLen );
}
/* *********************************************************************** */
static void hb_gt_sln_OutErr( BYTE * pbyStr, ULONG ulLen )
{
if( s_fStdErrTTY )
{
int Save_SLang_TT_Write_FD = SLang_TT_Write_FD;
SLang_TT_Write_FD = s_hStdErr;
SLsmg_set_color( ( int )( ( unsigned char )( hb_gt_GetColor() - 7 ) ) );
SLsmg_write_nchars( ( char * ) pbyStr, ulLen );
SLsmg_refresh();
SLang_TT_Write_FD = Save_SLang_TT_Write_FD;
}
else
HB_GTSUPER_OUTERR( pbyStr, ulLen );
}
/* *********************************************************************** */
/* NOTE: these two are for prepare Slang to temporary
finish its work. They should be called from run.c. */
@@ -1033,8 +1005,6 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
pFuncTable->Resume = hb_gt_sln_Resume;
pFuncTable->PreExt = hb_gt_sln_PreExt;
pFuncTable->PostExt = hb_gt_sln_PostExt;
pFuncTable->OutStd = hb_gt_sln_OutStd;
pFuncTable->OutErr = hb_gt_sln_OutErr;
pFuncTable->Tone = hb_gt_sln_Tone;
pFuncTable->Info = hb_gt_sln_Info;
pFuncTable->SetDispCP = hb_gt_sln_SetDispCP;

View File

@@ -232,6 +232,8 @@ static void hb_gt_std_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE
SetConsoleMode( ( HANDLE ) hb_fsGetOsHandle( s_hFilenoStdin ), 0x0000 );
}
#endif
hb_gt_SetFlag( GTI_STDOUTCON, TRUE );
hb_gt_SetFlag( GTI_STDERRCON, s_bStderrConsole );
}
static void hb_gt_std_Exit( void )
@@ -389,26 +391,6 @@ static BOOL hb_gt_std_Resume()
return TRUE;
}
static void hb_gt_std_OutStd( BYTE * pbyStr, ULONG ulLen )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_OutStd(%s,%lu)", pbyStr, ulLen ) );
if( s_bStdoutConsole )
hb_gt_WriteCon( pbyStr, ulLen );
else
HB_GTSUPER_OUTSTD( pbyStr, ulLen );
}
static void hb_gt_std_OutErr( BYTE * pbyStr, ULONG ulLen )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_OutErr(%s,%lu)", pbyStr, ulLen ) );
if( s_bStderrConsole )
hb_gt_WriteCon( pbyStr, ulLen );
else
HB_GTSUPER_OUTERR( pbyStr, ulLen );
}
static void hb_gt_std_Scroll( int iTop, int iLeft, int iBottom, int iRight,
BYTE bColor, BYTE bChar, int iRows, int iCols )
{
@@ -672,8 +654,6 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
pFuncTable->Version = hb_gt_std_Version;
pFuncTable->Suspend = hb_gt_std_Suspend;
pFuncTable->Resume = hb_gt_std_Resume;
pFuncTable->OutStd = hb_gt_std_OutStd;
pFuncTable->OutErr = hb_gt_std_OutErr;
pFuncTable->SetDispCP = hb_gt_std_SetDispCP;
pFuncTable->SetKeyCP = hb_gt_std_SetKeyCP;
pFuncTable->Tone = hb_gt_std_Tone;

View File

@@ -67,9 +67,11 @@
#include <time.h>
static PHB_GT_BASE s_curGT = NULL;
static BOOL s_fVgaCell = TRUE;
static BOOL s_fIsColor = TRUE;
static BOOL s_fBlinking = TRUE;
static BOOL s_fVgaCell = TRUE;
static BOOL s_fIsColor = TRUE;
static BOOL s_fBlinking = TRUE;
static BOOL s_fStdOutCon = FALSE;
static BOOL s_fStdErrCon = FALSE;
static int s_iCursorShape = SC_NORMAL;
static USHORT s_uiDispCount = 0;
static USHORT s_uiExtCount = 0;
@@ -633,11 +635,6 @@ static void hb_gt_def_SetSnowFlag( BOOL fNoSnow )
HB_SYMBOL_UNUSED( fNoSnow );
}
static void hb_gt_def_SetCompatBuffer( BOOL fCompat )
{
s_fVgaCell = fCompat;
}
static void hb_gt_def_DispBegin( void )
{
++s_uiDispCount;
@@ -683,19 +680,32 @@ static BOOL hb_gt_def_Resume()
return hb_gt_PostExt();
}
static void hb_gt_def_OutFile( FHANDLE hFile, BYTE * pbyStr, ULONG ulLen )
{
USHORT uiErrorOld;
uiErrorOld = hb_fsError();
hb_fsWriteLarge( hFile, pbyStr, ulLen );
hb_fsSetError( uiErrorOld );
}
static void hb_gt_def_OutStd( BYTE * pbyStr, ULONG ulLen )
{
if( ulLen )
{
USHORT uiErrorOld;
if( s_curGT )
hb_gt_PreExt();
uiErrorOld = hb_fsError();
hb_fsWriteLarge( s_hStdOut, ( BYTE * ) pbyStr, ulLen );
hb_fsSetError( uiErrorOld );
if( s_curGT )
hb_gt_PostExt();
{
if( s_fStdOutCon )
hb_gt_WriteCon( pbyStr, ulLen );
else
{
hb_gt_PreExt();
hb_gt_def_OutFile( s_hStdOut, pbyStr, ulLen );
hb_gt_PostExt();
}
}
else
hb_gt_def_OutFile( s_hStdOut, pbyStr, ulLen );
}
}
@@ -703,15 +713,19 @@ static void hb_gt_def_OutErr( BYTE * pbyStr, ULONG ulLen )
{
if( ulLen )
{
USHORT uiErrorOld;
if( s_curGT )
hb_gt_PreExt();
uiErrorOld = hb_fsError();
hb_fsWriteLarge( s_hStdErr, ( BYTE * ) pbyStr, ulLen );
hb_fsSetError( uiErrorOld );
if( s_curGT )
hb_gt_PostExt();
{
if( s_fStdErrCon )
hb_gt_WriteCon( pbyStr, ulLen );
else
{
hb_gt_PreExt();
hb_gt_def_OutFile( s_hStdErr, pbyStr, ulLen );
hb_gt_PostExt();
}
}
else
hb_gt_def_OutFile( s_hStdErr, pbyStr, ulLen );
}
}
@@ -1456,6 +1470,31 @@ static BOOL hb_gt_def_Info( int iType, PHB_GT_INFO pInfo )
return TRUE;
}
static int hb_gt_def_SetFlag( int iType, int iNewValue )
{
int iPrevValue = 0;
switch ( iType )
{
case GTI_COMPATBUFFER:
iPrevValue = s_fVgaCell;
s_fVgaCell = iNewValue != 0;
break;
case GTI_STDOUTCON:
iPrevValue = s_fStdOutCon;
s_fStdOutCon = iNewValue != 0;
break;
case GTI_STDERRCON:
iPrevValue = s_fStdErrCon;
s_fStdErrCon = iNewValue != 0;
break;
}
return iPrevValue;
}
static BOOL hb_gt_def_SetMode( int iRows, int iCols )
{
return hb_gt_Resize( iRows, iCols );
@@ -2018,7 +2057,6 @@ static HB_GT_FUNCS gtCoreFunc =
GetBlink : hb_gt_def_GetBlink ,
SetBlink : hb_gt_def_SetBlink ,
SetSnowFlag : hb_gt_def_SetSnowFlag ,
SetCompatBuffer : hb_gt_def_SetCompatBuffer ,
Version : hb_gt_def_Version ,
Suspend : hb_gt_def_Suspend ,
Resume : hb_gt_def_Resume ,
@@ -2029,6 +2067,7 @@ static HB_GT_FUNCS gtCoreFunc =
Tone : hb_gt_def_Tone ,
Bell : hb_gt_def_Bell ,
Info : hb_gt_def_Info ,
SetFlag : hb_gt_def_SetFlag ,
SetDispCP : hb_gt_def_SetDispCP ,
SetKeyCP : hb_gt_def_SetKeyCP ,
ReadKey : hb_gt_def_ReadKey ,
@@ -2124,7 +2163,6 @@ static HB_GT_FUNCS gtCoreFunc =
hb_gt_def_GetBlink ,
hb_gt_def_SetBlink ,
hb_gt_def_SetSnowFlag ,
hb_gt_def_SetCompatBuffer ,
hb_gt_def_Version ,
hb_gt_def_Suspend ,
hb_gt_def_Resume ,
@@ -2135,6 +2173,7 @@ static HB_GT_FUNCS gtCoreFunc =
hb_gt_def_Tone ,
hb_gt_def_Bell ,
hb_gt_def_Info ,
hb_gt_def_SetFlag ,
hb_gt_def_SetDispCP ,
hb_gt_def_SetKeyCP ,
hb_gt_def_ReadKey ,
@@ -2308,11 +2347,6 @@ void hb_gt_SetSnowFlag( BOOL fNoSnow )
gtCoreFunc.SetSnowFlag( fNoSnow );
}
void hb_gt_SetCompatBuffer( BOOL fCompat )
{
gtCoreFunc.SetCompatBuffer( fCompat );
}
void hb_gt_DispBegin( void )
{
gtCoreFunc.DispBegin();
@@ -2543,6 +2577,11 @@ BOOL hb_gt_Info( int iType, PHB_GT_INFO pInfo )
return gtCoreFunc.Info( iType, pInfo );
}
int hb_gt_SetFlag( int iType, int iNewValue )
{
return gtCoreFunc.SetFlag( iType, iNewValue );
}
int hb_gt_ReadKey( int iEventMask )
{
return gtCoreFunc.ReadKey( iEventMask );

View File

@@ -591,92 +591,99 @@ ULONG hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, ULONG * pulStart, ULONG *
ULONG ulStart;
ULONG ulCount;
if( pulStart && ( *pulStart >= 1 ) )
ulStart = *pulStart;
if( pulStart && *pulStart )
ulStart = *pulStart - 1;
else
ulStart = 1;
ulStart = 0;
if( ulStart <= ulLen )
if( ulStart < ulLen )
{
if( pulCount && ( *pulCount <= ulLen - ulStart ) )
ulCount = ulLen - ulStart;
if( pulCount && *pulCount < ulCount )
ulCount = *pulCount;
else
ulCount = ulLen - ulStart + 1;
if( ulStart + ulCount > ulLen ) /* check range */
ulCount = ulLen - ulStart + 1;
/* Make separate search loops for different types to find, so that
the loop can be faster. */
if( HB_IS_BLOCK( pValue ) )
if( ulCount > 0 )
{
for( --ulStart; ulCount > 0; --ulCount )
{
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( pValue );
hb_vmPush( pBaseArray->pItems + ulStart );
hb_vmPushLong( ++ulStart );
hb_vmDo( 2 );
/* Make separate search loops for different types to find, so that
the loop can be faster. */
if( HB_IS_LOGICAL( hb_stackReturnItem() ) && hb_stackReturnItem()->item.asLogical.value )
return ulStart; /* arrays start from 1 */
if( HB_IS_BLOCK( pValue ) )
{
do
{
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( pValue );
hb_vmPush( pBaseArray->pItems + ulStart );
hb_vmPushLong( ++ulStart );
hb_vmDo( 2 );
if( HB_IS_LOGICAL( hb_stackReturnItem() ) && hb_stackReturnItem()->item.asLogical.value )
return ulStart;
}
while( --ulCount > 0 && ulStart < pBaseArray->ulLen );
}
}
else if( HB_IS_STRING( pValue ) )
{
for( ulStart--; ulCount > 0; ulCount--, ulStart++ )
else if( HB_IS_STRING( pValue ) )
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart;
do
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart++;
/* NOTE: The order of the pItem and pValue parameters passed to
hb_itemStrCmp() is significant, please don't change it. [vszakats] */
if( HB_IS_STRING( pItem ) && hb_itemStrCmp( pItem, pValue, FALSE ) == 0 )
return ulStart + 1;
/* NOTE: The order of the pItem and pValue parameters passed to
hb_itemStrCmp() is significant, please don't change it. [vszakats] */
if( HB_IS_STRING( pItem ) && hb_itemStrCmp( pItem, pValue, FALSE ) == 0 )
return ulStart;
}
while( --ulCount > 0 );
}
}
else if( HB_IS_NUMERIC( pValue ) )
{
double dValue = hb_itemGetND( pValue );
for( ulStart--; ulCount > 0; ulCount--, ulStart++ )
else if( HB_IS_NUMERIC( pValue ) )
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart;
double dValue = hb_itemGetND( pValue );
if( HB_IS_NUMERIC( pItem ) && hb_itemGetND( pItem ) == dValue )
return ulStart + 1;
do
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart++;
if( HB_IS_NUMERIC( pItem ) && hb_itemGetND( pItem ) == dValue )
return ulStart;
}
while( --ulCount > 0 );
}
}
else if( HB_IS_DATE( pValue ) )
{
long lValue = hb_itemGetDL( pValue ); /* NOTE: This is correct: Get the date as a long value. [vszakats] */
for( ulStart--; ulCount > 0; ulCount--, ulStart++ )
else if( HB_IS_DATE( pValue ) )
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart;
long lValue = hb_itemGetDL( pValue ); /* NOTE: This is correct: Get the date as a long value. [vszakats] */
if( HB_IS_DATE( pItem ) && hb_itemGetDL( pItem ) == lValue )
return ulStart + 1;
do
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart++;
if( HB_IS_DATE( pItem ) && hb_itemGetDL( pItem ) == lValue )
return ulStart;
}
while( --ulCount > 0 );
}
}
else if( HB_IS_LOGICAL( pValue ) )
{
BOOL bValue = hb_itemGetL( pValue );
for( ulStart--; ulCount > 0; ulCount--, ulStart++ )
else if( HB_IS_LOGICAL( pValue ) )
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart;
BOOL bValue = hb_itemGetL( pValue );
if( HB_IS_LOGICAL( pItem ) && hb_itemGetL( pItem ) == bValue )
return ulStart + 1;
do
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart++;
if( HB_IS_LOGICAL( pItem ) && hb_itemGetL( pItem ) == bValue )
return ulStart;
}
while( --ulCount > 0 );
}
}
else if( HB_IS_NIL( pValue ) )
{
for( ulStart--; ulCount > 0; ulCount--, ulStart++ )
else if( HB_IS_NIL( pValue ) )
{
if( HB_IS_NIL( pBaseArray->pItems + ulStart ) )
return ulStart + 1;
do
{
PHB_ITEM pItem = pBaseArray->pItems + ulStart++;
if( HB_IS_NIL( pItem ) )
return ulStart;
}
while( --ulCount > 0 );
}
}
}
@@ -696,20 +703,16 @@ BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, ULONG * pulStart, ULONG * p
ULONG ulStart;
ULONG ulCount;
if( pulStart && ( *pulStart >= 1 ) )
ulStart = *pulStart;
if( pulStart && *pulStart )
ulStart = *pulStart - 1;
else
ulStart = 1;
ulStart = 0;
if( ulStart <= ulLen )
if( ulStart < ulLen )
{
if( pulCount && ( *pulCount <= ulLen - ulStart ) )
ulCount = ulLen - ulStart;
if( pulCount && *pulCount < ulCount )
ulCount = *pulCount;
else
ulCount = ulLen - ulStart + 1;
if( ulStart + ulCount > ulLen ) /* check range */
ulCount = ulLen - ulStart + 1;
if( ulCount > 0 )
{
@@ -717,8 +720,8 @@ BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, ULONG * pulStart, ULONG * p
{
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( bBlock );
hb_vmPush( pBaseArray->pItems + ulStart - 1 );
hb_vmPushLong( ulStart );
hb_vmPush( pBaseArray->pItems + ulStart );
hb_vmPushLong( ulStart + 1 );
hb_vmDo( 2 );
}
while( --ulCount > 0 && ++ulStart < pBaseArray->ulLen );