2006-09-20 23:17 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
* harbour/include/hbexprb.c
* harbour/include/hbexprop.h
* harbour/source/common/expropt2.c
% Compile-time optimization added for expressions below:
SToD(""), SToD(), HB_SToD(<cDate>), HB_SToD(""), HB_SToD()
! Tabs converted to spaces.
* harbour/source/common/hbdate.c
* harbour/source/rtl/dates.c
* Copyright cosmetic cleanup.
This commit is contained in:
@@ -8,6 +8,18 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
or generate compile time error.
|
||||
|
||||
* harbour/source/vm/macro.c
|
||||
% minor optimizations
|
||||
|
||||
2006-09-21 12:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/vm/itemapi.c
|
||||
% minor optimization in hb_itemParam()
|
||||
! fixed enumerator variable clearing in hb_itemCopy()
|
||||
|
||||
2006-09-21 09:52 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
|
||||
* harbour/source/common/expropt2.c
|
||||
! Fixed leak introduced in previous commit.
|
||||
|
||||
2006-09-20 23:17 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
|
||||
|
||||
@@ -1673,10 +1673,11 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) )
|
||||
hb_compExprReduceASC( pSelf, HB_MACRO_PARAM );
|
||||
}
|
||||
else if( ( strcmp( "STOD", pName->value.asSymbol ) == 0 ) && usCount )
|
||||
else if( ( ( strcmp( "STOD", pName->value.asSymbol ) == 0 ) ||
|
||||
( strcmp( "HB_STOD", pName->value.asSymbol ) == 0 ) ) && usCount < 2 )
|
||||
{
|
||||
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) )
|
||||
hb_compExprReduceSTOD( pSelf, HB_MACRO_PARAM );
|
||||
hb_compExprReduceSTOD( pSelf, usCount, HB_MACRO_PARAM );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ BOOL hb_compExprReduceAT( HB_EXPR_PTR, HB_MACRO_DECL );
|
||||
BOOL hb_compExprReduceCHR( HB_EXPR_PTR, HB_MACRO_DECL );
|
||||
BOOL hb_compExprReduceLEN( HB_EXPR_PTR, HB_MACRO_DECL );
|
||||
BOOL hb_compExprReduceASC( HB_EXPR_PTR, HB_MACRO_DECL );
|
||||
BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, HB_MACRO_DECL );
|
||||
BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_MACRO_DECL );
|
||||
BOOL hb_compExprIsValidMacro( char *, BOOL *, HB_MACRO_DECL );
|
||||
|
||||
#ifdef HB_MACRO_SUPPORT
|
||||
|
||||
@@ -1075,7 +1075,7 @@ HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pExpr;
|
||||
|
||||
pExpr =pSelf->value.asList.pExprList; /* get conditional expression */
|
||||
pExpr = pSelf->value.asList.pExprList; /* get conditional expression */
|
||||
if( pExpr->ExprType == HB_ET_LOGICAL )
|
||||
{
|
||||
/* the condition was reduced to a logical value: .T. or .F.
|
||||
@@ -1214,10 +1214,10 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
|
||||
if( bVal == 0 && pArg->value.asNum.lVal != 0 )
|
||||
{
|
||||
pExpr->value.asString.string = ( char * ) hb_xgrab( 1 );
|
||||
pExpr->value.asString.string[ 0 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->ulLength = 0;
|
||||
pExpr->value.asString.string = ( char * ) hb_xgrab( 1 );
|
||||
pExpr->value.asString.string[ 0 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->ulLength = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1225,20 +1225,20 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
pExpr->value.asString.string[ 0 ] = bVal;
|
||||
pExpr->value.asString.string[ 1 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->ulLength = 1;
|
||||
pExpr->ulLength = 1;
|
||||
}
|
||||
}
|
||||
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[ 1 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->ulLength = 1;
|
||||
pExpr->value.asString.string = ( char * ) hb_xgrab( 2 );
|
||||
pExpr->value.asString.string[ 0 ] = ( ( unsigned int ) pArg->value.asNum.dVal % 256 );
|
||||
pExpr->value.asString.string[ 1 ] = '\0';
|
||||
pExpr->value.asString.dealloc = TRUE;
|
||||
pExpr->ulLength = 1;
|
||||
}
|
||||
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
return TRUE;
|
||||
@@ -1251,13 +1251,13 @@ BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms->value.asList.pExprList;
|
||||
|
||||
|
||||
if( pArg->ExprType == HB_ET_STRING || pArg->ExprType == HB_ET_ARRAY )
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewLong( pArg->ulLength );
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewLong( pArg->ulLength );
|
||||
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
return TRUE;
|
||||
@@ -1269,13 +1269,13 @@ BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms->value.asList.pExprList;
|
||||
|
||||
|
||||
if( pArg->ExprType == HB_ET_STRING )
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewLong( (BYTE)pArg->value.asString.string[0] );
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewLong( (BYTE)pArg->value.asString.string[0] );
|
||||
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
return TRUE;
|
||||
@@ -1283,20 +1283,33 @@ BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
|
||||
BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_MACRO_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms->value.asList.pExprList;
|
||||
|
||||
if( pArg->ExprType == HB_ET_STRING && pArg->ulLength == 8 )
|
||||
if( usCount == 1 )
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewDate( hb_dateEncStr( pArg->value.asString.string ) );
|
||||
|
||||
hb_compExprFree( pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms->value.asList.pExprList;
|
||||
|
||||
if( pArg->ExprType == HB_ET_STRING && ( pArg->ulLength == 8 || pArg->ulLength == 0 ) )
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewDate( pArg->ulLength == 0 ? 0 : hb_dateEncStr( pArg->value.asString.string ) );
|
||||
|
||||
hb_compExprFree( pSelf->value.asFunCall.pParms, HB_MACRO_PARAM );
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewDate( 0 );
|
||||
|
||||
hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM );
|
||||
memcpy( pSelf, pExpr, sizeof( HB_EXPR ) );
|
||||
hb_compExprClear( pExpr );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -48,12 +48,20 @@
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 1999-2001 Viktor Szakats <viktor.szakats@syenar.hu>
|
||||
* hb_dateEncStr()
|
||||
* hb_dateDecStr()
|
||||
* hb_dateStrPut()
|
||||
* hb_dateStrGet()
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
@@ -60,12 +60,6 @@
|
||||
* Copyright 1999 David G. Holm <dholm@jsd-llc.com>
|
||||
* hb_dateFormat()
|
||||
*
|
||||
* Copyright 1999-2001 Viktor Szakats <viktor.szakats@syenar.hu>
|
||||
* hb_dateEncStr()
|
||||
* hb_dateDecStr()
|
||||
* hb_dateStrPut()
|
||||
* hb_dateStrGet()
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user