Stack trace fixups.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-02-04 08:43:16 +00:00
parent ee4034383e
commit c33d2fd0e0
4 changed files with 269 additions and 142 deletions

View file

@ -980,3 +980,39 @@ static unsigned posForIndex(GSIArray array, unsigned index)
@end
@implementation NSIndexSet (NSCharacterSet)
/* Extra method to let NSCharacterSet play with index sets more efficiently.
*/
- (unsigned int) _gapGreaterThanIndex: (unsigned int)anIndex
{
unsigned pos;
NSRange r;
if (anIndex++ == NSNotFound)
{
return NSNotFound;
}
if (_array == 0 || GSIArrayCount(_array) == 0)
{
return NSNotFound;
}
if ((pos = posForIndex(_array, anIndex)) >= GSIArrayCount(_array))
{
r = GSIArrayItemAtIndex(_array, pos-1).ext;
if (anIndex > NSMaxRange(r))
{
return NSNotFound;
}
return anIndex; // anIndex is the gap after the last index.
}
r = GSIArrayItemAtIndex(_array, pos).ext;
if (r.location > anIndex)
{
return anIndex; // anIndex is in a gap between index ranges.
}
return NSMaxRange(r); // Return start of gap after the index range.
}
@end