Updating preprocessor files

This commit is contained in:
Alexander S.Kresin
1999-06-16 08:28:08 +00:00
parent 449e685a1f
commit bf5ef6d500
4 changed files with 28 additions and 21 deletions

View File

@@ -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 <Ron@Profit-Master.com>
* compiler.h
added member iUsed to struct VAR

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;