From ef790a0a5576f7c8b2c80e0b4e127a37db78218e Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Tue, 15 Jan 2002 17:41:13 +0000 Subject: [PATCH] 2002-01-15 20:40 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 4 ++ harbour/source/pp/ppcore.c | 85 +++++++++++++++++++++++++++----------- 2 files changed, 64 insertions(+), 25 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5ffb406953..4bf180cc22 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -7,6 +7,10 @@ For example: 2002-12-01 23:12 UTC+0100 Foo Bar */ + * fixed 3 bugs with index not updating the tree + +2002-01-16 11:10 UTC-0500 David G. Holm + * contrib/libct/charsort.c ! OS/2 IBM C++ fix. 2002-01-16 05:00 UTC+0700 Andi Jahja diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 831d016924..e6cd8b43c4 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -880,7 +880,7 @@ static void ConvertPatterns( char * mpatt, int mlen, char * rpatt, int rlen ) int explen, rmlen; char exppatt[ MAX_NAME ], expreal[ 5 ] = "\1 0"; char lastchar = '@', exptype; - char * ptr; + char * ptr, * ptrtmp; HB_TRACE(HB_TR_DEBUG, ("ConvertPatterns(%s, %d, %s, %d)", mpatt, mlen, rpatt, rlen)); @@ -958,31 +958,66 @@ static void ConvertPatterns( char * mpatt, int mlen, char * rpatt, int rlen ) while( (ifou = hb_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 ) { /* Convert result marker into inner format */ + ifou --; ptr += ifou; - if( *(ptr-2) == '<' && *(ptr+explen-1) == '>' && - *(ptr-3) != '\\' && *(ptr+explen-2) != '\\' ) /* <...> */ - { - if( *(ptr-3) == '#' && *(ptr-4) != '\\' ) /* #<...> */ - { exptype = '1'; ptr -= 3; rmlen = explen+3; } - else - { exptype = '0'; ptr -= 2; rmlen = explen+2; } - } - else if( *(ptr-3) == '<' && *(ptr+explen) == '>' && - *(ptr-4) != '\\' && *(ptr+explen-1) != '\\' ) /* < ... > */ - { - ptr -= 2; - if( *ptr == '\"' ) exptype = '2'; - else if( *ptr == '(' ) exptype = '3'; - else if( *ptr == '{' ) exptype = '4'; - else if( *ptr == '.' ) exptype = '5'; - else if( *ptr == '-' ) exptype = '6'; - ptr--; - rmlen = explen+4; - } - else continue; - expreal[2] = exptype; - hb_pp_Stuff( expreal, ptr, 4, rmlen, rlen ); - rlen += 4 - rmlen; + ptrtmp = ptr + 1; + rmlen = explen; + exptype = '0'; + do + { + ptr--; + rmlen++; + ifou--; + if( *ptr == '<' ) + continue; + else if( *ptr == '\"' ) + exptype = '2'; + else if( *ptr == '(' ) + exptype = '3'; + else if( *ptr == '{' ) + exptype = '4'; + else if( *ptr == '.' ) + exptype = '5'; + else if( *ptr == '-' ) + exptype = '6'; + else if( *ptr == ' ' || *ptr == '\t' ) + continue; + else + ifou = -1; + } + while( ifou >= 0 && *ptr!='<' && *(ptr-1)!= '\\' ); + if( ifou >=0 && *ptr=='<' ) + { + ptr += rmlen++; + while( *ptr != '\0' && *ptr != '>' && *(ptr-1) != '\\' ) + { + if( *ptr != ' ' && *ptr != '\t' && *ptr != '\"' && *ptr != ')' && *ptr != '}' && *ptr != '.' && *ptr != '-' ) + { + ifou = -1; + break; + } + rmlen++; + ptr++; + } + if( ifou >=0 && *ptr=='>' ) + { + ptr -= rmlen; + ptr++; + if( exptype == '0' && *(ptr-1) == '#' && *(ptr-2) != '\\' ) + { + exptype = '1'; + ptr--; + rmlen++; + } + expreal[2] = exptype; + hb_pp_Stuff( expreal, ptr, 4, rmlen, rlen ); + rlen += 4 - rmlen; + } + else + ptr = ptrtmp; + } + else + ptr = ptrtmp; } } i++;