Changeset 521

Show
Ignore:
Timestamp:
04/28/08 18:30:18 (2 months ago)
Author:
krobillard
Message:

String parse to & thru now handle slices.

Files:

Legend:

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

    r519 r521  
    3636extern int ur_matchString( const UString* strA, int iA, 
    3737                           const UString* strB, int iB, int matchCase ); 
    38 extern int ur_findString( const UString* strA, int iA, 
    39                           const UString* strB, int iB, int matchCase ); 
     38extern int ur_findString( const UString* strA, UIndex iA, UIndex endA, 
     39                          const UString* strB, UIndex iB, UIndex endB, 
     40                          int matchCase ); 
    4041 
    4142 
     
    228229                        { 
    229230                            UString* pat = ur_bin(tval); 
    230                             pos = ur_findString( istr, pos, 
     231                            pos = ur_findString( istr, pos, pe->input.end, 
    231232                                                 pat, tval->series.it, 
     233                                                     ur_sliceEnd( tval, pat ), 
    232234                                                 pe->matchCase ); 
    233235                            if( pos < 0 ) 
  • trunk/thune/series.c

    r520 r521  
    27502750  Returns index in strA where strB is found or -1 if strB is not found. 
    27512751*/ 
    2752 int ur_findString( const UString* strA, int iA, 
    2753                    const UString* strB, int iB, int matchCase ) 
     2752int ur_findString( const UString* strA, UIndex iA, UIndex endA, 
     2753                   const UString* strB, UIndex iB, UIndex endB, 
     2754                   int matchCase ) 
    27542755{ 
    27552756    const char* it   = strA->ptr.c + iA; 
    2756     const char* end  = strA->ptr.c + strA->used
     2757    const char* end  = strA->ptr.c + endA
    27572758    const char* pat  = strB->ptr.c + iB; 
    2758     const char* pend = strB->ptr.c + strB->used
    2759  
    2760     assert( iA <= strA->used ); 
    2761     assert( iB <= strB->used )
     2759    const char* pend = strB->ptr.c + endB
     2760 
     2761    if( (iA >= endA) || (iB >= endB) ) 
     2762        return -1
    27622763 
    27632764    if( matchCase ) 
     
    29192920                    inv = UR_CALL_CELL; 
    29202921                    found = ur_findString( s1, res->series.it, 
     2922                                               ur_sliceEnd(res, s1), 
    29212923                                           s2, tos->series.it, 
     2924                                               ur_sliceEnd(tos, s2), 
    29222925                                      (inv && (ur_sel(inv) == UR_ATOM_CASE)) ); 
    29232926                    if( found > -1 )