diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c7314febf1..53ccf8fd7f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,30 @@ +2000-11-27 08:25 UTC+0800 Ron Pinkas + * 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 *source/rtl/idle.c *source/rtl/inkey.c diff --git a/harbour/config/dos/djgpp.cf b/harbour/config/dos/djgpp.cf index 30addb1359..66fbeb3c7b 100644 --- a/harbour/config/dos/djgpp.cf +++ b/harbour/config/dos/djgpp.cf @@ -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 diff --git a/harbour/config/linux/gcc.cf b/harbour/config/linux/gcc.cf index 57782fbf7d..35c5dba5ff 100644 --- a/harbour/config/linux/gcc.cf +++ b/harbour/config/linux/gcc.cf @@ -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 diff --git a/harbour/config/w32/bcc32.cf b/harbour/config/w32/bcc32.cf index dff3844cd2..7c9237be28 100644 --- a/harbour/config/w32/bcc32.cf +++ b/harbour/config/w32/bcc32.cf @@ -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 diff --git a/harbour/config/w32/gcc.cf b/harbour/config/w32/gcc.cf index 11c69524f2..9f06d23db4 100644 --- a/harbour/config/w32/gcc.cf +++ b/harbour/config/w32/gcc.cf @@ -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 diff --git a/harbour/hb_slex.bc b/harbour/hb_slex.bc index 9648bdce7b..9e7ec981aa 100644 --- a/harbour/hb_slex.bc +++ b/harbour/hb_slex.bc @@ -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 diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 22b664e467..011ec69acd 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -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 */ diff --git a/harbour/include/hbver.h b/harbour/include/hbver.h index 7e051693af..75188c18b8 100644 --- a/harbour/include/hbver.h +++ b/harbour/include/hbver.h @@ -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 */ diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index c19054521d..c4760312b5 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -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; } diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index 478785e33d..021d1d65bf 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -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 ) diff --git a/harbour/source/compiler/genjava.c b/harbour/source/compiler/genjava.c index 40fb4d3c90..965a06e781 100644 --- a/harbour/source/compiler/genjava.c +++ b/harbour/source/compiler/genjava.c @@ -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 ); diff --git a/harbour/source/compiler/genobj32.c b/harbour/source/compiler/genobj32.c index 680853ea27..1f4f22c364 100644 --- a/harbour/source/compiler/genobj32.c +++ b/harbour/source/compiler/genobj32.c @@ -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 ); diff --git a/harbour/source/compiler/hbusage.c b/harbour/source/compiler/hbusage.c index 4a63682dc3..597dfb0d7c 100644 --- a/harbour/source/compiler/hbusage.c +++ b/harbour/source/compiler/hbusage.c @@ -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" ); } diff --git a/harbour/source/rtl/idle.c b/harbour/source/rtl/idle.c index 1052040cf6..728a4194ab 100644 --- a/harbour/source/rtl/idle.c +++ b/harbour/source/rtl/idle.c @@ -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 { diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 421dac90ed..d02bb3fd5d 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -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(); } } diff --git a/harbour/tests/testget.prg b/harbour/tests/testget.prg new file mode 100644 index 0000000000..6d61aac6ba --- /dev/null +++ b/harbour/tests/testget.prg @@ -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 + + diff --git a/harbour/tests/testidle.prg b/harbour/tests/testidle.prg index 7301d9f0bc..ef2ba48ac3 100644 --- a/harbour/tests/testidle.prg +++ b/harbour/tests/testidle.prg @@ -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 ) ?