2007-10-13 02:12 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/doc/destruct.txt
    * update description for multiple inherited destructors

  * harbour/source/compiler/complex.c
    * _HB_CLASS and _HB_MEMBER are not longer reserved words

  * harbour/include/hbclass.ch
  * harbour/include/hbexprop.h
  * harbour/include/hbexprb.c
  * harbour/source/macro/macro.y
  * harbour/source/compiler/harbour.y
    * formatting and minor code cleanup

  * harbour/source/compiler/hbusage.c
    * added missing information about -undef:<id> switch to usage
      description

  * harbour/source/compiler/gencc.c
    ! fixed bug reported by Teo in code generated for SWITCH statement
This commit is contained in:
Przemyslaw Czerpak
2007-10-13 00:12:25 +00:00
parent bde1c66062
commit c374d6f243
10 changed files with 83 additions and 42 deletions

View File

@@ -8,6 +8,27 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-10-13 02:12 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/doc/destruct.txt
* update description for multiple inherited destructors
* harbour/source/compiler/complex.c
* _HB_CLASS and _HB_MEMBER are not longer reserved words
* harbour/include/hbclass.ch
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/macro/macro.y
* harbour/source/compiler/harbour.y
* formatting and minor code cleanup
* harbour/source/compiler/hbusage.c
* added missing information about -undef:<id> switch to usage
description
* harbour/source/compiler/gencc.c
! fixed bug reported by Teo in code generated for SWITCH statement
2007-10-10 21:11 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/tests/multifnc/t0.prg
* harbour/tests/multifnc/t1.prg

View File

@@ -105,13 +105,9 @@ overwrite the error object created before destructor.
Inheritance
-----------
Destructors can be inherited from the first super class in the
same way as ON ERROR message. Defining destructor in class overwrites
the inherited ones so they will not be executed.
Maybe in some spare time I'll add support for executing all inherited
super destructors.
If class has more then one destructor inherited from other classes
then all destructors are executed in reverted order. First current
class destructor (if any) and then super class destructors.
Defining destructors in CLASS definition code

View File

@@ -157,7 +157,7 @@
/* should we inherit from HBObject class by default ? */
#ifdef HB_CLS_NOTOBJECT
#xtranslate __HB_CLS_PAR([<cls,...>]) => { [<cls>] }
#xtranslate __HB_CLS_PAR([<cls,...>]) => { <cls> }
#else
#xtranslate __HB_CLS_PAR([<cls,...>]) => iif( <.cls.>, { <cls> }, { @HBObject() } )
#endif
@@ -204,7 +204,7 @@ DECLARE HBClass ;
* bindings it casts object to class in which current method were defined.
*/
#translate @:<MessageName>([<MsgParams,...>]) => ;
::realclass:<MessageName>([<MsgParams>])
::realclass:<MessageName>([ <MsgParams>])
/* Indirect super casting translation */
#xtranslate :Super( <SuperClass> ): => :<SuperClass>:
@@ -216,11 +216,11 @@ DECLARE HBClass ;
#xtranslate __HB_CLS_ASSTRING( <FuncName> ) => <(FuncName)>
#xtranslate __HB_CLS_ASSTRING( <FuncName>([<params,...>]) ) => <(FuncName)>
#xtranslate __HB_CLS_ASFUNC( <FuncName> ) => <FuncName>()
#xtranslate __HB_CLS_ASFUNC( <FuncName>([<params,...>]) ) => <FuncName>([<params>])
#xtranslate __HB_CLS_ASFUNC( <FuncName>([<params,...>]) ) => <FuncName>([ <params>])
#xtranslate __HB_CLS_ASID( <FuncName> ) => <FuncName>
#xtranslate __HB_CLS_ASID( <FuncName>([<params,...>]) ) => <FuncName>
#xtranslate __HB_CLS_ASARGS( <FuncName> ) =>
#xtranslate __HB_CLS_ASARGS( <FuncName>([<Args,...>]) ) => [<Args>]
#xtranslate __HB_CLS_ASARGS( <FuncName>([<Args,...>]) ) => [ <Args>]
#xtranslate __HB_CLS_ASARGSOPT( <FuncName> ) =>
#xtranslate __HB_CLS_ASARGSOPT( <FuncName>([<Args,...>]) ) => [, <Args>]
#xtranslate __HB_CLS_ISVAR( <var> ) => __HB_CLS_VARERR(<var>)
@@ -375,7 +375,7 @@ DECLARE HBClass ;
MESSAGE <MessageName> [ AS <type> ] BLOCK {|Self __HB_CLS_ASARGSOPT(<MessageName>) [,<Locals>]| __HB_CLS_SYMBOL_UNUSED(Self), <Code>} <ctor> <export> <protect> <hidde> <persistent>
#xcommand MESSAGE <MessageName> [ AS <type> ] <arg: ARG, ARGS> <Args,...> [LOCAL <Locals,...>] INLINE <Code,...> [<ctor: CONSTRUCTOR>] [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] => ;
MESSAGE __HB_CLS_ASID(<MessageName>)([<Args>]) [ AS <type> ] [LOCAL <Locals>] INLINE <Code> <ctor> <export> <protect> <hidde> <persistent>
MESSAGE __HB_CLS_ASID(<MessageName>)(<Args>) [ AS <type> ] [LOCAL <Locals>] INLINE <Code> <ctor> <export> <protect> <hidde> <persistent>
#xcommand MESSAGE <MessageName> [ AS <type> ] TO <oObject> [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] =>;
MESSAGE <MessageName> [ AS <type> ] INLINE Self:<oObject>:<MessageName> <export> <protect> <hidde> <persistent>
@@ -425,7 +425,7 @@ DECLARE HBClass ;
/* CLASSY SYNTAX */
#ifdef HB_CLS_CSY
#xcommand CREATE CLASS <ClassName> [<*more*>] => CLASS <ClassName> [<more>]
#xcommand CREATE CLASS <ClassName> [<*more*>] => CLASS <ClassName> <more>
#xcommand END CLASS [<*more*>] => ENDCLASS <more>
#xcommand CLASS VAR <*more*> => CLASSVAR <more>
#xcommand CLASS METHOD <*more*> => CLASSMETHOD <more>
@@ -451,10 +451,10 @@ DECLARE HBClass ;
// Classy compatibility... Added By JF Lefebvre (mafact) 2006/11/07
#xcommand METHOD <MethodName> [ AS <type> ] INLINE [Local <v>,] <Code,...> [<other>] => ;
MESSAGE <MethodName> [ AS <type> ] BLOCK {|Self [,<v>] | __HB_CLS_SYMBOL_UNUSED(Self), <Code>} [<other>]
MESSAGE <MethodName> [ AS <type> ] BLOCK {|Self [,<v>] | __HB_CLS_SYMBOL_UNUSED(Self), <Code>} [ <other>]
#xcommand METHOD <MethodName>( [<params,...>] ) [ AS <type> ] INLINE [Local <v>,] <Code,...> [<other>] => ;
MESSAGE <MethodName> [ AS <type> ] BLOCK {|Self [,<params>] [,<v>] | __HB_CLS_SYMBOL_UNUSED(Self), <Code> } [<other>]
MESSAGE <MethodName> [ AS <type> ] BLOCK {|Self [, <params>] [, <v>] | __HB_CLS_SYMBOL_UNUSED(Self), <Code> } [ <other>]
/* This definitions are not Class(y) compatible - I'm leaving them as is now */

