diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6d1f83089e..d759a6677b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +19990616-11:19 Alexander Kresin + updated: + * source\hbpp\hbppmain.c + * source\hbpp\hbppint.c + * source\hbpp\hbpp.c + Fixed problems with preprocessor, mentioned by David G. Holm + 19990615-23:20 PST Ron Pinkas * compiler.h added member iUsed to struct VAR diff --git a/harbour/source/hbpp/hbpp.c b/harbour/source/hbpp/hbpp.c index d9605adfc2..ee4e780a5a 100644 --- a/harbour/source/hbpp/hbpp.c +++ b/harbour/source/hbpp/hbpp.c @@ -69,7 +69,7 @@ int OpenInclude( char *, PATHNAMES *, FILE** ); #define SKIPTABSPACES(sptr) while ( *sptr == ' ' || *sptr == '\t' ) (sptr)++ #define MAX_NAME 255 #define BUFF_SIZE 2048 -#define STR_SIZE 1024 +#define STR_SIZE 2048 #define FALSE 0 #define TRUE 1 @@ -114,7 +114,7 @@ int koltranslates = 0, maxtranslates = 50; int ParseDirective( char* sLine ) { char sDirective[MAX_NAME]; - int i = 0; + int i; FILE* handl_i; i = NextWord( &sLine, sDirective, TRUE ); @@ -1191,7 +1191,7 @@ int WrStr(FILE* handl_o,char *buffer) { int lens = strolen(buffer); fwrite(buffer,lens,1,handl_o); - fwrite("\n",1,1,handl_o); + if ( *(buffer+lens-1) != '\n' ) fwrite("\n",1,1,handl_o); return 0; } @@ -1366,8 +1366,11 @@ int strotrim ( char *stroka ) if ( *stroka == '\'' ) State = STATE_QUOTE1; else if ( *stroka == '\"' ) State = STATE_QUOTE2; } - if ( State != STATE_NORMAL || (*stroka != ' ' && *stroka != '\t') || +/* if ( State != STATE_NORMAL || (*stroka != ' ' && *stroka != '\t') || ( (isname(lastc) || lastc=='>') && (isname(*(stroka+1)) || *(stroka+1)=='<') ) ) +*/ + if ( State != STATE_NORMAL || (*stroka != ' ' && *stroka != '\t') || + ( *stroka==' ' && lastc != ' ' && lastc != ',' && lastc != '(' && *(stroka+1)!=',') ) { *ptr++ = *stroka; lastc = *stroka; diff --git a/harbour/source/hbpp/hbppint.c b/harbour/source/hbpp/hbppint.c index 02619b5daa..ae3e417141 100644 --- a/harbour/source/hbpp/hbppint.c +++ b/harbour/source/hbpp/hbppint.c @@ -33,7 +33,7 @@ extern int *aCondCompile, nCondCompile; extern int nline; #define BUFF_SIZE 2048 -#define STR_SIZE 1024 +#define STR_SIZE 2048 #define INITIAL_ACOM_SIZE 200 extern DEFINES *aDefnew ; @@ -56,7 +56,7 @@ void Hbpp_init ( void ) int PreProcess( FILE* handl_i, FILE* handl_o, char *sOut ) { static char sBuffer[BUFF_SIZE]; /* File read buffer */ - char sLine[STR_SIZE], sOutLine[STR_SIZE], *ptr; + char sLine[STR_SIZE], sOutLine[STR_SIZE], *ptr, *ptrOut = sOut; int lContinue = 0; int lens=0, rdlen; int rezParse; @@ -72,6 +72,8 @@ int PreProcess( FILE* handl_i, FILE* handl_o, char *sOut ) lens--; lens--; while ( sLine[lens] == ' ' || sLine[lens] == '\t' ) lens--; sLine[++lens] = '\0'; + + *ptrOut++ = '\n'; } else { lContinue = 0; lens=0; } @@ -106,19 +108,14 @@ int PreProcess( FILE* handl_i, FILE* handl_o, char *sOut ) } } if ( rdlen < 0 ) return 0; - if(!lInclude) - { - if ( lPpo ) WrStr(handl_o,sLine); - lens = strolen ( sLine ); - *(sLine + lens++) = '\n'; - *(sLine + lens) = '\0'; - memcpy( sOut, sLine, lens ); - } - else - { - *sOut = '\n'; - lens = 1; - } + + lens = strocpy( ptrOut, sLine ) + ( ptrOut - sOut ); + *( sOut + lens++ ) = '\n'; + *( sOut + lens ) = '\0'; + + if ( lPpo ) + WrStr(handl_o,sOut); + return lens; } diff --git a/harbour/source/hbpp/hbppmain.c b/harbour/source/hbpp/hbppmain.c index 0f4a4f7f14..0d23191911 100644 --- a/harbour/source/hbpp/hbppmain.c +++ b/harbour/source/hbpp/hbppmain.c @@ -27,7 +27,7 @@ extern int nline; extern DEFINES *aDefnew ; #define BUFF_SIZE 2048 -#define STR_SIZE 1024 +#define STR_SIZE 2048 #define INITIAL_ACOM_SIZE 200 extern COMMANDS *aCommnew ; @@ -168,7 +168,7 @@ int Hp_Parse( FILE* handl_i, FILE* handl_o ) if(!lInclude) { - if( lContinue ) WrStr(handl_o,"\0"); else WrStr(handl_o,sLine); + if( lContinue ) WrStr(handl_o,"\n"); else WrStr(handl_o,sLine); } } return 0;