2000-07-11 09:30 UTC+0800 Ron Pinkas <ron@profit-master.com>

* hb_slex.bc
     * Updated to match makefile.bc

   * source/compiler/harbour.l
   * source/compiler/harbour.c
     - Removed refrences to hb_compReleaseStrings()

   * source/compiler/harbour.slx
     * Changed identifier reuse logic to use hb_compIdentifierNew()
This commit is contained in:
Ron Pinkas
2000-07-11 16:48:10 +00:00
parent 1ceccebaf4
commit fc355a3bac
5 changed files with 38 additions and 77 deletions

View File

@@ -1,3 +1,14 @@
2000-07-11 09:30 UTC+0800 Ron Pinkas <ron@profit-master.com>
* hb_slex.bc
* Updated to match makefile.bc
* source/compiler/harbour.l
* source/compiler/harbour.c
- Removed refrences to hb_compReleaseStrings()
* source/compiler/harbour.slx
* Changed identifier reuse logic to use hb_compIdentifierNew()
2000-07-11 12:00 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
*include/hbhash.h
@@ -5,14 +16,14 @@
*include/Makefile
*source/common/Makefile
* new files with reusable hash table implementation
*include/hbcomp.h
* added #include hbhash.h
*source/compiler/Makefile
*source/compiler/hbident.c
* new file that implements a table of reusable identifiers
*source/compiler/harbour.c
*source/compiler/harbour.l
*source/compiler/harbour.y

View File

@@ -417,6 +417,7 @@ COMMON_LIB_OBJS = \
$(OBJ_DIR)\hbstr.obj \
$(OBJ_DIR)\hbtrace.obj \
$(OBJ_DIR)\hbver.obj \
$(OBJ_DIR)\hash.obj \
$(OBJ_DIR)\expropt1.obj \
$(OBJ_DIR)\expropt2.obj \
$(OBJ_DIR)\reserved.obj
@@ -507,6 +508,7 @@ HARBOUR_EXE_OBJS = \
$(OBJ_DIR)\hbslex.obj \
$(OBJ_DIR)\cmdcheck.obj \
$(OBJ_DIR)\hbusage.obj \
$(OBJ_DIR)\hbident.obj \
$(OBJ_DIR)\hbgenerr.obj \
$(OBJ_DIR)\hbpcode.obj \
$(OBJ_DIR)\hbfix.obj \
@@ -632,6 +634,10 @@ $(OBJ_DIR)\hbver.obj : $(COMMON_DIR)\hbver.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(COMMON_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\hash.obj : $(COMMON_DIR)\hash.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(COMMON_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\expropt1.obj : $(COMMON_DIR)\expropt1.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(COMMON_LIB) $(ARFLAGS) -+$@,,
@@ -676,6 +682,7 @@ $(HARBOUR_EXE) : $(HARBOUR_EXE_OBJS)
echo. $(OBJ_DIR)\hbslex.obj >> make.tmp
echo. $(OBJ_DIR)\cmdcheck.obj >> make.tmp
echo. $(OBJ_DIR)\hbusage.obj >> make.tmp
echo. $(OBJ_DIR)\hbident.obj >> make.tmp
echo. $(OBJ_DIR)\hbgenerr.obj >> make.tmp
echo. $(OBJ_DIR)\hbpcode.obj >> make.tmp
echo. $(OBJ_DIR)\hbfix.obj >> make.tmp
@@ -708,10 +715,8 @@ $(OBJ_DIR)\harboury.obj : $(OBJ_DIR)\harboury.c
# $(CC) $(CLIBFLAGS) -I$(OBJ_DIR) -o$@ $**
# -del $(OBJ_DIR)\unistd.h
$(OBJ_DIR)\hbslex.obj : $(COMPILER_DIR)\hbslex.c
# move $(OBJ_DIR)\harboury.h $(INCLUDE_DIR) > NUL:
$(CC) $(CLIBFLAGS) -I$(OBJ_DIR) -o$@ $**
$(OBJ_DIR)\hbslex.obj : $(COMPILER_DIR)\hbslex.c
$(CC) $(CLIBFLAGS) -I$(OBJ_DIR) -o$@ $**
$(OBJ_DIR)\cmdcheck.obj : $(COMPILER_DIR)\cmdcheck.c
$(CC) $(CLIBFLAGS) -o$@ $**
@@ -719,6 +724,9 @@ $(OBJ_DIR)\cmdcheck.obj : $(COMPILER_DIR)\cmdcheck.c
$(OBJ_DIR)\hbusage.obj : $(COMPILER_DIR)\hbusage.c
$(CC) $(CLIBFLAGS) -o$@ $**
$(OBJ_DIR)\hbident.obj : $(COMPILER_DIR)\hbident.c
$(CC) $(CLIBFLAGS) -o$@ $**
$(OBJ_DIR)\hbgenerr.obj : $(COMPILER_DIR)\hbgenerr.c
$(CC) $(CLIBFLAGS) -o$@ $**

View File

@@ -183,9 +183,6 @@ extern char * hb_comp_szAnnounce;
extern void yyrestart( FILE * );
/* Simplex requirement */
extern void hb_compReleaseStrings( void );
/* ************************************************************************* */
int main( int argc, char * argv[] )
@@ -245,7 +242,7 @@ int main( int argc, char * argv[] )
break;
}
}
hb_compIdentifierClose();
if( ! bAnyFiles )
@@ -3604,9 +3601,6 @@ int hb_compCompile( char * szPrg, int argc, char * argv[] )
printf( "\rLines %i, Functions/Procedures %i\n", hb_comp_iLine, hb_comp_iFunctionCnt );
hb_compGenOutput( hb_comp_iLanguage );
if( hb_comp_bSimpLex )
hb_compReleaseStrings();
}
}
else

