Updating preprocessor files

This commit is contained in:
Alexander S.Kresin
2000-03-17 07:02:11 +00:00
parent d2595567e4
commit 4aad1f1710
7 changed files with 67 additions and 15 deletions

View File

@@ -1,3 +1,15 @@
20000317-09:56 GMT+3 Alexander Kresin
* source/pp/stdalone/hbpp.c
* source/pp/ppcomp.c
* source/pp/ppcore.c
* source/pp/pplib.c
* source/compiler/hbgenerr.c
* fixed line number output for errors and warnings
* hb_pp_init() changed for supporting multiply files compiling
* warning in addDefine about duplicate define uncommented
* contrib/rdd_ads/adsfunc.c
* typo fixed ( HB_ADCUSTOMIZEAOF -> HB_ADSCUSTOMIZEAOF )
20000317-01:09 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/rtl/console.c
- Removed the non-GT branch from __ACCEPT().

View File

@@ -258,7 +258,7 @@ HARBOUR HB_ADSCLEARAOF( void )
hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSCLEARAOF" );
}
HARBOUR HB_ADCUSTOMIZEAOF( void )
HARBOUR HB_ADSCUSTOMIZEAOF( void )
{
ADSAREAP pArea;
UNSIGNED32 pulRecords[1];

View File

@@ -35,6 +35,8 @@
#include "hbcomp.h"
extern int nEmptyStrings;
/* Table with parse errors */
char * hb_comp_szErrors[] =
{
@@ -113,7 +115,7 @@ char * hb_comp_szWarnings[] =
void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )
{
if( hb_comp_files.pLast != NULL && hb_comp_files.pLast->szFileName != NULL )
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_iLine );
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_iLine + nEmptyStrings );
printf( "Error %c%04i ", cPrefix, iError );
printf( szErrors[ iError - 1 ], szError1, szError2 );
@@ -133,7 +135,7 @@ void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, char *
if( ( szText[ 0 ] - '0' ) <= hb_comp_iWarnings )
{
if( hb_comp_files.pLast != NULL && hb_comp_files.pLast->szFileName != NULL )
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_iLine );
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_iLine + nEmptyStrings );
printf( "Warning %c%04i ", cPrefix, iWarning );
printf( szText + 1, szWarning1, szWarning2 );
printf( "\n" );

View File

