diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ce7cc7bcc6..71e4797dd6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-27 14:58 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/pp/ppcore.c + ! fixed GPF in expressions like: + #command CMD => #translate abc => \ + problem located by Ron in xHarbour + + * harbour/source/pp/hbpp.c + * extended string escaping to also quote " and ? (possible trigraph) + + * harbour/source/compiler/gencc.c + ; comment formatting + 2008-06-27 14:27 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/Makefile * After this change, HB_CONTRIBLIBS will _override_ the @@ -1682,7 +1694,7 @@ * Adjusted maximize operation - now window is centered on the screen. ; TODO - Find a better solution to enabling and disabling of resizing feature at run time. - + 2008-06-11 04:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbexprop.h * harbour/include/hbexprb.c diff --git a/harbour/source/compiler/gencc.c b/harbour/source/compiler/gencc.c index 679e12352c..768fa48b93 100644 --- a/harbour/source/compiler/gencc.c +++ b/harbour/source/compiler/gencc.c @@ -56,7 +56,7 @@ void hb_compGenCString( FILE * yyc, BYTE * pText, ULONG ulLen ) BYTE uchr = ( BYTE ) pText[ ulPos ]; /* * NOTE: After optimization some CHR(n) can be converted - * into a string containing nonprintable characters. + * into a string containing nonprintable characters. * * TODO: add switch to use hexadecimal format "%#04x" * diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index cae3aa6dd9..4ebc582c71 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -299,28 +299,33 @@ static int hb_pp_preprocesfile( PHB_PP_STATE pState, char * szRuleFile ) /* NOTE: Caller should free the pointer. */ static char * hb_pp_escapeString( char * szString ) { - int iPos; - int iCountBackslash = 0; - int iLen = strlen( szString ); - int iResult; - char * szResult; + char * szResult, ch; + int iLen; - for( iPos = 0; iPos < iLen; iPos++ ) + szResult = szString; + iLen = 0; + do { - if( szString[ iPos ] == '\\' ) - ++iCountBackslash; + ch = *szResult++; + /* NOTE: ? is escaped to avoid conflicts with trigraph sequences which + * are part of ANSI C standard + */ + if( ch == '"' || ch == '\\' || ch == '?' ) + ++iLen; + ++iLen; } + while( ch ); - szResult = ( char * ) hb_xgrab( iLen + iCountBackslash + 1 ); - - for( iPos = 0, iResult = 0; iPos < iLen; iPos++ ) + szResult = ( char * ) hb_xgrab( iLen ); + iLen = 0; + do { - szResult[ iResult++ ] = szString[ iPos ]; - if( szString[ iPos ] == '\\' ) - szResult[ iResult++ ] = '\\'; + ch = *szString++; + if( ch == '"' || ch == '\\' || ch == '?' ) + szResult[ iLen++ ] = '\\'; + szResult[ iLen++ ] = ch; } - - szResult[ iResult ] = '\0'; + while( ch ); return szResult; } diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 5e32509cd1..e9af129095 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -2646,7 +2646,8 @@ static BOOL hb_pp_tokenUnQuotedGet( PHB_PP_TOKEN ** pTokenPtr, BOOL * pfQuoted, if( HB_PP_TOKEN_TYPE( pToken->type ) == HB_PP_TOKEN_BACKSLASH ) { * pfQuoted = TRUE; - pToken->pNext->spaces = pToken->spaces; + if( pToken->pNext ) + pToken->pNext->spaces = pToken->spaces; ** pTokenPtr = pToken->pNext; hb_pp_tokenFree( pToken ); pToken = ** pTokenPtr;