From b594a5aa2dfd2866017022923a74eac16dfaabcf Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Wed, 22 Nov 2000 02:37:50 +0000 Subject: [PATCH] 2000-11-21 18:35 UTC+0800 Ron Pinkas * source/pp/ppcomp.c * Corrected 1 compiler warning. * source/pp/ppcore.c + Added s_bArray support logic to WorkDefine() * source/rtl/idle.c * Revered order of hb_gcCollectAll() and hb_releaseCPU(); --- harbour/ChangeLog | 10 +++++ harbour/source/pp/ppcomp.c | 4 +- harbour/source/pp/ppcore.c | 84 +++++++++++++++++++++++++------------- harbour/source/rtl/idle.c | 20 ++++----- 4 files changed, 78 insertions(+), 40 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1e4acf0671..2eb1edf195 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +2000-11-21 18:35 UTC+0800 Ron Pinkas + * source/pp/ppcomp.c + * Corrected 1 compiler warning. + + * source/pp/ppcore.c + + Added s_bArray support logic to WorkDefine() + + * source/rtl/idle.c + * Revered order of hb_gcCollectAll() and hb_releaseCPU(); + 2000-11-21 23:42 UTC-0100 JFL (mafact) * source/vm/classes.c * minor modif after the last Stack tests diff --git a/harbour/source/pp/ppcomp.c b/harbour/source/pp/ppcomp.c index 9d5ec2faa6..a87f0b5ca9 100644 --- a/harbour/source/pp/ppcomp.c +++ b/harbour/source/pp/ppcomp.c @@ -270,7 +270,9 @@ int hb_pp_ReadRules( void ) if( rdlen < 0 ) { if( hb_comp_files.iFiles == 1 ) + { return 0; /* we have reached the main EOF */ + } else { CloseInclude(); @@ -280,7 +282,5 @@ int hb_pp_ReadRules( void ) *s_szLine = '\0'; } } - - return lens; } diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 7142e313ef..f88790d882 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -157,6 +157,9 @@ int hb_pp_nCondCompile = 0; char * hb_pp_STD_CH = NULL; +/* Ron Pinkas added 2000-11-21 */ +static BOOL s_bArray = FALSE; + /* Table with parse errors */ char * hb_pp_szErrors[] = { @@ -186,10 +189,6 @@ char * hb_pp_szWarnings[] = "1No directives in command definitions file" }; -/* -extern BOOL bDebug; -*/ - void hb_pp_SetRules( HB_INCLUDE_FUNC_PTR hb_compInclude, BOOL hb_comp_bQuiet ) { HB_TRACE(HB_TR_DEBUG, ("hb_pp_SetRules()")); @@ -964,6 +963,11 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) } } + #if 0 + printf( "Line: >%s<\n", ptri ); + printf( "Out: >%s<\n", ptro ); + #endif + /* Look for definitions from #translate */ stcmd = hb_pp_topTranslate; while( stcmd != NULL ) @@ -971,10 +975,6 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) ptri = sLine + isdvig; lenToken = strlen(stcmd->name); - #if 0 - printf( "Line: >%s<\n", ptri ); - #endif - while( ( ifou = md_strAt( stcmd->name, lenToken, ptri, TRUE, FALSE, FALSE )) > 0 ) { ptri += ifou -1; @@ -1111,23 +1111,52 @@ static int WorkDefine( char ** ptri, char * ptro, DEFINES * stdef ) lens = hb_pp_strocpy( ptro,stdef->value ); } else - { - HB_SKIPTABSPACES( *ptri ); - if( **ptri == '(' ) + { + HB_SKIPTABSPACES( *ptri ); + + if( **ptri == '(' ) + { + npars = 0; ptr = *ptri; + + do { - npars = 0; ptr = *ptri; - do - { - ptr++; - if( NextParm( &ptr, NULL ) > 0 ) npars++; - } - while( *ptr != ')' && *ptr != '\0' ); - if( *ptr == ')' && stdef->npars == npars ) - lens = WorkPseudoF( ptri, ptro, stdef ); - else return -1; + ptr++; + + if( NextParm( &ptr, NULL ) > 0 ) + { + npars++; + } } - else return -1; - } + while( *ptr != ')' && *ptr != '\0' ); + + if( *ptr == ')' && stdef->npars == npars ) + { + /* Ron Pinkas added 2000-11-21 */ + char *pTmp = ptr + 1; + + while( *pTmp && ( *pTmp == ' ' || *pTmp == '\t' ) ) + { + pTmp++; + } + if( *pTmp == '[' ) + { + s_bArray = TRUE; + } + /* END - Ron Pinkas added 2000-11-21 */ + + lens = WorkPseudoF( ptri, ptro, stdef ); + } + else + { + return -1; + } + } + else + { + return -1; + } + } + return lens; } @@ -3049,7 +3078,6 @@ static int NextWord( char ** sSource, char * sDest, BOOL lLower ) static int NextName( char ** sSource, char * sDest ) { /* Ron Pinkas added 2000-11-08 */ - static BOOL s_bArray = FALSE; char cLastChar = '\0', *pString = NULL, *pTmp; /* END - Ron Pinkas added 2000-11-08 */ @@ -3100,6 +3128,7 @@ static int NextName( char ** sSource, char * sDest ) **sSource = '\0'; if( strchr( pString, '"' ) == NULL ) { + printf( "OOps!\n" ); *pString = '"'; **sSource = '"'; } @@ -3253,12 +3282,11 @@ static int NextParm( char ** sSource, char * sDest ) if( sDest != NULL ) { *sDest = '\0'; + #if 0 + printf( "NextParm: >%s<\n", sDest - lenName ); + #endif } - #if 0 - printf( "NextParm: >%s<\n", sDest - lenName ); - #endif - return lenName; } diff --git a/harbour/source/rtl/idle.c b/harbour/source/rtl/idle.c index d713516bba..7dad259e77 100644 --- a/harbour/source/rtl/idle.c +++ b/harbour/source/rtl/idle.c @@ -108,9 +108,9 @@ void hb_idleState( void ) if( ! s_bIamIdle ) { s_bIamIdle = TRUE; - hb_releaseCPU(); hb_gcCollectAll(); - + hb_releaseCPU(); + if( s_pIdleTasks ) { hb_vmEvalBlock( s_pIdleTasks + s_uiIdleTask ); @@ -148,7 +148,7 @@ HB_FUNC( HB_IDLESTATE ) HB_FUNC( HB_IDLEADD ) { HB_ITEM_PTR pBlock = hb_param( 1, HB_IT_BLOCK ); - + if( pBlock ) { ++s_uiIdleMaxTask; @@ -164,8 +164,8 @@ HB_FUNC( HB_IDLEADD ) /* prevent releasing if this block if it is no longer stored inside of * a harbour variable */ - hb_gcLockItem( pBlock ); - + hb_gcLockItem( pBlock ); + hb_retnl( ( ULONG ) pBlock->item.asBlock.value ); /* TODO: access to pointers from harbour code */ } else @@ -176,13 +176,13 @@ HB_FUNC( HB_IDLEADD ) HB_FUNC( HB_IDLEDEL ) { BOOL bFound = FALSE; - + if( s_pIdleTasks && ( hb_parinfo( 1 ) & HB_IT_NUMERIC ) ) { SHORT iTask; ULONG ulID = hb_parnl( 1 ); /* TODO: access to pointers from harbour code */ HB_ITEM_PTR pItem = s_pIdleTasks; - + iTask = 0; while( iTask < s_uiIdleMaxTask && !bFound ) { @@ -190,12 +190,12 @@ HB_FUNC( HB_IDLEDEL ) { hb_gcUnlockItem( pItem ); hb_itemClear( hb_itemReturn( pItem ) ); /* return a codeblock */ - + --s_uiIdleMaxTask; if( s_uiIdleMaxTask ) { if( iTask != s_uiIdleMaxTask ) - memcpy( &s_pIdleTasks[ iTask ], &s_pIdleTasks[ iTask + 1 ], + memcpy( &s_pIdleTasks[ iTask ], &s_pIdleTasks[ iTask + 1 ], sizeof( HB_ITEM ) * (s_uiIdleMaxTask - iTask) ); s_pIdleTasks = ( HB_ITEM_PTR ) hb_xrealloc( s_pIdleTasks, sizeof( HB_ITEM ) * s_uiIdleMaxTask ); } @@ -206,7 +206,7 @@ HB_FUNC( HB_IDLEDEL ) } bFound = TRUE; } - ++pItem; + ++pItem; ++iTask; } }