Various minor tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11901 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-12-26 11:32:46 +00:00
parent e0929789e3
commit 546773b804
3 changed files with 291 additions and 191 deletions

View file

@ -1,3 +1,11 @@
2001-12-26 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/autogsdoc.m: Add options for better control of index file and
turning off dependency checking (for slightly more efficient running
under make). Also added flag to enable/disable html generation.
* Tools/AGSHtml.m: Fix a few errors in achnors and links to document
titles.
2001-12-22 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/autogsdoc.m: Fix bug in handling args introduceed by last

View file

@ -629,9 +629,9 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"<br />\n"];
[buf appendString: indent];
[buf appendString: @"<h1>"];
[buf appendFormat: @"<h1><a name=\"title$%@\">", base];
[self outputText: [children children] to: buf];
[buf appendString: @"</h1>\n"];
[buf appendString: @"</a></h1>\n"];
[buf appendString: indent];
[buf appendString: @"<h3>Authors</h3>\n"];
@ -817,18 +817,17 @@ static NSMutableSet *textNodes = nil;
{
NSString *ref = [a objectAtIndex: i];
NSString *file = [dict objectForKey: ref];
NSString *text = ref;
/*
* Special case ... title listings are done in reverse
* order, with the name of the file being the unique key
* Special case ... title listings are done
* with the name of the file being the unique key
* and the value being the title string.
*/
if ([type isEqual: @"title"] == YES)
{
NSString *tmp = ref;
ref = file;
file = tmp;
text = file;
file = ref;
if ([file isEqual: base] == YES)
{
continue; // Don't list current file.
@ -838,7 +837,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: indent];
[buf appendFormat:
@"<li><a href=\"%@.html#%@$%@\">%@</a></li>\n",
file, type, ref, ref];
file, type, ref, text];
}
}

View file

