diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e6537c38d9..21550f55f4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,15 @@ +2000-06-13 03:00 UTC-0800 Ron Pinkas + + * makefile.bc + + Added ppcomp.c and ppcore.c to list of harbour.exe dependencies. + + * source/pp/ppcore.c + * source/compiler/harbour.y + ! Corrected initialization of pFile->iLine to 1 + + * source/pp/ppcomp.c + ! Fixed redundnant empty lines generation and line numbering. + 2000-06-12 20:25 UTC-0400 David G. Holm * source/rtl/gtwin/gtwin.c diff --git a/harbour/makefile.bc b/harbour/makefile.bc index f32fe72264..f22862fe05 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -509,7 +509,9 @@ HARBOUR_EXE_OBJS = \ $(OBJ_DIR)\expropta.obj \ $(OBJ_DIR)\exproptb.obj \ $(OBJ_DIR)\exproptc.obj \ - $(OBJ_DIR)\hbfunchk.obj + $(OBJ_DIR)\hbfunchk.obj \ + $(OBJ_DIR)\ppcore.obj \ + $(OBJ_DIR)\ppcomp.obj # # HBRUN.EXE rules diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index f8271830e0..2809a65b48 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -1653,6 +1653,7 @@ BOOL hb_compInclude( char * szFileName, PATHNAMES * pSearch ) pFile->pBuffer = hb_xgrab( HB_PP_BUFF_SIZE ); pFile->iBuffer = pFile->lenBuffer = 10; pFile->szFileName = szFileName; + pFile->iLine = 1; pFile->pPrev = NULL; /* diff --git a/harbour/source/pp/ppcomp.c b/harbour/source/pp/ppcomp.c index 199a1dceef..4a16f02f7f 100644 --- a/harbour/source/pp/ppcomp.c +++ b/harbour/source/pp/ppcomp.c @@ -96,35 +96,54 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) if( *s_szLine != '\0' ) { ptr = s_szLine; + HB_SKIPTABSPACES( ptr ); + if( *ptr == '#' ) { hb_pp_ParseDirective( ptr + 1 ); + if( pFile != hb_comp_files.pLast ) { pFile = ( PFILE ) ( ( PFILE ) hb_comp_files.pLast )->pPrev; + if( lLine ) - sprintf( s_szLine, "#line %d \"%s\"\n", - pFile->iLine+hb_pp_nEmptyStrings, pFile->szFileName ); + sprintf( s_szLine, "#line %d \"%s\"\n", pFile->iLine + hb_pp_nEmptyStrings, pFile->szFileName ); else *s_szLine = '\0'; + lLine = 0; - pFile->iLine += 1+hb_pp_nEmptyStrings; - sprintf( s_szLine+strlen(s_szLine), "#line 1 \"%s\"", - hb_comp_files.pLast->szFileName ); + + pFile->iLine += ( 1 + hb_pp_nEmptyStrings ); + sprintf( s_szLine+strlen(s_szLine), "#line 1 \"%s\"\n", hb_comp_files.pLast->szFileName ); hb_pp_nEmptyStrings = 0; } else { *s_szLine = '\0'; - hb_pp_nEmptyStrings++; + /*hb_pp_nEmptyStrings++;*/ + hb_comp_files.pLast->iLine++; } } else { - if( hb_pp_nCondCompile == 0 || hb_pp_aCondCompile[ hb_pp_nCondCompile - 1 ] ) + if( *ptr == '\0' ) + { + if( hb_comp_files.iFiles == 1 ) + { + hb_pp_nEmptyStrings++; + *s_szLine = '\0'; + } + else + { + hb_comp_files.pLast->iLine++; + continue; + } + } + else if( hb_pp_nCondCompile == 0 || hb_pp_aCondCompile[ hb_pp_nCondCompile - 1 ] ) { hb_pp_ParseExpression( ptr, s_szOutLine ); + hb_comp_files.pLast->iLine++; } else { @@ -138,6 +157,7 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) break; } } + if( rdlen < 0 ) { if( hb_comp_files.iFiles == 1 ) @@ -158,18 +178,21 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) } if( *s_szLine ) break; } + if( lLine ) { - sprintf( ptrOut, "#line %d \"%s\"\n",hb_comp_iLine+hb_pp_nEmptyStrings,hb_comp_files.pLast->szFileName ); + sprintf( ptrOut, "#line %d \"%s\"", hb_comp_files.pLast->iLine /*hb_comp_iLine + hb_pp_nEmptyStrings*/, hb_comp_files.pLast->szFileName ); while( *ptrOut ) ptrOut++; } else { - if( hb_pp_nEmptyStrings ) + if( hb_pp_nEmptyStrings && hb_comp_files.iFiles == 1 ) for( i=0;iiLine += 1+hb_pp_nEmptyStrings; + pFile->iLine += ( 1 + hb_pp_nEmptyStrings ); hb_pp_nEmptyStrings = 0; } else diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 0240501193..9196ee78a4 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -2662,8 +2662,12 @@ static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMain pFile->iBuffer = pFile->lenBuffer = 10; pFile->szFileName = (char*) hb_xgrab( strlen( szFileName ) + 1 ); hb_pp_strocpy( pFile->szFileName, szFileName ); + + /* hb_comp_files.pLast->iLine = hb_comp_iLine; - hb_comp_iLine = 1; + */ + + pFile->iLine = 1; pFile->pPrev = hb_comp_files.pLast; hb_comp_files.pLast = pFile; hb_comp_files.iFiles++;