Many minor autogsdoc improvements.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11777 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-12-16 13:36:06 +00:00
parent d08092b29b
commit 70b820fb3c
11 changed files with 179 additions and 43 deletions

View file

@ -1,6 +1,18 @@
2001-12-16 Richard Frith-Macdonald <rfm@gnu.org> 2001-12-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSObject.m: Make initial comment an autogsdoc comment.
* Tools/gsdoc-0_6_7.dtd: Fix protocol error reported by Adam * Tools/gsdoc-0_6_7.dtd: Fix protocol error reported by Adam
* Tools/AGSHtml.h:
* Tools/AGSHtml.m:
* Tools/AGSIndex.h:
* Tools/AGSIndex.m:
* Tools/AGSOutput.h:
* Tools/AGSOutput.m:
* Tools/AGSParser.h:
* Tools/AGSParser.m:
* Tools/autogsdoc.m: Tidied initial comments to take advantage of
new code to parse author and copyright details. Fixed several
minor bugs in various parts of the software. Updated documentation.
2001-12-15 Fred Kiefer <FredKiefer@gmx.de> 2001-12-15 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -1,4 +1,4 @@
/* Implementation of NSObject for GNUStep /** Implementation of NSObject for GNUStep
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu> Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>

View file

@ -3,10 +3,9 @@
/** /**
<title>AGSHtml ... a class to output html for a gsdoc file</title> <title>AGSHtml ... a class to output html for a gsdoc file</title>
Copyright <copy>(C) 2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
Written by: <author name="Richard Frith-Macdonald"> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
<email>richard@brainstorm.co.uk</email></author>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project

View file

@ -1,10 +1,9 @@
/** /**
<title>AGSHtml ... a class to output html for a gsdoc file</title> <title>AGSHtml ... a class to output html for a gsdoc file</title>
Copyright <copy>(C) 2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
Written by: <author name="Richard Frith-Macdonald"> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
<email>richard@brainstorm.co.uk</email></author>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project
@ -400,7 +399,7 @@ static NSMutableSet *textNodes = nil;
} }
else else
{ {
[buf appendFormat: @"<a href=\"%@\"><code>", ename]; [buf appendFormat: @"<a href=\"mailto:%@\"><code>", ename];
} }
[self outputText: [node children] to: buf]; [self outputText: [node children] to: buf];
if (ename == nil) if (ename == nil)
@ -598,8 +597,8 @@ static NSMutableSet *textNodes = nil;
if ([[children name] isEqual: @"copy"] == YES) if ([[children name] isEqual: @"copy"] == YES)
{ {
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<p>Copyright: "]; [buf appendString: @"<p>Copyright: (C) "];
[self outputNode: [children children] to: buf]; [self outputText: [children children] to: buf];
[buf appendString: @"</p>\n"]; [buf appendString: @"</p>\n"];
children = firstElement([children next]); children = firstElement([children next]);
} }

View file

@ -3,10 +3,9 @@
/** /**
<title>AGSIndex ... a class to create references for a gsdoc file</title> <title>AGSIndex ... a class to create references for a gsdoc file</title>
Copyright <copy>(C) 2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
Written by: <author name="Richard Frith-Macdonald"> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
<email>richard@brainstorm.co.uk</email></author>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project

View file

@ -1,10 +1,9 @@
/** /**
<title>AGSIndex ... a class to create references for a gsdoc file</title> <title>AGSIndex ... a class to create references for a gsdoc file</title>
Copyright <copy>(C) 2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
Written by: <author name="Richard Frith-Macdonald"> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
<email>richard@brainstorm.co.uk</email></author>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project

View file

@ -3,9 +3,9 @@
/** /**
<title>AGSOutput ... a class to output gsdoc source</title> <title>AGSOutput ... a class to output gsdoc source</title>
Copyright (C) <copy>2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
<author name="Richard Frith-Macdonald"></author><richard@brainstorm.co.uk> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project

View file

@ -1,9 +1,9 @@
/** /**
<title>AGSOutput ... a class to output gsdoc source</title> <title>AGSOutput ... a class to output gsdoc source</title>
Copyright (C) <copy>2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
<author name="Richard Frith-Macdonald"></author><richard@brainstorm.co.uk> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project

View file

@ -3,9 +3,9 @@
/** /**
<title>AGSParser ... a tool to get documention info from ObjC source</title> <title>AGSParser ... a tool to get documention info from ObjC source</title>
Copyright (C) <copy>2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
<author name="Richard Frith-Macdonald"></author> <richard@brainstorm.co.uk> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project

View file

@ -1,9 +1,9 @@
/** /**
<title>AGSParser ... a tool to get documention info from ObjC source</title> <title>AGSParser ... a tool to get documention info from ObjC source</title>
Copyright (C) <copy>2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
<author name="Richard Frith-Macdonald"></author> <richard@brainstorm.co.uk> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project
@ -1410,14 +1410,14 @@ fail:
if (commentsRead == NO && comment != nil) if (commentsRead == NO && comment != nil)
{ {
unsigned commentLength = [comment length]; unsigned commentLength = [comment length];
NSMutableArray *authors = nil; NSMutableArray *authors;
NSEnumerator *enumerator; NSEnumerator *enumerator;
NSArray *keys; NSArray *keys;
NSString *key; NSString *key;
authors = (NSMutableArray*)[info objectForKey: @"authors"];
/* /*
* Scan through for authors unless we got them from * Scan through for more authors
* the interface.
*/ */
r = NSMakeRange(0, commentLength); r = NSMakeRange(0, commentLength);
while (r.length > 0) while (r.length > 0)
@ -1451,7 +1451,10 @@ fail:
[info setObject: authors forKey: @"authors"]; [info setObject: authors forKey: @"authors"];
RELEASE(authors); RELEASE(authors);
} }
[authors addObject: author]; if ([authors containsObject: author] == NO)
{
[authors addObject: author];
}
} }
else else
{ {
@ -1459,29 +1462,108 @@ fail:
} }
} }
} }
if (authors == nil) /*
* In addition to fully specified author elements in the
* comment, we look for lines of the formats -
* Author: name <email>
* Author: name
* By: name <email>
* By: name
*/
r = NSMakeRange(0, commentLength);
while (r.length > 0)
{ {
NSString *term = @"\n";
NSRange a;
NSRange b;
/* /*
* Extract RCS keyword information for author * Look for 'Author:' or 'By:' and use whichever we
* if it is available. * find first.
*/ */
r = [comment rangeOfString: @"$Author:"]; a = [comment rangeOfString: @"author:"
options: NSCaseInsensitiveSearch
range: r];
b = [comment rangeOfString: @"by:"
options: NSCaseInsensitiveSearch
range: r];
if (a.length > 0)
{
if (b.length > 0 && b.location < a.location)
{
r = b;
}
else
{
r = a;
/*
* A line '$Author$' is an RCS tag and is
* terminated by the second dollar rather than
* by a newline.
*/
if (r.location > 0
&& [comment characterAtIndex: r.location-1] == '$')
{
term = @"$";
}
}
}
else
{
r = b;
}
if (r.length > 0) if (r.length > 0)
{ {
unsigned i = NSMaxRange(r); unsigned i = NSMaxRange(r);
NSString *line;
NSString *author; NSString *author;
r = NSMakeRange(i, commentLength - i); r = NSMakeRange(i, commentLength - i);
r = [comment rangeOfString: @"$" r = [comment rangeOfString: term
options: NSLiteralSearch options: NSLiteralSearch
range: r]; range: r];
if (r.length == 0)
{
r.location = commentLength;
}
r = NSMakeRange(i, NSMaxRange(r) - i);
line = [comment substringWithRange: r];
line = [line stringByTrimmingSpaces];
i = NSMaxRange(r);
r = [line rangeOfString: @"<"];
if (r.length > 0) if (r.length > 0)
{ {
r = NSMakeRange(i, r.location - i); NSString *name;
author = [comment substringWithRange: r]; NSString *mail;
author = [author stringByTrimmingSpaces];
authors = [NSMutableArray arrayWithObject: author]; name = [line substringToIndex: r.location];
name = [name stringByTrimmingSpaces];
mail = [line substringFromIndex: r.location+1];
r = [mail rangeOfString: @">"];
if (r.length > 0)
{
mail = [mail substringToIndex: r.location];
}
author = [NSString stringWithFormat:
@"<author name=\"%@\"><email address=\"%@\">"
@"%@</email></author>", name, mail, mail];
}
else
{
author = [NSString stringWithFormat:
@"<author name=\"%@\"></author>", line];
}
r = NSMakeRange(i, commentLength - i);
if (authors == nil)
{
authors = [NSMutableArray new];
[info setObject: authors forKey: @"authors"]; [info setObject: authors forKey: @"authors"];
RELEASE(authors);
}
if ([authors containsObject: author] == NO)
{
[authors addObject: author];
} }
} }
} }
@ -1536,6 +1618,43 @@ fail:
} }
} }
/*
* If no <copy> ... </copy> then try Copyright:
*/
if ([info objectForKey: @"copy"] == nil)
{
r = NSMakeRange(0, commentLength);
while (r.length > 0)
{
/*
* Look for 'Copyright:'
*/
r = [comment rangeOfString: @"copyright (c)"
options: NSCaseInsensitiveSearch
range: r];
if (r.length > 0)
{
unsigned i = NSMaxRange(r);
NSString *line;
r = NSMakeRange(i, commentLength - i);
r = [comment rangeOfString: @"\n"
options: NSLiteralSearch
range: r];
if (r.length == 0)
{
r.location = commentLength;
}
r = NSMakeRange(i, NSMaxRange(r) - i);
line = [comment substringWithRange: r];
line = [line stringByTrimmingSpaces];
line = [NSString stringWithFormat:
@"<copy>%@</copy>", line];
[info setObject: line forKey: @"copy"];
}
}
}
/* /*
* If no <date> ... </date> then try RCS info. * If no <date> ... </date> then try RCS info.
*/ */