View File

@@ -936,28 +936,26 @@ static HB_EXPR_FUNC( hb_compExprUseList )
switch( iMessage )
{
case HB_EA_REDUCE:
if( HB_SUPPORT_XBASE )
{
if( HB_SUPPORT_XBASE )
if( hb_compExprListLen( pSelf ) == 1 )
{
if( hb_compExprListLen( pSelf ) == 1 )
HB_EXPR_PTR pExpr = pSelf->value.asList.pExprList;
if( pExpr->ExprType == HB_ET_MACRO &&
pExpr->value.asMacro.SubType != HB_ET_MACRO_SYMBOL &&
pExpr->value.asMacro.SubType != HB_ET_MACRO_REFER &&
pExpr->value.asMacro.SubType != HB_ET_MACRO_ALIASED )
{
HB_EXPR_PTR pExpr = pSelf->value.asList.pExprList;
if( pExpr->ExprType == HB_ET_MACRO &&
pExpr->value.asMacro.SubType != HB_ET_MACRO_SYMBOL &&
pExpr->value.asMacro.SubType != HB_ET_MACRO_REFER &&
pExpr->value.asMacro.SubType != HB_ET_MACRO_ALIASED )
{
pExpr->value.asMacro.SubType |= HB_ET_MACRO_PARE;
}
pExpr->value.asMacro.SubType |= HB_ET_MACRO_PARE;
}
}
hb_compExprReduceList( pSelf, HB_COMP_PARAM );
/* NOTE: if the list contains a single expression then the list
* is not reduced to this expression - if you need that reduction
* then call hb_compExprListStrip() additionaly
*/
}
hb_compExprReduceList( pSelf, HB_COMP_PARAM );
/* NOTE: if the list contains a single expression then the list
* is not reduced to this expression - if you need that reduction
* then call hb_compExprListStrip() additionaly
*/
break;
case HB_EA_ARRAY_AT:

View File

@@ -60,7 +60,7 @@ HB_EXTERN_BEGIN
/* Definitions of function templates used in expression's message
* handling
*/
#define HB_EXPR_FUNC( proc ) HB_EXPR_PTR proc( HB_EXPR_PTR pSelf, int iMessage, HB_COMP_DECL )
#define HB_EXPR_FUNC( proc ) HB_EXPR_PTR proc( HB_EXPR_PTR pSelf, HB_EXPR_MESSAGE iMessage, HB_COMP_DECL )
typedef HB_EXPR_FUNC( HB_EXPR_FUNC_ );
typedef HB_EXPR_FUNC_ *HB_EXPR_FUNC_PTR;

View File

@@ -1259,11 +1259,24 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
break;
}
case DECLARE_CLASS:
pLex->iState = DECLARE_TYPE;
return iType;
if( pLex->iState == LOOKUP && !HB_PP_TOKEN_ISEOC( pToken->pNext ) &&
HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD )
{
pLex->iState = DECLARE_TYPE;
return DECLARE_CLASS;
}
iType = IDENTIFIER;
break;
case DECLARE_MEMBER:
pLex->iState = OPERATOR;
return iType;
if( pLex->iState == LOOKUP && !HB_PP_TOKEN_ISEOC( pToken->pNext ) &&
( HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD ||
HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_CB ) )
{
pLex->iState = OPERATOR;
return DECLARE_MEMBER;
}
iType = IDENTIFIER;
break;
case EXIT:
case STATIC:

