2007-10-09 09:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/runner.c
  * harbour/source/compiler/genhrb.c
    ! added support for functions marked as DYNAMIC in .hrb format

  * harbour/source/compiler/complex.c
    + finished code (stil disabled) to decode datetime in
       VFP strict date form
This commit is contained in:
Przemyslaw Czerpak
2007-10-09 07:05:39 +00:00
parent 3c909a6e05
commit 4803d0e558
4 changed files with 95 additions and 12 deletions

View File

@@ -8,6 +8,15 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-10-09 09:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/runner.c
* harbour/source/compiler/genhrb.c
! added support for functions marked as DYNAMIC in .hrb format
* harbour/source/compiler/complex.c
+ finished code (stil disabled) to decode datetime in
VFP strict date form
2007-10-09 00:11 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/source/vm/dynsym.c
* minor optimzation

View File

@@ -305,8 +305,8 @@ static BOOL hb_comp_dayTimeDecode( PHB_COMP_LEX pLex, PHB_PP_TOKEN pToken,
*/
/* Now support for dates constatns: {^YYYY/MM/DD} or {^YYYY-MM-DD} */
PHB_PP_TOKEN pYear, pMonth, pDay;
HB_LONG lYear, lMonth, lDay;
PHB_PP_TOKEN pYear, pMonth, pDay, pTime;
HB_LONG lYear, lMonth, lDay, lHour, lMinute, lMilliSec;
double dNumber;
int iDec, iWidth;
@@ -328,11 +328,76 @@ static BOOL hb_comp_dayTimeDecode( PHB_COMP_LEX pLex, PHB_PP_TOKEN pToken,
pDay = pMonth->pNext->pNext;
if( pDay && HB_PP_TOKEN_TYPE( pDay->type ) == HB_PP_TOKEN_NUMBER &&
pDay->pNext &&
HB_PP_TOKEN_TYPE( pDay->pNext->type ) == HB_PP_TOKEN_RIGHT_CB &&
!hb_compStrToNum( pDay->value, pDay->len, &lDay, &dNumber,
&iDec, &iWidth ) )
{
LONG lDate = hb_dateEncode( lYear, lMonth, lDay );
LONG lDate, lTime = 0;
pTime = pDay->pNext;
if( HB_PP_TOKEN_TYPE( pTime->type ) != HB_PP_TOKEN_RIGHT_CB )
{
if( HB_PP_TOKEN_TYPE( pTime->type ) == HB_PP_TOKEN_COMMA )
pTime = pTime->pNext;
if( !pTime || HB_PP_TOKEN_TYPE( pTime->type ) != HB_PP_TOKEN_NUMBER ||
hb_compStrToNum( pTime->value, pTime->len, &lHour, &dNumber,
&iDec, &iWidth ) ||
lHour < 0 || lHour >= 24 )
return 0;
pTime = pTime->pNext;
if( !pTime || HB_PP_TOKEN_TYPE( pTime->type ) != HB_PP_TOKEN_SEND )
return 0;
pTime = pTime->pNext;
if( !pTime || HB_PP_TOKEN_TYPE( pTime->type ) != HB_PP_TOKEN_NUMBER ||
hb_compStrToNum( pTime->value, pTime->len, &lMinute, &dNumber,
&iDec, &iWidth ) ||
lMinute < 0 || lMinute >= 60 )
return 0;
pTime = pTime->pNext;
if( !pTime )
return 0;
if( HB_PP_TOKEN_TYPE( pTime->type ) == HB_PP_TOKEN_SEND )
{
pTime = pTime->pNext;
if( !pTime || HB_PP_TOKEN_TYPE( pTime->type ) != HB_PP_TOKEN_NUMBER )
return 0;
if( hb_compStrToNum( pTime->value, pTime->len, &lMilliSec, &dNumber,
&iDec, &iWidth ) )
{
if( dNumber < 0.0 || dNumber >= 60.0 )
return 0;
lMilliSec = ( HB_LONG ) ( dNumber * 1000 );
}
else if( lMilliSec < 0 || lMilliSec >= 60 )
return 0;
else
lMilliSec *= 1000;
}
else
lMilliSec = 0;
if( HB_PP_TOKEN_TYPE( pTime->type ) == HB_PP_TOKEN_KEYWORD &&
lHour > 0 && lHour <= 12 )
{
if( ( pTime->len == 1 &&
( pTime->value[0] == 'A' || pTime->value[0] == 'a' ) ) ||
( pTime->len == 2 && hb_stricmp( pTime->value, "AM" ) == 0 ) )
{
if( lHour == 12 )
lHour = 0;
pTime = pTime->pNext;
}
else if( ( pTime->len == 1 &&
( pTime->value[0] == 'P' || pTime->value[0] == 'p' ) ) ||
( pTime->len == 2 && hb_stricmp( pTime->value, "PM" ) == 0 ) )
{
if( lHour < 12 )
lHour += 12;
pTime = pTime->pNext;
}
}
if( !pTime || HB_PP_TOKEN_TYPE( pTime->type ) != HB_PP_TOKEN_RIGHT_CB )
return 0;
lTime = ( lHour * 60 + lMinute ) * 60000 + lMilliSec;
}
lDate = hb_dateEncode( lYear, lMonth, lDay );
if( lDate != 0 || ( lYear == 0 && lMonth == 0 && lDay == 0 ) )
{
while( HB_PP_TOKEN_TYPE( pToken->type ) != HB_PP_TOKEN_RIGHT_CB )

View File

@@ -31,9 +31,10 @@
#include "hbcomp.h"
#define SYM_NOLINK 0 /* Symbol does not have to be linked */
#define SYM_FUNC 1 /* Defined function */
#define SYM_EXTERN 2 /* Previously defined function */
#define SYM_NOLINK 0 /* symbol does not have to be linked */
#define SYM_FUNC 1 /* function defined in this module */
#define SYM_EXTERN 2 /* function defined in other module */
#define SYM_DEFERRED 3 /* lately bound function */
static PFUNCTION hb_compFirstFunc( HB_COMP_DECL )
{
@@ -102,7 +103,9 @@ void hb_compGenBufPortObj( HB_COMP_DECL, BYTE ** pBufPtr, ULONG * pulSize )
/* symbol type */
/* if( hb_compFunctionFind( HB_COMP_PARAM, pSym->szName ) ) */
if( pSym->cScope & HB_FS_LOCAL )
*ptr++ = SYM_FUNC; /* function defined in this module */
*ptr++ = SYM_FUNC; /* function defined in this module */
else if( pSym->cScope & HB_FS_DEFERRED )
*ptr++ = SYM_DEFERRED; /* lately bound function */
else if( hb_compFunCallFind( HB_COMP_PARAM, pSym->szName ) )
*ptr++ = SYM_EXTERN; /* external function */
else

View File

@@ -95,10 +95,11 @@ typedef struct
static const BYTE szHead[] = { 192,'H','R','B' };
#define SYM_NOLINK 0 /* Symbol does not have to be linked */
#define SYM_FUNC 1 /* Defined function */
#define SYM_EXTERN 2 /* Prev. defined function */
#define SYM_NOT_FOUND 0xFFFFFFFFUL /* Symbol not found. */
#define SYM_NOLINK 0 /* symbol does not have to be linked */
#define SYM_FUNC 1 /* function defined in this module */
#define SYM_EXTERN 2 /* function defined in other module */
#define SYM_DEFERRED 3 /* lately bound function */
#define SYM_NOT_FOUND 0xFFFFFFFFUL /* Symbol not found. */
static int hb_hrbReadHead( char * szBody, ULONG ulBodySize, ULONG * pulBodyOffset )
{
@@ -424,6 +425,11 @@ static PHRB_BODY hb_hrbLoad( char* szHrbBody, ULONG ulBodySize )
pSymRead[ ul ].scope.value |= HB_FS_PCODEFUNC | HB_FS_LOCAL;
}
}
else if( pSymRead[ ul ].value.pCodeFunc == ( PHB_PCODEFUNC ) SYM_DEFERRED )
{
pSymRead[ ul ].value.pCodeFunc = ( PHB_PCODEFUNC ) SYM_EXTERN;
pSymRead[ ul ].scope.value |= HB_FS_DEFERRED;
}
/* External function */
if( pSymRead[ ul ].value.pCodeFunc == ( PHB_PCODEFUNC ) SYM_EXTERN )