Documentation improvements

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11932 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-01-02 06:50:30 +00:00
parent 8d210dfb59
commit c07f461919
7 changed files with 210 additions and 93 deletions

View file

@ -1,3 +1,11 @@
2002-01-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GNUmakefile: Use new -Standards flag for autogsdoc
* Tools/AGSparser.[hm]: New support for standards and some tidyups
* Tools/AGSHtml.[hm]: Improved output and simplified a little.
* Tools/autogsdoc.m: New Standards flag to turn on support for
generation of standards complience notes in documentation.
Tue Jan 1 11:18:35 2002 Nicola Pero <n.pero@mi.flashnet.it> Tue Jan 1 11:18:35 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSFileManager.m (custom_strdup): New inline function * Source/NSFileManager.m (custom_strdup): New inline function

View file

@ -136,8 +136,12 @@ GS_EXPORT NSString* const NSLocale;
*/ */
+ (void) resetStandardUserDefaults; + (void) resetStandardUserDefaults;
#endif #endif
#ifndef STRICT_OPENSTEP
#ifndef STRICT_MACOS_X
+ (NSArray*) userLanguages; + (NSArray*) userLanguages;
+ (void) setUserLanguages: (NSArray*)languages; + (void) setUserLanguages: (NSArray*)languages;
#endif
#endif
/* Initializing the User Defaults */ /* Initializing the User Defaults */
- (id) init; - (id) init;

View file

@ -429,7 +429,10 @@ libgnustep-base_HEADER_FILES = $(FOUNDATION_HEADERS)
DOCUMENT_NAME = Base DOCUMENT_NAME = Base
Base_AGSDOC_FILES = $(FOUNDATION_HEADERS) Base_AGSDOC_FILES = $(FOUNDATION_HEADERS)
Base_AGSDOC_FLAGS = -HeaderDirectory ../Headers/Foundation -Declared Foundation Base_AGSDOC_FLAGS = \
-HeaderDirectory ../Headers/Foundation \
-Declared Foundation \
-Standards YES
-include Makefile.preamble -include Makefile.preamble

View file

