From 685b64605122aa1bb134ccce47d820acaaa8f822 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Wed, 2 Aug 2000 16:43:49 +0000 Subject: [PATCH] 2000-08-02 09:40 UTC+0800 Ron Pinkas * source/macro/macro.l * source/macro/macro.y + Added: #define yylex hb_complex * source/pp/ppcore.c + Added check for the file path when checking self reference of #include. + Added logic to ignore case when checing self reference of #include. --- harbour/ChangeLog | 9 +++++++++ harbour/source/macro/macro.l | 3 ++- harbour/source/macro/macro.y | 9 +++++---- harbour/source/pp/ppcore.c | 16 +++++++++++++--- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e0473172ba..f71ad811d6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +2000-08-02 09:40 UTC+0800 Ron Pinkas + * source/macro/macro.l + * source/macro/macro.y + + Added: #define yylex hb_complex + + * source/pp/ppcore.c + + Added check for the file path when checking self reference of #include. + + Added logic to ignore case when checing self reference of #include. + 2000-08-02 15:54 UTC+0300 Chen Kedem * doc/simplex.txt diff --git a/harbour/source/macro/macro.l b/harbour/source/macro/macro.l index e8bbb9612e..0f2d1c25c8 100644 --- a/harbour/source/macro/macro.l +++ b/harbour/source/macro/macro.l @@ -48,6 +48,7 @@ NOTE: -C controls the speed/size ratio of generated scanner */ #define HB_MACRO_SUPPORT +#define yylex hb_complex #include #include @@ -117,7 +118,7 @@ MacroTxt ({MacroVar}|{MacroEnd}|{MacroId})+ ' BEGIN STRING1; \" BEGIN STRING2; -\[ { +\[ { if( pMacro->FlexState == SEPARATOR ) BEGIN STRING3; else diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index 76c967961b..b54822e33a 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -44,6 +44,7 @@ /* this #define HAVE TO be placed before all #include directives */ #define HB_MACRO_SUPPORT +#define yylex hb_complex #include "hbmacro.h" #include "hbcomp.h" @@ -205,15 +206,15 @@ Main : Expression '\n' { hb_compExprDelete( hb_compExprGenPop( $1, HB_MACRO_PARAM ), HB_MACRO_PARAM ); hb_compGenPCode1( HB_P_ENDPROC, HB_MACRO_PARAM ); } - | Expression error { + | Expression error { HB_TRACE(HB_TR_DEBUG, ("macro -> invalid expression: %s", HB_MACRO_DATA->string)); - hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); + hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); hb_compExprDelete( $1, HB_MACRO_PARAM ); YYABORT; } - | error { + | error { HB_TRACE(HB_TR_DEBUG, ("macro -> invalid syntax: %s", HB_MACRO_DATA->string)); - hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); + hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); YYABORT; } ; diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index a1287ff303..ca420a84ad 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -2916,11 +2916,21 @@ static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMain { pFileName = hb_fsFNameSplit( szFileName ); - if( strcmp( pFileName->szName, pMainFileName->szName ) == 0 && strcmp( pFileName->szExtension, pMainFileName->szExtension ) ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_INCLUDE_SELF, szFileName, NULL ); - if( pFileName->szPath == NULL || *(pFileName->szPath) == '\0' ) pFileName->szPath = pMainFileName->szPath; + + /* + printf( "Name=%s Ext=%s Path=%s\n", pFileName->szName, pFileName->szExtension, pFileName->szPath ); + printf( "Name=%s Ext=%s Path=%s\n", pMainFileName->szName, pMainFileName->szExtension, pMainFileName->szPath ); + */ + + if( strcmp( hb_strupr( pFileName->szName ), hb_strupr( pMainFileName->szName ) ) == 0 && + ( ( pFileName->szExtension == NULL && pMainFileName->szExtension == NULL ) || + ( pFileName->szExtension && pMainFileName->szExtension && + strcmp( hb_strupr( pFileName->szExtension ), hb_strupr( pMainFileName->szExtension ) ) == 0 ) ) && + ( pFileName->szPath == NULL || strcmp( hb_strupr( pFileName->szPath ), hb_strupr( pMainFileName->szPath ) ) == 0 ) ) + hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_INCLUDE_SELF, szFileName, NULL ); + hb_fsFNameMerge( szInclude, pFileName ); fptr = fopen( szInclude, "r" ); hb_xfree( pFileName );