2007-04-23 18:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbcomp.h
  * harbour/include/hbcompdf.h
  * harbour/include/hbexpra.c
  * harbour/include/hbexprb.c
  * harbour/include/hbexprop.h
  * harbour/source/common/expropt1.c
  * harbour/source/compiler/genc.c
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/hbmain.c
  * harbour/source/compiler/hbopt.c
    ! reverted fix for unnecessary -W2 warning:
         Function '...' does not end with RETURN statement
      in code like:
            func f(v)
            if v
               return "TRUE"
            else
               return "FALSE"
            endif
      Sorry but I had to make it because this fix was wrong and causes
      that code like:
            func f(v)
            if v
               ? v
            else
               return "FALSE"
            endif
      was compiled without any warnings but wrong PCODE was generated.
      In some spare time I'll try to implement valid RETURN detection,
      now simply add RETURN NIL at the end of such functions - it will
      be removed by dead code eliminator.
    ! fixed memory leak when more then one .prg file was given as compiler
      parameter
    + cleaned some code for future modifications

  * harbour/source/macro/macro.y
    + added small hack for two BCC/OW warnings
  * harbour/source/compiler/harbour.yyc
  * harbour/source/compiler/harbour.yyh
  * harbour/source/macro/macro.yyc
  * harbour/source/macro/macro.yyh
    * regenerated with modified Bison version which should give code
      without BCC warnings - I cannot promise I'll keep it in the
      future but I will try.

  * harbour/source/rdd/dbcmd.c
    ! use default RDD instead of current one in COPY TO and APPEND FROM

  * harbour/source/vm/classes.c
    * added support for (@func()):eval(...)
This commit is contained in:
Przemyslaw Czerpak
2007-04-23 16:27:57 +00:00
parent 0adc88de56
commit 74adc6f86c
18 changed files with 864 additions and 832 deletions

View File

@@ -8,6 +8,58 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-04-23 18:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbcomp.h
* harbour/include/hbcompdf.h
* harbour/include/hbexpra.c
* harbour/include/hbexprb.c
* harbour/include/hbexprop.h
* harbour/source/common/expropt1.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/hbmain.c
* harbour/source/compiler/hbopt.c
! reverted fix for unnecessary -W2 warning:
Function '...' does not end with RETURN statement
in code like:
func f(v)
if v
return "TRUE"
else
return "FALSE"
endif
Sorry but I had to make it because this fix was wrong and causes
that code like:
func f(v)
if v
? v
else
return "FALSE"
endif
was compiled without any warnings but wrong PCODE was generated.
In some spare time I'll try to implement valid RETURN detection,
now simply add RETURN NIL at the end of such functions - it will
be removed by dead code eliminator.
! fixed memory leak when more then one .prg file was given as compiler
parameter
+ cleaned some code for future modifications
* harbour/source/macro/macro.y
+ added small hack for two BCC/OW warnings
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
* harbour/source/macro/macro.yyc
* harbour/source/macro/macro.yyh
* regenerated with modified Bison version which should give code
without BCC warnings - I cannot promise I'll keep it in the
future but I will try.
* harbour/source/rdd/dbcmd.c
! use default RDD instead of current one in COPY TO and APPEND FROM
* harbour/source/vm/classes.c
* added support for (@func()):eval(...)
2007-04-20 21:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/source/rtl/tbcolumn.prg
* harbour/source/rtl/tbrowse.prg

View File

@@ -125,13 +125,13 @@ extern int hb_compVariableScope( HB_COMP_DECL, char * );
/*
* flags for bFlags member
*/
#define FUN_STATEMENTS 1 /* Function have at least one executable statement */
#define FUN_USES_STATICS 2 /* Function uses static variables */
#define FUN_PROCEDURE 4 /* This is a procedure that shouldn't return value */
#define FUN_BREAK_CODE 8 /* last statement breaks execution flow */
#define FUN_USES_LOCAL_PARAMS 16 /* parameters are declared using () */
#define FUN_WITH_RETURN 32 /* there was RETURN statement in previous line */
*/
#define FUN_STATEMENTS 0x01 /* Function have at least one executable statement */
#define FUN_USES_STATICS 0x02 /* Function uses static variables */
#define FUN_PROCEDURE 0x04 /* This is a procedure that shouldn't return value */
#define FUN_BREAK_CODE 0x08 /* last statement breaks execution flow */
#define FUN_USES_LOCAL_PARAMS 0x10 /* parameters are declared using () */
#define FUN_WITH_RETURN 0x20 /* there was RETURN statement in previous line */
extern void hb_compFunctionAdd( HB_COMP_DECL, char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */
extern PFUNCTION hb_compFunctionFind( HB_COMP_DECL, char * szFunName ); /* locates a previously defined function */

View File

@@ -387,11 +387,10 @@ typedef struct HB_EXPR_
} asList;
struct
{
char *string; /* source code of a codeblock */
USHORT length;
USHORT flags; /* HB_BLOCK_MACRO, HB_BLOCK_LATEEVAL, HB_BLOCK_VPARAMS */
struct HB_EXPR_ *pExprList; /* list elements */
HB_CBVAR_PTR pLocals; /* list of local variables */
char *string; /* source code of a codeblock */
USHORT flags; /* HB_BLOCK_MACRO, HB_BLOCK_LATEEVAL, HB_BLOCK_VPARAMS */
} asCodeblock;
struct
{

View File

@@ -566,6 +566,7 @@ HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightEx
return pExpr;
}
#endif
/* ************************************************************************* */

View File

