Changeset 522

Show
Ignore:
Timestamp:
04/29/08 19:04:09 (2 months ago)
Author:
krobillard
Message:

ur_matchString() now handles slice.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/thune/parse.c

    r521 r522  
    3434typedef char   UChar; 
    3535 
    36 extern int ur_matchString( const UString* strA, int iA, 
    37                            const UString* strB, int iB, int matchCase ); 
     36extern int ur_matchString( const UString* strA, UIndex iA, UIndex endA, 
     37                           const UString* strB, UIndex iB, UIndex endB, 
     38                           int matchCase ); 
    3839extern int ur_findString( const UString* strA, UIndex iA, UIndex endA, 
    3940                          const UString* strB, UIndex iB, UIndex endB, 
     
    403404                UString* pat = ur_bin( tval ); 
    404405 
    405                 pos = ur_matchString( istr, pos, pat, tval->series.it, 
     406                pos = ur_matchString( istr, pos, pe->input.end, 
     407                                      pat, tval->series.it, 
     408                                          ur_sliceEnd( tval, pat ), 
    406409                                      pe->matchCase ); 
    407410                if( pos ) 
     
    483486                while( count < repMax ) 
    484487                { 
    485                     p2 = ur_matchString( istr, pos, pat, tval->series.it, 
     488                    p2 = ur_matchString( istr, pos, pe->input.end, 
     489                                         pat, tval->series.it, 
     490                                             ur_sliceEnd( tval, pat ), 
    486491                                         pe->matchCase ); 
    487492                    if( ! p2 ) 
  • trunk/thune/series.c

    r521 r522  
    27082708  match. 
    27092709*/ 
    2710 int ur_matchString( const UString* strA, int iA, const UString* strB, int iB, 
     2710int ur_matchString( const UString* strA, UIndex iA, UIndex endA, 
     2711                    const UString* strB, UIndex iB, UIndex endB, 
    27112712                    int matchCase ) 
    27122713{ 
    27132714    const char* sit  = strA->ptr.c + iA; 
    2714     const char* send = strA->ptr.c + strA->used
     2715    const char* send = strA->ptr.c + endA
    27152716    const char* pit  = strB->ptr.c + iB; 
    2716     const char* pend = strB->ptr.c + strB->used
    2717  
    2718     assert( iA <= strA->used ); 
    2719     assert( iB <= strB->used )
     2717    const char* pend = strB->ptr.c + endB
     2718 
     2719    if( (iA >= endA) || (iB >= endB) ) 
     2720        return -1
    27202721 
    27212722    if( matchCase )