Remove automatic index file generation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11982 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-01-04 15:36:22 +00:00
parent bb57a81e5c
commit 8cf944f4b0
4 changed files with 306 additions and 350 deletions

View file

@ -1,3 +1,11 @@
2002-01-04 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/autogsdoc.m: Rearrange code somewhat and remove auto
generation of index and 'up' links ... now requires an explicit
-Up if you want one.
* Tools/GNUmakefile: Add -Up for documentation generation
* Source/GNUmakefile: ditto
Fri Jan 4 11:42:23 2002 Nicola Pero <n.pero@mi.flashnet.it> Fri Jan 4 11:42:23 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Tools/HTMLLinker.m: Implemented -FixupAllLinks, -PathMappings, * Tools/HTMLLinker.m: Implemented -FixupAllLinks, -PathMappings,

View file

@ -415,7 +415,8 @@ Base_AGSDOC_FILES = Base.gsdoc $(AUTOGSDOC_HEADERS)
Base_AGSDOC_FLAGS = \ Base_AGSDOC_FLAGS = \
-HeaderDirectory ../Headers/Foundation \ -HeaderDirectory ../Headers/Foundation \
-Declared Foundation \ -Declared Foundation \
-Standards YES -Standards YES \
-Up Base
-include Makefile.preamble -include Makefile.preamble

View file

@ -67,6 +67,7 @@ HTMLLinker_OBJC_FILES = HTMLLinker.m
DOCUMENT_NAME = autogsdoc DOCUMENT_NAME = autogsdoc
# Documentation rules for autogsdoc # Documentation rules for autogsdoc
autogsdoc_AGSDOC_FLAGS = -Up autogsdoc
autogsdoc_AGSDOC_FILES = autogsdoc.m \ autogsdoc_AGSDOC_FILES = autogsdoc.m \
AGSParser.h AGSOutput.h AGSIndex.h AGSHtml.h AGSParser.h AGSOutput.h AGSIndex.h AGSHtml.h
autogsdoc_DOC_INSTALL_DIR = Developer/Tools autogsdoc_DOC_INSTALL_DIR = Developer/Tools

View file

