mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Improve merging of indexes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11762 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
59c444170d
commit
d4e85e0de0
4 changed files with 38 additions and 16 deletions
|
@ -1,5 +1,7 @@
|
|||
2001-12-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/AGSIndex.h: improve merge control
|
||||
* Tools/AGSIndex.m: ditto
|
||||
* Tools/AGSHtml.h: new methods for cleaner indexing.
|
||||
* Tools/AGSHtml.m: new methods for cleaner indexing.
|
||||
* Tools/AGSParser.m: minor bugfixes.
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
- (NSString*) globalRef: (NSString*)ref type: (NSString*)type;
|
||||
- (void) makeRefs: (GSXMLNode*)node;
|
||||
- (void) mergeRefs: (NSDictionary*)more;
|
||||
- (void) mergeRefs: (NSDictionary*)more override: (BOOL)flag;
|
||||
- (NSMutableDictionary*) refs;
|
||||
- (void) setDirectory: (NSString*)path;
|
||||
- (void) setGlobalRef: (NSString*)ref type: (NSString*)type;
|
||||
|
|
|
@ -28,7 +28,7 @@ static int XML_ELEMENT_NODE;
|
|||
static int XML_TEXT_NODE;
|
||||
|
||||
static void
|
||||
mergeDictionaries(NSMutableDictionary *dst, NSDictionary *src)
|
||||
mergeDictionaries(NSMutableDictionary *dst, NSDictionary *src, BOOL override)
|
||||
{
|
||||
static NSMutableArray *stack = nil;
|
||||
NSEnumerator *e = [src keyEnumerator];
|
||||
|
@ -64,20 +64,35 @@ mergeDictionaries(NSMutableDictionary *dst, NSDictionary *src)
|
|||
}
|
||||
if (d != nil)
|
||||
{
|
||||
if ([d isKindOfClass: [s class]] == NO)
|
||||
if ([d isKindOfClass: [NSString class]] == YES)
|
||||
{
|
||||
NSLog(@"Class missmatch in merge for %@", stack);
|
||||
}
|
||||
else if ([d isKindOfClass: [NSString class]] == YES)
|
||||
{
|
||||
if ([d isEqual: s] == NO)
|
||||
if ([s isKindOfClass: [NSString class]] == NO)
|
||||
{
|
||||
NSLog(@"String missmatch in merge for %@", stack);
|
||||
NSLog(@"Class missmatch in merge for %@.", stack);
|
||||
}
|
||||
else if ([d isEqual: s] == NO)
|
||||
{
|
||||
if (override == YES)
|
||||
{
|
||||
[dst setObject: s forKey: k];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"String missmatch in merge for %@. S:%@, D:%@",
|
||||
stack, s, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([d isKindOfClass: [NSDictionary class]] == YES)
|
||||
{
|
||||
mergeDictionaries(d, s);
|
||||
if ([s isKindOfClass: [NSDictionary class]] == NO)
|
||||
{
|
||||
NSLog(@"Class missmatch in merge for %@.", stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
mergeDictionaries(d, s, override);
|
||||
}
|
||||
}
|
||||
}
|
||||
[stack removeLastObject];
|
||||
|
@ -329,9 +344,14 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
|
|||
}
|
||||
}
|
||||
|
||||
- (void) mergeRefs: (NSDictionary*)more
|
||||
/**
|
||||
* Merge a dictionary containing references into the current
|
||||
* index. The flag may be used to specify that references
|
||||
* being merged in should override any pre-existing values.
|
||||
*/
|
||||
- (void) mergeRefs: (NSDictionary*)more override: (BOOL)flag
|
||||
{
|
||||
mergeDictionaries(refs, more);
|
||||
mergeDictionaries(refs, more, flag);
|
||||
}
|
||||
|
||||
- (NSMutableDictionary*) refs
|
||||
|
|
|
@ -438,7 +438,7 @@ main(int argc, char **argv, char **env)
|
|||
NSString *p;
|
||||
|
||||
tmp = [AGSIndex new];
|
||||
[tmp mergeRefs: dict];
|
||||
[tmp mergeRefs: dict override: NO];
|
||||
RELEASE(dict);
|
||||
/*
|
||||
* Adjust path to external project files ...
|
||||
|
@ -449,7 +449,7 @@ main(int argc, char **argv, char **env)
|
|||
p = [k stringByDeletingLastPathComponent];
|
||||
}
|
||||
[tmp setDirectory: p];
|
||||
[indexer mergeRefs: [tmp refs]];
|
||||
[indexer mergeRefs: [tmp refs] override: NO];
|
||||
RELEASE(tmp);
|
||||
}
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ main(int argc, char **argv, char **env)
|
|||
/*
|
||||
* accumulate index info in project references
|
||||
*/
|
||||
[prjRefs mergeRefs: [locRefs refs]];
|
||||
[prjRefs mergeRefs: [locRefs refs] override: NO];
|
||||
}
|
||||
else if (isDocumentation)
|
||||
{
|
||||
|
@ -681,7 +681,7 @@ main(int argc, char **argv, char **env)
|
|||
/*
|
||||
* accumulate project index info into global index
|
||||
*/
|
||||
[indexer mergeRefs: [prjRefs refs]];
|
||||
[indexer mergeRefs: [prjRefs refs] override: YES];
|
||||
|
||||
for (i = 1; i < [args count]; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue