mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
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:
parent
bb57a81e5c
commit
8cf944f4b0
4 changed files with 306 additions and 350 deletions
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.7//EN"
|
||||||
|
"http://www.gnustep.org/gsdoc-0_6_7.xml">
|
||||||
|
<gsdoc base="index">
|
||||||
|
<head>
|
||||||
|
<title>My project reference</title>
|
||||||
|
<author name="my name"></author>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<chapter>
|
||||||
|
<heading>My project reference</heading>
|
||||||
|
</chapter>
|
||||||
|
<back>
|
||||||
|
<index scope="project" type="title" />
|
||||||
|
</back>
|
||||||
|
</body>
|
||||||
|
</gsdoc>
|
||||||
|
</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];
|
||||||
|
}
|
||||||
|
else if ([arg hasSuffix: @".gsdoc"] == YES)
|
||||||
{
|
{
|
||||||
// Make a note of any html files found.
|
[gFiles addObject: arg];
|
||||||
[hFiles addObject: [files objectAtIndex: i]];
|
}
|
||||||
|
else if ([arg hasSuffix: @".html"] == YES)
|
||||||
|
{
|
||||||
|
[hFiles addObject: arg];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Skip this value ... not a known file type.
|
// Skip this value ... not a known file type.
|
||||||
NSLog(@"Unknown argument '%@' ... ignored", arg);
|
NSLog(@"Unknown argument '%@' ... ignored", arg);
|
||||||
}
|
}
|
||||||
[files removeObjectAtIndex: i];
|
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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,52 +467,34 @@ main(int argc, char **argv, char **env)
|
||||||
|
|
||||||
mgr = [NSFileManager defaultManager];
|
mgr = [NSFileManager defaultManager];
|
||||||
|
|
||||||
globalRefs = [AGSIndex new];
|
count = [sFiles count];
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
AGSParser *parser;
|
||||||
|
AGSOutput *output;
|
||||||
|
NSString *up;
|
||||||
|
|
||||||
|
up = [defs stringForKey: @"Up"];
|
||||||
|
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
parser = [AGSParser new];
|
parser = [AGSParser new];
|
||||||
|
output = [AGSOutput new];
|
||||||
if ([defs boolForKey: @"Standards"] == YES)
|
if ([defs boolForKey: @"Standards"] == YES)
|
||||||
{
|
{
|
||||||
[parser setGenerateStandards: YES];
|
[parser setGenerateStandards: YES];
|
||||||
}
|
}
|
||||||
output = [AGSOutput new];
|
|
||||||
|
|
||||||
/*
|
for (i = 0; i < count; i++)
|
||||||
* 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;
|
NSString *arg = [sFiles objectAtIndex: i];
|
||||||
|
|
||||||
dict = [[NSDictionary alloc] initWithContentsOfFile: refsFile];
|
|
||||||
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];
|
|
||||||
for (i = 0; i < [files count]; i++)
|
|
||||||
{
|
|
||||||
NSString *arg = [files objectAtIndex: i];
|
|
||||||
NSString *gsdocfile;
|
NSString *gsdocfile;
|
||||||
NSString *hfile;
|
NSString *hfile;
|
||||||
NSString *sfile;
|
NSString *sfile;
|
||||||
NSString *ddir;
|
|
||||||
NSString *hdir;
|
NSString *hdir;
|
||||||
NSString *sdir;
|
NSString *sdir;
|
||||||
NSString *file;
|
NSString *file;
|
||||||
NSString *generated;
|
NSString *generated;
|
||||||
BOOL isSource = [arg hasSuffix: @".m"];
|
|
||||||
BOOL isDocumentation = [arg hasSuffix: @".gsdoc"];
|
|
||||||
NSDictionary *attrs;
|
NSDictionary *attrs;
|
||||||
NSDate *sDate = nil;
|
NSDate *sDate = nil;
|
||||||
NSDate *gDate = nil;
|
NSDate *gDate = nil;
|
||||||
|
@ -560,15 +520,23 @@ main(int argc, char **argv, char **env)
|
||||||
sdir = [sourceDirectory stringByAppendingPathComponent: hdir];
|
sdir = [sourceDirectory stringByAppendingPathComponent: hdir];
|
||||||
hdir = [headerDirectory stringByAppendingPathComponent: hdir];
|
hdir = [headerDirectory stringByAppendingPathComponent: hdir];
|
||||||
}
|
}
|
||||||
ddir = documentationDirectory;
|
|
||||||
|
|
||||||
hfile = [hdir stringByAppendingPathComponent: file];
|
|
||||||
hfile = [hfile stringByAppendingPathExtension: @"h"];
|
|
||||||
sfile = [sdir stringByAppendingPathComponent: file];
|
sfile = [sdir stringByAppendingPathComponent: file];
|
||||||
sfile = [sfile stringByAppendingPathExtension: @"m"];
|
sfile = [sfile stringByAppendingPathExtension: @"m"];
|
||||||
gsdocfile = [ddir stringByAppendingPathComponent: file];
|
if ([arg hasSuffix: @".m"] == YES)
|
||||||
|
{
|
||||||
|
hfile = sfile;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hfile = [hdir stringByAppendingPathComponent: file];
|
||||||
|
hfile = [hfile stringByAppendingPathExtension: @"h"];
|
||||||
|
}
|
||||||
|
gsdocfile = [documentationDirectory
|
||||||
|
stringByAppendingPathComponent: file];
|
||||||
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
|
gsdocfile = [gsdocfile stringByAppendingPathExtension: @"gsdoc"];
|
||||||
|
|
||||||
|
|
||||||
if (ignoreDependencies == NO)
|
if (ignoreDependencies == NO)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -589,35 +557,6 @@ main(int argc, char **argv, char **env)
|
||||||
AUTORELEASE(RETAIN(sDate));
|
AUTORELEASE(RETAIN(sDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (up == nil && [files count] > 1)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ASSIGN(up, @"index");
|
|
||||||
autoIndex = YES; // Generate it if needed.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDocumentation == NO)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* 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];
|
attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
|
||||||
gDate = [attrs objectForKey: NSFileModificationDate];
|
gDate = [attrs objectForKey: NSFileModificationDate];
|
||||||
AUTORELEASE(RETAIN(gDate));
|
AUTORELEASE(RETAIN(gDate));
|
||||||
|
@ -632,15 +571,14 @@ main(int argc, char **argv, char **env)
|
||||||
}
|
}
|
||||||
[parser reset];
|
[parser reset];
|
||||||
|
|
||||||
if (isSource == NO)
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Try to parse header to see what needs documenting.
|
* 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)
|
if ([mgr isReadableFileAtPath: hfile] == NO)
|
||||||
{
|
{
|
||||||
NSLog(@"No readable header at '%@' ... skipping",
|
NSLog(@"No readable header at '%@' ... skipping", hfile);
|
||||||
hfile);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (declared != nil)
|
if (declared != nil)
|
||||||
|
@ -650,27 +588,6 @@ main(int argc, char **argv, char **env)
|
||||||
[hfile lastPathComponent]]];
|
[hfile lastPathComponent]]];
|
||||||
}
|
}
|
||||||
[parser parseFile: hfile isSource: NO];
|
[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 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,7 +705,6 @@ 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
|
* Now we try to process the gsdoc data to make index info
|
||||||
|
@ -739,7 +716,7 @@ main(int argc, char **argv, char **env)
|
||||||
if (showDependencies == YES)
|
if (showDependencies == YES)
|
||||||
{
|
{
|
||||||
NSLog(@"%@: gsdoc %@, index %@ ==> regenerate",
|
NSLog(@"%@: gsdoc %@, index %@ ==> regenerate",
|
||||||
file, sDate, gDate);
|
file, gDate, rDate);
|
||||||
}
|
}
|
||||||
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
|
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
|
||||||
{
|
{
|
||||||
|
@ -768,78 +745,31 @@ main(int argc, char **argv, char **env)
|
||||||
* accumulate index info in project references
|
* accumulate index info in project references
|
||||||
*/
|
*/
|
||||||
[projectRefs mergeRefs: [localRefs refs] override: NO];
|
[projectRefs mergeRefs: [localRefs refs] override: NO];
|
||||||
modifiedRefs = YES;
|
|
||||||
}
|
}
|
||||||
else if (isDocumentation)
|
else
|
||||||
{
|
{
|
||||||
NSLog(@"No readable documentation at '%@' ... skipping",
|
NSLog(@"No readable documentation at '%@' ... skipping",
|
||||||
gsdocfile);
|
gsdocfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DESTROY(arp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure auto-generation of index file is done.
|
* Save project references if they have been modified.
|
||||||
*/
|
*/
|
||||||
if (autoIndex == YES)
|
projectIndex = [projectRefs refs];
|
||||||
|
if (projectIndex != nil && [originalIndex isEqual: projectIndex] == NO)
|
||||||
{
|
{
|
||||||
if ([files containsObject: up] == YES)
|
if ([projectIndex writeToFile: refsFile atomically: YES] == NO)
|
||||||
{
|
|
||||||
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);
|
NSLog(@"Sorry unable to write %@", refsFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DESTROY(originalIndex);
|
||||||
|
}
|
||||||
|
|
||||||
RELEASE(pool);
|
globalRefs = [AGSIndex new];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue