diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d0625e866e..a1e853a196 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,5 +1,16 @@ +19990728-05:40 CET Victor Szel + ! source/compiler/harbour.y/MakeFilename() - + Fixed bug, which sometimes caused that the + filename losed the "." extension separator char. + ! tests/working/makefile - newcopy.prg removed. + + tests/working/strsub.prg - Added some more tests, and the + expected results. + ! source/vm/hvm.c - Minus() simplified and fixed for strings. + ! config/dos/djgpp.cf - Added -g to CFLAGS, so it's + able to make test programs. + 19990728-03:50 CET Victor Szel - ! config\win32\msvc.cf - Missing include added. + ! config/win32/msvc.cf - Missing include added. 19990727-16:30 EDT David G. Holm * source/rtl/dir.c diff --git a/harbour/config/dos/djgpp.cf b/harbour/config/dos/djgpp.cf index c435edbce8..20d976c266 100644 --- a/harbour/config/dos/djgpp.cf +++ b/harbour/config/dos/djgpp.cf @@ -13,7 +13,7 @@ CC = gcc CC_IN = -c CC_OUT = -o CPPFLAGS = -I. -I$(HB_INC_COMPILE) -CFLAGS = -Wall +CFLAGS = -Wall -g LD = gcc LD_OUT = -o diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 5507787bea..4eb59f7238 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -1616,7 +1616,7 @@ char *MakeFilename( char *szFileName, FILENAME *pFileName ) { int iLen =strlen(szFileName); - if( !(pFileName->extension[ 0 ] == '.' || pFileName->name[ iLen-1 ] == '.') ) + if( !(pFileName->extension[ 0 ] == '.' || szFileName[ iLen-1 ] == '.') ) { /* add extension separator only when extansion doesn't contain it */ szFileName[ iLen++ ] ='.'; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index fd5431e1b7..9a2783be7a 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -1451,30 +1451,21 @@ void Minus( void ) } else if( IS_STRING( pItem1 ) && IS_STRING( pItem2 ) ) { - ULONG lLen = pItem1->item.asString.length; - ULONG lInc = 0; - ULONG i; + ULONG ulLen = pItem1->item.asString.length; pItem1->item.asString.value = (char*)hb_xrealloc( pItem1->item.asString.value, pItem1->item.asString.length + pItem2->item.asString.length + 1 ); + pItem1->item.asString.length += pItem2->item.asString.length; - while( lLen && pItem1->item.asString.value[lLen - 1] == ' ' ) + while( ulLen && pItem1->item.asString.value[ulLen - 1] == ' ' ) { - lLen--; - lInc++; + ulLen--; } - pItem1->item.asString.length = lLen; - lLen = pItem2->item.asString.length; - pItem2->item.asString.length += lInc; - - for( i = 0; i < lInc; i++) - pItem2->item.asString.value[lLen + i] = ' '; - - memcpy( pItem1->item.asString.value+ pItem1->item.asString.length, - pItem2->item.asString.value, pItem2->item.asString.length ); - - pItem1->item.asString.length += pItem2->item.asString.length; + memcpy( pItem1->item.asString.value + ulLen, pItem2->item.asString.value, pItem2->item.asString.length ); + ulLen += pItem2->item.asString.length; + memset( pItem1->item.asString.value + ulLen, ' ', pItem1->item.asString.length - ulLen); pItem1->item.asString.value[ pItem1->item.asString.length ] = 0; + if( pItem2->item.asString.value ) { hb_xfree( pItem2->item.asString.value ); diff --git a/harbour/tests/working/Makefile b/harbour/tests/working/Makefile index 5751f4adff..c5eeb4f617 100644 --- a/harbour/tests/working/Makefile +++ b/harbour/tests/working/Makefile @@ -64,7 +64,6 @@ PRG_SOURCES=\ memvar.prg \ mtran.prg \ multiarg.prg \ - newcopy.prg \ nums.prg \ objarr.prg \ objasign.prg \ diff --git a/harbour/tests/working/strsub.prg b/harbour/tests/working/strsub.prg index b251fe693b..2484e9d1ee 100644 --- a/harbour/tests/working/strsub.prg +++ b/harbour/tests/working/strsub.prg @@ -1,6 +1,17 @@ // Testing strings concat +// Expected result: +// +// [STRINGSCONCAT ] +// [STRINGSCONCAT ] +// [STRINGSCONCAT ] +// >AB< +// >AB < +// >AB < +// >A B < +// >B < + function main() LOCAL a := "STRINGS " @@ -15,6 +26,12 @@ function main() QOut( "[" + c + "]" ) next + QOut( ">" + "A" - "B" + "<" ) // "AB" + QOut( ">" + "A " - "B" + "<" ) // "AB " + QOut( ">" + "A " - "B " + "<" ) // "AB " + QOut( ">" + "A " - " B" + "<" ) // "A B " + QOut( ">" + " " - "B " + "<" ) // "B " + QOut() __Accept( "Press a key to raise an error!" ) QOut( a - i )