mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Some tidyups and restructuring.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11962 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
76e0732f81
commit
faf8500ede
3 changed files with 822 additions and 702 deletions
|
@ -1,13 +1,13 @@
|
||||||
/** Implementation for GSXMLDocument for GNUstep xmlparser
|
/** Implementation for GSXMLDocument for GNUstep xmlparser
|
||||||
|
|
||||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Michael Pakhantsov <mishel@berest.dp.ua> on behalf of
|
Written by: Michael Pakhantsov <mishel@berest.dp.ua> on behalf of
|
||||||
Brainstorm computer solutions.
|
Brainstorm computer solutions.
|
||||||
Date: Jule 2000
|
Date: Jule 2000
|
||||||
|
|
||||||
Integration by Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Integration/updates/rewrites by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
Date: September 2000
|
Date: Sep2000,Dec2001/Jan2002
|
||||||
|
|
||||||
This file is part of the GNUstep Base Library.
|
This file is part of the GNUstep Base Library.
|
||||||
|
|
||||||
|
@ -2045,6 +2045,12 @@ static NSString *endMarker = @"At end of incremental parse";
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The GSHTMLParser class is a simple subclass of GSXMLParser which should
|
||||||
|
* parse reasonably well formed HTML documents. If you wish to parse XHTML
|
||||||
|
* documents, you should use GSXMLParser ... the GSHTMLParser class is for
|
||||||
|
* older 'legacy' documents.
|
||||||
|
*/
|
||||||
@implementation GSHTMLParser
|
@implementation GSHTMLParser
|
||||||
|
|
||||||
- (BOOL) _initLibXML
|
- (BOOL) _initLibXML
|
||||||
|
|
|
@ -323,6 +323,7 @@
|
||||||
#include "AGSIndex.h"
|
#include "AGSIndex.h"
|
||||||
#include "AGSHtml.h"
|
#include "AGSHtml.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv, char **env)
|
main(int argc, char **argv, char **env)
|
||||||
{
|
{
|
||||||
|
@ -340,8 +341,8 @@ main(int argc, char **argv, char **env)
|
||||||
NSString *refsFile;
|
NSString *refsFile;
|
||||||
NSString *systemProjects;
|
NSString *systemProjects;
|
||||||
NSString *localProjects;
|
NSString *localProjects;
|
||||||
AGSIndex *prjRefs;
|
AGSIndex *projectRefs;
|
||||||
AGSIndex *indexer;
|
AGSIndex *globalRefs;
|
||||||
AGSParser *parser;
|
AGSParser *parser;
|
||||||
AGSOutput *output;
|
AGSOutput *output;
|
||||||
id obj;
|
id obj;
|
||||||
|
@ -350,7 +351,6 @@ main(int argc, char **argv, char **env)
|
||||||
BOOL showDependencies = NO;
|
BOOL showDependencies = NO;
|
||||||
BOOL autoIndex = NO;
|
BOOL autoIndex = NO;
|
||||||
BOOL modifiedRefs = NO;
|
BOOL modifiedRefs = NO;
|
||||||
BOOL standards = NO;
|
|
||||||
NSDate *rDate = nil;
|
NSDate *rDate = nil;
|
||||||
NSMutableArray *files = nil;
|
NSMutableArray *files = nil;
|
||||||
CREATE_AUTORELEASE_POOL(outer);
|
CREATE_AUTORELEASE_POOL(outer);
|
||||||
|
@ -375,7 +375,6 @@ main(int argc, char **argv, char **env)
|
||||||
nil]];
|
nil]];
|
||||||
|
|
||||||
autoIndex = [defs boolForKey: @"AutoIndex"];
|
autoIndex = [defs boolForKey: @"AutoIndex"];
|
||||||
standards = [defs boolForKey: @"Standards"];
|
|
||||||
ignoreDependencies = [defs boolForKey: @"IgnoreDependencies"];
|
ignoreDependencies = [defs boolForKey: @"IgnoreDependencies"];
|
||||||
showDependencies = [defs boolForKey: @"ShowDependencies"];
|
showDependencies = [defs boolForKey: @"ShowDependencies"];
|
||||||
if (ignoreDependencies == YES)
|
if (ignoreDependencies == YES)
|
||||||
|
@ -478,15 +477,20 @@ main(int argc, char **argv, char **env)
|
||||||
|
|
||||||
mgr = [NSFileManager defaultManager];
|
mgr = [NSFileManager defaultManager];
|
||||||
|
|
||||||
prjRefs = [AGSIndex new];
|
globalRefs = [AGSIndex new];
|
||||||
indexer = [AGSIndex new];
|
|
||||||
parser = [AGSParser new];
|
parser = [AGSParser new];
|
||||||
[parser setGenerateStandards: standards];
|
if ([defs boolForKey: @"Standards"] == YES)
|
||||||
|
{
|
||||||
|
[parser setGenerateStandards: YES];
|
||||||
|
}
|
||||||
output = [AGSOutput new];
|
output = [AGSOutput new];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load any old project indexing information.
|
* 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)
|
if ([mgr isReadableFileAtPath: refsFile] == YES)
|
||||||
{
|
{
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
|
@ -498,134 +502,12 @@ main(int argc, char **argv, char **env)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[prjRefs mergeRefs: dict override: NO];
|
[projectRefs mergeRefs: dict override: NO];
|
||||||
RELEASE(dict);
|
RELEASE(dict);
|
||||||
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
|
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
|
||||||
rDate = [dict objectForKey: NSFileModificationDate];
|
rDate = [dict objectForKey: NSFileModificationDate];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rDate == nil)
|
|
||||||
{
|
|
||||||
rDate = [NSDate distantPast];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Merge any external project references into the
|
|
||||||
* main cross reference index.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pool = [NSAutoreleasePool new];
|
|
||||||
if ([systemProjects caseInsensitiveCompare: @"None"] != NSOrderedSame)
|
|
||||||
{
|
|
||||||
NSString *base = [NSSearchPathForDirectoriesInDomains(
|
|
||||||
NSDocumentationDirectory, NSSystemDomainMask, NO) lastObject];
|
|
||||||
|
|
||||||
base = [base stringByStandardizingPath];
|
|
||||||
if (base != nil)
|
|
||||||
{
|
|
||||||
NSDirectoryEnumerator *enumerator = [mgr enumeratorAtPath: base];
|
|
||||||
NSString *file;
|
|
||||||
|
|
||||||
if ([systemProjects isEqual: @""] == YES)
|
|
||||||
{
|
|
||||||
systemProjects = base; // Absolute path
|
|
||||||
}
|
|
||||||
while ((file = [enumerator nextObject]) != nil)
|
|
||||||
{
|
|
||||||
NSString *ext = [file pathExtension];
|
|
||||||
|
|
||||||
if ([ext isEqualToString: @"igsdoc"] == YES)
|
|
||||||
{
|
|
||||||
NSString *key;
|
|
||||||
NSString *val;
|
|
||||||
|
|
||||||
if (projects == nil)
|
|
||||||
{
|
|
||||||
projects = [NSMutableDictionary dictionary];
|
|
||||||
}
|
|
||||||
key = [base stringByAppendingPathComponent: file];
|
|
||||||
val = [file stringByDeletingLastPathComponent];
|
|
||||||
val = [systemProjects stringByAppendingPathComponent: val];
|
|
||||||
[projects setObject: val forKey: key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([localProjects caseInsensitiveCompare: @"None"] != NSOrderedSame)
|
|
||||||
{
|
|
||||||
NSString *base = [NSSearchPathForDirectoriesInDomains(
|
|
||||||
NSDocumentationDirectory, NSLocalDomainMask, NO) lastObject];
|
|
||||||
|
|
||||||
base = [base stringByStandardizingPath];
|
|
||||||
if (base != nil)
|
|
||||||
{
|
|
||||||
NSDirectoryEnumerator *enumerator = [mgr enumeratorAtPath: base];
|
|
||||||
NSString *file;
|
|
||||||
|
|
||||||
if ([localProjects isEqual: @""] == YES)
|
|
||||||
{
|
|
||||||
localProjects = base; // Absolute path
|
|
||||||
}
|
|
||||||
while ((file = [enumerator nextObject]) != nil)
|
|
||||||
{
|
|
||||||
NSString *ext = [file pathExtension];
|
|
||||||
|
|
||||||
if ([ext isEqualToString: @"igsdoc"] == YES)
|
|
||||||
{
|
|
||||||
NSString *key;
|
|
||||||
NSString *val;
|
|
||||||
|
|
||||||
if (projects == nil)
|
|
||||||
{
|
|
||||||
projects = [NSMutableDictionary dictionary];
|
|
||||||
}
|
|
||||||
key = [base stringByAppendingPathComponent: file];
|
|
||||||
val = [file stringByDeletingLastPathComponent];
|
|
||||||
val = [localProjects stringByAppendingPathComponent: val];
|
|
||||||
[projects setObject: val forKey: key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (projects != nil)
|
|
||||||
{
|
|
||||||
NSEnumerator *e = [projects keyEnumerator];
|
|
||||||
NSString *k;
|
|
||||||
|
|
||||||
while ((k = [e nextObject]) != nil)
|
|
||||||
{
|
|
||||||
NSDictionary *dict;
|
|
||||||
|
|
||||||
if ([mgr isReadableFileAtPath: k] == NO
|
|
||||||
|| (dict = [[NSDictionary alloc] initWithContentsOfFile: k]) == nil)
|
|
||||||
{
|
|
||||||
NSLog(@"Unable to read project file '%@'", k);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AGSIndex *tmp;
|
|
||||||
NSString *p;
|
|
||||||
|
|
||||||
tmp = [AGSIndex new];
|
|
||||||
[tmp mergeRefs: dict override: NO];
|
|
||||||
RELEASE(dict);
|
|
||||||
/*
|
|
||||||
* Adjust path to external project files ...
|
|
||||||
*/
|
|
||||||
p = [projects objectForKey: k];
|
|
||||||
if ([p isEqual: @""] == YES)
|
|
||||||
{
|
|
||||||
p = [k stringByDeletingLastPathComponent];
|
|
||||||
}
|
|
||||||
[tmp setDirectory: p];
|
|
||||||
[indexer mergeRefs: [tmp refs] override: YES];
|
|
||||||
RELEASE(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RELEASE(pool);
|
|
||||||
|
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
for (i = 0; i < [files count]; i++)
|
for (i = 0; i < [files count]; i++)
|
||||||
|
@ -850,7 +732,7 @@ main(int argc, char **argv, char **env)
|
||||||
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
|
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
|
||||||
{
|
{
|
||||||
GSXMLParser *parser;
|
GSXMLParser *parser;
|
||||||
AGSIndex *locRefs;
|
AGSIndex *localRefs;
|
||||||
|
|
||||||
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
|
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
|
||||||
[parser substituteEntities: NO];
|
[parser substituteEntities: NO];
|
||||||
|
@ -867,13 +749,13 @@ main(int argc, char **argv, char **env)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
locRefs = AUTORELEASE([AGSIndex new]);
|
localRefs = AUTORELEASE([AGSIndex new]);
|
||||||
[locRefs makeRefs: [[parser doc] root]];
|
[localRefs makeRefs: [[parser doc] root]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* accumulate index info in project references
|
* accumulate index info in project references
|
||||||
*/
|
*/
|
||||||
[prjRefs mergeRefs: [locRefs refs] override: NO];
|
[projectRefs mergeRefs: [localRefs refs] override: NO];
|
||||||
modifiedRefs = YES;
|
modifiedRefs = YES;
|
||||||
}
|
}
|
||||||
else if (isDocumentation)
|
else if (isDocumentation)
|
||||||
|
@ -939,7 +821,7 @@ main(int argc, char **argv, char **env)
|
||||||
*/
|
*/
|
||||||
if (modifiedRefs == YES)
|
if (modifiedRefs == YES)
|
||||||
{
|
{
|
||||||
if ([[prjRefs refs] writeToFile: refsFile atomically: YES] == NO)
|
if ([[projectRefs refs] writeToFile: refsFile atomically: YES] == NO)
|
||||||
{
|
{
|
||||||
NSLog(@"Sorry unable to write %@", refsFile);
|
NSLog(@"Sorry unable to write %@", refsFile);
|
||||||
}
|
}
|
||||||
|
@ -954,10 +836,138 @@ main(int argc, char **argv, char **env)
|
||||||
*/
|
*/
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Merge any external project references into the
|
||||||
|
* main cross reference index.
|
||||||
|
*/
|
||||||
|
if ([systemProjects caseInsensitiveCompare: @"None"] != NSOrderedSame)
|
||||||
|
{
|
||||||
|
NSString *base = [NSSearchPathForDirectoriesInDomains(
|
||||||
|
NSDocumentationDirectory, NSSystemDomainMask, NO) lastObject];
|
||||||
|
|
||||||
|
base = [base stringByStandardizingPath];
|
||||||
|
if (base != nil)
|
||||||
|
{
|
||||||
|
NSDirectoryEnumerator *enumerator = [mgr enumeratorAtPath: base];
|
||||||
|
NSString *file;
|
||||||
|
|
||||||
|
if ([systemProjects isEqual: @""] == YES)
|
||||||
|
{
|
||||||
|
systemProjects = base; // Absolute path
|
||||||
|
}
|
||||||
|
while ((file = [enumerator nextObject]) != nil)
|
||||||
|
{
|
||||||
|
NSString *ext = [file pathExtension];
|
||||||
|
|
||||||
|
if ([ext isEqualToString: @"igsdoc"] == YES)
|
||||||
|
{
|
||||||
|
NSString *key;
|
||||||
|
NSString *val;
|
||||||
|
|
||||||
|
if (projects == nil)
|
||||||
|
{
|
||||||
|
projects = [NSMutableDictionary dictionary];
|
||||||
|
}
|
||||||
|
key = [base stringByAppendingPathComponent: file];
|
||||||
|
val = [file stringByDeletingLastPathComponent];
|
||||||
|
val
|
||||||
|
= [systemProjects stringByAppendingPathComponent: val];
|
||||||
|
[projects setObject: val forKey: key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([localProjects caseInsensitiveCompare: @"None"] != NSOrderedSame)
|
||||||
|
{
|
||||||
|
NSString *base = [NSSearchPathForDirectoriesInDomains(
|
||||||
|
NSDocumentationDirectory, NSLocalDomainMask, NO) lastObject];
|
||||||
|
|
||||||
|
base = [base stringByStandardizingPath];
|
||||||
|
if (base != nil)
|
||||||
|
{
|
||||||
|
NSDirectoryEnumerator *enumerator;
|
||||||
|
NSString *file;
|
||||||
|
|
||||||
|
enumerator = [mgr enumeratorAtPath: base];
|
||||||
|
if ([localProjects isEqual: @""] == YES)
|
||||||
|
{
|
||||||
|
localProjects = base; // Absolute path
|
||||||
|
}
|
||||||
|
while ((file = [enumerator nextObject]) != nil)
|
||||||
|
{
|
||||||
|
NSString *ext = [file pathExtension];
|
||||||
|
|
||||||
|
if ([ext isEqualToString: @"igsdoc"] == YES)
|
||||||
|
{
|
||||||
|
NSString *key;
|
||||||
|
NSString *val;
|
||||||
|
|
||||||
|
if (projects == nil)
|
||||||
|
{
|
||||||
|
projects = [NSMutableDictionary dictionary];
|
||||||
|
}
|
||||||
|
key = [base stringByAppendingPathComponent: file];
|
||||||
|
val = [file stringByDeletingLastPathComponent];
|
||||||
|
val = [localProjects stringByAppendingPathComponent: val];
|
||||||
|
[projects setObject: val forKey: key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (projects != nil)
|
||||||
|
{
|
||||||
|
NSEnumerator *e = [projects keyEnumerator];
|
||||||
|
NSString *k;
|
||||||
|
|
||||||
|
while ((k = [e nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if ([mgr isReadableFileAtPath: k] == NO)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to read project file '%@'", k);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSDictionary *dict;
|
||||||
|
|
||||||
|
dict = [[NSDictionary alloc] initWithContentsOfFile: k];
|
||||||
|
|
||||||
|
if (dict == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to read project file '%@'", k);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AGSIndex *tmp;
|
||||||
|
NSString *p;
|
||||||
|
|
||||||
|
tmp = [AGSIndex new];
|
||||||
|
[tmp mergeRefs: dict override: NO];
|
||||||
|
RELEASE(dict);
|
||||||
|
/*
|
||||||
|
* Adjust path to external project files ...
|
||||||
|
*/
|
||||||
|
p = [projects objectForKey: k];
|
||||||
|
if ([p isEqual: @""] == YES)
|
||||||
|
{
|
||||||
|
p = [k stringByDeletingLastPathComponent];
|
||||||
|
}
|
||||||
|
[tmp setDirectory: p];
|
||||||
|
[globalRefs mergeRefs: [tmp refs] override: YES];
|
||||||
|
RELEASE(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accumulate project index info into global index
|
* Accumulate project index info into global index
|
||||||
*/
|
*/
|
||||||
[indexer mergeRefs: [prjRefs refs] override: YES];
|
[globalRefs mergeRefs: [projectRefs refs] override: YES];
|
||||||
|
|
||||||
|
RELEASE(pool);
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
for (i = 0; i < [files count]; i++)
|
for (i = 0; i < [files count]; i++)
|
||||||
{
|
{
|
||||||
|
@ -1024,8 +1034,8 @@ main(int argc, char **argv, char **env)
|
||||||
if (hDate == nil || [gDate earlierDate: hDate] == hDate)
|
if (hDate == nil || [gDate earlierDate: hDate] == hDate)
|
||||||
{
|
{
|
||||||
GSXMLParser *parser;
|
GSXMLParser *parser;
|
||||||
AGSIndex *locRefs;
|
AGSIndex *localRefs;
|
||||||
AGSHtml *html;
|
AGSHtml *html;
|
||||||
|
|
||||||
if (showDependencies == YES)
|
if (showDependencies == YES)
|
||||||
{
|
{
|
||||||
|
@ -1047,16 +1057,16 @@ main(int argc, char **argv, char **env)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
locRefs = AUTORELEASE([AGSIndex new]);
|
localRefs = AUTORELEASE([AGSIndex new]);
|
||||||
[locRefs makeRefs: [[parser doc] root]];
|
[localRefs makeRefs: [[parser doc] root]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We perform final output
|
* We perform final output
|
||||||
*/
|
*/
|
||||||
html = AUTORELEASE([AGSHtml new]);
|
html = AUTORELEASE([AGSHtml new]);
|
||||||
[html setGlobalRefs: indexer];
|
[html setGlobalRefs: globalRefs];
|
||||||
[html setProjectRefs: prjRefs];
|
[html setProjectRefs: projectRefs];
|
||||||
[html setLocalRefs: locRefs];
|
[html setLocalRefs: localRefs];
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue