From d15c80e28fc4f7ee8b7781867bf5baeb21ee9c04 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Thu, 9 Feb 2006 14:17:25 +0000 Subject: [PATCH] 2006-02-09 15:25 UTC+0100 Ryszard Glab * source/compiler/harbour.c * fixed to release memory allocated with the proeprocessor * tests/mousetst.prg * minor fix after latest Przemek changes * source/pp/ppcore.c * fixed bug in processing the list of optional repeatable code reported by Lorenzo --- harbour/ChangeLog | 11 +++++++++++ harbour/source/compiler/harbour.c | 4 ++++ harbour/source/pp/ppcore.c | 26 ++++++++++++++++++++------ harbour/tests/mousetst.prg | 3 --- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8182ec1ce2..e26aa514e9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ * fixed <-x-> match marker +2006-02-09 15:25 UTC+0100 Ryszard Glab + * source/compiler/harbour.c + * fixed to release memory allocated with the proeprocessor + + * tests/mousetst.prg + * minor fix after latest Przemek changes + + * source/pp/ppcore.c + * fixed bug in processing the list of optional repeatable code + reported by Lorenzo + 2006-02-09 12:52 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/bin/bld.cmd + added -ldbffpt, -lhbsix, -lhsx libraries for GCC OS2 linking diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 8e97910543..5d8b5cde56 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -261,7 +261,11 @@ int main( int argc, char * argv[] ) } } + hb_pp_Free(); + hb_compIdentifierClose(); + if( hb_comp_pIncludePath ) + hb_fsFreeSearchPath( hb_comp_pIncludePath ); if( (! bAnyFiles ) && (! hb_comp_bQuiet) ) { diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 9f8bbfabfa..cc6436b5dc 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -2874,10 +2874,11 @@ static void SearnRep( char * exppatt, char * expreal, int lenreal, char * ptro, HB_TRACE(HB_TR_DEBUG, ("SearnRep(%s, %s, %d, %s, %p)", exppatt, expreal, lenreal, ptro, lenres)); - if( *(exppatt+1) == '\0' ) *( ptro + *lenres ) = '\0'; + if( *(exppatt+1) == '\0' ) + *( ptro + *lenres ) = '\0'; + while( (ifou = md_strAt( exppatt, (*(exppatt+1))? 2:1, ptrOut, FALSE, FALSE, TRUE, MD_STR_AT_USESUBCASE )) > 0 ) { - bFound = TRUE; rezs = FALSE; ptr = ptrOut + ifou - 2; @@ -2885,8 +2886,11 @@ static void SearnRep( char * exppatt, char * expreal, int lenreal, char * ptro, ptr = PrevSquare( ptr, ptro, &kolmarkers ); if( ptr ) { - if( s_Repeate ) s_aIsRepeate[ s_Repeate - 1 ]++; - if( !s_bReplacePat ) return; + if( s_Repeate ) + s_aIsRepeate[ s_Repeate - 1 ]++; + if( !s_bReplacePat ) + return; + ptr2 = ptrOut + ifou + 3; while( *ptr2 != ']' || *(ptr2-1) == '\\' ) { @@ -2900,7 +2904,7 @@ static void SearnRep( char * exppatt, char * expreal, int lenreal, char * ptro, isdvig += ifou; rezs = TRUE; } - else + else if( s_Repeate ) { if( lenreal == 0 ) { @@ -2942,7 +2946,16 @@ static void SearnRep( char * exppatt, char * expreal, int lenreal, char * ptro, rezs = TRUE; } } + else if( exppatt[0] == '\001' && exppatt[1] == '\000' ) + { + /* final pass to remove optional markers */ + hb_pp_Stuff( "", ptr, 0, ptr2-ptr+1, *lenres-(ptr-ptro) ); + *lenres -= ptr2-ptr+1; + isdvig = ptr - ptro; + rezs = TRUE; + } } + if( !rezs && s_bReplacePat ) { if( *(ptrOut + ifou + 2) != '0' && *(exppatt+1) ) @@ -2962,7 +2975,8 @@ static void SearnRep( char * exppatt, char * expreal, int lenreal, char * ptro, else if( !s_bReplacePat ) isdvig += ifou; ptrOut = ptro + isdvig; } - if( !bFound && s_Repeate ) s_aIsRepeate[ s_Repeate - 1 ]++; + if( !bFound && s_Repeate ) + s_aIsRepeate[ s_Repeate - 1 ]++; } static BOOL ScanMacro( char * expreal, int lenitem, int * pNewLen ) diff --git a/harbour/tests/mousetst.prg b/harbour/tests/mousetst.prg index 6f2a7453d8..d7cf2a3cda 100644 --- a/harbour/tests/mousetst.prg +++ b/harbour/tests/mousetst.prg @@ -9,9 +9,6 @@ #include "inkey.ch" -#define K_MBUTTONDOWN 332 // any value -#define K_MBUTTONUP 331 - PROCEDURE main() LOCAL nR := 5, nC := 38