View File

@@ -1625,6 +1625,7 @@ static HB_GENC_FUNC( hb_p_switch )
HB_GENC_LABEL();
lPCodePos += 3;
for( us = 0; us < usCases; ++us )
{
switch( pFunc->pCode[ lPCodePos ] )
@@ -1660,18 +1661,20 @@ static HB_GENC_FUNC( hb_p_switch )
}
}
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" );
fprintf( cargo->yyc, "\t\tULONG ulLen = pszText ? hb_itemGetCLen( pSwitch ) : 0;\n" );
}
if( fNum )
fprintf( cargo->yyc, "\t\tlong lVal = (type & HB_IT_NUMINT) ? hb_itemGetNL( pSwitch ) : 0;\n\n" );
}
lPCodePos += 3;
lPCodePos = ulStart + 3;
for( us = 0; us < usCases; ++us )
{
switch( pFunc->pCode[ lPCodePos ] )
@@ -1682,8 +1685,11 @@ static HB_GENC_FUNC( hb_p_switch )
lPCodePos += 5;
break;
case HB_P_PUSHSTRSHORT:
fprintf( cargo->yyc, "\t\tif( pszText && !strcmp( pszText, \"%s\" ) )\n",
&pFunc->pCode[ lPCodePos + 2 ] );
fprintf( cargo->yyc, "\t\tif( pszText && ulLen == %d && !memcmp( pszText, ",
pFunc->pCode[ lPCodePos + 1 ] - 1 );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 1 ] - 1 );
fprintf( cargo->yyc, ", %d ) )\n", pFunc->pCode[ lPCodePos + 1 ] - 1 );
lPCodePos += 2 + pFunc->pCode[ lPCodePos + 1 ];
break;
case HB_P_PUSHNIL:
@@ -1710,7 +1716,9 @@ static HB_GENC_FUNC( hb_p_switch )
fprintf( cargo->yyc, "\t\t{\n\t\t\thb_stackPop();\n\t\t\tgoto lab%05ld;\n\t\t}\n",
HB_GENC_GETLABEL( ulNewPos ) );
}
fprintf( cargo->yyc, "\t}\n" );
if( fStr || fNum )
fprintf( cargo->yyc, "\t}\n" );
return lPCodePos - ulStart;
}

View File

@@ -62,6 +62,8 @@
#undef YYMALLOC
#define YYMALLOC hb_xgrab
#define NO_YYERROR
static void hb_compLoopStart( HB_COMP_DECL, BOOL );
static void hb_compLoopEnd( HB_COMP_DECL );
static void hb_compLoopLoop( HB_COMP_DECL );
@@ -2253,7 +2255,7 @@ void hb_compElseIfKill( HB_COMP_DECL )
{
HB_ELSEIF_PTR pFix;
HB_ELSEIF_PTR pDel;
while( HB_COMP_PARAM->elseif )
{
pFix = HB_COMP_PARAM->elseif;

View File

@@ -91,6 +91,7 @@ void hb_compPrintUsage( HB_COMP_DECL, char * szSelf )
"\n %cs syntax check only",
/* TODO: "\n %ct<path> path for temp file creation", */
"\n %cu[<file>] use command def set in <file> (or none)",
"\n %cundef:<id> #undef <id>",
"\n %cv variables are assumed M->",
"\n %cw[<level>] set warning level number (0..3, default 1)",
"\n %cx[<prefix>] set symbol init function name prefix (for .c only)",

View File

@@ -93,6 +93,8 @@
#undef YYMALLOC
#define YYMALLOC hb_xgrab
#define NO_YYERROR
/* yacc/lex related definitions
*/