2007-05-11 22:50 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/source/compiler/complex.c
  * harbour/source/compiler/genc.c
  * harbour/source/compiler/gencli.c
  * harbour/source/compiler/genobj32.c
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyc
  * harbour/source/compiler/harbour.yyh
  * harbour/source/compiler/hbmain.c
    * changed code used for variable scoping - now it's much more
      simple (only one function) and allows to use declarations in
      nested functions/codeblocks with visibility similar to Pascal
    ! fixed parsing FILED <fields,...> IN <alias>
      we were accepting code like:
         FIELD f1, f2 IN db1, f3 IN db2 IN db3
      and for all fields the last alias (db2 in this example) was used
    ! fixed calculating number of static variables with -b (debugger)
      compilation (number of file wide statics were doubled)
    ! fixed generation of static variable names for debugger when declared
      with array dimensions, f.e.:
         static sVar[3]

  * harbour/source/rtl/hbffind.c
    * minor cleanup *nix version

  * harbour/contrib/bmdbfcdx/bmdbfcdx1.c
    ! fixed casting for C++ compilation

  * harbour/source/rdd/dbfdbt/dbfdbt1.c
    * updated for some old API modifications (this library is not used now
      but if we keep it in CVS then I think it should be updated)
This commit is contained in:
Przemyslaw Czerpak
2007-05-11 20:51:04 +00:00
parent 064a737e31
commit 91ec7b23a5
16 changed files with 5533 additions and 5834 deletions

View File

@@ -8,6 +8,42 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-05-11 22:50 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/source/compiler/complex.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencli.c
* harbour/source/compiler/genobj32.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
* harbour/source/compiler/hbmain.c
* changed code used for variable scoping - now it's much more
simple (only one function) and allows to use declarations in
nested functions/codeblocks with visibility similar to Pascal
! fixed parsing FILED <fields,...> IN <alias>
we were accepting code like:
FIELD f1, f2 IN db1, f3 IN db2 IN db3
and for all fields the last alias (db2 in this example) was used
! fixed calculating number of static variables with -b (debugger)
compilation (number of file wide statics were doubled)
! fixed generation of static variable names for debugger when declared
with array dimensions, f.e.:
static sVar[3]
* harbour/source/rtl/hbffind.c
* minor cleanup *nix version
* harbour/contrib/bmdbfcdx/bmdbfcdx1.c
! fixed casting for C++ compilation
* harbour/source/rdd/dbfdbt/dbfdbt1.c
* updated for some old API modifications (this library is not used now
but if we keep it in CVS then I think it should be updated)
2007-05-11 18:09 UTC+0100 Antonio Linares (alinares@fivetechsoft.com)
* contrib/adordd/adordd.prg
* COMMIT changes

View File

