2007-06-14 00:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbcompat.ch
    + added translation rules for extended code blocks

  * harbour/source/compiler/gencc.c
    * cleaned C compiler warnings in -gc3 output and SWITCH <exp>
      statement

  * harbour/source/compiler/complex.c
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyc
    * allow to use 0d0 and 0d00000000 as empty date value

  * harbour/source/pp/Makefile
    * workaround for problems with some GNU make  versions,
      f.e. 3.76.1 on OS2
This commit is contained in:
Przemyslaw Czerpak
2007-06-13 22:06:19 +00:00
parent 5c85215870
commit ad2ab41638
8 changed files with 487 additions and 423 deletions

View File

@@ -8,6 +8,23 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-06-14 00:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbcompat.ch
+ added translation rules for extended code blocks
* harbour/source/compiler/gencc.c
* cleaned C compiler warnings in -gc3 output and SWITCH <exp>
statement
* harbour/source/compiler/complex.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* allow to use 0d0 and 0d00000000 as empty date value
* harbour/source/pp/Makefile
* workaround for problems with some GNU make versions,
f.e. 3.76.1 on OS2
2007-06-12 23:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/ads1.c
* cleaned BCC warning

View File

@@ -126,6 +126,10 @@
#xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
#xcommand FINALLY => ALWAYS
/* EXTENDED CODEBLOCKs */
#xtranslate \<|[<x,...>]| => {|<x>|
#xcommand > [<*x*>] => } <x>
#endif
#endif /* __HARBOUR__ */

View File

@@ -335,6 +335,13 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
}
else
yylval_ptr->valLong.lNumber = 0;
if( yylval_ptr->valLong.lNumber == 0 &&
strcmp( pToken->value + 2, "0" ) != 0 &&
strcmp( pToken->value + 2, "00000000" ) != 0 )
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_DATE, pToken->value, NULL );
}
return NUM_DATE;
case HB_PP_TOKEN_STRING:

View File

@@ -1621,22 +1621,59 @@ static HB_GENC_FUNC( hb_p_switch )
{
USHORT usCases = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), us;
ULONG ulStart = lPCodePos, ulNewPos;
BOOL fNum = FALSE, fStr = FALSE;
HB_GENC_LABEL();
fprintf( cargo->yyc, "\t{\n\t\tPHB_ITEM pSwitch = hb_stackItemFromTop( -1 );\n"
"\t\tHB_TYPE type = hb_itemType( pSwitch );\n"
"\t\tchar * pszText = (type & HB_IT_STRING) ? hb_itemGetCPtr( pSwitch ) : NULL;\n"
"\t\tlong lVal = (type & HB_IT_NUMINT) ? hb_itemGetNL( pSwitch ) : 0;\n\n" );
for( us = 0; us < usCases; ++us )
{
switch( pFunc->pCode[ lPCodePos ] )
{
case HB_P_PUSHLONG:
fNum = TRUE;
lPCodePos += 5;
break;
case HB_P_PUSHSTRSHORT:
fStr = TRUE;
lPCodePos += 2 + pFunc->pCode[ lPCodePos + 1 ];
break;
case HB_P_PUSHNIL:
/* default clause */
lPCodePos++;
break;
}
switch( pFunc->pCode[ lPCodePos ] )
{
case HB_P_JUMPNEAR:
ulNewPos = lPCodePos + ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
lPCodePos += 2;
break;
case HB_P_JUMP:
ulNewPos = lPCodePos + HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
lPCodePos += 3;
break;
/*case HB_P_JUMPFAR:*/
default:
ulNewPos = lPCodePos + HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
lPCodePos += 4;
break;
}
}
lPCodePos = ulStart;
if( fStr || fNum )
{
fprintf( cargo->yyc, "\t{\n\t\tPHB_ITEM pSwitch = hb_stackItemFromTop( -1 );\n"
"\t\tHB_TYPE type = hb_itemType( pSwitch );\n" );
if( fStr )
fprintf( cargo->yyc, "\t\tchar * pszText = (type & HB_IT_STRING) ? hb_itemGetCPtr( pSwitch ) : NULL;\n" );
if( fNum )
fprintf( cargo->yyc, "\t\tlong lVal = (type & HB_IT_NUMINT) ? hb_itemGetNL( pSwitch ) : 0;\n\n" );
}
lPCodePos += 3;
for( us = 0; us < usCases; ++us )
{
#if 0
/* only for test function - can be removed */
if( lPCodePos >= pFunc->lPCodePos )
break;
#endif
switch( pFunc->pCode[ lPCodePos ] )
{
case HB_P_PUSHLONG:

View File

@@ -549,12 +549,7 @@ NumValue : NUM_DOUBLE { $$ = hb_compExprNewDouble( $1.dNumber, $1.bWi
| NUM_LONG { $$ = hb_compExprNewLong( $1.lNumber, HB_COMP_PARAM ); }
;
DateValue : NUM_DATE { $$ = hb_compExprNewDate( $1.lNumber, HB_COMP_PARAM );
if( $1.lNumber == 0 )
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_DATE, HB_COMP_PARAM->pLex->lasttok, NULL );
}
}
DateValue : NUM_DATE { $$ = hb_compExprNewDate( $1.lNumber, HB_COMP_PARAM ); }
;
NumAlias : NUM_LONG ALIASOP { $$ = hb_compExprNewLong( $1.lNumber, HB_COMP_PARAM ); }

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,9 @@ LIBNAME=pp
LIBS=\
common \
HB_PPGEN_PATH ?= .
ifeq ($(HB_PPGEN_PATH),)
HB_PPGEN_PATH=.
endif
include $(TOP)$(ROOT)config/lib.cf

View File

@@ -305,15 +305,20 @@ RETURN oInstance
STATIC PROCEDURE AddData( cData, xInit, cType, nScope, lNoinit )
LOCAL c
DEFAULT lNoInit TO .F.
DEFAULT nScope TO HB_OO_CLSTP_EXPORTED
// Default Init for Logical and numeric
IF ! lNoInit .AND. cType != NIL .AND. xInit == NIL
IF Upper( Left( cType, 1 ) ) == "L"
c := Upper( Left( cType, 1 ) )
IF c == "L" /* Logical */
xInit := .F.
ELSEIF Upper( Left( cType, 1 ) ) $ "NI" /* Numeric Int */
ELSEIF c $ "NI" /* Numeric or Integer */
xInit := 0
ELSEIF c == "D" /* Date */
xInit := Ctod("")
ENDIF
ENDIF
@@ -351,6 +356,8 @@ STATIC PROCEDURE AddClassData( cData, xInit, cType, nScope, lNoInit )
xInit := .F.
ELSEIF c $ "NI" /* Numeric or Integer */
xInit := 0
ELSEIF c == "D" /* Date */
xInit := Ctod("")
ENDIF
ENDIF