@@ -49,8 +49,7 @@
#include "hbpp.h"
#include "hbcomp.h"
extern FILES hb_comp_files;
extern int hb_comp_iLine; /* currently parsed file line number */
extern int nEmptyStrings;
static char s_szLine[ HB_PP_STR_SIZE ];
static char s_szOutLine[ HB_PP_STR_SIZE ];
@@ -61,10 +60,11 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
char * ptr, * ptrOut;
int lContinue;
int lens, rdlen;
int nEmptyStrings = 0, lLine = 0, i;
int lLine = 0, i;
HB_TRACE(HB_TR_DEBUG, ("PreProcess(%p, %p, %s)", handl_o, sOut));
nEmptyStrings = 0;
while( TRUE )
{
pFile = hb_comp_files.pLast;

View File

@@ -143,7 +143,9 @@ static BOOL s_bTracePragma = FALSE;
#define IT_COMMA 3
#define IT_ID_OR_EXPR 4
static int s_kolAddDefs;
static int s_kolAddDefs = 0;
static int s_kolAddComs = 0;
static int s_kolAddTras = 0;
static int s_ParseState;
static int s_maxCondCompile;
static int s_aIsRepeate[ 5 ];
@@ -153,8 +155,8 @@ static int s_numBrackets;
static char s_groupchar;
static char s_prevchar;
extern int hb_comp_iLine; /* currently parsed file line number */
int * hb_pp_aCondCompile;
int nEmptyStrings;
int * hb_pp_aCondCompile = NULL;
int hb_pp_nCondCompile = 0;
/* Table with parse errors */
@@ -184,17 +186,50 @@ char * hb_pp_szWarnings[] =
void hb_pp_Init( void )
{
DEFINES * stdef;
COMMANDS * stcmd;
HB_TRACE(HB_TR_DEBUG, ("hb_pp_Init()"));
/* TOFIX: The tables in PPTABLE.C should also be reinitialized */
while( s_kolAddDefs )
{
stdef = hb_pp_topDefine;
if( stdef->pars ) hb_xfree( stdef->pars );
if( stdef->value ) hb_xfree( stdef->value );
hb_xfree( stdef->name );
hb_pp_topDefine = stdef->last;
hb_xfree( stdef );
s_kolAddDefs--;
}
while( s_kolAddComs )
{
stcmd = hb_pp_topCommand;
if( stcmd->mpatt ) hb_xfree( stcmd->mpatt );
if( stcmd->value ) hb_xfree( stcmd->value );
hb_xfree( stcmd->name );
hb_pp_topCommand = stcmd->last;
hb_xfree( stcmd );
s_kolAddComs--;
}
while( s_kolAddTras )
{
stcmd = hb_pp_topTranslate;
if( stcmd->mpatt ) hb_xfree( stcmd->mpatt );
if( stcmd->value ) hb_xfree( stcmd->value );
hb_xfree( stcmd->name );
hb_pp_topTranslate = stcmd->last;
hb_xfree( stcmd );
s_kolAddTras--;
}
s_kolAddDefs = 0;
s_ParseState = 0;
s_maxCondCompile = 5;
s_bReplacePat = TRUE;
s_prevchar = 'A';
hb_pp_aCondCompile = ( int * ) hb_xgrab( sizeof( int ) * 5 );
if( !hb_pp_aCondCompile )
hb_pp_aCondCompile = ( int * ) hb_xgrab( sizeof( int ) * 5 );
hb_pp_nCondCompile = 0;
{
@@ -378,9 +413,7 @@ DEFINES * hb_pp_AddDefine( char * defname, char * value )
if( stdef != NULL )
{
/*
hb_compGenWarning( hb_pp_szWarnings, 'I', HB_PP_WARN_DEFINE_REDEF, defname, NULL );
*/
if( isNew )
{
@@ -400,6 +433,7 @@ DEFINES * hb_pp_AddDefine( char * defname, char * value )
}
stdef->value = ( value == NULL ) ? NULL : hb_strdup( value );
stdef->pars = NULL;
return stdef;
}
@@ -683,6 +717,7 @@ static COMMANDS * AddCommand( char * cmdname )
stcmd->last = hb_pp_topCommand;
hb_pp_topCommand = stcmd;
stcmd->name = hb_strdup( cmdname );
s_kolAddComs++;
return stcmd;
}

View File

@@ -54,6 +54,7 @@ PATHNAMES * hb_comp_pIncludePath = NULL;
PHB_FNAME hb_comp_pFileName = NULL;
FILES hb_comp_files;
int hb_comp_iLine; /* currently parsed file line number */
extern int nEmptyStrings;
/* These are need for the PP #pragma support */
BOOL hb_comp_bPPO = FALSE; /* flag indicating, is ppo output needed */

View File

@@ -64,6 +64,7 @@ PATHNAMES * hb_comp_pIncludePath = NULL;
PHB_FNAME hb_comp_pFileName = NULL;
FILES hb_comp_files;
int hb_comp_iLine = 1; /* currently parsed file line number */
extern int nEmptyStrings;
/* These are need for the PP #pragma support */
BOOL hb_comp_bPPO = FALSE; /* flag indicating, is ppo output needed */
@@ -234,10 +235,11 @@ int hb_pp_Parse( FILE * handl_o )
char * ptr;
int lContinue;
int lens, rdlen;
int nEmptyStrings = 0, lLine = 0, i;
int lLine = 0, i;
HB_TRACE(HB_TR_DEBUG, ("PreProcess(%p, %p, %s)", handl_o, sOut));
nEmptyStrings = 0;
while( TRUE )
{
pFile = hb_comp_files.pLast;