Varuious tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11799 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-12-18 06:48:20 +00:00
parent 0d425b4731
commit e4a156fde5
3 changed files with 215 additions and 72 deletions

View file

@ -1,3 +1,11 @@
2001-12-18 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSHtml.m: Output tidyups and general format improvements.
Add lins to other documents in project.
* Tools/autogsdoc.m: Clean up a little and handle gsdoc files
listed as source files better .... now looks for them in the
source directory.
2001-12-17 Richard Frith-Macdonald <rfm@gnu.org> 2001-12-17 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/gnustep/base/GSMime.h: Updates for autogsdoc * Headers/gnustep/base/GSMime.h: Updates for autogsdoc

View file

@ -282,7 +282,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"<html>\n"]; [buf appendString: @"<html>\n"];
[self incIndent]; [self incIndent];
[self outputNodeList: [node children] to: buf]; [self outputNodeList: node to: buf];
[self decIndent]; [self decIndent];
[buf appendString: @"</html>\n"]; [buf appendString: @"</html>\n"];
@ -316,6 +316,25 @@ static NSMutableSet *textNodes = nil;
{ {
/* Should already be in html body */ /* Should already be in html body */
[self outputNodeList: children to: buf]; [self outputNodeList: children to: buf];
[buf appendString: indent];
[buf appendString: @"<br />\n"];
if (prevFile != nil)
{
[buf appendString: indent];
[buf appendFormat: @"<a href=\"%@\">Prev</a>\n", prevFile];
}
if (upFile != nil)
{
[buf appendString: indent];
[buf appendFormat: @"<a href=\"%@\">Up</a>\n", upFile];
}
if (nextFile != nil)
{
[buf appendString: indent];
[buf appendFormat: @"<a href=\"%@\">Next</a>\n", nextFile];
}
[self decIndent]; [self decIndent];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"</body>\n"]; [buf appendString: @"</body>\n"];
@ -388,7 +407,7 @@ static NSMutableSet *textNodes = nil;
unsigned l = 0; unsigned l = 0;
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<hr />\n"]; [buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<h3>Contents -</h3>\n"]; [buf appendString: @"<h3>Contents -</h3>\n"];
@ -465,7 +484,7 @@ static NSMutableSet *textNodes = nil;
l--; l--;
} }
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<hr />\n"]; [buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
} }
} }
else if ([name isEqual: @"desc"] == YES) else if ([name isEqual: @"desc"] == YES)
@ -562,7 +581,7 @@ static NSMutableSet *textNodes = nil;
} }
nextFile = [prop objectForKey: @"next"]; nextFile = [prop objectForKey: @"next"];
nextFile = [nextFile stringByAppendingPathExtension: @"html"]; nextFile = [nextFile stringByAppendingPathExtension: @"html"];
prevFile = [prop objectForKey: @"pref"]; prevFile = [prop objectForKey: @"prev"];
prevFile = [prevFile stringByAppendingPathExtension: @"html"]; prevFile = [prevFile stringByAppendingPathExtension: @"html"];
upFile = [prop objectForKey: @"up"]; upFile = [prop objectForKey: @"up"];
upFile = [upFile stringByAppendingPathExtension: @"html"]; upFile = [upFile stringByAppendingPathExtension: @"html"];
@ -586,6 +605,25 @@ static NSMutableSet *textNodes = nil;
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<body>\n"]; [buf appendString: @"<body>\n"];
[self incIndent]; [self incIndent];
if (prevFile != nil)
{
[buf appendString: indent];
[buf appendFormat: @"<a href=\"%@\">Prev</a>\n", prevFile];
}
if (upFile != nil)
{
[buf appendString: indent];
[buf appendFormat: @"<a href=\"%@\">Up</a>\n", upFile];
}
if (nextFile != nil)
{
[buf appendString: indent];
[buf appendFormat: @"<a href=\"%@\">Next</a>\n", nextFile];
}
[buf appendString: indent];
[buf appendString: @"<br />\n"];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<h1>"]; [buf appendString: @"<h1>"];
[self outputText: [children children] to: buf]; [self outputText: [children children] to: buf];
@ -854,7 +892,8 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
tmp = [node children]; tmp = [node children];
if (tmp != nil) if (tmp != nil)
{ {
[buf appendString: @"Standards:"]; [buf appendString: indent];
[buf appendString: @"<b>Standards:</b>"];
while (tmp != nil) while (tmp != nil)
{ {
[buf appendString: @" "]; [buf appendString: @" "];
@ -888,7 +927,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[self outputNode: node to: buf]; [self outputNode: node to: buf];
} }
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<hr />\n"]; [buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
} }
} }
else if ([name isEqual: @"p"] == YES) else if ([name isEqual: @"p"] == YES)
@ -1289,26 +1328,60 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
if (node != nil && [[node name] isEqual: @"declared"] == YES) if (node != nil && [[node name] isEqual: @"declared"] == YES)
{ {
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"Declared: "]; [buf appendString: @"<blockquote>\n"];
[self outputText: [node children] to: buf]; [self incIndent];
[buf appendString: @"<br />\n"];
node = [node next];
}
while (node != nil && [[node name] isEqual: @"conform"] == YES)
{
NSString *text = [[node children] content];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"Conform: "]; [buf appendString: @"<dl>\n"];
[buf appendString: [self protocolRef: text]]; [self incIndent];
[buf appendString: @"<br />\n"]; [buf appendString: indent];
[buf appendString: @"<dt><b>Declared in:</b></dt>\n"];
[buf appendString: indent];
[buf appendString: @"<dd>"];
[self outputText: [node children] to: buf];
[buf appendString: @"</dd>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</dl>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</blockquote>\n"];
node = [node next]; node = [node next];
} }
if (node != nil && [[node name] isEqual: @"conform"] == YES)
{
[buf appendString: indent];
[buf appendString: @"<blockquote>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<dl>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<dt><b>Conforms to:</b></dt>\n"];
while (node != nil && [[node name] isEqual: @"conform"] == YES)
{
NSString *text = [[node children] content];
[buf appendString: indent];
[buf appendString: @"<dd>"];
[buf appendString: [self protocolRef: text]];
[buf appendString: @"</dd>\n"];
node = [node next];
}
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</dl>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</blockquote>\n"];
}
if (node != nil && [[node name] isEqual: @"desc"] == YES) if (node != nil && [[node name] isEqual: @"desc"] == YES)
{ {
[self outputNode: node to: buf]; [self outputNode: node to: buf];
node = [node next]; node = [node next];
} }
a = [localRefs methodsInUnit: unit]; a = [localRefs methodsInUnit: unit];
if ([a count] > 0) if ([a count] > 0)
{ {
@ -1317,7 +1390,9 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[a sortUsingSelector: @selector(compare:)]; [a sortUsingSelector: @selector(compare:)];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<h2>Methods</h2>\n"]; [buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: indent];
[buf appendString: @"<h2>Method summary</h2>\n"];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<ul>\n"]; [buf appendString: @"<ul>\n"];
[self incIndent]; [self incIndent];
@ -1334,6 +1409,8 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[self decIndent]; [self decIndent];
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"</ul>\n"]; [buf appendString: @"</ul>\n"];
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
} }
while (node != nil && [[node name] isEqual: @"method"] == YES) while (node != nil && [[node name] isEqual: @"method"] == YES)
{ {
@ -1342,7 +1419,20 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
} }
if (node != nil && [[node name] isEqual: @"standards"] == YES) if (node != nil && [[node name] isEqual: @"standards"] == YES)
{ {
[self outputNode: node to: buf]; GSXMLNode *tmp = node;
if (tmp != nil)
{
[buf appendString: indent];
[buf appendString: @"<b>Standards:</b>"];
while (tmp != nil)
{
[buf appendString: @" "];
[buf appendString: [tmp name]];
tmp = [tmp next];
}
[buf appendString: @"<br />\n"];
}
node = [node next]; node = [node next];
} }
} }

