diff --git a/Source/DocMakefile b/Source/DocMakefile index f24ab3223..81e27f666 100644 --- a/Source/DocMakefile +++ b/Source/DocMakefile @@ -244,7 +244,8 @@ GCObject.h \ # directory. # Base_AGSDOC_FLAGS = \ - -MakeFrames YES \ + -MakeFrames NO \ + -IndexFile Base \ -DocumentationDirectory ../Documentation/Base \ -HeaderDirectory ../Headers/Foundation \ -Declared Foundation \ @@ -253,14 +254,14 @@ Base_AGSDOC_FLAGS = \ -ConstantsTemplate TypesAndConstants \ -FunctionsTemplate Functions \ -MacrosTemplate Functions \ - -StylesheetURL gnustepStyle \ -TypedefsTemplate TypesAndConstants \ -VariablesTemplate TypesAndConstants \ -WordMap '{\ }' -Up Base BaseAdditions_AGSDOC_FLAGS = \ - -MakeFrames YES \ + -MakeFrames NO \ + -IndexFile BaseAdditions \ -DocumentationDirectory ../Documentation/BaseAdditions \ -HeaderDirectory ../Headers/GNUstepBase \ -Declared GNUstepBase \ diff --git a/Tools/AGSHtml.h b/Tools/AGSHtml.h index b89e276e0..e8d9f9cff 100644 --- a/Tools/AGSHtml.h +++ b/Tools/AGSHtml.h @@ -50,6 +50,7 @@ unsigned sssect; BOOL isContentsDoc; BOOL ivarsAtEnd; + BOOL cssNavigation; BOOL verbose; BOOL warn; } @@ -61,6 +62,9 @@ - (NSString*) makeLink: (NSString*)r ofType: (NSString*)t isRef: (BOOL)f; +- (NSString*) makeURL: (NSString*)r + ofType: (NSString*)t + isRef: (BOOL)f; - (NSString*) makeLink: (NSString*)r ofType: (NSString*)t inUnit: (NSString*)u diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index 14e94851b..f3294c697 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -253,6 +253,7 @@ - (id) init project = RETAIN([defs stringForKey: @"Project"]); verbose = [defs boolForKey: @"Verbose"]; warn = [defs boolForKey: @"Warn"]; + cssNavigation = [defs boolForKey: @"MakeFrames"] ? NO : YES; } return self; } @@ -261,7 +262,7 @@ - (id) init * Calls -makeLink:ofType:isRef: or -makeLink:ofType:inUnit:isRef: to * create the first part of an anchor, and fills in the text content * of the anchor with n (the specified name). Returns an entire anchor - * string as a result.
+ * string as a result.
* This method is used to create all the anchors in the html output. */ - (NSString*) makeAnchor: (NSString*)r @@ -336,9 +337,9 @@ - (NSString*) makeURL: (NSString*)r /** * Make a link for the element r, with the specified type t, * in a particular unit u. Only the start of - * the html element is returned (<a ...>).
+ * the html element is returned (<a ...>).
* If the boolean f is YES, then the link is a reference to somewhere, - * otherwise the link is an anchor for some element being output.
+ * otherwise the link is an anchor for some element being output.
* If there is an error, the method returns nil. */ - (NSString*) makeLink: (NSString*)r @@ -431,12 +432,8 @@ - (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file buf = [NSMutableString stringWithCapacity: 4096]; /* Declaration */ - [buf appendString: @"\n"]; - [buf appendString: @"\n"]; + [buf appendString: @"\n"]; + [buf appendString: @"\n"]; [self incIndent]; [self outputNodeList: node to: buf]; @@ -447,6 +444,24 @@ - (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file return buf; } +/** Output all the nodes containing xml elements from this one onwards. + * Text and entity ref nodes are ignored (to remove whitespace etc + * between elements). + */ +- (void) outputElemList: (GSXMLNode*)node to: (NSMutableString*)buf +{ + while (node != nil) + { + GSXMLNode *next = [node nextElement]; + + if ([node type] == XML_ELEMENT_NODE) + { + [self outputNode: node to: buf]; + } + node = next; + } +} + - (void) outputIndex: (NSString*)type scope: (NSString*)scope title: (NSString*)title @@ -459,7 +474,16 @@ - (void) outputIndex: (NSString*)type NSArray *a; unsigned c; unsigned i; - BOOL isBareStyle = [@"bare" isEqualToString: style]; + BOOL isBareStyle = NO; + + if ([@"bare" isEqualToString: style]) + { + isBareStyle = YES; + } + else if ([@"cssNavigation" isEqualToString: style]) + { + isBareStyle = YES; + } if (globalRefs != nil && [scope isEqual: @"global"] == YES) { @@ -496,7 +520,9 @@ - (void) outputIndex: (NSString*)type /* Put the index in a div with a class identifying its scope and type * so that CSS can be used to style it. */ - [buf appendFormat: @"
\n", scope, type]; + [buf appendString: indent]; + [buf appendFormat: @"

\n", scope, type]; + [self incIndent]; if ([type isEqual: @"title"] == YES) { @@ -505,7 +531,9 @@ - (void) outputIndex: (NSString*)type if (!isBareStyle) { [buf appendString: indent]; - [buf appendFormat: @"%@ Index\n", title]; + [buf appendFormat: + @"

%@ Index

\n", + title]; [buf appendString: indent]; [buf appendString: @"
\n"]; + + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"

\n"]; } - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf @@ -765,7 +797,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [self outputNodeList: children to: buf]; [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; if (prevFile != nil) { [buf appendString: indent]; @@ -783,18 +815,28 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf } [self decIndent]; - [buf appendString: indent]; - [buf appendString: indent]; + if (cssNavigation) + { + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"\n"]; //content-pane-body + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"\n"]; //content-pane + } if (isContentsDoc) { + [self decIndent]; + [buf appendString: indent]; [buf appendString: @"\n"]; } + [buf appendString: indent]; [buf appendString: @"\n"]; } else if ([name isEqual: @"br"] == YES) { - [buf appendString: @"
"]; + [buf appendString: @"
"]; } else if ([name isEqual: @"category"] == YES) { @@ -891,7 +933,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: @"\n"]; [buf appendString: indent]; [buf appendString: str]; - [buf appendString: @";
\n"]; + [buf appendString: @";
\n"]; node = firstElement(children); @@ -928,7 +970,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf unsigned l = 0; [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; [buf appendString: indent]; [buf appendString: @"

Contents -

\n"]; @@ -1005,7 +1047,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf l--; } [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } } else if ([name isEqual: @"declared"] == YES) @@ -1204,7 +1246,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: @"\n"]; [buf appendString: indent]; [buf appendString: str]; - [buf appendString: @");
\n"]; + [buf appendString: @");
\n"]; node = firstElement(children); @@ -1253,7 +1295,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf ([stylesheetURL rangeOfString: @"gsdoc_contents"].length > 0)) ? YES : NO; - [self outputNodeList: children to: buf]; + [self outputElemList: children to: buf]; } } else if ([name isEqual: @"head"] == YES) @@ -1263,6 +1305,11 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: indent]; [buf appendString: @"\n"]; [self incIndent]; + + /** charset/encoding should be in first 1024 bytes, so before title */ + [buf appendString: indent]; + [buf appendString: @"\n"]; + children = firstElement(children); [buf appendString: indent]; [buf appendString: @""]; @@ -1271,17 +1318,13 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [self decIndent]; [buf appendString: @"\n"]; - /** handcrafted styles for previous in-line styles */ - [buf appendString: indent]; - [buf appendString: @"\n"]; + [buf appendString: @"\n"]; + [buf appendFormat: @"\n", + [[NSUserDefaults standardUserDefaults] stringForKey: + @"StylesheetURL"]]; #if 0 - /** Css : TODO print.css **/ - [buf appendString:@"\n"]; - [buf appendString:@"\n"]; /** Robots **/ [buf appendString:@"\n"]; #endif @@ -1297,8 +1340,160 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf { [buf appendString: indent]; [buf appendString: @"
\n"]; + [self incIndent]; } + if (cssNavigation) + { + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + + [buf appendString: indent]; + [buf appendString: + @"Classes
\n"]; + [buf appendString: indent]; + [buf appendString: + @"Protocols
\n"]; + [buf appendString: indent]; + [buf appendString: + @"Constants
\n"]; + [buf appendString: indent]; + [buf appendString: + @"Functions
\n"]; + [buf appendString: indent]; + [buf appendString: + @"Macros
\n"]; + [buf appendString: indent]; + [buf appendString: + @"Types
\n"]; + [buf appendString: indent]; + [buf appendString: + @"Variables
\n"]; + + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"
\n"]; // content-bar-top-body + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"
\n"]; // content-bar-top + + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: @"Classes"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"class" + scope: @"project" + title: @"Project classes" + style: @"cssNavigation" + target: nil + to: buf]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: + @"Protocols"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"protocol" + scope: @"project" + title: @"Project protocols" + style: @"cssNavigation" + target: nil + to: buf]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: + @"Constants"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"constant" + scope: @"project" + title: @"Project constants" + style: @"cssNavigation" + target: nil + to: buf]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: + @"Functions"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"function" + scope: @"project" + title: @"Project functions" + style: @"cssNavigation" + target: nil + to: buf]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: + @"Macros"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"macro" + scope: @"project" + title: @"Project macros" + style: @"cssNavigation" + target: nil + to: buf]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: @"Types"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"type" + scope: @"project" + title: @"Project types" + style: @"cssNavigation" + target: nil + to: buf]; + + [buf appendString: indent]; + [buf appendString: @"

"]; + [buf appendString: @"Variables"]; + [buf appendString: @"

\n"]; + [self outputIndex: @"variable" + scope: @"project" + title: @"Project variables" + style: @"cssNavigation" + target: nil + to: buf]; + + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"
\n"]; // bar-bottom-body + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"
\n"]; // bar-bottom + + [self decIndent]; + [buf appendString: indent]; + [buf appendString: @"
\n"]; // content-bar + + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + [buf appendString: indent]; + [buf appendString: @"
\n"]; + [self incIndent]; + } + if (prevFile != nil) { [buf appendString: indent]; @@ -1317,7 +1512,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf if (prevFile != nil || upFile != nil || nextFile != nil) { [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } [buf appendString: indent]; @@ -1538,7 +1733,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf { v = @"public"; } - [buf appendFormat: @"%@@%@ %@ %@;
\n", indent, v, t, n]; + [buf appendFormat: @"%@@%@ %@ %@;
\n", indent, v, t, n]; /* * List standards with which ivar complies @@ -1656,7 +1851,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf { [buf appendString: @")"]; } - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; node = firstElement(children); @@ -1679,7 +1874,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf } [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } else if ([name isEqual: @"method"] == YES) { @@ -1803,7 +1998,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: @"\n"]; [buf appendString: indent]; [buf appendString: str]; - [buf appendString: @";
\n"]; + [buf appendString: @";
\n"]; node = firstElement(children); @@ -1821,23 +2016,23 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf && [str boolValue] == YES) { [buf appendString: @"This is a designated initialiser " - @"for the class.
\n"]; + @"for the class.
\n"]; } str = [prop objectForKey: @"override"]; if ([str isEqual: @"subclass"] == YES) { [buf appendString: @"Subclasses must " - @"override this method.
\n"]; + @"override this method.
\n"]; } else if ([str isEqual: @"dummy"] == YES) { [buf appendString: @"An empty method provided for subclasses " - @"to override.
\n"]; + @"to override.
\n"]; } else if ([str isEqual: @"never"] == YES) { [buf appendString: @"Subclasses must NOT " - @"override this method.
\n"]; + @"override this method.
\n"]; } if ([[node name] isEqual: @"desc"]) @@ -1845,7 +2040,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [self outputNode: node to: buf]; } [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } [buf appendString:@"
\n"]; } @@ -2019,7 +2214,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: @"\n"]; [buf appendString: indent]; [buf appendString: str]; - [buf appendString: @";
\n"]; + [buf appendString: @";
\n"]; node = firstElement(children); @@ -2042,7 +2237,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf } [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } else if ([name isEqual: @"uref"] == YES) { @@ -2097,7 +2292,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf [buf appendString: @"\n"]; [buf appendString: indent]; [buf appendString: str]; - [buf appendString: @";
\n"]; + [buf appendString: @";
\n"]; node = firstElement(children); @@ -2120,7 +2315,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf } [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } else { @@ -2138,8 +2333,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf LEAVE_POOL } -/** - * Output all the nodes from this one onwards ... try to output +/** Output all the nodes from this one onwards ... try to output * as text first, if not possible, call the main method to output * each node. */ @@ -2550,27 +2744,28 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf @" fontsize=24 width=0.5 shape=rectangle style=filled]\n"]; if (sNam) { + [dot appendFormat: @" %@ [class=figure_super", sNam]; if (url) { - [dot appendFormat: @" %@ [URL=\"%@\"]\n", sNam, url]; - } - else - { - [dot appendFormat: @" %@\n", sNam]; + [dot appendFormat: @" URL=\"%@\"", url]; } + [dot appendString: @"]\n"]; + [dot appendFormat: @" %@ [class=figure_class fontcolor=\"green\"]\n", + cNam]; } else { sNam = cNam; // This is a root class ... + [dot appendFormat: @" %@ [class=figure_root fontcolor=\"green\"]\n", + cNam]; } - [dot appendFormat: @" %@ [fontcolor=\"green\"]\n", cNam]; if (protocols) { e = [protocols keyEnumerator]; while ((p = [e nextObject]) != nil) { - [dot appendFormat: - @" p_%@ [label=\"%@\" URL=\"%@\" shape=hexagon]\n", + [dot appendFormat: @" p_%@ [class=figure_protocol" + @" label=\"%@\" URL=\"%@\" shape=hexagon]\n", p, p, [protocols objectForKey: p]]; } } @@ -2666,16 +2861,16 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf { ibuf = ivarBuf; [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; [buf appendString: indent]; [buf appendFormat: @"Instance Variables\n", classname]; [buf appendString: indent]; - [buf appendString: @"

\n"]; + [buf appendString: @"

\n"]; [ibuf appendFormat: @"", classname]; } [ibuf appendString: indent]; - [ibuf appendString: @"

\n"]; + [ibuf appendString: @"

\n"]; [ibuf appendString: indent]; [ibuf appendFormat: @"

Instance Variables for %@ Class

\n", classname]; @@ -2685,7 +2880,7 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf node = [node nextElement]; } [ibuf appendString: indent]; - [ibuf appendString: @"


\n"]; + [ibuf appendString: @"


\n"]; } a = [localRefs methodsInUnit: unit]; @@ -2698,7 +2893,7 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf target: nil to: buf]; [buf appendString: indent]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; while (node != nil) { if ([[node name] isEqual: @"method"] == YES) @@ -2823,7 +3018,7 @@ - (void) outputVersion: (NSDictionary*)prop to: (NSMutableString*)buf } } [buf appendString:@"
\n"]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } else if ([gvadd length] > 0) { @@ -2841,14 +3036,14 @@ - (void) outputVersion: (NSDictionary*)prop to: (NSMutableString*)buf [buf appendString: @" deprecated at "]; [buf appendString: gvdep]; } - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; if ([gvrem length] > 0) { [buf appendString: @" Likely to be changed/moved/removed at "]; [buf appendString: gvrem]; } [buf appendString:@"
\n"]; - [buf appendString: @"
\n"]; + [buf appendString: @"
\n"]; } } diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 560399bbd..940530798 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -24,6 +24,7 @@ #import "Foundation/NSArray.h" #import "Foundation/NSAutoreleasePool.h" +#import "Foundation/NSBundle.h" #import "Foundation/NSCharacterSet.h" #import "Foundation/NSData.h" #import "Foundation/NSDictionary.h" @@ -301,6 +302,7 @@ - (id) init */ - (NSArray*) output: (NSMutableDictionary*)d { + NSFileManager *mgr = [NSFileManager defaultManager]; NSMutableString *str = [NSMutableString stringWithCapacity: 10240]; NSDictionary *classes; NSDictionary *categories; @@ -312,6 +314,7 @@ - (NSArray*) output: (NSMutableDictionary*)d NSDictionary *macros; NSMutableArray *files; NSArray *authors; + NSString *style = @"default-styles.css"; NSString *base; NSString *tmp; NSString *file; @@ -328,9 +331,25 @@ - (NSArray*) output: (NSMutableDictionary*)d file = [file stringByAppendingPathExtension: @"gsdoc"]; } dest = [info objectForKey: @"directory"]; - if ([dest length] > 0 && [file isAbsolutePath] == NO) + if ([dest length] > 0) { - file = [dest stringByAppendingPathComponent: file]; + style = [dest stringByAppendingPathComponent: style]; + if ([file isAbsolutePath] == NO) + { + file = [dest stringByAppendingPathComponent: file]; + } + } + + /* When there is no local default stylesheet present, we copy the + * stylesheet from the main bundle. + */ + if ([mgr isReadableFileAtPath: style] == NO) + { + NSBundle *bundle = [NSBundle mainBundle]; + NSString *path; + + path = [bundle pathForResource: @"default-styles" ofType: @"css"]; + [mgr copyPath: path toPath: style handler: nil]; } classes = [info objectForKey: @"Classes"]; @@ -361,12 +380,9 @@ - (NSArray*) output: (NSMutableDictionary*)d tmp = [[NSUserDefaults standardUserDefaults] stringForKey: @"StylesheetURL"]; } - if (tmp) - { - [str appendString: @" stylesheeturl=\""]; - [str appendString: tmp]; - [str appendString: @"\""]; - } + [str appendString: @" stylesheeturl=\""]; + [str appendString: tmp]; + [str appendString: @"\""]; tmp = [info objectForKey: @"up"]; if (tmp != nil) @@ -2370,12 +2386,10 @@ - (NSString*) mergeMarkup: (NSString*)markup tmp = [[NSUserDefaults standardUserDefaults] stringForKey: @"StylesheetURL"]; } - if (tmp) - { - [str appendString: @" stylesheeturl=\""]; - [str appendString: tmp]; - [str appendString: @"\""]; - } + [str appendString: @" stylesheeturl=\""]; + [str appendString: tmp]; + [str appendString: @"\""]; + /* * If a -Up default has been set, create an up link in this * template file... as long as the specified up link is not @@ -2383,7 +2397,7 @@ - (NSString*) mergeMarkup: (NSString*)markup */ if (up != nil && [up isEqual: [name lastPathComponent]] == NO) { - [str appendString: @"\" up=\""]; + [str appendString: @" up=\""]; [str appendString: up]; [str appendString: @"\""]; } diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index 0dc674b79..bce7821aa 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -1345,6 +1345,7 @@ - (unsigned) parseComment if (buffer[pos + 1] == '/') { [self skipRemainderOfLine]; + break; } else if (buffer[pos + 1] == '*') { @@ -1854,34 +1855,21 @@ - (NSMutableArray*) parseDeclarations */ if ([self parseSpace] < length && buffer[pos] == '<') { - unsigned save = pos; - NSString *p; + NSArray *protocols = [self parseProtocolList]; - do - { - pos++; - p = [self parseIdentifier]; - if (p != nil) - { - [a addObject: p]; - } - } - while ([self parseSpace] < length && buffer[pos] == ','); - if ('>' == buffer[pos]) - { - pos++; - [self parseSpace]; + if (protocols) + { + [a addObjectsFromArray: protocols]; [a sortUsingSelector: @selector(compare:)]; [t appendString: @"<"]; [t appendString: [a componentsJoinedByString: @","]]; [t appendString: @">"]; [a removeAllObjects]; - } - else - { - pos = save; - [self skipGeneric]; - } + } + else + { + [self skipGeneric]; + } } baseType = t; } @@ -2463,7 +2451,7 @@ - (NSMutableDictionary*) parseImplementation { pos++; if ((base = [self parseIdentifier]) == nil - || [self parseSpace] >= length) + || [self parseSpaceOrGeneric] >= length) { [self log: @"@interface with bad base class"]; goto fail; @@ -2560,7 +2548,7 @@ - (NSMutableDictionary*) parseInterface } if ((name = [self parseIdentifier]) == nil - || [self parseSpace] >= length) + || [self parseSpaceOrGeneric] >= length) { [self log: @"interface with bad name"]; goto fail; @@ -2625,7 +2613,17 @@ - (NSMutableDictionary*) parseInterface if (protocols == nil) { - goto fail; + unsigned saved = pos; + + if ([self skipGeneric] > saved) + { + [self parseSpace]; + } + else + { + [self log: @"bad protocol list"]; + goto fail; + } } else if ([protocols count] > 0) { @@ -4328,6 +4326,7 @@ - (NSMutableDictionary*) parseProtocol if (protocols == nil) { + [self log: @"bad protocol list"]; goto fail; } else if ([protocols count] > 0) @@ -4388,6 +4387,7 @@ - (NSMutableArray*) parseProtocolList { NSMutableArray *protocols; NSString *p; + unsigned start = pos; protocols = [NSMutableArray arrayWithCapacity: 2]; pos++; @@ -4410,7 +4410,7 @@ - (NSMutableArray*) parseProtocolList if (pos >= length || buffer[pos] != '>' || ++pos >= length || [self parseSpace] >= length || [protocols count] == 0) { - [self log: @"bad protocol list"]; + pos = start; return nil; } return protocols; @@ -4522,7 +4522,28 @@ - (unsigned) parseSpace: (NSCharacterSet*)spaceSet - (unsigned) parseSpace { - return [self parseSpace: spacenl]; + [self parseSpace: spacenl]; + return pos; +} + +- (unsigned) parseSpaceOrGeneric +{ + [self parseSpace: spacenl]; + + if (pos < length && '<' == buffer[pos]) + { + unsigned saved = pos; + + if ([self skipGeneric] > saved) + { + [self parseSpace]; + } + else + { + [self log: @"bad generic"]; + } + } + return pos; } - (NSString*) parseVersion diff --git a/Tools/GNUmakefile b/Tools/GNUmakefile index 22a03f1df..ca54437e8 100644 --- a/Tools/GNUmakefile +++ b/Tools/GNUmakefile @@ -117,6 +117,10 @@ ifneq ($(HAVE_DOT), ) AGSHtml.m_FILE_FLAGS+= -DHAVE_DOT=$(HAVE_DOT) endif +autogsdoc_HAS_RESOURCE_BUNDLE = yes +autogsdoc_RESOURCE_FILES = \ + default-styles.css + # Reset this variable (defined in config.mak) to avoid useless linkage # against the libraries gnustep-base uses. CONFIG_SYSTEM_LIBS := diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index a8271e7bb..edbe27510 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -464,7 +464,8 @@ the project as dependencies of the project name (see StylesheetURL The URL of a CSS document to be used as the stadard stylesheet for - generated autogsdoc files. + generated autogsdoc files. If this is not specified the default of + a local document default-styles.css is used. SystemProjects This value is used to control the automatic inclusion of system @@ -751,6 +752,7 @@ standard PropertyList format (not the XML format of OS X), using defs = [NSUserDefaults standardUserDefaults]; [defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys: @"Untitled", @"Project", + @"default-styles.css", @"StylesheetURL", nil]]; // BEGIN test for any unrecognized arguments, or "--help" @@ -811,6 +813,9 @@ standard PropertyList format (not the XML format of OS X), using @"FunctionsTemplate", @"\t\tSTR\t(\"\")\n\tfile into which docs for macros " @"should be consolidated", + @"IndexFile", + @"\t\tSTR\t(\"\")\n\tHTML file name (extension omitted) " + @"copied to index.html", @"MacrosTemplate", @"\t\tSTR\t(\"\")\n\tfile into which docs for typedefs " @"should be consolidated", @@ -848,6 +853,10 @@ standard PropertyList format (not the XML format of OS X), using { NSArray *args = [argsRecognized allKeys]; + if (![@"help" isEqual: opt]) + { + GSPrintf(stderr, @"Unknown option: '%@'\n", opt); + } GSPrintf(stderr, @"Usage:\n"); GSPrintf(stderr, [NSString stringWithFormat: @" %@ [options] [files]\n", [argsGiven objectAtIndex: 0]]); @@ -1977,14 +1986,20 @@ standard PropertyList format (not the XML format of OS X), using // file for top-left frame (header only; rest appended below) idxIndexFile = [@"MainIndex" stringByAppendingPathExtension: @"html"]; - [idxIndex setString: @"\n \n" -@" Index
\n"]; + [idxIndex setString: @"\n" +@"\n" +@" \n" +@" \n" +@" \n" +@" \n" +@" Index
\n"]; // this becomes index.html framesetFile = [@"index" stringByAppendingPathExtension: @"html"]; - [frameset setString: @"\n" -@"\n" + [frameset setString: @"\n" +@"\n" @" \n" +@" \n" @" \n" @" Autogsdoc-generated Documentation for [prjName]\n" @" \n" @@ -2094,6 +2109,9 @@ standard PropertyList format (not the XML format of OS X), using count = [gFiles count]; if (generateHtml == YES && count > 0) { + NSString *htmlIndexFile; + + htmlIndexFile = [defs stringForKey: @"IndexFile"]; pool = [NSAutoreleasePool new]; for (i = 0; i < count; i++) @@ -2200,6 +2218,17 @@ standard PropertyList format (not the XML format of OS X), using { NSLog(@"Sorry unable to write %@", htmlfile); } + if ([file isEqual: htmlIndexFile]) + { + NSString *s; + + s = [documentationDirectory + stringByAppendingPathComponent: @"index.html"]; + if ([d writeToFile: s atomically: YES] == NO) + { + NSLog(@"Sorry unable to write %@ to %@", htmlfile, s); + } + } } } else if ([arg hasSuffix: @".gsdoc"] == YES) diff --git a/Tools/default-styles.css b/Tools/default-styles.css new file mode 100644 index 000000000..4fb24f262 --- /dev/null +++ b/Tools/default-styles.css @@ -0,0 +1,90 @@ +.content-bar { + float: left; + position: fixed; + top: 0px; + left: 0px; + width: 20%; + height: 100%; + border-right: 1px solid grey; +} + +.content-bar-top { + position: absolute; + top: 0px; + left: 0px; + height: 30%; + width: 100%; + overflow: auto; + border-bottom: 1px solid grey; +} + +.content-bar-top-body { + position: absolute; + top: 0px; + left: 0px; + padding-left: 10px; + padding-top: 10px; +} + +.content-bar-bottom { + position: absolute; + bottom: 0px; + left: 0px; + height:70%; + width: 100%; + overflow: auto; +} + +.content-bar-bottom-body { + position: absolute; + top: 0px; + left: 0px; + padding-left: 10px; + padding-top: 10px; +} + + +.content-pane { + position: fixed; + top: 0px; + right: 0px; + width: 80%; + height: 100%; + overflow-y: auto; +} + +.content-pane-body { + position: absolute; + top: 0px; + left: 0px; + padding-left: 10px; +} + +hr.section-separator { + width:50%; + margin-left:0; + text-align:left; +} + + +hr.method-separator { + width:25%; + margin-left:0; + text-align:left; +} + +h3.content-bar-index-section-header { + font-family: sans-serif; +} + +h3.index-section-header { + font-family: sans-serif; +} + +p { + font-family: Serif; +} + +.desc { + font-family: Serif; +}