mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 08:10:49 +00:00
Tweak warning/verbose output and auto generate author/date when needed
This commit is contained in:
parent
7fc6637390
commit
4e3e169bed
5 changed files with 74 additions and 31 deletions
|
@ -43,12 +43,15 @@
|
||||||
NSString *nextFile; // Not retained
|
NSString *nextFile; // Not retained
|
||||||
NSString *prevFile; // Not retained
|
NSString *prevFile; // Not retained
|
||||||
NSString *upFile; // Not retained
|
NSString *upFile; // Not retained
|
||||||
|
NSString *fileName;
|
||||||
unsigned chap;
|
unsigned chap;
|
||||||
unsigned sect;
|
unsigned sect;
|
||||||
unsigned ssect;
|
unsigned ssect;
|
||||||
unsigned sssect;
|
unsigned sssect;
|
||||||
BOOL isContentsDoc;
|
BOOL isContentsDoc;
|
||||||
BOOL ivarsAtEnd;
|
BOOL ivarsAtEnd;
|
||||||
|
BOOL verbose;
|
||||||
|
BOOL warn;
|
||||||
}
|
}
|
||||||
- (void) decIndent;
|
- (void) decIndent;
|
||||||
- (void) incIndent;
|
- (void) incIndent;
|
||||||
|
@ -68,7 +71,7 @@
|
||||||
style: (NSString*)style
|
style: (NSString*)style
|
||||||
target: (NSString*)target
|
target: (NSString*)target
|
||||||
to: (NSMutableString*)buf;
|
to: (NSMutableString*)buf;
|
||||||
- (NSString*) outputDocument: (GSXMLNode*)node;
|
- (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file;
|
||||||
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf;
|
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf;
|
||||||
- (void) outputNodeList: (GSXMLNode*)node to: (NSMutableString*)buf;
|
- (void) outputNodeList: (GSXMLNode*)node to: (NSMutableString*)buf;
|
||||||
- (GSXMLNode*) outputBlock: (GSXMLNode*)node
|
- (GSXMLNode*) outputBlock: (GSXMLNode*)node
|
||||||
|
|
|
@ -22,11 +22,7 @@
|
||||||
|
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
|
||||||
#import "Foundation/NSAutoreleasePool.h"
|
#import "Foundation/Foundation.h"
|
||||||
#import "Foundation/NSArray.h"
|
|
||||||
#import "Foundation/NSDictionary.h"
|
|
||||||
#import "Foundation/NSSet.h"
|
|
||||||
#import "Foundation/NSUserDefaults.h"
|
|
||||||
#import "AGSHtml.h"
|
#import "AGSHtml.h"
|
||||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||||
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
|
#import "GNUstepBase/NSMutableString+GNUstepBase.h"
|
||||||
|
@ -108,6 +104,7 @@ static NSString *mainFont = nil;
|
||||||
RELEASE(localRefs);
|
RELEASE(localRefs);
|
||||||
RELEASE(projectRefs);
|
RELEASE(projectRefs);
|
||||||
RELEASE(indent);
|
RELEASE(indent);
|
||||||
|
RELEASE(fileName);
|
||||||
DEALLOC
|
DEALLOC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,9 +125,15 @@ static NSString *mainFont = nil;
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
indent = [[NSMutableString alloc] initWithCapacity: 64];
|
if (nil != (self = [super init]))
|
||||||
project = RETAIN([[NSUserDefaults standardUserDefaults]
|
{
|
||||||
stringForKey: @"Project"]);
|
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
|
indent = [[NSMutableString alloc] initWithCapacity: 64];
|
||||||
|
project = RETAIN([defs stringForKey: @"Project"]);
|
||||||
|
verbose = [defs boolForKey: @"Verbose"];
|
||||||
|
warn = [defs boolForKey: @"Warn"];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,10 +284,11 @@ static NSString *mainFont = nil;
|
||||||
return [s stringByReplacingString: @":" withString: @"$"];
|
return [s stringByReplacingString: @":" withString: @"$"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*) outputDocument: (GSXMLNode*)node
|
- (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file
|
||||||
{
|
{
|
||||||
NSMutableString *buf;
|
NSMutableString *buf;
|
||||||
|
|
||||||
|
ASSIGN(fileName, file);
|
||||||
if (localRefs == nil)
|
if (localRefs == nil)
|
||||||
{
|
{
|
||||||
localRefs = [AGSIndex new];
|
localRefs = [AGSIndex new];
|
||||||
|
@ -305,6 +309,7 @@ static NSString *mainFont = nil;
|
||||||
[self decIndent];
|
[self decIndent];
|
||||||
[buf appendString: @"</html>\n"];
|
[buf appendString: @"</html>\n"];
|
||||||
|
|
||||||
|
DESTROY(fileName);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1193,6 +1198,15 @@ static NSString *mainFont = nil;
|
||||||
GSXMLNode *email = nil;
|
GSXMLNode *email = nil;
|
||||||
GSXMLNode *url = nil;
|
GSXMLNode *url = nil;
|
||||||
GSXMLNode *desc = 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];
|
children = [children nextElement];
|
||||||
|
|
||||||
|
@ -1216,8 +1230,7 @@ static NSString *mainFont = nil;
|
||||||
if (url == nil)
|
if (url == nil)
|
||||||
{
|
{
|
||||||
[buf appendString: @"<dt>"];
|
[buf appendString: @"<dt>"];
|
||||||
[buf appendString: [[[author attributes]
|
[buf appendString: [name stringByEscapingXML]];
|
||||||
objectForKey: @"name"] stringByEscapingXML]];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1225,8 +1238,7 @@ static NSString *mainFont = nil;
|
||||||
[buf appendString: [[url attributes]
|
[buf appendString: [[url attributes]
|
||||||
objectForKey: @"url"]];
|
objectForKey: @"url"]];
|
||||||
[buf appendString: @"\">"];
|
[buf appendString: @"\">"];
|
||||||
[buf appendString: [[[author attributes]
|
[buf appendString: [name stringByEscapingXML]];
|
||||||
objectForKey: @"name"] stringByEscapingXML]];
|
|
||||||
[buf appendString: @"</a>"];
|
[buf appendString: @"</a>"];
|
||||||
}
|
}
|
||||||
if (email != nil)
|
if (email != nil)
|
||||||
|
@ -1267,9 +1279,24 @@ static NSString *mainFont = nil;
|
||||||
}
|
}
|
||||||
if ([[children name] isEqual: @"date"] == YES)
|
if ([[children name] isEqual: @"date"] == YES)
|
||||||
{
|
{
|
||||||
|
GSXMLNode *tmp = [children firstChild];
|
||||||
|
NSString *str;
|
||||||
|
|
||||||
[buf appendString: indent];
|
[buf appendString: indent];
|
||||||
[buf appendString: @"<p><b>Date:</b> "];
|
[buf appendString: @"<p><b>Date:</b> "];
|
||||||
[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: @"</p>\n"];
|
[buf appendString: @"</p>\n"];
|
||||||
children = [children nextElement];
|
children = [children nextElement];
|
||||||
}
|
}
|
||||||
|
@ -1719,17 +1746,24 @@ static NSString *mainFont = nil;
|
||||||
}
|
}
|
||||||
if (s == nil)
|
if (s == nil)
|
||||||
{
|
{
|
||||||
if (c == nil)
|
if (warn)
|
||||||
{
|
{
|
||||||
NSLog(@"Location of %@ '%@' not found or not unique"
|
NSString *ref;
|
||||||
@" (referenced from %@:\n%@).",
|
|
||||||
type, r, base, [[node parent] parent]);
|
ref = [NSString stringWithFormat:
|
||||||
}
|
@" (referenced from %@ in %@).",
|
||||||
else
|
base, fileName];
|
||||||
{
|
if (c == nil)
|
||||||
NSLog(@"Location of the %@ version of %@ '%@' not found"
|
{
|
||||||
@"(referenced from %@:\n%@).",
|
NSLog(@"Warning - location of %@ '%@'"
|
||||||
c, type, r, base, [[node parent] parent]);
|
@" 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)
|
if (tmp == nil)
|
||||||
{
|
{
|
||||||
|
|
|
@ -746,7 +746,7 @@ static BOOL snuggleStart(NSString *t)
|
||||||
|
|
||||||
if (warn == YES && [[d objectForKey: @"Implemented"] isEqual: @"YES"] == NO)
|
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];
|
[str appendFormat: @" <%@ type=\"", kind];
|
||||||
|
@ -790,7 +790,7 @@ static BOOL snuggleStart(NSString *t)
|
||||||
|
|
||||||
if (warn == YES && [[d objectForKey: @"Implemented"] isEqual: @"YES"] == NO)
|
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 @@ static BOOL snuggleStart(NSString *t)
|
||||||
}
|
}
|
||||||
else if (warn == YES)
|
else if (warn == YES)
|
||||||
{
|
{
|
||||||
NSLog(@"Warning ... unit %@ is not implemented where expected", name);
|
NSLog(@"Warning - unit %@ is not implemented where expected", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2178,7 +2178,7 @@ main(int argc, char **argv, char **env)
|
||||||
[html setProjectRefs: projectRefs];
|
[html setProjectRefs: projectRefs];
|
||||||
[html setLocalRefs: localRefs];
|
[html setLocalRefs: localRefs];
|
||||||
[html setInstanceVariablesAtEnd: instanceVarsAtEnd];
|
[html setInstanceVariablesAtEnd: instanceVarsAtEnd];
|
||||||
generated = [html outputDocument: root];
|
generated = [html outputDocument: root name: gsdocfile];
|
||||||
d = [generated dataUsingEncoding: NSUTF8StringEncoding];
|
d = [generated dataUsingEncoding: NSUTF8StringEncoding];
|
||||||
if ([d writeToFile: htmlfile atomically: YES] == NO)
|
if ([d writeToFile: htmlfile atomically: YES] == NO)
|
||||||
{
|
{
|
||||||
|
|
|
@ -578,10 +578,16 @@
|
||||||
<!-- The version of the document. -->
|
<!-- The version of the document. -->
|
||||||
<!ELEMENT version (%text;)*>
|
<!ELEMENT version (%text;)*>
|
||||||
|
|
||||||
<!-- The date the document was written. -->
|
<!-- The date the document was written.
|
||||||
|
If the text content is empty, output produced from the document
|
||||||
|
should describe the date/time at which that output was generated.
|
||||||
|
-->
|
||||||
<!ELEMENT date (%text;)*>
|
<!ELEMENT date (%text;)*>
|
||||||
|
|
||||||
<!-- An author. -->
|
<!-- An author.
|
||||||
|
If the name attribute is empty, output produced from the document
|
||||||
|
should describe the user account which generated the output.
|
||||||
|
-->
|
||||||
<!ELEMENT author (email?, url?, desc?)>
|
<!ELEMENT author (email?, url?, desc?)>
|
||||||
<!ATTLIST author
|
<!ATTLIST author
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
|
|
Loading…
Reference in a new issue