optimisations

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4233 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-05-10 06:35:41 +00:00
parent 635e257390
commit 75006d6b76
5 changed files with 52 additions and 10 deletions

View file

@ -1,3 +1,13 @@
Mon May 10 8:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSString.m: ([-rangeOfComposedCharacterSequenceAtIndex:])
optimised.
* Source/NSGString.m ([-rangeOfComposedCharacterSequenceAtIndex:])
implemented.
* Source/NSGCString.m ([-rangeOfComposedCharacterSequenceAtIndex:])
implemented.
* Source/include/NSThread.h: add gcontext ivar.
Fri May 7 15:12:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSBundle.m: Modified ([-release]) to avoid unnecessary work

View file

@ -42,16 +42,17 @@ typedef enum
@interface NSThread : NSObject
{
@public
objc_thread_t _thread_id;
NSHandler *_exception_handler;
NSMutableDictionary *_thread_dictionary;
objc_thread_t _thread_id;
NSHandler *_exception_handler;
NSMutableDictionary *_thread_dictionary;
struct autorelease_thread_vars _autorelease_vars;
id _gcontext;
}
+ (NSThread*) currentThread;
+ (void) detachNewThreadSelector: (SEL)aSelector
toTarget: (id)aTarget
withObject: (id)anArgument;
toTarget: (id)aTarget
withObject: (id)anArgument;
+ (BOOL) isMultiThreaded;
- (NSMutableDictionary*) threadDictionary;

View file

@ -649,6 +649,14 @@ static IMP msInitImp; /* designated initialiser for mutable */
return result;
}
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex
{
if (anIndex >= _count)
[NSException raise: NSRangeException format:@"Invalid location."];
return NSMakeRange(anIndex, 1);
}
@end

View file

@ -369,6 +369,25 @@
return result;
}
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex
{
unsigned start;
unsigned end;
if (anIndex >= _count)
[NSException raise: NSRangeException format:@"Invalid location."];
start = anIndex;
while (uni_isnonsp(_contents_chars[start]) && start > 0)
start--;
end = start + 1;
if (end < _count)
while ((end < _count) && (uni_isnonsp(_contents_chars[end])) )
end++;
return NSMakeRange(start, end-start);
}
@end

View file

@ -1311,16 +1311,20 @@ handle_printf_atsign (FILE *stream,
// Determining Composed Character Sequences
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex
{
unsigned int start, end;
unsigned start;
unsigned end;
unsigned length = [self length];
start=anIndex;
if (anIndex >= length)
[NSException raise: NSRangeException format:@"Invalid location."];
start = anIndex;
while (uni_isnonsp([self characterAtIndex: start]) && start > 0)
start--;
end=start+1;
if (end < [self length])
while ((end < [self length]) && (uni_isnonsp([self characterAtIndex: end])) )
if (end < length)
while ((end < length) && (uni_isnonsp([self characterAtIndex: end])) )
end++;
return NSMakeRange(start, end-start);
}