@@ -356,7 +356,7 @@ static HB_EXPR_FUNC( hb_compExprUseString )
case HB_EA_PUSH_PCODE:
{
HB_GEN_FUNC2( PushString, pSelf->value.asString.string,
pSelf->ulLength + 1 );
pSelf->ulLength + 1 );
#if ! defined( HB_MACRO_SUPPORT )
if( HB_COMP_PARAM->fTextSubst &&
hb_compIsValidMacroText( HB_COMP_PARAM,
@@ -410,8 +410,8 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock )
HB_EXPR_PCODE1( hb_compExprCodeblockPush, pSelf );
#else
if( ( pSelf->value.asCodeblock.flags & HB_BLOCK_MACRO ) &&
!( pSelf->value.asCodeblock.flags &
( HB_BLOCK_LATEEVAL | HB_BLOCK_VPARAMS ) ) )
!( pSelf->value.asCodeblock.flags &
( HB_BLOCK_LATEEVAL | HB_BLOCK_VPARAMS ) ) )
/* early evaluation of a macro */
hb_compExprCodeblockEarly( pSelf, HB_COMP_PARAM );
else
@@ -3903,7 +3903,7 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf, HB_COMP_DECL )
HB_EXPR_PTR pNew;
hb_compExprCodeblockPush( pSelf, FALSE, HB_COMP_PARAM );
pNew = hb_compExprNewMacro( hb_compExprNewString( pSelf->value.asCodeblock.string, pSelf->value.asCodeblock.length, FALSE, HB_COMP_PARAM ), 0, NULL, HB_COMP_PARAM );
pNew = hb_compExprNewMacro( hb_compExprNewString( pSelf->value.asCodeblock.string, pSelf->ulLength, FALSE, HB_COMP_PARAM ), 0, NULL, HB_COMP_PARAM );
HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE );
HB_COMP_EXPR_DELETE( pNew );
hb_compCodeBlockStop( HB_COMP_PARAM );

View File

