2009-06-16 13:37 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/hbct/token1.c
    % use explicit constant value instead of HB_MKULONG() macro

  * harbour/source/compiler/cmdcheck.c
    ! fixed few typos in bit manipulation used to calculate result in
      PackDateTime() function by rewriting it to use bitfield union.
This commit is contained in:
Przemyslaw Czerpak
2009-06-16 11:27:55 +00:00
parent c2092fff60
commit 01162d9200
3 changed files with 34 additions and 25 deletions

View File

@@ -17,6 +17,14 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-16 13:37 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbct/token1.c
% use explicit constant value instead of HB_MKULONG() macro
* harbour/source/compiler/cmdcheck.c
! fixed few typos in bit manipulation used to calculate result in
PackDateTime() function by rewriting it to use bitfield union.
2009-06-16 09:13 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
+ Two optional envvars got some super extra clarification.

View File

@@ -278,9 +278,9 @@ static void do_token1( int iSwitch )
/* should we find the last token, but string ends with tokenizer, i.e.
pc points to the last character at the moment ?
-> break here ! */
if( ulTokenCounter == HB_MKULONG( 255, 255, 255, 255 ) )
if( ulTokenCounter == 0xFFFFFFFFUL )
{
if( ulSkip == HB_MKULONG( 255, 255, 255, 255 ) )
if( ulSkip == 0xFFFFFFFFUL )
{
char *t;
BOOL bLast = TRUE;
@@ -307,7 +307,7 @@ static void do_token1( int iSwitch )
{
char cRet;
if( ( ulTokenCounter == HB_MKULONG( 255, 255, 255, 255 ) ) ||
if( ( ulTokenCounter == 0xFFFFFFFFUL ) ||
( ulToken == ulTokenCounter ) )
hb_retclen( pcSubStr, pc - pcSubStr );
else
@@ -330,7 +330,7 @@ static void do_token1( int iSwitch )
break;
case DO_TOKEN1_ATTOKEN:
if( ( ulTokenCounter == HB_MKULONG( 255, 255, 255, 255 ) ) ||
if( ( ulTokenCounter == 0xFFFFFFFFUL ) ||
( ulToken == ulTokenCounter ) )
hb_retnl( pcSubStr - pcString + 1 );
else

View File

@@ -72,31 +72,32 @@
static ULONG PackDateTime( void )
{
int iYear, iMonth, iDay, iHour, iMinute, iSeconds, iMillisec;
BYTE szString[4];
BYTE nValue;
union
{
struct
{
UINT32 second : 6; /* bits: 0 - 5 */
UINT32 minute : 6; /* bits: 6 - 11 */
UINT32 hour : 5; /* bits: 12 - 16 */
UINT32 day : 5; /* bits: 16 - 21 */
UINT32 month : 4; /* bits: 22 - 25 */
UINT32 year : 6; /* bits: 26 - 31 */
} ts;
UINT32 val;
} u;
int iYear, iMonth, iDay, iHour, iMinute, iSecond, iMillisec;
hb_timeStampGetLocal( &iYear, &iMonth, &iDay,
&iHour, &iMinute, &iSeconds, &iMillisec );
&iHour, &iMinute, &iSecond, &iMillisec );
nValue = ( BYTE ) ( ( iYear - 1980 ) & ( 2 ^ 6 ) ); /* 6 bits */
szString[0] = nValue << 2;
nValue = ( BYTE ) ( iMonth ); /* 4 bits */
szString[0] |= nValue >> 2;
szString[1] = nValue << 6;
nValue = ( BYTE ) ( iDay ); /* 5 bits */
szString[1] |= nValue << 1;
u.ts.year = iYear - 1980;
u.ts.month = iMonth;
u.ts.day = iDay;
u.ts.hour = iHour;
u.ts.minute = iMinute;
u.ts.second = iSecond;
nValue = ( BYTE ) iHour; /* 5 bits */
szString[1] = nValue >> 4;
szString[2] = nValue << 4;
nValue = ( BYTE ) iMinute; /* 6 bits */
szString[2] |= nValue >> 2;
szString[3] = nValue << 6;
nValue = ( BYTE ) iSeconds; /* 6 bits */
szString[3] |= nValue;
return HB_MKLONG( szString[3], szString[2], szString[1], szString[0] );
return u.val;
}
static void hb_notSupportedInfo( HB_COMP_DECL, const char *szSwitch )