2000-11-27 08:25 UTC+0800 Ron Pinkas <ron@profit-master.com>

* include/hbapi.h
   * source/rtl/idle.c
     + Added hb_idleReset()
   * source/rtl/inkey.c
     * Replaced direct idle flags reset with call to hb_idleReset()
   * tests/testidle.prg
     + Added 2nd block test.

   + tests/testget.prg
     + Added test for plain gets, array gets, macro gets, and object data gets.

   * hb_slex.bc
   * include/hbver.h
   * source/common/hbver.c
   * source/compiler/genc.c
   * source/compiler/genjava.c
   * source/compiler/genobj32.c
   * source/compiler/hbusage.c
     + Added HB_VER_LEX macro and added to Build Info.

   * config/dos/djgpp.cf
   * config/linux/gcc.cf
   * config/w32/bcc32.cf
   * config/w32/gcc.cf
     + Added -DSIMPLEX to C[LIB]FLAGS of SimpLex build
This commit is contained in:
Ron Pinkas
2000-11-27 19:17:44 +00:00
parent c963ded268
commit 2c5ad9f51d
17 changed files with 130 additions and 62 deletions

View File

@@ -1,3 +1,30 @@
2000-11-27 08:25 UTC+0800 Ron Pinkas <ron@profit-master.com>
* include/hbapi.h
* source/rtl/idle.c
+ Added hb_idleReset()
* source/rtl/inkey.c
* Replaced direct idle flags reeset with call to hb_idleReset()
* tests/testidle.prg
+ Added 2nd block test.
+ tests/testget.prg
+ Added test for plain gets, array gets, macro gets, and object data gets.
* hb_slex.bc
* include/hbver.h
* source/common/hbver.c
* source/compiler/genc.c
* source/compiler/genjava.c
* source/compiler/genobj32.c
* source/compiler/hbusage.c
+ Added HB_VER_LEX macro and added to Build Info.
* config/dos/djgpp.cf
* config/linux/gcc.cf
* config/w32/bcc32.cf
* config/w32/gcc.cf
+ Added -DSIMPLEX to C[LIB]FLAGS of SimpLex build
2000-11-27 18:55 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
*source/rtl/idle.c
*source/rtl/inkey.c

View File

@@ -13,7 +13,11 @@ CC = gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS = -Wall -DSIMPLEX
else
CFLAGS = -Wall
endif
LD = gcc
LD_OUT = -o

View File

@@ -13,7 +13,11 @@ CC = gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS = -Wall -g -DSIMPLEX
else
CFLAGS = -Wall -g
endif
LD = gcc
LD_OUT = -o

View File

@@ -1,4 +1,4 @@
#
#
# $Id$
#
# The Harbour Project
@@ -24,7 +24,11 @@ CC = bcc32
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I$(GRANDP) -I$(HB_INC_COMPILE)
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS = -O2 -d -DSIMPLEX
else
CFLAGS = -O2 -d
endif
LD = bcc32
LDFLAGS = -O2

View File

@@ -13,7 +13,11 @@ CC = gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS = -Wall -DSIMPLEX
else
CFLAGS = -Wall
endif
LD = gcc
LD_OUT = -o

View File

