diff --git a/Tools/AGSHtml.h b/Tools/AGSHtml.h index e3c7f66c9b..b89e276e0e 100644 --- a/Tools/AGSHtml.h +++ b/Tools/AGSHtml.h @@ -43,12 +43,15 @@ NSString *nextFile; // Not retained NSString *prevFile; // Not retained NSString *upFile; // Not retained + NSString *fileName; unsigned chap; unsigned sect; unsigned ssect; unsigned sssect; BOOL isContentsDoc; BOOL ivarsAtEnd; + BOOL verbose; + BOOL warn; } - (void) decIndent; - (void) incIndent; @@ -68,7 +71,7 @@ style: (NSString*)style target: (NSString*)target to: (NSMutableString*)buf; -- (NSString*) outputDocument: (GSXMLNode*)node; +- (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file; - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf; - (void) outputNodeList: (GSXMLNode*)node to: (NSMutableString*)buf; - (GSXMLNode*) outputBlock: (GSXMLNode*)node diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index 1c78d54230..dbb6a7e8d9 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -22,11 +22,7 @@ #import "common.h" -#import "Foundation/NSAutoreleasePool.h" -#import "Foundation/NSArray.h" -#import "Foundation/NSDictionary.h" -#import "Foundation/NSSet.h" -#import "Foundation/NSUserDefaults.h" +#import "Foundation/Foundation.h" #import "AGSHtml.h" #import "GNUstepBase/NSString+GNUstepBase.h" #import "GNUstepBase/NSMutableString+GNUstepBase.h" @@ -108,6 +104,7 @@ - (void) dealloc RELEASE(localRefs); RELEASE(projectRefs); RELEASE(indent); + RELEASE(fileName); DEALLOC } @@ -128,9 +125,15 @@ - (void) incIndent - (id) init { - indent = [[NSMutableString alloc] initWithCapacity: 64]; - project = RETAIN([[NSUserDefaults standardUserDefaults] - stringForKey: @"Project"]); + if (nil != (self = [super init])) + { + NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; + + indent = [[NSMutableString alloc] initWithCapacity: 64]; + project = RETAIN([defs stringForKey: @"Project"]); + verbose = [defs boolForKey: @"Verbose"]; + warn = [defs boolForKey: @"Warn"]; + } return self; } @@ -281,10 +284,11 @@ - (NSString*) makeLink: (NSString*)r return [s stringByReplacingString: @":" withString: @"$"]; } -- (NSString*) outputDocument: (GSXMLNode*)node +- (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file { NSMutableString *buf; + ASSIGN(fileName, file); if (localRefs == nil) { localRefs = [AGSIndex new]; @@ -305,6 +309,7 @@ - (NSString*) outputDocument: (GSXMLNode*)node [self decIndent]; [buf appendString: @"\n"]; + DESTROY(fileName); return buf; } @@ -1193,6 +1198,15 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf GSXMLNode *email = nil; GSXMLNode *url = nil; GSXMLNode *desc = nil; + NSString *name; + + name = [[author attributes] objectForKey: @"name"]; + name = [name stringByTrimmingSpaces]; + if ([name length] == 0) + { + name = [NSString stringWithFormat: @"Generated by %@", + NSFullUserName()]; + } children = [children nextElement]; @@ -1216,8 +1230,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf if (url == nil) { [buf appendString: @"
"]; - [buf appendString: [[[author attributes] - objectForKey: @"name"] stringByEscapingXML]]; + [buf appendString: [name stringByEscapingXML]]; } else { @@ -1225,8 +1238,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: [[url attributes] objectForKey: @"url"]]; [buf appendString: @"\">"]; - [buf appendString: [[[author attributes] - objectForKey: @"name"] stringByEscapingXML]]; + [buf appendString: [name stringByEscapingXML]]; [buf appendString: @""]; } if (email != nil) @@ -1267,9 +1279,24 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf } if ([[children name] isEqual: @"date"] == YES) { + GSXMLNode *tmp = [children firstChild]; + NSString *str; + [buf appendString: indent]; [buf appendString: @"

Date: "]; - [self outputText: [children firstChild] to: buf]; + if (nil == tmp + || ([tmp type] == XML_TEXT_NODE + && [(str = [[tmp escapedContent] stringByTrimmingSpaces]) + length] == 0)) + { + str = [NSString stringWithFormat: @"Generated at %@", + [NSDate date]]; + [buf appendString: str]; + } + else + { + [self outputText: tmp to: buf]; + } [buf appendString: @"

\n"]; children = [children nextElement]; } @@ -1719,17 +1746,24 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf } if (s == nil) { - if (c == nil) - { - NSLog(@"Location of %@ '%@' not found or not unique" - @" (referenced from %@:\n%@).", - type, r, base, [[node parent] parent]); - } - else + if (warn) { - NSLog(@"Location of the %@ version of %@ '%@' not found" - @"(referenced from %@:\n%@).", - c, type, r, base, [[node parent] parent]); + NSString *ref; + + ref = [NSString stringWithFormat: + @" (referenced from %@ in %@).", + base, fileName]; + if (c == nil) + { + NSLog(@"Warning - location of %@ '%@'" + @" not found or not unique %@.", + type, r, ref); + } + else + { + NSLog(@"Warning - location of the %@ version of %@ '%@'" + @" not found %@.", c, type, r, ref); + } } if (tmp == nil) { diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 64353cb048..79a799cb67 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -746,7 +746,7 @@ - (void) outputDecl: (NSMutableDictionary*)d if (warn == YES && [[d objectForKey: @"Implemented"] isEqual: @"YES"] == NO) { - NSLog(@"Warning ... %@ %@ is not implemented where expected", kind, name); + NSLog(@"Warning - %@ %@ is not implemented where expected", kind, name); } [str appendFormat: @" <%@ type=\"", kind]; @@ -790,7 +790,7 @@ - (void) outputFunction: (NSMutableDictionary*)d to: (NSMutableString*)str if (warn == YES && [[d objectForKey: @"Implemented"] isEqual: @"YES"] == NO) { - NSLog(@"Warning ... function %@ is not implemented where expected", name); + NSLog(@"Warning - function %@ is not implemented where expected", name); } /** @@ -1172,7 +1172,7 @@ - (void) outputUnit: (NSMutableDictionary*)d to: (NSMutableString*)str } else if (warn == YES) { - NSLog(@"Warning ... unit %@ is not implemented where expected", name); + NSLog(@"Warning - unit %@ is not implemented where expected", name); } } else diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index f542c2e0ef..70765c633d 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -2178,7 +2178,7 @@ standard PropertyList format (not the XML format of OS X), using [html setProjectRefs: projectRefs]; [html setLocalRefs: localRefs]; [html setInstanceVariablesAtEnd: instanceVarsAtEnd]; - generated = [html outputDocument: root]; + generated = [html outputDocument: root name: gsdocfile]; d = [generated dataUsingEncoding: NSUTF8StringEncoding]; if ([d writeToFile: htmlfile atomically: YES] == NO) { diff --git a/Tools/gsdoc-1_0_4.dtd b/Tools/gsdoc-1_0_4.dtd index e2feae784f..e258209190 100644 --- a/Tools/gsdoc-1_0_4.dtd +++ b/Tools/gsdoc-1_0_4.dtd @@ -578,10 +578,16 @@ - + - +