View File

@@ -1895,11 +1895,6 @@ static int yy_ConvertNumber( char * szBuffer )
}
}
void hb_compReleaseStrings( void )
{
}
#ifdef HB_NESTED_COMPILE
void * hb_compGet_YY_CURRENT_BUFFER()
{

View File

@@ -45,9 +45,7 @@
#define YY_INPUT( buf, result, max_size ) result = yy_lex_input( buf, max_size );
static int iTexts = 0, iStrings = 0, iString;
static char * aTexts[256];
static char * aStrings[2048];
static char * pString;
static char * aTexts[64];
/* ----------------------------------------------------- Language Definitions. ---------------------------------------------------- */
@@ -909,11 +907,7 @@ LANGUAGE_RULES_ARE {
yytext++;\
yyleng--;\
\
yytext = hb_strdup( yytext );\
/* aTexts[iTexts++] = yytext; */\
/* printf( "Text %i At: %i for %s\n", iTexts, aTexts[iTexts - 1], aTexts[iTexts - 1] ); */\
\
yylval.string = yytext;\
yylval.string = hb_compIdentifierNew( yytext, TRUE );\
iRet = MACROVAR;\
}\
else if( tmpPtr == yytext + yyleng - 1 )\
@@ -922,21 +916,16 @@ LANGUAGE_RULES_ARE {
\
/* Remove the '&' and the '.' */ \
yytext++;\
yylval.string = yytext;\
yyleng -= 2;\
yytext[yyleng] = '\0';\
\
yytext = hb_strdup( yytext );\
/* aTexts[iTexts++] = yytext; */\
/* printf( "Text %i At: %i for %s\n", iTexts, aTexts[iTexts - 1], aTexts[iTexts - 1] ); */\
\
yylval.string = yytext;\
yylval.string = hb_compIdentifierNew( yytext, TRUE );\
iRet = MACROVAR;\
}\
else\
{\
yytext = hb_strdup( yytext );\
/* aTexts[iTexts++] = yytext; */\
aTexts[iTexts++] = yytext; \
/* printf( "Text %i At: %i for %s\n", iTexts, aTexts[iTexts - 1], aTexts[iTexts - 1] ); */\
\
yylval.string = yytext;\
@@ -957,32 +946,7 @@ LANGUAGE_RULES_ARE {
{\
DEBUG_INFO( printf( "Element \"%s\" is IDENTIFIER\n", yytext ) );\
\
iString = 0; \
while( iString < iStrings ) \
{ \
if( strcmp( yytext, aStrings[ iString ] ) == 0 ) \
{ \
pString = aStrings[ iString ]; \
break; \
} \
iString++; \
} \
\
if( iString < iStrings ) \
{ \
yytext = pString; \
DEBUG_INFO( printf( "Re-Using Allocation for String \"%s\"\n", yytext ) ); \
} \
else \
{ \
yytext = hb_strdup( yytext ); \
aStrings[iStrings++] = yytext; \
\
/* aTexts[iTexts++] = yytext; */ \
DEBUG_INFO( printf( "Allocated long term String \"%s\"\n", yytext ) ); \
} \
\
yylval.string = yytext; \
yylval.string = hb_compIdentifierNew( yytext, TRUE );\
iRet = IDENTIFIER; \
}\
}\
@@ -1050,17 +1014,13 @@ LANGUAGE_RULES_ARE {
}
#undef CUSTOM_ACTION(x)
#define CUSTOM_ACTION(x) \
#define CUSTOM_ACTION(x) \
\
DEBUG_INFO( printf( "Custom Action for %i\n", x ) );\
\
/* Resetting (prepairing). */\
yytext = hb_xgrab( iWordLen + 1 );\
/* aTexts[iTexts++] = yytext; */\
\
yytext[0] = '\0';\
yylval.string = yytext;\
/* printf( "Text %i At: %i for Var As Id\n", iTexts, aTexts[iTexts - 1] ); */\
\
DEBUG_INFO( printf( "Prepared Text: %i Pointer: %i\n", iTexts, yytext ) );\
\
@@ -1395,6 +1355,11 @@ LANGUAGE_RULES_ARE {
\
if( x == IDENTIFIER )\
{\
yylval.string = hb_compIdentifierNew( yytext, TRUE );\
\
/* No longer needed. */\
hb_xfree( yytext );\
\
PUSH_TOKEN( IDENTIFIER );\
x = 0;\
}
@@ -1409,15 +1374,3 @@ int yy_lex_input( char *buffer, int iBufferSize )
return hb_pp_Internal( hb_comp_bPPO ? hb_comp_yyppo : NULL, buffer );
}
void hb_compReleaseStrings( void )
{
DEBUG_INFO( printf( "Releasing: %i Strings\n", iStrings ) );
iString = 0;
while( iString < iStrings )
{
hb_xfree( aStrings[ iString ] );
iString++;
}
}