View file

@ -1,10 +1,9 @@
/** This tool produces gsdoc files from source files. /** This tool produces gsdoc files from source files.
<title>Autogsdoc ... a tool to make documentation from source code</title> <title>Autogsdoc ... a tool to make documentation from source code</title>
Copyright <copy>(C) 2001 Free Software Foundation, Inc.</copy> Copyright (C) 2001 Free Software Foundation, Inc.
Written by: <author name="Richard Frith-Macdonald"> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
<email>richard@brainstorm.co.uk</email></author>
Created: October 2001 Created: October 2001
This file is part of the GNUstep Project This file is part of the GNUstep Project
@ -62,7 +61,13 @@
<item><strong>&lt;author&gt;</strong> <item><strong>&lt;author&gt;</strong>
A description of the author of the code - may be repeated to handle A description of the author of the code - may be repeated to handle
the case where a document has multiple authors. Placed in the the case where a document has multiple authors. Placed in the
head of the gsdoc output. head of the gsdoc output.<br />
As an aid to readability of the source, some special additional
processing is performed related to the document author -<br />
Any line of the form 'Author: name &lt;email-address&gt;', or
'By: name &lt;email-address&gt;', or 'Author: name' or 'By: name'
will be recognised and converted to an <em>author</em> element,
possibly containing an <em>email</em> element.
</item> </item>
<item><strong>&lt;back&gt;</strong> <item><strong>&lt;back&gt;</strong>
Placed in the gsdoc output just before the end of the body of the Placed in the gsdoc output just before the end of the body of the
@ -75,7 +80,11 @@
</item> </item>
<item><strong>&lt;copy&gt;</strong> <item><strong>&lt;copy&gt;</strong>
Copyright of the content of the document ... placed in the head Copyright of the content of the document ... placed in the head
of the gsdoc output. of the gsdoc output.<br />
As an aid to readability of the source, some special additional
processing is performed -<br />
Any line of the form 'Copyright (C) text' will be recognised and
converted to a <em>copy</em> element.
</item> </item>
<item><strong>&lt;date&gt;</strong> <item><strong>&lt;date&gt;</strong>
Date of the revision of the document ... placed in the head Date of the revision of the document ... placed in the head
@ -316,7 +325,7 @@ main(int argc, char **argv, char **env)
sourceDirectory = [defs stringForKey: @"SourceDirectory"]; sourceDirectory = [defs stringForKey: @"SourceDirectory"];
if (sourceDirectory == nil) if (sourceDirectory == nil)
{ {
sourceDirectory = headerDirectory; sourceDirectory = @".";
} }
documentationDirectory = [defs stringForKey: @"DocumentationDirectory"]; documentationDirectory = [defs stringForKey: @"DocumentationDirectory"];