@@ -10100,11 +10100,11 @@ HB_FUNC( SIXCDX_GETFUNCTABLE )
if ( uiCount )
* uiCount = RDDFUNCSCOUNT;
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, ( BYTE * ) "DBFFPT" );
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFFPT" );
if ( errCode != SUCCESS )
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, ( BYTE * ) "DBFDBT" );
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFDBT" );
if ( errCode != SUCCESS )
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, ( BYTE * ) "DBF" );
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBF" );
hb_retni( errCode );
if ( errCode == SUCCESS )
{
@@ -10164,11 +10164,11 @@ HB_FUNC( BMDBFCDX_GETFUNCTABLE )
if ( uiCount )
* uiCount = RDDFUNCSCOUNT;
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, ( BYTE * ) "DBFFPT" );
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFFPT" );
if ( errCode != SUCCESS )
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, ( BYTE * ) "DBFDBT" );
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFDBT" );
if ( errCode != SUCCESS )
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, ( BYTE * ) "DBF" );
errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBF" );
if ( errCode == SUCCESS )
{
/*

View File

@@ -103,17 +103,18 @@ extern void hb_compParserStop( HB_COMP_DECL );
/* return detailed information about a class of variable */
extern int hb_compVariableScope( HB_COMP_DECL, char * );
#define HB_VS_UNDECLARED 0
#define HB_VS_UNDECLARED 0
/* variables declared in a current codeblock/function/procedure */
#define HB_VS_CBLOCAL_VAR 1 /* local parameter of a codeblock */
#define HB_VS_LOCAL_VAR 2
#define HB_VS_LOCAL_MEMVAR 4
#define HB_VS_LOCAL_FIELD 8
#define HB_VS_STATIC_VAR 16
#define HB_VS_CBLOCAL_VAR 1 /* local parameter of a codeblock */
#define HB_VS_LOCAL_VAR 2
#define HB_VS_LOCAL_MEMVAR 4
#define HB_VS_LOCAL_FIELD 8
#define HB_VS_STATIC_VAR 16
#define HB_VS_FILEWIDE 32
/* variables declared outside of a current function/procedure */
#define HB_VS_GLOBAL_MEMVAR (32 | HB_VS_LOCAL_MEMVAR)
#define HB_VS_GLOBAL_FIELD (32 | HB_VS_LOCAL_FIELD)
#define HB_VS_GLOBAL_STATIC (32 | HB_VS_STATIC_VAR)
#define HB_VS_GLOBAL_MEMVAR (HB_VS_FILEWIDE | HB_VS_LOCAL_MEMVAR)
#define HB_VS_GLOBAL_FIELD (HB_VS_FILEWIDE | HB_VS_LOCAL_FIELD)
#define HB_VS_GLOBAL_STATIC (HB_VS_FILEWIDE | HB_VS_STATIC_VAR)
#define VU_NOT_USED 0
#define VU_INITIALIZED 1
@@ -135,33 +136,26 @@ extern int hb_compVariableScope( HB_COMP_DECL, char * );
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 */
extern PINLINE hb_compInlineFind( HB_COMP_DECL, char * szFunName );
extern USHORT hb_compFunctionGetPos( HB_COMP_DECL, char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */
extern PFUNCTION hb_compFunctionKill( HB_COMP_DECL, PFUNCTION ); /* releases all memory allocated by function and returns the next one */
extern void hb_compAnnounce( HB_COMP_DECL, char * );
extern PINLINE hb_compInlineAdd( HB_COMP_DECL, char * szFunName, int iLine );
extern PINLINE hb_compInlineFind( HB_COMP_DECL, char * szFunName );
extern PFUNCALL hb_compFunCallFind( HB_COMP_DECL, char * szFunName ); /* locates a previously defined called function */
extern BOOL hb_compFunCallCheck( HB_COMP_DECL, char *, int );
extern void hb_compVariableAdd( HB_COMP_DECL, char * szVarName, BYTE cType ); /* add a new param, local, static variable to a function definition or a public or private */
extern PVAR hb_compVariableFind( PVAR pVars, USHORT wOrder ); /* returns a variable if defined or zero */
extern PVAR hb_compLocalVariableFind( PFUNCTION pFunc, USHORT wVar );
extern USHORT hb_compVariableGetPos( PVAR pVars, char * szVarName ); /* returns the order + 1 of a variable if defined or zero */
extern int hb_compLocalGetPos( HB_COMP_DECL, char * szVarName ); /* returns the order + 1 of a local variable */
extern char * hb_compStaticGetName( HB_COMP_DECL, USHORT wVar ); /* returns the name of static variable */
extern PVAR hb_compVariableFind( HB_COMP_DECL, char * szVarName, int * piPos, int * piScope );
extern char * hb_compLocalVariableName( PFUNCTION pFunc, USHORT wVar ); /* returns the name of local variable */
extern char * hb_compStaticVariableName( HB_COMP_DECL, USHORT wVar ); /* returns the name of static variable */
#define HB_SYM_MEMVAR FALSE
#define HB_SYM_ALIAS FALSE
#define HB_SYM_MSGNAME FALSE
#define HB_SYM_FUNCNAME TRUE
extern PCOMSYMBOL hb_compSymbolAdd( HB_COMP_DECL, char *, USHORT *, BOOL );
extern PCOMSYMBOL hb_compSymbolKill( PCOMSYMBOL ); /* releases all memory allocated by symbol and returns the next one */
extern PCOMSYMBOL hb_compSymbolFind( HB_COMP_DECL, char *, USHORT *, BOOL ); /* returns a symbol pointer from the symbol table */
extern PCOMSYMBOL hb_compSymbolGetPos( HB_COMP_DECL, USHORT ); /* returns a symbol based on its index on the symbol table */
extern char * hb_compSymbolName( HB_COMP_DECL, USHORT ); /* returns a symbol name based on its index on the symbol table */
extern PCOMDECLARED hb_compDeclaredAdd( HB_COMP_DECL, char * );
extern PCOMDECLARED hb_compDeclaredFind( HB_COMP_DECL, char * );
extern PCOMCLASS hb_compClassAdd( HB_COMP_DECL, char * );
extern PCOMCLASS hb_compClassFind( HB_COMP_DECL, char * );
@@ -234,8 +228,7 @@ extern int hb_compFieldsCount( HB_COMP_DECL );
/* Static variables */
extern void hb_compStaticDefStart( HB_COMP_DECL );
extern void hb_compStaticDefEnd( HB_COMP_DECL );
extern void hb_compGenStaticName( char *, HB_COMP_DECL );
extern void hb_compStaticDefEnd( HB_COMP_DECL, char * );
extern BOOL hb_compCheckUnclosedStru( HB_COMP_DECL );
@@ -317,7 +310,6 @@ extern void hb_compPrintModes( void );
/* Misc functions defined in harbour.c */
extern void hb_compFinalizeFunction( HB_COMP_DECL ); /* fixes all last defined function returns jumps offsets */
extern void hb_compNOOPfill( PFUNCTION pFunc, ULONG ulFrom, int iCount, BOOL fPop, BOOL fCheck );
extern BOOL hb_compIsJump( HB_COMP_DECL, PFUNCTION pFunc, ULONG ulPos );

View File

@@ -137,6 +137,7 @@ typedef struct __FUNC
PVAR pStatics; /* pointer to static variables list */
PVAR pFields; /* pointer to fields variables list */
PVAR pMemvars; /* pointer to memvar variables list */
PVAR pDetached; /* pointer to detached local variables list */
PVAR pPrivates; /* pointer to private variables list */
BYTE * pCode; /* pointer to a memory block where pcode is stored */
ULONG lPCodeSize; /* total memory size for pcode */

View File

@@ -361,7 +361,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM
#if !defined( HB_MACRO_SUPPORT )
if( pArg->ExprType == HB_ET_VARIABLE )
{
if( hb_compVariableScope( HB_COMP_PARAM, pArg->value.asSymbol ) > 0 )
if( hb_compVariableFind( HB_COMP_PARAM, pArg->value.asSymbol, NULL, NULL ) )
pArg = hb_compExprSetGetBlock( pArg, HB_COMP_PARAM );
else
{
@@ -566,7 +566,6 @@ HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightEx
return pExpr;
}
#endif
/* ************************************************************************* */

View File

@@ -3803,6 +3803,7 @@ static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, BOOL bLateEval, HB_COMP
{
HB_CBVAR_PTR pVar;
HB_COMP_PARAM->iVarScope = VS_PARAMETER;
pVar = pSelf->value.asCodeblock.pLocals;
while( pVar )
{
@@ -4171,8 +4172,9 @@ static void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL )
#if defined( HB_MACRO_SUPPORT )
{
#else
int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
int iVar, iScope;
hb_compVariableFind( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol, &iVar, &iScope );
if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD &&
iScope != HB_VS_UNDECLARED )
{
@@ -4186,15 +4188,14 @@ static void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL )
if( bOpEq != HB_P_MINUS || iIncrement >= -INT16_MAX )
{
int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
BYTE buffer[ 5 ];
if( bOpEq == HB_P_MINUS )
iIncrement = -iIncrement;
buffer[ 0 ] = HB_P_LOCALADDINT;
buffer[ 1 ] = HB_LOBYTE( iLocal );
buffer[ 2 ] = HB_HIBYTE( iLocal );
buffer[ 1 ] = HB_LOBYTE( iVar );
buffer[ 2 ] = HB_HIBYTE( iVar );
buffer[ 3 ] = HB_LOBYTE( iIncrement );
buffer[ 4 ] = HB_HIBYTE( iIncrement );
HB_GEN_FUNC2( PCodeN, buffer, 5 );
@@ -4327,8 +4328,9 @@ static void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL )
#if defined( HB_MACRO_SUPPORT )
{
#else
int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
int iVar, iScope;
hb_compVariableFind( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol, &iVar, &iScope );
if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD &&
iScope != HB_VS_UNDECLARED )
{
@@ -4342,15 +4344,14 @@ static void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL )
if( bOpEq != HB_P_MINUS || iIncrement >= -INT16_MAX )
{
int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
BYTE buffer[ 5 ];
if( bOpEq == HB_P_MINUS )
iIncrement = -iIncrement;
buffer[ 0 ] = HB_P_LOCALADDINT;
buffer[ 1 ] = HB_LOBYTE( iLocal );
buffer[ 2 ] = HB_HIBYTE( iLocal );
buffer[ 1 ] = HB_LOBYTE( iVar );
buffer[ 2 ] = HB_HIBYTE( iVar );
buffer[ 3 ] = HB_LOBYTE( iIncrement );
buffer[ 4 ] = HB_HIBYTE( iIncrement );
HB_GEN_FUNC2( PCodeN, buffer, 5 );
@@ -4442,21 +4443,21 @@ static void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_COMP_DECL )
#if !defined( HB_MACRO_SUPPORT )
else if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE )
{
int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
int iVar, iScope;
hb_compVariableFind( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol, &iVar, &iScope );
if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD &&
iScope != HB_VS_UNDECLARED )
{
if( iScope == HB_VS_LOCAL_VAR )
{
int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
if( bOper == HB_P_INC )
{
HB_GEN_FUNC3( PCode3, HB_P_LOCALINCPUSH, HB_LOBYTE( iLocal ), HB_HIBYTE( iLocal ) );
HB_GEN_FUNC3( PCode3, HB_P_LOCALINCPUSH, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ) );
}
else
{
HB_GEN_FUNC3( PCode3, HB_P_LOCALDEC, HB_LOBYTE( iLocal ), HB_HIBYTE( iLocal ) );
HB_GEN_FUNC3( PCode3, HB_P_LOCALDEC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ) );
/* Push current value */
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
}
@@ -4560,19 +4561,18 @@ static void hb_compExprPushPostOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_COMP_DECL )
#if !defined( HB_MACRO_SUPPORT )
else if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE )
{
int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
int iVar, iScope;
hb_compVariableFind( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol, &iVar, &iScope );
if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD &&
iScope != HB_VS_UNDECLARED )
{
if( iScope == HB_VS_LOCAL_VAR )
{
int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
/* Push current value */
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE );
HB_GEN_FUNC3( PCode3, ( bOper == HB_P_INC ) ? HB_P_LOCALINC : HB_P_LOCALDEC,
HB_LOBYTE( iLocal ), HB_HIBYTE( iLocal ) );
HB_LOBYTE( iVar ), HB_HIBYTE( iVar ) );
}
else
{
@@ -4664,17 +4664,16 @@ static void hb_compExprUsePreOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_COMP_DECL )
#if !defined( HB_MACRO_SUPPORT )
else if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE )
{
int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
int iVar, iScope;
hb_compVariableFind( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol, &iVar, &iScope );
if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD &&
iScope != HB_VS_UNDECLARED )
{
if( iScope == HB_VS_LOCAL_VAR )
{
int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol );
HB_GEN_FUNC3( PCode3, ( bOper == HB_P_INC ) ? HB_P_LOCALINC : HB_P_LOCALDEC,
HB_LOBYTE( iLocal ), HB_HIBYTE( iLocal ) );
HB_LOBYTE( iVar ), HB_HIBYTE( iVar ) );
}
else
{

View File

@@ -573,12 +573,14 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL )
case BEGINSEQ:
if( pLex->iState == LOOKUP && pToken->pNext &&
HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD &&
pToken->pNext->len >= 4 && pToken->pNext->len <= 8 &&
hb_strnicmp( "SEQUENCE", pToken->pNext->value, pToken->pNext->len ) == 0 )
HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD )
{
hb_pp_tokenGet( pLex->pPP );
break;
if( pToken->pNext->len >= 4 && pToken->pNext->len <= 8 &&
hb_strnicmp( "SEQUENCE", pToken->pNext->value, pToken->pNext->len ) == 0 )
{
hb_pp_tokenGet( pLex->pPP );
break;
}
}
iType = IDENTIFIER;
break;

