diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b3f80f5654..dbfa44dfd6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,17 @@ +2000-10-10 16:30 UTC-0400 David G. Holm + * include/hberrors.h + * source/pp/pplib.c + % Changed the two char * parameters for hb_compGenError() + and hb_compGenWarning() to const char *. + * source/pp/ppcore.c + % Removed the artificial nested include file limit test and + replaced it with a test for errno == EMFILE after returning + from the OpenInclude() function, which starts by clearing + errno and does not try to search the path if the standard + open attempt results in errno being set to EMFILE. + % Added displaying the C RTL error message corresponding to + errno if OpenInclude() returns an error that isn't EMFILE. + 2000-10-10 16:12 GMT+3 Alexander Kresin *contrib/rdd_ads/ads1.c * fixed bug with creating compound indexes, reported by Antonio Linares diff --git a/harbour/include/hberrors.h b/harbour/include/hberrors.h index e53d2368a3..9fa20bc08e 100644 --- a/harbour/include/hberrors.h +++ b/harbour/include/hberrors.h @@ -146,8 +146,8 @@ extern "C" { #define HB_PP_WARN_DEFINE_REDEF 1 #define HB_PP_WARN_NO_DIRECTIVES 2 -extern void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szError1, char * szError2 ); /* generic parsing error management function */ -extern void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2); /* generic parsing warning management function */ +extern void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ); /* generic parsing error management function */ +extern void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2); /* generic parsing warning management function */ #if defined(HB_EXTERN_C) } diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 2b64a7ae58..8554b65e16 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -63,6 +63,7 @@ #include #include #include +#include #include "hbpp.h" #include "hbcomp.h" @@ -158,7 +159,7 @@ char * hb_pp_STD_CH = NULL; /* Table with parse errors */ char * hb_pp_szErrors[] = { - "Can\'t open #include file: \'%s\'", + "Can\'t open #include file: \'%s\'; %s", "#else does not match #ifdef", "#endif does not match #ifdef", "Bad filename in #include", @@ -437,9 +438,13 @@ int hb_pp_ParseDirective( char * sLine ) hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_NAME, NULL, NULL ); *(sLine+i) = '\0'; - /* if((handl_i = fopen(sLine, "r")) == NULL) */ if( !OpenInclude( sLine, hb_comp_pIncludePath, hb_comp_pFileName, ( cDelimChar == '>' ), szInclude ) ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, NULL ); + { + if( errno == 0 || errno == EMFILE ) + hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, sLine, NULL ); + else + hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, sys_errlist[ errno ] ); + } } else if( i >= 4 && i <= 6 && memcmp( sDirective, "DEFINE", i ) == 0 ) @@ -2942,9 +2947,7 @@ static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMain HB_TRACE(HB_TR_DEBUG, ("OpenInclude(%s, %p, %p, %p, %d)", szFileName, pSearch, pMainFileName, fptr, (int) bStandardOnly)); - if( hb_comp_files.iFiles > HB_PP_MAX_INCLUDES ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, szFileName, NULL ); - + errno = 0; if( bStandardOnly ) { fptr = 0; @@ -2963,7 +2966,7 @@ static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMain hb_xfree( pFileName ); } - if( !fptr && pSearch ) + if( !fptr && pSearch && errno != EMFILE ) { pFileName = hb_fsFNameSplit( szFileName ); pFileName->szName = szFileName; diff --git a/harbour/source/pp/pplib.c b/harbour/source/pp/pplib.c index ceb8074342..8996806ff7 100644 --- a/harbour/source/pp/pplib.c +++ b/harbour/source/pp/pplib.c @@ -121,7 +121,7 @@ HB_FUNC( __PREPROCESS ) hb_retc( "" ); } -void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szError1, char * szError2 ) +void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) { PHB_ITEM pError; char buffer[ 128 ]; @@ -141,7 +141,7 @@ void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szErro longjmp( s_env, iError == 0 ? -1 : iError ); } -void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2 ) +void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2 ) { HB_TRACE(HB_TR_DEBUG, ("GenWarning(%p, %c, %d, %s, %s)", szWarnings, cPrefix, iWarning, szWarning1, szWarning2));