ChangeLog 2000-11-07 16:25 UTC+0100
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
2000-11-07 16:25 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*include/hbexpra.c
|
||||
*source/compiler/expropta.c
|
||||
*source/macro/macroa.c
|
||||
*fixed internal _GET_ optimization for macro variables
|
||||
|
||||
*source/rtl/tgetint.prg
|
||||
*__GET uses macro operator if no initial value is passed and
|
||||
there is no set/get block
|
||||
|
||||
2000-11-06 22:10 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* source/compiler/cmdcheck.c
|
||||
* utils/hbpp/hbpp.c
|
||||
|
||||
@@ -392,6 +392,73 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms )
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( pArg->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
/* @ 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
|
||||
if( pArg->value.asMacro.pExprList == NULL )
|
||||
{
|
||||
/* Simple macro expansion (not a parenthesized expressions)
|
||||
*/
|
||||
HB_EXPR_PTR pFirst, pNext;
|
||||
|
||||
pFirst = pArg; /* first argument */
|
||||
pNext = pFirst->pNext; /* second argument */
|
||||
if( pNext )
|
||||
pNext = pNext->pNext; /* third argument */
|
||||
|
||||
pArg = hb_compExprNewNil(); /* replace 1st with NIL */
|
||||
pParms->value.asList.pExprList = pArg;
|
||||
pArg->pNext = pFirst->pNext;
|
||||
if( pFirst->value.asMacro.cMacroOp == '&' )
|
||||
{
|
||||
/* 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
|
||||
if( pFirst->pNext )
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pFirst->pNext ); /* delete a second argument */
|
||||
pArg->pNext = hb_compExprNewVar( szName );
|
||||
pArg->pNext->pNext = pNext; /* restore third argument */
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pFirst );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* text substitution text&variable - replace the second
|
||||
* argument with a string
|
||||
*/
|
||||
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
|
||||
pArg->pNext = hb_compExprNewString( szText );
|
||||
pArg->pNext->pNext = pNext;
|
||||
}
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pFirst ); /* delete first argument */
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* @ 0,0 GET &(var)
|
||||
* TODO: generate a compilation time error -
|
||||
* invalid GET expression
|
||||
*/
|
||||
}
|
||||
}
|
||||
else
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
HB_XFREE( pName->value.asSymbol );
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/* hbexpra.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)
|
||||
* 2 - ignore this magic number - this is used to force compilation
|
||||
* 3 - ignore this magic number - this is used to force compilation
|
||||
*/
|
||||
#include "hbexpra.c"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* hbexpra.c is also included from ../compiler/expropta.c
|
||||
* However it produces a slighty different code if used in
|
||||
* macro compiler (there is an additional parameter passed to some functions)
|
||||
* 2 - ignore this magic number - this is used to force compilation
|
||||
* 3 - ignore this magic number - this is used to force compilation
|
||||
*/
|
||||
|
||||
#define HB_MACRO_SUPPORT
|
||||
|
||||
@@ -49,7 +49,11 @@ FUNCTION __GET( uVar, cVarName, cPicture, bValid, bWhen, bSetGet )
|
||||
LOCAL oGet
|
||||
|
||||
IF( bSetGet == NIL )
|
||||
bSetGet := {|xValue| IIF( PCOUNT()==0, uVar, uVar:=xValue)}
|
||||
IF( uVar == NIL )
|
||||
bSetGet := {|xValue| IIF( PCOUNT()==0, &cVarName, &cVarname:=xValue)}
|
||||
ELSE
|
||||
bSetGet := {|xValue| IIF( PCOUNT()==0, uVar, uVar:=xValue)}
|
||||
ENDIF
|
||||
ENDIF
|
||||
oGet := Get():New(,, bSetGet, cVarName, cPicture )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user