diff --git a/ChangeLog b/ChangeLog index f85f4d0e0..9aa870be5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2002-01-08 Richard Frith-Macdonald + + * Tools/AGSHtml.h: + * Tools/AGSHtml.m: + * Tools/AGSIndex.h: + * Tools/AGSIndex.m: + * Tools/AGSOutput.h: + * Tools/AGSOutput.m: + * Tools/AGSParser.h: + * Tools/AGSParser.m: + * Tools/autogsdoc.m: + * Tools/gsdoc-0_6_7.dtd: + Updated for several changes ... + Support documentation of instance variables + Index class and category method names identically + Extend index to have a listing of methods by unit + Extend index to have a listing of ivariablese by class + Use new extensions to double speed of generation of method + indexes for classes. + 2002-01-07 Adam Fedor * Version: 1.1.0 diff --git a/Tools/AGSHtml.h b/Tools/AGSHtml.h index 7c96c3f3c..4a703de6c 100644 --- a/Tools/AGSHtml.h +++ b/Tools/AGSHtml.h @@ -32,6 +32,8 @@ NSMutableString *indent; NSString *base; // Not retained NSString *unit; // Not retained + NSString *category; // Not retained + NSString *classname; // Not retained NSString *heading; // Not retained NSString *nextFile; // Not retained NSString *prevFile; // Not retained diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index c5c11178c..2ac38ca63 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -193,11 +193,25 @@ static NSMutableSet *textNodes = nil; } else if (u == nil) { - u = unit; + if (category == nil) + { + u = unit; + } + else + { + u = classname; + } s = [localRefs unitRef: r type: t unit: &u]; if (s == nil) { - u = unit; + if (category == nil) + { + u = unit; + } + else + { + u = classname; + } s = [globalRefs unitRef: r type: t unit: &u]; } } @@ -264,65 +278,127 @@ static NSMutableSet *textNodes = nil; title: (NSString*)title to: (NSMutableString*)buf { - NSDictionary *dict = [localRefs refs]; + NSDictionary *refs = [localRefs refs]; + NSDictionary *dict; + NSArray *a; + unsigned c; + unsigned i; if (globalRefs != nil && [scope isEqual: @"global"] == YES) { - dict = [globalRefs refs]; + refs = [globalRefs refs]; } else if (projectRefs != nil && [scope isEqual: @"project"] == YES) { - dict = [projectRefs refs]; + refs = [projectRefs refs]; } - dict = [dict objectForKey: type]; - if ([dict count] > 1 - || ([dict count] > 0 && [type isEqual: @"title"] == NO)) + if ([type isEqualToString: @"method"] == YES) + { + if (unit == nil) + { + refs = nil; // Can't index methods outside a unit. + } + dict = [refs objectForKey: @"unitmethods"]; + dict = [dict objectForKey: unit]; + } + else if ([type isEqualToString: @"ivariable"] == YES) + { + if (unit == nil) + { + refs = nil; // Can't index instance variables outside a class. + } + dict = [refs objectForKey: @"classvars"]; + dict = [dict objectForKey: unit]; + } + else + { + dict = [refs objectForKey: type]; + } + + if ([dict count] > 1 && [type isEqual: @"title"] == YES) + { + [buf appendString: indent]; + [buf appendFormat: @"%@\n", title]; + [buf appendString: indent]; + [buf appendString: @"\n"]; + } + else if ([dict count] > 0) { - NSArray *a = [dict allKeys]; - unsigned c = [a count]; - NSMutableSet *unitNames = nil; - unsigned i; NSString *sep = @""; + NSString *u = unit; BOOL isInUnit = NO; - if ([type isEqual: @"method"] || [type isEqual: @"ivariable"]) + if (unit != nil) { - isInUnit = YES; - if ([type isEqual: @"ivariable"]) + if ([type isEqual: @"method"] || [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) + isInUnit = YES; + if ([type isEqual: @"ivariable"]) { - NSArray *categoryNames; - unsigned l = [unit length]; + sep = @"*"; // List ivars in class + } + else if (category != nil) + { + u = classname; // List methods in category + } + else if (classname != nil) + { + NSArray *catNames; - categoryNames = [[dict objectForKey: @"category"] allKeys]; - i = [categoryNames count]; - while (i-- > 0) + /* + * For a clss, we want to list methods in any associated + * categories as well as those of the class itsself. + */ + catNames = [[[refs objectForKey: @"categories"] + objectForKey: classname] allKeys]; + if ((c = [catNames count]) > 0) { - NSString *n = [categoryNames objectAtIndex: i]; + NSMutableDictionary *m = [dict mutableCopy]; + NSDictionary *unitDict; - if ([n hasPrefix: unit] == YES && [n length] > l - && [n characterAtIndex: i] == '(') + unitDict = [refs objectForKey: @"unitmethods"]; + for (i = 0; i < c; i++) { - [unitNames addObject: n]; + NSString *catName = [catNames objectAtIndex: i]; + NSDictionary *catDict; + + catName = [classname stringByAppendingFormat: @"(%@)", + catName]; + catDict = [unitDict objectForKey: catName]; + [m addEntriesFromDictionary: catDict]; } + dict = AUTORELEASE(m); } } } } - a = [a sortedArrayUsingSelector: @selector(compare:)]; [buf appendString: indent]; [buf appendFormat: @"%@\n", title]; @@ -330,75 +406,25 @@ static NSMutableSet *textNodes = nil; [buf appendString: @"