diff --git a/ChangeLog b/ChangeLog index a24585800..11cd696c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,18 @@ 2001-12-16 Richard Frith-Macdonald + * Source/NSObject.m: Make initial comment an autogsdoc comment. * 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 diff --git a/Source/NSObject.m b/Source/NSObject.m index 826b5da4f..9cb524271 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -1,4 +1,4 @@ -/* Implementation of NSObject for GNUStep +/** Implementation of NSObject for GNUStep Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Written by: Andrew Kachites McCallum diff --git a/Tools/AGSHtml.h b/Tools/AGSHtml.h index 3518ac60d..8213d14df 100644 --- a/Tools/AGSHtml.h +++ b/Tools/AGSHtml.h @@ -3,10 +3,9 @@ /** AGSHtml ... a class to output html for a gsdoc file - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - Written by: - richard@brainstorm.co.uk + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index 556f6d487..0e7dbaaf7 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -1,10 +1,9 @@ /** AGSHtml ... a class to output html for a gsdoc file - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - Written by: - richard@brainstorm.co.uk + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project @@ -400,7 +399,7 @@ static NSMutableSet *textNodes = nil; } else { - [buf appendFormat: @"", ename]; + [buf appendFormat: @"", ename]; } [self outputText: [node children] to: buf]; if (ename == nil) @@ -598,8 +597,8 @@ static NSMutableSet *textNodes = nil; if ([[children name] isEqual: @"copy"] == YES) { [buf appendString: indent]; - [buf appendString: @"

Copyright: "]; - [self outputNode: [children children] to: buf]; + [buf appendString: @"

Copyright: (C) "]; + [self outputText: [children children] to: buf]; [buf appendString: @"

\n"]; children = firstElement([children next]); } diff --git a/Tools/AGSIndex.h b/Tools/AGSIndex.h index d84cf1d30..e5a995e55 100644 --- a/Tools/AGSIndex.h +++ b/Tools/AGSIndex.h @@ -3,10 +3,9 @@ /** AGSIndex ... a class to create references for a gsdoc file - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - Written by: - richard@brainstorm.co.uk + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project diff --git a/Tools/AGSIndex.m b/Tools/AGSIndex.m index 07b01c8cd..066cb8471 100644 --- a/Tools/AGSIndex.m +++ b/Tools/AGSIndex.m @@ -1,10 +1,9 @@ /** AGSIndex ... a class to create references for a gsdoc file - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - Written by: - richard@brainstorm.co.uk + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project diff --git a/Tools/AGSOutput.h b/Tools/AGSOutput.h index e9a62d371..970c07d24 100644 --- a/Tools/AGSOutput.h +++ b/Tools/AGSOutput.h @@ -3,9 +3,9 @@ /** AGSOutput ... a class to output gsdoc source - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index da689025c..c76a415a2 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -1,9 +1,9 @@ /** AGSOutput ... a class to output gsdoc source - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project diff --git a/Tools/AGSParser.h b/Tools/AGSParser.h index fc6310da6..4753d364d 100644 --- a/Tools/AGSParser.h +++ b/Tools/AGSParser.h @@ -3,9 +3,9 @@ /** AGSParser ... a tool to get documention info from ObjC source - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index 7c24d92c8..117aace87 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -1,9 +1,9 @@ /** AGSParser ... a tool to get documention info from ObjC source - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project @@ -1410,14 +1410,14 @@ fail: if (commentsRead == NO && comment != nil) { unsigned commentLength = [comment length]; - NSMutableArray *authors = nil; + NSMutableArray *authors; NSEnumerator *enumerator; NSArray *keys; NSString *key; + authors = (NSMutableArray*)[info objectForKey: @"authors"]; /* - * Scan through for authors unless we got them from - * the interface. + * Scan through for more authors */ r = NSMakeRange(0, commentLength); while (r.length > 0) @@ -1451,7 +1451,10 @@ fail: [info setObject: authors forKey: @"authors"]; RELEASE(authors); } - [authors addObject: author]; + if ([authors containsObject: author] == NO) + { + [authors addObject: author]; + } } 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 + * Author: name + * By: name + * By: name + */ + r = NSMakeRange(0, commentLength); + while (r.length > 0) { + NSString *term = @"\n"; + NSRange a; + NSRange b; + /* - * Extract RCS keyword information for author - * if it is available. + * Look for 'Author:' or 'By:' and use whichever we + * 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) { unsigned i = NSMaxRange(r); + NSString *line; NSString *author; r = NSMakeRange(i, commentLength - i); - r = [comment rangeOfString: @"$" + r = [comment rangeOfString: term options: NSLiteralSearch 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) { - r = NSMakeRange(i, r.location - i); - author = [comment substringWithRange: r]; - author = [author stringByTrimmingSpaces]; - authors = [NSMutableArray arrayWithObject: author]; + NSString *name; + NSString *mail; + + 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: + @"" + @"%@", name, mail, mail]; + } + else + { + author = [NSString stringWithFormat: + @"", line]; + } + r = NSMakeRange(i, commentLength - i); + if (authors == nil) + { + authors = [NSMutableArray new]; [info setObject: authors forKey: @"authors"]; + RELEASE(authors); + } + if ([authors containsObject: author] == NO) + { + [authors addObject: author]; } } } @@ -1536,6 +1618,43 @@ fail: } } + /* + * If no ... 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: + @"%@", line]; + [info setObject: line forKey: @"copy"]; + } + } + } + /* * If no ... then try RCS info. */ diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index 8394fa342..d3b038003 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -1,10 +1,9 @@ /** This tool produces gsdoc files from source files. Autogsdoc ... a tool to make documentation from source code - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. - Written by: - richard@brainstorm.co.uk + Written by: Richard Frith-Macdonald Created: October 2001 This file is part of the GNUstep Project @@ -62,7 +61,13 @@ <author> A description of the author of the code - may be repeated to handle the case where a document has multiple authors. Placed in the - head of the gsdoc output. + head of the gsdoc output.
+ As an aid to readability of the source, some special additional + processing is performed related to the document author -
+ Any line of the form 'Author: name <email-address>', or + 'By: name <email-address>', or 'Author: name' or 'By: name' + will be recognised and converted to an author element, + possibly containing an email element.
<back> Placed in the gsdoc output just before the end of the body of the @@ -75,7 +80,11 @@ <copy> Copyright of the content of the document ... placed in the head - of the gsdoc output. + of the gsdoc output.
+ As an aid to readability of the source, some special additional + processing is performed -
+ Any line of the form 'Copyright (C) text' will be recognised and + converted to a copy element.
<date> 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"]; if (sourceDirectory == nil) { - sourceDirectory = headerDirectory; + sourceDirectory = @"."; } documentationDirectory = [defs stringForKey: @"DocumentationDirectory"];