@@ -89,7 +89,7 @@ extern HB_EXPR_PTR hb_compExprNewDate( HB_LONG, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewString( char *, ULONG, BOOL, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewLogical( int, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewSelf( HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewCodeBlock( char *, int, int, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewCodeBlock( char *, ULONG, int, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewVar( char *, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL );

View File

@@ -439,7 +439,7 @@ HB_EXPR_PTR hb_compExprNewHash( HB_EXPR_PTR pHashList, HB_COMP_DECL )
return pHashList;
}
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, int iLen, int iFlags, HB_COMP_DECL )
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, ULONG ulLen, int iFlags, HB_COMP_DECL )
{
HB_EXPR_PTR pExpr;
@@ -450,9 +450,9 @@ HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, int iLen, int iFlags, HB_COMP
pExpr->value.asCodeblock.pExprList = NULL;
pExpr->value.asCodeblock.pLocals = NULL; /* this will hold local variables declarations */
pExpr->ValType = HB_EV_CODEBLOCK;
pExpr->value.asCodeblock.string = string;
pExpr->value.asCodeblock.length = ( USHORT ) iLen;
pExpr->value.asCodeblock.flags = ( USHORT ) iFlags;
pExpr->value.asCodeblock.string = string;
pExpr->ulLength = ulLen;
return pExpr;
}

View File

@@ -42,7 +42,7 @@ typedef struct HB_stru_genc_info
HB_COMP_DECL;
FILE * yyc;
BOOL bVerbose;
USHORT iNestedCodeblock;
ULONG ulEndBlockPos;
} HB_GENC_INFO, * HB_GENC_INFO_PTR;
#define HB_GENC_FUNC( func ) HB_PCODE_FUNC( func, HB_GENC_INFO_PTR )
@@ -418,6 +418,31 @@ static void hb_compGenCByteStr( FILE * yyc, BYTE * pText, ULONG ulLen )
}
}
static void hb_compGenCLocalName( PFUNCTION pFunc, int iLocal, ULONG lPCodePos, HB_GENC_INFO_PTR cargo )
{
PVAR pVar;
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->ulEndBlockPos > lPCodePos )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iLocal < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iLocal );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iLocal );
}
else
{
pVar = hb_compLocalVariableFind( pFunc, ( USHORT ) iLocal );
if( pVar )
fprintf( cargo->yyc, "\t/* %s */", pVar->szName );
}
}
static HB_GENC_FUNC( hb_p_and )
{
HB_SYMBOL_UNUSED( pFunc );
@@ -468,7 +493,7 @@ static HB_GENC_FUNC( hb_p_arraydim )
fprintf( cargo->yyc, "\tHB_P_ARRAYDIM, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -561,14 +586,13 @@ static HB_GENC_FUNC( hb_p_endblock )
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
--cargo->iNestedCodeblock;
fprintf( cargo->yyc, "\tHB_P_ENDBLOCK,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_endproc )
{
if( (lPCodePos+1) == pFunc->lPCodePos )
if( lPCodePos + 1 == pFunc->lPCodePos )
fprintf( cargo->yyc, "\tHB_P_ENDPROC\n" );
else
fprintf( cargo->yyc, "\tHB_P_ENDPROC,\n" );
@@ -631,7 +655,7 @@ static HB_GENC_FUNC( hb_p_arraygen )
fprintf( cargo->yyc, "\tHB_P_ARRAYGEN, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -641,7 +665,7 @@ static HB_GENC_FUNC( hb_p_hashgen )
fprintf( cargo->yyc, "\tHB_P_HASHGEN, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -703,7 +727,7 @@ static HB_GENC_FUNC( hb_p_jump )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
@@ -719,7 +743,7 @@ static HB_GENC_FUNC( hb_p_jumpfar )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -746,7 +770,7 @@ static HB_GENC_FUNC( hb_p_jumpfalse )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -761,7 +785,7 @@ static HB_GENC_FUNC( hb_p_jumpfalsefar )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -788,7 +812,7 @@ static HB_GENC_FUNC( hb_p_jumptrue )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -803,7 +827,7 @@ static HB_GENC_FUNC( hb_p_jumptruefar )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -838,7 +862,7 @@ static HB_GENC_FUNC( hb_p_line )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1001,7 +1025,7 @@ static HB_GENC_FUNC( hb_p_message )
fprintf( cargo->yyc, "\tHB_P_MESSAGE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1097,7 +1121,7 @@ static HB_GENC_FUNC( hb_p_parameter )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 4;
}
@@ -1134,7 +1158,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfield )
fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1153,7 +1177,7 @@ static HB_GENC_FUNC( hb_p_popaliasedvar )
fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1163,7 +1187,7 @@ static HB_GENC_FUNC( hb_p_popfield )
fprintf( cargo->yyc, "\tHB_P_POPFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1175,22 +1199,8 @@ static HB_GENC_FUNC( hb_p_poplocal )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1203,21 +1213,7 @@ static HB_GENC_FUNC( hb_p_poplocalnear )
if( cargo->bVerbose )
{
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 2;
@@ -1228,7 +1224,7 @@ static HB_GENC_FUNC( hb_p_popmemvar )
fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1240,7 +1236,7 @@ static HB_GENC_FUNC( hb_p_popstatic )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %s */", szName );
}
fprintf( cargo->yyc, "\n" );
@@ -1252,7 +1248,7 @@ static HB_GENC_FUNC( hb_p_popvariable )
fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1280,7 +1276,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfield )
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1299,15 +1295,13 @@ static HB_GENC_FUNC( hb_p_pushaliasedvar )
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushblockshort )
{
++cargo->iNestedCodeblock;
fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKSHORT, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
@@ -1315,6 +1309,9 @@ static HB_GENC_FUNC( hb_p_pushblockshort )
pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\n" );
if( cargo->ulEndBlockPos < lPCodePos )
cargo->ulEndBlockPos = lPCodePos + pFunc->pCode[ lPCodePos + 1 ] - 1;
return 2;
}
@@ -1323,8 +1320,6 @@ static HB_GENC_FUNC( hb_p_pushblock )
USHORT wVar, w;
ULONG ulStart = lPCodePos;
++cargo->iNestedCodeblock;
fprintf( cargo->yyc, "\tHB_P_PUSHBLOCK, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
@@ -1361,11 +1356,15 @@ static HB_GENC_FUNC( hb_p_pushblock )
* because at the time of C code generation we don't know
* in which function was defined this local variable
*/
if( ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT )
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, w )->szName );
if( cargo->bVerbose && ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT )
hb_compGenCLocalName( pFunc, w, lPCodePos, cargo );
fprintf( cargo->yyc, "\n" );
lPCodePos +=2;
}
if( cargo->ulEndBlockPos < ulStart )
cargo->ulEndBlockPos = ulStart + HB_PCODE_MKUSHORT( &pFunc->pCode[ ulStart + 1 ] ) - 1;
return (lPCodePos - ulStart);
}
@@ -1374,8 +1373,6 @@ static HB_GENC_FUNC( hb_p_pushblocklarge )
USHORT wVar, w;
ULONG ulStart = lPCodePos;
++cargo->iNestedCodeblock;
fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKLARGE, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
@@ -1413,11 +1410,15 @@ static HB_GENC_FUNC( hb_p_pushblocklarge )
* because at the time of C code generation we don't know
* in which function was defined this local variable
*/
if( ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT )
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, w )->szName );
if( cargo->bVerbose && ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT )
hb_compGenCLocalName( pFunc, w, lPCodePos, cargo );
fprintf( cargo->yyc, "\n" );
lPCodePos +=2;
}
if( cargo->ulEndBlockPos < ulStart )
cargo->ulEndBlockPos = ulStart + HB_PCODE_MKUINT24( &pFunc->pCode[ ulStart + 1 ] ) - 1;
return (lPCodePos - ulStart);
}
@@ -1429,15 +1430,15 @@ static HB_GENC_FUNC( hb_p_pushdouble )
++lPCodePos;
for( i = 0; i < ( int ) ( sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) ); ++i )
{
fprintf( cargo->yyc, " %i,", ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ] );
fprintf( cargo->yyc, " %i,", ( UCHAR ) pFunc->pCode[ lPCodePos + i ] );
}
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %.*f, %d, %d */",
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ] ) ),
HB_PCODE_MKDOUBLE( &( pFunc->pCode[ lPCodePos ] ) ),
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ),
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ] ) ) );
( UCHAR ) pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ],
HB_PCODE_MKDOUBLE( &pFunc->pCode[ lPCodePos ] ),
( UCHAR ) pFunc->pCode[ lPCodePos + sizeof( double ) ],
( UCHAR ) pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ] );
}
fprintf( cargo->yyc, "\n" );
@@ -1449,7 +1450,7 @@ static HB_GENC_FUNC( hb_p_pushfield )
fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1458,8 +1459,7 @@ static HB_GENC_FUNC( hb_p_pushbyte )
{
fprintf( cargo->yyc, "\tHB_P_PUSHBYTE, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */",
( signed char ) pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", ( signed char ) pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\n" );
return 2;
}
@@ -1469,7 +1469,7 @@ static HB_GENC_FUNC( hb_p_pushint )
fprintf( cargo->yyc, "\tHB_P_PUSHINT, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1481,22 +1481,8 @@ static HB_GENC_FUNC( hb_p_pushlocal )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = (int) HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
int iVar = (int) HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1509,21 +1495,7 @@ static HB_GENC_FUNC( hb_p_pushlocalnear )
if( cargo->bVerbose )
{
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 2;
@@ -1536,22 +1508,8 @@ static HB_GENC_FUNC( hb_p_pushlocalref )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = (int) HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
int iVar = (int) HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1564,7 +1522,7 @@ static HB_GENC_FUNC( hb_p_pushlong )
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %li */", HB_PCODE_MKLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %li */", HB_PCODE_MKLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 5;
@@ -1584,9 +1542,9 @@ static HB_GENC_FUNC( hb_p_pushlonglong )
if( cargo->bVerbose )
{
#ifdef HB_LONG_LONG_OFF
fprintf( cargo->yyc, "\t/* %f */", HB_PCODE_MKLONGLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\t/* %f */", HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
#else
fprintf( cargo->yyc, "\t/* %" PFLL "i */", HB_PCODE_MKLONGLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\t/* %" PFLL "i */", HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
#endif
}
fprintf( cargo->yyc, "\n" );
@@ -1599,7 +1557,7 @@ static HB_GENC_FUNC( hb_p_pushmemvar )
fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1609,7 +1567,7 @@ static HB_GENC_FUNC( hb_p_pushmemvarref )
fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1639,7 +1597,7 @@ static HB_GENC_FUNC( hb_p_pushstatic )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %s */", szName );
}
fprintf( cargo->yyc, "\n" );
@@ -1653,7 +1611,7 @@ static HB_GENC_FUNC( hb_p_pushstaticref )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %s */", szName );
}
fprintf( cargo->yyc, "\n" );
@@ -1667,7 +1625,7 @@ static HB_GENC_FUNC( hb_p_pushstrshort )
fprintf( cargo->yyc, "\tHB_P_PUSHSTRSHORT, %i,", pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", wLen );
fprintf( cargo->yyc, "\t/* %i */", wLen );
if( wLen > 0 )
{
@@ -1746,7 +1704,7 @@ static HB_GENC_FUNC( hb_p_pushsym )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1767,7 +1725,7 @@ static HB_GENC_FUNC( hb_p_pushfuncsym )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1778,7 +1736,7 @@ static HB_GENC_FUNC( hb_p_pushvariable )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1823,7 +1781,7 @@ static HB_GENC_FUNC( hb_p_seqbegin )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
@@ -1840,7 +1798,7 @@ static HB_GENC_FUNC( hb_p_seqend )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
@@ -1920,7 +1878,7 @@ static HB_GENC_FUNC( hb_p_statics )
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %i statics */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 3 ] ) ) );
fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %i statics */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 3 ] ) );
fprintf( cargo->yyc, "\n" );
return 5;
@@ -2046,7 +2004,7 @@ static HB_GENC_FUNC( hb_p_switch )
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %i*/", HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\t/* %i*/", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
}
fprintf( cargo->yyc, "\n" );
@@ -2066,7 +2024,7 @@ static HB_GENC_FUNC( hb_p_pushdate )
int year, month, day;
char date[9];
hb_dateDecode( HB_PCODE_MKLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ), &year, &month, &day );
hb_dateDecode( HB_PCODE_MKLONG( &pFunc->pCode[ lPCodePos + 1 ] ), &year, &month, &day );
hb_dateStrPut( date, year, month, day );
date[8] = '\0';
fprintf( cargo->yyc, "\t/* %s */", date );
@@ -2085,10 +2043,10 @@ static HB_GENC_FUNC( hb_p_localnearaddint )
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %s %i*/", hb_compLocalVariableFind( pFunc, ( signed char ) pFunc->pCode[ lPCodePos + 1 ] )->szName,
HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 2 ] ) ) );
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
fprintf( cargo->yyc, "/* %i */", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 2 ] ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
@@ -2103,10 +2061,10 @@ static HB_GENC_FUNC( hb_p_localaddint )
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %s %i*/", hb_compLocalVariableFind( pFunc, HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName,
HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 3 ] ) ) );
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
fprintf( cargo->yyc, "/* %i */", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 3 ] ) );
}
fprintf( cargo->yyc, "\n" );
return 5;
@@ -2119,9 +2077,9 @@ static HB_GENC_FUNC( hb_p_localinc )
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %s*/", hb_compLocalVariableFind( pFunc, HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -2134,9 +2092,9 @@ static HB_GENC_FUNC( hb_p_localdec )
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %s*/", hb_compLocalVariableFind( pFunc, HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -2149,9 +2107,9 @@ static HB_GENC_FUNC( hb_p_localincpush )
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %s*/", hb_compLocalVariableFind( pFunc, HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -2315,7 +2273,7 @@ static HB_GENC_FUNC( hb_p_withobjectmessage )
fprintf( cargo->yyc, "\tHB_P_WITHOBJECTMESSAGE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -2567,7 +2525,7 @@ static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc )
assert( HB_P_LAST_PCODE == sizeof( s_verbose_table ) / sizeof( HB_GENC_FUNC_PTR ) );
genc_info.HB_COMP_PARAM = HB_COMP_PARAM;
genc_info.iNestedCodeblock = 0;
genc_info.ulEndBlockPos = 0;
genc_info.bVerbose = ( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_VERBOSE );
genc_info.yyc = yyc;

View File

@@ -402,7 +402,8 @@ Statement : ExecFlow CrlfStmnt
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL );
}
HB_COMP_EXPR_DELETE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); /* TODO: check if return value agree with declared value */
/* TODO: check if return value agree with declared value */
HB_COMP_EXPR_DELETE( hb_compExprGenPush( $3, HB_COMP_PARAM ) );
hb_compGenPCode2( HB_P_RETVALUE, HB_P_ENDPROC, HB_COMP_PARAM );
if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_PROCEDURE )
{ /* procedure returns a value */
@@ -743,7 +744,7 @@ VariableAtAlias : VariableAt ALIASOP
;
FunIdentCall: IdentName '(' { $<bTrue>$ = HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1, HB_COMP_PARAM ), $4, HB_COMP_PARAM ); HB_COMP_PARAM->iPassByRef = $<bTrue>3; }
/* Function call
/* function call
*/
FunCall : FunIdentCall
| MacroVar '(' { $<bTrue>$ = HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( $1, $4, HB_COMP_PARAM ); HB_COMP_PARAM->iPassByRef = $<bTrue>3; }
@@ -1056,8 +1057,11 @@ VarDefs : LOCAL { HB_COMP_PARAM->iVarScope = VS_LOCAL; hb_compLinePush( HB_COMP
| PARAMETERS { if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_USES_LOCAL_PARAMS )
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_PARAMETERS_NOT_ALLOWED, NULL, NULL );
else
HB_COMP_PARAM->functions.pLast->wParamNum=0; HB_COMP_PARAM->iVarScope = ( VS_PRIVATE | VS_PARAMETER ); }
MemvarList Crlf { HB_COMP_PARAM->iVarScope = VS_NONE; }
{
HB_COMP_PARAM->functions.pLast->wParamNum = 0;
HB_COMP_PARAM->iVarScope = ( VS_PRIVATE | VS_PARAMETER );
}
} MemvarList Crlf { HB_COMP_PARAM->iVarScope = VS_NONE; }
;
VarList : VarDef { $$ = 1; }
@@ -1366,10 +1370,10 @@ IfElseIf : ELSEIF { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE
EndIf : ENDIF { if( HB_COMP_PARAM->wIfCounter )
--HB_COMP_PARAM->wIfCounter;
HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); }
HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); }
| END { if( HB_COMP_PARAM->wIfCounter )
--HB_COMP_PARAM->wIfCounter;
HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); }
HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); }
;
DoCase : DoCaseBegin
@@ -2280,7 +2284,6 @@ static void hb_compForEnd( HB_COMP_DECL, char *szVar )
{
HB_ENUMERATOR_PTR pEnumVar;
HB_SYMBOL_UNUSED( HB_COMP_PARAM );
HB_SYMBOL_UNUSED( szVar );
pEnumVar = HB_COMP_PARAM->functions.pLast->pEnum;
@@ -2557,7 +2560,7 @@ static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr )
BOOL hb_compCheckUnclosedStru( HB_COMP_DECL )
{
BOOL fUnclosed = TRUE;
if( HB_COMP_PARAM->wIfCounter )
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNCLOSED_STRU, "IF", NULL );
@@ -2601,8 +2604,6 @@ BOOL hb_compCheckUnclosedStru( HB_COMP_DECL )
void yyerror( HB_COMP_DECL, char * s )
{
HB_SYMBOL_UNUSED( pComp );
if( !HB_COMP_PARAM->pLex->lasttok || HB_COMP_PARAM->pLex->lasttok[ 0 ] == '\n' )
{
if( ! hb_pp_eof( HB_COMP_PARAM->pLex->pPP ) )

File diff suppressed because it is too large Load Diff

View File

@@ -298,7 +298,7 @@ typedef union YYSTYPE
} value;
} asMessage;
}
/* Line 1529 of yacc.c. */
/* Line 1533 of yacc.c. */
#line 303 "harboury.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

