From 81589b35adf049b3dd464555ec3676ceb499e511 Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 7 Jan 2002 11:24:52 +0000 Subject: [PATCH] More tidyups git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12019 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++ Headers/gnustep/base/NSObject.h | 7 +- Source/GNUmakefile | 2 +- Tools/AGSHtml.m | 62 ++++++++++----- Tools/AGSParser.m | 136 ++++++++------------------------ 5 files changed, 93 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2df21e622..9e8523ab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-01-07 Richard Frith-Macdonald + + * Tools/AGSHtml.m: Minor speedup. + * Tools/AGSParser.m: Rewrite handling of standards information to fix + bug in NO_GNUSTEP handling. + * Source/GNUmakefile: Don't document concrete number stuff ... not + public. + Sun Jan 6 22:33:55 2002 Nicola Pero * Tools/HTMLLinker.m: Rewritten to fixup links by link name rather diff --git a/Headers/gnustep/base/NSObject.h b/Headers/gnustep/base/NSObject.h index 390eeb928..e72b19b87 100644 --- a/Headers/gnustep/base/NSObject.h +++ b/Headers/gnustep/base/NSObject.h @@ -95,9 +95,11 @@ Class isa; } +#ifndef NO_GNUSTEP #if GS_WITH_GC + (BOOL) requiresTypedMemory; #endif +#endif + (void) initialize; + (id) allocWithZone: (NSZone*)z; + (id) alloc; @@ -164,6 +166,8 @@ NSComparisonResult; enum {NSNotFound = 0x7fffffff}; +#ifndef NO_GNUSTEP + @interface NSObject (NEXTSTEP) - error:(const char *)aString, ...; - notImplemented:(SEL)aSel; @@ -171,7 +175,6 @@ enum {NSNotFound = 0x7fffffff}; Removed because OpenStep has -(NSString*)name; */ @end -#ifndef NO_GNUSTEP /* Global lock to be used by classes when operating on any global data that invoke other methods which also access global; thus, creating the potential for deadlock. */ @@ -189,7 +192,7 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock; @end @interface NSObject (GNU) -- (int) compare: (id)anObject; +- (NSComparisonResult) compare: (id)anObject; /* * Default description methods - * [descriptionWithLocale:] calls [description] diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 86f8052db..9eb99f16c 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -310,7 +310,6 @@ NSCalendarDate.h \ NSCharacterSet.h \ NSClassDescription.h \ NSCoder.h \ -NSConcreteNumber.h \ NSConnection.h \ NSData.h \ NSDate.h \ @@ -366,6 +365,7 @@ NSZone.h FOUNDATION_HEADERS = \ Foundation.h \ NSByteOrder.h \ +NSConcreteNumber.h \ NSKeyValueCoding.h \ NSPathUtilities.h \ NSSerialization.h \ diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index e8fa26095..c5c11178c 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -279,14 +279,48 @@ static NSMutableSet *textNodes = nil; if ([dict count] > 1 || ([dict count] > 0 && [type isEqual: @"title"] == NO)) { - NSArray *a = [dict allKeys]; - unsigned c = [a count]; - unsigned i; - NSString *sep = @""; + NSArray *a = [dict allKeys]; + unsigned c = [a count]; + NSMutableSet *unitNames = nil; + unsigned i; + NSString *sep = @""; + BOOL isInUnit = NO; - if ([type isEqual: @"ivariable"]) + if ([type isEqual: @"method"] || [type isEqual: @"ivariable"]) { - sep = @"*"; + isInUnit = YES; + if ([type isEqual: @"ivariable"]) + { + sep = @"*"; + } + else if (unit != nil) + { + /* + * Create a mutable set containing the unit name. + */ + unitNames = [NSMutableSet setWithObject: unit]; + /* + * if the unit is a class, add all its categories to the set. + */ + if ([unit hasSuffix: @")"] == NO) + { + NSArray *categoryNames; + unsigned l = [unit length]; + + categoryNames = [[dict objectForKey: @"category"] allKeys]; + i = [categoryNames count]; + while (i-- > 0) + { + NSString *n = [categoryNames objectAtIndex: i]; + + if ([n hasPrefix: unit] == YES && [n length] > l + && [n characterAtIndex: i] == '(') + { + [unitNames addObject: n]; + } + } + } + } } a = [a sortedArrayUsingSelector: @selector(compare:)]; @@ -298,33 +332,25 @@ static NSMutableSet *textNodes = nil; for (i = 0; i < c; i++) { - if ([type isEqual: @"method"] || [type isEqual: @"ivariable"]) + if (isInUnit == YES) { NSString *ref = [a objectAtIndex: i]; NSDictionary *units = [dict objectForKey: ref]; NSMutableArray *b = [[units allKeys] mutableCopy]; unsigned j; - if (unit != nil) + if (unitNames != nil) { /* * Remove any listing for methods not in the - * current unit or in categories of the - * current class. + * current unit or in categories of the current class. */ for (j = 0; j < [b count]; j++) { NSString *u = [b objectAtIndex: j]; - if ([unit isEqual: u] == NO) + if ([unitNames member: u] == NO) { - if ([unit hasSuffix: @")"] == NO - && [u hasPrefix: unit] == YES - && [u characterAtIndex: [unit length]] - == '(') - { - continue; - } [b removeObjectAtIndex: j--]; } } diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index 0e6c93497..25c17ead2 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -1289,9 +1289,8 @@ fail: else if (ifStack == nil) { ifStack = [[NSMutableArray alloc] initWithCapacity: 4]; - [ifStack addObject: @"OpenStep"]; - [ifStack addObject: @"MacOS-X"]; - [ifStack addObject: @"GNUstep"]; + [ifStack addObject: [NSSet setWithObjects: + @"OpenStep", @"MacOS-X", @"GNUstep", nil]]; } } @@ -1302,65 +1301,21 @@ fail: */ - (void) setStandards: (NSMutableDictionary*)dict { - unsigned c = [ifStack count]; - BOOL hadG = NO; - BOOL hadM = NO; - BOOL hadO = NO; + NSSet *set = [ifStack lastObject]; - if (c > 0) + if ([set count] > 0) { NSMutableString *s = nil; - BOOL found = NO; + NSEnumerator *e = [set objectEnumerator]; + NSString *name; s = [NSMutableString stringWithCString: ""]; - while (c-- > 0) + while ((name = [e nextObject]) != nil) { - NSString *name = [ifStack objectAtIndex: c]; - - /* - * We don't produce output for empty strings or - * the 'NotGNUstep' string. - */ - if ([name isEqualToString: @""] == YES - || [name isEqualToString: @"NotGNUstep"] == YES) - { - continue; - } - if ([name isEqualToString: @"GNUstep"] == YES - || [name isEqualToString: @"NotGNUstep"] == YES) - { - if (hadG == YES) - { - continue; - } - hadG = YES; - } - if ([name isEqualToString: @"OpenStep"] == YES - || [name isEqualToString: @"NotOpenStep"] == YES) - { - if (hadO == YES) - { - continue; - } - hadO = YES; - } - if ([name isEqualToString: @"MacOS-X"] == YES - || [name isEqualToString: @"NotMacOS-X"] == YES) - { - if (hadM == YES) - { - continue; - } - hadM = YES; - } - found = YES; [s appendFormat: @"<%@ />", name]; } - if (found == YES) - { - [s appendString: @""]; - [dict setObject: s forKey: @"Standards"]; - } + [s appendString: @""]; + [dict setObject: s forKey: @"Standards"]; } } @@ -2043,71 +1998,42 @@ fail: if ([directive isEqual: @"endif"] == YES) { - unsigned c = [ifStack count]; - - if (c == 0) + if ([ifStack count] <= 1) { [self log: @"Unexpected #endif (no matching #if)"]; } else { - [ifStack removeObjectAtIndex: c - 1]; + [ifStack removeLastObject]; } } else if ([directive isEqual: @"elif"] == YES) { - unsigned c = [ifStack count]; - - if (c == 0) + if ([ifStack count] <= 1) { [self log: @"Unexpected #else (no matching #if)"]; } else { - [ifStack replaceObjectAtIndex: c - 1 withObject: @""]; + [ifStack removeLastObject]; + [ifStack addObject: [ifStack lastObject]]; } } else if ([directive isEqual: @"else"] == YES) { - unsigned c = [ifStack count]; - - if (c == 0) + if ([ifStack count] <= 1) { [self log: @"Unexpected #else (no matching #if)"]; } else { - NSString *item = [ifStack objectAtIndex: --c]; - - if ([item isEqual: @"GNUstep"] == YES) - { - [ifStack replaceObjectAtIndex: c withObject: @"NotGNUstep"]; - } - else if ([item isEqual: @"NotGNUstep"] == YES) - { - [ifStack replaceObjectAtIndex: c withObject: @"GNUstep"]; - } - else if ([item isEqual: @"OpenStep"] == YES) - { - [ifStack replaceObjectAtIndex: c withObject: @"NotOpenStep"]; - } - else if ([item isEqual: @"NotOpenStep"] == YES) - { - [ifStack replaceObjectAtIndex: c withObject: @"OpenStep"]; - } - else if ([item isEqual: @"MacOS-X"] == YES) - { - [ifStack replaceObjectAtIndex: c withObject: @"NotMacOS-X"]; - } - else if ([item isEqual: @"NotMacOS-X"] == YES) - { - [ifStack replaceObjectAtIndex: c withObject: @"MacOS-X"]; - } + [ifStack removeLastObject]; + [ifStack addObject: [ifStack lastObject]]; } } else if ([directive isEqual: @"if"] == YES) { - [ifStack addObject: @""]; + [ifStack addObject: [ifStack lastObject]]; } else if ([directive hasPrefix: @"if"] == YES) { @@ -2119,43 +2045,51 @@ fail: } if (pos < length && buffer[pos] != '\n') { - NSString *arg = [self parseIdentifier]; - NSString *val = @""; + NSMutableSet *set = [[ifStack lastObject] mutableCopy]; + NSString *arg = [self parseIdentifier]; if ([arg isEqual: @"NO_GNUSTEP"] == YES) { if (isIfDef == YES) { - val = @"NotGNUstep"; + [self log: @"Unexpected #ifdef NO_GNUSTEP (nonsense)"]; } else { - val = @"GNUstep"; + [set removeObject: @"MacOS-X"]; + [set addObject: @"NotMacOS-X"]; + [set removeObject: @"OpenStep"]; + [set addObject: @"NotOpenStep"]; } } else if ([arg isEqual: @"STRICT_MACOS_X"] == YES) { if (isIfDef == YES) { - val = @"MacOS-X"; + [set removeObject: @"NotMacOS-X"]; + [set addObject: @"MacOS-X"]; } else { - val = @"NotMacOS-X"; + [set removeObject: @"MacOS-X"]; + [set addObject: @"NotMacOS-X"]; } } else if ([arg isEqual: @"STRICT_OPENSTEP"] == YES) { if (isIfDef == YES) { - val = @"OpenStep"; + [set removeObject: @"NotOpenStep"]; + [set addObject: @"OpenStep"]; } else { - val = @"NotOpenStep"; + [set removeObject: @"OpenStep"]; + [set addObject: @"NotOpenStep"]; } } - [ifStack addObject: val]; + [ifStack addObject: set]; + RELEASE(set); } } }