From f4be8f3f04eda858ccc466e2c0934730f4cabc5b Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Thu, 22 Feb 2001 09:20:18 +0000 Subject: [PATCH] 2001-02-22 01:10 UTC-0800 Ron Pinkas * source/pp/ppcore.c ! Fixed NextName() to skip over .AND., .NOT. and .OR. * config/w32/mingw32.cf + Added rules to use script files for long command lines, but commented out because @scripts did not work. --- harbour/ChangeLog | 7 +++ harbour/config/w32/mingw32.cf | 42 ++++++++++++-- harbour/source/pp/ppcore.c | 105 +++++++++++++++++++++------------- 3 files changed, 109 insertions(+), 45 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 968249c20f..ad69d4444f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +2001-02-22 01:10 UTC-0800 Ron Pinkas + * source/pp/ppcore.c + ! Fixed NextName() to skip over .AND., .NOT. and .OR. + + * config/w32/mingw32.cf + + Added rules to use script files for long command lines, but commented out because @scripts did not work. + 2001-02-22 10:25 GMT+3 Alexander Kresin * harbour/source/rdd/dbfntx/dbfntx1.c * few bugs fixed, reported by Robert Haley diff --git a/harbour/config/w32/mingw32.cf b/harbour/config/w32/mingw32.cf index 32517df7d6..7a20c3d067 100644 --- a/harbour/config/w32/mingw32.cf +++ b/harbour/config/w32/mingw32.cf @@ -13,7 +13,11 @@ CC = gcc CC_IN = -c CC_OUT = -o CPPFLAGS = -I. -I$(HB_INC_COMPILE) -mno-cygwin +ifeq ($(HB_LEX),SIMPLEX) +CFLAGS = -Wall -DSIMPLEX +else CFLAGS = -Wall +endif LD = gcc LD_OUT = -o @@ -26,10 +30,6 @@ else LINKPATHS += -L$(HB_LIB_COMPILE) endif -# The -( option could be appropriate to link against libraries with -# cyclic dependencies, but I think it is not really necessary if the -# libraries are kept in proper order. -# LINKLIBS += -Wl,-( LINKLIBS += $(foreach lib, $(CONTRIBS), -l$(lib)) LINKLIBS += $(foreach lib, $(LIBS), -l$(lib)) @@ -71,10 +71,44 @@ endif # libraries are kept in proper order. # LINKLIBS += -Wl,-) +# NOTE: The empty line directly before 'endef' HAVE TO exist! +# It causes that every echo command will be separated by LF +define lib_object +echo. ADDMOD $(file) >> __lib__.tmp + +endef + +# We have to use script to overcome the DOS limit of max 128 characters +# in commmand line +define create_library +echo. CREATE $@ > __lib__.tmp +$(foreach file, $^, $(lib_object)) +echo. SAVE >> __lib__.tmp +echo. END >> __lib__.tmp +$(AR) -M < __lib__.tmp +endef + +# NOTE: The empty line below HAVE TO exist! +define link_file +echo. $(file) >> __link__.tmp + +endef + +define link_exe_file +echo. $(LDFLAGS) $(L_USR) $(LD_OUT)$@ > __link__.tmp +$(foreach file, $^, $(link_file)) +$(foreach file, $(LINKPATHS), $(link_file)) +$(foreach file, $(LINKLIBS), $(link_file)) +-$(LD) @__link__.tmp +endef + LDFLAGS = $(LINKPATHS) -mno-cygwin AR = ar ARFLAGS = $(A_USR) AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@ +#AR_RULE = $(create_library) + +#LD_RULE = $(link_exe_file) include $(TOP)$(ROOT)config/rules.cf diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 64a1746913..a8f79d19be 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -995,9 +995,18 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) HB_TRACE(HB_TR_DEBUG, ("hb_pp_ParseExpression(%s, %s)", sLine, sOutLine)); + #if 0 + printf( "Line: >%s<\n", sLine ); + #endif + do { strotrim( sLine, FALSE ); + + #if 0 + printf( "Trimed: >%s<\n", sLine ); + #endif + rezDef = 0; rezTra = 0; rezCom = 0; isdvig = 0; @@ -1035,6 +1044,10 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) { /* Look for macros from #define */ while( ( lenToken = NextName( &ptri, sToken ) ) > 0 ) { + #if 0 + printf( "Token: >%s< Line: >%s<\n", sToken, sLine ); + #endif + if( (stdef=DefSearch(sToken,NULL)) != NULL ) { ptrb = ptri - lenToken; @@ -1064,8 +1077,10 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) } #if 0 - printf( "Line: >%s<\n", ptri ); - printf( "Out: >%s<\n", ptro ); + if( *sOutLine ) + printf( "*After #defines: >%s<\n", sOutLine ); + else + printf( "After #defines: >%s<\n", sLine ); #endif /* Look for definitions from #translate */ @@ -1112,6 +1127,13 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) stcmd = stcmd->last; } + #if 0 + if( *sOutLine ) + printf( "*After #translate: >%s<\n", sOutLine ); + else + printf( "After #translate: >%s<\n", sLine ); + #endif + /* Look for definitions from #command */ /* JFL ! Was 3 but insufficient in most cases */ /* I know this is a new hardcoded limit ... any better idea's welcome */ @@ -1216,8 +1238,10 @@ int hb_pp_ParseExpression( char * sLine, char * sOutLine ) while( rezDef || rezTra || rezCom ); #if 0 - printf( "*Line: >%s<\n", sLine ); - printf( "*Out: >%s<\n", sOutLine ); + if( *sOutLine ) + printf( "Out: >%s<\n", sOutLine ); + else + printf( "Out: >%s<\n", sLine ); #endif return 0; @@ -2742,12 +2766,6 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch int State = 0; char cha, cLast = '\0', symbLast = '\0'; - #if 0 - /* Ron Pinkas added 2000-06-04 */ - BOOL bNewLine = TRUE; - /* Ron Pinkas end 2000-06-04 */ - #endif - HB_TRACE(HB_TR_DEBUG, ("hb_pp_RdStr(%p, %s, %d, %d, %s, %p, %p)", handl_i, buffer, maxlen, lDropSpaces, sBuffer, lenBuffer, iBuffer)); if( *lenBuffer == 0 ) @@ -2879,38 +2897,12 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch maxlen = readed = 0; } break; - - #if 0 - /* Ron Pinkas added 2000-06-01 */ - case ';': - bNewLine = TRUE; - break; - - case '@': - if( bNewLine && ( sBuffer[ *iBuffer ] == '&' || sBuffer[ *iBuffer ] == '.' || sBuffer[ *iBuffer ] == '-' ) ) - { - buffer[readed++] = cha; - s_prevchar = cha; - cha = ' '; - } - break; - #endif - /* Ron Pinkas end 2000-06-01 */ } if( cha != ' ' && cha != ';' ) { s_prevchar = cha; } - - #if 0 - /* Ron Pinkas added 2000-06-04 */ - if( cha != ' ' && cha != '\t' && cha != ';' ) - { - bNewLine = FALSE; - } - /* Ron Pinkas end 2000-06-04 */ - #endif } if( cha != ' ' && cha != '\t' ) @@ -3057,7 +3049,7 @@ static int md_strAt( char * szSub, int lSubLen, char * szText, BOOL checkword, B lPos++; continue; } - else if( bRule == FALSE && *(szText+lPos) == '[' && ( lPos == 0 || *(szText+lPos-1) != '\\' ) && strchr( ")]}.", cLastChar ) == NULL && ! ISNAME( cLastChar ) ) + else if( bRule == FALSE && *(szText+lPos) == '[' && strchr( ")]}.", cLastChar ) == NULL && ! ISNAME( cLastChar ) ) { State = STATE_QUOTE3; lPos++; @@ -3282,11 +3274,19 @@ static int strincpy( char * ptro, char * ptri ) static int strotrim( char * stroka, BOOL bRule ) { - char *ptr = stroka, lastc = '0', curc, cLastChar = '\0'; + char *ptr = stroka, lastc = '0', curc; int lens = 0, State = STATE_NORMAL; + /* + char *cLastChar = '\0'; + */ + HB_TRACE(HB_TR_DEBUG, ("strotrim(%s)", stroka)); + #if 0 + printf( "StrIn: >%s<\n", stroka ); + #endif + while( ( curc = *stroka ) != '\0' ) { if( State == STATE_QUOTE1 ) @@ -3339,10 +3339,12 @@ static int strotrim( char * stroka, BOOL bRule ) lastc = curc; lens++; + /* if( State == STATE_NORMAL && curc != ' ' ) { cLastChar = curc; } + */ } stroka++; @@ -3350,6 +3352,10 @@ static int strotrim( char * stroka, BOOL bRule ) *ptr = '\0'; + #if 0 + printf( "Str Out: >%s<\n", stroka - lens ); + #endif + return lens; } @@ -3441,18 +3447,36 @@ static int NextName( char ** sSource, char * sDest ) /* END - Ron Pinkas added 2000-11-08 */ } } + /* Ron Pinkas added 2001-02-21 */ + else if( (*sSource)[0] == '.' && toupper( (*sSource)[1] ) == 'A' && toupper( (*sSource)[2] ) == 'N' && toupper( (*sSource)[3] ) == 'D' && (*sSource)[4] == '.' ) + { + (*sSource) += 5; + cLastChar = ' '; + continue; + } + else if( (*sSource)[0] == '.' && toupper( (*sSource)[1] ) == 'N' && toupper( (*sSource)[2] ) == 'O' && toupper( (*sSource)[3] ) == 'T' && (*sSource)[4] == '.' ) + { + (*sSource) += 5; + cLastChar = ' '; + continue; + } + else if( (*sSource)[0] == '.' && toupper( (*sSource)[1] ) == 'O' && toupper( (*sSource)[2] ) == 'R' && (*sSource)[3] == '.' ) + { + (*sSource) += 4; + cLastChar = ' '; + continue; + } + /* End - Ron Pinkas added 2001-02-21 */ else if( **sSource == '\'' ) { /* Ron Pinkas added 2000-11-08 */ pString = *sSource; - State = STATE_QUOTE1; } else if( **sSource == '\"' ) { /* Ron Pinkas added 2000-11-08 */ pString = *sSource; - State = STATE_QUOTE2; } /* Ron Pinkas added 2000-11-08 */ @@ -3460,7 +3484,6 @@ static int NextName( char ** sSource, char * sDest ) { /* Ron Pinkas added 2000-11-08 */ pString = *sSource; - State = STATE_QUOTE3; } /* END - Ron Pinkas added 2000-11-08 */