View File

@@ -420,8 +420,6 @@ 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
*/
@@ -437,12 +435,24 @@ static void hb_compGenCLocalName( PFUNCTION pFunc, int iLocal, ULONG lPCodePos,
}
else
{
pVar = hb_compLocalVariableFind( pFunc, ( USHORT ) iLocal );
if( pVar )
fprintf( cargo->yyc, "\t/* %s */", pVar->szName );
char *szName = hb_compLocalVariableName( pFunc, ( USHORT ) iLocal );
if( szName )
fprintf( cargo->yyc, "\t/* %s */", szName );
else
fprintf( cargo->yyc, "\t/* localvar%i */", iLocal );
}
}
static void hb_compGenCStaticName( USHORT uiStatic, HB_GENC_INFO_PTR cargo )
{
char *szName = hb_compStaticVariableName( cargo->HB_COMP_PARAM, uiStatic );
if( szName )
fprintf( cargo->yyc, "\t/* %s */", szName );
else
fprintf( cargo->yyc, "\t/* staticvar%hu */", uiStatic );
}
static HB_GENC_FUNC( hb_p_and )
{
HB_SYMBOL_UNUSED( pFunc );
@@ -1025,7 +1035,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1121,7 +1131,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 4;
}
@@ -1158,7 +1168,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1167,7 +1177,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfieldnear )
{
fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELDNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 2;
}
@@ -1177,7 +1187,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1187,7 +1197,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1224,7 +1234,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1235,10 +1245,7 @@ static HB_GENC_FUNC( hb_p_popstatic )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %s */", szName );
}
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), cargo );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1248,7 +1255,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1276,7 +1283,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1285,7 +1292,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfieldnear )
{
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELDNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 2;
}
@@ -1295,7 +1302,7 @@ 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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1450,7 +1457,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1557,7 +1564,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1567,7 +1574,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1596,10 +1603,7 @@ static HB_GENC_FUNC( hb_p_pushstatic )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %s */", szName );
}
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), cargo );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1610,10 +1614,7 @@ static HB_GENC_FUNC( hb_p_pushstaticref )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %s */", szName );
}
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), cargo );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1703,8 +1704,7 @@ static HB_GENC_FUNC( hb_p_pushsym )
fprintf( cargo->yyc, "\tHB_P_PUSHSYM, %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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1713,8 +1713,7 @@ static HB_GENC_FUNC( hb_p_pushsymnear )
{
fprintf( cargo->yyc, "\tHB_P_PUSHSYMNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 2;
}
@@ -1724,8 +1723,7 @@ static HB_GENC_FUNC( hb_p_pushfuncsym )
fprintf( cargo->yyc, "\tHB_P_PUSHFUNCSYM, %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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1735,8 +1733,7 @@ static HB_GENC_FUNC( hb_p_pushvariable )
fprintf( cargo->yyc, "\tHB_P_PUSHVARIABLE, %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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -2273,7 +2270,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_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}

View File

@@ -61,10 +61,7 @@ void hb_compGenILCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the IL
char szFileName[ _POSIX_PATH_MAX + 1 ], * szVer;
PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst;
PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst;
PFUNCALL pFuncall;
PINLINE pInline;
PCOMDECLARED pDeclared;
PCOMCLASS pClass;
FILE * yyc; /* file handle for IL output */
BOOL bIsPublicFunction ;
BOOL bIsInitFunction ;
@@ -177,49 +174,6 @@ void hb_compGenILCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the IL
fclose( yyc );
pFunc = HB_COMP_PARAM->functions.pFirst;
while( pFunc )
pFunc = hb_compFunctionKill( HB_COMP_PARAM, pFunc );
pFuncall = HB_COMP_PARAM->funcalls.pFirst;
while( pFuncall )
{
HB_COMP_PARAM->funcalls.pFirst = pFuncall->pNext;
pFuncall = HB_COMP_PARAM->funcalls.pFirst;
}
if ( HB_COMP_PARAM->iWarnings >= 3 )
{
pDeclared = HB_COMP_PARAM->pReleaseDeclared->pNext;
while( pDeclared )
{
HB_COMP_PARAM->pFirstDeclared = pDeclared->pNext;
hb_xfree( ( void * ) pDeclared );
pDeclared = HB_COMP_PARAM->pFirstDeclared;
}
pClass = HB_COMP_PARAM->pReleaseClass->pNext;
while( pClass )
{
HB_COMP_PARAM->pFirstClass = pClass->pNext;
pDeclared = pClass->pMethod;
while ( pDeclared )
{
HB_COMP_PARAM->pFirstDeclared = pDeclared->pNext;
hb_xfree( ( void * ) pDeclared );
pDeclared = HB_COMP_PARAM->pFirstDeclared;
}
hb_xfree( ( void * ) pClass );
pClass = HB_COMP_PARAM->pFirstClass;
}
}
pSym = HB_COMP_PARAM->symbols.pFirst;
while( pSym )
pSym = hb_compSymbolKill( pSym );
if( ! HB_COMP_PARAM->fQuiet )
printf( "Done.\n" );
}
@@ -1022,15 +976,13 @@ static HB_GENC_FUNC( hb_p_poplocal )
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( wVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -wVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", wVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, wVar )->szName );
fprintf( cargo->yyc, "\t/* localvar%i */", wVar );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1151,18 +1103,9 @@ static HB_GENC_FUNC( hb_p_pushblock )
/* create the table of referenced local variables */
while( wVar-- )
{
w = * ( ( USHORT * ) &( pFunc->pCode [ lPCodePos ] ) );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos ],
pFunc->pCode[ lPCodePos + 1 ] );
/* NOTE:
* When a codeblock is used to initialize a static variable
* the names of local variables cannot be determined
* 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_INIT | HB_FS_EXIT ) ) != ( HB_FS_INIT | HB_FS_EXIT ) )
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, w )->szName );
fprintf( cargo->yyc, "\n" );
lPCodePos +=2;
}
@@ -1247,15 +1190,13 @@ static HB_GENC_FUNC( hb_p_pushlocal )
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( wVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -wVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", wVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, wVar )->szName );
fprintf( cargo->yyc, "\t/* localvar%i */", wVar );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1285,15 +1226,13 @@ static HB_GENC_FUNC( hb_p_pushlocalref )
if( cargo->iNestedCodeblock )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( wVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -wVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", wVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, wVar )->szName );
fprintf( cargo->yyc, "\t/* localvar%i */", wVar );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1502,7 +1441,7 @@ static HB_GENC_FUNC( hb_p_pushsymnear )
pTemp = pFunCalls;
}
pTemp->szName = hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName;
pTemp->szName = hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] );
pTemp->bFirstParam = TRUE;
pTemp->pNext = NULL;

View File

@@ -101,6 +101,21 @@ void hb_compGenObj32( HB_COMP_DECL, PHB_FNAME pFileName )
printf( "Done.\n" );
}
static USHORT hb_compFunctionGetPos( HB_COMP_DECL, char * szFunctionName ) /* return 0 if not found or order + 1 */
{
PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst;
USHORT wFunction = HB_COMP_PARAM->fStartProc ? 1 : 0;
while( pFunc )
{
if( ! strcmp( pFunc->szName, szFunctionName ) && pFunc != HB_COMP_PARAM->functions.pFirst )
return wFunction;
wFunction++;
pFunc = pFunc->pNext;
}
return 0;
}
static ULONG GetSymbolsSize( HB_COMP_DECL )
{
return HB_COMP_PARAM->symbols.iCount * sizeof( HB_SYMB );

View File

@@ -164,7 +164,7 @@ extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management fun
%token AS_ARRAY AS_BLOCK AS_CHARACTER AS_CLASS AS_DATE AS_LOGICAL AS_NUMERIC AS_OBJECT AS_VARIANT DECLARE OPTIONAL DECLARE_CLASS DECLARE_MEMBER
%token AS_ARRAY_ARRAY AS_BLOCK_ARRAY AS_CHARACTER_ARRAY AS_CLASS_ARRAY AS_DATE_ARRAY AS_LOGICAL_ARRAY AS_NUMERIC_ARRAY AS_OBJECT_ARRAY
%token PROCREQ
%token CBSTART DOIDENT
%token CBSTART BEGINCODE DOIDENT
%token FOREACH DESCEND
%token DOSWITCH WITHOBJECT
%token NUM_DATE
@@ -197,7 +197,7 @@ extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management fun
%right '\n' ';' ','
/*the highest precedence*/
%type <string> IdentName IDENTIFIER MACROVAR MACROTEXT CompTimeStr
%type <string> IdentName IDENTIFIER MACROVAR MACROTEXT CompTimeStr InAlias
%type <string> DOIDENT WHILE
%type <valChar> LITERAL
%type <valDouble> NUM_DOUBLE
@@ -315,6 +315,10 @@ AsType : /* not specified */ { HB_COMP_PARAM->cVarType = ' '; }
| StrongType
;
AsArrayType: /* not specified */ { HB_COMP_PARAM->cVarType = ' '; }
| AsArray
;
StrongType : AS_NUMERIC { HB_COMP_PARAM->cVarType = 'N'; }
| AS_CHARACTER { HB_COMP_PARAM->cVarType = 'C'; }
| AS_DATE { HB_COMP_PARAM->cVarType = 'D'; }
@@ -1084,14 +1088,7 @@ ExtVarDef : VarDef
{ HB_COMP_EXPR_DELETE( hb_compExprGenPush( $4, HB_COMP_PARAM ) );
hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), TRUE );
}
| MacroVar DimList
{
USHORT uCount = (USHORT) hb_compExprListLen( $2 );
HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM );
hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), TRUE );
}
| MacroVar DimList AsArray
| MacroVar DimList AsArrayType
{
USHORT uCount = (USHORT) hb_compExprListLen( $2 );
HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) );
@@ -1105,15 +1102,13 @@ VarDef : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_P
if( HB_COMP_PARAM->iVarScope == VS_STATIC )
{
hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */
hb_compStaticDefEnd( HB_COMP_PARAM );
hb_compGenStaticName( $1, HB_COMP_PARAM );
hb_compStaticDefEnd( HB_COMP_PARAM, $1 );
}
else if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE )
{
hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( $1, NULL, HB_COMP_PARAM ), FALSE );
}
}
| IdentName AsType { $<iNumber>$ = HB_COMP_PARAM->iVarScope;
hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType );
}
@@ -1127,8 +1122,7 @@ VarDef : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_P
{
hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */
HB_COMP_EXPR_DELETE( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( $1, HB_COMP_PARAM ), $6, HB_COMP_PARAM ), HB_COMP_PARAM ) );
hb_compStaticDefEnd( HB_COMP_PARAM );
hb_compGenStaticName( $1, HB_COMP_PARAM );
hb_compStaticDefEnd( HB_COMP_PARAM, $1 );
}
else if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE )
{
@@ -1142,8 +1136,7 @@ VarDef : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_P
HB_COMP_PARAM->iVarScope = $<iNumber>3;
}
| IdentName DimList { hb_compVariableDim( $1, $2, HB_COMP_PARAM ); }
| IdentName DimList AsArray { hb_compVariableDim( $1, $2, HB_COMP_PARAM ); }
| IdentName DimList AsArrayType { hb_compVariableDim( $1, $2, HB_COMP_PARAM ); }
;
/* NOTE: DimList and DimIndex is the same as ArrayIndex and IndexList
@@ -1157,20 +1150,27 @@ DimIndex : '[' Expression { $$ = hb_compExprNewArgList( $2, HB_C
| DimIndex ']' '[' Expression { $$ = hb_compExprAddListExpr( $1, $4 ); }
;
FieldsDef : FIELD { HB_COMP_PARAM->iVarScope = VS_FIELD; } FieldList Crlf { HB_COMP_PARAM->cVarType = ' '; }
FieldsDef : FIELD { HB_COMP_PARAM->iVarScope = VS_FIELD; }
FieldList InAlias Crlf
{
if( $4 ) hb_compFieldSetAlias( HB_COMP_PARAM, $4, $3 );
HB_COMP_PARAM->cVarType = ' ';
}
;
FieldList : IdentName AsType { $$=hb_compFieldsCount( HB_COMP_PARAM ); hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); }
| FieldList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); }
| FieldList IN IdentName { hb_compFieldSetAlias( HB_COMP_PARAM, $3, $<iNumber>1 ); }
FieldList : IdentName AsType { $$=hb_compFieldsCount( HB_COMP_PARAM ); hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); }
| FieldList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); }
;
InAlias : /* no alias */ { $$ = NULL; }
| IN IdentName { $$ = $2; }
;
MemvarDef : MEMVAR { HB_COMP_PARAM->iVarScope = VS_MEMVAR; } MemvarList Crlf { HB_COMP_PARAM->cVarType = ' '; }
;
MemvarList : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); }
| MemvarList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); }
MemvarList : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); }
| MemvarList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); }
;
Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( HB_COMP_PARAM, $2 ); HB_COMP_PARAM->szDeclaredFun = $2; } DecList ')' AsType Crlf
@@ -2203,7 +2203,7 @@ static void hb_compVariableDim( char * szName, HB_EXPR_PTR pInitValue, HB_COMP_D
hb_compExprGenPop( pVar, HB_COMP_PARAM );
/* delete all used expressions */
HB_COMP_EXPR_DELETE( pAssign );
hb_compStaticDefEnd( HB_COMP_PARAM );
hb_compStaticDefEnd( HB_COMP_PARAM, szName );
}
else
{

File diff suppressed because it is too large Load Diff

View File

@@ -132,17 +132,18 @@
AS_OBJECT_ARRAY = 348,
PROCREQ = 349,
CBSTART = 350,
DOIDENT = 351,
FOREACH = 352,
DESCEND = 353,
DOSWITCH = 354,
WITHOBJECT = 355,
NUM_DATE = 356,
EPSILON = 357,
HASHOP = 358,
POST = 359,
UNARY = 360,
PRE = 361
BEGINCODE = 351,
DOIDENT = 352,
FOREACH = 353,
DESCEND = 354,
DOSWITCH = 355,
WITHOBJECT = 356,
NUM_DATE = 357,
EPSILON = 358,
HASHOP = 359,
POST = 360,
UNARY = 361,
PRE = 362
};
#endif
/* Tokens. */
@@ -239,17 +240,18 @@
#define AS_OBJECT_ARRAY 348
#define PROCREQ 349
#define CBSTART 350
#define DOIDENT 351
#define FOREACH 352
#define DESCEND 353
#define DOSWITCH 354
#define WITHOBJECT 355
#define NUM_DATE 356
#define EPSILON 357
#define HASHOP 358
#define POST 359
#define UNARY 360
#define PRE 361
#define BEGINCODE 351
#define DOIDENT 352
#define FOREACH 353
#define DESCEND 354
#define DOSWITCH 355
#define WITHOBJECT 356
#define NUM_DATE 357
#define EPSILON 358
#define HASHOP 359
#define POST 360
#define UNARY 361
#define PRE 362
@@ -299,7 +301,7 @@ typedef union YYSTYPE
} asMessage;
}
/* Line 1533 of yacc.c. */
#line 303 "harboury.h"
#line 305 "harboury.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