@ -179,6 +179,11 @@
supplied as command-line arguments as usual) -
</p>
<list>
<item><strong>AutoIndex</strong>
A boolean value which may be used to specify that the program should
generate an index file for the project automatically. This defaults
to NO.
</item>
<item><strong>Declared</strong>
Specify where headers are to be documented as being found.<br />
The actual name produced in the documentation is formed by appending
@ -197,11 +202,21 @@
documentation is to be placed. If this is not set, output
is placed in the current directory.
</item>
<item><strong>GenerateHtml</strong>
May be used to specify if HTML output is to be generated.
Defaults to YES.
</item>
<item><strong>HeaderDirectory</strong>
May be used to specify the directory to be searched for header files.
If this is not specified, headers are looked for relative to the
current directory or using absolute path names if given.
</item>
<item><strong>IgnoreDependencies</strong>
A boolean value which may be used to specify that the program should
ignore file modification times and regenerate files anyway. Provided
for use in conjunction with the <code>make</code> system, which is
expected to manage dependency checking itsself.
</item>
<item><strong>LocalProjects</strong>
This value is used to control the automatic inclusion of local
external projects into the indexing system for generation of
@ -258,9 +273,22 @@
file was found, otherwise it is used as a prefix to the name in
the index.
</item>
<item><strong>Up</strong>
A string used to supply the name to be used in the 'up' link from
generated gsdoc documents. This should normally be the name of a
file which contains an index of the contents of a project.<br />
If this is explicitly set to an empty string, then no 'up' link
will be provided in the documents.
</item>
</list>
<section>
<heading>Inter-document linkage</heading>
<p>
Normally, the 'Up' default is used to specify the name of a document
which should be used as the 'up' link for any other documents used.
However, if this default is omitted, the tool will make certain
assumptions about linkage as follows -
</p>
<p>
If the first file listed on the command line is a gsdoc document,
it will be assumed to be the 'top' document and will be referenced
@ -270,7 +298,7 @@
</p>
<p>
Where autogsdoc is used with only a single file name, the
above linkage is <em>not</em> set up.
above assumed linkage is <em>not</em> set up.
</p>
</section>
</chapter>
@ -300,6 +328,7 @@ main(int argc, char **argv, char **env)
NSString *headerDirectory;
NSString *sourceDirectory;
NSString *project;
NSString *up;
NSString *refsFile;
NSString *systemProjects;
NSString *localProjects;
@ -307,8 +336,11 @@ main(int argc, char **argv, char **env)
AGSIndex *indexer;
AGSParser *parser;
AGSOutput *output;
NSString *up = nil;
BOOL showDependencies = YES;
id obj;
BOOL generateHtml = YES;
BOOL ignoreDependencies = NO;
BOOL showDependencies = NO;
BOOL autoIndex = NO;
BOOL modifiedRefs = NO;
NSDate *rDate = nil;
NSMutableArray *files = nil;
@ -326,9 +358,32 @@ main(int argc, char **argv, char **env)
@"Untitled", @"Project",
nil]];
autoIndex = [defs boolForKey: @"AutoIndex"];
ignoreDependencies = [defs boolForKey: @"IgnoreDependencies"];
showDependencies = [defs boolForKey: @"ShowDependencies"];
if (ignoreDependencies == YES)
{
if (showDependencies == YES)
{
showDependencies = NO;
NSLog(@"ShowDependencies(YES) used with IgnoreDependencies(YES)");
}
}
obj = [defs objectForKey: @"GenerateHtml"];
if (obj != nil)
{
generateHtml = [defs boolForKey: @"GenerateHtml"];
}
declared = [defs stringForKey: @"Declared"];
project = [defs stringForKey: @"Project"];
up = [defs stringForKey: @"Up"];
if ([up isEqual: @""] && autoIndex == YES)
{
autoIndex = NO;
NSLog(@"Up(\"\") used with AutoIndex(YES)");
}
localProjects = [defs stringForKey: @"LocalProjects"];
if (localProjects == nil)
@ -569,8 +624,8 @@ main(int argc, char **argv, char **env)
BOOL isSource = [arg hasSuffix: @".m"];
BOOL isDocumentation = [arg hasSuffix: @".gsdoc"];
NSDictionary *attrs;
NSDate *sDate;
NSDate *gDate;
NSDate *sDate = nil;
NSDate *gDate = nil;
if (pool != nil)
{
@ -602,6 +657,8 @@ main(int argc, char **argv, char **env)
gsdocfile = [ddir stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
if (ignoreDependencies == NO)
{
/*
* When were the files last modified?
*/
@ -620,56 +677,24 @@ main(int argc, char **argv, char **env)
AUTORELEASE(RETAIN(sDate));
}
}
}
if (up == nil && [files count] > 1)
{
/*
* If me have multiple files to process, we want one to point to all
* If we have multiple files to process, we want one to point to all
* the others and be an 'up' link for them ... if the first file is
* '.gsdoc' file, we assume it performs that indexing function,
* otherwise we generate an index.
* If there is only one file to process, we don't have an index file.
* otherwise we use a default name.
*/
if (i == 0 && [files count] > 1)
{
if (isDocumentation == YES)
{
ASSIGN(up, file);
}
else
{
NSString *upFile = [documentationDirectory
stringByAppendingPathComponent: @"index.gsdoc"];
if ([mgr isReadableFileAtPath: upFile] == NO)
{
NSString *upString = [NSString stringWithFormat:
@"<?xml version=\"1.0\"?>\n"
@"<!DOCTYPE gsdoc PUBLIC "
@"\"-//GNUstep//DTD gsdoc 0.6.7//EN\" "
@"\"http://www.gnustep.org/gsdoc-0_6_7.xml\">\n"
@"<gsdoc base=\"index\">\n"
@" <head>\n"
@" <title>%@ project reference</title>\n"
@" <author name=\"autogsdoc\"></author>\n"
@" </head>\n"
@" <body>\n"
@" <chapter>\n"
@" <heading>%@ project reference</heading>\n"
@" </chapter>\n"
@" <back>\n"
@" <index scope=\"project\" type=\"title\" />\n"
@" </back>\n"
@" </body>\n"
@"</gsdoc>\n",
project, project];
if ([upString writeToFile: upFile atomically: YES] == NO)
{
NSLog(@"Unable to write %@", upFile);
}
}
ASSIGN(up, @"index");
[files insertObject: upFile atIndex: 0];
i++; // Step past inserted auto-generated file.
autoIndex = YES; // Generate it if needed.
}
}
@ -679,9 +704,12 @@ main(int argc, char **argv, char **env)
* The file we are processing is not a gsdoc file ... so
* we need to try to generate the gsdoc from source code.
*/
if (ignoreDependencies == NO)
{
attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
gDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(gDate));
}
if (gDate == nil || [sDate earlierDate: gDate] == gDate)
{
@ -745,10 +773,12 @@ main(int argc, char **argv, char **env)
* Set up linkage for this file.
*/
[[parser info] setObject: file forKey: @"base"];
/*
* Only produce linkage if there are multiple files.
* Only produce linkage if the up link is not empty.
* Don't add an up link if this *is* the up link document.
*/
if ([files count] > 1)
if ([up length] > 0 && [up isEqual: file] == NO)
{
[[parser info] setObject: up forKey: @"up"];
}
@ -779,17 +809,20 @@ main(int argc, char **argv, char **env)
gsdocfile = [gsdocfile stringByAppendingPathExtension:
@"gsdoc"];
}
if (ignoreDependencies == NO)
{
attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
gDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(gDate));
}
}
/*
* Now we try to process the gsdoc data to make index info
* unless the project index is already more up to date than
* this file.
*/
if ([gDate earlierDate: rDate] == rDate)
if (gDate == nil || [gDate earlierDate: rDate] == rDate)
{
if (showDependencies == YES)
{
@ -832,13 +865,82 @@ main(int argc, char **argv, char **env)
}
}
}
/*
* Make sure auto-generation of index file is done.
*/
if (autoIndex == YES)
{
if ([files containsObject: up] == YES)
{
NSLog(@"AutoIndex(YES) set, but Up(%@) listed in source files", up);
}
else
{
NSString *upFile = documentationDirectory;
upFile = [upFile stringByAppendingPathComponent: up];
upFile = [upFile stringByAppendingPathExtension: @"gsdoc"];
if ([mgr isReadableFileAtPath: upFile] == NO)
{
NSString *upString = [NSString stringWithFormat:
@"<?xml version=\"1.0\"?>\n"
@"<!DOCTYPE gsdoc PUBLIC "
@"\"-//GNUstep//DTD gsdoc 0.6.7//EN\" "
@"\"http://www.gnustep.org/gsdoc-0_6_7.xml\">\n"
@"<gsdoc base=\"index\">\n"
@" <head>\n"
@" <title>%@ project reference</title>\n"
@" <author name=\"autogsdoc\"></author>\n"
@" </head>\n"
@" <body>\n"
@" <chapter>\n"
@" <heading>%@ project reference</heading>\n"
@" </chapter>\n"
@" <back>\n"
@" <index scope=\"project\" type=\"title\" />\n"
@" </back>\n"
@" </body>\n"
@"</gsdoc>\n",
project, project];
if ([upString writeToFile: upFile atomically: YES] == NO)
{
NSLog(@"Unable to write %@", upFile);
}
}
[files insertObject: upFile atIndex: 0];
}
}
DESTROY(up);
/*
* Save project references.
*/
if (modifiedRefs == YES)
{
if ([[prjRefs refs] writeToFile: refsFile atomically: YES] == NO)
{
NSLog(@"Sorry unable to write %@", refsFile);
}
}
RELEASE(pool);
if (generateHtml == YES)
{
/*
* Second pass ... generate html output from gsdoc files.
*/
pool = [NSAutoreleasePool new];
/*
* Accumulate project index info into global index
*/
[indexer mergeRefs: [prjRefs refs] override: YES];
RELEASE(pool);
pool = [NSAutoreleasePool new];
for (i = 0; i < [files count]; i++)
{
NSString *arg = [files objectAtIndex: i];
@ -848,8 +950,8 @@ main(int argc, char **argv, char **env)
NSString *file;
NSString *generated;
NSDictionary *attrs;
NSDate *gDate;
NSDate *hDate;
NSDate *gDate = nil;
NSDate *hDate = nil;
if (pool != nil)
{
@ -886,6 +988,8 @@ main(int argc, char **argv, char **env)
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
}
if (ignoreDependencies == NO)
{
/*
* When were the files last modified?
*/
@ -895,6 +999,7 @@ main(int argc, char **argv, char **env)
attrs = [mgr fileAttributesAtPath: htmlfile traverseLink: YES];
hDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(hDate));
}
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
{
@ -947,19 +1052,7 @@ main(int argc, char **argv, char **env)
gsdocfile);
}
}
RELEASE(pool);
DESTROY(up);
if (modifiedRefs == YES)
{
/*
* Save references.
*/
if ([[prjRefs refs] writeToFile: refsFile atomically: YES] == NO)
{
NSLog(@"Sorry unable to write %@", refsFile);
}
}
RELEASE(outer);