add project authors in index

This commit is contained in:
rfm 2023-12-21 21:32:35 +00:00
parent 9acd9f8e76
commit 695b650d4a
3 changed files with 79 additions and 2 deletions

View file

@ -2,6 +2,8 @@
* Tools/AGSParser.m: Replace GS_GENERIC macros in method types etc
with the basic type name.
* Tools/AGSIndex.h:
* Tools/AGSIndex.m: Create index of all authors in the project
2023-12-09 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -42,6 +42,7 @@
unsigned ssect;
unsigned sssect;
}
- (NSDictionary*) authors;
- (NSArray*) find: (NSString*)key;
- (NSString*) globalRef: (NSString*)ref type: (NSString*)type;
- (void) makeRefs: (GSXMLNode*)node;
@ -50,6 +51,7 @@
- (NSArray*) methodsInUnit: (NSString*)aUnit;
- (NSMutableDictionary*) refs;
- (void) setDirectory: (NSString*)path;
- (void) setEmail: (NSString*)address forAuthor: (NSString*)name;
- (void) setGlobalRef: (NSString*)ref type: (NSString*)type;
- (void) setOutputs: (NSArray*)a forHeader: (NSString*)h;
- (void) setRelationship: (NSString*)r from: (NSString*)from to: (NSString*)to;

View file

@ -110,7 +110,23 @@ mergeDictionaries(NSMutableDictionary *dst, NSDictionary *src, BOOL override)
}
else if ([d isEqual: s] == NO)
{
if (override == YES)
if ([[stack firstObject] isEqualToString: @"author"])
{
NSMutableArray *m = AUTORELEASE([s mutableCopy]);
NSUInteger c = [d count];
while (c-- > 0)
{
NSString *e = [d objectAtIndex: c];
if (NO == [m containsObject: e])
{
[m addObject: e];
}
}
[dst setObject: m forKey: k];
}
else if (override == YES)
{
[dst setObject: s forKey: k];
}
@ -291,7 +307,32 @@ findKey(id refs, NSString *key, NSMutableArray *path, NSMutableArray *found)
[self setGlobalRef: base type: @"tool"];
}
if ([name isEqual: @"category"] == YES)
if ([name isEqual: @"author"] == YES)
{
NSString *author = [prop objectForKey: @"name"];
if ([author length] > 0)
{
GSXMLNode *tmp = [node firstChild];
[self setEmail: nil forAuthor: author];
while (tmp)
{
if ([[tmp name] isEqual: @"email"])
{
NSDictionary *prop = [tmp attributes];
name = [prop objectForKey: @"address"];
if ([name length] > 0)
{
[self setEmail: name forAuthor: author];
}
}
tmp = [tmp next];
}
}
}
else if ([name isEqual: @"category"] == YES)
{
newUnit = YES;
classname = [prop objectForKey: @"class"];
@ -597,6 +638,38 @@ findKey(id refs, NSString *key, NSMutableArray *path, NSMutableArray *found)
}
}
- (NSDictionary*) authors
{
return [refs objectForKey: @"author"];
}
/**
* Set up an array of email addresses for author.
*/
- (void) setEmail: (NSString*)address forAuthor: (NSString*)name
{
NSMutableDictionary *dict;
NSMutableArray *array;
dict = [refs objectForKey: @"author"];
if (dict == nil)
{
dict = [NSMutableDictionary new];
[refs setObject: dict forKey: @"author"];
RELEASE(dict);
}
if (nil == (array = [dict objectForKey: name]))
{
array = [NSMutableArray array];
[dict setObject: array forKey: name];
}
address = [address lowercaseString];
if (address != nil && NO == [array containsObject: address])
{
[array addObject: address];
}
}
- (void) setGlobalRef: (NSString*)ref
type: (NSString*)type
{