From 7fd91d3b48d06f176fe283b50aa8016b98f65898 Mon Sep 17 00:00:00 2001
From: CaS
Date: Tue, 18 Dec 2001 09:31:32 +0000
Subject: [PATCH] Add support for 'index' element
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11803 72102866-910b-0410-8b05-ffd578937521
---
ChangeLog | 5 ++-
Source/GSXML.m | 6 +++-
Tools/AGSHtml.h | 2 ++
Tools/AGSHtml.m | 73 +++++++++++++++++++++++++++++++++++++++++++
Tools/autogsdoc.m | 5 +++
Tools/gsdoc-0_6_7.dtd | 1 +
6 files changed, 90 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d055a5bf5..159c82742 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
2001-12-18 Richard Frith-Macdonald
+ * Tools/gsdoc-0_6_7.dtd: add scope to index element
+ * Tools/AGSHtml.h:
* Tools/AGSHtml.m: Output tidyups and general format improvements.
- Add lins to other documents in project.
+ Add links to other documents in project. Add support for 'index'
+ element with bioth file and project scope.
* Tools/autogsdoc.m: Clean up a little and handle gsdoc files
listed as source files better .... now looks for them in the
source directory.
diff --git a/Source/GSXML.m b/Source/GSXML.m
index 6b2d06d11..a18c22abe 100644
--- a/Source/GSXML.m
+++ b/Source/GSXML.m
@@ -1470,7 +1470,7 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctx)
NSString *file;
xmlParserInputPtr ret = 0;
NSString *entityId;
- NSString *location ;
+ NSString *location;
NSArray *components;
NSMutableString *local;
unsigned count;
@@ -1601,6 +1601,10 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctx)
{
ret = xmlNewInputFromFile(ctx, [file fileSystemRepresentation]);
}
+ else
+ {
+ NSLog(@"don't know how to load entity '%s' id '%s'", url, eid);
+ }
return ret;
}
diff --git a/Tools/AGSHtml.h b/Tools/AGSHtml.h
index 9621ea744..e8f041a92 100644
--- a/Tools/AGSHtml.h
+++ b/Tools/AGSHtml.h
@@ -28,6 +28,7 @@
{
AGSIndex *localRefs;
AGSIndex *globalRefs;
+ AGSIndex *projectRefs;
NSMutableString *indent;
NSString *base; // Not retained
NSString *unit; // Not retained
@@ -64,6 +65,7 @@
- (NSString*) protocolRef: (NSString*)t;
- (void) setGlobalRefs: (AGSIndex*)r;
- (void) setLocalRefs: (AGSIndex*)r;
+- (void) setProjectRefs: (AGSIndex*)r;
- (NSString*) typeRef: (NSString*)t;
@end
#endif
diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m
index 939d78e82..461f6e44d 100644
--- a/Tools/AGSHtml.m
+++ b/Tools/AGSHtml.m
@@ -78,6 +78,7 @@ static NSMutableSet *textNodes = nil;
{
RELEASE(globalRefs);
RELEASE(localRefs);
+ RELEASE(projectRefs);
RELEASE(indent);
[super dealloc];
}
@@ -750,6 +751,73 @@ static NSMutableSet *textNodes = nil;
[buf appendString: heading];
[buf appendString: @">\n"];
}
+ else if ([name isEqual: @"index"] == YES)
+ {
+ NSString *scope = [prop objectForKey: @"scope"];
+ NSString *type = [prop objectForKey: @"type"];
+ NSDictionary *dict = [localRefs refs];
+
+ if (projectRefs != nil && [scope isEqual: @"project"] == YES)
+ {
+ dict = [projectRefs refs];
+ }
+
+ dict = [dict objectForKey: type];
+ if ([dict count] > 0)
+ {
+ NSArray *a = [dict allKeys];
+ unsigned c = [a count];
+ unsigned i;
+
+ a = [a sortedArrayUsingSelector: @selector(compare:)];
+
+ [buf appendString: indent];
+ [buf appendString: @"
\n"];
+ [buf appendString: indent];
+ [buf appendFormat: @"%@ index\n",
+ [type capitalizedString]];
+ [buf appendString: indent];
+ [buf appendString: @"\n"];
+ [self incIndent];
+
+ for (i = 0; i < c; i++)
+ {
+ if ([type isEqual: @"method"] || [type isEqual: @"ivariable"])
+ {
+ NSString *ref = [a objectAtIndex: i];
+ NSDictionary *units = [dict objectForKey: ref];
+ NSArray *b = [units allKeys];
+ unsigned j;
+
+ b = [b sortedArrayUsingSelector: @selector(compare:)];
+ for (j = 0; j < [b count]; j++)
+ {
+ NSString *u = [b objectAtIndex: j];
+ NSString *file = [units objectForKey: u];
+
+ [buf appendString: indent];
+ [buf appendFormat:
+ @"- %@ in %@
\n",
+ file, u, ref, ref, u];
+ }
+ }
+ else
+ {
+ NSString *ref = [a objectAtIndex: i];
+ NSString *file = [dict objectForKey: ref];
+
+ [buf appendString: indent];
+ [buf appendFormat:
+ @"- %@
\n",
+ file, type, ref, ref];
+ }
+ }
+
+ [self decIndent];
+ [buf appendString: indent];
+ [buf appendString: @"
\n"];
+ }
+ }
else if ([name isEqual: @"ivar"] == YES) // %phrase
{
[buf appendString: @""];
@@ -1476,6 +1544,11 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
ASSIGN(localRefs, r);
}
+- (void) setProjectRefs: (AGSIndex*)r
+{
+ ASSIGN(projectRefs, r);
+}
+
/**
* Assuming that the supplied string contains type information (as used
* in a method declaration or type cast), we make an attempt at extracting
diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m
index 4cffa0103..fbd6c22d8 100644
--- a/Tools/autogsdoc.m
+++ b/Tools/autogsdoc.m
@@ -276,6 +276,10 @@
+
+
+
+
*/
#include
@@ -842,6 +846,7 @@ main(int argc, char **argv, char **env)
*/
html = AUTORELEASE([AGSHtml new]);
[html setGlobalRefs: indexer];
+ [html setProjectRefs: prjRefs];
[html setLocalRefs: locRefs];
generated = [html outputDocument: [[parser doc] root]];
if ([generated writeToFile: htmlfile atomically: YES] == NO)
diff --git a/Tools/gsdoc-0_6_7.dtd b/Tools/gsdoc-0_6_7.dtd
index 5fbe33c70..929a500be 100644
--- a/Tools/gsdoc-0_6_7.dtd
+++ b/Tools/gsdoc-0_6_7.dtd
@@ -489,6 +489,7 @@