From d972547fbe7e72413bf9e247733bc2d1d33d2e7a Mon Sep 17 00:00:00 2001 From: Eddie Runia Date: Sat, 22 May 1999 13:19:37 +0000 Subject: [PATCH] See changelog --- harbour/ChangeLog | 19 +++++++++++++ harbour/include/hbsetup.h | 2 +- harbour/source/compiler/harbour.y | 5 +--- harbour/source/vm/hvm.c | 45 +++++++++++++++++++++++++++---- harbour/tests/broken/instr.prg | 14 ---------- harbour/tests/working/instr.prg | 18 +++++++++++++ harbour/tests/working/runner.c | 1 - 7 files changed, 79 insertions(+), 25 deletions(-) delete mode 100644 harbour/tests/broken/instr.prg create mode 100644 harbour/tests/working/instr.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a1d09a76e0..6d66f20750 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,22 @@ +19990522-14:10 CET Eddie Runia + Change from 11:43 committed + * tests/broken/instr.prg + removed + * include/hbsetup.h + #define HARBOUR_START_PROGRAM temporarily commented out, because of errors + +19990522-11:43 CET Eddie Runia + * source/vm/hvm.c + pItem bug in add changed + Instring operator added + 'unreleased memory block' only get shown if memory block remain open + * tests/working/instr.prg + test program for instring added + * tests/working/runner.c + 'Loading' messages removed + * source/compiler/harbour.y + 'Debug' messages removed. + 19990521-21:45 CET Eddie Runia * tests/broken/instr.prg added. Contribution from Les Griffiths. formerly known as strcomp diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index ea720eb06e..64dc909ca6 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -16,7 +16,7 @@ * * By default we are using automatic lookup (symbol not defined) */ -#define HARBOUR_START_PROCEDURE "MAIN" +/* #define HARBOUR_START_PROCEDURE "MAIN" */ /* This symbol defines if we want an ability to create and link OBJ files * generated by Harbour compiler diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 7907be4e9c..74aaca65f2 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -3459,9 +3459,6 @@ void GenPortObj( char *szFileName, char *szName ) while( pFunc ) { -/* if( pFunc->cScope != FS_PUBLIC ) - fprintf( yyc, "static " ); */ - fputs( pFunc->szName, yyc ); fputc( 0, yyc ); fputc( (BYTE) ( ( pFunc->lPCodePos ) & 255 ), yyc ); /* Write size */ @@ -3469,7 +3466,7 @@ void GenPortObj( char *szFileName, char *szName ) fputc( (BYTE) ( ( pFunc->lPCodePos >> 16 ) & 255 ), yyc ); fputc( (BYTE) ( ( pFunc->lPCodePos >> 24 ) & 255 ), yyc ); - printf( "Creating output for %s\n", pFunc->szName ); +/* printf( "Creating output for %s\n", pFunc->szName ); */ lPCodePos = 0; lPad = 0; /* Number of bytes optimized */ diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 0197e63dd6..dd63c6c411 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -50,6 +50,7 @@ void GenArray( WORD wElements ); /* generates a wElements Array and fills it fro void Greater( void ); /* checks if the latest - 1 value is greater than the latest, removes both and leaves result */ void GreaterEqual( void ); /* checks if the latest - 1 value is greater than or equal the latest, removes both and leaves result */ void Inc( void ); /* increment the latest numeric value on the stack */ +void Instring( void ); /* check whether string 1 is contained in string 2 */ void ItemCopy( PITEM pDest, PITEM pSource ); /* copies an item to one place to another respecting its containts */ void Less( void ); /* checks if the latest - 1 value is less than the latest, removes both and leaves result */ void LessEqual( void ); /* checks if the latest - 1 value is less than or equal the latest, removes both and leaves result */ @@ -125,6 +126,7 @@ void InitSymbolTable( void ); /* initialization of runtime support symbols */ static void ForceLink( void ); ULONG hb_isMessage( PITEM, char * ); +ULONG hb_strAt( char *, long, char *, long ); #define STACK_INITITEMS 100 #define STACK_EXPANDITEMS 20 @@ -231,10 +233,13 @@ BYTE bErrorLevel = 0; /* application exit errorlevel */ /* LogSymbols(); */ HBDEBUG( "Done!\n" ); - printf( "\n\ntotal memory blocks allocated: %lu\n", ulMemoryMaxBlocks ); - printf( "memory maximum size consumed: %ld\n", ulMemoryMaxConsumed ); - printf( "memory blocks not released: %ld\n", ulMemoryBlocks ); - printf( "memory size not released: %ld\n", ulMemoryConsumed ); + if( ulMemoryBlocks ) + { + printf( "\n\ntotal memory blocks allocated: %lu\n", ulMemoryMaxBlocks ); + printf( "memory maximum size consumed: %ld\n", ulMemoryMaxConsumed ); + printf( "memory blocks not released: %ld\n", ulMemoryBlocks ); + printf( "memory size not released: %ld\n", ulMemoryConsumed ); + } return bErrorLevel; } @@ -345,6 +350,11 @@ void VirtualMachine( PBYTE pCode, PSYMBOL pSymbols ) w++; break; + case _INSTRING: + Instring(); + w++; + break; + case _JUMP: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); if( wParams ) @@ -1043,6 +1053,31 @@ void ItemRelease( PITEM pItem ) pItem->wType = IT_NIL; } +void Instring( void ) +{ + PITEM pItem1 = stack.pPos - 2; + PITEM pItem2 = stack.pPos - 1; + int iResult; + ULONG ul; + + if( IS_STRING( pItem1 ) && IS_STRING( pItem2 ) ) + { + for( iResult = 0, ul = 0; !iResult && ul < (ULONG) pItem1->wLength; ul++ ) + iResult = hb_strAt( pItem1->value.szText + ul, 1, + pItem2->value.szText, pItem2->wLength ); + StackPop(); + StackPop(); + PushLogical( iResult == 0 ? 0 : 1 ); + } + else + { + PITEM pError = _errNew(); + + _errPutDescription( pError, "Error BASE/1109 Argument error: $" ); + _errLaunch( pError ); + } +} + void ItemCopy( PITEM pDest, PITEM pSource ) { ItemRelease( pDest ); @@ -1382,7 +1417,7 @@ void Plus( void ) PushDate( lDate1 + dNumber2 ); } - else if( IS_OBJECT( pItem1 ) && hb_isMessage( pItem, "+" ) ) + else if( IS_OBJECT( pItem1 ) && hb_isMessage( pItem2, "+" ) ) OperatorCall( pItem1, pItem2, "+" ); /* TODO: Generate an error if types don't match */ diff --git a/harbour/tests/broken/instr.prg b/harbour/tests/broken/instr.prg deleted file mode 100644 index 72084634ce..0000000000 --- a/harbour/tests/broken/instr.prg +++ /dev/null @@ -1,14 +0,0 @@ - -/* test of instring $ operator */ - -function main -qout( "test of instring $ operator ") -qout('"d" $ "bcde"', "d" $ "bcde",.t.) -qout('"D" $ "BCDE"', "D" $ "BCDE",.t.) - -qout('"a" $ "bcde"', "a" $ "bcde",.f.) -qout('"d" $ "BCDE"', "d" $ "BCDE",.f.) -qout('"D" $ "bcde"', "D" $ "bcde",.f.) - -return nil - diff --git a/harbour/tests/working/instr.prg b/harbour/tests/working/instr.prg new file mode 100644 index 0000000000..eaffcb06f9 --- /dev/null +++ b/harbour/tests/working/instr.prg @@ -0,0 +1,18 @@ + +/* test of instring $ operator */ + +function main +qout( "test of instring $ operator ") +qout('"d" $ "bcde" ', "d" $ "bcde",.t.) +qout('"D" $ "BCDE" ', "D" $ "BCDE",.t.) + +qout('"a" $ "bcde" ', "a" $ "bcde",.f.) +qout('"d" $ "BCDE" ', "d" $ "BCDE",.f.) +qout('"D" $ "bcde" ', "D" $ "bcde",.f.) + +qout('"de" $ "bcde"', "de" $ "bcde",.t.) +qout('"bd" $ "bcde"', "bd" $ "bcde",.t.) +qout('"BD" $ "bcde"', "BD" $ "bcde",.f.) + +return nil + diff --git a/harbour/tests/working/runner.c b/harbour/tests/working/runner.c index f5a2854589..8445f6d1ef 100644 --- a/harbour/tests/working/runner.c +++ b/harbour/tests/working/runner.c @@ -172,7 +172,6 @@ HARBOUR HB_RUN( void ) /* HB_Run( ) */ else bCont = FALSE; } while( bCont ); - printf("\nLoading <%s>", szTemp ); pDynFunc[ ul ].szName = (char *) _xgrab( szIdx - szTemp + 1); strcpy( pDynFunc[ ul ].szName, szTemp );