@ -179,11 +179,6 @@
supplied as command-line arguments as usual) - supplied as command-line arguments as usual) -
</p> </p>
<list> <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> <item><strong>Declared</strong>
Specify where headers are to be documented as being found.<br /> Specify where headers are to be documented as being found.<br />
The actual name produced in the documentation is formed by appending The actual name produced in the documentation is formed by appending
@ -285,29 +280,39 @@
A string used to supply the name to be used in the 'up' link from 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 generated gsdoc documents. This should normally be the name of a
file which contains an index of the contents of a project.<br /> 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 If this is missing or set to an empty string, then no 'up' link
will be provided in the documents. will be provided in the documents.
</item> </item>
</list> </list>
<section> <section>
<heading>Inter-document linkage</heading> <heading>Inter-document linkage</heading>
<p> <p>
Normally, the 'Up' default is used to specify the name of a document The 'Up' default is used to specify the name of a document which
which should be used as the 'up' link for any other documents used. should be used as the 'up' link for any other documents used.<br />
However, if this default is omitted, the tool will make certain This name must not include a path or extension.<br />
assumptions about linkage as follows - Generally, the document referred to by this default should be a
</p> hand-edited gsdoc document which should have a <em>back</em>
<p> section containing a project index. eg.
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
in the 'up' link for all subsequent documents.<br />
Otherwise, autogsdoc will generate an index file called 'index.gsdoc'
which will be used as the 'top' file.
</p>
<p>
Where autogsdoc is used with only a single file name, the
above assumed linkage is <em>not</em> set up.
</p> </p>
<example>
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.7//EN"
"http://www.gnustep.org/gsdoc-0_6_7.xml"&gt;
&lt;gsdoc base="index"&gt;
&lt;head&gt;
&lt;title&gt;My project reference&lt;/title&gt;
&lt;author name="my name"&gt;&lt;/author&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;chapter&gt;
&lt;heading&gt;My project reference&lt;/heading&gt;
&lt;/chapter&gt;
&lt;back&gt;
&lt;index scope="project" type="title" /&gt;
&lt;/back&gt;
&lt;/body&gt;
&lt;/gsdoc&gt;
</example>
</section> </section>
</chapter> </chapter>
<back> <back>
@ -331,30 +336,26 @@ main(int argc, char **argv, char **env)
unsigned i; unsigned i;
NSUserDefaults *defs; NSUserDefaults *defs;
NSFileManager *mgr; NSFileManager *mgr;
NSMutableDictionary *projects;
NSString *documentationDirectory; NSString *documentationDirectory;
NSString *declared; NSString *declared;
NSString *headerDirectory; NSString *headerDirectory;
NSString *sourceDirectory; NSString *sourceDirectory;
NSString *project; NSString *project;
NSString *up; NSDictionary *originalIndex;
NSString *refsFile;
NSString *systemProjects;
NSString *localProjects;
AGSIndex *projectRefs; AGSIndex *projectRefs;
AGSIndex *globalRefs; AGSIndex *globalRefs;
AGSParser *parser; NSDate *rDate = nil;
AGSOutput *output; NSString *refsFile;
id obj; id obj;
unsigned count;
BOOL generateHtml = YES; BOOL generateHtml = YES;
BOOL ignoreDependencies = NO; BOOL ignoreDependencies = NO;
BOOL showDependencies = NO; BOOL showDependencies = NO;
BOOL autoIndex = NO;
BOOL modifiedRefs = NO;
BOOL verbose = NO; BOOL verbose = NO;
NSDate *rDate = nil; NSArray *files;
NSMutableArray *files = nil; NSMutableArray *sFiles = nil; // Source
NSMutableArray *hFiles = nil; NSMutableArray *gFiles = nil; // GSDOC
NSMutableArray *hFiles = nil; // HTML
CREATE_AUTORELEASE_POOL(outer); CREATE_AUTORELEASE_POOL(outer);
CREATE_AUTORELEASE_POOL(pool); CREATE_AUTORELEASE_POOL(pool);
@ -376,7 +377,6 @@ main(int argc, char **argv, char **env)
@"Untitled", @"Project", @"Untitled", @"Project",
nil]]; nil]];
autoIndex = [defs boolForKey: @"AutoIndex"];
verbose = [defs boolForKey: @"Verbose"]; verbose = [defs boolForKey: @"Verbose"];
ignoreDependencies = [defs boolForKey: @"IgnoreDependencies"]; ignoreDependencies = [defs boolForKey: @"IgnoreDependencies"];
showDependencies = [defs boolForKey: @"ShowDependencies"]; showDependencies = [defs boolForKey: @"ShowDependencies"];
@ -397,25 +397,6 @@ main(int argc, char **argv, char **env)
declared = [defs stringForKey: @"Declared"]; declared = [defs stringForKey: @"Declared"];
project = [defs stringForKey: @"Project"]; 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)
{
localProjects = @"";
}
systemProjects = [defs stringForKey: @"SystemProjects"];
if (systemProjects == nil)
{
systemProjects = @"";
}
projects = [[defs dictionaryForKey: @"Projects"] mutableCopy];
AUTORELEASE(projects);
headerDirectory = [defs stringForKey: @"HeaderDirectory"]; headerDirectory = [defs stringForKey: @"HeaderDirectory"];
if (headerDirectory == nil) if (headerDirectory == nil)
@ -435,10 +416,6 @@ main(int argc, char **argv, char **env)
documentationDirectory = @""; documentationDirectory = @"";
} }
refsFile = [documentationDirectory stringByAppendingPathComponent: project];
refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"];
proc = [NSProcessInfo processInfo]; proc = [NSProcessInfo processInfo];
if (proc == nil) if (proc == nil)
{ {
@ -449,39 +426,40 @@ main(int argc, char **argv, char **env)
/* /*
* Build an array of files to be processed. * Build an array of files to be processed.
*/ */
files = AUTORELEASE([[proc arguments] mutableCopy]); files = [proc arguments];
sFiles = [NSMutableArray array];
gFiles = [NSMutableArray array];
hFiles = [NSMutableArray array]; hFiles = [NSMutableArray array];
[files removeObjectAtIndex: 0]; count = [files count];
for (i = 0; i < [files count]; i++) for (i = 1; i < count; i++)
{ {
NSString *arg = [files objectAtIndex: i]; NSString *arg = [files objectAtIndex: i];
if ([arg hasPrefix: @"-"]) if ([arg hasPrefix: @"-"] == YES)
{ {
// Skip this and next value ... it is a default. i++; // a default
[files removeObjectAtIndex: i];
[files removeObjectAtIndex: i];
i--;
} }
else if ([arg hasSuffix: @".h"] == NO else if ([arg hasSuffix: @".h"] == YES
&& [arg hasSuffix: @".m"] == NO || [arg hasSuffix: @".m"] == YES)
&& [arg hasSuffix: @".gsdoc"] == NO)
{ {
if ([arg hasSuffix: @".html"] == YES) [sFiles addObject: arg];
{ }
// Make a note of any html files found. else if ([arg hasSuffix: @".gsdoc"] == YES)
[hFiles addObject: [files objectAtIndex: i]]; {
} [gFiles addObject: arg];
else }
{ else if ([arg hasSuffix: @".html"] == YES)
// Skip this value ... not a known file type. {
NSLog(@"Unknown argument '%@' ... ignored", arg); [hFiles addObject: arg];
} }
[files removeObjectAtIndex: i]; else
i--; {
// Skip this value ... not a known file type.
NSLog(@"Unknown argument '%@' ... ignored", arg);
} }
} }
if ([files count] < 1 && [hFiles count] < 1)
if ([sFiles count] == 0 && [gFiles count] == 0 && [hFiles count] == 0)
{ {
NSLog(@"No filename arguments found ... giving up"); NSLog(@"No filename arguments found ... giving up");
return 1; return 1;
@ -489,135 +467,96 @@ main(int argc, char **argv, char **env)
mgr = [NSFileManager defaultManager]; mgr = [NSFileManager defaultManager];
globalRefs = [AGSIndex new]; count = [sFiles count];
parser = [AGSParser new]; if (count > 0)
if ([defs boolForKey: @"Standards"] == YES)
{ {
[parser setGenerateStandards: YES]; AGSParser *parser;
} AGSOutput *output;
output = [AGSOutput new]; NSString *up;
/* up = [defs stringForKey: @"Up"];
* Load any old project indexing information and determine when the
* indexing information was last updated (never ==> distant past)
*/
projectRefs = [AGSIndex new];
rDate = [NSDate distantPast];
if ([mgr isReadableFileAtPath: refsFile] == YES)
{
NSDictionary *dict;
dict = [[NSDictionary alloc] initWithContentsOfFile: refsFile]; pool = [NSAutoreleasePool new];
if (dict == nil)
{
NSLog(@"Unable to read project file '%@'", refsFile);
}
else
{
[projectRefs mergeRefs: dict override: NO];
RELEASE(dict);
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
rDate = [dict objectForKey: NSFileModificationDate];
}
}
pool = [NSAutoreleasePool new]; parser = [AGSParser new];
for (i = 0; i < [files count]; i++) output = [AGSOutput new];
{ if ([defs boolForKey: @"Standards"] == YES)
NSString *arg = [files objectAtIndex: i]; {
NSString *gsdocfile; [parser setGenerateStandards: YES];
NSString *hfile; }
NSString *sfile;
NSString *ddir;
NSString *hdir;
NSString *sdir;
NSString *file;
NSString *generated;
BOOL isSource = [arg hasSuffix: @".m"];
BOOL isDocumentation = [arg hasSuffix: @".gsdoc"];
NSDictionary *attrs;
NSDate *sDate = nil;
NSDate *gDate = nil;
if (pool != nil) for (i = 0; i < count; i++)
{ {
RELEASE(pool); NSString *arg = [sFiles objectAtIndex: i];
pool = [NSAutoreleasePool new]; NSString *gsdocfile;
} NSString *hfile;
file = [[arg lastPathComponent] stringByDeletingPathExtension]; NSString *sfile;
hdir = [arg stringByDeletingLastPathComponent]; NSString *hdir;
if ([hdir length] == 0) NSString *sdir;
{ NSString *file;
hdir = headerDirectory; NSString *generated;
sdir = sourceDirectory; NSDictionary *attrs;
} NSDate *sDate = nil;
else if ([hdir isAbsolutePath] == YES) NSDate *gDate = nil;
{
sdir = hdir;
}
else
{
sdir = [sourceDirectory stringByAppendingPathComponent: hdir];
hdir = [headerDirectory stringByAppendingPathComponent: hdir];
}
ddir = documentationDirectory;
hfile = [hdir stringByAppendingPathComponent: file]; if (pool != nil)
hfile = [hfile stringByAppendingPathExtension: @"h"];
sfile = [sdir stringByAppendingPathComponent: file];
sfile = [sfile stringByAppendingPathExtension: @"m"];
gsdocfile = [ddir stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
if (ignoreDependencies == NO)
{
/*
* When were the files last modified?
*/
attrs = [mgr fileAttributesAtPath: hfile traverseLink: YES];
sDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(sDate));
attrs = [mgr fileAttributesAtPath: sfile traverseLink: YES];
if (attrs != nil)
{ {
NSDate *d; RELEASE(pool);
pool = [NSAutoreleasePool new];
d = [attrs objectForKey: NSFileModificationDate];
if (sDate == nil || [d earlierDate: sDate] == sDate)
{
sDate = d;
AUTORELEASE(RETAIN(sDate));
}
} }
} file = [[arg lastPathComponent] stringByDeletingPathExtension];
hdir = [arg stringByDeletingLastPathComponent];
if (up == nil && [files count] > 1) if ([hdir length] == 0)
{
/*
* 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 use a default name.
*/
if (isDocumentation == YES)
{ {
ASSIGN(up, file); hdir = headerDirectory;
sdir = sourceDirectory;
}
else if ([hdir isAbsolutePath] == YES)
{
sdir = hdir;
} }
else else
{ {
ASSIGN(up, @"index"); sdir = [sourceDirectory stringByAppendingPathComponent: hdir];
autoIndex = YES; // Generate it if needed. hdir = [headerDirectory stringByAppendingPathComponent: hdir];
} }
}
if (isDocumentation == NO) sfile = [sdir stringByAppendingPathComponent: file];
{ sfile = [sfile stringByAppendingPathExtension: @"m"];
/* if ([arg hasSuffix: @".m"] == YES)
* The file we are processing is not a gsdoc file ... so {
* we need to try to generate the gsdoc from source code. hfile = sfile;
*/ }
else
{
hfile = [hdir stringByAppendingPathComponent: file];
hfile = [hfile stringByAppendingPathExtension: @"h"];
}
gsdocfile = [documentationDirectory
stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
if (ignoreDependencies == NO) if (ignoreDependencies == NO)
{ {
/*
* When were the files last modified?
*/
attrs = [mgr fileAttributesAtPath: hfile traverseLink: YES];
sDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(sDate));
attrs = [mgr fileAttributesAtPath: sfile traverseLink: YES];
if (attrs != nil)
{
NSDate *d;
d = [attrs objectForKey: NSFileModificationDate];
if (sDate == nil || [d earlierDate: sDate] == sDate)
{
sDate = d;
AUTORELEASE(RETAIN(sDate));
}
}
attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES]; attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
gDate = [attrs objectForKey: NSFileModificationDate]; gDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(gDate)); AUTORELEASE(RETAIN(gDate));
@ -632,45 +571,23 @@ main(int argc, char **argv, char **env)
} }
[parser reset]; [parser reset];
if (isSource == NO) /*
* Try to parse header to see what needs documenting.
* If the header given was actually a .m file, this will
* parse that file for declarations rather than definitions.
*/
if ([mgr isReadableFileAtPath: hfile] == NO)
{ {
/* NSLog(@"No readable header at '%@' ... skipping", hfile);
* Try to parse header to see what needs documenting. continue;
*/
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) if (declared != nil)
{ {
/* [parser setDeclared:
* Try to parse source *as-if-it-was-a-header* [declared stringByAppendingPathComponent:
* to see what needs documenting. [hfile lastPathComponent]]];
*/
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];
} }
[parser parseFile: hfile isSource: NO];
/* /*
* If we can read a source file, parse it for any * If we can read a source file, parse it for any
@ -704,12 +621,72 @@ main(int argc, char **argv, char **env)
} }
else else
{ {
gDate = [NSDate date]; // Just generated. /*
* Add the newly created gsdoc file to the list of
* those to process.
*/
[gFiles addObject: [gsdocfile lastPathComponent]];
} }
} }
} }
DESTROY(pool);
DESTROY(parser);
DESTROY(output);
}
/*
* Load any old project indexing information and determine when the
* indexing information was last updated (never ==> distant past)
*/
refsFile = [documentationDirectory
stringByAppendingPathComponent: project];
refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"];
projectRefs = [AGSIndex new];
originalIndex = nil;
rDate = [NSDate distantPast];
if ([mgr isReadableFileAtPath: refsFile] == YES)
{
originalIndex
= [[NSDictionary alloc] initWithContentsOfFile: refsFile];
if (originalIndex == nil)
{
NSLog(@"Unable to read project file '%@'", refsFile);
}
else else
{ {
NSDictionary *dict;
[projectRefs mergeRefs: originalIndex override: NO];
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
rDate = [dict objectForKey: NSFileModificationDate];
}
}
count = [gFiles count];
if (count > 0)
{
NSDictionary *projectIndex;
CREATE_AUTORELEASE_POOL(arp);
for (i = 0; i < count; i++)
{
NSString *arg = [gFiles objectAtIndex: i];
NSString *gsdocfile;
NSString *file;
NSDictionary *attrs;
NSDate *gDate = nil;
if (arp != nil)
{
RELEASE(arp);
arp = [NSAutoreleasePool new];
}
file = [[arg lastPathComponent] stringByDeletingPathExtension];
gsdocfile = [documentationDirectory
stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
/* /*
* Our source file is a gsdoc file ... so it may be located * Our source file is a gsdoc file ... so it may be located
* in the source (input) directory rather than the documentation * in the source (input) directory rather than the documentation
@ -717,7 +694,8 @@ main(int argc, char **argv, char **env)
*/ */
if ([mgr isReadableFileAtPath: gsdocfile] == NO) if ([mgr isReadableFileAtPath: gsdocfile] == NO)
{ {
gsdocfile = [sdir stringByAppendingPathComponent: file]; gsdocfile = [sourceDirectory
stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: gsdocfile = [gsdocfile stringByAppendingPathExtension:
@"gsdoc"]; @"gsdoc"];
} }
@ -727,119 +705,71 @@ main(int argc, char **argv, char **env)
gDate = [attrs objectForKey: NSFileModificationDate]; gDate = [attrs objectForKey: NSFileModificationDate];
AUTORELEASE(RETAIN(gDate)); 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 == nil || [gDate earlierDate: rDate] == rDate)
{
if (showDependencies == YES)
{
NSLog(@"%@: gsdoc %@, index %@ ==> regenerate",
file, gDate, rDate);
}
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
{
GSXMLParser *parser;
AGSIndex *localRefs;
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
[parser substituteEntities: NO];
[parser doValidityChecking: YES];
[parser keepBlanks: NO];
if ([parser parse] == NO)
{
NSLog(@"WARNING %@ is not a valid document", gsdocfile);
}
if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"])
{
NSLog(@"not a gsdoc document - because name node is %@",
[[[parser doc] root] name]);
return 1;
}
localRefs = AUTORELEASE([AGSIndex new]);
[localRefs makeRefs: [[parser doc] root]];
/*
* accumulate index info in project references
*/
[projectRefs mergeRefs: [localRefs refs] override: NO];
}
else
{
NSLog(@"No readable documentation at '%@' ... skipping",
gsdocfile);
}
}
} }
DESTROY(arp);
/* /*
* Now we try to process the gsdoc data to make index info * Save project references if they have been modified.
* unless the project index is already more up to date than
* this file.
*/ */
if (gDate == nil || [gDate earlierDate: rDate] == rDate) projectIndex = [projectRefs refs];
if (projectIndex != nil && [originalIndex isEqual: projectIndex] == NO)
{ {
if (showDependencies == YES) if ([projectIndex writeToFile: refsFile atomically: YES] == NO)
{ {
NSLog(@"%@: gsdoc %@, index %@ ==> regenerate", NSLog(@"Sorry unable to write %@", refsFile);
file, sDate, gDate);
}
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
{
GSXMLParser *parser;
AGSIndex *localRefs;
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
[parser substituteEntities: NO];
[parser doValidityChecking: YES];
[parser keepBlanks: NO];
if ([parser parse] == NO)
{
NSLog(@"WARNING %@ is not a valid document", gsdocfile);
}
if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"])
{
NSLog(@"not a gsdoc document - because name node is %@",
[[[parser doc] root] name]);
return 1;
}
localRefs = AUTORELEASE([AGSIndex new]);
[localRefs makeRefs: [[parser doc] root]];
/*
* accumulate index info in project references
*/
[projectRefs mergeRefs: [localRefs refs] override: NO];
modifiedRefs = YES;
}
else if (isDocumentation)
{
NSLog(@"No readable documentation at '%@' ... skipping",
gsdocfile);
} }
} }
DESTROY(originalIndex);
} }
/* globalRefs = [AGSIndex new];
* 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 ([[projectRefs refs] writeToFile: refsFile atomically: YES] == NO)
{
NSLog(@"Sorry unable to write %@", refsFile);
}
}
RELEASE(pool);
/* /*
* If we are either generating html output, or relocating existing * If we are either generating html output, or relocating existing
@ -848,7 +778,25 @@ main(int argc, char **argv, char **env)
*/ */
if (generateHtml == YES || [hFiles count] > 0) if (generateHtml == YES || [hFiles count] > 0)
{ {
NSMutableDictionary *projects;
NSString *systemProjects;
NSString *localProjects;
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
localProjects = [defs stringForKey: @"LocalProjects"];
if (localProjects == nil)
{
localProjects = @"";
}
systemProjects = [defs stringForKey: @"SystemProjects"];
if (systemProjects == nil)
{
systemProjects = @"";
}
projects = [[defs dictionaryForKey: @"Projects"] mutableCopy];
AUTORELEASE(projects);
/* /*
* Merge any external project references into the * Merge any external project references into the
* main cross reference index. * main cross reference index.
@ -985,16 +933,16 @@ main(int argc, char **argv, char **env)
/* /*
* Next pass ... generate html output from gsdoc files if required. * Next pass ... generate html output from gsdoc files if required.
*/ */
if (generateHtml == YES) count = [gFiles count];
if (generateHtml == YES && count > 0)
{ {
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
for (i = 0; i < [files count]; i++) for (i = 0; i < count; i++)
{ {
NSString *arg = [files objectAtIndex: i]; NSString *arg = [gFiles objectAtIndex: i];
NSString *gsdocfile; NSString *gsdocfile;
NSString *htmlfile; NSString *htmlfile;
NSString *ddir;
NSString *file; NSString *file;
NSString *generated; NSString *generated;
NSDictionary *attrs; NSDictionary *attrs;
@ -1007,11 +955,12 @@ main(int argc, char **argv, char **env)
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
} }
file = [[arg lastPathComponent] stringByDeletingPathExtension]; file = [[arg lastPathComponent] stringByDeletingPathExtension];
ddir = documentationDirectory;
gsdocfile = [ddir stringByAppendingPathComponent: file]; gsdocfile = [documentationDirectory
stringByAppendingPathComponent: file];
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"]; gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
htmlfile = [ddir stringByAppendingPathComponent: file]; htmlfile = [documentationDirectory
stringByAppendingPathComponent: file];
htmlfile = [htmlfile stringByAppendingPathExtension: @"html"]; htmlfile = [htmlfile stringByAppendingPathExtension: @"html"];
/* /*
@ -1107,17 +1056,16 @@ main(int argc, char **argv, char **env)
* Relocate existing html documents if required ... adjust all cross * Relocate existing html documents if required ... adjust all cross
* referencing within those documents. * referencing within those documents.
*/ */
if ([hFiles count] > 0) count = [hFiles count];
if (count > 0)
{ {
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
for (i = 0; i < [hFiles count]; i++) for (i = 0; i < count; i++)
{ {
NSString *file = [hFiles objectAtIndex: i]; NSString *file = [hFiles objectAtIndex: i];
NSString *src; NSString *src;
NSString *dst; NSString *dst;
NSString *sdir;
NSString *ddir;
if (pool != nil) if (pool != nil)
{ {
@ -1125,11 +1073,9 @@ main(int argc, char **argv, char **env)
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
} }
file = [file lastPathComponent]; file = [file lastPathComponent];
sdir = sourceDirectory;
ddir = documentationDirectory;
src = [sdir stringByAppendingPathComponent: file]; src = [sourceDirectory stringByAppendingPathComponent: file];
dst = [ddir stringByAppendingPathComponent: file]; dst = [documentationDirectory stringByAppendingPathComponent: file];
/* /*
* If we can't find the file in the source directory, assume * If we can't find the file in the source directory, assume