diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aabf7df031..eee1c4c852 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +199908.04-11:35 GMT+3 Alexander Kresin + * source/hbpp/hbpp.c + * Some bugs fixed,mentioned by Victor Szel, Matteo Baccan and David G. Holm + * makefile.b32 + * msgxxx.c replaced with msguk.c + * config/win32/bcc32.cf + * LD = bcc32 + 19990804-00:40 EDT Paul Tucker * source/rtl/gt/gtwin.c * better selection of default screen size reported by MaxRow/Col diff --git a/harbour/config/win32/bcc32.cf b/harbour/config/win32/bcc32.cf index 38b29ca527..b48590a660 100644 --- a/harbour/config/win32/bcc32.cf +++ b/harbour/config/win32/bcc32.cf @@ -41,7 +41,7 @@ $(COMSPEC) /E:2048 /Cecho $(LINKLIBS) >> __link__.tmp -$(LD) @__link__.tmp endef -LD = bcc +LD = bcc32 LDFLAGS = -O2 ifeq ($(HB_LIB_COMPILE),) LINKLIBS = $(foreach lib, $(LIBS), $(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)$(LIB_EXT)) diff --git a/harbour/makefile.b32 b/harbour/makefile.b32 index 31bad9f486..1c30902fc8 100644 --- a/harbour/makefile.b32 +++ b/harbour/makefile.b32 @@ -17,7 +17,7 @@ harbour.lib : arrays.obj asort.obj classes.obj codebloc.obj alert.obj \ dir.obj do.obj dynsym.obj environ.obj error.obj menu.obj \ errorapi.obj errorsys.obj extend.obj files.obj fm.obj \ hardcr.obj hb_f.obj initsymb.obj inkey.obj itemapi.obj memvars.obj \ - math.obj mathx.obj msgxxx.obj mtran.obj objfunc.obj \ + math.obj mathx.obj msguk.obj mtran.obj objfunc.obj \ set.obj setcolor.obj setkey.obj strings.obj symbols.obj stringp.obj \ stringsx.obj tclass.obj transfrm.obj copyfile.obj @@ -52,7 +52,7 @@ itemapi.obj : itemapi.c extend.h hbdefs.h math.obj : math.c extend.h hbdefs.h memvars.obj : memvars.c extend.h hbdefs.h mathx.obj : mathx.c extend.h hbdefs.h -msgxxx.obj : msgxxx.c extend.h hbdefs.h +msguk.obj : msguk.c extend.h hbdefs.h mtran.obj : mtran.c extend.h hbdefs.h objfunc.obj : objfunc.c extend.h hbdefs.h set.obj : set.c extend.h hbdefs.h diff --git a/harbour/source/hbpp/hbpp.c b/harbour/source/hbpp/hbpp.c index 741d0b8b02..929eb6ef85 100644 --- a/harbour/source/hbpp/hbpp.c +++ b/harbour/source/hbpp/hbpp.c @@ -60,8 +60,8 @@ void AddCommand ( char * ); /* Add new #command to an array void AddTranslate ( char * ); /* Add new #translate to an array */ COMMANDS* getCommand ( int ); int ParseExpression( char*, char* ); /* Parsing a line ( without preprocessor directive ) */ -int WorkDefine ( char**, char**, DEFINES *, int ); /* Replace fragment of code with a #defined result text */ -void WorkPseudoF ( char**, char**, DEFINES*); /* Replace pseudofunction with a #defined result text */ +int WorkDefine ( char**, char*, DEFINES * ); /* Replace fragment of code with a #defined result text */ +int WorkPseudoF ( char**, char*, DEFINES*); /* Replace pseudofunction with a #defined result text */ int WorkCommand ( char*, char*, char*, int); int WorkTranslate ( char*, char*, char*, int, int* ); int CommandStuff ( char *, char *, char *, int*, int ); @@ -221,7 +221,7 @@ int ParseDirective( char* sLine ) ParseCommand ( sLine, (i==9)? FALSE:TRUE, FALSE ); else if ( i == 6 && memcmp ( sDirective, "STDOUT", 6 ) == 0 ) - printf ( "%s", sLine ); /* --- #stdout --- */ + printf ( "%s\n", sLine ); /* --- #stdout --- */ else if ( i == 5 && memcmp ( sDirective, "ERROR", 5 ) == 0 ) { /* --- #error --- */ @@ -544,17 +544,15 @@ COMMANDS* getCommand ( int ndef ) int ParseExpression( char* sLine, char* sOutLine ) { char sToken[MAX_NAME]; - char *ptri, *ptro; + char *ptri, *ptro, *ptrb; int lenToken, i, ndef, ipos, isdvig, lens; - int rezDef, rezDefsub, rezTra, rezCom, kolpass = 0; - int kolused = 0, lastused; - DEFINES *aUsed[100], *stdef; + int rezDef, rezTra, rezCom, kolpass = 0; + DEFINES *stdef; do { strotrim ( sLine ); rezDef = 0; rezTra = 0; rezCom = 0; - lastused = kolused; isdvig = 0; do { @@ -572,42 +570,27 @@ int ParseExpression( char* sLine, char* sOutLine ) else { /* Look for macros from #define */ - rezDefsub = 0; - while ( ( lenToken = NextName(&ptri, sToken, &ptro) ) > 0 ) + while ( ( lenToken = NextName( &ptri, sToken, NULL ) ) > 0 ) if ( (stdef=DefSearch(sToken)) != NULL ) { - for(i=0;i= 0 ) { - if ( i < lastused ) GenError( _szPErrors, 'P', ERR_RECURSE, NULL, NULL ); - } - if ( WorkDefine ( &ptri, &ptro, stdef, lenToken ) ) - { - aUsed[kolused++] = stdef; - rezDef++; rezDefsub++; - } - } - if ( rezDefsub ) /* if some defines was processed */ - { - *ptro = '\0'; - ptri = sLine + isdvig; - if ( isdvig + ipos > 0 ) - { - lens = strolen( ptri ); + rezDef++; + lens = strolen( ptrb ); if ( ipos > 0 ) { - *(ptri+lens) = ';'; - lens += strolen( ptri+ipos ) + 1; + *(ptrb+lens) = ';'; + lens += strolen( ptrb+lens+1 ); } - pp_Stuff ( sOutLine, ptri, ptro - sOutLine, (ipos)? ipos-1:lens, lens ); + pp_Stuff ( ptro, ptrb, i, ptri-ptrb, lens+1 ); if ( ipos > 0 ) { - ipos = ptro - sOutLine + 1; - *(ptri + ipos - 1) = '\0'; + ipos += i - (ptri-ptrb); + *(sLine + isdvig + ipos - 1) = '\0'; } + ptri += i - (ptri-ptrb); } - else - memcpy ( sLine, sOutLine, ptro - sOutLine + 1); } /* Look for definitions from #translate */ @@ -680,101 +663,90 @@ int ParseExpression( char* sLine, char* sOutLine ) } while ( ipos != 0 ); kolpass++; + if( kolpass > 20 && rezDef ) + GenError( _szPErrors, 'P', ERR_RECURSE, NULL, NULL ); } while ( rezDef || rezTra || rezCom ); return 0; } -int WorkDefine ( char** ptri, char** ptro, DEFINES *stdef, int lenToken ) +int WorkDefine ( char** ptri, char* ptro, DEFINES *stdef ) { - int rezDef = 0, npars; - char *ptr; - if ( stdef->npars < 0 ) - { - rezDef = 1; - *ptro -= lenToken; - lenToken = 0; - while ( *(stdef->value+lenToken) != '\0' ) - *(*ptro)++ = *(stdef->value+lenToken++); - } - else - { - SKIPTABSPACES( *ptri ); - if ( **ptri == '(' ) - { - npars = 0; ptr = *ptri; - do + int npars, lens; + char *ptr; + + if ( stdef->npars < 0 ) + lens = strocpy( ptro,stdef->value ); + else + { + SKIPTABSPACES( *ptri ); + if ( **ptri == '(' ) { - ptr++; - if ( NextParm( &ptr, NULL ) > 0 ) npars++; + npars = 0; ptr = *ptri; + do + { + ptr++; + if ( NextParm( &ptr, NULL ) > 0 ) npars++; + } + while ( *ptr != ')' && *ptr != '\0' ); + if ( *ptr == ')' && stdef->npars == npars ) + lens = WorkPseudoF( ptri, ptro, stdef ); + else return -1; } - while ( *ptr != ')' && *ptr != '\0' ); - if ( *ptr == ')' && stdef->npars == npars ) - { - rezDef = 1; - *ptro -= lenToken; - WorkPseudoF( ptri, ptro, stdef ); - } - } - else *(*ptro)++ = ' '; - } - return rezDef; + else return -1; + } + return lens; } -void WorkPseudoF ( char** ptri, char** ptro, DEFINES *stdef ) +int WorkPseudoF ( char** ptri, char* ptro, DEFINES *stdef ) { char parfict[MAX_NAME], parreal[MAX_NAME]; char *ptrb; - int ipos = 0, ifou, ibeg; + int ipos, ifou, ibeg; int lenfict, lenreal, lenres; - while ( *(stdef->value+ipos) != '\0' ) /* Copying value of macro */ - { /* to destination string */ - *(*ptro+ipos) = *(stdef->value+ipos); - ipos++; - } - *(*ptro+ipos) = '\0'; - lenres = ipos; + lenres = strocpy( ptro, stdef->value ); /* Copying value of macro to destination string */ if ( stdef->pars ) { - ipos = 0; ibeg = 0; - do /* Parsing through parameters */ - { /* in macro definition */ - if ( *(stdef->pars+ipos)==',' || *(stdef->pars+ipos)=='\0' ) - { - *(parfict+ipos-ibeg) = '\0'; - lenfict = ipos - ibeg; - - if ( **ptri != ')' ) + ipos = 0; ibeg = 0; + do /* Parsing through parameters */ + { /* in macro definition */ + if ( *(stdef->pars+ipos) == ',' || *(stdef->pars+ipos) == '\0' ) { - (*ptri)++; /* Parsing through real parameters */ - lenreal = NextParm( ptri, parreal ); + *(parfict+ipos-ibeg) = '\0'; + lenfict = ipos - ibeg; - ptrb = *ptro; - while ( (ifou = pp_strAt( parfict, lenfict, ptrb, lenres-(ptrb-*ptro) )) > 0 ) - { - ptrb = ptrb+ifou-1; - if ( !ISNAME(*(ptrb-1)) && !ISNAME(*(ptrb+lenfict)) ) - { - pp_Stuff ( parreal, ptrb, lenreal, lenfict, lenres ); - lenres += lenreal - lenfict; - } - else ptrb++; - } - ibeg = ipos+1; + if ( **ptri != ')' ) + { + (*ptri)++; /* Get next real parameter */ + lenreal = NextParm( ptri, parreal ); + + ptrb = ptro; + while ( (ifou = pp_strAt( parfict, lenfict, ptrb, lenres-(ptrb-ptro) )) > 0 ) + { + ptrb = ptrb+ifou-1; + if ( !ISNAME(*(ptrb-1)) && !ISNAME(*(ptrb+lenfict)) ) + { + pp_Stuff ( parreal, ptrb, lenreal, lenfict, lenres ); + lenres += lenreal - lenfict; + ptrb += lenreal; + } + else ptrb++; + } + ibeg = ipos+1; + } } - } - else *(parfict+ipos-ibeg) = *(stdef->pars+ipos); - if ( *(stdef->pars+ipos) == '\0' ) break; - ipos++; - } - while ( 1 ); + else *(parfict+ipos-ibeg) = *(stdef->pars+ipos); + if ( *(stdef->pars+ipos) == '\0' ) break; + ipos++; + } + while ( 1 ); } else while ( **ptri != ')' ) (*ptri)++; (*ptri)++; - *ptro += lenres; + return lenres; } int WorkCommand ( char* sToken, char* ptri, char* ptro, int ndef ) @@ -1113,7 +1085,7 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int nbr ) int getExpReal ( char *expreal, char **ptri, int prlist, int maxrez ) { int lens = 0; - char *sZnaki = "+-=><*/$.&:#"; + char *sZnaki = "+-=><*/$.&:#%"; int State; int StBr1 = 0, StBr2 = 0, StBr3 = 0; int rez = 0;