View File

@@ -67,7 +67,6 @@
extern unsigned _stklen = UINT_MAX;
#endif
static void hb_compCompileEnd( HB_COMP_DECL );
static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile );
static int hb_compStaticGetPos( char *, PFUNCTION ); /* return if passed name is a static variable */
@@ -95,7 +94,6 @@ FILE * hb_comp_errFile = NULL;
static void hb_compMainExit( HB_COMP_DECL )
{
hb_compCompileEnd( HB_COMP_PARAM );
hb_compParserStop( HB_COMP_PARAM );
if( HB_COMP_PARAM->iErrorCount != 0 )
hb_compExprLstDealloc( HB_COMP_PARAM );
@@ -2244,18 +2242,12 @@ USHORT hb_compFunctionGetPos( HB_COMP_DECL, char * szFunctionName ) /* return 0
static void hb_compNOOPadd( PFUNCTION pFunc, ULONG ulPos )
{
pFunc->pCode[ ulPos ] = HB_P_NOOP;
pFunc->iNOOPs++;
if( pFunc->pNOOPs )
{
pFunc->pNOOPs = ( ULONG * ) hb_xrealloc( pFunc->pNOOPs, sizeof( ULONG ) * pFunc->iNOOPs );
pFunc->pNOOPs[ pFunc->iNOOPs - 1 ] = ulPos;
}
if( pFunc->iNOOPs )
pFunc->pNOOPs = ( ULONG * ) hb_xrealloc( pFunc->pNOOPs, sizeof( ULONG ) * ( pFunc->iNOOPs + 1 ) );
else
{
pFunc->pNOOPs = ( ULONG * ) hb_xgrab( sizeof( ULONG ) );
pFunc->pNOOPs[ pFunc->iNOOPs - 1 ] = ulPos;
}
pFunc->pNOOPs[ pFunc->iNOOPs++ ] = ulPos;
}
/* NOTE: To disable jump optimization, just make this function a dummy one.
@@ -2265,18 +2257,13 @@ static void hb_compPrepareOptimize( HB_COMP_DECL )
{
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) )
{
HB_COMP_PARAM->functions.pLast->iJumps++;
PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast;
if( HB_COMP_PARAM->functions.pLast->pJumps )
{
HB_COMP_PARAM->functions.pLast->pJumps = ( ULONG * ) hb_xrealloc( HB_COMP_PARAM->functions.pLast->pJumps, sizeof( ULONG ) * HB_COMP_PARAM->functions.pLast->iJumps );
HB_COMP_PARAM->functions.pLast->pJumps[ HB_COMP_PARAM->functions.pLast->iJumps - 1 ] = ( ULONG ) ( HB_COMP_PARAM->functions.pLast->lPCodePos - 4 );
}
if( pFunc->iJumps )
pFunc->pJumps = ( ULONG * ) hb_xrealloc( pFunc->pJumps, sizeof( ULONG ) * ( pFunc->iJumps + 1 ) );
else
{
HB_COMP_PARAM->functions.pLast->pJumps = ( ULONG * ) hb_xgrab( sizeof( ULONG ) );
HB_COMP_PARAM->functions.pLast->pJumps[ HB_COMP_PARAM->functions.pLast->iJumps - 1 ] = ( ULONG ) ( HB_COMP_PARAM->functions.pLast->lPCodePos - 4 );
}
pFunc->pJumps = ( ULONG * ) hb_xgrab( sizeof( ULONG ) );
pFunc->pJumps[ pFunc->iJumps++ ] = ( ULONG ) ( pFunc->lPCodePos - 4 );
}
}
@@ -4071,20 +4058,21 @@ void hb_compCodeBlockStart( HB_COMP_DECL, BOOL bLateEval )
void hb_compCodeBlockEnd( HB_COMP_DECL )
{
PFUNCTION pCodeblock; /* pointer to the current codeblock */
PFUNCTION pFunc;/* pointer to a function that owns a codeblock */
PFUNCTION pFunc; /* pointer to a function that owns a codeblock */
char * pFuncName;
ULONG ulSize;
USHORT wLocals = 0; /* number of referenced local variables */
USHORT wLocals = 0; /* number of referenced local variables */
USHORT wLocalsCnt, wLocalsLen;
USHORT wPos;
int iLocalPos;
PVAR pVar, pFree;
pCodeblock = HB_COMP_PARAM->functions.pLast;
hb_compGenPCode1( HB_P_ENDBLOCK, HB_COMP_PARAM ); /* finish the codeblock */
hb_compOptimizeJumps( HB_COMP_PARAM );
pCodeblock = HB_COMP_PARAM->functions.pLast;
if( !pCodeblock->bError )
hb_compOptimizeJumps( HB_COMP_PARAM );
/* return to pcode buffer of function/codeblock in which the current
* codeblock was defined
@@ -4106,9 +4094,6 @@ void hb_compCodeBlockEnd( HB_COMP_DECL )
/* generate a proper codeblock frame with a codeblock size and with
* a number of expected parameters
*/
/* QUESTION: would be 64kB enough for a codeblock size?
* we are assuming now a USHORT for a size of codeblock
*/
/* Count the number of referenced local variables */
wLocalsLen = 0;
@@ -4264,11 +4249,18 @@ void hb_compCodeBlockRewind( HB_COMP_DECL )
/* Release the NOOP array. */
if( pCodeblock->pNOOPs )
{
hb_xfree( ( void * ) pCodeblock->pNOOPs );
pCodeblock->pNOOPs = NULL;
pCodeblock->iNOOPs = 0;
}
/* Release the Jumps array. */
if( pCodeblock->pJumps )
{
hb_xfree( ( void * ) pCodeblock->pJumps );
pCodeblock->pJumps = NULL;
pCodeblock->iJumps = 0;
}
}
@@ -4397,6 +4389,90 @@ static void hb_compAddInitFunc( HB_COMP_DECL, PFUNCTION pFunc )
++HB_COMP_PARAM->functions.iCount;
}
static void hb_compCompileEnd( HB_COMP_DECL )
{
hb_compRTVariableKill( HB_COMP_PARAM );
if( HB_COMP_PARAM->pMainFileName && HB_COMP_PARAM->pFileName != HB_COMP_PARAM->pMainFileName )
{
/* currently compiled file was autoopened - close also
* the main module
*/
hb_xfree( HB_COMP_PARAM->pMainFileName );
HB_COMP_PARAM->pMainFileName = NULL;
}
if( HB_COMP_PARAM->pFileName )
{
hb_xfree( HB_COMP_PARAM->pFileName );
HB_COMP_PARAM->pFileName = NULL;
}
if( HB_COMP_PARAM->functions.pFirst )
{
PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst;
while( pFunc )
pFunc = hb_compFunctionKill( HB_COMP_PARAM, pFunc );
HB_COMP_PARAM->functions.pFirst = NULL;
}
while( HB_COMP_PARAM->funcalls.pFirst )
{
PFUNCALL pFunc = HB_COMP_PARAM->funcalls.pFirst;
HB_COMP_PARAM->funcalls.pFirst = pFunc->pNext;
hb_xfree( ( void * ) pFunc );
}
while( HB_COMP_PARAM->externs )
{
PEXTERN pExtern = HB_COMP_PARAM->externs;
HB_COMP_PARAM->externs = HB_COMP_PARAM->externs->pNext;
hb_xfree( pExtern );
}
while( HB_COMP_PARAM->inlines.pFirst )
{
PINLINE pInline = HB_COMP_PARAM->inlines.pFirst;
HB_COMP_PARAM->inlines.pFirst = pInline->pNext;
if( pInline->pCode )
hb_xfree( pInline->pCode );
hb_xfree( ( void * ) pInline );
}
while( HB_COMP_PARAM->pReleaseDeclared )
{
PCOMDECLARED pDeclared = HB_COMP_PARAM->pReleaseDeclared;
HB_COMP_PARAM->pReleaseDeclared = pDeclared->pNext;
hb_xfree( ( void * ) pDeclared );
}
HB_COMP_PARAM->pFirstDeclared = HB_COMP_PARAM->pLastDeclared = NULL;
while( HB_COMP_PARAM->pReleaseClass )
{
PCOMCLASS pClass = HB_COMP_PARAM->pReleaseClass;
HB_COMP_PARAM->pReleaseClass = pClass->pNext;
while( pClass->pMethod )
{
PCOMDECLARED pDeclared = pClass->pMethod;
pClass->pMethod = pDeclared->pNext;
hb_xfree( ( void * ) pDeclared );
}
hb_xfree( ( void * ) pClass );
}
HB_COMP_PARAM->pFirstClass = HB_COMP_PARAM->pLastClass = NULL;
if( HB_COMP_PARAM->symbols.pFirst )
{
PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst;
while( pSym )
pSym = hb_compSymbolKill( pSym );
HB_COMP_PARAM->symbols.pFirst = NULL;
}
}
static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile )
{
int iStatus = EXIT_SUCCESS;
@@ -4650,94 +4726,11 @@ static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile )
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADFILENAME, szPrg, NULL );
iStatus = EXIT_FAILURE;
}
hb_compCompileEnd( HB_COMP_PARAM );
return HB_COMP_PARAM->fExit ? EXIT_FAILURE : iStatus;
}
static void hb_compCompileEnd( HB_COMP_DECL )
{
hb_compRTVariableKill( HB_COMP_PARAM );
if( HB_COMP_PARAM->pFileName )
{
if( HB_COMP_PARAM->pFileName != HB_COMP_PARAM->pMainFileName && HB_COMP_PARAM->pMainFileName )
{
/* currently compiled file was autoopened - close also
* the main module
*/
hb_xfree( HB_COMP_PARAM->pMainFileName );
HB_COMP_PARAM->pMainFileName = NULL;
}
hb_xfree( HB_COMP_PARAM->pFileName );
HB_COMP_PARAM->pFileName = NULL;
}
if( HB_COMP_PARAM->functions.pFirst )
{
PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst;
while( pFunc )
pFunc = hb_compFunctionKill( HB_COMP_PARAM, pFunc );
HB_COMP_PARAM->functions.pFirst = NULL;
}
while( HB_COMP_PARAM->funcalls.pFirst )
{
PFUNCALL pFunc = HB_COMP_PARAM->funcalls.pFirst;
HB_COMP_PARAM->funcalls.pFirst = pFunc->pNext;
hb_xfree( ( void * ) pFunc );
}
while( HB_COMP_PARAM->externs )
{
PEXTERN pExtern = HB_COMP_PARAM->externs;
HB_COMP_PARAM->externs = HB_COMP_PARAM->externs->pNext;
hb_xfree( pExtern );
}
while( HB_COMP_PARAM->inlines.pFirst )
{
PINLINE pInline = HB_COMP_PARAM->inlines.pFirst;
HB_COMP_PARAM->inlines.pFirst = pInline->pNext;
if( pInline->pCode )
hb_xfree( pInline->pCode );
hb_xfree( ( void * ) pInline );
}
while( HB_COMP_PARAM->pReleaseDeclared )
{
PCOMDECLARED pDeclared = HB_COMP_PARAM->pReleaseDeclared;
HB_COMP_PARAM->pReleaseDeclared = pDeclared->pNext;
hb_xfree( ( void * ) pDeclared );
}
HB_COMP_PARAM->pFirstDeclared = HB_COMP_PARAM->pLastDeclared = NULL;
while( HB_COMP_PARAM->pReleaseClass )
{
PCOMCLASS pClass = HB_COMP_PARAM->pReleaseClass;
HB_COMP_PARAM->pReleaseClass = pClass->pNext;
while( pClass->pMethod )
{
PCOMDECLARED pDeclared = pClass->pMethod;
pClass->pMethod = pDeclared->pNext;
hb_xfree( ( void * ) pDeclared );
}
hb_xfree( ( void * ) pClass );
}
HB_COMP_PARAM->pFirstClass = HB_COMP_PARAM->pLastClass = NULL;
if( HB_COMP_PARAM->symbols.pFirst )
{
PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst;
while( pSym )
pSym = hb_compSymbolKill( pSym );
HB_COMP_PARAM->symbols.pFirst = NULL;
}
}
static BOOL hb_compAutoOpenFind( HB_COMP_DECL, char * szName )
{
PAUTOOPEN pLast = HB_COMP_PARAM->autoopen;

View File

@@ -537,6 +537,30 @@ static HB_OPT_FUNC( hb_p_jumptruefar )
return 4;
}
static HB_OPT_FUNC( hb_p_endblock )
{
HB_SYMBOL_UNUSED( cargo );
if( lPCodePos + 1 < pFunc->lPCodePos &&
pFunc->pCode[ lPCodePos + 1 ] == HB_P_ENDBLOCK )
{
hb_compNOOPfill( pFunc, lPCodePos, 1, FALSE, FALSE );
}
return 1;
}
static HB_OPT_FUNC( hb_p_endproc )
{
HB_SYMBOL_UNUSED( cargo );
if( lPCodePos + 1 < pFunc->lPCodePos &&
pFunc->pCode[ lPCodePos + 1 ] == HB_P_ENDPROC )
{
hb_compNOOPfill( pFunc, lPCodePos, 1, FALSE, FALSE );
}
return 1;
}
/* NOTE: The order of functions have to match the order of opcodes mnemonics
*/
static HB_OPT_FUNC_PTR s_opt_table[] =
@@ -547,8 +571,8 @@ static HB_OPT_FUNC_PTR s_opt_table[] =
NULL, /* HB_P_ARRAYDIM, */
NULL, /* HB_P_ARRAYGEN, */
NULL, /* HB_P_EQUAL, */
NULL, /* HB_P_ENDBLOCK, */
NULL, /* HB_P_ENDPROC, */
hb_p_endblock, /* HB_P_ENDBLOCK, */
hb_p_endproc, /* HB_P_ENDPROC, */
NULL, /* HB_P_EXACTLYEQUAL, */
hb_p_false, /* HB_P_FALSE, */
NULL, /* HB_P_FORTEST, */

