Add support for 'index' element

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11803 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-12-18 09:31:32 +00:00
parent 85f10b4970
commit 7fd91d3b48
6 changed files with 90 additions and 2 deletions

View file

@ -1,7 +1,10 @@
2001-12-18 Richard Frith-Macdonald <rfm@gnu.org> 2001-12-18 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gsdoc-0_6_7.dtd: add scope to index element
* Tools/AGSHtml.h:
* Tools/AGSHtml.m: Output tidyups and general format improvements. * 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 * Tools/autogsdoc.m: Clean up a little and handle gsdoc files
listed as source files better .... now looks for them in the listed as source files better .... now looks for them in the
source directory. source directory.

View file

@ -1470,7 +1470,7 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctx)
NSString *file; NSString *file;
xmlParserInputPtr ret = 0; xmlParserInputPtr ret = 0;
NSString *entityId; NSString *entityId;
NSString *location ; NSString *location;
NSArray *components; NSArray *components;
NSMutableString *local; NSMutableString *local;
unsigned count; unsigned count;
@ -1601,6 +1601,10 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctx)
{ {
ret = xmlNewInputFromFile(ctx, [file fileSystemRepresentation]); ret = xmlNewInputFromFile(ctx, [file fileSystemRepresentation]);
} }
else
{
NSLog(@"don't know how to load entity '%s' id '%s'", url, eid);
}
return ret; return ret;
} }

View file

@ -28,6 +28,7 @@
{ {
AGSIndex *localRefs; AGSIndex *localRefs;
AGSIndex *globalRefs; AGSIndex *globalRefs;
AGSIndex *projectRefs;
NSMutableString *indent; NSMutableString *indent;
NSString *base; // Not retained NSString *base; // Not retained
NSString *unit; // Not retained NSString *unit; // Not retained
@ -64,6 +65,7 @@
- (NSString*) protocolRef: (NSString*)t; - (NSString*) protocolRef: (NSString*)t;
- (void) setGlobalRefs: (AGSIndex*)r; - (void) setGlobalRefs: (AGSIndex*)r;
- (void) setLocalRefs: (AGSIndex*)r; - (void) setLocalRefs: (AGSIndex*)r;
- (void) setProjectRefs: (AGSIndex*)r;
- (NSString*) typeRef: (NSString*)t; - (NSString*) typeRef: (NSString*)t;
@end @end
#endif #endif

View file

@ -78,6 +78,7 @@ static NSMutableSet *textNodes = nil;
{ {
RELEASE(globalRefs); RELEASE(globalRefs);
RELEASE(localRefs); RELEASE(localRefs);
RELEASE(projectRefs);
RELEASE(indent); RELEASE(indent);
[super dealloc]; [super dealloc];
} }
@ -750,6 +751,73 @@ static NSMutableSet *textNodes = nil;
[buf appendString: heading]; [buf appendString: heading];
[buf appendString: @">\n"]; [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: @"<hr />\n"];
[buf appendString: indent];
[buf appendFormat: @"<b>%@ index</b>\n",
[type capitalizedString]];
[buf appendString: indent];
[buf appendString: @"<ul>\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:
@"<li><a href=\"%@.html#%@%@\">%@ in %@</a></li>\n",
file, u, ref, ref, u];
}
}
else
{
NSString *ref = [a objectAtIndex: i];
NSString *file = [dict objectForKey: ref];
[buf appendString: indent];
[buf appendFormat:
@"<li><a href=\"%@.html#%@$%@\">%@</a></li>\n",
file, type, ref, ref];
}
}
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</ul>\n"];
}
}
else if ([name isEqual: @"ivar"] == YES) // %phrase else if ([name isEqual: @"ivar"] == YES) // %phrase
{ {
[buf appendString: @"<var>"]; [buf appendString: @"<var>"];
@ -1476,6 +1544,11 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
ASSIGN(localRefs, r); ASSIGN(localRefs, r);
} }
- (void) setProjectRefs: (AGSIndex*)r
{
ASSIGN(projectRefs, r);
}
/** /**
* Assuming that the supplied string contains type information (as used * Assuming that the supplied string contains type information (as used
* in a method declaration or type cast), we make an attempt at extracting * in a method declaration or type cast), we make an attempt at extracting

View file

@ -276,6 +276,10 @@
</p> </p>
</section> </section>
</chapter> </chapter>
<back>
<index type="class" scope="project" />
<index type="method" scope="project" />
</back>
*/ */
#include <config.h> #include <config.h>
@ -842,6 +846,7 @@ main(int argc, char **argv, char **env)
*/ */
html = AUTORELEASE([AGSHtml new]); html = AUTORELEASE([AGSHtml new]);
[html setGlobalRefs: indexer]; [html setGlobalRefs: indexer];
[html setProjectRefs: prjRefs];
[html setLocalRefs: locRefs]; [html setLocalRefs: locRefs];
generated = [html outputDocument: [[parser doc] root]]; generated = [html outputDocument: [[parser doc] root]];
if ([generated writeToFile: htmlfile atomically: YES] == NO) if ([generated writeToFile: htmlfile atomically: YES] == NO)

View file

@ -489,6 +489,7 @@
<!ELEMENT index EMPTY> <!ELEMENT index EMPTY>
<!ATTLIST index <!ATTLIST index
type (class | protocol | method | ivariable | function | type | macro | variable | constant | label) "label" type (class | protocol | method | ivariable | function | type | macro | variable | constant | label) "label"
scope (file | project) "file"
> >