2010-02-07 12:17 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rdd/dbfcdx/dbfcdx1.c
* minor code cleanup
* harbour/src/vm/macro.c
% eliminated memory allocation in macro compiler for object item assign
operation
* updated hb_macroGenMessage() to work like hb_compilerGenMessage()
* harbour/src/vm/memvars.c
* reverted HB_ISIZ -> int
* harbour/include/hbmacro.h
* harbour/include/hbexprop.h
* harbour/include/hbexpra.c
* harbour/src/common/expropt1.c
- eliminated old hb_compExprNewSend()/hb_macroExprNewSend()
+ added common for compiler and macrocompiler functions:
hb_compExprNewSend(),
hb_compExprNewMacroSend(),
hb_compExprNewMethodObject()
* harbour/include/hbcomp.h
* harbour/src/compiler/harbour.y
* harbour/src/compiler/harbour.yyc
* harbour/src/compiler/harbour.yyh
* use new functions for send coperator
% eliminated asMessage structure - it was the biggest one so this
modification reduce total memory usage by grammar stack
+ added new terminal symbol MacroAny and simplified some rules using it
+ added static function hb_compCheckMethod() used for enumerator
messages
- eliminated public function hb_compForEachVarError()
* harbour/src/macro/macro.y
* harbour/src/macro/macro.yyc
* use new functions for send coperator
This commit is contained in:
@@ -17,6 +17,44 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-02-07 12:17 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/src/rdd/dbfcdx/dbfcdx1.c
|
||||
* minor code cleanup
|
||||
|
||||
* harbour/src/vm/macro.c
|
||||
% eliminated memory allocation in macro compiler for object item assign
|
||||
operation
|
||||
* updated hb_macroGenMessage() to work like hb_compilerGenMessage()
|
||||
|
||||
* harbour/src/vm/memvars.c
|
||||
* reverted HB_ISIZ -> int
|
||||
|
||||
* harbour/include/hbmacro.h
|
||||
* harbour/include/hbexprop.h
|
||||
* harbour/include/hbexpra.c
|
||||
* harbour/src/common/expropt1.c
|
||||
- eliminated old hb_compExprNewSend()/hb_macroExprNewSend()
|
||||
+ added common for compiler and macrocompiler functions:
|
||||
hb_compExprNewSend(),
|
||||
hb_compExprNewMacroSend(),
|
||||
hb_compExprNewMethodObject()
|
||||
|
||||
* harbour/include/hbcomp.h
|
||||
* harbour/src/compiler/harbour.y
|
||||
* harbour/src/compiler/harbour.yyc
|
||||
* harbour/src/compiler/harbour.yyh
|
||||
* use new functions for send coperator
|
||||
% eliminated asMessage structure - it was the biggest one so this
|
||||
modification reduce total memory usage by grammar stack
|
||||
+ added new terminal symbol MacroAny and simplified some rules using it
|
||||
+ added static function hb_compCheckMethod() used for enumerator
|
||||
messages
|
||||
- eliminated public function hb_compForEachVarError()
|
||||
|
||||
* harbour/src/macro/macro.y
|
||||
* harbour/src/macro/macro.yyc
|
||||
* use new functions for send coperator
|
||||
|
||||
2010-02-07 10:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* include/hbapi.h
|
||||
* src/vm/memvars.c
|
||||
|
||||
@@ -178,8 +178,6 @@ extern void hb_compLoopKill( PFUNCTION );
|
||||
extern void hb_compGenError( HB_COMP_DECL, const char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ); /* generic parsing error management function */
|
||||
extern void hb_compGenWarning( HB_COMP_DECL, const char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2); /* generic parsing warning management function */
|
||||
|
||||
extern HB_BOOL hb_compForEachVarError( HB_COMP_DECL, const char * ); /* checks if it is FOR EACH enumerator variable and generates a warning */
|
||||
|
||||
extern ULONG hb_compGenJump( LONG, HB_COMP_DECL ); /* generates the pcode to jump to a specific offset */
|
||||
extern ULONG hb_compGenJumpFalse( LONG, HB_COMP_DECL ); /* generates the pcode to jump if false */
|
||||
extern ULONG hb_compGenJumpTrue( LONG, HB_COMP_DECL ); /* generates the pcode to jump if true */
|
||||
|
||||
@@ -179,9 +179,9 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM
|
||||
{
|
||||
HB_COMP_EXPR_DELETE( pParms );
|
||||
HB_COMP_EXPR_DELETE( pName );
|
||||
return hb_compExprNewMethodCall( hb_compExprNewSend(
|
||||
hb_compExprNewVar( szName, HB_COMP_PARAM ),
|
||||
szMessage, NULL, HB_COMP_PARAM ), NULL );
|
||||
return hb_compExprNewMethodObject(
|
||||
hb_compExprNewSend( szMessage, HB_COMP_PARAM ),
|
||||
hb_compExprNewVar( szName, HB_COMP_PARAM ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,18 +194,18 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM
|
||||
else if( iLen == 4 && memcmp( "EVAL", pName->value.asSymbol, 4 ) == 0 )
|
||||
{
|
||||
HB_EXPR_PTR pEval;
|
||||
|
||||
/* Optimize Eval( bBlock, [ArgList] ) to: bBlock:Eval( [ArgList] ) */
|
||||
if( !HB_SUPPORT_HARBOUR )
|
||||
pParms = HB_EXPR_USE( pParms, HB_EA_REDUCE );
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
|
||||
pEval = hb_compExprNewMethodCall(
|
||||
hb_macroExprNewSend( pParms->value.asList.pExprList, "EVAL", NULL, HB_COMP_PARAM ),
|
||||
hb_compExprNewArgList( pParms->value.asList.pExprList->pNext, HB_COMP_PARAM ) );
|
||||
#else
|
||||
pEval = hb_compExprNewMethodCall(
|
||||
hb_compExprNewSend( pParms->value.asList.pExprList, "EVAL", NULL, HB_COMP_PARAM ),
|
||||
hb_compExprNewArgList( pParms->value.asList.pExprList->pNext, HB_COMP_PARAM ) );
|
||||
#endif
|
||||
hb_compExprNewMethodObject(
|
||||
hb_compExprNewSend( "EVAL", HB_COMP_PARAM ),
|
||||
pParms->value.asList.pExprList ),
|
||||
hb_compExprNewArgList(
|
||||
pParms->value.asList.pExprList->pNext,
|
||||
HB_COMP_PARAM ) );
|
||||
pParms->value.asList.pExprList = NULL;
|
||||
HB_COMP_EXPR_DELETE( pParms );
|
||||
HB_COMP_EXPR_DELETE( pName );
|
||||
@@ -457,66 +457,6 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* Creates new send expression
|
||||
* pObject : szMessage
|
||||
*/
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
HB_EXPR_PTR hb_macroExprNewSend( HB_EXPR_PTR pObject, const char * szMessage,
|
||||
HB_EXPR_PTR pMessage, HB_COMP_DECL )
|
||||
#else
|
||||
HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR pObject, const char * szMessage,
|
||||
HB_EXPR_PTR pMessage, HB_COMP_DECL )
|
||||
#endif
|
||||
{
|
||||
HB_EXPR_PTR pExpr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSend(%p,%s,%p,%p)", pObject, szMessage, pMessage, HB_COMP_PARAM));
|
||||
|
||||
pExpr = HB_COMP_EXPR_NEW( HB_ET_SEND );
|
||||
pExpr->value.asMessage.pObject = pObject;
|
||||
pExpr->value.asMessage.pParms = NULL;
|
||||
|
||||
if( szMessage != NULL )
|
||||
{
|
||||
pExpr->value.asMessage.szMessage = szMessage;
|
||||
pExpr->value.asMessage.pMessage = NULL;
|
||||
#ifndef HB_MACRO_SUPPORT
|
||||
if( pObject && szMessage[ 0 ] == '_' && strncmp( "__ENUM", szMessage, 6 ) == 0 )
|
||||
{
|
||||
if( strcmp( "INDEX", szMessage + 6 ) == 0 ||
|
||||
strcmp( "KEY", szMessage + 6 ) == 0 ||
|
||||
strcmp( "BASE", szMessage + 6 ) == 0 ||
|
||||
strcmp( "VALUE", szMessage + 6 ) == 0 )
|
||||
{
|
||||
if( pObject->ExprType == HB_ET_VARIABLE )
|
||||
{
|
||||
if( ! hb_compForEachVarError( HB_COMP_PARAM, pObject->value.asSymbol ) )
|
||||
{
|
||||
/* pExpr->value.asMessage.pObject = hb_compExprNewVarRef( pObject->value.asSymbol, HB_COMP_PARAM ); */
|
||||
/* NOTE: direct type change */
|
||||
pObject->ExprType = HB_ET_VARREF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
pExpr->value.asMessage.pMessage = pMessage;
|
||||
pExpr->value.asMessage.szMessage = NULL;
|
||||
if( pMessage->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
/* Signal that macro compiler have to generate a pcode that will
|
||||
* return function name as symbol instead of usual value
|
||||
*/
|
||||
pMessage->value.asMacro.SubType = HB_ET_MACRO_SYMBOL;
|
||||
}
|
||||
}
|
||||
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* Creates new array access expression
|
||||
* pArray[ pIndex ]
|
||||
* NOTE: In case of multiple indexes it is called recursively
|
||||
|
||||
@@ -127,7 +127,9 @@ extern HB_EXPR_PTR hb_compExprNewFunRef( const char *, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewRef( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewCodeblockExpr( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
extern HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR, const char *szMessage, HB_EXPR_PTR pMessage, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewSend( const char *, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewMacroSend( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewMethodObject( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
extern HB_EXPR_PTR hb_compExprNewMethodCall( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
extern HB_EXPR_PTR hb_compExprNewList( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewArgList( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
|
||||
@@ -109,7 +109,6 @@ extern HB_EXPR_PTR hb_macroExprGenPop( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
|
||||
extern HB_EXPR_PTR hb_macroExprNewArrayAt( HB_EXPR_PTR pArray, HB_EXPR_PTR pIndex, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_macroExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_macroExprNewSend( HB_EXPR_PTR pObject, const char * szMessage, HB_EXPR_PTR pMessage, HB_COMP_DECL );
|
||||
|
||||
/* Size of pcode buffer incrementation
|
||||
*/
|
||||
|
||||
@@ -673,6 +673,67 @@ HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR pAlias, HB_EXPR_PTR pExpList,
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* Creates new send expression
|
||||
* : <msgid> -> ( expression )
|
||||
*/
|
||||
HB_EXPR_PTR hb_compExprNewSend( const char * szMessage, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pExpr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSend(%s,%p)", szMessage, HB_COMP_PARAM));
|
||||
|
||||
pExpr = HB_COMP_EXPR_NEW( HB_ET_SEND );
|
||||
pExpr->value.asMessage.pObject = NULL;
|
||||
pExpr->value.asMessage.pParms = NULL;
|
||||
|
||||
pExpr->value.asMessage.szMessage = szMessage;
|
||||
pExpr->value.asMessage.pMessage = NULL;
|
||||
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* Creates new macro send expression
|
||||
* : &<msg> -> ( expression )
|
||||
*/
|
||||
HB_EXPR_PTR hb_compExprNewMacroSend( HB_EXPR_PTR pMessage, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pExpr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewMacroSend(%p,%p)", pMessage, HB_COMP_PARAM));
|
||||
|
||||
pExpr = HB_COMP_EXPR_NEW( HB_ET_SEND );
|
||||
pExpr->value.asMessage.pObject = NULL;
|
||||
pExpr->value.asMessage.pParms = NULL;
|
||||
|
||||
pExpr->value.asMessage.szMessage = NULL;
|
||||
pExpr->value.asMessage.pMessage = pMessage;
|
||||
|
||||
if( pMessage->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
/* Signal that macro compiler have to generate a pcode that will
|
||||
* return function name as symbol instead of usual value
|
||||
*/
|
||||
pMessage->value.asMacro.SubType = HB_ET_MACRO_SYMBOL;
|
||||
}
|
||||
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* Set object in send expression
|
||||
* pObject : pExpr
|
||||
*
|
||||
* pExpr = is an expression returned by hb_compExprNewSend
|
||||
* pObject = is an object
|
||||
*/
|
||||
HB_EXPR_PTR hb_compExprNewMethodObject( HB_EXPR_PTR pExpr, HB_EXPR_PTR pObject )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewMethodObject(%p,%p,%p)", pExpr, pObject, HB_COMP_PARAM));
|
||||
|
||||
pExpr->value.asMessage.pObject = pObject;
|
||||
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* Creates new method call
|
||||
* pObject : identifier ( pArgList )
|
||||
*
|
||||
|
||||
@@ -94,6 +94,7 @@ static void hb_compSwitchStart( HB_COMP_DECL, HB_EXPR_PTR );
|
||||
static void hb_compSwitchAdd( HB_COMP_DECL, HB_EXPR_PTR );
|
||||
static void hb_compSwitchEnd( HB_COMP_DECL );
|
||||
|
||||
static HB_EXPR_PTR hb_compCheckMethod( HB_COMP_DECL, HB_EXPR_PTR pExpr );
|
||||
static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr );
|
||||
|
||||
#ifdef HB_YYDEBUG
|
||||
@@ -146,15 +147,6 @@ static void hb_compDebugStart( void ) { }
|
||||
int length;
|
||||
int flags; /* Flag for early {|| ¯o} (1) or late {|| &(macro)} (2) binding */
|
||||
} asCodeblock;
|
||||
struct
|
||||
{
|
||||
HB_BOOL bMacro;
|
||||
union
|
||||
{
|
||||
char * string;
|
||||
HB_EXPR_PTR macro;
|
||||
} value;
|
||||
} asMessage;
|
||||
PHB_VARTYPE asVarType;
|
||||
};
|
||||
|
||||
@@ -230,7 +222,7 @@ extern void yyerror( HB_COMP_DECL, const char * ); /* parsing error manageme
|
||||
%type <pVoid> IfElseIf Cases
|
||||
%type <asExpr> Argument ExtArgument RefArgument ArgList ElemList
|
||||
%type <asExpr> BlockHead BlockExpList BlockVars BlockVarList
|
||||
%type <asExpr> DoName DoProc DoArgs DoArgument DoArgList
|
||||
%type <asExpr> DoProc DoArgs DoArgument DoArgList
|
||||
%type <asExpr> NumValue NumAlias
|
||||
%type <asExpr> NilValue NilAlias
|
||||
%type <asExpr> LiteralValue LiteralAlias
|
||||
@@ -244,6 +236,7 @@ extern void yyerror( HB_COMP_DECL, const char * ); /* parsing error manageme
|
||||
%type <asExpr> Variable VarAlias
|
||||
%type <asExpr> MacroVar MacroVarAlias
|
||||
%type <asExpr> MacroExpr MacroExprAlias
|
||||
%type <asExpr> MacroAny
|
||||
%type <asExpr> AliasId AliasVar AliasExpr
|
||||
%type <asExpr> VariableAt VariableAtAlias
|
||||
%type <asExpr> FunIdentCall FunCall FunCallAlias FunRef
|
||||
@@ -263,7 +256,7 @@ extern void yyerror( HB_COMP_DECL, const char * ); /* parsing error manageme
|
||||
%type <asExpr> ForVar ForList ForExpr ForArgs
|
||||
%type <asExpr> SwitchStart SwitchBegin
|
||||
%type <asCodeblock> CBSTART
|
||||
%type <asMessage> SendId
|
||||
%type <asExpr> SendId
|
||||
%type <asVarType> AsType StrongType AsArrayType AsArray
|
||||
|
||||
/*
|
||||
@@ -375,13 +368,7 @@ Statement : ExecFlow CrlfStmnt
|
||||
| FunCall CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; }
|
||||
| AliasExpr CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; }
|
||||
| ObjectMethod CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; }
|
||||
| MacroVar CrlfStmnt { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) )
|
||||
HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) );
|
||||
else
|
||||
HB_COMP_EXPR_DELETE( HB_COMP_ERROR_SYNTAX( $1 ) );
|
||||
HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN;
|
||||
}
|
||||
| MacroExpr CrlfStmnt { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) )
|
||||
| MacroAny CrlfStmnt { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) )
|
||||
HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) );
|
||||
else
|
||||
HB_COMP_EXPR_DELETE( HB_COMP_ERROR_SYNTAX( $1 ) );
|
||||
@@ -682,6 +669,10 @@ MacroExpr : '&' PareExpList { $$ = hb_compExprNewMacro( $2, 0, NULL, HB_COMP_P
|
||||
MacroExprAlias : MacroExpr ALIASOP
|
||||
;
|
||||
|
||||
MacroAny : MacroVar
|
||||
| MacroExpr
|
||||
;
|
||||
|
||||
/* Aliased variables
|
||||
*/
|
||||
/* special case: _FIELD-> and FIELD-> can be nested
|
||||
@@ -709,8 +700,7 @@ FieldVarAlias : FieldAlias VarAlias { HB_COMP_EXPR_DELETE( $1 ); $$
|
||||
;
|
||||
|
||||
AliasId : IdentName { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); }
|
||||
| MacroVar
|
||||
| MacroExpr
|
||||
| MacroAny
|
||||
;
|
||||
|
||||
AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); }
|
||||
@@ -763,8 +753,7 @@ VariableAt : NumValue ArrayIndex { $$ = $2; }
|
||||
| Variable ArrayIndex { $$ = $2; }
|
||||
| AliasVar ArrayIndex { $$ = $2; }
|
||||
| AliasExpr ArrayIndex { $$ = $2; }
|
||||
| MacroVar ArrayIndex { $$ = $2; }
|
||||
| MacroExpr ArrayIndex { $$ = $2; }
|
||||
| MacroAny ArrayIndex { $$ = $2; }
|
||||
| ObjectData ArrayIndex { $$ = $2; }
|
||||
| ObjectMethod ArrayIndex { $$ = $2; }
|
||||
| FunCall ArrayIndex { $$ = $2; }
|
||||
@@ -780,8 +769,7 @@ FunIdentCall: IdentName '(' ArgList ')' { $$ = hb_compExprNewFunCall( hb_compE
|
||||
;
|
||||
|
||||
FunCall : FunIdentCall
|
||||
| MacroVar '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3, HB_COMP_PARAM ); }
|
||||
| MacroExpr '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3, HB_COMP_PARAM ); }
|
||||
| MacroAny '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
/* FunRef : '@' FunCall { $$ = hb_compCheckPassByRef( HB_COMP_PARAM, $2 ); } */
|
||||
@@ -812,21 +800,20 @@ ExtArgument : EPSILON { $$ = hb_compExprNewArgRef( HB_COMP_PARAM ); }
|
||||
|
||||
/* Object's instance variable
|
||||
*/
|
||||
ObjectData : LeftExpression ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); }
|
||||
| ObjectRef ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); }
|
||||
ObjectData : LeftExpression ':' SendId { $$ = hb_compCheckMethod( HB_COMP_PARAM, hb_compExprNewMethodObject( $3, $1 ) ); }
|
||||
| ObjectRef ':' SendId { $$ = hb_compExprNewMethodObject( $3, $1 ); }
|
||||
| ':' SendId { if( HB_COMP_PARAM->functions.pLast->wWithObjectCnt == 0 )
|
||||
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_WITHOBJECT, NULL, NULL );
|
||||
$$ = ($2.bMacro ? hb_compExprNewSend( NULL, NULL, $2.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( NULL, $2.value.string, NULL, HB_COMP_PARAM ));
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
SendId : IdentName { $$.value.string = $1; $$.bMacro=FALSE; }
|
||||
| MacroVar { $$.value.macro = $1; $$.bMacro=TRUE; }
|
||||
| MacroExpr { $$.value.macro = $1; $$.bMacro=TRUE; }
|
||||
SendId : IdentName { $$ = hb_compExprNewSend( $1, HB_COMP_PARAM ); }
|
||||
| MacroAny { $$ = hb_compExprNewMacroSend( $1, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ObjectRef : '(' '@' IdentName ')' { $$ = hb_compExprNewVarRef( $3, HB_COMP_PARAM ); }
|
||||
|
||||
;
|
||||
|
||||
ObjectDataAlias : ObjectData ALIASOP
|
||||
;
|
||||
@@ -921,8 +908,7 @@ LeftExpression : NumValue
|
||||
| Hash
|
||||
| AliasVar
|
||||
| AliasExpr
|
||||
| MacroVar
|
||||
| MacroExpr
|
||||
| MacroAny
|
||||
| Variable
|
||||
| VariableAt
|
||||
| PareExpList
|
||||
@@ -1886,11 +1872,7 @@ RecoverUsing : RECOVERUSING IdentName
|
||||
* DO .. WITH ++variable
|
||||
* will pass the value of variable not a reference
|
||||
*/
|
||||
DoName : MacroVar
|
||||
| MacroExpr
|
||||
;
|
||||
|
||||
DoProc : DO DoName DoArgs
|
||||
DoProc : DO MacroAny DoArgs
|
||||
{
|
||||
$$ = hb_compExprNewFunCall( $2, $3, HB_COMP_PARAM );
|
||||
}
|
||||
@@ -2467,7 +2449,7 @@ static void hb_compForStart( HB_COMP_DECL, const char *szVarName, HB_BOOL bForEa
|
||||
pEnumVar->pNext = NULL;
|
||||
}
|
||||
|
||||
HB_BOOL hb_compForEachVarError( HB_COMP_DECL, const char *szVarName )
|
||||
static HB_BOOL hb_compForEachVarError( HB_COMP_DECL, const char *szVarName )
|
||||
{
|
||||
HB_ENUMERATOR_PTR pEnumVar;
|
||||
|
||||
@@ -2790,6 +2772,29 @@ static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr )
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
static HB_EXPR_PTR hb_compCheckMethod( HB_COMP_DECL, HB_EXPR_PTR pExpr )
|
||||
{
|
||||
if( pExpr->value.asMessage.szMessage &&
|
||||
pExpr->value.asMessage.pObject &&
|
||||
pExpr->value.asMessage.pObject->ExprType == HB_ET_VARIABLE &&
|
||||
pExpr->value.asMessage.szMessage[ 0 ] == '_' &&
|
||||
strncmp( "__ENUM", pExpr->value.asMessage.szMessage, 6 ) == 0 )
|
||||
{
|
||||
const char * szMessage = pExpr->value.asMessage.szMessage + 6;
|
||||
|
||||
if( strcmp( "INDEX", szMessage ) == 0 ||
|
||||
strcmp( "KEY", szMessage ) == 0 ||
|
||||
strcmp( "BASE", szMessage ) == 0 ||
|
||||
strcmp( "VALUE", szMessage ) == 0 )
|
||||
{
|
||||
if( ! hb_compForEachVarError( HB_COMP_PARAM, pExpr->value.asMessage.pObject->value.asSymbol ) )
|
||||
pExpr->value.asMessage.pObject->ExprType = HB_ET_VARREF;
|
||||
}
|
||||
}
|
||||
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
HB_BOOL hb_compCheckUnclosedStru( HB_COMP_DECL, PFUNCTION pFunc )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -266,7 +266,7 @@
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 113 "harbour.y"
|
||||
#line 114 "harbour.y"
|
||||
{
|
||||
char * string; /* to hold a string returned by lex */
|
||||
int iNumber; /* to hold a temporary integer number */
|
||||
@@ -303,19 +303,10 @@ typedef union YYSTYPE
|
||||
int length;
|
||||
int flags; /* Flag for early {|| ¯o} (1) or late {|| &(macro)} (2) binding */
|
||||
} asCodeblock;
|
||||
struct
|
||||
{
|
||||
HB_BOOL bMacro;
|
||||
union
|
||||
{
|
||||
char * string;
|
||||
HB_EXPR_PTR macro;
|
||||
} value;
|
||||
} asMessage;
|
||||
PHB_VARTYPE asVarType;
|
||||
}
|
||||
/* Line 1495 of yacc.c. */
|
||||
#line 319 "harboury.h"
|
||||
#line 310 "harboury.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
@@ -232,6 +232,7 @@ extern void yyerror( HB_MACRO_PTR, const char * ); /* parsing error managemen
|
||||
%type <asExpr> AliasId AliasVar AliasExpr
|
||||
%type <asExpr> VariableAt
|
||||
%type <asExpr> FunCall FunRef
|
||||
%type <asExpr> SendId
|
||||
%type <asExpr> ObjectData
|
||||
%type <asExpr> ObjectMethod
|
||||
%type <asExpr> IfInline
|
||||
@@ -480,9 +481,12 @@ ExtArgument : EPSILON { $$ = hb_compExprNewArgRef( HB_COMP_PARAM ); }
|
||||
|
||||
/* Object's instance variable
|
||||
*/
|
||||
ObjectData : LeftExpression ':' IDENTIFIER { $$ = hb_macroExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); }
|
||||
| LeftExpression ':' MacroVar { $$ = hb_macroExprNewSend( $1, NULL, $3, HB_COMP_PARAM ); }
|
||||
| LeftExpression ':' MacroExpr { $$ = hb_macroExprNewSend( $1, NULL, $3, HB_COMP_PARAM ); }
|
||||
ObjectData : LeftExpression ':' SendId { $$ = hb_compExprNewMethodObject( $3, $1 ); }
|
||||
;
|
||||
|
||||
SendId : IDENTIFIER { $$ = hb_compExprNewSend( $1, HB_COMP_PARAM ); }
|
||||
| MacroVar { $$ = hb_compExprNewMacroSend( $1, HB_COMP_PARAM ); }
|
||||
| MacroExpr { $$ = hb_compExprNewMacroSend( $1, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
/* Object's method
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4637,7 +4637,7 @@ static void hb_cdxIndexDelTag( LPCDXINDEX pIndex, const char * szTagName )
|
||||
if( *pTagPtr )
|
||||
{
|
||||
LPCDXTAG pTag = *pTagPtr;
|
||||
LPCDXKEY pKey = hb_cdxKeyPutC( NULL, szTagName, pIndex->pCompound->uiLen,
|
||||
LPCDXKEY pKey = hb_cdxKeyPutC( NULL, pTag->szName, pIndex->pCompound->uiLen,
|
||||
pTag->TagBlock );
|
||||
if( hb_cdxTagKeyDel( pIndex->pCompound, pKey ) )
|
||||
{
|
||||
|
||||
@@ -1302,23 +1302,26 @@ void hb_macroGenPushTimeStamp( long lDate, long lTime, HB_COMP_DECL )
|
||||
/* sends a message to an object */
|
||||
void hb_macroGenMessage( const char * szMsgName, HB_BOOL bIsObject, HB_COMP_DECL )
|
||||
{
|
||||
BYTE byBuf[ sizeof( HB_DYNS_PTR ) + 1 ];
|
||||
if( szMsgName )
|
||||
{
|
||||
BYTE byBuf[ sizeof( HB_DYNS_PTR ) + 1 ];
|
||||
|
||||
/* Find the address of passed symbol - create the symbol if doesn't exist
|
||||
*/
|
||||
HB_DYNS_PTR pSym = hb_dynsymGetCase( szMsgName );
|
||||
/* Find the address of passed symbol - create the symbol if doesn't exist
|
||||
*/
|
||||
HB_DYNS_PTR pSym = hb_dynsymGetCase( szMsgName );
|
||||
|
||||
byBuf[ 0 ] = HB_P_MMESSAGE;
|
||||
HB_PUT_PTR( &byBuf[ 1 ], pSym );
|
||||
hb_macroGenPCodeN( byBuf, sizeof( byBuf ), HB_COMP_PARAM );
|
||||
|
||||
HB_SYMBOL_UNUSED( bIsObject ); /* used in full compiler only */
|
||||
byBuf[ 0 ] = HB_P_MMESSAGE;
|
||||
HB_PUT_PTR( &byBuf[ 1 ], pSym );
|
||||
hb_macroGenPCodeN( byBuf, sizeof( byBuf ), HB_COMP_PARAM );
|
||||
}
|
||||
if( !bIsObject ) /* used in full compiler only */
|
||||
hb_macroGenPCode3( HB_P_WITHOBJECTMESSAGE, HB_LOBYTE( 0xFFFF ), HB_HIBYTE( 0xFFFF ), HB_COMP_PARAM );
|
||||
}
|
||||
|
||||
/* generates an underscore-symbol name for a data assignment */
|
||||
void hb_macroGenMessageData( const char * szMsg, HB_BOOL bIsObject, HB_COMP_DECL )
|
||||
{
|
||||
char * szResult;
|
||||
char szResult[ HB_SYMBOL_NAME_LEN + 1 ];
|
||||
int iLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_macroGenMessageData(%s)", szMsg));
|
||||
@@ -1326,12 +1329,10 @@ void hb_macroGenMessageData( const char * szMsg, HB_BOOL bIsObject, HB_COMP_DECL
|
||||
iLen = ( int ) strlen( szMsg );
|
||||
if( iLen > HB_SYMBOL_NAME_LEN - 1 )
|
||||
iLen = HB_SYMBOL_NAME_LEN - 1;
|
||||
szResult = ( char * ) hb_xgrab( iLen + 2 );
|
||||
szResult[ 0 ] = '_';
|
||||
memcpy( szResult + 1, szMsg, iLen );
|
||||
szResult[ iLen + 1 ] = '\0';
|
||||
hb_macroGenMessage( szResult, bIsObject, HB_COMP_PARAM );
|
||||
hb_xfree( szResult );
|
||||
}
|
||||
|
||||
/* generates the pcode to pop a value from the virtual machine stack onto a variable */
|
||||
|
||||
@@ -548,7 +548,7 @@ static HB_DYNS_PTR hb_memvarFindSymbol( const char * szArg, HB_SIZE ulLen )
|
||||
if( ulLen && szArg && *szArg )
|
||||
{
|
||||
char szUprName[ HB_SYMBOL_NAME_LEN + 1 ];
|
||||
HB_ISIZ iSize = 0;
|
||||
int iSize = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user