File diff suppressed because it is too large Load Diff

View File

@@ -358,7 +358,7 @@ static void hb_dbtWriteMemo( DBTAREAP pArea, ULONG ulBlock, PHB_ITEM pItem, ULON
if( pBuff )
{
memcpy( pBuff, pItem->item.asString.value, ulLen );
memcpy( pBuff, hb_itemGetCPtr( pItem ), ulLen );
pBuff[ ulLen ] = 0x1A;
hb_cdpnTranslate( ( char * ) pBuff, hb_cdp_page, pArea->cdPage, ulLen );
hb_fsWriteLarge( pArea->hMemoFile, pBuff, ulLen + 1 );
@@ -366,7 +366,7 @@ static void hb_dbtWriteMemo( DBTAREAP pArea, ULONG ulBlock, PHB_ITEM pItem, ULON
}
else
{
BYTE pBlock[ DBT_BLOCKSIZE ], *pSrc = ( BYTE * ) pItem->item.asString.value;
BYTE pBlock[ DBT_BLOCKSIZE ], *pSrc = ( BYTE * ) hb_itemGetCPtr( pItem );
ULONG ulWritten = 0, ulRest;
do
@@ -386,7 +386,7 @@ static void hb_dbtWriteMemo( DBTAREAP pArea, ULONG ulBlock, PHB_ITEM pItem, ULON
{
BYTE pBlock[ DBT_BLOCKSIZE ];
memset( pBlock, 0x1A, DBT_BLOCKSIZE );
hb_fsWriteLarge( pArea->hMemoFile, ( BYTE * ) pItem->item.asString.value, ulLen );
hb_fsWriteLarge( pArea->hMemoFile, ( BYTE * ) hb_itemGetCPtr( pItem ), ulLen );
hb_fsWrite( pArea->hMemoFile, pBlock, ( DBT_BLOCKSIZE - ( USHORT ) ( ulLen % DBT_BLOCKSIZE ) ) );
}
pArea->fMemoFlush = TRUE;
@@ -410,7 +410,7 @@ static BOOL hb_dbtPutMemo( DBTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
HB_TRACE(HB_TR_DEBUG, ("hb_dbtPutMemo(%p, %hu, %p)", pArea, uiIndex, pItem));
ulLen = pItem->item.asString.length;
ulLen = hb_itemGetCLen( pItem );
if( ulLen > 0 )
{
ulBlock = hb_dbfGetMemoBlock( ( DBFAREAP ) pArea, uiIndex );

View File

@@ -623,7 +623,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
{
PHB_FFIND_INFO info = ( PHB_FFIND_INFO ) ffind->info;
char dirname[ 2 * _POSIX_PATH_MAX + 1 ];
char dirname[ _POSIX_PATH_MAX + 1 ];
char string[ _POSIX_PATH_MAX + 1 ];
bFound = FALSE;
@@ -652,8 +652,9 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
else
{
hb_strncpy( info->pattern, string, sizeof( info->pattern ) - 1 );
hb_strncpy( dirname, ".X", sizeof( dirname ) - 1 );
dirname[ 0 ] = '.';
dirname[ 1 ] = OS_PATH_DELIMITER;
dirname[ 2 ] = '\0';
}
tzset();
@@ -667,7 +668,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
while( ( info->entry = readdir( info->dir ) ) != NULL )
{
hb_strncpy( string, info->entry->d_name, sizeof( string ) - 1 );
#if defined( __WATCOMC__ )
if( hb_strMatchWild( string, info->pattern ) )
#else
@@ -681,7 +682,6 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
}
/* Fill Harbour found file info */
if( bFound )
{
hb_strncpy( dirname, info->path, sizeof( dirname ) - 1 );
@@ -701,23 +701,25 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
struct stat sStat;
if( stat( dirname, &sStat ) != 0 )
#endif
printf("\n%s (%i)", dirname, errno );
{
strncpy( ffind->szName, info->entry->d_name, _POSIX_PATH_MAX );
ffind->size = sStat.st_size;
strncpy( ffind->szName, info->entry->d_name, _POSIX_PATH_MAX );
ffind->size = sStat.st_size;
raw_attr = sStat.st_mode;
raw_attr = sStat.st_mode;
ftime = sStat.st_mtime;
ft = localtime( &ftime );
ftime = sStat.st_mtime;
ft = localtime( &ftime );
nYear = ft->tm_year + 1900;
nMonth = ft->tm_mon + 1;
nDay = ft->tm_mday;
nYear = ft->tm_year + 1900;
nMonth = ft->tm_mon + 1;
nDay = ft->tm_mday;
nHour = ft->tm_hour;
nMin = ft->tm_min;
nSec = ft->tm_sec;
nHour = ft->tm_hour;
nMin = ft->tm_min;
nSec = ft->tm_sec;
}
else
bFound = FALSE;
}
}
@@ -752,14 +754,14 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
{
/* Do the conversions common for all platforms */
ffind->szName[ _POSIX_PATH_MAX + 1 ] = '\0';
ffind->szName[ _POSIX_PATH_MAX ] = '\0';
ffind->attr = hb_fsAttrFromRaw( raw_attr );
ffind->lDate = hb_dateEncode( nYear, nMonth, nDay );
hb_dateStrPut( ffind->szDate, nYear, nMonth, nDay );
ffind->szDate[ 8 ] = '\0';
snprintf( ffind->szTime, sizeof( ffind->szTime ), "%02d:%02d:%02d", nHour, nMin, nSec );
}