View File

@@ -99,7 +99,7 @@
/* Standard checking for valid expression creation
*/
#define HB_MACRO_CHECK( pExpr ) \
#define HB_MACRO_CHECK( pExpr ) \
if( ! ( HB_MACRO_DATA->status & HB_MACRO_CONT ) ) \
{ \
YYABORT; \
@@ -115,6 +115,13 @@
YYABORT; \
}
#if defined( __BORLANDC__ ) || defined( __WATCOMC__ )
/* The if() inside this macro is always TRUE but it's used to hide BCC warning */
#define HB_MACRO_ABORT if( !( HB_MACRO_DATA->status & HB_MACRO_CONT ) ) { YYABORT; }
#else
#define HB_MACRO_ABORT { YYABORT; }
#endif
%}
%union /* special structure used by lex and yacc to share info */
@@ -158,13 +165,6 @@ static void hb_macroIdentNew( HB_COMP_DECL, char * );
%}
%{
#ifdef __WATCOMC__
/* disable warnings for unreachable code */
#pragma warning 13 9
#endif
%}
%token IDENTIFIER NIL NUM_DOUBLE INASSIGN NUM_LONG NUM_DATE
%token IIF LITERAL TRUEVALUE FALSEVALUE
%token AND OR NOT EQ NE1 NE2 INC DEC ALIASOP HASHOP SELF
@@ -264,12 +264,12 @@ Main : Expression '\n' {
| Expression error {
HB_TRACE(HB_TR_DEBUG, ("macro -> invalid expression: %s", HB_MACRO_DATA->string));
hb_macroError( EG_SYNTAX, HB_COMP_PARAM );
YYABORT;
HB_MACRO_ABORT;
}
| error {
HB_TRACE(HB_TR_DEBUG, ("macro -> invalid syntax: %s", HB_MACRO_DATA->string));
hb_macroError( EG_SYNTAX, HB_COMP_PARAM );
YYABORT;
HB_MACRO_ABORT;
}
;
@@ -708,11 +708,6 @@ IfInline : IIF '(' Expression ',' Argument ',' Argument ')'
%%
#ifdef __WATCOMC__
/* enable warnings for unreachable code */
#pragma warning 13 1
#endif
/*
** ------------------------------------------------------------------------ **

View File

@@ -253,7 +253,7 @@
/* Standard checking for valid expression creation
*/
#define HB_MACRO_CHECK( pExpr ) \
#define HB_MACRO_CHECK( pExpr ) \
if( ! ( HB_MACRO_DATA->status & HB_MACRO_CONT ) ) \
{ \
YYABORT; \
@@ -269,6 +269,13 @@
YYABORT; \
}
#if defined( __BORLANDC__ ) || defined( __WATCOMC__ )
/* The if() inside this macro is always TRUE but it's used to hide BCC warning */
#define HB_MACRO_ABORT if( !( HB_MACRO_DATA->status & HB_MACRO_CONT ) ) { YYABORT; }
#else
#define HB_MACRO_ABORT { YYABORT; }
#endif
/* Enabling traces. */
@@ -291,7 +298,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 121 "macro.y"
#line 128 "macro.y"
{
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */
@@ -320,7 +327,7 @@ typedef union YYSTYPE
} valDouble;
}
/* Line 193 of yacc.c. */
#line 324 "macroy.c"
#line 331 "macroy.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -330,7 +337,7 @@ typedef union YYSTYPE
/* Copy the second part of user declarations. */
#line 149 "macro.y"
#line 156 "macro.y"
/* This must be placed after the above union - the union is
* typedef-ined to YYSTYPE
@@ -341,16 +348,10 @@ extern void yyerror( HB_MACRO_PTR, char * ); /* parsing error management func
static void hb_macroIdentNew( HB_COMP_DECL, char * );
#line 161 "macro.y"
#ifdef __WATCOMC__
/* disable warnings for unreachable code */
#pragma warning 13 9
#endif
/* Line 216 of yacc.c. */
#line 354 "macroy.c"
#line 355 "macroy.c"
#ifdef short
# undef short
@@ -1739,6 +1740,7 @@ yydestruct (yymsg, yytype, yyvaluep, pMacro)
if (!yymsg)
yymsg = "Deleting";
YYUSE (yymsg);
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype)
@@ -1927,6 +1929,7 @@ int yynerrs;
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
YYUSE (yyptr);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
@@ -2090,7 +2093,7 @@ yyreduce:
{
HB_TRACE(HB_TR_DEBUG, ("macro -> invalid expression: %s", HB_MACRO_DATA->string));
hb_macroError( EG_SYNTAX, HB_COMP_PARAM );
YYABORT;
HB_MACRO_ABORT;
;}
break;
@@ -2099,7 +2102,7 @@ yyreduce:
{
HB_TRACE(HB_TR_DEBUG, ("macro -> invalid syntax: %s", HB_MACRO_DATA->string));
hb_macroError( EG_SYNTAX, HB_COMP_PARAM );
YYABORT;
HB_MACRO_ABORT;
;}
break;
@@ -2887,8 +2890,8 @@ yyreduce:
break;
/* Line 1267 of yacc.c. */
#line 2892 "macroy.c"
/* Line 1268 of yacc.c. */
#line 2895 "macroy.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2923,6 +2926,7 @@ yyerrlab:
if (!yyerrstatus)
{
++yynerrs;
YYUSE (yynerrs);
#if ! YYERROR_VERBOSE
yyerror (pMacro, YY_("syntax error"));
#else
@@ -2994,8 +2998,10 @@ yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
#if ! defined( __BORLANDC__ ) && ! defined( __WATCOMC__ )
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
#endif
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
@@ -3105,11 +3111,6 @@ yyreturn:
#line 709 "macro.y"
#ifdef __WATCOMC__
/* enable warnings for unreachable code */
#pragma warning 13 1
#endif
/*
** ------------------------------------------------------------------------ **

View File

@@ -122,7 +122,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 121 "macro.y"
#line 128 "macro.y"
{
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */
@@ -150,7 +150,7 @@ typedef union YYSTYPE
UCHAR bDec; /* to hold the number of decimal points in the value */
} valDouble;
}
/* Line 1529 of yacc.c. */
/* Line 1533 of yacc.c. */
#line 155 "macroy.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

View File

@@ -4446,7 +4446,8 @@ static ERRCODE hb_rddTransRecords( AREAP pArea,
uiPrevArea = hb_rddGetCurrentWorkAreaNumber();
if( szDriver == NULL )
szDriver = SELF_RDDNODE( pArea )->szName;
/* szDriver = SELF_RDDNODE( pArea )->szName; */
szDriver = hb_rddDefaultDrv( NULL );
if( fExport )
{

View File

@@ -1522,7 +1522,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
}
else if( HB_IS_BLOCK( pObject ) )
{
if( pMessage == &hb_symEval || pMsg == hb_symEval.pDynSym )
if( pMsg == hb_symEval.pDynSym )
return &hb_symEval;
}
else if( HB_IS_BYREF( pObject ) )
@@ -1587,7 +1587,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
}
else if( HB_IS_SYMBOL( pObject ) )
{
if( pMsg == s___msgExec.pDynSym )
if( pMsg == s___msgExec.pDynSym || pMsg == hb_symEval.pDynSym )
{
if( ! pObject->item.asSymbol.value->value.pFunPtr &&
pObject->item.asSymbol.value->pDynSym )