From 181e59a3a6331d6dc0f74ff6119d51200a9bbc44 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Mon, 3 Jan 2005 09:28:58 +0000 Subject: [PATCH] 2005-01-03 10:30 UTC+0100 Ryszard Glab * include/hbcomp.h * include/hbexprb.c * include/hbmacro.h * source/compiler/exproptb.c * source/compiler/harbour.c * source/compiler/hbgenerr.c * source/macro/macrob.c * source/vm/macro.c * compiler reports error on the following syntax now (Clipper compatibility): {|| ¯ovar anysymbol} "codeblock contains both macro and declared symbol reference" Notice, that Clipper reports error even in this case: MEMVAR mvar {|| &mvar,mvar} * source/vm/memvars.c * restored initial and expand sizes for memvars table * source/pp/ppcore.c * some empty lines added --- harbour/ChangeLog | 29 ++++++++++ harbour/include/hbcomp.h | 6 ++- harbour/include/hbexprb.c | 85 ++++++++++++++++++++---------- harbour/include/hbmacro.h | 2 +- harbour/source/compiler/exproptb.c | 2 +- harbour/source/compiler/harbour.c | 84 ++++++++++++++++++++++------- harbour/source/compiler/hbgenerr.c | 3 +- harbour/source/macro/macrob.c | 2 +- harbour/source/pp/ppcore.c | 48 ++++++++++++----- harbour/source/vm/macro.c | 4 +- harbour/source/vm/memvars.c | 4 +- 11 files changed, 201 insertions(+), 68 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6df47f0c07..d1022cd20d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,35 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2005-01-03 10:30 UTC+0100 Ryszard Glab + * include/hbcomp.h + * include/hbexprb.c + * include/hbmacro.h + * source/compiler/exproptb.c + * source/compiler/harbour.c + * source/compiler/hbgenerr.c + * source/macro/macrob.c + * source/vm/macro.c + * compiler reports error on the following syntax now (Clipper + compatibility): + {|| ¯ovar anysymbol} + "codeblock contains both macro and declared symbol reference" + Notice, that Clipper reports error even in this case: + MEMVAR mvar + {|| &mvar,mvar} + + * source/vm/memvars.c + * restored initial and expand sizes for memvars table + + * source/pp/ppcore.c + * some empty lines added + +2004-12-27 10:37 UTC+0100 Ryszard Glab + * source/vm/memvars.c + * changed algorithm for recycling of unused memvar values + - thanks to Przemek + + 2004-12-31 06:16 UTC-0800 Luis Krause Mantilla * harbour/source/codepage/cdpesmwi.c ! the init values were set to ESWIN instead of ESMWIN diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 926848ce6b..e4309ffb2b 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -171,6 +171,7 @@ typedef struct __FUNC int iStackFunctions; /* Index into DEclared Functions on Compile Time Stack */ PCOMCLASS pStackClasses[ 8 ]; /* Declared Classes on the Compile Time Stack */ int iStackClasses; /* Index into Declared Classes on Compile Time Stack */ + BOOL bLateEval; /* TRUE if accessing of declared (compile time) variables is allowed */ struct __FUNC * pOwner; /* pointer to the function/procedure that owns the codeblock */ struct __FUNC * pNext; /* pointer to the next defined function */ } _FUNC, * PFUNCTION; @@ -353,7 +354,7 @@ extern void hb_compGenMessageData( char * szMsg ); /* generates an underscor extern void hb_compGenPopVar( char * szVarName ); /* generates the pcode to pop a value from the virtual machine stack onto a variable */ extern void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec ); /* Pushes a number on the virtual machine stack */ extern void hb_compGenPushFunCall( char * ); /* generates the pcode to push function's call */ -extern void hb_compGenPushVar( char * szVarName ); /* generates the pcode to push a variable value to the virtual machine stack */ +extern void hb_compGenPushVar( char * szVarName, BOOL bMacroVar ); /* generates the pcode to push a variable value to the virtual machine stack */ extern void hb_compGenPushVarRef( char * szVarName ); /* generates the pcode to push a variable by reference to the virtual machine stack */ extern void hb_compGenPushInteger( int iNumber ); /* Pushes a integer number on the virtual machine stack */ extern void hb_compGenPushLogical( int iTrueFalse ); /* pushes a logical value on the virtual machine stack */ @@ -377,9 +378,10 @@ extern ULONG hb_compSequenceEnd( void ); extern void hb_compSequenceFinish( ULONG, int ); /* Codeblocks */ -extern void hb_compCodeBlockStart( void ); /* starts a codeblock creation */ +extern void hb_compCodeBlockStart( BOOL ); /* starts a codeblock creation */ extern void hb_compCodeBlockEnd( void ); /* end of codeblock creation */ extern void hb_compCodeBlockStop( void ); /* end of fake codeblock */ +extern void hb_compCodeBlockRewind( void ); /* restart of fake codeblock */ /* support for FIELD declaration */ extern void hb_compFieldSetAlias( char *, int ); diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 9c57ef14b7..ca80985a3b 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -179,7 +179,7 @@ static HB_EXPR_FUNC( hb_compExprUseNegate ); #if defined( HB_MACRO_SUPPORT ) static void hb_compExprCodeblockPush( HB_EXPR_PTR, HB_MACRO_DECL ); #else - static void hb_compExprCodeblockPush( HB_EXPR_PTR ); + static void hb_compExprCodeblockPush( HB_EXPR_PTR, BOOL ); #if !defined(SIMPLEX) static void hb_compExprCodeblockEarly( HB_EXPR_PTR ); #endif @@ -365,11 +365,11 @@ static HB_EXPR_FUNC( hb_compExprUseString ) if( HB_SUPPORT_HARBOUR ) { if( bValidMacro ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); - else - { - hb_compErrorMacro( pSelf->value.asString.string ); - } + HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); + else + { + hb_compErrorMacro( pSelf->value.asString.string ); + } } else { @@ -423,11 +423,11 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) HB_EXPR_PCODE1( hb_compExprCodeblockPush, pSelf ); #else if( !pSelf->value.asCodeblock.isMacro || pSelf->value.asCodeblock.lateEval ) - hb_compExprCodeblockPush( pSelf ); + hb_compExprCodeblockPush( pSelf, TRUE ); else { - /* early evaluation of a macro */ - hb_compExprCodeblockEarly( pSelf ); + /* early evaluation of a macro */ + hb_compExprCodeblockEarly( pSelf ); } #endif } @@ -465,18 +465,20 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) #if defined( HB_MACRO_SUPPORT ) static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) #else -static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf ) +static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, BOOL bLateEval ) #endif { HB_EXPR_PTR pExpr, pNext; HB_EXPR_PTR * pPrev; - HB_EXPR_PCODE0( hb_compCodeBlockStart ); /* Define requested local variables */ #if defined( HB_MACRO_SUPPORT ) + HB_EXPR_PCODE0( hb_compCodeBlockStart ); HB_PCODE_DATA->pLocals = pSelf->value.asCodeblock.pLocals; #else + HB_EXPR_PCODE1( hb_compCodeBlockStart, bLateEval ); + { HB_CBVAR_PTR pVar; @@ -520,14 +522,28 @@ static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf ) */ *pPrev = pExpr; /* store a new expression into the previous one */ pExpr->pNext = pNext; /* restore the link to next expression */ +#if defined( HB_MACRO_SUPPORT ) if( pNext ) HB_EXPR_USE( pExpr, HB_EA_PUSH_POP ); else HB_EXPR_USE( pExpr, HB_EA_PUSH_PCODE ); +#else + if( pNext && bLateEval ) + HB_EXPR_USE( pExpr, HB_EA_PUSH_POP ); + else + HB_EXPR_USE( pExpr, HB_EA_PUSH_PCODE ); +#endif pPrev = &pExpr->pNext; pExpr = pNext; } +#if defined( HB_MACRO_SUPPORT ) HB_EXPR_PCODE0( hb_compCodeBlockEnd ); +#else + if( bLateEval ) + HB_EXPR_PCODE0( hb_compCodeBlockEnd ); + else + HB_EXPR_PCODE0( hb_compCodeBlockRewind ); +#endif } /* This generates a push pcode for early evaluation of a macro @@ -562,18 +578,9 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) * {|| &variable+1} => &( '{|| &variable+1}' ) */ HB_EXPR_PTR pNew; - char *szDupl; - BOOL bUseTextSubst; - - HB_EXPR_PCODE0( hb_compCodeBlockStart ); - szDupl = hb_strupr( hb_strdup( pSelf->value.asCodeblock.string ) ); - if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) - { - hb_compErrorCodeblock( pSelf->value.asCodeblock.string ); - hb_compErrorMacro( pSelf->value.asCodeblock.string ); - } - hb_xfree( szDupl ); + hb_compExprCodeblockPush( pSelf, FALSE ); + pNew = hb_compExprNewMacro( hb_compExprNewString(pSelf->value.asCodeblock.string), 0, NULL ); HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE ); hb_compExprDelete( pNew ); @@ -1294,7 +1301,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) /* simple macro variable expansion: &variable * 'szMacro' is a variable name */ - HB_EXPR_PCODE1( hb_compGenPushVar, pSelf->value.asMacro.szMacro ); + HB_EXPR_PCODE2( hb_compGenPushVar, pSelf->value.asMacro.szMacro, TRUE ); } else { @@ -1302,6 +1309,18 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) * all components should be placed as a string that will * be compiled after text susbstitution */ +#if ! defined( HB_MACRO_SUPPORT ) + + BOOL bUseTextSubst; + char *szDupl; + szDupl = hb_strupr( hb_strdup( pSelf->value.asMacro.szMacro ) ); + + if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) + { + hb_compErrorMacro( pSelf->value.asMacro.szMacro ); + } + hb_xfree( szDupl ); +#endif HB_EXPR_PCODE2( hb_compGenPushString, pSelf->value.asMacro.szMacro, strlen(pSelf->value.asMacro.szMacro) + 1 ); } } @@ -1411,7 +1430,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) /* simple macro variable expansion: &variable * 'szMacro' is a variable name */ - HB_EXPR_PCODE1( hb_compGenPushVar, pSelf->value.asMacro.szMacro ); + HB_EXPR_PCODE2( hb_compGenPushVar, pSelf->value.asMacro.szMacro, TRUE ); } else { @@ -1419,6 +1438,18 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) * all components should be placed as a string that will * be compiled after text susbstitution */ +#if ! defined( HB_MACRO_SUPPORT ) + + BOOL bUseTextSubst; + char *szDupl; + szDupl = hb_strupr( hb_strdup( pSelf->value.asMacro.szMacro ) ); + + if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) + { + hb_compErrorMacro( pSelf->value.asMacro.szMacro ); + } + hb_xfree( szDupl ); +#endif HB_EXPR_PCODE2( hb_compGenPushString, pSelf->value.asMacro.szMacro, strlen(pSelf->value.asMacro.szMacro) + 1 ); } } @@ -1952,10 +1983,10 @@ static HB_EXPR_FUNC( hb_compExprUseVariable ) if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_ALIASED ) HB_EXPR_PCODE4( hb_compGenPushAliasedVar, pSelf->value.asSymbol, FALSE, NULL, 0 ); else - HB_EXPR_PCODE1( hb_compGenPushVar, pSelf->value.asSymbol ); + HB_EXPR_PCODE2( hb_compGenPushVar, pSelf->value.asSymbol, FALSE ); } #else - HB_EXPR_PCODE1( hb_compGenPushVar, pSelf->value.asSymbol ); + HB_EXPR_PCODE2( hb_compGenPushVar, pSelf->value.asSymbol, FALSE ); #endif break; @@ -1974,7 +2005,7 @@ static HB_EXPR_FUNC( hb_compExprUseVariable ) case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - HB_EXPR_PCODE1( hb_compGenPushVar, pSelf->value.asSymbol ); + HB_EXPR_PCODE2( hb_compGenPushVar, pSelf->value.asSymbol, FALSE ); HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); break; diff --git a/harbour/include/hbmacro.h b/harbour/include/hbmacro.h index 4d19178a19..21712d1179 100644 --- a/harbour/include/hbmacro.h +++ b/harbour/include/hbmacro.h @@ -140,7 +140,7 @@ extern void hb_compGenPopAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, long lWorkarea, HB_BISON_PTR pMacro ); -extern void hb_compGenPushVar( char * szVarName, HB_BISON_PTR pMacro ); +extern void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_BISON_PTR pMacro ); extern void hb_compGenPushVarRef( char * szVarName, HB_BISON_PTR pMacro ); extern void hb_compGenPushAliasedVar( char * szVarName, BOOL bPushAliasValue, diff --git a/harbour/source/compiler/exproptb.c b/harbour/source/compiler/exproptb.c index e62581b334..eb92d8dcad 100644 --- a/harbour/source/compiler/exproptb.c +++ b/harbour/source/compiler/exproptb.c @@ -5,6 +5,6 @@ /* hbexprb.c is also included from ../macro/macro.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 1.11 - ignore this magic number - this is used to force compilation + * 1.12 - ignore this magic number - this is used to force compilation */ #include "hbexprb.c" diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 66b76a9cfe..dbc13f0add 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -1507,6 +1507,7 @@ static PFUNCTION hb_compFunctionNew( char * szName, HB_SYMBOLSCOPE cScope ) pFunc->iStackIndex = 0; pFunc->iStackFunctions = 0; pFunc->iStackClasses = 0; + pFunc->bLateEval = TRUE; return pFunc; } @@ -2690,6 +2691,22 @@ void hb_compGenMessageData( char * szMsg ) /* generates an underscore-symbol nam hb_compGenMessage( szResult ); } +static void hb_compCheckEarlyMacroEval( char *szVarName ) +{ + int iScope = hb_compVariableScope( szVarName ); + + if( iScope == HB_VS_CBLOCAL_VAR || + iScope == HB_VS_STATIC_VAR || + iScope == HB_VS_GLOBAL_STATIC || + iScope == HB_VS_LOCAL_FIELD || + iScope == HB_VS_GLOBAL_FIELD || + iScope == HB_VS_LOCAL_MEMVAR || + iScope == HB_VS_GLOBAL_MEMVAR ) + { + hb_compErrorCodeblock( szVarName ); + } +} + /* Check variable in the following order: * LOCAL variable * local STATIC variable @@ -2704,6 +2721,13 @@ void hb_compGenPopVar( char * szVarName ) /* generates the pcode to pop a value { int iVar; + if( ! hb_comp_functions.pLast->bLateEval ) + { + /* pseudo-generation of pcode for a codeblock with macro symbol */ + hb_compCheckEarlyMacroEval( szVarName ); + return; + } + iVar = hb_compLocalGetPos( szVarName ); if( iVar ) { @@ -2864,11 +2888,19 @@ void hb_compGenPopAliasedVar( char * szVarName, /* generates the pcode to push a nonaliased variable value to the virtual * machine stack + * bMacroVar is TRUE if macro &szVarName context */ -void hb_compGenPushVar( char * szVarName ) +void hb_compGenPushVar( char * szVarName, BOOL bMacroVar ) { int iVar; + if( ! hb_comp_functions.pLast->bLateEval && ! bMacroVar ) + { + /* pseudo-generation of pcode for a codeblock with macro symbol */ + hb_compCheckEarlyMacroEval( szVarName ); + return; + } + iVar = hb_compLocalGetPos( szVarName ); if( iVar ) { @@ -2964,6 +2996,13 @@ void hb_compGenPushVarRef( char * szVarName ) /* generates the pcode to push a v { int iVar; + if( ! hb_comp_functions.pLast->bLateEval ) + { + /* pseudo-generation of pcode for a codeblock with macro symbol */ + hb_compCheckEarlyMacroEval( szVarName ); + return; + } + iVar = hb_compLocalGetPos( szVarName ); if( iVar ) { @@ -3752,13 +3791,14 @@ void hb_compStaticDefEnd( void ) /* * Start a new fake-function that will hold pcodes for a codeblock */ -void hb_compCodeBlockStart() +void hb_compCodeBlockStart( BOOL bLateEval ) { PFUNCTION pBlock; pBlock = hb_compFunctionNew( NULL, HB_FS_STATIC ); pBlock->pOwner = hb_comp_functions.pLast; pBlock->iStaticsBase = hb_comp_functions.pLast->iStaticsBase; + pBlock->bLateEval = bLateEval; hb_comp_functions.pLast = pBlock; } @@ -3919,9 +3959,7 @@ void hb_compCodeBlockEnd( void ) void hb_compCodeBlockStop( void ) { PFUNCTION pCodeblock; /* pointer to the current codeblock */ - PFUNCTION pFunc; /* pointer to a function that owns a codeblock */ - USHORT wLocals = 0; /* number of referenced local variables */ - USHORT wUsed; + PFUNCTION pFunc;/* pointer to a function that owns a codeblock */ PVAR pVar, pFree; pCodeblock = hb_comp_functions.pLast; @@ -3936,22 +3974,11 @@ void hb_compCodeBlockStop( void ) while( pFunc->pOwner ) pFunc = pFunc->pOwner; - pFunc->bFlags |= ( pCodeblock->bFlags & FUN_USES_STATICS ); - - /* Count the number of referenced local variables */ - pVar = pCodeblock->pStatics; - while( pVar ) - { - pVar = pVar->pNext; - ++wLocals; - } - - wUsed =0; pVar = pCodeblock->pLocals; while( pVar ) { - if( pVar->iUsed & VU_USED ) - wUsed = 1; + if( hb_comp_iWarnings && pFunc->szName && pVar->szName && ! ( pVar->iUsed & VU_USED ) ) + hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_BLOCKVAR_NOT_USED, pVar->szName, pFunc->szName ); /* free used variables */ pFree = pVar; @@ -3965,6 +3992,27 @@ void hb_compCodeBlockStop( void ) hb_xfree( ( void * ) pCodeblock ); } +void hb_compCodeBlockRewind() +{ + PFUNCTION pCodeblock; /* pointer to the current codeblock */ + + pCodeblock = hb_comp_functions.pLast; + pCodeblock->lPCodePos = 0; + + /* Release the NOOP array. */ + if( pCodeblock->pNOOPs ) + hb_xfree( ( void * ) pCodeblock->pNOOPs ); + + /* Release the Jumps array. */ + if( pCodeblock->pJumps ) + hb_xfree( ( void * ) pCodeblock->pJumps ); + + /* Compile Time Strong Type Checking Stack is not needed any more. */ + if ( pCodeblock->pStack ) + hb_xfree( ( void * ) pCodeblock->pStack ); +} + + /* ************************************************************************* */ /* initialize support variables */ diff --git a/harbour/source/compiler/hbgenerr.c b/harbour/source/compiler/hbgenerr.c index 9a8fc603fb..721cb9f7d2 100644 --- a/harbour/source/compiler/hbgenerr.c +++ b/harbour/source/compiler/hbgenerr.c @@ -79,7 +79,7 @@ char * hb_comp_szErrors[] = "ANNOUNCEd procedure \'%s\' must be a public symbol", "Jump PCode not found", "CASE or OTHERWISE does not match DO CASE", - "Code block contains both macro and declared symbol references", + "Code block contains both macro and declared symbol references \'%s\'", "GET contains complex macro", "Unterminated inline block in function: \'%s\'", "Too many inline blocks %s", @@ -227,6 +227,7 @@ HB_EXPR_PTR hb_compWarnMeaningless( HB_EXPR_PTR pExpr ) void hb_compErrorCodeblock( char * szBlock ) { hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BLOCK, szBlock, NULL ); + hb_comp_bError = FALSE; /* clear error flag for this line */ } void hb_compErrorMacro( char *szText ) diff --git a/harbour/source/macro/macrob.c b/harbour/source/macro/macrob.c index cbf922b8df..a89a0a9f3f 100644 --- a/harbour/source/macro/macrob.c +++ b/harbour/source/macro/macrob.c @@ -5,7 +5,7 @@ /* hbexprb.c is also included from ../compiler/exproptb.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 1.10 - ignore this magic number - this is used to force compilation + * 1.11 - ignore this magic number - this is used to force compilation */ #define HB_MACRO_SUPPORT diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 959e361d2b..3934731420 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -1686,16 +1686,23 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr s_numBrackets = 0; HB_SKIPTABSPACES( ptri ); - if( ptrmp == NULL ) { if( *ptri != '\0' ) return -1; } + if( ptrmp == NULL ) + { + if( *ptri != '\0' ) + return -1; + } else + { while( *ptri != '\0' && !endTranslation ) - { + { HB_SKIPTABSPACES( ptrmp ); if( *ptrmp == '[' && !s_numBrackets && !strtopti ) + { strtopti = ptrmp; + } if( !s_numBrackets && strtopti && strtptri != ptri && ( ISNAME( ( BYTE ) *ptri ) || *ptri=='&' ) ) - { + { strtptri = ptri; ptrmp = strtopti; ptr = ptri; @@ -1708,7 +1715,8 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr if( ptr ) ptrmp = ptr; } - } + } + switch( *ptrmp ) { case '[': if( !s_numBrackets ) isWordInside = 0; @@ -1717,21 +1725,24 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr lastopti[s_Repeate++] = ptrmp; ptrmp++; if( !CheckOptional( ptrmp, ptri, ptro, lenres, com_or_tra, com_or_xcom ) ) + { SkipOptional( &ptrmp ); + } break; + case ']': if( s_Repeate ) { s_Repeate--; if( s_aIsRepeate[ s_Repeate ] ) - { + { if( ISNAME( ( BYTE ) *ptri) ) - { + { ptr = ptri; ipos = NextName( &ptr, tmpname ); ipos = md_strAt( tmpname, ipos, ptrmp, TRUE, TRUE, TRUE ); if( ipos && TestOptional( ptrmp+1, ptrmp+ipos-2 ) ) - { + { ptr = PrevSquare( ptrmp+ipos-2, ptrmp+1, NULL ); if( !ptr || CheckOptional( ptrmp+1, ptri, ptro, lenres, com_or_tra, com_or_xcom ) ) { @@ -1745,18 +1756,22 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr } else ptrmp = lastopti[s_Repeate]; - } + } else + { ptrmp = lastopti[s_Repeate]; - } + } + } else + { ptrmp = lastopti[s_Repeate]; - } + } + } else - { + { if( !isWordInside ) strtopti = NULL; ptrmp++; - } + } s_numBrackets--; } else @@ -1765,6 +1780,7 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr s_numBrackets--; ptrmp++; } break; + case ',': if( s_numBrackets == 1 ) isWordInside = 1; if( !s_numBrackets ) strtopti = NULL; @@ -1778,6 +1794,7 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr else return -1; } break; + case '\1': /* Match marker */ if( !s_numBrackets ) strtopti = NULL; if( s_numBrackets == 1 && *(ptrmp+2) == '2' ) isWordInside = 1; /* restricted match marker */ @@ -1790,11 +1807,13 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr else return -1; } break; + case '\0': if( com_or_tra ) return -1; else endTranslation = TRUE; break; + default: /* Key word */ if( s_numBrackets == 1 ) isWordInside = 1; if( !s_numBrackets ) strtopti = NULL; @@ -1810,8 +1829,9 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr } } HB_SKIPTABSPACES( ptri ); - }; - + }; + } + if( *ptrmp != '\0' ) { if( s_Repeate ) { s_Repeate = 0; ptrmp = lastopti[0]; } diff --git a/harbour/source/vm/macro.c b/harbour/source/vm/macro.c index b6eeccac9e..1cddbabc24 100644 --- a/harbour/source/vm/macro.c +++ b/harbour/source/vm/macro.c @@ -1401,10 +1401,12 @@ void hb_compGenPopAliasedVar( char * szVarName, /* generates the pcode to push a nonaliased variable value to the virtual * machine stack */ -void hb_compGenPushVar( char * szVarName, HB_MACRO_DECL ) +void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_MACRO_DECL ) { int iVar; + HB_SYMBOL_UNUSED( bMacroVar ); + iVar = hb_compLocalVarGetPos( szVarName, HB_MACRO_PARAM ); if( iVar ) { diff --git a/harbour/source/vm/memvars.c b/harbour/source/vm/memvars.c index 71d6b601c4..709fed90ed 100644 --- a/harbour/source/vm/memvars.c +++ b/harbour/source/vm/memvars.c @@ -85,8 +85,8 @@ static ULONG s_globalFirstFree = 0; static ULONG s_globalLastFree = 0; static HB_VALUE_PTR s_globalTable = NULL; -#define TABLE_INITHB_VALUE 1 //00 -#define TABLE_EXPANDHB_VALUE 2 //50 +#define TABLE_INITHB_VALUE 100 +#define TABLE_EXPANDHB_VALUE 50 struct mv_PUBLIC_var_info {