@@ -95,7 +95,7 @@ HBPDF_DIR = contrib\pdflib
#
CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS)
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) -DSIMPLEX
CLIBFLAGSDEBUG = -v $(CLIBFLAGS)
!if $d(PDF)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) -dPDF
@@ -705,7 +705,7 @@ $(OBJ_DIR)\pplib.obj : $(PP_DIR)\pplib.c
tlib $(PP_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\pptable.obj : $(PP_DIR)\pptable.c
$(CC) $(CLIBFLAGS) -DSIMPLEX -o$@ $**
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(PP_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\pragma.obj : $(PP_DIR)\pragma.c
@@ -791,7 +791,7 @@ $(OBJ_DIR)\genhrb.obj : $(COMPILER_DIR)\genhrb.c
$(CC) $(CLIBFLAGS) -o$@ $**
$(OBJ_DIR)\expropta.obj : $(COMPILER_DIR)\expropta.c
$(CC) $(CLIBFLAGS) -DSIMPLEX -o$@ $**
$(CC) $(CLIBFLAGS) -o$@ $**
$(OBJ_DIR)\exproptb.obj : $(COMPILER_DIR)\exproptb.c
$(CC) $(CLIBFLAGS) -o$@ $**
@@ -1894,7 +1894,7 @@ $(OBJ_DIR)\macroslx.obj : $(MACRO_DIR)\macroslx.c
tlib $(MACRO_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\macroa.obj : $(MACRO_DIR)\macroa.c
$(CC) $(CLIBFLAGS) -DSIMPLEX -o$@ $**
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(MACRO_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\macrob.obj : $(MACRO_DIR)\macrob.c

View File

@@ -538,6 +538,7 @@ extern HB_GARBAGE_FUNC( hb_arrayReleaseGarbage ); /* clear an array before relea
/* idle states */
extern void hb_idleState( void ); /* services a single idle state */
extern void hb_idleReset( void ); /* services a single idle state */
extern void hb_idleShutDown( void ); /* closes all background tasks */
/* misc */

View File

@@ -36,6 +36,11 @@
#ifndef HB_VER_H_
#define HB_VER_H_
#if defined(SIMPLEX)
#define HB_VER_LEX "SimpLex"
#else
#define HB_VER_LEX "Flex"
#endif
#define HB_VER_MAJOR 0 /* Major version number */
#define HB_VER_MINOR 35 /* Minor version number */
#define HB_VER_REVISION "i" /* Revision letter */

View File

@@ -388,7 +388,7 @@ char * hb_verCompiler( void )
{
char szSub[ 32 ];
/* QUESTION: Is there any better, safer, more official way to detect
/* QUESTION: Is there any better, safer, more official way to detect
the bit depth of the C compiler ? [vszakats] */
sprintf( szSub, " (%i bit)", ( int ) ( sizeof( int ) * 8 ) );
strcat( pszCompiler, szSub );
@@ -409,8 +409,8 @@ char * hb_verHarbour( void )
pszVersion = ( char * ) hb_xgrab( 80 );
sprintf( pszVersion, "Harbour %d.%d%s Intl. (Build %d) (%04d.%02d.%02d)",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY );
sprintf( pszVersion, "Harbour %d.%d%s Intl. (Build %d) (%04d.%02d.%02d) (%s)",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY, HB_VER_LEX );
return pszVersion;
}

View File

@@ -70,8 +70,8 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
fflush( stdout );
}
fprintf( yyc, "/*\n * Harbour Compiler, %d.%d%s (Build %d) (%04d.%02d.%02d)\n",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY );
fprintf( yyc, "/*\n * Harbour Compiler, %d.%d%s (Build %d) (%04d.%02d.%02d) (%s)\n",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY, HB_VER_LEX );
fprintf( yyc, " * Generated C source code\n */\n\n" );
if( hb_comp_iFunctionCnt )

View File

@@ -67,8 +67,8 @@ void hb_compGenJava( PHB_FNAME pFileName )
s_nChar = 0;
fprintf( s_yyc, "/*\n * Harbour Compiler, %d.%d%s (Build %d) (%04d.%02d.%02d)\n",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY );
fprintf( s_yyc, "/*\n * Harbour Compiler, %d.%d%s (Build %d) (%04d.%02d.%02d) (%s)\n",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY, HB_VER_LEX );
fprintf( s_yyc, " * Generated JAVA source code\n */\n\n" );
fprintf( s_yyc, "public class %s\n", pFileName->szName );

View File

@@ -84,9 +84,9 @@ void hb_compGenObj32( PHB_FNAME pFileName )
fflush( stdout );
}
sprintf( compiler, "Harbour Compiler %d.%d%s (Build %d) (%04d.%02d.%02d)",
sprintf( compiler, "Harbour Compiler %d.%d%s (Build %d) (%04d.%02d.%02d) (%s)",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR,
HB_VER_MONTH, HB_VER_DAY );
HB_VER_MONTH, HB_VER_DAY, HB_VER_LEX );
CompiledFileName( hObjFile, szFileName );
CompilerVersion( hObjFile, compiler );

View File

@@ -134,8 +134,8 @@ void hb_compPrintCredits( void )
*/
void hb_compPrintLogo( void )
{
printf( "Harbour Compiler %d.%d%s (Build %d) (%04d.%02d.%02d)\n",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY );
printf( "Harbour Compiler %d.%d%s (Build %d) (%04d.%02d.%02d) (%s)\n",
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY, HB_VER_LEX );
printf( "Copyright 1999-2000, http://www.harbour-project.org\n" );
}

View File

@@ -64,10 +64,10 @@ static HB_ITEM_PTR s_pIdleTasks = NULL;
static BOOL s_bIamIdle = FALSE;
/* current task to be executed */
USHORT hb_vm_uiIdleTask = 0;
static USHORT s_uiIdleTask = 0;
/* number of tasks in the list */
USHORT hb_vm_uiIdleMaxTask = 0;
static USHORT s_uiIdleMaxTask = 0;
/* flag to indicate GarbageCollection should be done in idle state. */
BOOL hb_vm_bCollectGarbage = TRUE;
@@ -128,7 +128,6 @@ static void hb_releaseCPU( void )
#endif
}
/* performs all tasks defined for idle state */
void hb_idleState( void )
{
@@ -144,17 +143,17 @@ void hb_idleState( void )
return;
}
if( s_pIdleTasks && hb_vm_uiIdleTask < hb_vm_uiIdleMaxTask )
if( s_pIdleTasks && s_uiIdleTask < s_uiIdleMaxTask )
{
hb_vmEvalBlock( s_pIdleTasks + hb_vm_uiIdleTask );
++hb_vm_uiIdleTask;
hb_vmEvalBlock( s_pIdleTasks + s_uiIdleTask );
++s_uiIdleTask;
s_bIamIdle = FALSE;
return;
}
if( hb_vm_bIdleRepeat && hb_vm_uiIdleTask == hb_vm_uiIdleMaxTask )
if( hb_vm_bIdleRepeat && s_uiIdleTask == s_uiIdleMaxTask )
{
hb_vm_uiIdleTask = 0;
s_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
hb_releaseCPU();
@@ -168,13 +167,22 @@ void hb_idleState( void )
}
}
void hb_idleReset( void )
{
if( s_uiIdleTask == s_uiIdleMaxTask )
{
s_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
}
}
/* close all active background task on program exit */
void hb_idleShutDown( void )
{
if( s_pIdleTasks )
{
HB_ITEM_PTR pItem = s_pIdleTasks;
while( hb_vm_uiIdleMaxTask-- )
while( s_uiIdleMaxTask-- )
{
hb_gcUnlock( pItem->item.asBlock.value );
hb_itemClear( pItem );
@@ -190,9 +198,9 @@ HB_FUNC( HB_IDLESTATE )
{
hb_idleState();
if( hb_vm_uiIdleTask == hb_vm_uiIdleMaxTask )
if( s_uiIdleTask == s_uiIdleMaxTask )
{
hb_vm_uiIdleTask = 0;
s_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
}
}
@@ -204,16 +212,16 @@ HB_FUNC( HB_IDLEADD )
if( pBlock )
{
++hb_vm_uiIdleMaxTask;
++s_uiIdleMaxTask;
if( !s_pIdleTasks )
{
s_pIdleTasks = ( HB_ITEM_PTR ) hb_xgrab( sizeof( HB_ITEM ) );
}
else
{
s_pIdleTasks = ( HB_ITEM_PTR ) hb_xrealloc( s_pIdleTasks, sizeof( HB_ITEM ) * hb_vm_uiIdleMaxTask );
s_pIdleTasks = ( HB_ITEM_PTR ) hb_xrealloc( s_pIdleTasks, sizeof( HB_ITEM ) * s_uiIdleMaxTask );
}
hb_itemCopy( s_pIdleTasks + hb_vm_uiIdleMaxTask - 1, pBlock );
hb_itemCopy( s_pIdleTasks + s_uiIdleMaxTask - 1, pBlock );
/* prevent releasing if this block if it is no longer stored inside of
* a harbour variable
*/
@@ -237,20 +245,20 @@ HB_FUNC( HB_IDLEDEL )
HB_ITEM_PTR pItem = s_pIdleTasks;
iTask = 0;
while( iTask < hb_vm_uiIdleMaxTask && !bFound )
while( iTask < s_uiIdleMaxTask && !bFound )
{
if( ulID == ( ULONG ) pItem->item.asBlock.value )
{
hb_gcUnlockItem( pItem );
hb_itemClear( hb_itemReturn( pItem ) ); /* return a codeblock */
--hb_vm_uiIdleMaxTask;
if( hb_vm_uiIdleMaxTask )
--s_uiIdleMaxTask;
if( s_uiIdleMaxTask )
{
if( iTask != hb_vm_uiIdleMaxTask )
if( iTask != s_uiIdleMaxTask )
memcpy( &s_pIdleTasks[ iTask ], &s_pIdleTasks[ iTask + 1 ],
sizeof( HB_ITEM ) * (hb_vm_uiIdleMaxTask - iTask) );
s_pIdleTasks = ( HB_ITEM_PTR ) hb_xrealloc( s_pIdleTasks, sizeof( HB_ITEM ) * hb_vm_uiIdleMaxTask );
sizeof( HB_ITEM ) * (s_uiIdleMaxTask - iTask) );
s_pIdleTasks = ( HB_ITEM_PTR ) hb_xrealloc( s_pIdleTasks, sizeof( HB_ITEM ) * s_uiIdleMaxTask );
}
else
{

View File

@@ -69,13 +69,6 @@ static BOOL s_inkeyPoll; /* Flag to override no polling when TYPEAHEAD i
static int s_inkeyForce; /* Variable to hold keyboard input when TYPEAHEAD is 0 */
static HB_inkey_enum s_eventmask;
/* current task to be executed */
extern USHORT hb_vm_uiIdleTask;
/* number of tasks in the list */
extern USHORT hb_vm_uiIdleMaxTask;
/* flag to indicate GarbageCollection should be done in idle state. */
extern BOOL hb_vm_bCollectGarbage;
int hb_inkey( BOOL bWait, double dSeconds, HB_inkey_enum event_mask )
{
int key;
@@ -97,12 +90,7 @@ int hb_inkey( BOOL bWait, double dSeconds, HB_inkey_enum event_mask )
{
hb_idleState();
}
if( hb_vm_uiIdleTask == hb_vm_uiIdleMaxTask )
{
hb_vm_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
}
hb_idleReset();
}
}
else
@@ -124,12 +112,7 @@ int hb_inkey( BOOL bWait, double dSeconds, HB_inkey_enum event_mask )
{
hb_idleState();
}
if( hb_vm_uiIdleTask == hb_vm_uiIdleMaxTask )
{
hb_vm_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
}
hb_idleReset();
}
}

30
harbour/tests/testget.prg Normal file
View File

@@ -0,0 +1,30 @@
Procedure Main()
LOCAL GetList := {}, cVar := "Hello"
MEMVAR aVar, nIndex, cMacro
PRIVATE aVar := { "World", "Again" }, nIndex := 1, cMacro := "cEarly", cEarly := "Early", cLate := "Late!"
CLS
? "2nd GET should say 'Early'."
@ 10,10 SAY "cVar :" GET cVar PICTURE "@K!"
@ 12,10 SAY "cMacro :" GET &cMacro
nIndex := 2
@ 14,10 SAY "aVar :" GET aVar[nIndex]
@ 16,10 SAY "Picture of GET-1:" GET GetList[1]:Picture
nIndex := 3
cMacro := "cLate"
READ
CLS
? "This GET should say 'Late!'."
cMacro := "cEarly"
@ 10,10 SAY "cMacro :" GET &(cMacro)
cMacro := "cLate"
READ
RETURN

View File

@@ -2,12 +2,8 @@
PROCEDURE MAIN()
LOCAL bIdle := {|| QOut( "Idle Block" ) }
CLS
? _SET_IDLEREPEAT
? "DEFAULT IDLEREPEAT =", SET( _SET_IDLEREPEAT )
?
? "Idle Block should be displayed multiple times until key or 10 seconds elapsed!"
@@ -15,18 +11,20 @@ PROCEDURE MAIN()
?
Inkey(0)
HB_IDLEADD( bIdle )
HB_IDLEADD( {|| QOut( "Idle Block" ) } )
Inkey( 2 )
SET( _SET_IDLEREPEAT, .F. )
HB_IDLEADD( {|| QOut( "Idle Block2" ) } )
CLS
? "Idle Block should display ONCE! while waitning for key or 10 seconds elapsed!"
? "Idle Block & Block-2 should display ONCE! while waitning for key or 10 seconds elapsed!"
?
Inkey( 2 )
?
? "Again - Idle Block should display ONCE! while waitning for key or 10 seconds elapsed!"
? "Again - Idle Block & Block-2 should display ONCE! while waitning for key or 10 seconds elapsed!"
?
Inkey( 2 )
?