2000-10-02 13:00 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/hbpcode.c
* Corrected 1 compiler warning.
* source/pp/ppcomp.c
* Cleaned-up and corrected bug when rules files had an #include directive.
+ Added CloseInclude() and moved relevant logic into it.
* source/pp/ppcore.c
- Removed unused s_iIncludes, and hb_pp_nEmptyStrings
* utils/hbpp/hbpp.c
+ Added local hb_pp_nEmptyStrings to hb_pp_Parse()
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
2000-10-02 13:00 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* source/compiler/hbpcode.c
|
||||
* Corrected 1 compiler warning.
|
||||
|
||||
* source/pp/ppcomp.c
|
||||
* Cleaned-up and corrected bug when rules files had an #include directive.
|
||||
+ Added CloseInclude() and moved relevant logic into it.
|
||||
|
||||
* source/pp/ppcore.c
|
||||
- Removed unused s_iIncludes, and hb_pp_nEmptyStrings
|
||||
|
||||
* utils/hbpp/hbpp.c
|
||||
+ Added local hb_pp_nEmptyStrings to hb_pp_Parse()
|
||||
|
||||
2000-10-02 12:45 UTC-0400 David G. Holm <dholm@jsd-llc.com>
|
||||
* source/pp/ppcore.c
|
||||
! The include file limit check now uses hb_comp_files.iFiles
|
||||
|
||||
@@ -233,7 +233,7 @@ void hb_compStrongType( int iSize )
|
||||
PCOMDECLARED pDeclared;
|
||||
ULONG ulPos = pFunc->lPCodePos - iSize;
|
||||
SHORT wVar = 0;
|
||||
BYTE szType1[64], szType2[64], cType = 0, cSubType1 = 0, cSubType2 = 0;
|
||||
BYTE szType1[64], szType2[64], cType, cSubType1 = 0, cSubType2 = 0;
|
||||
BYTE bLast1, bLast2;
|
||||
|
||||
/* Make sure we have enough stack space. */
|
||||
@@ -1459,7 +1459,7 @@ void hb_compStrongType( int iSize )
|
||||
|
||||
if( pVar )
|
||||
{
|
||||
BYTE cType = pVar->cType;
|
||||
cType = pVar->cType;
|
||||
|
||||
/*printf( "\nPushed: %s Type: %c SubType: %c\n", pVar->szName, pVar->cType, pVar->cType - 100 );*/
|
||||
|
||||
@@ -1485,7 +1485,7 @@ void hb_compStrongType( int iSize )
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE cType = pSym->cType;
|
||||
cType = pSym->cType;
|
||||
|
||||
/*printf( "\nPushed Symbol: %s Type: %c SubType: %c\n", pSym->szName, pSym->cType, pSym->cType - 100 );*/
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ static int hb_pp_LastOutLine = 1;
|
||||
BOOL bDebug = FALSE;
|
||||
*/
|
||||
|
||||
extern void CloseInclude( void );
|
||||
|
||||
int hb_pp_Internal( FILE * handl_o, char * sOut )
|
||||
{
|
||||
PFILE pFile;
|
||||
@@ -67,8 +69,6 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pp_Internal(%p, %s)", handl_o, sOut));
|
||||
|
||||
hb_pp_nEmptyStrings = 0;
|
||||
|
||||
while( TRUE )
|
||||
{
|
||||
pFile = hb_comp_files.pLast;
|
||||
@@ -157,16 +157,7 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
|
||||
return 0; /* we have reached the main EOF */
|
||||
else
|
||||
{
|
||||
/* we close the currently include file and continue */
|
||||
fclose( hb_comp_files.pLast->handle );
|
||||
hb_xfree( hb_comp_files.pLast->pBuffer );
|
||||
hb_xfree( hb_comp_files.pLast->szFileName );
|
||||
pFile = ( PFILE ) ( ( PFILE ) hb_comp_files.pLast )->pPrev;
|
||||
hb_xfree( hb_comp_files.pLast );
|
||||
hb_comp_files.pLast = pFile;
|
||||
|
||||
hb_comp_iLine = hb_comp_files.pLast->iLine;
|
||||
hb_comp_files.iFiles--;
|
||||
CloseInclude();
|
||||
lLine = 1;
|
||||
}
|
||||
|
||||
@@ -183,7 +174,9 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
|
||||
{
|
||||
if( hb_comp_files.iFiles == 1 )
|
||||
hb_pp_LastOutLine = hb_comp_iLine;
|
||||
|
||||
sprintf( ptrOut, "#line %d \"%s\"", ( hb_comp_files.pLast->iLine ) , hb_comp_files.pLast->szFileName );
|
||||
|
||||
while( *ptrOut ) ptrOut++;
|
||||
|
||||
/* Ron Pinkas added 2000-06-14 */
|
||||
@@ -230,7 +223,6 @@ int hb_pp_ReadRules( void )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pp_ReadRules()"));
|
||||
|
||||
hb_pp_nEmptyStrings = 0;
|
||||
while( TRUE )
|
||||
{
|
||||
pFile = hb_comp_files.pLast;
|
||||
@@ -238,81 +230,64 @@ int hb_pp_ReadRules( void )
|
||||
while( ( rdlen = hb_pp_RdStr( pFile->handle, s_szLine + lens, HB_PP_STR_SIZE -
|
||||
lens, lContinue, ( char * ) pFile->pBuffer, &( pFile->lenBuffer ),
|
||||
&( pFile->iBuffer ) ) ) >= 0 )
|
||||
{
|
||||
lens += rdlen;
|
||||
{
|
||||
lens += rdlen;
|
||||
hb_comp_iLine++;
|
||||
|
||||
if( s_szLine[ lens - 1 ] == ';' )
|
||||
{
|
||||
lContinue = 1;
|
||||
lens--;
|
||||
lens--;
|
||||
while( s_szLine[ lens ] == ' ' || s_szLine[ lens ] == '\t' ) lens--;
|
||||
s_szLine[ ++lens ] = ' ';
|
||||
s_szLine[ ++lens ] = '\0';
|
||||
if( s_szLine[ lens - 1 ] == ';' )
|
||||
{
|
||||
lContinue = 1;
|
||||
lens--;
|
||||
lens--;
|
||||
while( s_szLine[ lens ] == ' ' || s_szLine[ lens ] == '\t' ) lens--;
|
||||
s_szLine[ ++lens ] = ' ';
|
||||
s_szLine[ ++lens ] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
lContinue = 0;
|
||||
lens = 0;
|
||||
}
|
||||
|
||||
hb_pp_nEmptyStrings++;
|
||||
}
|
||||
else
|
||||
if( ! lContinue )
|
||||
{
|
||||
if( *s_szLine != '\0' )
|
||||
{
|
||||
lContinue = 0;
|
||||
lens = 0;
|
||||
ptr = s_szLine;
|
||||
HB_SKIPTABSPACES( ptr );
|
||||
|
||||
if( *ptr == '#' )
|
||||
{
|
||||
hb_pp_ParseDirective( ptr + 1 );
|
||||
}
|
||||
|
||||
*s_szLine = '\0';
|
||||
}
|
||||
|
||||
if( !lContinue )
|
||||
{
|
||||
if( *s_szLine != '\0' )
|
||||
{
|
||||
ptr = s_szLine;
|
||||
HB_SKIPTABSPACES( ptr );
|
||||
if( *ptr == '#' )
|
||||
{
|
||||
hb_pp_ParseDirective( ptr + 1 );
|
||||
if( pFile != hb_comp_files.pLast )
|
||||
{
|
||||
pFile = ( PFILE ) ( ( PFILE ) hb_comp_files.pLast )->pPrev;
|
||||
if( lLine == 0)
|
||||
*s_szLine = '\0';
|
||||
lLine = 0;
|
||||
pFile->iLine += ( 1 + hb_pp_nEmptyStrings );
|
||||
hb_pp_nEmptyStrings = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*s_szLine = '\0';
|
||||
hb_pp_nEmptyStrings++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*s_szLine = '\0';
|
||||
hb_pp_nEmptyStrings++;
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_pp_nEmptyStrings++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( rdlen < 0 )
|
||||
{
|
||||
{
|
||||
if( hb_comp_files.iFiles == 1 )
|
||||
return 0; /* we have reached the main EOF */
|
||||
else
|
||||
{ /* we close the currently include file and continue */
|
||||
fclose( hb_comp_files.pLast->handle );
|
||||
hb_xfree( hb_comp_files.pLast->pBuffer );
|
||||
hb_xfree( hb_comp_files.pLast->szFileName );
|
||||
pFile = ( PFILE ) ( ( PFILE ) hb_comp_files.pLast )->pPrev;
|
||||
hb_xfree( hb_comp_files.pLast );
|
||||
hb_comp_files.pLast = pFile;
|
||||
hb_comp_iLine = hb_comp_files.pLast->iLine;
|
||||
hb_comp_files.iFiles--;
|
||||
{
|
||||
CloseInclude();
|
||||
lLine = 1;
|
||||
hb_pp_nEmptyStrings = 0;
|
||||
}
|
||||
}
|
||||
if( *s_szLine ) break;
|
||||
}
|
||||
|
||||
*s_szLine = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if( lLine )
|
||||
{
|
||||
if( hb_comp_files.iFiles == 1 )
|
||||
hb_pp_LastOutLine = hb_comp_iLine;
|
||||
}
|
||||
|
||||
return lens;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ static int NextWord( char **, char *, BOOL );
|
||||
static int NextName( char **, char * );
|
||||
static int NextParm( char **, char * );
|
||||
static BOOL OpenInclude( char *, PATHNAMES *, PHB_FNAME, BOOL bStandardOnly, char * );
|
||||
void CloseInclude( void );
|
||||
|
||||
#define ISNAME( c ) ( isalnum( ( int ) c ) || ( c ) == '_' || ( c ) > 0x7E )
|
||||
#define MAX_NAME 255
|
||||
@@ -149,7 +150,6 @@ static int s_numBrackets;
|
||||
static char s_groupchar;
|
||||
static char s_prevchar;
|
||||
|
||||
int hb_pp_nEmptyStrings;
|
||||
int * hb_pp_aCondCompile = NULL;
|
||||
int hb_pp_nCondCompile = 0;
|
||||
|
||||
@@ -2938,7 +2938,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 )
|
||||
if( hb_comp_files.iFiles > HB_PP_MAX_INCLUDES )
|
||||
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, szFileName, NULL );
|
||||
|
||||
if( bStandardOnly )
|
||||
@@ -2996,3 +2996,17 @@ static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMain
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CloseInclude( void )
|
||||
{
|
||||
PFILE pFile;
|
||||
|
||||
/* we close the currently include file and continue */
|
||||
fclose( hb_comp_files.pLast->handle );
|
||||
hb_xfree( hb_comp_files.pLast->pBuffer );
|
||||
hb_xfree( hb_comp_files.pLast->szFileName );
|
||||
pFile = ( PFILE ) ( ( PFILE ) hb_comp_files.pLast )->pPrev;
|
||||
hb_xfree( hb_comp_files.pLast );
|
||||
hb_comp_files.pLast = pFile;
|
||||
hb_comp_iLine = hb_comp_files.pLast->iLine;
|
||||
hb_comp_files.iFiles--;
|
||||
}
|
||||
|
||||
@@ -234,11 +234,10 @@ int hb_pp_Parse( FILE * handl_o )
|
||||
char * ptr;
|
||||
int lContinue;
|
||||
int lens, rdlen;
|
||||
int lLine = 0, i;
|
||||
int lLine = 0, i, hb_pp_nEmptyStrings = 0;;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pp_Parse(%p)", handl_o));
|
||||
|
||||
hb_pp_nEmptyStrings = 0;
|
||||
while( TRUE )
|
||||
{
|
||||
pFile = hb_comp_files.pLast;
|
||||
|
||||
Reference in New Issue
Block a user