@ -488,6 +488,27 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"]; [buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
} }
} }
else if ([name isEqual: @"declared"] == YES)
{
[buf appendString: indent];
[buf appendString: @"<blockquote>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<dl>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<dt><b>Declared in:</b></dt>\n"];
[buf appendString: indent];
[buf appendString: @"<dd>"];
[self outputText: [node children] to: buf];
[buf appendString: @"</dd>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</dl>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</blockquote>\n"];
}
else if ([name isEqual: @"desc"] == YES) else if ([name isEqual: @"desc"] == YES)
{ {
[buf appendString: indent]; [buf appendString: indent];
@ -985,19 +1006,7 @@ static NSMutableSet *textNodes = nil;
children = [node next]; children = [node next];
if ([[children name] isEqual: @"standards"]) if ([[children name] isEqual: @"standards"])
{ {
tmp = [children children]; [self outputNode: children to: buf];
if (tmp != nil)
{
[buf appendString: indent];
[buf appendString: @"<b>Standards:</b>"];
while (tmp != nil)
{
[buf appendString: @" "];
[buf appendString: [tmp name]];
tmp = [tmp next];
}
[buf appendString: @"<br />\n"];
}
} }
if ((str = [prop objectForKey: @"init"]) != nil if ((str = [prop objectForKey: @"init"]) != nil
@ -1100,6 +1109,32 @@ static NSMutableSet *textNodes = nil;
[self outputText: children to: buf]; [self outputText: children to: buf];
[buf appendString: @"</code>"]; [buf appendString: @"</code>"];
} }
else if ([name isEqual: @"standards"])
{
GSXMLNode *tmp = [node children];
BOOL first = YES;
if (tmp != nil)
{
[buf appendString: indent];
[buf appendString: @"<b>Standards:</b>"];
while (tmp != nil)
{
if (first == YES)
{
first = NO;
[buf appendString: @" "];
}
else
{
[buf appendString: @", "];
}
[buf appendString: [tmp name]];
tmp = [tmp next];
}
[buf appendString: @"<br />\n"];
}
}
else if ([name isEqual: @"strong"] == YES) else if ([name isEqual: @"strong"] == YES)
{ {
[buf appendString: @"<strong>"]; [buf appendString: @"<strong>"];
@ -1135,10 +1170,7 @@ static NSMutableSet *textNodes = nil;
if (node != nil && [[node name] isEqual: @"declared"] == YES) if (node != nil && [[node name] isEqual: @"declared"] == YES)
{ {
[buf appendString: indent]; [self outputNode: node to: buf];
[buf appendString: @"Declared: "];
[self outputText: [node children] to: buf];
[buf appendString: @"<br />\n"];
node = [node next]; node = [node next];
} }
if (node != nil && [[node name] isEqual: @"desc"] == YES) if (node != nil && [[node name] isEqual: @"desc"] == YES)
@ -1450,29 +1482,13 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
- (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf
{ {
GSXMLNode *t;
NSMutableArray *a; NSMutableArray *a;
node = [node children]; node = [node children];
if (node != nil && [[node name] isEqual: @"declared"] == YES) if (node != nil && [[node name] isEqual: @"declared"] == YES)
{ {
[buf appendString: indent]; [self outputNode: node to: buf];
[buf appendString: @"<blockquote>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<dl>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<dt><b>Declared in:</b></dt>\n"];
[buf appendString: indent];
[buf appendString: @"<dd>"];
[self outputText: [node children] to: buf];
[buf appendString: @"</dd>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</dl>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</blockquote>\n"];
node = [node next]; node = [node next];
} }
@ -1510,6 +1526,38 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
node = [node next]; node = [node next];
} }
t = node;
while (t != nil && [[t name] isEqual: @"standards"] == NO)
{
t = [t next];
}
if (t != nil && [t children] != nil)
{
t = [t children];
[buf appendString: indent];
[buf appendString: @"<blockquote>\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<b>Standards:</b>\n"];
[buf appendString: indent];
[buf appendString: @"<ul>\n"];
[self incIndent];
while (t != nil)
{
[buf appendString: indent];
[buf appendString: @"<li>"];
[buf appendString: [t name]];
[buf appendString: @"</li>\n"];
t = [t next];
}
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</ul>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</blockquote>\n"];
}
a = [localRefs methodsInUnit: unit]; a = [localRefs methodsInUnit: unit];
if ([a count] > 0) if ([a count] > 0)
{ {
@ -1545,24 +1593,6 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[self outputNode: node to: buf]; [self outputNode: node to: buf];
node = [node next]; node = [node next];
} }
if (node != nil && [[node name] isEqual: @"standards"] == YES)
{
GSXMLNode *tmp = [node children];
if (tmp != nil)
{
[buf appendString: indent];
[buf appendString: @"<b>Standards:</b>"];
while (tmp != nil)
{
[buf appendString: @" "];
[buf appendString: [tmp name]];
tmp = [tmp next];
}
[buf appendString: @"<br />\n"];
}
node = [node next];
}
} }
/** /**

View file

@ -81,6 +81,8 @@
- (NSMutableArray*) parseProtocolList; - (NSMutableArray*) parseProtocolList;
- (void) reset; - (void) reset;
- (void) setDeclared: (NSString*)name; - (void) setDeclared: (NSString*)name;
- (void) setGenerateStandards: (BOOL)flag;
- (void) setStandards: (NSMutableDictionary*)dict;
- (void) setupBuffer; - (void) setupBuffer;
- (unsigned) skipBlock; - (unsigned) skipBlock;
- (unsigned) skipComment; - (unsigned) skipComment;
@ -92,6 +94,5 @@
- (unsigned) skipStatementLine; - (unsigned) skipStatementLine;
- (unsigned) skipUnit; - (unsigned) skipUnit;
- (unsigned) skipWhiteSpace; - (unsigned) skipWhiteSpace;
- (void) setStandards: (NSMutableDictionary*)dict;
@end @end
#endif #endif

View file

@ -57,7 +57,6 @@
identStart = RETAIN([NSCharacterSet characterSetWithCharactersInString: identStart = RETAIN([NSCharacterSet characterSetWithCharactersInString:
@"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]); @"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]);
info = [[NSMutableDictionary alloc] initWithCapacity: 6]; info = [[NSMutableDictionary alloc] initWithCapacity: 6];
ifStack = [[NSMutableArray alloc] initWithCapacity: 4];
return self; return self;
} }
@ -1206,6 +1205,96 @@ fail:
ASSIGN(declared, name); ASSIGN(declared, name);
} }
/**
* Turn on or off parsing of preprocessor conditional compilation info
* indicating the standards complied with. When this is turned on, we
* assume that all standards are complied with by default.<br />
* You should only turn this on while parsing the GNUstep source code.
*/
- (void) setGenerateStandards: (BOOL)flag
{
if (flag == NO)
{
DESTROY(ifStack);
}
else if (ifStack == nil)
{
ifStack = [[NSMutableArray alloc] initWithCapacity: 4];
[ifStack addObject: @"OpenStep"];
[ifStack addObject: @"MacOS-X"];
[ifStack addObject: @"GNUstep"];
}
}
/**
* Store the current standards information derived from preprocessor
* conditionals in the supplied dictionary ... this will be used by
* the AGSOutput class to put standards markup in the gsdoc output.
*/
- (void) setStandards: (NSMutableDictionary*)dict
{
unsigned c = [ifStack count];
BOOL hadG = NO;
BOOL hadM = NO;
BOOL hadO = NO;
if (c > 0)
{
NSMutableString *s = nil;
BOOL found = NO;
s = [NSMutableString stringWithCString: "<standards>"];
while (c-- > 0)
{
NSString *name = [ifStack objectAtIndex: c];
/*
* We don't produce output for empty strings or
* the 'NotGNUstep' string.
*/
if ([name isEqualToString: @""] == YES
|| [name isEqualToString: @"NotGNUstep"] == YES)
{
continue;
}
if ([name isEqualToString: @"GNUstep"] == YES
|| [name isEqualToString: @"NotGNUstep"] == YES)
{
if (hadG == YES)
{
continue;
}
hadG = YES;
}
if ([name isEqualToString: @"OpenStep"] == YES
|| [name isEqualToString: @"NotOpenStep"] == YES)
{
if (hadO == YES)
{
continue;
}
hadO = YES;
}
if ([name isEqualToString: @"MacOS-X"] == YES
|| [name isEqualToString: @"NotMacOS-X"] == YES)
{
if (hadM == YES)
{
continue;
}
hadM = YES;
}
found = YES;
[s appendFormat: @"<%@ />", name];
}
if (found == YES)
{
[s appendString: @"</standards>"];
[dict setObject: s forKey: @"Standards"];
}
}
}
/** /**
* Read in the file to be parsed and store it in a temporary unicode * Read in the file to be parsed and store it in a temporary unicode
* buffer. Perform basic transformations on the buffer to simplify * buffer. Perform basic transformations on the buffer to simplify
@ -1821,6 +1910,14 @@ fail:
*/ */
- (unsigned) skipPreprocessor - (unsigned) skipPreprocessor
{ {
/*
* If we are not doing preprocessor handling ... just skip to end of line.
*/
if (ifStack == nil)
{
return [self skipRemainderOfLine];
}
while (pos < length && [spaces characterIsMember: buffer[pos]] == YES) while (pos < length && [spaces characterIsMember: buffer[pos]] == YES)
{ {
pos++; pos++;
@ -2107,42 +2204,5 @@ fail:
return pos; return pos;
} }
/**
* Store the current standards information derived from preprocessor
* conditionals in the supplied dictionary ... this will be used by
* the AGSOutput class to put standards markup in the gsdoc output.
*/
- (void) setStandards: (NSMutableDictionary*)dict
{
unsigned c = [ifStack count];
if (c > 0)
{
NSMutableString *s = nil;
BOOL found = NO;
s = [NSMutableString stringWithCString: "<standards>"];
while (c-- > 0)
{
NSString *name = [ifStack objectAtIndex: c];
/*
* We don't produce output for empty strings or
* the 'NotGNUstep' string.
*/
if ([name isEqualToString: @""] == NO
&& [name isEqualToString: @"NotGNUstep"] == NO)
{
found = YES;
[s appendFormat: @"<%@ />", name];
}
}
if (found == YES)
{
[s appendString: @"</standards>"];
[dict setObject: s forKey: @"Standards"];
}
}
}
@end @end

View file

@ -252,6 +252,14 @@
log which files are being regenerated because of their dependencies log which files are being regenerated because of their dependencies
on other files. on other files.
</item> </item>
<item><strong>Standards</strong>
A boolean value used to specify whether the program should insert
information about standards complience into ythe documentation.
This should only be used when documenting the GNUstep libraries
and tools themselves as it assumes that the code being documented
is part of GNUstep and possibly complies with the OpenStep standard
or implements MacOS-X compatible methods.
</item>
<item><strong>SourceDirectory</strong> <item><strong>SourceDirectory</strong>
May be used to specify the directory to be searched for source May be used to specify the directory to be searched for source
(anything other than <code>.h</code> files ... which are controlled (anything other than <code>.h</code> files ... which are controlled
@ -342,6 +350,7 @@ 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);
@ -359,6 +368,7 @@ 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)
@ -464,6 +474,7 @@ main(int argc, char **argv, char **env)
prjRefs = [AGSIndex new]; prjRefs = [AGSIndex new];
indexer = [AGSIndex new]; indexer = [AGSIndex new];
parser = [AGSParser new]; parser = [AGSParser new];
[parser setGenerateStandards: standards];
output = [AGSOutput new]; output = [AGSOutput new];
/* /*