2006-12-01 18:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/pack_src.sh
+ added packing *.yy[ch] files
* harbour/makefile.bc
* harbour/makefile.vc
* harbour/include/hbcomp.h
* harbour/include/hbcompdf.h
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* harbour/include/hbexprc.c
* harbour/include/hbexprop.h
* harbour/include/hbpp.h
* harbour/source/common/expropt1.c
* harbour/source/common/expropt2.c
* harbour/source/compiler/Makefile
* harbour/source/compiler/complex.c
* harbour/source/compiler/harbour.c
* harbour/source/compiler/harbour.l
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
* harbour/source/compiler/hbgenerr.c
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyc
* harbour/source/pp/ppcore.c
+ added hb_comp prefix to grammar/lexer compiler public functions to
reduce possible conflict with 3-rd party code which may use default
yy prefix.
! do not use bison destructors for expressions. Internal bison logic
cannot properly detect if expression was used or not in some of our
grammar rules and it's possible that some expressions will not be freed
and some other freed twice.
! added protection against multiple destructors execution for CBSTART
and LITERAL tokens
* added small garbage collector for deallocating expressions which were
not freed (such situation can happen in syntax errors)
% some optimizations in used structures to reduce their sizes
+ added protection against execution PCODE optimizations for functions
which were not cleanly compiled.
* harbour/source/rtl/idle.c
* use const in nanosec() timeout declaration
This commit is contained in:
@@ -8,6 +8,50 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2006-12-01 18:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/bin/pack_src.sh
|
||||
+ added packing *.yy[ch] files
|
||||
|
||||
* harbour/makefile.bc
|
||||
* harbour/makefile.vc
|
||||
* harbour/include/hbcomp.h
|
||||
* harbour/include/hbcompdf.h
|
||||
* harbour/include/hbexpra.c
|
||||
* harbour/include/hbexprb.c
|
||||
* harbour/include/hbexprc.c
|
||||
* harbour/include/hbexprop.h
|
||||
* harbour/include/hbpp.h
|
||||
* harbour/source/common/expropt1.c
|
||||
* harbour/source/common/expropt2.c
|
||||
* harbour/source/compiler/Makefile
|
||||
* harbour/source/compiler/complex.c
|
||||
* harbour/source/compiler/harbour.c
|
||||
* harbour/source/compiler/harbour.l
|
||||
* harbour/source/compiler/harbour.y
|
||||
* harbour/source/compiler/harbour.yyc
|
||||
* harbour/source/compiler/harbour.yyh
|
||||
* harbour/source/compiler/hbgenerr.c
|
||||
* harbour/source/macro/macro.y
|
||||
* harbour/source/macro/macro.yyc
|
||||
* harbour/source/pp/ppcore.c
|
||||
+ added hb_comp prefix to grammar/lexer compiler public functions to
|
||||
reduce possible conflict with 3-rd party code which may use default
|
||||
yy prefix.
|
||||
! do not use bison destructors for expressions. Internal bison logic
|
||||
cannot properly detect if expression was used or not in some of our
|
||||
grammar rules and it's possible that some expressions will not be freed
|
||||
and some other freed twice.
|
||||
! added protection against multiple destructors execution for CBSTART
|
||||
and LITERAL tokens
|
||||
* added small garbage collector for deallocating expressions which were
|
||||
not freed (such situation can happen in syntax errors)
|
||||
% some optimizations in used structures to reduce their sizes
|
||||
+ added protection against execution PCODE optimizations for functions
|
||||
which were not cleanly compiled.
|
||||
|
||||
* harbour/source/rtl/idle.c
|
||||
* use const in nanosec() timeout declaration
|
||||
|
||||
2006-11-30 03:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbcompdf.h
|
||||
* harbour/source/compiler/harbour.l
|
||||
|
||||
@@ -76,8 +76,7 @@ $hb_collect source/Makefile
|
||||
# SOURCE\COMPILER
|
||||
$hb_collect source/compiler/Makefile
|
||||
$hb_collect source/compiler/*.[cylh]
|
||||
$hb_collect source/compiler/*.sl[xy]
|
||||
$hb_collect source/compiler/*.simple
|
||||
$hb_collect source/compiler/*.yy[ch]
|
||||
|
||||
# SOURCE\DEBUG
|
||||
$hb_collect source/debug/Makefile
|
||||
@@ -94,7 +93,7 @@ $hb_collect source/codepage/*.[ch]
|
||||
# SOURCE\MACRO
|
||||
$hb_collect source/macro/Makefile
|
||||
$hb_collect source/macro/*.[cylh]
|
||||
$hb_collect source/macro/*.slx
|
||||
$hb_collect source/macro/*.yy[ch]
|
||||
|
||||
# SOURCE\PP
|
||||
$hb_collect source/pp/Makefile
|
||||
|
||||
@@ -86,8 +86,9 @@ extern void hb_compPCodeTrace( PFUNCTION, HB_PCODE_FUNC_PTR *, void * );
|
||||
|
||||
extern void hb_compGenLabelTable( PFUNCTION pFunc, PHB_LABEL_INFO label_info );
|
||||
|
||||
/* compiler PP functions and variables */
|
||||
extern void hb_compInitPP( HB_COMP_DECL, int argc, char * argv[] );
|
||||
|
||||
extern int hb_compparse( HB_COMP_DECL );
|
||||
extern void hb_compParserStop( HB_COMP_DECL );
|
||||
|
||||
#define VS_NONE 0
|
||||
|
||||
@@ -146,6 +146,7 @@ typedef struct __FUNC
|
||||
ULONG iNOOPs; /* NOOPs Counter */
|
||||
ULONG iJumps; /* Jumps Counter */
|
||||
BOOL bLateEval; /* TRUE if accessing of declared (compile time) variables is allowed */
|
||||
BOOL bError; /* error during function compilation */
|
||||
struct __FUNC * pOwner; /* pointer to the function/procedure that owns the codeblock */
|
||||
struct __FUNC * pNext; /* pointer to the next defined function */
|
||||
HB_ENUMERATOR_PTR pEnum; /* pointer to FOR EACH variables */
|
||||
@@ -333,21 +334,23 @@ typedef struct HB_EXPR_
|
||||
BOOL asLogical; /* logical value */
|
||||
struct
|
||||
{
|
||||
char *string; /* literal strings */
|
||||
BOOL dealloc; /* automatic deallocate on expresion deletion */
|
||||
char *string; /* literal strings */
|
||||
BOOL dealloc; /* automatic deallocate on expresion deletion */
|
||||
} asString;
|
||||
struct
|
||||
{
|
||||
struct HB_EXPR_ *pMacro; /* macro variable */
|
||||
char *szName; /* variable name */
|
||||
} asRTVar; /* PUBLIC or PRIVATE variable declaration */
|
||||
struct HB_EXPR_ *pMacro; /* macro variable */
|
||||
char *szName; /* variable name */
|
||||
} asRTVar; /* PUBLIC or PRIVATE variable declaration */
|
||||
struct
|
||||
{
|
||||
HB_LONG lVal; /* long value */
|
||||
double dVal; /* double value */
|
||||
unsigned char bWidth; /* unsigned char used intentionally */
|
||||
unsigned char bDec; /* unsigned char used intentionally */
|
||||
unsigned char NumType; /* used to distinguish LONG and DOUBLE */
|
||||
union {
|
||||
HB_LONG l; /* long value */
|
||||
double d; /* double value */
|
||||
} val;
|
||||
unsigned char bWidth; /* unsigned char used intentionally */
|
||||
unsigned char bDec; /* unsigned char used intentionally */
|
||||
unsigned char NumType; /* used to distinguish LONG and DOUBLE */
|
||||
} asNum;
|
||||
struct
|
||||
{
|
||||
@@ -359,16 +362,16 @@ typedef struct HB_EXPR_
|
||||
} asMacro;
|
||||
struct
|
||||
{
|
||||
struct HB_EXPR_ *pExprList; /* list elements */
|
||||
struct HB_EXPR_ *pIndex; /* array index, others */
|
||||
struct HB_EXPR_ *pExprList; /* list elements */
|
||||
struct HB_EXPR_ *pIndex; /* array index, others */
|
||||
} asList;
|
||||
struct
|
||||
{
|
||||
char *string; /* source code of a codeblock */
|
||||
char *string; /* source code of a codeblock */
|
||||
USHORT length;
|
||||
USHORT flags; /* HB_BLOCK_MACRO, HB_BLOCK_LATEEVAL */
|
||||
struct HB_EXPR_ *pExprList; /* list elements */
|
||||
HB_CBVAR_PTR pLocals; /* list of local variables */
|
||||
USHORT isMacro; /* TRUE=codeblock contains macro expression */
|
||||
USHORT lateEval; /* TRUE=late evaluation of macro */
|
||||
} asCodeblock;
|
||||
struct
|
||||
{
|
||||
@@ -520,6 +523,14 @@ typedef struct _HB_COMP_LEX
|
||||
}
|
||||
HB_COMP_LEX, * PHB_COMP_LEX;
|
||||
|
||||
typedef struct _HB_EXPRLST
|
||||
{
|
||||
HB_EXPR Expression;
|
||||
struct _HB_EXPRLST *pPrev;
|
||||
struct _HB_EXPRLST *pNext;
|
||||
}
|
||||
HB_EXPRLST, * PHB_EXPRLST;
|
||||
|
||||
typedef struct _HB_COMP
|
||||
{
|
||||
/* common to macro compiler members */
|
||||
@@ -528,6 +539,7 @@ typedef struct _HB_COMP
|
||||
|
||||
/* compiler only members */
|
||||
PHB_COMP_LEX pLex;
|
||||
PHB_EXPRLST pExprLst;
|
||||
|
||||
HB_HASH_TABLE_PTR pIdentifiers;
|
||||
FUNCTIONS functions;
|
||||
|
||||
@@ -65,8 +65,6 @@
|
||||
|
||||
/* memory allocation
|
||||
*/
|
||||
#define HB_XGRAB( size ) hb_xgrab( (size) )
|
||||
#define HB_XFREE( pPtr ) hb_xfree( (void *)(pPtr) )
|
||||
|
||||
/* Table with operators precedence
|
||||
* NOTE:
|
||||
@@ -135,6 +133,69 @@ static HB_CBVAR_PTR hb_compExprCBVarNew( char *, BYTE );
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
#if !defined( HB_MACRO_SUPPORT )
|
||||
static HB_EXPR_PTR hb_compExprAlloc( HB_COMP_DECL )
|
||||
{
|
||||
PHB_EXPRLST pExpItm = ( PHB_EXPRLST ) hb_xgrab( sizeof( HB_EXPRLST ) );
|
||||
|
||||
pExpItm->pNext = HB_COMP_PARAM->pExprLst;
|
||||
HB_COMP_PARAM->pExprLst = pExpItm;
|
||||
if( pExpItm->pNext )
|
||||
{
|
||||
pExpItm->pPrev = pExpItm->pNext->pPrev;
|
||||
pExpItm->pNext->pPrev = pExpItm;
|
||||
pExpItm->pPrev->pNext = pExpItm;
|
||||
}
|
||||
else
|
||||
pExpItm->pPrev = pExpItm->pNext = pExpItm;
|
||||
|
||||
return &pExpItm->Expression;
|
||||
}
|
||||
|
||||
static void hb_compExprDealloc( HB_EXPR_PTR pExpr, HB_COMP_DECL )
|
||||
{
|
||||
if( HB_COMP_PARAM->pExprLst )
|
||||
{
|
||||
PHB_EXPRLST pExpItm = ( PHB_EXPRLST ) pExpr;
|
||||
|
||||
pExpItm->pNext->pPrev = pExpItm->pPrev;
|
||||
pExpItm->pPrev->pNext = pExpItm->pNext;
|
||||
if( pExpItm == HB_COMP_PARAM->pExprLst )
|
||||
{
|
||||
if( pExpItm->pNext == pExpItm )
|
||||
HB_COMP_PARAM->pExprLst = NULL;
|
||||
else
|
||||
HB_COMP_PARAM->pExprLst = pExpItm->pNext;
|
||||
}
|
||||
hb_xfree( pExpItm );
|
||||
}
|
||||
}
|
||||
|
||||
void hb_compExprLstDealloc( HB_COMP_DECL )
|
||||
{
|
||||
if( HB_COMP_PARAM->pExprLst )
|
||||
{
|
||||
PHB_EXPRLST pExpItm, pExp;
|
||||
pExpItm = pExp = HB_COMP_PARAM->pExprLst;
|
||||
HB_COMP_PARAM->pExprLst = NULL;
|
||||
do
|
||||
{
|
||||
hb_compExprDelete( &pExp->Expression, HB_COMP_PARAM );
|
||||
pExp = pExp->pNext;
|
||||
}
|
||||
while( pExp != pExpItm );
|
||||
do
|
||||
{
|
||||
PHB_EXPRLST pFree = pExp;
|
||||
pExp = pExp->pNext;
|
||||
hb_xfree( pFree );
|
||||
}
|
||||
while( pExp != pExpItm );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE iType, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pExpr;
|
||||
@@ -144,8 +205,7 @@ HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE iType, HB_COMP_DECL )
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
pExpr = hb_macroExprNew( HB_COMP_PARAM );
|
||||
#else
|
||||
HB_SYMBOL_UNUSED( HB_COMP_PARAM );
|
||||
pExpr = ( HB_EXPR_PTR ) HB_XGRAB( sizeof( HB_EXPR ) );
|
||||
pExpr = hb_compExprAlloc( HB_COMP_PARAM );
|
||||
#endif
|
||||
pExpr->ExprType = iType;
|
||||
pExpr->pNext = NULL;
|
||||
@@ -157,13 +217,14 @@ HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE iType, HB_COMP_DECL )
|
||||
|
||||
/* Delete self - all components will be deleted somewhere else
|
||||
*/
|
||||
void hb_compExprClear( HB_EXPR_PTR pExpr )
|
||||
void hb_compExprClear( HB_EXPR_PTR pExpr, HB_COMP_DECL )
|
||||
{
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
pExpr->ExprType = HB_ET_NONE;
|
||||
#else
|
||||
if( --pExpr->Counter == 0 )
|
||||
HB_XFREE( pExpr );
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
pExpr->ExprType = HB_ET_NONE;
|
||||
HB_SYMBOL_UNUSED( HB_COMP_PARAM );
|
||||
#else
|
||||
hb_compExprDealloc( pExpr, HB_COMP_PARAM );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -172,19 +233,15 @@ void hb_compExprClear( HB_EXPR_PTR pExpr )
|
||||
void hb_compExprDelete( HB_EXPR_PTR pExpr, HB_COMP_DECL )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprDelete(%p,%p)", pExpr, HB_COMP_PARAM));
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
if( pExpr && pExpr->ExprType != HB_ET_NONE )
|
||||
{
|
||||
HB_EXPR_USE( pExpr, HB_EA_DELETE );
|
||||
pExpr->ExprType = HB_ET_NONE;
|
||||
}
|
||||
#else
|
||||
if( pExpr && --pExpr->Counter == 0 )
|
||||
{
|
||||
HB_EXPR_USE( pExpr, HB_EA_DELETE );
|
||||
HB_XFREE( pExpr );
|
||||
}
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
pExpr->ExprType = HB_ET_NONE;
|
||||
#else
|
||||
hb_compExprDealloc( pExpr, HB_COMP_PARAM );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete all components and delete self
|
||||
@@ -198,7 +255,7 @@ void hb_compExprFree( HB_EXPR_PTR pExpr, HB_COMP_DECL )
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
pExpr->ExprType = HB_ET_NONE;
|
||||
#else
|
||||
HB_XFREE( pExpr );
|
||||
hb_compExprDealloc( pExpr, HB_COMP_PARAM );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -434,7 +491,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM
|
||||
*/
|
||||
pArg->value.asList.pIndex = NULL;
|
||||
pArg->value.asList.pExprList = NULL;
|
||||
hb_compExprClear( pArg );
|
||||
hb_compExprClear( pArg, HB_COMP_PARAM );
|
||||
/* Create an array with index elements
|
||||
*/
|
||||
pIndex = HB_EXPR_PCODE1( hb_compExprNewArray, hb_compExprNewList( pIndex, HB_COMP_PARAM ) );
|
||||
@@ -482,7 +539,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM
|
||||
{
|
||||
pVar = pBase->value.asList.pExprList;
|
||||
pBase->value.asList.pExprList = NULL;
|
||||
hb_compExprClear( pBase );
|
||||
hb_compExprClear( pBase, HB_COMP_PARAM );
|
||||
pBase = pVar;
|
||||
}
|
||||
}
|
||||
@@ -933,7 +990,7 @@ static HB_CBVAR_PTR hb_compExprCBVarNew( char * szVarName, BYTE bType )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprCBVarNew(%s)", szVarName));
|
||||
|
||||
pVar = ( HB_CBVAR_PTR ) HB_XGRAB( sizeof( HB_CBVAR ) );
|
||||
pVar = ( HB_CBVAR_PTR ) hb_xgrab( sizeof( HB_CBVAR ) );
|
||||
|
||||
pVar->szName = szVarName;
|
||||
pVar->bType = bType;
|
||||
@@ -953,7 +1010,7 @@ void hb_compExprCBVarDel( HB_CBVAR_PTR pVars )
|
||||
{
|
||||
pDel = pVars;
|
||||
pVars = pVars->pNext;
|
||||
HB_XFREE( pDel );
|
||||
hb_xfree( pDel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
|
||||
/* memory allocation
|
||||
*/
|
||||
#define HB_XGRAB( size ) hb_xgrab( (size) )
|
||||
#define HB_XFREE( pPtr ) hb_xfree( (void *)(pPtr) )
|
||||
|
||||
/* Forward declarations
|
||||
*/
|
||||
@@ -284,9 +282,9 @@ static HB_EXPR_FUNC( hb_compExprUseNumeric )
|
||||
break;
|
||||
case HB_EA_PUSH_PCODE:
|
||||
if( pSelf->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
HB_EXPR_PCODE3( hb_compGenPushDouble, pSelf->value.asNum.dVal, pSelf->value.asNum.bWidth, pSelf->value.asNum.bDec );
|
||||
HB_EXPR_PCODE3( hb_compGenPushDouble, pSelf->value.asNum.val.d, pSelf->value.asNum.bWidth, pSelf->value.asNum.bDec );
|
||||
else
|
||||
HB_EXPR_PCODE1( hb_compGenPushLong, pSelf->value.asNum.lVal );
|
||||
HB_EXPR_PCODE1( hb_compGenPushLong, pSelf->value.asNum.val.l );
|
||||
break;
|
||||
case HB_EA_POP_PCODE:
|
||||
break;
|
||||
@@ -317,7 +315,7 @@ static HB_EXPR_FUNC( hb_compExprUseDate )
|
||||
hb_compErrorLValue( HB_COMP_PARAM, pSelf );
|
||||
break;
|
||||
case HB_EA_PUSH_PCODE:
|
||||
HB_EXPR_PCODE1( hb_compGenPushDate, pSelf->value.asNum.lVal );
|
||||
HB_EXPR_PCODE1( hb_compGenPushDate, pSelf->value.asNum.val.l );
|
||||
break;
|
||||
case HB_EA_POP_PCODE:
|
||||
break;
|
||||
@@ -395,7 +393,7 @@ static HB_EXPR_FUNC( hb_compExprUseString )
|
||||
|
||||
case HB_EA_DELETE:
|
||||
if( pSelf->value.asString.dealloc )
|
||||
HB_XFREE( pSelf->value.asString.string );
|
||||
hb_xfree( pSelf->value.asString.string );
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
@@ -423,11 +421,12 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock )
|
||||
#if defined(HB_MACRO_SUPPORT)
|
||||
HB_EXPR_PCODE1( hb_compExprCodeblockPush, pSelf );
|
||||
#else
|
||||
if( !pSelf->value.asCodeblock.isMacro || pSelf->value.asCodeblock.lateEval )
|
||||
hb_compExprCodeblockPush( pSelf, TRUE, HB_COMP_PARAM );
|
||||
else
|
||||
if( ( pSelf->value.asCodeblock.flags & HB_BLOCK_MACRO ) &&
|
||||
!( pSelf->value.asCodeblock.flags & HB_BLOCK_LATEEVAL ) )
|
||||
/* early evaluation of a macro */
|
||||
hb_compExprCodeblockEarly( pSelf, HB_COMP_PARAM );
|
||||
else
|
||||
hb_compExprCodeblockPush( pSelf, TRUE, HB_COMP_PARAM );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -445,7 +444,7 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock )
|
||||
hb_compExprCBVarDel( pSelf->value.asCodeblock.pLocals );
|
||||
|
||||
if( pSelf->value.asCodeblock.string )
|
||||
HB_XFREE( pSelf->value.asCodeblock.string );
|
||||
hb_xfree( pSelf->value.asCodeblock.string );
|
||||
|
||||
/* Delete all expressions of the block. */
|
||||
while( pExp )
|
||||
@@ -579,12 +578,9 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
* {|| &variable+1} => &( '{|| &variable+1}' )
|
||||
*/
|
||||
HB_EXPR_PTR pNew;
|
||||
char *cStr;
|
||||
|
||||
hb_compExprCodeblockPush( pSelf, FALSE, HB_COMP_PARAM );
|
||||
|
||||
cStr = pSelf->value.asCodeblock.string;
|
||||
pNew = hb_compExprNewMacro( hb_compExprNewString( cStr, strlen( cStr ), FALSE, HB_COMP_PARAM ), 0, NULL, HB_COMP_PARAM );
|
||||
pNew = hb_compExprNewMacro( hb_compExprNewString( pSelf->value.asCodeblock.string, pSelf->value.asCodeblock.length, FALSE, HB_COMP_PARAM ), 0, NULL, HB_COMP_PARAM );
|
||||
HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE );
|
||||
hb_compExprDelete( pNew, HB_COMP_PARAM );
|
||||
HB_EXPR_PCODE0( hb_compCodeBlockStop );
|
||||
@@ -1249,9 +1245,9 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt )
|
||||
|
||||
pExpr = pExpr->value.asList.pExprList; /* the first element in the array */
|
||||
if( pIdx->value.asNum.NumType == HB_ET_LONG )
|
||||
lIndex = ( LONG ) pIdx->value.asNum.lVal;
|
||||
lIndex = ( LONG ) pIdx->value.asNum.val.l;
|
||||
else
|
||||
lIndex = ( LONG ) pIdx->value.asNum.dVal;
|
||||
lIndex = ( LONG ) pIdx->value.asNum.val.d;
|
||||
|
||||
if( lIndex > 0 )
|
||||
{
|
||||
@@ -1287,9 +1283,9 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt )
|
||||
LONG lIndex;
|
||||
|
||||
if( pIdx->value.asNum.NumType == HB_ET_LONG )
|
||||
lIndex = ( LONG ) pIdx->value.asNum.lVal;
|
||||
lIndex = ( LONG ) pIdx->value.asNum.val.l;
|
||||
else
|
||||
lIndex = ( LONG ) pIdx->value.asNum.dVal;
|
||||
lIndex = ( LONG ) pIdx->value.asNum.val.d;
|
||||
|
||||
if( lIndex > 0 )
|
||||
HB_EXPR_USE( pExpr, HB_EA_ARRAY_AT );
|
||||
@@ -1777,7 +1773,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar )
|
||||
* NOTE: only integer (long) values are allowed
|
||||
*/
|
||||
if( pAlias->value.asNum.NumType == HB_ET_LONG )
|
||||
HB_EXPR_PCODE4( hb_compGenPushAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, TRUE, NULL, pAlias->value.asNum.lVal );
|
||||
HB_EXPR_PCODE4( hb_compGenPushAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, TRUE, NULL, pAlias->value.asNum.val.l );
|
||||
else
|
||||
hb_compErrorAlias( HB_COMP_PARAM, pAlias );
|
||||
}
|
||||
@@ -1831,7 +1827,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar )
|
||||
* NOTE: only integer (long) values are allowed
|
||||
*/
|
||||
if( pAlias->value.asNum.NumType == HB_ET_LONG )
|
||||
HB_EXPR_PCODE4( hb_compGenPopAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, TRUE, NULL, pAlias->value.asNum.lVal );
|
||||
HB_EXPR_PCODE4( hb_compGenPopAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, TRUE, NULL, pAlias->value.asNum.val.l );
|
||||
else
|
||||
hb_compErrorAlias( HB_COMP_PARAM, pAlias );
|
||||
}
|
||||
@@ -2911,17 +2907,17 @@ static HB_EXPR_FUNC( hb_compExprUseEqual )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.lVal == pRight->value.asNum.lVal) );
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.val.l == pRight->value.asNum.val.l) );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.dVal == pRight->value.asNum.dVal) );
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.val.d == pRight->value.asNum.val.d) );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.lVal == pRight->value.asNum.dVal) );
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.val.l == pRight->value.asNum.val.d) );
|
||||
else
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.dVal == pRight->value.asNum.lVal) );
|
||||
HB_EXPR_PCODE1( hb_compGenPushLogical, (pLeft->value.asNum.val.d == pRight->value.asNum.val.l) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3746,9 +3742,9 @@ static HB_EXPR_FUNC( hb_compExprUseNegate )
|
||||
if( pExpr->ExprType == HB_ET_NUMERIC )
|
||||
{
|
||||
if( pExpr->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
pExpr->value.asNum.dVal = - pExpr->value.asNum.dVal;
|
||||
pExpr->value.asNum.val.d = - pExpr->value.asNum.val.d;
|
||||
else
|
||||
pExpr->value.asNum.lVal = - pExpr->value.asNum.lVal;
|
||||
pExpr->value.asNum.val.l = - pExpr->value.asNum.val.l;
|
||||
pSelf->ExprType = HB_ET_NONE; /* do not delete operator parameter - we are still using it */
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pSelf );
|
||||
pSelf = pExpr;
|
||||
|
||||
@@ -241,7 +241,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL )
|
||||
|
||||
if( iLocal < 256 && hb_compExprIsInteger( pSelf->value.asOperator.pRight ) )
|
||||
{
|
||||
short iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.lVal;
|
||||
short iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.val.l;
|
||||
|
||||
if( bOpEq != HB_P_MINUS || iIncrement >= -INT16_MAX )
|
||||
{
|
||||
@@ -404,7 +404,7 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL )
|
||||
|
||||
if( iLocal < 256 && hb_compExprIsInteger( pSelf->value.asOperator.pRight ) )
|
||||
{
|
||||
short iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.lVal;
|
||||
short iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.val.l;
|
||||
|
||||
if( bOpEq != HB_P_MINUS || iIncrement >= -INT16_MAX )
|
||||
{
|
||||
|
||||
@@ -77,7 +77,9 @@ typedef HB_EXPR_PTR HB_EXPR_ACTION( HB_EXPR_PTR pSelf, int iMessage, HB_COMP_DE
|
||||
#define HB_EXPR_PCODE4( action, p1, p2, p3, p4 ) action( (p1), (p2), (p3), (p4), HB_COMP_PARAM )
|
||||
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
extern HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL );
|
||||
#else
|
||||
extern void hb_compExprLstDealloc( HB_COMP_DECL );
|
||||
#endif
|
||||
|
||||
extern HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE, HB_COMP_DECL );
|
||||
@@ -89,7 +91,7 @@ extern HB_EXPR_PTR hb_compExprNewDate( HB_LONG, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewString( char *, ULONG, BOOL, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewLogical( int, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewSelf( HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewCodeBlock( char *, BOOL, BOOL, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewCodeBlock( char *, int, int, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewVar( char *, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL );
|
||||
@@ -150,7 +152,7 @@ extern HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DE
|
||||
extern HB_EXPR_PTR hb_compExprClone( HB_EXPR_PTR pSrc );
|
||||
extern ULONG hb_compExprListLen( HB_EXPR_PTR );
|
||||
extern ULONG hb_compExprMacroListLen( HB_EXPR_PTR );
|
||||
extern void hb_compExprClear( HB_EXPR_PTR );
|
||||
extern void hb_compExprClear( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern const char * hb_compExprDescription( HB_EXPR_PTR );
|
||||
extern int hb_compExprType( HB_EXPR_PTR );
|
||||
extern int hb_compExprIsInteger( HB_EXPR_PTR );
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
#define HB_BLOCK_MACRO 1
|
||||
#define HB_BLOCK_LATEEVAL 2
|
||||
|
||||
/* #pragma {__text,__stream,__cstream}|functionOut|functionEnd|functionStart */
|
||||
#define HB_PP_STREAM_OFF 0 /* standard preprocessing */
|
||||
#define HB_PP_STREAM_COMMENT 1 /* multiline comment */
|
||||
@@ -640,7 +643,7 @@ extern BOOL hb_pp_eof( PHB_PP_STATE pState );
|
||||
|
||||
extern void hb_pp_tokenUpper( PHB_PP_TOKEN pToken );
|
||||
extern void hb_pp_tokenToString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken );
|
||||
extern char * hb_pp_tokenBlockString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken, int *piType );
|
||||
extern char * hb_pp_tokenBlockString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken, int * piType, int * piLen );
|
||||
extern PHB_PP_STATE hb_pp_lexNew( char * pString, ULONG ulLen );
|
||||
extern PHB_PP_TOKEN hb_pp_lexGet( PHB_PP_STATE pState );
|
||||
extern PHB_PP_TOKEN hb_pp_tokenGet( PHB_PP_STATE pState );
|
||||
|
||||
@@ -636,7 +636,7 @@ $(OBJ_DIR)\macroy.c : $(MACRO_DIR)\macro.y
|
||||
bison --no-line -p hb_macro -d $** -o$@
|
||||
|
||||
$(OBJ_DIR)\harboury.c : $(HARBOUR_DIR)\harbour.y
|
||||
bison --no-line -d $** -o$@
|
||||
bison --no-line -p hb_comp -d $** -o$@
|
||||
|
||||
!else
|
||||
|
||||
@@ -656,7 +656,7 @@ $(OBJ_DIR)\macrol.c : $(MACRO_DIR)\macro.l
|
||||
flex -Phb_macro -i -8 -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\harbourl.c : $(HARBOUR_DIR)\harbour.l
|
||||
flex -i -8 -o$@ $**
|
||||
flex -Phb_comp -i -8 -o$@ $**
|
||||
|
||||
#**********************************************************
|
||||
|
||||
@@ -680,7 +680,7 @@ $(DLL_OBJ_DIR)\macroy.c : $(MACRO_DIR)\macro.y
|
||||
bison --no-line -p hb_macro -d $** -o$@
|
||||
|
||||
$(DLL_OBJ_DIR)\harboury.c : $(HARBOUR_DIR)\harbour.y
|
||||
bison --no-line -d $** -o$@
|
||||
bison --no-line -p hb_comp -d $** -o$@
|
||||
|
||||
!else
|
||||
|
||||
@@ -700,7 +700,7 @@ $(DLL_OBJ_DIR)\macrol.c : $(MACRO_DIR)\macro.l
|
||||
flex -Phb_macro -i -8 -o$@ $**
|
||||
|
||||
$(DLL_OBJ_DIR)\harbourl.c : $(HARBOUR_DIR)\harbour.l
|
||||
flex -i -8 -o$@ $**
|
||||
flex -Phb_comp -i -8 -o$@ $**
|
||||
|
||||
#**********************************************************
|
||||
|
||||
|
||||
@@ -969,7 +969,7 @@ $(OBJ_DIR)\macroy.c : $(MACRO_DIR)\macro.y
|
||||
bison --no-line -p hb_macro -d $** -o$@
|
||||
|
||||
$(OBJ_DIR)\harboury.c : $(HARBOUR_DIR)\harbour.y
|
||||
bison --no-line -d $** -o$@
|
||||
bison --no-line -p hb_comp -d $** -o$@
|
||||
|
||||
!else
|
||||
|
||||
@@ -995,7 +995,7 @@ $(OBJ_DIR)\macrol.obj : $(OBJ_DIR)\macrol.c
|
||||
|
||||
|
||||
$(OBJ_DIR)\harbourl.c : $(HARBOUR_DIR)\harbour.l
|
||||
flex -i -8 -o$@ $**
|
||||
flex -Phb_comp -i -8 -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\harboury.obj : $(OBJ_DIR)\harboury.c
|
||||
$(OBJ_DIR)\harbourl.obj : $(OBJ_DIR)\harbourl.c
|
||||
@@ -1020,10 +1020,10 @@ $(DLL_OBJ_DIR)\macrol.obj : $(DLL_OBJ_DIR)\macrol.c
|
||||
#**********************************************************
|
||||
|
||||
$(DLL_OBJ_DIR)\harboury.c : $(HARBOUR_DIR)\harbour.y
|
||||
bison --no-line -d $** -o$@
|
||||
bison --no-line -p hb_comp -d $** -o$@
|
||||
|
||||
$(DLL_OBJ_DIR)\harbourl.c : $(HARBOUR_DIR)\harbour.l
|
||||
flex -i -8 -o$@ $**
|
||||
flex -Phb_comp -i -8 -o$@ $**
|
||||
|
||||
$(DLL_OBJ_DIR)\harboury.obj : $(DLL_OBJ_DIR)\harboury.c
|
||||
$(DLL_OBJ_DIR)\harbourl.obj : $(DLL_OBJ_DIR)\harbourl.c
|
||||
|
||||
@@ -157,7 +157,7 @@ int hb_compExprType( HB_EXPR_PTR pExpr )
|
||||
int hb_compExprIsInteger( HB_EXPR_PTR pExpr )
|
||||
{
|
||||
return ( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG &&
|
||||
HB_LIM_INT16( pExpr->value.asNum.lVal ) );
|
||||
HB_LIM_INT16( pExpr->value.asNum.val.l ) );
|
||||
}
|
||||
|
||||
int hb_compExprIsLong( HB_EXPR_PTR pExpr )
|
||||
@@ -187,15 +187,15 @@ int hb_compExprAsStringLen( HB_EXPR_PTR pExpr )
|
||||
int hb_compExprAsInteger( HB_EXPR_PTR pExpr )
|
||||
{
|
||||
if( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG )
|
||||
return ( int ) pExpr->value.asNum.lVal;
|
||||
return ( int ) pExpr->value.asNum.val.l;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
long hb_compExprAsLong( HB_EXPR_PTR pExpr )
|
||||
HB_LONG hb_compExprAsLong( HB_EXPR_PTR pExpr )
|
||||
{
|
||||
if( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG )
|
||||
return pExpr->value.asNum.lVal;
|
||||
return pExpr->value.asNum.val.l;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ HB_EXPR_PTR hb_compExprNewDouble( double dValue, BYTE ucWidth, BYTE ucDec,
|
||||
|
||||
pExpr = hb_compExprNew( HB_ET_NUMERIC, HB_COMP_PARAM );
|
||||
|
||||
pExpr->value.asNum.dVal = dValue;
|
||||
pExpr->value.asNum.val.d = dValue;
|
||||
pExpr->value.asNum.bWidth = ucWidth;
|
||||
pExpr->value.asNum.bDec = ucDec;
|
||||
pExpr->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -248,7 +248,7 @@ HB_EXPR_PTR hb_compExprNewLong( HB_LONG lValue, HB_COMP_DECL )
|
||||
|
||||
pExpr = hb_compExprNew( HB_ET_NUMERIC, HB_COMP_PARAM );
|
||||
|
||||
pExpr->value.asNum.lVal = lValue;
|
||||
pExpr->value.asNum.val.l = lValue;
|
||||
pExpr->value.asNum.bDec = 0;
|
||||
pExpr->value.asNum.NumType = HB_ET_LONG;
|
||||
pExpr->ValType = HB_EV_NUMERIC;
|
||||
@@ -264,18 +264,17 @@ HB_EXPR_PTR hb_compExprNewDate( HB_LONG lValue, HB_COMP_DECL )
|
||||
|
||||
pExpr = hb_compExprNew( HB_ET_DATE, HB_COMP_PARAM );
|
||||
|
||||
pExpr->value.asNum.lVal = lValue;
|
||||
pExpr->value.asNum.val.l = lValue;
|
||||
pExpr->ValType = HB_EV_DATE;
|
||||
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, BOOL isMacro, BOOL lateEval,
|
||||
HB_COMP_DECL )
|
||||
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, int iLen, int iFlags, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pExpr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%u,%u,%p)",string,isMacro,lateEval,HB_COMP_PARAM));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%d,%d,%p)",string, iLen, iFlags, HB_COMP_PARAM));
|
||||
|
||||
pExpr = hb_compExprNew( HB_ET_CODEBLOCK, HB_COMP_PARAM );
|
||||
|
||||
@@ -283,8 +282,8 @@ HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, BOOL isMacro, BOOL lateEval,
|
||||
pExpr->value.asCodeblock.pLocals = NULL; /* this will hold local variables declarations */
|
||||
pExpr->ValType = HB_EV_CODEBLOCK;
|
||||
pExpr->value.asCodeblock.string = string;
|
||||
pExpr->value.asCodeblock.isMacro = isMacro;
|
||||
pExpr->value.asCodeblock.lateEval = lateEval;
|
||||
pExpr->value.asCodeblock.length = ( USHORT ) iLen;
|
||||
pExpr->value.asCodeblock.flags = ( USHORT ) iFlags;
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
@@ -853,13 +852,13 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr, HB_COMP_DECL )
|
||||
{
|
||||
if( pNegExpr->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
{
|
||||
pNegExpr->value.asNum.dVal = - pNegExpr->value.asNum.dVal;
|
||||
pNegExpr->value.asNum.bWidth = HB_DBL_LENGTH( pNegExpr->value.asNum.dVal );
|
||||
pNegExpr->value.asNum.val.d = - pNegExpr->value.asNum.val.d;
|
||||
pNegExpr->value.asNum.bWidth = HB_DBL_LENGTH( pNegExpr->value.asNum.val.d );
|
||||
}
|
||||
else
|
||||
{
|
||||
pNegExpr->value.asNum.lVal = - pNegExpr->value.asNum.lVal;
|
||||
pNegExpr->value.asNum.bWidth = HB_LONG_LENGTH( pNegExpr->value.asNum.lVal );
|
||||
pNegExpr->value.asNum.val.l = - pNegExpr->value.asNum.val.l;
|
||||
pNegExpr->value.asNum.bWidth = HB_LONG_LENGTH( pNegExpr->value.asNum.val.l );
|
||||
}
|
||||
pExpr = pNegExpr;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,11 @@ HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG && pRight->value.asNum.NumType == HB_ET_LONG )
|
||||
{
|
||||
if( pRight->value.asNum.lVal )
|
||||
if( pRight->value.asNum.val.l )
|
||||
{
|
||||
HB_LONG lVal = pLeft->value.asNum.lVal % pRight->value.asNum.lVal;
|
||||
HB_LONG lVal = pLeft->value.asNum.val.l % pRight->value.asNum.val.l;
|
||||
|
||||
pSelf->value.asNum.lVal = lVal;
|
||||
pSelf->value.asNum.val.l = lVal;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_LONG;
|
||||
pSelf->ExprType = HB_ET_NUMERIC;
|
||||
@@ -118,19 +118,19 @@ HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
|
||||
if( pRight->value.asNum.lVal )
|
||||
if( pRight->value.asNum.val.l )
|
||||
{
|
||||
if( pLeft->value.asNum.lVal % pRight->value.asNum.lVal == 0 )
|
||||
if( pLeft->value.asNum.val.l % pRight->value.asNum.val.l == 0 )
|
||||
{
|
||||
/* Return integer results as long */
|
||||
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal / pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l / pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return non-integer results as double */
|
||||
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal / ( double ) pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.d = ( double ) pLeft->value.asNum.val.l / ( double ) pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = HB_DEFAULT_DECIMALS;
|
||||
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -141,9 +141,9 @@ HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
|
||||
case HB_ET_DOUBLE:
|
||||
|
||||
if( pRight->value.asNum.dVal != 0.0 )
|
||||
if( pRight->value.asNum.val.d != 0.0 )
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal / pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d / pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = HB_DEFAULT_DECIMALS;
|
||||
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -155,18 +155,18 @@ HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
|
||||
if( pLeft->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
{
|
||||
if( pRight->value.asNum.lVal )
|
||||
if( pRight->value.asNum.val.l )
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal / ( double ) pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d / ( double ) pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = HB_DEFAULT_DECIMALS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pRight->value.asNum.dVal != 0.0 )
|
||||
if( pRight->value.asNum.val.d != 0.0 )
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal / pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) pLeft->value.asNum.val.l / pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = HB_DEFAULT_DECIMALS;
|
||||
}
|
||||
@@ -208,17 +208,17 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
{
|
||||
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.lVal * ( HB_MAXDBL ) pRight->value.asNum.lVal;
|
||||
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.val.l * ( HB_MAXDBL ) pRight->value.asNum.val.l;
|
||||
|
||||
if ( HB_DBL_LIM_LONG( dVal ) )
|
||||
{
|
||||
pSelf->value.asNum.lVal = ( HB_LONG ) dVal;
|
||||
pSelf->value.asNum.val.l = ( HB_LONG ) dVal;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) dVal;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -229,7 +229,7 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
|
||||
case HB_ET_DOUBLE:
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal * pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d * pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec + pRight->value.asNum.bDec;
|
||||
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -241,13 +241,13 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal * ( double ) pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d * ( double ) pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal * pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) pLeft->value.asNum.val.l * pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pRight->value.asNum.bDec;
|
||||
}
|
||||
@@ -282,17 +282,17 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
{
|
||||
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.lVal - ( HB_MAXDBL ) pRight->value.asNum.lVal;
|
||||
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.val.l - ( HB_MAXDBL ) pRight->value.asNum.val.l;
|
||||
|
||||
if ( HB_DBL_LIM_LONG( dVal ) )
|
||||
{
|
||||
pSelf->value.asNum.lVal = ( HB_LONG ) dVal;
|
||||
pSelf->value.asNum.val.l = ( HB_LONG ) dVal;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) dVal;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -303,7 +303,7 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
|
||||
case HB_ET_DOUBLE:
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal - pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d - pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
if( pLeft->value.asNum.bDec < pRight->value.asNum.bDec )
|
||||
pSelf->value.asNum.bDec = pRight->value.asNum.bDec;
|
||||
@@ -318,13 +318,13 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal - ( double ) pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d - ( double ) pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal - pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) pLeft->value.asNum.val.l - pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pRight->value.asNum.bDec;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
}
|
||||
else if( pLeft->ExprType == HB_ET_DATE && pRight->ExprType == HB_ET_DATE )
|
||||
{
|
||||
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal - pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l - pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_LONG;
|
||||
pSelf->ExprType = HB_ET_NUMERIC;
|
||||
@@ -350,11 +350,11 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
if( pRight->value.asNum.NumType == HB_ET_LONG )
|
||||
{
|
||||
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal - pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l - pRight->value.asNum.val.l;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal - ( HB_LONG ) pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l - ( HB_LONG ) pRight->value.asNum.val.d;
|
||||
}
|
||||
pSelf->ExprType = HB_ET_DATE;
|
||||
pSelf->ValType = HB_EV_DATE;
|
||||
@@ -389,17 +389,17 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
{
|
||||
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.lVal + ( HB_MAXDBL ) pRight->value.asNum.lVal;
|
||||
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.val.l + ( HB_MAXDBL ) pRight->value.asNum.val.l;
|
||||
|
||||
if ( HB_DBL_LIM_LONG( dVal ) )
|
||||
{
|
||||
pSelf->value.asNum.lVal = ( HB_LONG ) dVal;
|
||||
pSelf->value.asNum.val.l = ( HB_LONG ) dVal;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) dVal;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = 0;
|
||||
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
|
||||
@@ -410,7 +410,7 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
|
||||
case HB_ET_DOUBLE:
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal + pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d + pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
if( pLeft->value.asNum.bDec < pRight->value.asNum.bDec )
|
||||
pSelf->value.asNum.bDec = pRight->value.asNum.bDec;
|
||||
@@ -425,13 +425,13 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_DOUBLE )
|
||||
{
|
||||
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal + ( double ) pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d + ( double ) pRight->value.asNum.val.l;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal + pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.d = ( double ) pLeft->value.asNum.val.l + pRight->value.asNum.val.d;
|
||||
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
|
||||
pSelf->value.asNum.bDec = pRight->value.asNum.bDec;
|
||||
}
|
||||
@@ -478,11 +478,11 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
if( pRight->value.asNum.NumType == HB_ET_LONG )
|
||||
{
|
||||
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal + pRight->value.asNum.lVal;
|
||||
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l + pRight->value.asNum.val.l;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal + ( HB_LONG ) pRight->value.asNum.dVal;
|
||||
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l + ( HB_LONG ) pRight->value.asNum.val.d;
|
||||
}
|
||||
pSelf->ExprType = HB_ET_DATE;
|
||||
pSelf->ValType = HB_EV_DATE;
|
||||
@@ -581,17 +581,17 @@ HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
bResult = ( pLeft->value.asNum.lVal != pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.l != pRight->value.asNum.val.l );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
bResult = ( pLeft->value.asNum.dVal != pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.d != pRight->value.asNum.val.d );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
bResult = ( pLeft->value.asNum.lVal != pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.l != pRight->value.asNum.val.d );
|
||||
else
|
||||
bResult = ( pLeft->value.asNum.dVal != pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.d != pRight->value.asNum.val.l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -645,17 +645,17 @@ HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
bResult = ( pLeft->value.asNum.lVal >= pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.l >= pRight->value.asNum.val.l );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
bResult = ( pLeft->value.asNum.dVal >= pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.d >= pRight->value.asNum.val.d );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
bResult = ( pLeft->value.asNum.lVal >= pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.l >= pRight->value.asNum.val.d );
|
||||
else
|
||||
bResult = ( pLeft->value.asNum.dVal >= pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.d >= pRight->value.asNum.val.l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -709,17 +709,17 @@ HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
bResult = ( pLeft->value.asNum.lVal <= pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.l <= pRight->value.asNum.val.l );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
bResult = ( pLeft->value.asNum.dVal <= pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.d <= pRight->value.asNum.val.d );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
bResult = ( pLeft->value.asNum.lVal <= pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.l <= pRight->value.asNum.val.d );
|
||||
else
|
||||
bResult = ( pLeft->value.asNum.dVal <= pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.d <= pRight->value.asNum.val.l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -773,17 +773,17 @@ HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
bResult = ( pLeft->value.asNum.lVal > pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.l > pRight->value.asNum.val.l );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
bResult = ( pLeft->value.asNum.dVal > pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.d > pRight->value.asNum.val.d );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
bResult = ( pLeft->value.asNum.lVal > pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.l > pRight->value.asNum.val.d );
|
||||
else
|
||||
bResult = ( pLeft->value.asNum.dVal > pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.d > pRight->value.asNum.val.l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -837,17 +837,17 @@ HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
bResult = ( pLeft->value.asNum.lVal < pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.l < pRight->value.asNum.val.l );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
bResult = ( pLeft->value.asNum.dVal < pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.d < pRight->value.asNum.val.d );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
bResult = ( pLeft->value.asNum.lVal < pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.l < pRight->value.asNum.val.d );
|
||||
else
|
||||
bResult = ( pLeft->value.asNum.dVal < pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.d < pRight->value.asNum.val.l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -913,17 +913,17 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
switch( pLeft->value.asNum.NumType & pRight->value.asNum.NumType )
|
||||
{
|
||||
case HB_ET_LONG:
|
||||
bResult = ( pLeft->value.asNum.lVal == pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.l == pRight->value.asNum.val.l );
|
||||
break;
|
||||
case HB_ET_DOUBLE:
|
||||
bResult = ( pLeft->value.asNum.dVal == pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.d == pRight->value.asNum.val.d );
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if( pLeft->value.asNum.NumType == HB_ET_LONG )
|
||||
bResult = ( pLeft->value.asNum.lVal == pRight->value.asNum.dVal );
|
||||
bResult = ( pLeft->value.asNum.val.l == pRight->value.asNum.val.d );
|
||||
else
|
||||
bResult = ( pLeft->value.asNum.dVal == pRight->value.asNum.lVal );
|
||||
bResult = ( pLeft->value.asNum.val.d == pRight->value.asNum.val.l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1193,7 +1193,7 @@ BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
hb_compExprFree( pSelf->value.asFunCall.pParms, HB_COMP_PARAM );
|
||||
|
||||
memcpy( pSelf, pReduced, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pReduced );
|
||||
hb_compExprClear( pReduced, HB_COMP_PARAM );
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -1219,9 +1219,9 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
if( pArg->value.asNum.NumType == HB_ET_LONG )
|
||||
{
|
||||
BYTE bVal;
|
||||
bVal = ( pArg->value.asNum.lVal % 256 );
|
||||
bVal = ( pArg->value.asNum.val.l % 256 );
|
||||
|
||||
if( bVal == 0 && pArg->value.asNum.lVal != 0 )
|
||||
if( bVal == 0 && pArg->value.asNum.val.l != 0 )
|
||||
{
|
||||
pExpr->value.asString.string = "";
|
||||
pExpr->value.asString.dealloc = FALSE;
|
||||
@@ -1239,7 +1239,7 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
else
|
||||
{
|
||||
pExpr->value.asString.string = ( char * ) hb_xgrab( 2 );
|
||||
pExpr->value.asString.string[ 0 ] = ( ( unsigned int ) pArg->value.asNum.dVal % 256 );
|
||||
pExpr->value.asString.string[ 0 ] = ( ( unsigned int ) pArg->value.asNum.val.d % 256 );
|
||||
pExpr->value.asString.string[ 1 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->ulLength = 1;
|
||||
@@ -1248,7 +1248,7 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
hb_compExprFree( pParms, HB_COMP_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
hb_compExprClear( pExpr, HB_COMP_PARAM );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1267,7 +1267,7 @@ BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
hb_compExprFree( pParms, HB_COMP_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
hb_compExprClear( pExpr, HB_COMP_PARAM );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -1286,7 +1286,7 @@ BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
hb_compExprFree( pParms, HB_COMP_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
hb_compExprClear( pExpr, HB_COMP_PARAM );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -1308,7 +1308,7 @@ BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL )
|
||||
hb_compExprFree( pParms, HB_COMP_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
hb_compExprClear( pExpr, HB_COMP_PARAM );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1319,7 +1319,7 @@ BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL )
|
||||
hb_compExprFree( pSelf->value.asFunCall.pParms, HB_COMP_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
hb_compExprClear( pExpr, HB_COMP_PARAM );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
|
||||
ROOT = ../../
|
||||
|
||||
#LEX_FLAGS = -Phb_macro -C
|
||||
#LEX_FLAGS = -Phb_comp -C
|
||||
#LEX_SOURCE=harbour.l
|
||||
#LEX_HEADERS=\
|
||||
# hbsetup.h \
|
||||
# hberrors.h \
|
||||
# hbdefs.h
|
||||
|
||||
#YACC_FLAGS = -p hb_comp
|
||||
YACC_FLAGS = -p hb_comp
|
||||
YACC_SOURCE=harbour.y
|
||||
YACC_HEADERS=\
|
||||
hbcomp.h \
|
||||
hbcompdf.h \
|
||||
hbsetup.h \
|
||||
hbpcode.h \
|
||||
hbdefs.h \
|
||||
|
||||
@@ -141,8 +141,7 @@ static const HB_LEX_KEY s_keytable[] =
|
||||
{ "PRIVATE", 4, 7, PRIVATE },
|
||||
{ "PROCEDURE", 4, 9, PROCEDURE },
|
||||
{ "PUBLIC", 4, 6, PUBLIC },
|
||||
{ "QSELF", 4, 5, SELF },
|
||||
{ "_PROCREQ_", 4, 9, PROCREQ },
|
||||
{ "QSELF", 5, 5, SELF },
|
||||
{ "RECOVER", 4, 7, RECOVER },
|
||||
{ "RETURN", 4, 6, RETURN },
|
||||
{ "STATIC", 4, 6, STATIC },
|
||||
@@ -151,6 +150,7 @@ static const HB_LEX_KEY s_keytable[] =
|
||||
{ "TO", 2, 2, TO },
|
||||
{ "WHILE", 4, 5, WHILE },
|
||||
{ "WITH", 4, 4, WITH },
|
||||
{ "_PROCREQ_", 9, 9, PROCREQ },
|
||||
{ "AS", 2, 2, AS_TYPE },
|
||||
{ "_HB_CLASS", 9, 9, DECLARE_CLASS },
|
||||
{ "_HB_MEMBER", 10, 10, DECLARE_MEMBER }
|
||||
@@ -281,8 +281,7 @@ static char * hb_comp_tokenString( YYSTYPE *yylval_ptr, HB_COMP_DECL, PHB_PP_TOK
|
||||
return pToken->value;
|
||||
}
|
||||
|
||||
//int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
|
||||
int yylex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
|
||||
int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
|
||||
{
|
||||
PHB_COMP_LEX pLex = ( PHB_COMP_LEX ) HB_COMP_PARAM->pLex;
|
||||
PHB_PP_TOKEN pToken = hb_pp_tokenGet( pLex->pPP );
|
||||
@@ -385,13 +384,10 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
|
||||
if( pToken->pNext &&
|
||||
HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_PIPE )
|
||||
{
|
||||
int iType = 0;
|
||||
yylval_ptr->asCodeblock.string =
|
||||
hb_strdup( hb_pp_tokenBlockString( pLex->pPP, pToken, &iType ) );
|
||||
yylval_ptr->asCodeblock.length =
|
||||
strlen( yylval_ptr->asCodeblock.string );
|
||||
yylval_ptr->asCodeblock.isMacro = iType > 0;
|
||||
yylval_ptr->asCodeblock.lateEval = iType > 1;
|
||||
yylval_ptr->asCodeblock.string = hb_strdup(
|
||||
hb_pp_tokenBlockString( pLex->pPP, pToken,
|
||||
&yylval_ptr->asCodeblock.flags,
|
||||
&yylval_ptr->asCodeblock.length ) );
|
||||
hb_pp_tokenGet( pLex->pPP );
|
||||
return CBSTART;
|
||||
}
|
||||
|
||||
@@ -93,14 +93,13 @@ static int hb_compAutoOpen( HB_COMP_DECL, char * szPrg, BOOL * bSkipGen, BOOL bS
|
||||
/* global variables */
|
||||
FILE * hb_comp_errFile = NULL;
|
||||
|
||||
extern int yyparse( HB_COMP_DECL ); /* main yacc parsing function */
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
static void hb_compMainExit( HB_COMP_DECL )
|
||||
{
|
||||
hb_compCompileEnd( HB_COMP_PARAM );
|
||||
hb_compParserStop( HB_COMP_PARAM );
|
||||
hb_compExprLstDealloc( HB_COMP_PARAM );
|
||||
hb_compIdentifierClose( HB_COMP_PARAM );
|
||||
|
||||
if( HB_COMP_PARAM->pOutPath )
|
||||
@@ -1762,6 +1761,7 @@ static PFUNCTION hb_compFunctionNew( HB_COMP_DECL, char * szName, HB_SYMBOLSCOPE
|
||||
pFunc->pNOOPs = NULL;
|
||||
pFunc->pJumps = NULL;
|
||||
pFunc->bLateEval = TRUE;
|
||||
pFunc->bError = FALSE;
|
||||
pFunc->pEnum = NULL;
|
||||
|
||||
return pFunc;
|
||||
@@ -3369,31 +3369,34 @@ void hb_compFinalizeFunction( HB_COMP_DECL ) /* fixes all last defined function
|
||||
hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM );
|
||||
}
|
||||
|
||||
if( pFunc->bFlags & FUN_USES_LOCAL_PARAMS )
|
||||
if( !pFunc->bError )
|
||||
{
|
||||
int PCount = pFunc->wParamCount;
|
||||
if( pFunc->bFlags & FUN_USES_LOCAL_PARAMS )
|
||||
{
|
||||
int PCount = pFunc->wParamCount;
|
||||
|
||||
/* do not adjust if local parameters are used -remove NOOPs only */
|
||||
pFunc->wParamCount = 0;
|
||||
/* There was a PARAMETERS statement used.
|
||||
* NOTE: This fixes local variables references in a case when
|
||||
* there is PARAMETERS statement after a LOCAL variable declarations.
|
||||
* All local variables are numbered from 1 - which means use first
|
||||
* item from the eval stack. However if PARAMETERS statement is used
|
||||
* then there are additional items on the eval stack - the
|
||||
* function arguments. Then first local variable is at the position
|
||||
* (1 + <number of arguments>). We cannot fix this numbering
|
||||
* because the PARAMETERS statement can be used even at the end
|
||||
* of function body when all local variables are already created.
|
||||
*/
|
||||
/* do not adjust if local parameters are used -remove NOOPs only */
|
||||
pFunc->wParamCount = 0;
|
||||
/* There was a PARAMETERS statement used.
|
||||
* NOTE: This fixes local variables references in a case when
|
||||
* there is PARAMETERS statement after a LOCAL variable declarations.
|
||||
* All local variables are numbered from 1 - which means use first
|
||||
* item from the eval stack. However if PARAMETERS statement is used
|
||||
* then there are additional items on the eval stack - the
|
||||
* function arguments. Then first local variable is at the position
|
||||
* (1 + <number of arguments>). We cannot fix this numbering
|
||||
* because the PARAMETERS statement can be used even at the end
|
||||
* of function body when all local variables are already created.
|
||||
*/
|
||||
|
||||
hb_compFixFuncPCode( HB_COMP_PARAM, pFunc );
|
||||
pFunc->wParamCount = PCount;
|
||||
hb_compFixFuncPCode( HB_COMP_PARAM, pFunc );
|
||||
pFunc->wParamCount = PCount;
|
||||
}
|
||||
else
|
||||
hb_compFixFuncPCode( HB_COMP_PARAM, pFunc );
|
||||
|
||||
hb_compOptimizeJumps( HB_COMP_PARAM );
|
||||
}
|
||||
else
|
||||
hb_compFixFuncPCode( HB_COMP_PARAM, pFunc );
|
||||
|
||||
hb_compOptimizeJumps( HB_COMP_PARAM );
|
||||
|
||||
if( HB_COMP_PARAM->iWarnings )
|
||||
{
|
||||
@@ -4481,7 +4484,7 @@ static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile )
|
||||
hb_compFunctionAdd( HB_COMP_PARAM, "", HB_FS_PUBLIC, FUN_PROCEDURE );
|
||||
}
|
||||
|
||||
yyparse( HB_COMP_PARAM );
|
||||
hb_compparse( HB_COMP_PARAM );
|
||||
|
||||
if( HB_COMP_PARAM->pFilePpo )
|
||||
{
|
||||
@@ -4834,7 +4837,7 @@ static int hb_compAutoOpen( HB_COMP_DECL, char * szPrg, BOOL * pbSkipGen, BOOL b
|
||||
int i = HB_COMP_PARAM->iExitLevel ;
|
||||
BOOL b = HB_COMP_PARAM->fAnyWarning;
|
||||
|
||||
yyparse( HB_COMP_PARAM );
|
||||
hb_compparse( HB_COMP_PARAM );
|
||||
|
||||
if( HB_COMP_PARAM->pFilePpo )
|
||||
{
|
||||
|
||||
@@ -1645,8 +1645,7 @@ Separator {SpaceTab}
|
||||
int iCode=1;
|
||||
char cMark='\0';
|
||||
|
||||
yylval_ptr->asCodeblock.isMacro = FALSE;
|
||||
yylval_ptr->asCodeblock.lateEval = FALSE;
|
||||
yylval_ptr->asCodeblock.flags = 0;
|
||||
cText = yytext+1;
|
||||
iLen = 1;
|
||||
|
||||
@@ -1665,12 +1664,12 @@ Separator {SpaceTab}
|
||||
iPos = iLen;
|
||||
else if( *cText == '&' && cMark == '\0' )
|
||||
{
|
||||
yylval_ptr->asCodeblock.isMacro = TRUE;
|
||||
yylval_ptr->asCodeblock.falgs |= HB_BLOCK_MACRO;
|
||||
++cText;
|
||||
while( *cText == ' ' || *cText == '\t' )
|
||||
++cText;
|
||||
if( *cText == '(' )
|
||||
yylval_ptr->asCodeblock.lateEval = TRUE;
|
||||
yylval_ptr->asCodeblock.flags |= HB_BLOCK_LATEEVAL;
|
||||
--cText;
|
||||
}
|
||||
else if( *cText == '{' && cMark == '\0' )
|
||||
|
||||
@@ -105,6 +105,8 @@ static void hb_compDebugStart( void ) { };
|
||||
int iNumber; /* to hold a temporary integer number */
|
||||
HB_LONG lNumber; /* to hold a temporary long number */
|
||||
BOOL bTrue;
|
||||
HB_EXPR_PTR asExpr;
|
||||
void * pVoid; /* to hold any memory structure we may need */
|
||||
struct
|
||||
{
|
||||
HB_LONG lNumber; /* to hold a long number returned by lex */
|
||||
@@ -117,7 +119,6 @@ static void hb_compDebugStart( void ) { };
|
||||
UCHAR bWidth; /* to hold the width of the value */
|
||||
UCHAR bDec; /* to hold the number of decimal points in the value */
|
||||
} valDouble;
|
||||
HB_EXPR_PTR asExpr;
|
||||
struct
|
||||
{
|
||||
char * string;
|
||||
@@ -128,8 +129,7 @@ static void hb_compDebugStart( void ) { };
|
||||
{
|
||||
char * string;
|
||||
int length;
|
||||
BOOL lateEval; /* Flag for early {|| ¯o} (0) or late {|| &(macro)} (1) binding */
|
||||
BOOL isMacro;
|
||||
int flags; /* Flag for early {|| ¯o} (1) or late {|| &(macro)} (2) binding */
|
||||
} asCodeblock;
|
||||
struct
|
||||
{
|
||||
@@ -140,7 +140,6 @@ static void hb_compDebugStart( void ) { };
|
||||
HB_EXPR_PTR macro;
|
||||
} value;
|
||||
} asMessage;
|
||||
void * pVoid; /* to hold any memory structure we may need */
|
||||
};
|
||||
|
||||
%{
|
||||
@@ -148,7 +147,6 @@ static void hb_compDebugStart( void ) { };
|
||||
* typedef-ined to YYSTYPE
|
||||
*/
|
||||
extern int yylex( YYSTYPE *, HB_COMP_DECL ); /* main lex token function, called by yyparse() */
|
||||
extern int yyparse( HB_COMP_DECL ); /* main yacc parsing function */
|
||||
extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management function */
|
||||
%}
|
||||
|
||||
@@ -245,6 +243,13 @@ extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management fun
|
||||
%type <asExpr> DateValue
|
||||
%type <asMessage> SendId
|
||||
|
||||
/*
|
||||
We cannot use destructors for expressions. The internal bison logic cannot
|
||||
detect properly if the expression was used or not in our grammar definition
|
||||
so it's possible that destructors will never be executed or executed for
|
||||
expressions which we freed ourself.
|
||||
*/
|
||||
/*
|
||||
%destructor {
|
||||
hb_compExprDelete( $$, HB_COMP_PARAM );
|
||||
}
|
||||
@@ -281,8 +286,8 @@ extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management fun
|
||||
FieldAlias FieldVarAlias
|
||||
PostOp
|
||||
ForVar ForList ForExpr
|
||||
|
||||
%destructor { hb_xfree( $$.string ); } CBSTART
|
||||
*/
|
||||
%destructor { if( $$.string ) hb_xfree( $$.string ); } CBSTART
|
||||
%destructor { if( $$.dealloc ) hb_xfree( $$.string ); } LITERAL
|
||||
|
||||
%%
|
||||
@@ -320,7 +325,7 @@ Line : LINE NUM_LONG LITERAL Crlf
|
||||
ProcReq : PROCREQ CompTimeStr ')' Crlf { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; }
|
||||
;
|
||||
|
||||
CompTimeStr: LITERAL {
|
||||
CompTimeStr : LITERAL {
|
||||
if( $1.dealloc )
|
||||
{
|
||||
$1.string = hb_compIdentifierNew( HB_COMP_PARAM, $1.string, HB_IDENT_FREE );
|
||||
@@ -328,7 +333,7 @@ CompTimeStr: LITERAL {
|
||||
}
|
||||
hb_compAutoOpenAdd( HB_COMP_PARAM, $1.string );
|
||||
}
|
||||
| LITERAL '+' LITERAL {
|
||||
| LITERAL '+' LITERAL {
|
||||
{
|
||||
char szFileName[ _POSIX_PATH_MAX + 1 ];
|
||||
hb_strncat( hb_strncpy( szFileName, $1.string, _POSIX_PATH_MAX ), $3.string, _POSIX_PATH_MAX );
|
||||
@@ -339,7 +344,7 @@ CompTimeStr: LITERAL {
|
||||
hb_xfree( $3.string );
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
Function : FunScope FUNCTION IdentName { HB_COMP_PARAM->cVarType = ' '; hb_compFunctionAdd( HB_COMP_PARAM, $3, ( HB_SYMBOLSCOPE ) $1, 0 ); } Crlf {}
|
||||
| FunScope PROCEDURE IdentName { HB_COMP_PARAM->cVarType = ' '; hb_compFunctionAdd( HB_COMP_PARAM, $3, ( HB_SYMBOLSCOPE ) $1, FUN_PROCEDURE ); } Crlf {}
|
||||
@@ -498,7 +503,7 @@ LineStat : Crlf { $<lNumber>$ = 0; HB_COMP_PARAM->fDontGenLineNum = T
|
||||
| Statement { $<lNumber>$ = 1; }
|
||||
| Declaration { $<lNumber>$ = 1; }
|
||||
| Line { $<lNumber>$ = 1; }
|
||||
| ControlError { hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNCLOSED_STRU, NULL, NULL ); }
|
||||
| ControlError { $<lNumber>$ = 0; hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNCLOSED_STRU, NULL, NULL ); }
|
||||
;
|
||||
|
||||
ControlError : FunScopeId FUNCTION IdentName Crlf {}
|
||||
@@ -570,6 +575,7 @@ NilAlias : NilValue ALIASOP { $$ = $1; }
|
||||
*/
|
||||
LiteralValue : LITERAL {
|
||||
$$ = hb_compExprNewString( $1.string, $1.length, $1.dealloc, HB_COMP_PARAM );
|
||||
$1.dealloc = FALSE;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -1111,9 +1117,9 @@ ElemList : EmptyExpression { $$ = hb_compExprNewList( $1, HB_COMP
|
||||
| ElemList ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); }
|
||||
;
|
||||
|
||||
CodeBlock : CBSTART { $<asExpr>$ = hb_compExprNewCodeBlock( $1.string, $1.isMacro, $1.lateEval, HB_COMP_PARAM ); } BlockNoVar
|
||||
CodeBlock : CBSTART { $<asExpr>$ = hb_compExprNewCodeBlock( $1.string, $1.length, $1.flags, HB_COMP_PARAM ); $1.string = NULL; } BlockNoVar
|
||||
'|' BlockExpList '}' { $$ = $<asExpr>2; }
|
||||
| CBSTART { $<asExpr>$ = hb_compExprNewCodeBlock( $1.string, $1.isMacro, $1.lateEval, HB_COMP_PARAM ); } BlockVarList
|
||||
| CBSTART { $<asExpr>$ = hb_compExprNewCodeBlock( $1.string, $1.length, $1.flags, HB_COMP_PARAM ); } BlockVarList
|
||||
'|' BlockExpList '}' { $$ = $<asExpr>2; }
|
||||
;
|
||||
|
||||
@@ -1598,7 +1604,7 @@ DoWhile : WhileBegin Expression Crlf
|
||||
{
|
||||
hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM );
|
||||
$<lNumber>$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM );
|
||||
}
|
||||
}
|
||||
EmptyStats
|
||||
{
|
||||
hb_compLoopHere( HB_COMP_PARAM );
|
||||
@@ -1663,11 +1669,11 @@ ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */
|
||||
}
|
||||
else if( $<asExpr>8 )
|
||||
{
|
||||
hb_compExprClear( hb_compExprGenStatement( hb_compExprSetOperand( hb_compExprNewPlusEq( $2, HB_COMP_PARAM ), $<asExpr>8, HB_COMP_PARAM ), HB_COMP_PARAM ) );
|
||||
hb_compExprClear( hb_compExprGenStatement( hb_compExprSetOperand( hb_compExprNewPlusEq( $2, HB_COMP_PARAM ), $<asExpr>8, HB_COMP_PARAM ), HB_COMP_PARAM ), HB_COMP_PARAM );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_compExprClear( hb_compExprGenStatement( hb_compExprNewPreInc( $2, HB_COMP_PARAM ), HB_COMP_PARAM ) );
|
||||
hb_compExprClear( hb_compExprGenStatement( hb_compExprNewPreInc( $2, HB_COMP_PARAM ), HB_COMP_PARAM ), HB_COMP_PARAM );
|
||||
}
|
||||
|
||||
hb_compGenJumpHere( $<lNumber>9, HB_COMP_PARAM );
|
||||
@@ -1780,7 +1786,6 @@ DoSwitch : SwitchBegin
|
||||
{
|
||||
hb_compGenPCode1( HB_P_POP, HB_COMP_PARAM );
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
EndSwitch : END
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -256,6 +256,8 @@ typedef union YYSTYPE
|
||||
int iNumber; /* to hold a temporary integer number */
|
||||
HB_LONG lNumber; /* to hold a temporary long number */
|
||||
BOOL bTrue;
|
||||
HB_EXPR_PTR asExpr;
|
||||
void * pVoid; /* to hold any memory structure we may need */
|
||||
struct
|
||||
{
|
||||
HB_LONG lNumber; /* to hold a long number returned by lex */
|
||||
@@ -268,7 +270,6 @@ typedef union YYSTYPE
|
||||
UCHAR bWidth; /* to hold the width of the value */
|
||||
UCHAR bDec; /* to hold the number of decimal points in the value */
|
||||
} valDouble;
|
||||
HB_EXPR_PTR asExpr;
|
||||
struct
|
||||
{
|
||||
char * string;
|
||||
@@ -279,8 +280,7 @@ typedef union YYSTYPE
|
||||
{
|
||||
char * string;
|
||||
int length;
|
||||
BOOL lateEval; /* Flag for early {|| ¯o} (0) or late {|| &(macro)} (1) binding */
|
||||
BOOL isMacro;
|
||||
int flags; /* Flag for early {|| ¯o} (1) or late {|| &(macro)} (2) binding */
|
||||
} asCodeblock;
|
||||
struct
|
||||
{
|
||||
@@ -291,10 +291,9 @@ typedef union YYSTYPE
|
||||
HB_EXPR_PTR macro;
|
||||
} value;
|
||||
} asMessage;
|
||||
void * pVoid; /* to hold any memory structure we may need */
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
#line 298 "harboury.h"
|
||||
#line 297 "harboury.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
@@ -138,6 +138,7 @@ void hb_compGenError( HB_COMP_DECL, char * szErrors[], char cPrefix, int iError,
|
||||
{
|
||||
if( !HB_COMP_PARAM->fExit && ( cPrefix == 'F' || !HB_COMP_PARAM->fError ) )
|
||||
{
|
||||
PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast;
|
||||
char * szFile = hb_pp_fileName( HB_COMP_PARAM->pLex->pPP );
|
||||
int iLine = hb_pp_line( HB_COMP_PARAM->pLex->pPP );
|
||||
|
||||
@@ -150,7 +151,11 @@ void hb_compGenError( HB_COMP_DECL, char * szErrors[], char cPrefix, int iError,
|
||||
|
||||
HB_COMP_PARAM->iErrorCount++;
|
||||
HB_COMP_PARAM->fError = TRUE;
|
||||
|
||||
while( pFunc )
|
||||
{
|
||||
pFunc->bError = TRUE;
|
||||
pFunc = pFunc->pOwner;
|
||||
}
|
||||
/* fatal error - exit immediately */
|
||||
if( cPrefix == 'F' )
|
||||
HB_COMP_PARAM->fExit = TRUE;
|
||||
|
||||
@@ -752,11 +752,11 @@ ElemList : EmptyExpression { $$ = hb_compExprNewList( $1, HB_C
|
||||
;
|
||||
|
||||
CodeBlock : '{' '|'
|
||||
{ $<asExpr>$ = hb_compExprNewCodeBlock( NULL, FALSE, FALSE, HB_COMP_PARAM ); } BlockNoVar
|
||||
{ $<asExpr>$ = hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ); } BlockNoVar
|
||||
'|' BlockExpList '}'
|
||||
{ $$ = $<asExpr>3; }
|
||||
| '{' '|'
|
||||
{ $<asExpr>$ = hb_compExprNewCodeBlock( NULL, FALSE, FALSE, HB_COMP_PARAM ); }
|
||||
{ $<asExpr>$ = hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ); }
|
||||
BlockVarList
|
||||
'|' BlockExpList '}'
|
||||
{ $$ = $<asExpr>3; }
|
||||
|
||||
@@ -3813,7 +3813,7 @@ yyreduce:
|
||||
|
||||
case 313:
|
||||
#line 755 "macro.y"
|
||||
{ (yyval.asExpr) = hb_compExprNewCodeBlock( NULL, FALSE, FALSE, HB_COMP_PARAM ); ;}
|
||||
{ (yyval.asExpr) = hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ); ;}
|
||||
break;
|
||||
|
||||
case 314:
|
||||
@@ -3823,7 +3823,7 @@ yyreduce:
|
||||
|
||||
case 315:
|
||||
#line 759 "macro.y"
|
||||
{ (yyval.asExpr) = hb_compExprNewCodeBlock( NULL, FALSE, FALSE, HB_COMP_PARAM ); ;}
|
||||
{ (yyval.asExpr) = hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ); ;}
|
||||
break;
|
||||
|
||||
case 316:
|
||||
|
||||
@@ -5043,7 +5043,7 @@ void hb_pp_tokenToString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken )
|
||||
}
|
||||
|
||||
char * hb_pp_tokenBlockString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken,
|
||||
int * piType )
|
||||
int * piType, int * piLen )
|
||||
{
|
||||
* piType = 0;
|
||||
hb_membufFlush( pState->pBuffer );
|
||||
@@ -5057,11 +5057,11 @@ char * hb_pp_tokenBlockString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken,
|
||||
{
|
||||
if( pToken->pNext &&
|
||||
HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_LEFT_PB )
|
||||
* piType |= 2;
|
||||
* piType |= HB_BLOCK_LATEEVAL;
|
||||
}
|
||||
else if( HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_MACROVAR ||
|
||||
HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_MACROTEXT )
|
||||
* piType |= 1;
|
||||
* piType |= HB_BLOCK_LATEEVAL | HB_BLOCK_MACRO;
|
||||
else if( HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_RIGHT_CB )
|
||||
--iBraces;
|
||||
else if( HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_LEFT_CB )
|
||||
@@ -5070,6 +5070,7 @@ char * hb_pp_tokenBlockString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken,
|
||||
}
|
||||
while( iBraces && !HB_PP_TOKEN_ISEOC( pToken ) );
|
||||
}
|
||||
* piLen = ( int ) hb_membufLen( pState->pBuffer );
|
||||
hb_membufAddCh( pState->pBuffer, '\0' );
|
||||
return hb_membufPtr( pState->pBuffer );
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void hb_releaseCPU( void )
|
||||
}
|
||||
#else
|
||||
{
|
||||
static struct timespec nanosecs = { 0, 1000 };
|
||||
static const struct timespec nanosecs = { 0, 1000 };
|
||||
/* NOTE: it will sleep at least 10 miliseconds (forced by kernel) */
|
||||
nanosleep( &nanosecs, NULL );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user