diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f832f0b7f0..84dc97a492 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +20000505-19:15 GMT+1 Ryszard Glab + + *include/hbapi.h + *include/hbexprop.h + *source/common/expropt1.c + *source/macro/macro.y + *source/vm/macro.c + * added int exprType for HB_MACRO structure + * TYPE( "{|| NotLinked()}" ) returns now 'B' instead of 'UI' + + 20000505-17:53 GMT+1 Ryszard Glab *include/hbcomp.h diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 8e829a7396..650e8712f0 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -491,6 +491,7 @@ typedef struct HB_MACRO_ /* a macro compiled pcode container */ void * pParseInfo; /* data needed by the parser - it should be 'void *' to allow different implementation of macr compiler */ USHORT uiNameLen; /* the maximum symbol name length */ BOOL bShortCuts; /* are we using logical shorcuts (in OR/AND) */ + int exprType; /* type of successfully compiled expression */ } HB_MACRO, * HB_MACRO_PTR; extern void hb_macroGetValue( HB_ITEM_PTR ); diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index 14df2f9252..3bc2072c92 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -329,6 +329,7 @@ HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR, HB_EXPR_PTR ); ULONG hb_compExprListLen( HB_EXPR_PTR ); void hb_compExprClear( HB_EXPR_PTR ); char * hb_compExprDescription( HB_EXPR_PTR ); +int hb_compExprType( HB_EXPR_PTR ); void hb_compExprFree( HB_EXPR_PTR, HB_MACRO_DECL ); void hb_compExprErrorType( HB_EXPR_PTR, HB_MACRO_DECL ); diff --git a/harbour/source/common/expropt1.c b/harbour/source/common/expropt1.c index bfdb1da9d3..5cb3d5afcb 100644 --- a/harbour/source/common/expropt1.c +++ b/harbour/source/common/expropt1.c @@ -33,8 +33,6 @@ * */ -/* TOFIX: Split the code, since MSC8 can't compile it, even in Huge model. */ - /* TODO: * - Correct post- and pre- operations to correctly handle the following code * a[ i++ ]++ @@ -144,6 +142,11 @@ char * hb_compExprDescription( HB_EXPR_PTR pExpr ) return s_OperTable[ 0 ]; } +int hb_compExprType( HB_EXPR_PTR pExpr ) +{ + return ( int ) pExpr->ExprType; +} + /* ************************************************************************* */ HB_EXPR_PTR hb_compExprNewEmpty( void ) diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index 19b16418b7..76c967961b 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -189,6 +189,7 @@ int yylex( YYSTYPE *, HB_MACRO_PTR ); %% Main : Expression '\n' { + HB_MACRO_DATA->exprType = hb_compExprType( $1 ); if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH ) hb_compExprDelete( hb_compExprGenPush( $1, HB_MACRO_PARAM ), HB_MACRO_PARAM ); else @@ -197,6 +198,7 @@ Main : Expression '\n' { } | Expression { + HB_MACRO_DATA->exprType = hb_compExprType( $1 ); if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH ) hb_compExprDelete( hb_compExprGenPush( $1, HB_MACRO_PARAM ), HB_MACRO_PARAM ); else diff --git a/harbour/source/vm/macro.c b/harbour/source/vm/macro.c index 9ab0ba677e..d0b7563493 100644 --- a/harbour/source/vm/macro.c +++ b/harbour/source/vm/macro.c @@ -74,6 +74,11 @@ static int hb_macroParse( HB_MACRO_PTR pMacro, char * szString ) pMacro->pCodeInfo->pPrev = NULL; HB_TRACE(HB_TR_DEBUG, ("hb_macroParse.(%p, %s)", pMacro, szString)); pMacro->pCodeInfo->pCode = ( BYTE * ) hb_xgrab( HB_PCODE_SIZE ); + + /* reset the type of compiled expression - this should be filled after + * successfully compilation + */ + pMacro->exprType = HB_ET_NONE; return hb_compParse( pMacro ); } @@ -661,7 +666,14 @@ char * hb_macroGetType( HB_ITEM_PTR pItem ) { /* passed string was successfully compiled */ - if( struMacro.status & HB_MACRO_UNKN_SYM ) + if( struMacro.exprType == HB_ET_CODEBLOCK ) + { + /* Clipper ignores any undeclared symbols or UDFs if the + * compiled expression is a valid codeblock + */ + szType ="B"; + } + else if( struMacro.status & HB_MACRO_UNKN_SYM ) { /* request for a symbol that is not in a symbol table */