2006-11-18 15:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* harbour/include/hbexprc.c
* harbour/source/macro/macro.y
* harbour/source/macro/macrolex.c
* do not allocate separate memory in macro compiler for terminal
symbols which needs string representation - it fixes some set
of memory leaks and increase a little bit macro compilation
! fixed accessing freed memory in:
private cMacro := "cEarly", cEarly := {"Early"}
@ 12,10 GET &cMacro[1]
! fixed GPF in:
p:=@left()
and similar expressions
* harbour/source/common/expropt2.c
% minor modification
* harbour/source/compiler/harbour.c
! fixed HB_TRACE message
This commit is contained in:
@@ -8,6 +8,28 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
to lower cases will be better. Please think about it.
|
||||
|
||||
2006-11-20 15:20 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/macro/macrolex.c
|
||||
! fixed bad typo in NIL, IIF, .AND., .NOT. tokens parsing
|
||||
|
||||
2006-11-18 15:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbexpra.c
|
||||
* harbour/include/hbexprb.c
|
||||
* harbour/include/hbexprc.c
|
||||
* harbour/source/macro/macro.y
|
||||
* harbour/source/macro/macrolex.c
|
||||
* do not allocate separate memory in macro compiler for terminal
|
||||
symbols which needs string representation - it fixes some set
|
||||
of memory leaks and increase a little bit macro compilation
|
||||
! fixed accessing freed memory in:
|
||||
private cMacro := "cEarly", cEarly := {"Early"}
|
||||
@ 12,10 GET &cMacro[1]
|
||||
! fixed GPF in:
|
||||
p:=@left()
|
||||
and similar expressions
|
||||
|
||||
* harbour/source/common/expropt2.c
|
||||
% minor modification
|
||||
|
||||
|
||||
@@ -377,27 +377,20 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
#ifndef HB_MACRO_SUPPORT
|
||||
if( ! hb_compFunCallCheck( pName->value.asSymbol, iCount ) )
|
||||
{
|
||||
hb_compExprDelete( pName );
|
||||
if( pParms )
|
||||
hb_compExprDelete( pParms );
|
||||
return NULL;
|
||||
/* skip any farther modifications which can depend on valid number
|
||||
of parameters */
|
||||
;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
/* TODO: EMPTY() (not done by Clipper) */
|
||||
|
||||
if( ( strcmp( "EVAL", pName->value.asSymbol ) == 0 ) && iCount )
|
||||
{
|
||||
HB_EXPR_PTR pEval;
|
||||
/* Optimize Eval( bBlock, [ArgList] ) to: bBlock:Eval( [ArgList] ) */
|
||||
pEval = hb_compExprNewMethodCall(
|
||||
#ifndef HB_MACRO_SUPPORT
|
||||
hb_compExprNewSend( pParms->value.asList.pExprList, hb_compIdentifierNew( "EVAL", TRUE ), NULL ),
|
||||
#else
|
||||
hb_compExprNewSend( pParms->value.asList.pExprList, hb_strdup("EVAL"), NULL ),
|
||||
#endif
|
||||
hb_compExprNewSend( pParms->value.asList.pExprList, "EVAL", NULL ),
|
||||
hb_compExprNewArgList( pParms->value.asList.pExprList->pNext ) );
|
||||
|
||||
pParms->value.asList.pExprList = NULL;
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pParms );
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pName );
|
||||
@@ -421,17 +414,12 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
HB_EXPR_PTR pIndex, pVar;
|
||||
HB_EXPR_PTR pBase;
|
||||
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
HB_XFREE( pName->value.asSymbol );
|
||||
pName->value.asSymbol = hb_strdup( "__GETA" );
|
||||
#else
|
||||
pName->value.asSymbol = hb_compIdentifierNew( "__GETA", TRUE );
|
||||
#endif
|
||||
pName->value.asSymbol = "__GETA";
|
||||
/* NOTE: a[ i, j ] is stored as: (pExprList)->(pIndex)
|
||||
* ((a->[ i ])->[ j ])
|
||||
*/
|
||||
pVar = HB_EXPR_USE( pArg->value.asList.pExprList, HB_EA_REDUCE );
|
||||
pBase = pVar;
|
||||
pBase = pVar->ExprType == HB_ET_ARRAYAT ? pVar : NULL;
|
||||
pIndex = HB_EXPR_USE( pArg->value.asList.pIndex, HB_EA_REDUCE );
|
||||
pIndex->pNext = NULL;
|
||||
while( pVar->ExprType == HB_ET_ARRAYAT )
|
||||
@@ -469,7 +457,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
hb_compExprClear( pArg );
|
||||
/* Create an array with index elements
|
||||
*/
|
||||
pIndex = HB_EXPR_PCODE1(hb_compExprNewArray, hb_compExprNewList( pIndex ) );
|
||||
pIndex = HB_EXPR_PCODE1( hb_compExprNewArray, hb_compExprNewList( pIndex ) );
|
||||
/* The array with index elements have to be the sixth argument
|
||||
* of __GETA() call
|
||||
*/
|
||||
@@ -508,12 +496,15 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
}
|
||||
}
|
||||
/* clear expressions no longer used */
|
||||
while( pBase->ExprType == HB_ET_ARRAYAT )
|
||||
if( pBase )
|
||||
{
|
||||
pVar = pBase->value.asList.pExprList;
|
||||
pBase->value.asList.pExprList = NULL;
|
||||
hb_compExprClear( pBase );
|
||||
pBase = pVar;
|
||||
while( pBase->ExprType == HB_ET_ARRAYAT )
|
||||
{
|
||||
pVar = pBase->value.asList.pExprList;
|
||||
pBase->value.asList.pExprList = NULL;
|
||||
hb_compExprClear( pBase );
|
||||
pBase = pVar;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( pArg->ExprType == HB_ET_MACRO )
|
||||
@@ -521,12 +512,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
/* @ 0,0 GET &var => __GET( NIL, var,... )
|
||||
* @ 0,0 GET var&var => __GET( NIL, "var&var",... )
|
||||
*/
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
HB_XFREE( pName->value.asSymbol );
|
||||
pName->value.asSymbol = hb_strdup( "__GET" );
|
||||
#else
|
||||
pName->value.asSymbol = hb_compIdentifierNew( "__GET", TRUE );
|
||||
#endif
|
||||
pName->value.asSymbol = "__GET";
|
||||
if( pArg->value.asMacro.pExprList == NULL )
|
||||
{
|
||||
/* Simple macro expansion (not a parenthesized expressions)
|
||||
@@ -546,11 +532,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
/* simple &variable - replace the second argument with
|
||||
* a variable name
|
||||
*/
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
char *szName = hb_strdup( pFirst->value.asMacro.szMacro );
|
||||
#else
|
||||
char *szName = hb_compIdentifierNew( pFirst->value.asMacro.szMacro, FALSE );
|
||||
#endif
|
||||
char *szName = pFirst->value.asMacro.szMacro;
|
||||
if( pFirst->pNext )
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pFirst->pNext ); /* delete a second argument */
|
||||
pArg->pNext = hb_compExprNewVar( szName );
|
||||
@@ -565,11 +547,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
if( pArg->pNext == NULL )
|
||||
{
|
||||
/* no second argument */
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
char *szText = hb_strdup( pFirst->value.asMacro.szMacro );
|
||||
#else
|
||||
char *szText = hb_compIdentifierNew( pFirst->value.asMacro.szMacro, FALSE );
|
||||
#endif
|
||||
char *szText = pFirst->value.asMacro.szMacro;
|
||||
pArg->pNext = hb_compExprNewString( szText, strlen(szText) );
|
||||
pArg->pNext->pNext = pNext;
|
||||
}
|
||||
@@ -586,12 +564,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
else
|
||||
{
|
||||
HB_EXPR_PTR pNext;
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
HB_XFREE( pName->value.asSymbol );
|
||||
pName->value.asSymbol = hb_strdup( "__GET" );
|
||||
#else
|
||||
pName->value.asSymbol = hb_compIdentifierNew( "__GET", TRUE );
|
||||
#endif
|
||||
pName->value.asSymbol = "__GET";
|
||||
/* store second and a rest of arguments */
|
||||
pNext = pArg->pNext;
|
||||
pArg->pNext = NULL;
|
||||
@@ -714,11 +687,7 @@ HB_EXPR_PTR hb_compExprNewString( char *szValue, ULONG ulLen )
|
||||
pExpr =hb_compExprNew( HB_ET_STRING );
|
||||
|
||||
pExpr->value.asString.string = szValue;
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
#else
|
||||
pExpr->value.asString.dealloc = FALSE;
|
||||
#endif
|
||||
pExpr->ulLength = ulLen;
|
||||
pExpr->ValType = HB_EV_STRING;
|
||||
|
||||
@@ -1034,9 +1003,6 @@ void hb_compExprCBVarDel( HB_CBVAR_PTR pVars )
|
||||
{
|
||||
pDel = pVars;
|
||||
pVars = pVars->pNext;
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
HB_XFREE( pDel->szName );
|
||||
#endif
|
||||
HB_XFREE( pDel );
|
||||
}
|
||||
}
|
||||
@@ -1066,11 +1032,10 @@ HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr )
|
||||
* NOTE: this is not a valid variable name so there will be no collisions
|
||||
*/
|
||||
/* create var==NIL */
|
||||
pIIF =hb_compExprNewVar( "~1" );
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
pIIF =hb_compExprNewVar( hb_strdup("~1") );
|
||||
pIIF = hb_compExprSetOperand( hb_compExprNewEQ( pIIF ), hb_compExprNewNil(), HB_MACRO_PARAM );
|
||||
#else
|
||||
pIIF =hb_compExprNewVar( hb_compIdentifierNew("~1",TRUE) );
|
||||
pIIF = hb_compExprSetOperand( hb_compExprNewEQ( pIIF ), hb_compExprNewNil() );
|
||||
#endif
|
||||
/* create ( var==NIL, */
|
||||
@@ -1078,11 +1043,7 @@ HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr )
|
||||
/* create ( var==NIL, <pExpr>, */
|
||||
pIIF = hb_compExprAddListExpr( pIIF, pExpr );
|
||||
/* create var */
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
pSet =hb_compExprNewVar( hb_strdup("~1") );
|
||||
#else
|
||||
pSet =hb_compExprNewVar( hb_compIdentifierNew("~1",TRUE) );
|
||||
#endif
|
||||
pSet =hb_compExprNewVar( "~1" );
|
||||
/* create <pExpr>:=var */
|
||||
pSet = hb_compExprAssign( hb_compExprClone( pExpr ), pSet );
|
||||
/* create ( var==nil, <pExpr>, <pExpr>:=var ) */
|
||||
@@ -1092,7 +1053,7 @@ HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr )
|
||||
/* create a codeblock
|
||||
*/
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( hb_compExprNewCodeBlock(NULL,0,0), hb_strdup("~1"), HB_MACRO_PARAM ), pIIF );
|
||||
return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( hb_compExprNewCodeBlock(NULL,0,0), "~1", HB_MACRO_PARAM ), pIIF );
|
||||
#else
|
||||
return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( hb_compExprNewCodeBlock(NULL,0,0), "~1", ' ' ), pIIF );
|
||||
#endif
|
||||
|
||||
@@ -859,10 +859,6 @@ static HB_EXPR_FUNC( hb_compExprUseVarRef )
|
||||
case HB_EA_STATEMENT:
|
||||
hb_compWarnMeaningless( pSelf );
|
||||
case HB_EA_DELETE:
|
||||
/* NOTE: variable name should be released if macro compilation */
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
HB_XFREE( pSelf->value.asSymbol );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -900,10 +896,6 @@ static HB_EXPR_FUNC( hb_compExprUseFunRef )
|
||||
case HB_EA_STATEMENT:
|
||||
hb_compWarnMeaningless( pSelf );
|
||||
case HB_EA_DELETE:
|
||||
/* NOTE: function name should be released if macro compilation */
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
HB_XFREE( pSelf->value.asSymbol );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -1622,13 +1614,6 @@ static HB_EXPR_FUNC( hb_compExprUseMacro )
|
||||
case HB_EA_DELETE:
|
||||
if( pSelf->value.asMacro.pExprList )
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asMacro.pExprList );
|
||||
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
if( pSelf->value.asMacro.szMacro )
|
||||
HB_XFREE( pSelf->value.asMacro.szMacro );
|
||||
#else
|
||||
/* NOTE: This will be released during releasing of symbols' table */
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -2056,9 +2041,6 @@ static HB_EXPR_FUNC( hb_compExprUseAlias )
|
||||
break;
|
||||
|
||||
case HB_EA_DELETE:
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
HB_XFREE( pSelf->value.asSymbol );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -2082,9 +2064,6 @@ static HB_EXPR_FUNC( hb_compExprUseFunName )
|
||||
case HB_EA_PUSH_POP:
|
||||
case HB_EA_STATEMENT:
|
||||
case HB_EA_DELETE:
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
HB_XFREE( pSelf->value.asSymbol );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -2176,10 +2155,6 @@ static HB_EXPR_FUNC( hb_compExprUseVariable )
|
||||
break;
|
||||
|
||||
case HB_EA_DELETE:
|
||||
/* NOTE: variable name should be released if macro compilation */
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
HB_XFREE( pSelf->value.asSymbol );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -2351,9 +2326,6 @@ static HB_EXPR_FUNC( hb_compExprUseSend )
|
||||
{
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asMessage.pMessage );
|
||||
}
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
HB_XFREE( pSelf->value.asMessage.szMessage );
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3150,7 +3122,7 @@ static HB_EXPR_FUNC( hb_compExprUseEQ )
|
||||
break;
|
||||
|
||||
case HB_EA_STATEMENT:
|
||||
hb_compErrorSyntax( pSelf );
|
||||
hb_compErrorSyntax( pSelf );
|
||||
break;
|
||||
|
||||
case HB_EA_DELETE:
|
||||
@@ -3200,8 +3172,8 @@ static HB_EXPR_FUNC( hb_compExprUseLT )
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE );
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP );
|
||||
HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE );
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3817,9 +3789,9 @@ static HB_EXPR_FUNC( hb_compExprUsePower )
|
||||
case HB_EA_PUSH_POP:
|
||||
if( HB_SUPPORT_HARBOUR )
|
||||
{
|
||||
/* NOTE: This will not generate a runtime error if incompatible
|
||||
* data type is used
|
||||
*/
|
||||
/* NOTE: This will not generate a runtime error if incompatible
|
||||
* data type is used
|
||||
*/
|
||||
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_POP );
|
||||
HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_POP );
|
||||
}
|
||||
@@ -3886,9 +3858,9 @@ static HB_EXPR_FUNC( hb_compExprUseNegate )
|
||||
case HB_EA_PUSH_POP:
|
||||
if( HB_SUPPORT_HARBOUR )
|
||||
{
|
||||
/* NOTE: This will not generate a runtime error if incompatible
|
||||
* data type is used
|
||||
*/
|
||||
/* NOTE: This will not generate a runtime error if incompatible
|
||||
* data type is used
|
||||
*/
|
||||
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_POP );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -787,42 +787,31 @@ BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_MACRO_DECL
|
||||
* pExpr is the first expression on the list
|
||||
*/
|
||||
HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, HB_MACRO_DECL )
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
{
|
||||
pLeft->value.asString.string = (char *) hb_xrealloc( pLeft->value.asString.string, pLeft->ulLength + pRight->ulLength + 1 );
|
||||
pLeft->value.asString.dealloc = TRUE;
|
||||
memcpy( pLeft->value.asString.string + pLeft->ulLength,
|
||||
pRight->value.asString.string, pRight->ulLength );
|
||||
pLeft->ulLength += pRight->ulLength;
|
||||
pLeft->value.asString.string[ pLeft->ulLength ] = '\0';
|
||||
hb_compExprFree( pRight, HB_MACRO_PARAM );
|
||||
|
||||
HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */
|
||||
return pLeft;
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* NOTE: compiler uses the hash table for storing identifiers and literals
|
||||
* Strings passed for reduction can be referenced by other expressions
|
||||
* then we cannot resize them or deallocate
|
||||
*/
|
||||
char *szString;
|
||||
|
||||
szString = (char *) hb_xgrab( pLeft->ulLength + pRight->ulLength + 1 );
|
||||
memcpy( szString, pLeft->value.asString.string, pLeft->ulLength );
|
||||
memcpy( szString + pLeft->ulLength, pRight->value.asString.string, pRight->ulLength );
|
||||
pLeft->ulLength += pRight->ulLength;
|
||||
szString[ pLeft->ulLength ] = '\0';
|
||||
if( pLeft->value.asString.dealloc )
|
||||
hb_xfree( pLeft->value.asString.string );
|
||||
pLeft->value.asString.string = szString;
|
||||
pLeft->value.asString.dealloc = TRUE;
|
||||
hb_compExprFree( pRight, HB_MACRO_PARAM );
|
||||
|
||||
{
|
||||
pLeft->value.asString.string = (char *) hb_xrealloc( pLeft->value.asString.string, pLeft->ulLength + pRight->ulLength + 1 );
|
||||
memcpy( pLeft->value.asString.string + pLeft->ulLength,
|
||||
pRight->value.asString.string, pRight->ulLength );
|
||||
pLeft->ulLength += pRight->ulLength;
|
||||
pLeft->value.asString.string[ pLeft->ulLength ] = '\0';
|
||||
hb_compExprFree( pRight, HB_MACRO_PARAM );
|
||||
}
|
||||
else
|
||||
{
|
||||
char *szString;
|
||||
szString = (char *) hb_xgrab( pLeft->ulLength + pRight->ulLength + 1 );
|
||||
memcpy( szString, pLeft->value.asString.string, pLeft->ulLength );
|
||||
memcpy( szString + pLeft->ulLength, pRight->value.asString.string, pRight->ulLength );
|
||||
pLeft->ulLength += pRight->ulLength;
|
||||
szString[ pLeft->ulLength ] = '\0';
|
||||
pLeft->value.asString.string = szString;
|
||||
pLeft->value.asString.dealloc = TRUE;
|
||||
hb_compExprFree( pRight, HB_MACRO_PARAM );
|
||||
}
|
||||
HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */
|
||||
return pLeft;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
/* enable warnings for unreferenced symbols */
|
||||
|
||||
@@ -1214,9 +1214,8 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
|
||||
if( bVal == 0 && pArg->value.asNum.lVal != 0 )
|
||||
{
|
||||
pExpr->value.asString.string = ( char * ) hb_xgrab( 1 );
|
||||
pExpr->value.asString.string[ 0 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->value.asString.string = "";
|
||||
pExpr->value.asString.dealloc = FALSE;
|
||||
pExpr->ulLength = 0;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -4655,7 +4655,7 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile )
|
||||
{
|
||||
int iStatus = EXIT_SUCCESS;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compCompile(%s,%i)", szPrg, argc));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compCompile(%s,%d)", szPrg, bSingleFile));
|
||||
|
||||
hb_comp_pMainFileName = hb_fsFNameSplit( szPrg );
|
||||
hb_comp_pFileName = hb_comp_pMainFileName;
|
||||
|
||||
@@ -330,7 +330,6 @@ MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1 );
|
||||
if( hb_macroIsIdent( szVarName ) )
|
||||
{
|
||||
$$ = hb_compExprNewVar( szVarName );
|
||||
hb_xfree( $1 );
|
||||
HB_MACRO_CHECK( $$ );
|
||||
}
|
||||
else
|
||||
@@ -338,8 +337,6 @@ MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1 );
|
||||
/* invalid variable name
|
||||
*/
|
||||
HB_TRACE(HB_TR_DEBUG, ("macro -> invalid variable name: %s", $1));
|
||||
|
||||
hb_xfree( $1 );
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
@@ -360,7 +357,7 @@ MacroExprAlias : MacroExpr ALIASOP { $$ = $1; }
|
||||
*/
|
||||
/* special case: _FIELD-> and FIELD-> can be nested
|
||||
*/
|
||||
FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( hb_strdup( "FIELD" ) ); }
|
||||
FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( "FIELD" ); }
|
||||
| FIELD ALIASOP FieldAlias { $$ = $3; }
|
||||
;
|
||||
|
||||
@@ -888,17 +885,17 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
return NIL;
|
||||
|
||||
hb_pp_tokenUpper( pToken );
|
||||
yylval_ptr->string = hb_strdup( pToken->value );
|
||||
yylval_ptr->string = pToken->value;
|
||||
return IDENTIFIER;
|
||||
|
||||
case HB_PP_TOKEN_MACROVAR:
|
||||
hb_pp_tokenUpper( pToken );
|
||||
yylval_ptr->string = hb_strdup( pToken->value );
|
||||
yylval_ptr->string = pToken->value;
|
||||
return MACROVAR;
|
||||
|
||||
case HB_PP_TOKEN_MACROTEXT:
|
||||
hb_pp_tokenUpper( pToken );
|
||||
yylval_ptr->string = hb_strdup( pToken->value );
|
||||
yylval_ptr->string = pToken->value;
|
||||
return MACROTEXT;
|
||||
|
||||
case HB_PP_TOKEN_NUMBER:
|
||||
@@ -933,7 +930,7 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
return NUM_DATE;
|
||||
|
||||
case HB_PP_TOKEN_STRING:
|
||||
yylval_ptr->string = hb_strdup( pToken->value );
|
||||
yylval_ptr->string = pToken->value;
|
||||
return LITERAL;
|
||||
|
||||
case HB_PP_TOKEN_LOGICAL:
|
||||
|
||||
@@ -151,7 +151,7 @@ static int hb_lexNumConv( YYSTYPE *yylval_ptr, PHB_MACRO_LEX pLex, ULONG ulLen )
|
||||
}
|
||||
}
|
||||
|
||||
static int _hb_complex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
int hb_complex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
{
|
||||
PHB_MACRO_LEX pLex = ( PHB_MACRO_LEX ) pMacro->pLex;
|
||||
|
||||
@@ -640,23 +640,3 @@ static int _hb_complex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
this function is temporary hack which makes this code compatible
|
||||
with the one generated by FLEX. In fact we do not need to allocate
|
||||
memory for terminal symbols which need string representation because
|
||||
memory pointed by yylval_ptr->string is never destroyed until
|
||||
hb_macroLexDelete() is executed. When we update include/hbexpr*.c
|
||||
files to not execute hb_xfree() then we can safly remove this function
|
||||
and change the type and name of function above from:
|
||||
static _int hb_complex(...) to: int hb_complex(...)
|
||||
*/
|
||||
int hb_complex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
{
|
||||
int i = _hb_complex( yylval_ptr, pMacro );
|
||||
|
||||
if( i == IDENTIFIER || i == MACROVAR || i == MACROTEXT || i == LITERAL )
|
||||
yylval_ptr->string = hb_strdup( yylval_ptr->string );
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user