Attempt to allow documentation to be generated for uninstalled base package.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29655 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-02-16 19:51:52 +00:00
parent 303d202588
commit 031865c190
5 changed files with 64 additions and 10 deletions

View file

@ -1,3 +1,13 @@
2010-02-16 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepBase/GSXML.h:
* Source/Additions/GSXML.m: new method to allow an additional DTD
directory to be set for the parser.
* Tools/autogsdoc.m: Add flag to allow command line setting of extra
DTD directory.
* Source/DocMakefile: Set extra DTD directory to the Tools directory
so that gsdoc DTDs can be found even when they haven't been installed.
2010-02-16 Niels Grewe <niels.grewe@halbordnung.de>
* Source/Additions/GSXML.m:

View file

@ -206,6 +206,7 @@ extern "C" {
withContentsOfURL: (NSURL*)url;
+ (GSXMLParser*) parserWithSAXHandler: (GSSAXHandler*)handler
withData: (NSData*)data;
+ (void) setDTDs: (NSString*)aPath;
+ (NSString*) xmlEncodingStringForStringEncoding: (NSStringEncoding)encoding;
- (void) abortParsing;

View file

@ -1619,6 +1619,10 @@ static NSMapTable *nodeNames = 0;
*/
@implementation GSXMLParser
/* To override location for DTDs
*/
static NSString *dtdPath = nil;
static NSString *endMarker = @"At end of incremental parse";
+ (void) initialize
@ -1777,6 +1781,15 @@ static NSString *endMarker = @"At end of incremental parse";
withData: data]);
}
/** Sets a directory in which to look for DTDs when resolving external
* references. Can be used whjen DTDs have not been installed in the
* normal locatioons.
*/
+ (void) setDTDs: (NSString*)aPath
{
ASSIGNCOPY(dtdPath, aPath);
}
/**
* Return the name of the string encoding (for XML) to use for the
* specified OpenStep encoding.
@ -2541,16 +2554,28 @@ loadEntityFunction(void *ctx,
range: r];
}
if (dtdPath != nil)
{
found = [dtdPath stringByAppendingPathComponent: name];
found = [found stringByAppendingPathExtension: @"dtd"];
if (![[NSFileManager defaultManager] fileExistsAtPath: found])
{
found = nil;
}
}
if (found == nil)
{
#ifdef GNUSTEP
found = [NSBundle pathForLibraryResource: name
ofType: @"dtd"
inDirectory: @"DTDs"];
found = [NSBundle pathForLibraryResource: name
ofType: @"dtd"
inDirectory: @"DTDs"];
#else
found = [[NSBundle bundleForClass: NSClassFromString(@"GSXMLNode")]
pathForResource: name
ofType: @"dtd"
inDirectory: @"DTDs"];
found = [[NSBundle bundleForClass: [GSXMLNode class]
pathForResource: name
ofType: @"dtd"
inDirectory: @"DTDs"];
#endif
}
if (found == nil)
{
NSLog(@"unable to find GNUstep DTD - '%@' for '%s'", name, eid);
@ -2566,9 +2591,20 @@ loadEntityFunction(void *ctx,
*/
if (file == nil)
{
file = [[NSBundle mainBundle] pathForResource: local
ofType: @""
inDirectory: @"DTDs"];
if (dtdPath != nil)
{
file = [dtdPath stringByAppendingPathComponent: local];
if (![[NSFileManager defaultManager] fileExistsAtPath: local])
{
file = nil;
}
}
if (file == nil)
{
file = [[NSBundle mainBundle] pathForResource: local
ofType: @""
inDirectory: @"DTDs"];
}
if (file == nil)
{
file = [NSBundle pathForLibraryResource: local

View file

@ -202,6 +202,7 @@ BaseAdditions_AGSDOC_FLAGS = \
-HeaderDirectory ../Headers/Additions/GNUstepBase \
-Declared GNUstepBase \
-Standards YES \
-DTDs ../Tools \
-ConstantsTemplate TypesAndConstants \
-FunctionsTemplate Functions \
-MacrosTemplate Functions \

View file

@ -809,6 +809,8 @@ main(int argc, char **argv, char **env)
@"\t\tBOOL\t(NO)\n\tif YES, create documentation pages "
@"for display in HTML frames",
@"MakeFrames",
@"\t\tString\t(nil)\n\tIf set, look for DTDs in the given directory",
@"DTDs",
nil];
argSet = [NSSet setWithArray: [argsRecognized allKeys]];
argsGiven = [[NSProcessInfo processInfo] arguments];
@ -853,6 +855,10 @@ main(int argc, char **argv, char **env)
mgr = [NSFileManager defaultManager];
if ([GSXMLParser respondsToSelector: @selector(setDTDs:)])
{
[GSXMLParser setDTDs: [defs stringForKey: @"DTDs"]];
}
verbose = [defs boolForKey: @"Verbose"];
warn = [defs boolForKey: @"Warn"];