2006-07-16 14:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/compiler/genc.c
  * harbour/source/compiler/gencc.c
    ! fixed .prg file name stored in generated .c files

  * harbour/source/compiler/harbour.c
    ! update function counter when startup function is removed
      It fixes compilation of empty .prg files in C++ mode

  * harbour/source/rtl/dbjoin.prg
    - removed unused variable
This commit is contained in:
Przemyslaw Czerpak
2006-07-16 12:42:27 +00:00
parent 912b301c85
commit a854da38b2
5 changed files with 32 additions and 10 deletions

View File

@@ -8,6 +8,18 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* harbour/bin/hb-func.sh
* use by default -gc0 output when compiled as temporary workaround
for GPF in -gc2
2006-07-16 14:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencc.c
! fixed .prg file name stored in generated .c files
* harbour/source/compiler/harbour.c
! update function counter when startup function is removed
It fixes compilation of empty .prg files in C++ mode
* harbour/source/rtl/dbjoin.prg

View File

@@ -32,6 +32,7 @@
#include "hbdate.h"
extern void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc );
extern void hb_compGenCString( FILE * yyc, BYTE * pText, USHORT usLen );
static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc );
static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc );
@@ -314,8 +315,10 @@ static void hb_writeEndInit( FILE* yyc, char * szModulname, char * szSourceFile
fprintf( yyc, "\nHB_INIT_SYMBOLS_END( hb_vm_SymbolInit_%s%s )\n\n",
hb_comp_szPrefix, szModulname );
*/
fprintf( yyc, "\nHB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_%s%s, \"%s\", 0x%lx, 0x%04x )\n\n",
hb_comp_szPrefix, szModulname, szSourceFile, 0L, HB_PCODE_VER );
fprintf( yyc, "\nHB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_%s%s, ",
hb_comp_szPrefix, szModulname );
hb_compGenCString( yyc, ( BYTE * ) szSourceFile, strlen( szSourceFile ) );
fprintf( yyc, ", 0x%lx, 0x%04x )\n\n", 0L, HB_PCODE_VER );
fprintf( yyc, "#if defined(HB_PRAGMA_STARTUP)\n"
" #pragma startup hb_vm_SymbolInit_%s%s\n"
@@ -1112,8 +1115,13 @@ static HB_GENC_FUNC( hb_p_popstatic )
PVAR pVar;
PFUNCTION pTmp = hb_comp_functions.pFirst;
USHORT wVar = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
printf("\r\npTmp=%p, iStaticsBase=%d, wVar=%d\r\n", pTmp, pTmp->iStaticsBase, wVar);fflush(stdout);
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
{
printf("pTmp=%p, iStaticsBase=%d\r\n", pTmp, pTmp->iStaticsBase);fflush(stdout);
pTmp = pTmp->pNext;
}
printf("pStatics=%p, var=%d\r\n", pTmp->pStatics, wVar - pTmp->iStaticsBase);fflush(stdout);
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
fprintf( cargo->yyc, "\t/* %s */", pVar->szName );

View File

@@ -32,6 +32,7 @@
#include "hbdate.h"
extern void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc );
extern void hb_compGenCString( FILE * yyc, BYTE * pText, USHORT usLen );
#define HB_GENC_FUNC( func ) HB_PCODE_FUNC( func, PHB_LABEL_INFO )
typedef HB_GENC_FUNC( HB_GENC_FUNC_ );
@@ -49,7 +50,7 @@ typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR;
fprintf( cargo->yyc, "\t#error: \"" s "\"\n" ); \
} while( 0 )
static void hb_gencc_string_put( FILE * yyc, BYTE * pText, USHORT usLen )
void hb_compGenCString( FILE * yyc, BYTE * pText, USHORT usLen )
{
USHORT usPos;
@@ -557,7 +558,7 @@ static HB_GENC_FUNC( hb_p_localname )
usLen = strlen( ( char * ) &pFunc->pCode[ lPCodePos + 3 ] );
fprintf( cargo->yyc, "\thb_xvmLocalName( %hu, ",
HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
hb_gencc_string_put( cargo->yyc, &pFunc->pCode[ lPCodePos + 3 ], usLen );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 3 ], usLen );
fprintf( cargo->yyc, " );\n" );
return usLen + 4;
}
@@ -695,7 +696,7 @@ static HB_GENC_FUNC( hb_p_modulename )
usLen = strlen( ( char * ) &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\thb_xvmModuleName( " );
hb_gencc_string_put( cargo->yyc, &pFunc->pCode[ lPCodePos + 1 ], usLen );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 1 ], usLen );
fprintf( cargo->yyc, " );\n" );
return usLen + 2;
}
@@ -976,7 +977,7 @@ static HB_GENC_FUNC( hb_p_pushdouble )
* This version keeps double calculation compatible with RT FL functions
*/
fprintf( cargo->yyc, "\thb_xvmPushDouble( * ( double * ) " );
hb_gencc_string_put( cargo->yyc, &pFunc->pCode[ lPCodePos + 1 ], sizeof( double ) );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 1 ], sizeof( double ) );
fprintf( cargo->yyc, ", %d, %d );\n",
pFunc->pCode[ lPCodePos + 1 + sizeof( double ) ],
pFunc->pCode[ lPCodePos + 1 + sizeof( double ) + sizeof( BYTE ) ] );
@@ -1149,7 +1150,7 @@ static HB_GENC_FUNC( hb_p_pushstr )
HB_GENC_LABEL();
fprintf( cargo->yyc, "\thb_xvmPushStringConst( " );
hb_gencc_string_put( cargo->yyc, &pFunc->pCode[ lPCodePos + 3 ], usLen );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 3 ], usLen );
fprintf( cargo->yyc, ", %hu );\n", usLen );
return 4 + usLen;
@@ -1162,7 +1163,7 @@ static HB_GENC_FUNC( hb_p_pushstrshort )
HB_GENC_LABEL();
fprintf( cargo->yyc, "\thb_xvmPushStringConst( " );
hb_gencc_string_put( cargo->yyc, &pFunc->pCode[ lPCodePos + 2 ], usLen );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 2 ], usLen );
fprintf( cargo->yyc, ", %hu );\n", usLen );
return 3 + usLen;
@@ -1299,7 +1300,7 @@ static HB_GENC_FUNC( hb_p_staticname )
fprintf( cargo->yyc, "\thb_xvmStaticName( %hu, %hu, ",
( USHORT ) pFunc->pCode[ lPCodePos + 1 ],
HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 2 ] ) );
hb_gencc_string_put( cargo->yyc, &pFunc->pCode[ lPCodePos + 4 ], usLen );
hb_compGenCString( cargo->yyc, &pFunc->pCode[ lPCodePos + 4 ], usLen );
fprintf( cargo->yyc, " );\n" );
return usLen + 5;
}

View File

@@ -4978,6 +4978,7 @@ int hb_compCompile( char * szPrg, int argc, char * argv[], BOOL bSingleFile )
{
*pFunPtr = hb_compFunctionKill( *pFunPtr );
hb_comp_functions.iCount--;
hb_comp_iFunctionCnt--;
}
else
{

View File

@@ -133,7 +133,7 @@ Return aList
static function __doJoinList(aList)
local i, aJoin
local aJoin
if len(aList) > 0
( aList[1][1] )->( dbAppend() )