2000-07-12 20:45 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/harbour.slx
* Corrected support for PARAMETERS
+ Added type casts to allow c++ mode compilation
* source/compiler/simplex.c
- Removed unused vars.
+ Added type casts to allow c++ mode compilation
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2000-07-12 20:45 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* source/compiler/harbour.slx
|
||||
* Corrected support for PARAMETERS
|
||||
+ Added type casts to allow c++ mode compilation
|
||||
|
||||
* source/compiler/simplex.c
|
||||
- Removed unused vars.
|
||||
+ Added type casts to allow c++ mode compilation
|
||||
|
||||
20000712-22:03 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
|
||||
|
||||
* source/rtl/teditor.prg
|
||||
|
||||
@@ -36,15 +36,21 @@
|
||||
#define DEBUG_INFO(x) x
|
||||
#endif
|
||||
|
||||
#define LEX_ABBREVIATE_KEYS 4
|
||||
#define LEX_ABBREVIATE_WORDS 4
|
||||
#undef LEX_ABBREVIATE_KEYS
|
||||
#define LEX_ABBREVIATE_KEYS 4
|
||||
|
||||
#undef LEX_ABBREVIATE_WORDS
|
||||
#define LEX_ABBREVIATE_WORDS 4
|
||||
|
||||
#undef YY_INPUT /* to implement our own YY_INPUT function to manage PRGs without \n at the end */
|
||||
extern FILE * yyin; /* currently yacc parsed file */
|
||||
int yy_lex_input( char *, int );
|
||||
#define YY_INPUT( buf, result, max_size ) result = yy_lex_input( buf, max_size );
|
||||
#define YY_INPUT( buf, result, max_size ) result = yy_lex_input( buf, max_size );
|
||||
|
||||
static int iTexts = 0, iStrings = 0, iString;
|
||||
#undef YY_BUF_SIZE HB_PP_STR_SIZE
|
||||
#define YY_BUF_SIZE HB_PP_STR_SIZE
|
||||
|
||||
static int iTexts = 0;
|
||||
static char * aTexts[64];
|
||||
|
||||
/* ----------------------------------------------------- Language Definitions. ---------------------------------------------------- */
|
||||
@@ -373,6 +379,15 @@ LANGUAGE_RULES_ARE {
|
||||
IF_SEQUENCE_IS( END , _SEQUENCE_ , 0 , 0 ) REDUCE_TO( END , 0 ),
|
||||
IF_SEQUENCE_IS( END , 0 , 0 , 0 ) PASS_THROUGH(),
|
||||
|
||||
IF_SEQUENCE_IS( DECLARE , IDENTIFIER , '[' , 0 ) REDUCE_TO( PRIVATE , _ID_ARRAY ),
|
||||
IF_SEQUENCE_IS( _ID_ARRAY , 0 , 0 , 0 ) REDUCE_TO( IDENTIFIER , '[' ),
|
||||
IF_SEQUENCE_IS( DECLARE , MACROVAR , '[' , 0 ) REDUCE_TO( PRIVATE , _MACRO_ARRAY),
|
||||
IF_SEQUENCE_IS( _MACRO_ARRAY , 0 , 0 , 0 ) REDUCE_TO( MACROVAR , '[' ),
|
||||
IF_SEQUENCE_IS( DECLARE , MACROTEXT , '[' , 0 ) REDUCE_TO( PRIVATE , _TEXT_ARRAY ),
|
||||
IF_SEQUENCE_IS( _TEXT_ARRAY , 0 , 0 , 0 ) REDUCE_TO( MACROTEXT , '[' ),
|
||||
IF_SEQUENCE_IS( DECLARE , IDENTIFIER , 0 , 0 ) PASS_THROUGH(),
|
||||
IF_SEQUENCE_IS( DECLARE , 0 , 0 , 0 ) REDUCE_TO( HB_DECLARE_ID , 0 ),
|
||||
|
||||
IF_SEQUENCE_IS( PUBLIC , INASSIGN , 0 , 0 ) REDUCE_TO( HB_PUBLIC_ID , INASSIGN ),
|
||||
IF_SEQUENCE_IS( PUBLIC , INC , 0 , 0 ) REDUCE_TO( HB_PUBLIC_ID , INC ),
|
||||
IF_SEQUENCE_IS( PUBLIC , DEC , 0 , 0 ) REDUCE_TO( HB_PUBLIC_ID , DEC ),
|
||||
@@ -409,15 +424,6 @@ LANGUAGE_RULES_ARE {
|
||||
IF_SEQUENCE_IS( PRIVATE , ';' , 0 , 0 ) REDUCE_TO( HB_PRIVATE_ID , ';' ),
|
||||
IF_SEQUENCE_IS( PRIVATE , 0 , 0 , 0 ) PASS_THROUGH(),
|
||||
|
||||
IF_SEQUENCE_IS( DECLARE , IDENTIFIER , '[' , 0 ) REDUCE_TO( PRIVATE , _ID_ARRAY ),
|
||||
IF_SEQUENCE_IS( _ID_ARRAY , 0 , 0 , 0 ) REDUCE_TO( IDENTIFIER , '[' ),
|
||||
IF_SEQUENCE_IS( DECLARE , MACROVAR , '[' , 0 ) REDUCE_TO( PRIVATE , _MACRO_ARRAY),
|
||||
IF_SEQUENCE_IS( _MACRO_ARRAY , 0 , 0 , 0 ) REDUCE_TO( MACROVAR , '[' ),
|
||||
IF_SEQUENCE_IS( DECLARE , MACROTEXT , '[' , 0 ) REDUCE_TO( PRIVATE , _TEXT_ARRAY ),
|
||||
IF_SEQUENCE_IS( _TEXT_ARRAY , 0 , 0 , 0 ) REDUCE_TO( MACROTEXT , '[' ),
|
||||
IF_SEQUENCE_IS( DECLARE , IDENTIFIER , 0 , 0 ) PASS_THROUGH(),
|
||||
IF_SEQUENCE_IS( DECLARE , 0 , 0 , 0 ) REDUCE_TO( HB_DECLARE_ID , 0 ),
|
||||
|
||||
IF_SEQUENCE_IS( LOCAL , INASSIGN , 0 , 0 ) REDUCE_TO( HB_LOCAL_ID , INASSIGN ),
|
||||
IF_SEQUENCE_IS( LOCAL , INC , 0 , 0 ) REDUCE_TO( HB_LOCAL_ID , INC ),
|
||||
IF_SEQUENCE_IS( LOCAL , DEC , 0 , 0 ) REDUCE_TO( HB_LOCAL_ID , DEC ),
|
||||
@@ -491,6 +497,24 @@ LANGUAGE_RULES_ARE {
|
||||
IF_SEQUENCE_IS( FIELD , _WITH_ , 0 , 0 ) REDUCE_TO( FIELD , HB_WITH_ID ),
|
||||
IF_SEQUENCE_IS( FIELD , 0 , 0 , 0 ) PASS_THROUGH(),
|
||||
|
||||
IF_SEQUENCE_IS( PARAMETERS , INASSIGN , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , INASSIGN ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , INC , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , INC ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , DEC , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , DEC ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , ALIASOP , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , ALIASOP ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , PLUSEQ , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , PLUSEQ ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , MINUSEQ , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , MINUSEQ ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , MULTEQ , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , MULTEQ ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , DIVEQ , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , DIVEQ ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , EXPEQ , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , EXPEQ ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , MODEQ , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , MODEQ ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , '(' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , '(' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , '[' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , '[' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , '=' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , '=' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , ':' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , ':' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , '\n' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , '\n' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , ';' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , ';' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , 0 , 0 , 0 ) PASS_THROUGH(),
|
||||
|
||||
/* This _FIELD_ is FIELD NOT at BOL wants only ->. */
|
||||
IF_SEQUENCE_IS( _FIELD_ , ALIASOP , 0 , 0 ) REDUCE_TO( FIELD , ALIASOP ),
|
||||
IF_SEQUENCE_IS( _FIELD_ , '[' , 0 , 0 ) REDUCE_TO( HB_FIELD_ID , '[' ),
|
||||
@@ -501,10 +525,6 @@ LANGUAGE_RULES_ARE {
|
||||
IF_SEQUENCE_IS( _FIELD , '[' , 0 , 0 ) REDUCE_TO( HB__FIELD_ID , '[' ),
|
||||
IF_SEQUENCE_IS( _FIELD , 0 , 0 , 0 ) REDUCE_TO( HB__FIELD_ID , 0 ),
|
||||
|
||||
IF_SEQUENCE_IS( PARAMETERS , IDENTIFIER , 0 , 0 ) PASS_THROUGH(),
|
||||
IF_SEQUENCE_IS( PARAMETERS , '[' , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , '[' ),
|
||||
IF_SEQUENCE_IS( PARAMETERS , 0 , 0 , 0 ) REDUCE_TO( HB_PARAMETERS_ID , 0 ),
|
||||
|
||||
IF_SEQUENCE_IS( OTHERWISE , '\n' , 0 , 0 ) PASS_THROUGH(),
|
||||
IF_SEQUENCE_IS( OTHERWISE , ';' , 0 , 0 ) PASS_THROUGH(),
|
||||
IF_SEQUENCE_IS( OTHERWISE , '[' , 0 , 0 ) REDUCE_TO( HB_OTHERWISE_ID , '[' ),
|
||||
@@ -955,7 +975,7 @@ LANGUAGE_RULES_ARE {
|
||||
DEBUG_INFO( printf( "Passing Element \"%s\" to CONVERT_NUMBER()\n", sToken ) );\
|
||||
\
|
||||
/* "Returns" Token in iRet. (yylval.string already allocated). */\
|
||||
yylval.string = hb_xgrab( TOKEN_SIZE );\
|
||||
yylval.string = (char*) hb_xgrab( TOKEN_SIZE );\
|
||||
yylval.string[0] = 0;\
|
||||
aTexts[iTexts++] = yylval.string;\
|
||||
/* printf( "Text %i At: %i for Converted %s\n", iTexts, aTexts[iTexts - 1], sToken ); */\
|
||||
@@ -1019,7 +1039,7 @@ LANGUAGE_RULES_ARE {
|
||||
DEBUG_INFO( printf( "Custom Action for %i\n", x ) );\
|
||||
\
|
||||
/* Resetting (prepairing). */\
|
||||
yytext = hb_xgrab( iWordLen + 1 );\
|
||||
yytext = (char*) hb_xgrab( iWordLen + 1 );\
|
||||
yytext[0] = '\0';\
|
||||
\
|
||||
DEBUG_INFO( printf( "Prepared Text: %i Pointer: %i\n", iTexts, yytext ) );\
|
||||
|
||||
@@ -82,6 +82,10 @@ typedef struct _LEX_PAIR
|
||||
int iToken;
|
||||
} LEX_PAIR; /* support structure for KEYS and WORDS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
/* Above are NOT overidable !!! Need to precede the Language Definitions. */
|
||||
|
||||
/* --------------------------------------------------------------------------------- */
|
||||
@@ -113,16 +117,6 @@ typedef struct _LEX_PAIR
|
||||
|
||||
FILE *yyin; /* currently yacc parsed file */
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
YY_BUFFER_STATE yy_create_buffer( FILE *, int ); /* yacc functions to manage multiple files */
|
||||
void yy_switch_to_buffer( YY_BUFFER_STATE ); /* yacc functions to manage multiple files */
|
||||
void yy_delete_buffer( YY_BUFFER_STATE ); /* yacc functions to manage multiple files */
|
||||
#else
|
||||
void * yy_create_buffer( FILE *, int ); /* yacc functions to manage multiple files */
|
||||
void yy_switch_to_buffer( void * ); /* yacc functions to manage multiple files */
|
||||
void yy_delete_buffer( void * ); /* yacc functions to manage multiple files */
|
||||
#endif
|
||||
|
||||
extern void yyerror( char * ); /* parsing error management function */
|
||||
|
||||
@@ -421,7 +415,7 @@ int Reduce( int iToken, BOOL bReal );
|
||||
iRet = aiHold[iHold]; \
|
||||
if( asHold[iHold] ) \
|
||||
{ \
|
||||
strcpy( sToken, asHold[iHold] );\
|
||||
strcpy( (char*) sToken, asHold[iHold] );\
|
||||
} \
|
||||
\
|
||||
DEBUG_INFO( printf( "Released %i Now Holding %i Tokens: %i %i %i %i\n", iRet, iHold, aiHold[0], aiHold[1], aiHold[2], aiHold[3] ) ); \
|
||||
@@ -806,7 +800,7 @@ int Reduce( int iToken, BOOL bReal );
|
||||
}\
|
||||
}
|
||||
|
||||
int yylex( void /*YYSTYPE * yylval*/ )
|
||||
int yylex( void )
|
||||
{
|
||||
register char * szBuffer = s_szBuffer;
|
||||
|
||||
@@ -1135,7 +1129,7 @@ int yylex( void /*YYSTYPE * yylval*/ )
|
||||
CheckToken:
|
||||
{
|
||||
#ifdef LEX_ABBREVIATE_KEYS
|
||||
iWordLen = strlen( sToken );
|
||||
iWordLen = strlen( (char*) sToken );
|
||||
|
||||
if( iWordLen < LEX_ABBREVIATE_KEYS )
|
||||
{
|
||||
@@ -1149,17 +1143,17 @@ int yylex( void /*YYSTYPE * yylval*/ )
|
||||
//DEBUG_INFO( printf( "Comparing: \"%s\" and \"%s\"\n", sToken, aTokens[iKey] ) );
|
||||
|
||||
#ifdef LEX_ABBREVIATE_KEYS
|
||||
if( strncmp( sToken, aKeys[ iKey++ ].sWord, iWordLen ) == 0 )
|
||||
if( strncmp( (char*) sToken, (char*)( aKeys[ iKey++ ].sWord ), iWordLen ) == 0 )
|
||||
#else
|
||||
if( strcmp( sToken, aKeys[ iKey++ ].sWord ) == 0 )
|
||||
if( strcmp( (char*) sToken, (char*) ( aKeys[ iKey++ ].sWord ) ) == 0 )
|
||||
#endif
|
||||
{
|
||||
DEBUG_INFO( printf( "Reducing Key Word: %s\n", sToken ) );
|
||||
DEBUG_INFO( printf( "Reducing Key Word: %s\n", (char*) sToken ) );
|
||||
|
||||
bNewLine = FALSE;
|
||||
NEW_LINE_ACTION();
|
||||
|
||||
RETURN_TOKEN( REDUCE( aKeys[ iKey - 1 ].iToken ), sToken );
|
||||
RETURN_TOKEN( REDUCE( aKeys[ iKey - 1 ].iToken ), (char*) sToken );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1170,7 +1164,7 @@ int yylex( void /*YYSTYPE * yylval*/ )
|
||||
}
|
||||
|
||||
#ifdef LEX_ABBREVIATE_WORDS
|
||||
iWordLen = strlen( sToken );
|
||||
iWordLen = strlen( (char*) sToken );
|
||||
|
||||
if( iWordLen < LEX_ABBREVIATE_WORDS )
|
||||
{
|
||||
@@ -1182,18 +1176,18 @@ int yylex( void /*YYSTYPE * yylval*/ )
|
||||
while ( iWord < iWords )
|
||||
{
|
||||
#ifdef LEX_ABBREVIATE_WORDS
|
||||
if( strncmp( sToken, aWords[ iWord++ ].sWord, iWordLen ) == 0 )
|
||||
if( strncmp( (char*) sToken, (char*) ( aWords[ iWord++ ].sWord ), iWordLen ) == 0 )
|
||||
#else
|
||||
if( strcmp( sToken, aWords[ iWord++ ].sWord ) == 0 )
|
||||
if( strcmp( (char*) sToken, (char*) ( aWords[ iWord++ ].sWord ) ) == 0 )
|
||||
#endif
|
||||
{
|
||||
DEBUG_INFO( printf( "Reducing Word: %s\n", sToken ) );
|
||||
DEBUG_INFO( printf( "Reducing Word: %s\n", (char*) sToken ) );
|
||||
|
||||
RETURN_TOKEN( REDUCE( aWords[ iWord - 1 ].iToken ), sToken );
|
||||
RETURN_TOKEN( REDUCE( aWords[ iWord - 1 ].iToken ), (char*) sToken );
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_INFO( printf( "Reducing Element: \"%s\"\n", sToken ) );
|
||||
DEBUG_INFO( printf( "Reducing Element: \"%s\"\n", (char*) sToken ) );
|
||||
|
||||
/* "Returns" the Token as iRet. */
|
||||
ELEMENT_TOKEN( sToken )
|
||||
@@ -1293,22 +1287,39 @@ int Reduce( int iToken, BOOL bReal )
|
||||
}
|
||||
}
|
||||
|
||||
void * yy_create_buffer( FILE * pFile, int iBufSize )
|
||||
#ifdef __cplusplus
|
||||
YY_BUFFER_STATE yy_create_buffer( FILE * pFile, int iBufSize )
|
||||
#else
|
||||
void * yy_create_buffer( FILE * pFile, int iBufSize )
|
||||
#endif
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFile );
|
||||
HB_SYMBOL_UNUSED( iBufSize );
|
||||
iSize = 0;
|
||||
return szLexBuffer;
|
||||
|
||||
#ifdef __cplusplus
|
||||
return (YY_BUFFER_STATE) szLexBuffer;
|
||||
#else
|
||||
return (void*) szLexBuffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
void yy_switch_to_buffer( void * pBuffer )
|
||||
#ifdef __cplusplus
|
||||
void yy_switch_to_buffer( YY_BUFFER_STATE pBuffer )
|
||||
#else
|
||||
void yy_switch_to_buffer( void * pBuffer )
|
||||
#endif
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pBuffer );
|
||||
FORCE_REDUCE();
|
||||
iSize = 0;
|
||||
}
|
||||
|
||||
void yy_delete_buffer( void * pBuffer )
|
||||
#ifdef __cplusplus
|
||||
void yy_delete_buffer( YY_BUFFER_STATE pBuffer )
|
||||
#else
|
||||
void yy_delete_buffer( void * pBuffer )
|
||||
#endif
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pBuffer );
|
||||
FORCE_REDUCE();
|
||||
|
||||
Reference in New Issue
Block a user