2006-02-11 12:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>

* source/compiler/harbour.c
   * source/compiler/harbour.y
   * source/pp/ppcore.c
      * added tracing code
      * fixed one more memory leak
This commit is contained in:
Ryszard Glab
2006-02-11 11:32:24 +00:00
parent d15c80e28f
commit 093fa3886f
4 changed files with 59 additions and 2 deletions

View File

@@ -8,6 +8,13 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* fixed <-x-> match marker
2006-02-11 12:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* source/compiler/harbour.c
* source/compiler/harbour.y
* source/pp/ppcore.c
* added tracing code
* fixed one more memory leak
2006-02-09 15:25 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* source/compiler/harbour.c
* fixed to release memory allocated with the proeprocessor

View File

@@ -50,6 +50,15 @@
#include <malloc.h>
*/
/*
* Avoid tracing in preprocessor/compiler.
*/
#if ! defined(HB_TRACE_UTILS)
#if defined(HB_TRACE_LEVEL)
#undef HB_TRACE_LEVEL
#endif
#endif
#include "hbcomp.h"
#include "hbhash.h"
@@ -190,6 +199,8 @@ int main( int argc, char * argv[] )
int i;
BOOL bAnyFiles;
HB_TRACE(HB_TR_DEBUG, ("main()"));
hb_comp_pOutPath = NULL;
#if defined( HOST_OS_UNIX_COMPATIBLE )
@@ -246,13 +257,22 @@ int main( int argc, char * argv[] )
for( i = 1; i < argc; i++ )
{
HB_TRACE(HB_TR_DEBUG, ("main LOOP(%i,%s)", i, argv[i]));
if( ! HB_ISOPTSEP( argv[ i ][ 0 ] ) )
{
if( ! bAnyFiles )
{
bAnyFiles = TRUE;
if( i > 1 )
/* do not call hb_pp_Init() because it was already called
* in hb_pp_SetRules
*/
}
else
{
/* Clear and reinitialize preprocessor state
*/
hb_pp_Init();
}
iStatus = hb_compCompile( argv[ i ], argc, argv );
@@ -4322,6 +4342,7 @@ static void hb_compInitVars( void )
static void hb_compGenOutput( int iLanguage )
{
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compGenOutput()"));
switch( iLanguage )
{
@@ -4353,6 +4374,8 @@ static void hb_compGenOutput( int iLanguage )
static void hb_compPpoFile( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compPpoFile()"));
hb_comp_pFilePpo->szPath = NULL;
hb_comp_pFilePpo->szExtension = NULL;
@@ -4377,6 +4400,8 @@ static void hb_compPpoFile( void )
static void hb_compOutputFile( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compOutputFile()"));
hb_comp_pFileName->szPath = NULL;
hb_comp_pFileName->szExtension = NULL;
@@ -4400,6 +4425,8 @@ int hb_compCompile( char * szPrg, int argc, char * argv[] )
int iStatus = EXIT_SUCCESS;
PHB_FNAME pFileName;
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compCompile(%s,%i)", szPrg, argc));
hb_comp_pFileName = hb_fsFNameSplit( szPrg );
if( hb_comp_pFileName->szName )
@@ -4630,6 +4657,8 @@ int hb_compCompile( char * szPrg, int argc, char * argv[] )
void hb_compAutoOpenAdd( char * szName )
{
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compAutoOpenAdd(%s)", szName));
if( hb_comp_bAutoOpen && ! hb_compAutoOpenFind( szName ) )
{
PAUTOOPEN pAutoOpen = ( PAUTOOPEN ) hb_xgrab( sizeof( AUTOOPEN ) ), pLast;
@@ -4654,6 +4683,8 @@ BOOL hb_compAutoOpenFind( char * szName )
{
PAUTOOPEN pLast = hb_comp_pAutoOpen;
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compAutoOpenFind(%s)", szName));
if( pLast == NULL )
return FALSE;

View File

@@ -1936,6 +1936,15 @@ int hb_compYACCMain( char * szName )
/* ------------------------------------------------------------------------ */
/*
* Avoid tracing in preprocessor/compiler.
*/
#if ! defined(HB_TRACE_UTILS)
#if defined(HB_TRACE_LEVEL)
#undef HB_TRACE_LEVEL
#endif
#endif
void yyerror( char * s )
{
if( yytext[ 0 ] == '\n' )
@@ -1949,6 +1958,8 @@ BOOL hb_compInclude( char * szFileName, HB_PATHNAMES * pSearch )
{
PFILE pFile;
HB_TRACE(HB_TR_DEBUG, ("hb_pp_compInclude(%s,%p)", szFileName, pSearch));
yyin = fopen( szFileName, "r" );
if( ! yyin )
{
@@ -1999,6 +2010,8 @@ BOOL hb_compInclude( char * szFileName, HB_PATHNAMES * pSearch )
int yywrap( void ) /* handles the EOF of the currently processed file */
{
HB_TRACE(HB_TR_DEBUG, ("yywrap()"));
if( hb_comp_files.iFiles == 1 )
{
hb_xfree( hb_comp_files.pLast->pBuffer );

View File

@@ -376,6 +376,12 @@ void hb_pp_Free( void )
hb_xfree( stcmd );
s_kolAddTras--;
}
if( hb_pp_aCondCompile )
{
hb_xfree( (void *)hb_pp_aCondCompile );
hb_pp_aCondCompile = NULL;
}
}
void hb_pp_Init( void )