View file

@ -238,8 +238,10 @@
on other files. on other files.
</item> </item>
<item><strong>SourceDirectory</strong> <item><strong>SourceDirectory</strong>
May be used to specify the directory to be searched for header files. May be used to specify the directory to be searched for source
If this is not specified, headers are looked for relative to the (anything other than <code>.h</code> files ... which are controlled
by the HeaderDirectory default).<br />
If this is not specified, sources are looked for relative to the
current directory or using absolute path names if given. current directory or using absolute path names if given.
</item> </item>
<item><strong>SystemProjects</strong> <item><strong>SystemProjects</strong>
@ -307,7 +309,6 @@ main(int argc, char **argv, char **env)
NSString *up = nil; NSString *up = nil;
NSString *prev = nil; NSString *prev = nil;
BOOL showDependencies = YES; BOOL showDependencies = YES;
id o;
CREATE_AUTORELEASE_POOL(outer); CREATE_AUTORELEASE_POOL(outer);
CREATE_AUTORELEASE_POOL(pool); CREATE_AUTORELEASE_POOL(pool);
@ -496,7 +497,7 @@ main(int argc, char **argv, char **env)
} }
else if ([arg hasSuffix: @".h"] == YES else if ([arg hasSuffix: @".h"] == YES
|| [arg hasSuffix: @".m"] == YES || [arg hasSuffix: @".m"] == YES
|| [arg hasSuffix: @".gsdoc"]== YES) || [arg hasSuffix: @".gsdoc"] == YES)
{ {
NSString *gsdocfile; NSString *gsdocfile;
NSString *hfile; NSString *hfile;
@ -560,61 +561,66 @@ main(int argc, char **argv, char **env)
AUTORELEASE(RETAIN(sDate)); AUTORELEASE(RETAIN(sDate));
} }
} }
attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
gDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(gDate));
if (gDate == nil || [sDate earlierDate: gDate] == gDate) if (isDocumentation == NO)
{ {
if (showDependencies == YES) /*
{ * The file we are processing is not a gsdoc file ... so
NSLog(@"%@: source %@, gsdoc %@ ==> regenerate", * we need to try to generate the gsdoc from source code.
file, sDate, gDate); */
} attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
[parser reset]; gDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(gDate));
if (isSource == NO && isDocumentation == NO) if (gDate == nil || [sDate earlierDate: gDate] == gDate)
{ {
/* if (showDependencies == YES)
* Try to parse header to see what needs documenting.
*/
if ([mgr isReadableFileAtPath: hfile] == NO)
{ {
NSLog(@"No readable header at '%@' ... skipping", NSLog(@"%@: source %@, gsdoc %@ ==> regenerate",
hfile); file, sDate, gDate);
continue; }
[parser reset];
if (isSource == NO)
{
/*
* Try to parse header to see what needs documenting.
*/
if ([mgr isReadableFileAtPath: hfile] == NO)
{
NSLog(@"No readable header at '%@' ... skipping",
hfile);
continue;
}
if (declared != nil)
{
[parser setDeclared:
[declared stringByAppendingPathComponent:
[hfile lastPathComponent]]];
}
[parser parseFile: hfile isSource: NO];
}
else if (isSource == YES)
{
/*
* Try to parse source *as-if-it-was-a-header*
* to see what needs documenting.
*/
if ([mgr isReadableFileAtPath: sfile] == NO)
{
NSLog(@"No readable source at '%@' ... skipping",
sfile);
continue;
}
if (declared != nil)
{
[parser setDeclared:
[declared stringByAppendingPathComponent:
[sfile lastPathComponent]]];
}
[parser parseFile: sfile isSource: NO];
} }
if (declared != nil)
{
[parser setDeclared:
[declared stringByAppendingPathComponent:
[hfile lastPathComponent]]];
}
[parser parseFile: hfile isSource: NO];
}
else if (isSource == YES)
{
/*
* Try to parse source *as-if-it-was-a-header*
* to see what needs documenting.
*/
if ([mgr isReadableFileAtPath: sfile] == NO)
{
NSLog(@"No readable source at '%@' ... skipping",
sfile);
continue;
}
if (declared != nil)
{
[parser setDeclared:
[declared stringByAppendingPathComponent:
[sfile lastPathComponent]]];
}
[parser parseFile: sfile isSource: NO];
}
if (isDocumentation == NO)
{
/* /*
* If we can read a source file, parse it for any * If we can read a source file, parse it for any
* additional information on items found in the header. * additional information on items found in the header.
@ -671,7 +677,24 @@ main(int argc, char **argv, char **env)
} }
} }
} }
else
{
/*
* Our source file is a gsdoc file ... so it may be located
* in the source (input) directory rather than the documentation
* (output) directory.
*/
if ([mgr isReadableFileAtPath: gsdocfile] == NO)
{
gsdocfile = [sdir stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension:
@"gsdoc"];
}
}
/*
* Now we try to process the gsdoc data to make index info.
*/
if ([mgr isReadableFileAtPath: gsdocfile] == YES) if ([mgr isReadableFileAtPath: gsdocfile] == YES)
{ {
GSXMLParser *parser; GSXMLParser *parser;
@ -751,6 +774,28 @@ main(int argc, char **argv, char **env)
htmlfile = [ddir stringByAppendingPathComponent: file]; htmlfile = [ddir stringByAppendingPathComponent: file];
htmlfile = [htmlfile stringByAppendingPathExtension: @"html"]; htmlfile = [htmlfile stringByAppendingPathExtension: @"html"];
/*
* If the gsdoc file name was specified as a source file,
* it may be in the source directory rather than the documentation
* directory.
*/
if ([mgr isReadableFileAtPath: gsdocfile] == NO
&& [arg hasSuffix: @".gsdoc"] == YES)
{
NSString *sdir = [arg stringByDeletingLastPathComponent];
if ([sdir length] == 0)
{
sdir = sourceDirectory;
}
else if ([sdir isAbsolutePath] == NO)
{
sdir = [sourceDirectory stringByAppendingPathComponent: sdir];
}
gsdocfile = [sdir stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
}
/* /*
* When were the files last modified? * When were the files last modified?
*/ */