2005-02-22 11:22:44 +00:00
|
|
|
/**
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
<title>AGSHtml ... a class to output html for a gsdoc file</title>
|
2001-12-16 13:36:06 +00:00
|
|
|
Copyright (C) 2001 Free Software Foundation, Inc.
|
2001-10-17 20:58:12 +00:00
|
|
|
|
2001-12-16 13:36:06 +00:00
|
|
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
2001-10-17 20:58:12 +00:00
|
|
|
Created: October 2001
|
|
|
|
|
|
|
|
This file is part of the GNUstep Project
|
|
|
|
|
2001-12-18 11:09:38 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
2001-10-17 20:58:12 +00:00
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public
|
2001-12-18 11:09:38 +00:00
|
|
|
License along with this program; see the file COPYING.LIB.
|
2001-10-17 20:58:12 +00:00
|
|
|
If not, write to the Free Software Foundation,
|
2005-05-22 03:32:16 +00:00
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Foundation/Foundation.h>
|
|
|
|
#include "AGSHtml.h"
|
2003-07-31 23:49:32 +00:00
|
|
|
#include "GNUstepBase/GNUstep.h"
|
|
|
|
#include "GNUstepBase/GSCategories.h"
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
static int XML_ELEMENT_NODE;
|
2001-11-29 14:26:24 +00:00
|
|
|
static int XML_ENTITY_REF_NODE;
|
2001-10-17 20:58:12 +00:00
|
|
|
static int XML_TEXT_NODE;
|
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
static GSXMLNode *firstElement(GSXMLNode *nodes)
|
|
|
|
{
|
2002-04-25 13:06:59 +00:00
|
|
|
if (nodes == nil)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2002-04-25 13:06:59 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
if ([nodes type] == XML_ELEMENT_NODE)
|
|
|
|
{
|
|
|
|
return nodes;
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2002-04-25 13:06:59 +00:00
|
|
|
return [nodes nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
@implementation AGSHtml
|
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
static NSMutableSet *textNodes = nil;
|
2004-03-29 03:44:10 +00:00
|
|
|
static NSString *tocFont = nil;
|
|
|
|
static NSString *mainFont = nil;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [AGSHtml class])
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Cache XML node information.
|
|
|
|
*/
|
|
|
|
XML_ELEMENT_NODE = [GSXMLNode typeFromDescription: @"XML_ELEMENT_NODE"];
|
2001-11-29 14:26:24 +00:00
|
|
|
XML_ENTITY_REF_NODE
|
|
|
|
= [GSXMLNode typeFromDescription: @"XML_ENTITY_REF_NODE"];
|
2001-10-17 20:58:12 +00:00
|
|
|
XML_TEXT_NODE = [GSXMLNode typeFromDescription: @"XML_TEXT_NODE"];
|
2001-11-21 17:10:22 +00:00
|
|
|
textNodes = [NSMutableSet new];
|
|
|
|
[textNodes addObject: @"br"];
|
|
|
|
[textNodes addObject: @"code"];
|
|
|
|
[textNodes addObject: @"em"];
|
|
|
|
[textNodes addObject: @"email"];
|
|
|
|
[textNodes addObject: @"entry"];
|
|
|
|
[textNodes addObject: @"file"];
|
|
|
|
[textNodes addObject: @"label"];
|
|
|
|
[textNodes addObject: @"prjref"];
|
|
|
|
[textNodes addObject: @"ref"];
|
|
|
|
[textNodes addObject: @"site"];
|
2001-11-29 14:26:24 +00:00
|
|
|
[textNodes addObject: @"strong"];
|
2001-11-21 17:10:22 +00:00
|
|
|
[textNodes addObject: @"uref"];
|
|
|
|
[textNodes addObject: @"url"];
|
|
|
|
[textNodes addObject: @"var"];
|
|
|
|
[textNodes addObject: @"footnote"];
|
2004-03-29 03:44:10 +00:00
|
|
|
|
|
|
|
// default fonts
|
|
|
|
tocFont = @"sans";
|
2004-08-02 18:12:19 +00:00
|
|
|
mainFont = @"serif";
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
2005-05-10 05:06:08 +00:00
|
|
|
RELEASE(project);
|
2001-10-17 20:58:12 +00:00
|
|
|
RELEASE(globalRefs);
|
|
|
|
RELEASE(localRefs);
|
2001-12-18 09:31:32 +00:00
|
|
|
RELEASE(projectRefs);
|
2001-10-17 20:58:12 +00:00
|
|
|
RELEASE(indent);
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) decIndent
|
|
|
|
{
|
|
|
|
unsigned len = [indent length];
|
|
|
|
|
|
|
|
if (len >= 2)
|
|
|
|
{
|
|
|
|
[indent deleteCharactersInRange: NSMakeRange(len - 2, 2)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) incIndent
|
|
|
|
{
|
|
|
|
[indent appendString: @" "];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
indent = [[NSMutableString alloc] initWithCapacity: 64];
|
2005-05-10 05:06:08 +00:00
|
|
|
project = RETAIN([[NSUserDefaults standardUserDefaults]
|
|
|
|
stringForKey: @"Project"]);
|
2001-10-17 20:58:12 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2001-12-15 07:54:10 +00:00
|
|
|
/**
|
|
|
|
* 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.<br />
|
|
|
|
* This method is used to create all the anchors in the html output.
|
|
|
|
*/
|
|
|
|
- (NSString*) makeAnchor: (NSString*)r
|
|
|
|
ofType: (NSString*)t
|
|
|
|
name: (NSString*)n
|
|
|
|
{
|
|
|
|
NSString *s;
|
|
|
|
|
|
|
|
if (n == nil)
|
|
|
|
{
|
|
|
|
n = @"";
|
|
|
|
}
|
|
|
|
if ([t isEqualToString: @"method"] || [t isEqualToString: @"ivariable"])
|
|
|
|
{
|
|
|
|
s = [self makeLink: r ofType: t inUnit: nil isRef: NO];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s = [self makeLink: r ofType: t isRef: NO];
|
|
|
|
}
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
n = [s stringByAppendingFormat: @"%@</a>", n];
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make a link for the element r with the specified type. Only the start of
|
|
|
|
* the html element is returned (<a ...>).
|
|
|
|
* If the boolean f is YES, then the link is a reference to somewhere,
|
|
|
|
* and the method will return nil if the destination is not found in the index.
|
|
|
|
* If f is NO, then the link is an anchor for some element being output, and
|
|
|
|
* the method is guaranteed to succeed and return the link.
|
|
|
|
*/
|
|
|
|
- (NSString*) makeLink: (NSString*)r
|
|
|
|
ofType: (NSString*)t
|
|
|
|
isRef: (BOOL)f
|
|
|
|
{
|
|
|
|
NSString *s;
|
2002-01-03 20:17:28 +00:00
|
|
|
NSString *kind = (f == YES) ? @"rel=\"gsdoc\" href" : @"name";
|
2001-12-15 10:03:24 +00:00
|
|
|
NSString *hash = (f == YES) ? @"#" : @"";
|
2001-12-15 07:54:10 +00:00
|
|
|
|
|
|
|
if (f == NO || (s = [localRefs globalRef: r type: t]) != nil)
|
|
|
|
{
|
2001-12-15 10:03:24 +00:00
|
|
|
s = [NSString stringWithFormat: @"<a %@=\"%@%@$%@\">",
|
|
|
|
kind, hash, t, r];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
else if ((s = [globalRefs globalRef: r type: t]) != nil)
|
|
|
|
{
|
|
|
|
s = [s stringByAppendingPathExtension: @"html"];
|
2001-12-15 10:03:24 +00:00
|
|
|
s = [NSString stringWithFormat: @"<a %@=\"%@%@%@$%@\">",
|
|
|
|
kind, s, hash, t, r];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 ...>).<br />
|
|
|
|
* 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.<br />
|
|
|
|
* If there is an error, the method returns nil.
|
|
|
|
*/
|
|
|
|
- (NSString*) makeLink: (NSString*)r
|
|
|
|
ofType: (NSString*)t
|
|
|
|
inUnit: (NSString*)u
|
|
|
|
isRef: (BOOL)f
|
|
|
|
{
|
2001-12-15 08:42:21 +00:00
|
|
|
NSString *s = nil;
|
2002-01-03 20:17:28 +00:00
|
|
|
NSString *kind = (f == YES) ? @"rel=\"gsdoc\" href" : @"name";
|
2001-12-15 10:03:24 +00:00
|
|
|
NSString *hash = (f == YES) ? @"#" : @"";
|
2001-12-15 07:54:10 +00:00
|
|
|
|
2002-11-04 15:39:43 +00:00
|
|
|
if (f == NO)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
if (u == nil)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
u = unit;
|
2002-10-14 11:05:49 +00:00
|
|
|
s = base;
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
2002-01-03 20:17:28 +00:00
|
|
|
}
|
|
|
|
else if (u == nil)
|
|
|
|
{
|
|
|
|
s = [localRefs unitRef: r type: t unit: &u];
|
|
|
|
if (s == nil)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
s = [globalRefs unitRef: r type: t unit: &u];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
}
|
2002-10-14 11:05:49 +00:00
|
|
|
if (s == nil)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
NSString *tmp = u;
|
|
|
|
|
2001-12-15 07:54:10 +00:00
|
|
|
/*
|
|
|
|
* Simply look up the reference.
|
|
|
|
*/
|
2002-01-03 20:17:28 +00:00
|
|
|
s = [localRefs unitRef: r type: t unit: &u];
|
|
|
|
if (s == nil)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
u = tmp;
|
|
|
|
s = [globalRefs unitRef: r type: t unit: &u];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s != nil)
|
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
NSString *sep = @"";
|
|
|
|
|
|
|
|
if ([t isEqual: @"ivariable"] == YES)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
2002-01-03 20:17:28 +00:00
|
|
|
sep = @"*";
|
|
|
|
}
|
|
|
|
if ([s isEqual: base] == YES)
|
|
|
|
{
|
|
|
|
s = [NSString stringWithFormat: @"<a %@=\"%@%@$%@%@%@\">",
|
|
|
|
kind, hash, t, u, sep, r];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s = [s stringByAppendingPathExtension: @"html"];
|
2002-01-03 20:17:28 +00:00
|
|
|
s = [NSString stringWithFormat: @"<a %@=\"%@%@%@$%@%@%@\">",
|
|
|
|
kind, s, hash, t, u, sep, r];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
- (NSString*) outputDocument: (GSXMLNode*)node
|
|
|
|
{
|
|
|
|
NSMutableString *buf;
|
|
|
|
|
|
|
|
if (localRefs == nil)
|
|
|
|
{
|
|
|
|
localRefs = [AGSIndex new];
|
|
|
|
[localRefs makeRefs: node];
|
|
|
|
}
|
|
|
|
buf = [NSMutableString stringWithCapacity: 4096];
|
|
|
|
|
|
|
|
[buf appendString: @"<html>\n"];
|
|
|
|
[self incIndent];
|
2001-12-18 06:48:20 +00:00
|
|
|
[self outputNodeList: node to: buf];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: @"</html>\n"];
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2002-01-06 10:24:43 +00:00
|
|
|
- (void) outputIndex: (NSString*)type
|
|
|
|
scope: (NSString*)scope
|
|
|
|
title: (NSString*)title
|
2004-03-29 03:37:46 +00:00
|
|
|
style: (NSString*)style
|
|
|
|
target: (NSString*)target
|
2002-01-06 10:24:43 +00:00
|
|
|
to: (NSMutableString*)buf
|
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSDictionary *refs = [localRefs refs];
|
|
|
|
NSDictionary *dict;
|
|
|
|
NSArray *a;
|
|
|
|
unsigned c;
|
|
|
|
unsigned i;
|
2004-03-29 03:37:46 +00:00
|
|
|
BOOL isBareStyle = [@"bare" isEqualToString: style];
|
2002-01-06 10:24:43 +00:00
|
|
|
|
|
|
|
if (globalRefs != nil && [scope isEqual: @"global"] == YES)
|
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
refs = [globalRefs refs];
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
|
|
|
else if (projectRefs != nil && [scope isEqual: @"project"] == YES)
|
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
refs = [projectRefs refs];
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
if ([type isEqualToString: @"method"] == YES)
|
2002-01-06 10:24:43 +00:00
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
if (unit == nil)
|
|
|
|
{
|
|
|
|
refs = nil; // Can't index methods outside a unit.
|
|
|
|
}
|
|
|
|
dict = [refs objectForKey: @"unitmethods"];
|
|
|
|
dict = [dict objectForKey: unit];
|
|
|
|
}
|
|
|
|
else if ([type isEqualToString: @"ivariable"] == YES)
|
|
|
|
{
|
|
|
|
if (unit == nil)
|
|
|
|
{
|
|
|
|
refs = nil; // Can't index instance variables outside a class.
|
|
|
|
}
|
|
|
|
dict = [refs objectForKey: @"classvars"];
|
|
|
|
dict = [dict objectForKey: unit];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dict = [refs objectForKey: type];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ([dict count] > 1 && [type isEqual: @"title"] == YES)
|
|
|
|
{
|
2004-03-29 03:37:46 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<b>%@ Index</b>\n", title];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<ul>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
}
|
2002-01-07 11:24:52 +00:00
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
a = [dict allKeys];
|
|
|
|
a = [a sortedArrayUsingSelector: @selector(compare:)];
|
|
|
|
c = [a count];
|
|
|
|
|
|
|
|
for (i = 0; i < c; i++)
|
2002-01-06 10:24:43 +00:00
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSString *ref = [a objectAtIndex: i];
|
|
|
|
NSString *text = [dict objectForKey: ref];
|
|
|
|
NSString *file = ref;
|
|
|
|
|
|
|
|
if ([file isEqual: base] == YES)
|
2002-01-07 11:24:52 +00:00
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
continue; // Don't list current file.
|
2002-01-07 11:24:52 +00:00
|
|
|
}
|
2002-01-08 17:31:38 +00:00
|
|
|
|
|
|
|
[buf appendString: indent];
|
2004-03-29 03:37:46 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<li>"];
|
|
|
|
}
|
|
|
|
[buf appendString: @"<a rel=\"gsdoc\" "];
|
|
|
|
if (target != nil)
|
|
|
|
{
|
|
|
|
[buf appendFormat: @"target=\"%@\" ", target];
|
|
|
|
}
|
2004-09-19 23:01:23 +00:00
|
|
|
if (([type isEqual: @"protocol"] == YES)
|
|
|
|
&& ([text hasPrefix: @"("] == NO))
|
|
|
|
{
|
|
|
|
// it's an informal protocol, detected earlier as an
|
|
|
|
// unimplemented category of NSObject; make proper link
|
|
|
|
[buf appendFormat: @"href=\"%@.html#%@$NSObject%@\">(%@)</a>",
|
|
|
|
file, @"category", ref, text];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendFormat: @"href=\"%@.html#%@$%@\">%@</a>",
|
|
|
|
file, type, ref, text];
|
|
|
|
}
|
2004-03-29 03:37:46 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendString: @"</li>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: @"<br/>"];
|
|
|
|
}
|
|
|
|
[buf appendString: @"\n"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</ul>\n"];
|
|
|
|
}
|
2002-01-08 17:31:38 +00:00
|
|
|
}
|
|
|
|
else if ([dict count] > 0)
|
|
|
|
{
|
|
|
|
NSString *sep = @"";
|
|
|
|
NSString *u = unit;
|
|
|
|
BOOL isInUnit = NO;
|
|
|
|
|
|
|
|
if (unit != nil)
|
|
|
|
{
|
|
|
|
if ([type isEqual: @"method"] || [type isEqual: @"ivariable"])
|
2002-01-07 11:24:52 +00:00
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
isInUnit = YES;
|
|
|
|
if ([type isEqual: @"ivariable"])
|
|
|
|
{
|
|
|
|
sep = @"*"; // List ivars in class
|
|
|
|
}
|
2004-09-19 23:01:23 +00:00
|
|
|
else if (classname != nil && category == nil)
|
2002-01-08 17:31:38 +00:00
|
|
|
{
|
|
|
|
NSArray *catNames;
|
2002-01-07 11:24:52 +00:00
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
/*
|
2002-02-12 12:33:57 +00:00
|
|
|
* For a class, we want to list methods in any associated
|
2004-06-22 22:52:21 +00:00
|
|
|
* categories as well as those of the class itself.
|
2002-01-08 17:31:38 +00:00
|
|
|
*/
|
|
|
|
catNames = [[[refs objectForKey: @"categories"]
|
|
|
|
objectForKey: classname] allKeys];
|
|
|
|
if ((c = [catNames count]) > 0)
|
2002-01-07 11:24:52 +00:00
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSMutableDictionary *m = [dict mutableCopy];
|
|
|
|
NSDictionary *unitDict;
|
2002-01-07 11:24:52 +00:00
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
unitDict = [refs objectForKey: @"unitmethods"];
|
|
|
|
for (i = 0; i < c; i++)
|
2002-01-07 11:24:52 +00:00
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSString *catName = [catNames objectAtIndex: i];
|
|
|
|
NSDictionary *catDict;
|
2003-07-06 06:34:34 +00:00
|
|
|
NSString *cName;
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
NSString *mname;
|
2002-01-08 17:31:38 +00:00
|
|
|
|
2003-07-06 06:34:34 +00:00
|
|
|
cName = [classname stringByAppendingFormat: @"(%@)",
|
2002-01-08 17:31:38 +00:00
|
|
|
catName];
|
2003-07-06 06:34:34 +00:00
|
|
|
catDict = [unitDict objectForKey: cName];
|
|
|
|
enumerator = [catDict keyEnumerator];
|
|
|
|
/*
|
|
|
|
* Add category references to the dictionary,
|
|
|
|
* prefixing them with the category they belong to.
|
|
|
|
*/
|
|
|
|
while ((mname = [enumerator nextObject]) != nil)
|
|
|
|
{
|
|
|
|
NSString *file = [catDict objectForKey: mname];
|
|
|
|
NSString *ref = [NSString stringWithFormat:
|
|
|
|
@"(%@)%@", catName, mname];
|
|
|
|
|
|
|
|
[m setObject: file forKey: ref];
|
|
|
|
}
|
2002-01-07 11:24:52 +00:00
|
|
|
}
|
2002-01-08 17:31:38 +00:00
|
|
|
dict = AUTORELEASE(m);
|
2002-01-07 11:24:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
2004-03-29 03:37:46 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendFormat: @"<b>%@</b>\n", title];
|
|
|
|
}
|
2002-01-06 10:24:43 +00:00
|
|
|
[buf appendString: indent];
|
2004-07-09 11:58:44 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<ul>"];
|
|
|
|
[self incIndent];
|
|
|
|
}
|
2004-03-29 03:37:46 +00:00
|
|
|
[buf appendString: @"\n"];
|
2002-01-06 10:24:43 +00:00
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
a = [dict allKeys];
|
|
|
|
a = [a sortedArrayUsingSelector: @selector(compare:)];
|
|
|
|
c = [a count];
|
|
|
|
|
2002-01-06 10:24:43 +00:00
|
|
|
for (i = 0; i < c; i++)
|
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSString *ref = [a objectAtIndex: i];
|
|
|
|
NSString *file = [dict objectForKey: ref];
|
|
|
|
NSString *text = ref;
|
|
|
|
|
2003-07-06 06:34:34 +00:00
|
|
|
/*
|
2003-11-10 18:49:52 +00:00
|
|
|
* If a reference to a method contains a leading category name,
|
|
|
|
* we don't want it in the visible method name, however if it's
|
2004-09-19 23:01:23 +00:00
|
|
|
* actually a formal protocol name, we need to make it look right
|
|
|
|
* by changing the round brackets to angle brackets.
|
2003-07-06 06:34:34 +00:00
|
|
|
*/
|
|
|
|
if ([text hasPrefix: @"("] == YES)
|
|
|
|
{
|
|
|
|
NSRange r = [text rangeOfString: @")"];
|
2003-11-10 18:49:52 +00:00
|
|
|
|
2004-09-19 23:01:23 +00:00
|
|
|
if (NSMaxRange(r) == [text length]) // A formal protocol
|
2003-11-10 18:49:52 +00:00
|
|
|
{
|
|
|
|
text = [text stringByReplacingString: @"("
|
|
|
|
withString: @"<"];
|
|
|
|
text = [text stringByReplacingString: @")"
|
|
|
|
withString: @">"];
|
|
|
|
}
|
|
|
|
else // Category name in brackets followed by class name
|
|
|
|
{
|
|
|
|
text = [text substringFromIndex: NSMaxRange(r)];
|
|
|
|
}
|
2003-07-06 06:34:34 +00:00
|
|
|
}
|
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
[buf appendString: indent];
|
2004-03-29 03:37:46 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<li>"];
|
|
|
|
}
|
|
|
|
[buf appendString: @"<a rel=\"gsdoc\" "];
|
|
|
|
if (target != nil)
|
|
|
|
{
|
|
|
|
[buf appendFormat: @"target=\"%@\" ", target];
|
|
|
|
}
|
2002-01-07 11:24:52 +00:00
|
|
|
if (isInUnit == YES)
|
2002-01-06 10:24:43 +00:00
|
|
|
{
|
2004-03-29 03:37:46 +00:00
|
|
|
[buf appendFormat: @"href=\"%@.html#%@$%@%@%@\">%@</a>",
|
2002-01-08 17:31:38 +00:00
|
|
|
file, type, u, sep, ref, text];
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-19 23:01:23 +00:00
|
|
|
if (([type isEqual: @"protocol"] == YES)
|
|
|
|
&& ([text hasPrefix: @"<"] == NO))
|
|
|
|
{
|
|
|
|
// it's an informal protocol, detected earlier as an
|
|
|
|
// unimplemented category of NSObject; make proper link
|
|
|
|
text = [text stringByDeletingPrefix: @"NSObject"];
|
|
|
|
[buf appendFormat: @"href=\"%@.html#%@$%@\">%@</a>",
|
|
|
|
file, @"category", ref, text];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendFormat: @"href=\"%@.html#%@$%@\">%@</a>",
|
|
|
|
file, type, ref, text];
|
|
|
|
}
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
2004-03-29 03:37:46 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[buf appendString: @"</li>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: @"<br/>"];
|
|
|
|
}
|
|
|
|
[buf appendString: @"\n"];
|
|
|
|
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
|
|
|
|
2004-07-09 11:58:44 +00:00
|
|
|
if (!isBareStyle)
|
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</ul>"];
|
|
|
|
}
|
2004-03-29 03:37:46 +00:00
|
|
|
[buf appendString: @"\n"];
|
2002-01-06 10:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
|
|
|
|
{
|
2002-06-25 17:23:05 +00:00
|
|
|
#if GS_WITH_GC == 0
|
2001-11-21 17:10:22 +00:00
|
|
|
CREATE_AUTORELEASE_POOL(arp);
|
2002-06-25 17:23:05 +00:00
|
|
|
#endif
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *children = [node firstChild];
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
if ([node type] == XML_ELEMENT_NODE)
|
|
|
|
{
|
|
|
|
NSString *name = [node name];
|
2002-05-23 15:58:15 +00:00
|
|
|
NSDictionary *prop = [node attributes];
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
if ([name isEqual: @"back"] == YES)
|
|
|
|
{
|
|
|
|
// Open back division
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<div>\n"];
|
|
|
|
[self incIndent];
|
2001-11-21 17:10:22 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
// Close back division
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</div>\n"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"body"] == YES)
|
|
|
|
{
|
2001-11-21 17:10:22 +00:00
|
|
|
/* Should already be in html body */
|
|
|
|
[self outputNodeList: children to: buf];
|
2001-12-18 06:48:20 +00:00
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<br />\n"];
|
|
|
|
if (prevFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"%@\">Prev</a>\n", prevFile];
|
|
|
|
}
|
|
|
|
if (upFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"%@\">Up</a>\n", upFile];
|
|
|
|
}
|
|
|
|
if (nextFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"%@\">Next</a>\n", nextFile];
|
|
|
|
}
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
2004-03-29 03:37:46 +00:00
|
|
|
|
2004-03-29 03:44:10 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</font>\n"];
|
2004-03-29 03:37:46 +00:00
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: @"</body>\n"];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"br"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<br />"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"category"] == YES)
|
|
|
|
{
|
2001-12-15 07:54:10 +00:00
|
|
|
NSString *s;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
category = [prop objectForKey: @"name"];
|
|
|
|
classname = [prop objectForKey: @"class"];
|
|
|
|
unit = [NSString stringWithFormat: @"%@(%@)", classname, category];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h2>"];
|
2002-01-08 17:31:38 +00:00
|
|
|
[buf appendString: [self typeRef: classname]];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"("];
|
2002-01-08 17:31:38 +00:00
|
|
|
s = [self makeAnchor: unit ofType: @"category" name: category];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: @")</h2>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self outputUnit: node to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
unit = nil;
|
2002-01-08 17:31:38 +00:00
|
|
|
classname = nil;
|
|
|
|
category = nil;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"chapter"] == YES)
|
|
|
|
{
|
|
|
|
heading = @"h1";
|
2001-12-17 22:36:30 +00:00
|
|
|
chap++;
|
|
|
|
sect = 0;
|
|
|
|
ssect = 0;
|
|
|
|
sssect = 0;
|
2001-11-21 17:10:22 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2002-10-05 17:47:54 +00:00
|
|
|
heading = nil;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"class"] == YES)
|
|
|
|
{
|
2001-11-21 17:10:22 +00:00
|
|
|
NSString *sup = [prop objectForKey: @"super"];
|
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
classname = [prop objectForKey: @"name"];
|
|
|
|
unit = classname;
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h2>"];
|
|
|
|
[buf appendString:
|
2002-01-08 17:31:38 +00:00
|
|
|
[self makeAnchor: classname ofType: @"class" name: classname]];
|
2001-12-15 07:54:10 +00:00
|
|
|
if (sup != nil)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2003-01-03 15:21:15 +00:00
|
|
|
sup = [self typeRef: sup];
|
|
|
|
if (sup != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: @" : "];
|
|
|
|
[buf appendString: sup];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"</h2>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self outputUnit: node to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
unit = nil;
|
2002-01-08 17:31:38 +00:00
|
|
|
classname = nil;
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"code"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<code>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</code>"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2002-02-04 20:20:07 +00:00
|
|
|
else if ([name isEqual: @"constant"] == YES)
|
|
|
|
{
|
|
|
|
NSString *nam;
|
|
|
|
NSString *str;
|
|
|
|
NSString *s;
|
|
|
|
|
|
|
|
nam = [prop objectForKey: @"name"];
|
|
|
|
str = [prop objectForKey: @"type"];
|
2002-02-12 20:58:10 +00:00
|
|
|
str = [self typeRef: str];
|
2002-12-31 10:12:43 +00:00
|
|
|
str = [str stringByAppendingFormat: @" %@", nam];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
/*
|
2002-02-12 20:58:10 +00:00
|
|
|
* Output heading.
|
2002-02-04 20:20:07 +00:00
|
|
|
*/
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h3>"];
|
|
|
|
s = [self makeLink: nam ofType: @"constant" isRef: NO];
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: nam];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: nam];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</h3>\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: str];
|
|
|
|
[buf appendString: @";<br />\n"];
|
|
|
|
|
|
|
|
node = firstElement(children);
|
|
|
|
|
|
|
|
if ([[node name] isEqual: @"declared"] == YES)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
|
|
|
|
2002-04-25 13:06:59 +00:00
|
|
|
children = node;
|
2002-02-04 20:20:07 +00:00
|
|
|
if ([[children name] isEqual: @"standards"])
|
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
if ([[node name] isEqual: @"desc"])
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
|
|
|
}
|
2001-12-17 22:36:30 +00:00
|
|
|
else if ([name isEqual: @"contents"] == YES)
|
|
|
|
{
|
|
|
|
NSDictionary *dict;
|
|
|
|
|
|
|
|
dict = [[localRefs refs] objectForKey: @"contents"];
|
2002-12-12 15:14:13 +00:00
|
|
|
if ([dict count] > 1)
|
2001-12-17 22:36:30 +00:00
|
|
|
{
|
|
|
|
NSArray *a;
|
|
|
|
unsigned i;
|
|
|
|
unsigned l = 0;
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
2001-12-18 06:48:20 +00:00
|
|
|
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
|
2001-12-17 22:36:30 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h3>Contents -</h3>\n"];
|
|
|
|
|
|
|
|
a = [dict allKeys];
|
|
|
|
a = [a sortedArrayUsingSelector: @selector(compare:)];
|
|
|
|
for (i = 0; i < [a count]; i++)
|
|
|
|
{
|
|
|
|
NSString *k = [a objectAtIndex: i];
|
|
|
|
NSString *v = [dict objectForKey: k];
|
|
|
|
unsigned pos = 3;
|
|
|
|
|
|
|
|
if ([k hasSuffix: @"000"] == YES)
|
|
|
|
{
|
|
|
|
pos = 2;
|
|
|
|
if ([k hasSuffix: @"000000"] == YES)
|
|
|
|
{
|
|
|
|
pos = 1;
|
|
|
|
if ([k hasSuffix: @"000"] == YES)
|
|
|
|
{
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (l == pos)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<ol>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (l > pos + 1)
|
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</li>\n"];
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</ol>\n"];
|
|
|
|
l--;
|
|
|
|
}
|
|
|
|
if (l == pos + 1)
|
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</li>\n"];
|
|
|
|
l--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<li>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"#%@\">%@</a>\n", k, v];
|
|
|
|
if (pos == 3)
|
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</li>\n"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
l++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (l > 0)
|
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</li>\n"];
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</ol>\n"];
|
|
|
|
l--;
|
|
|
|
}
|
|
|
|
[buf appendString: indent];
|
2001-12-18 06:48:20 +00:00
|
|
|
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
|
2001-12-17 22:36:30 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-02 06:50:30 +00:00
|
|
|
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>"];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [node firstChild] to: buf];
|
2002-01-02 06:50:30 +00:00
|
|
|
[buf appendString: @"</dd>\n"];
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</dl>\n"];
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</blockquote>\n"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"desc"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<p>\n"];
|
|
|
|
[self incIndent];
|
2001-12-18 17:46:13 +00:00
|
|
|
while (children != nil)
|
|
|
|
{
|
|
|
|
children = [self outputBlock: children to: buf inPara: YES];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</p>\n"];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"em"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<em>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</em>"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"email"] == YES)
|
|
|
|
{
|
2005-02-22 11:22:44 +00:00
|
|
|
NSString *ename;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
|
|
|
ename = [prop objectForKey: @"address"];
|
|
|
|
if (ename == nil)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<code>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-16 13:36:06 +00:00
|
|
|
[buf appendFormat: @"<a href=\"mailto:%@\"><code>", ename];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2003-06-17 05:06:00 +00:00
|
|
|
//
|
|
|
|
// [node firstChild] doesn't look like it points to
|
|
|
|
// the mail address.
|
|
|
|
// not sure _where_ it points to though...
|
|
|
|
//
|
|
|
|
#if 0
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [node firstChild] to: buf];
|
2003-06-17 05:06:00 +00:00
|
|
|
#endif
|
2001-11-21 17:10:22 +00:00
|
|
|
if (ename == nil)
|
|
|
|
{
|
|
|
|
[buf appendString: @"</code>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-06-17 05:06:00 +00:00
|
|
|
[buf appendFormat: @"%@</code></a>", ename];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
else if ([name isEqual: @"embed"] == YES)
|
|
|
|
{
|
|
|
|
[self outputBlock: node to: buf inPara: NO];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"entry"])
|
|
|
|
{
|
|
|
|
NSString *text;
|
|
|
|
NSString *val;
|
|
|
|
|
2003-05-12 19:23:02 +00:00
|
|
|
text = [children escapedContent];
|
2001-11-21 17:10:22 +00:00
|
|
|
val = [prop objectForKey: @"id"];
|
|
|
|
if (val == nil)
|
|
|
|
{
|
|
|
|
val = text;
|
2003-03-23 07:06:27 +00:00
|
|
|
if (val == nil) val = @"";
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: [self makeAnchor: val ofType: @"label" name: @""]];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
else if ([name isEqual: @"example"] == YES)
|
|
|
|
{
|
|
|
|
[self outputBlock: node to: buf inPara: NO];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"file"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<code>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</code>"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"footnote"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<blockquote>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</blockquote>"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"front"] == YES)
|
|
|
|
{
|
|
|
|
// Open front division
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<div>\n"];
|
|
|
|
[self incIndent];
|
2001-11-21 17:10:22 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2001-10-17 20:58:12 +00:00
|
|
|
// Close front division
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</div>\n"];
|
|
|
|
}
|
2002-02-04 20:20:07 +00:00
|
|
|
else if ([name isEqual: @"function"] == YES)
|
|
|
|
{
|
|
|
|
NSString *fun;
|
|
|
|
NSString *str;
|
|
|
|
NSString *s;
|
|
|
|
GSXMLNode *tmp = children;
|
|
|
|
BOOL hadArg = NO;
|
|
|
|
|
|
|
|
fun = [prop objectForKey: @"name"];
|
|
|
|
str = [prop objectForKey: @"type"];
|
2002-02-12 20:58:10 +00:00
|
|
|
str = [self typeRef: str];
|
2002-02-04 20:20:07 +00:00
|
|
|
str = [str stringByAppendingFormat: @" %@(", fun];
|
|
|
|
children = nil;
|
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
if ([tmp type] == XML_ELEMENT_NODE)
|
|
|
|
{
|
|
|
|
if ([[tmp name] isEqual: @"arg"] == YES)
|
|
|
|
{
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *t = [tmp firstChild];
|
2002-02-04 20:20:07 +00:00
|
|
|
NSString *s;
|
|
|
|
|
|
|
|
if (hadArg == YES)
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @", "];
|
|
|
|
}
|
|
|
|
|
2002-05-23 15:58:15 +00:00
|
|
|
s = [[tmp attributes] objectForKey: @"type"];
|
2002-02-04 20:20:07 +00:00
|
|
|
s = [self typeRef: s];
|
|
|
|
str = [str stringByAppendingString: s];
|
|
|
|
|
|
|
|
str = [str stringByAppendingString: @" <b>"];
|
|
|
|
while (t != nil)
|
|
|
|
{
|
|
|
|
if ([t type] == XML_TEXT_NODE)
|
|
|
|
{
|
2003-05-12 19:23:02 +00:00
|
|
|
NSString *content = [t escapedContent];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
if (content == nil) content = @"";
|
2002-02-04 20:20:07 +00:00
|
|
|
str = [str stringByAppendingString: content];
|
|
|
|
}
|
|
|
|
t = [t next];
|
|
|
|
}
|
|
|
|
str = [str stringByAppendingString: @"</b>"];
|
|
|
|
hadArg = YES;
|
|
|
|
}
|
|
|
|
else if ([[tmp name] isEqual: @"vararg"] == YES)
|
|
|
|
{
|
|
|
|
if (hadArg == YES)
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @"<b>,...</b>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @"<b>,...</b>"];
|
|
|
|
}
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [tmp nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
children = tmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-04-25 13:06:59 +00:00
|
|
|
tmp = [tmp nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Output function heading.
|
|
|
|
*/
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h3>"];
|
|
|
|
s = [self makeLink: fun ofType: @"function" isRef: NO];
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: fun];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: fun];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</h3>\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: str];
|
|
|
|
[buf appendString: @");<br />\n"];
|
|
|
|
|
|
|
|
node = firstElement(children);
|
|
|
|
|
|
|
|
if ([[node name] isEqual: @"declared"] == YES)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
|
|
|
|
2002-04-25 13:06:59 +00:00
|
|
|
children = node;
|
2002-02-04 20:20:07 +00:00
|
|
|
if ([[children name] isEqual: @"standards"])
|
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
if ([[node name] isEqual: @"desc"])
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"gsdoc"] == YES)
|
|
|
|
{
|
2004-03-29 03:37:46 +00:00
|
|
|
NSString *stylesheetURL = [prop objectForKey: @"stylesheeturl"];
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
base = [prop objectForKey: @"base"];
|
|
|
|
if (base == nil)
|
|
|
|
{
|
|
|
|
NSLog(@"No 'base' document name supplied in gsdoc element");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nextFile = [prop objectForKey: @"next"];
|
|
|
|
nextFile = [nextFile stringByAppendingPathExtension: @"html"];
|
2001-12-18 06:48:20 +00:00
|
|
|
prevFile = [prop objectForKey: @"prev"];
|
2001-10-17 20:58:12 +00:00
|
|
|
prevFile = [prevFile stringByAppendingPathExtension: @"html"];
|
|
|
|
upFile = [prop objectForKey: @"up"];
|
|
|
|
upFile = [upFile stringByAppendingPathExtension: @"html"];
|
2004-03-29 03:37:46 +00:00
|
|
|
|
|
|
|
// special formatting for table-of-contents frames; ultimately
|
|
|
|
// this should be moved to stylesheet
|
|
|
|
isContentsDoc = ((stylesheetURL != nil) &&
|
|
|
|
([stylesheetURL rangeOfString: @"gsdoc_contents"].length > 0)) ?
|
|
|
|
YES : NO;
|
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"head"] == YES)
|
|
|
|
{
|
2004-03-29 03:37:46 +00:00
|
|
|
NSString *headerTag;
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<head>\n"];
|
|
|
|
[self incIndent];
|
2001-11-21 17:10:22 +00:00
|
|
|
children = firstElement(children);
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<title>"];
|
|
|
|
[self incIndent];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: @"</title>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</head>\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<body>\n"];
|
|
|
|
[self incIndent];
|
2001-12-18 06:48:20 +00:00
|
|
|
|
2004-03-29 03:37:46 +00:00
|
|
|
// special formatting for table-of-contents frames; ultimately
|
|
|
|
// this should be moved to stylesheet
|
|
|
|
if (isContentsDoc)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
2004-03-29 03:44:10 +00:00
|
|
|
[buf appendFormat: @"<font face=\"%@\" size=\"-1\">\n", tocFont];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<font face=\"%@\">\n", mainFont];
|
2004-03-29 03:37:46 +00:00
|
|
|
}
|
|
|
|
|
2001-12-18 06:48:20 +00:00
|
|
|
if (prevFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"%@\">Prev</a>\n", prevFile];
|
|
|
|
}
|
|
|
|
if (upFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"%@\">Up</a>\n", upFile];
|
|
|
|
}
|
|
|
|
if (nextFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"%@\">Next</a>\n", nextFile];
|
|
|
|
}
|
2004-03-29 03:37:46 +00:00
|
|
|
if (prevFile != nil || upFile != nil || nextFile != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<br />\n"];
|
|
|
|
}
|
2001-12-18 06:48:20 +00:00
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: indent];
|
2004-03-29 03:37:46 +00:00
|
|
|
if (isContentsDoc)
|
|
|
|
{
|
|
|
|
headerTag = @"h2";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
headerTag = @"h1";
|
|
|
|
}
|
|
|
|
[buf appendFormat: @"<%@><a name=\"title$%@\">", headerTag, base];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2004-03-29 03:37:46 +00:00
|
|
|
[buf appendFormat: @"</a></%@>\n", headerTag];
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2003-07-22 04:22:58 +00:00
|
|
|
if ([[children name] isEqual: @"author"] == YES)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
2003-07-22 04:22:58 +00:00
|
|
|
[buf appendString: @"<h3>Authors</h3>\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: indent];
|
2003-07-22 04:22:58 +00:00
|
|
|
[buf appendString: @"<dl>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
while ([[children name] isEqual: @"author"] == YES)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2003-07-22 04:22:58 +00:00
|
|
|
GSXMLNode *author = children;
|
|
|
|
GSXMLNode *tmp;
|
|
|
|
GSXMLNode *email = nil;
|
|
|
|
GSXMLNode *url = nil;
|
|
|
|
GSXMLNode *desc = nil;
|
|
|
|
|
|
|
|
children = [children nextElement];
|
|
|
|
|
|
|
|
tmp = [author firstChildElement];
|
|
|
|
if ([[tmp name] isEqual: @"email"] == YES)
|
2001-12-18 17:46:13 +00:00
|
|
|
{
|
2003-07-22 04:22:58 +00:00
|
|
|
email = tmp;
|
|
|
|
tmp = [tmp nextElement];
|
2001-12-18 17:46:13 +00:00
|
|
|
}
|
2003-07-22 04:22:58 +00:00
|
|
|
if ([[tmp name] isEqual: @"url"] == YES)
|
|
|
|
{
|
|
|
|
url = tmp;
|
|
|
|
tmp = [tmp nextElement];
|
|
|
|
}
|
|
|
|
if ([[tmp name] isEqual: @"desc"] == YES)
|
|
|
|
{
|
|
|
|
desc = tmp;
|
|
|
|
tmp = [tmp nextElement];
|
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
if (url == nil)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<dt>"];
|
|
|
|
[buf appendString: [[author attributes]
|
|
|
|
objectForKey: @"name"]];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: @"<dt><a href=\""];
|
|
|
|
[buf appendString: [[url attributes]
|
|
|
|
objectForKey: @"url"]];
|
|
|
|
[buf appendString: @"\">"];
|
|
|
|
[buf appendString: [[author attributes]
|
|
|
|
objectForKey: @"name"]];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
if (email != nil)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Add a beautifier ' ' otherwise we'll get a
|
|
|
|
// <dt>John Doe(<a href="mailto:...
|
|
|
|
// or
|
|
|
|
// <dt><a href...>John Doe</a>(<a href...
|
|
|
|
//
|
|
|
|
[buf appendString: @" ("];
|
|
|
|
[self outputNode: email to: buf];
|
|
|
|
[buf appendString: @")"];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</dt>\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dd>\n"];
|
|
|
|
if (desc != nil)
|
|
|
|
{
|
|
|
|
[self incIndent];
|
2004-03-29 03:37:46 +00:00
|
|
|
[self outputNode: desc to: buf];
|
|
|
|
desc = nil;
|
2003-07-22 04:22:58 +00:00
|
|
|
[self decIndent];
|
|
|
|
}
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</dd>\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2003-07-22 04:22:58 +00:00
|
|
|
[self decIndent];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: indent];
|
2003-07-22 04:22:58 +00:00
|
|
|
[buf appendString: @"</dl>\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
if ([[children name] isEqual: @"version"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
2001-12-18 16:23:03 +00:00
|
|
|
[buf appendString: @"<p><b>Version:</b> "];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: @"</p>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
if ([[children name] isEqual: @"date"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
2001-12-18 16:23:03 +00:00
|
|
|
[buf appendString: @"<p><b>Date:</b> "];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: @"</p>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
if ([[children name] isEqual: @"abstract"] == YES)
|
|
|
|
{
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *tmp = [children firstChild];
|
2001-12-18 17:46:13 +00:00
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<blockquote>\n"];
|
|
|
|
[self incIndent];
|
2001-12-18 17:46:13 +00:00
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
tmp = [self outputBlock: tmp to: buf inPara: NO];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</blockquote>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
if ([[children name] isEqual: @"copy"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
2001-12-18 11:29:02 +00:00
|
|
|
[buf appendString: @"<p><b>Copyright:</b> (C) "];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: @"</p>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"heading"] == YES)
|
|
|
|
{
|
2002-10-05 17:47:54 +00:00
|
|
|
if (heading == nil)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<"];
|
|
|
|
[buf appendString: heading];
|
|
|
|
[buf appendString: @">"];
|
|
|
|
[buf appendFormat: @"<a name=\"%03u%03u%03u%03u\">",
|
|
|
|
chap, sect, ssect, sssect];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</a></"];
|
|
|
|
[buf appendString: heading];
|
|
|
|
[buf appendString: @">\n"];
|
|
|
|
heading = nil;
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-12-18 09:31:32 +00:00
|
|
|
else if ([name isEqual: @"index"] == YES)
|
|
|
|
{
|
|
|
|
NSString *scope = [prop objectForKey: @"scope"];
|
|
|
|
NSString *type = [prop objectForKey: @"type"];
|
2004-03-29 03:37:46 +00:00
|
|
|
NSString *target = [prop objectForKey: @"target"];
|
2002-01-06 10:24:43 +00:00
|
|
|
NSString *title = [type capitalizedString];
|
2004-03-29 03:37:46 +00:00
|
|
|
NSString *style = [prop objectForKey: @"style"];
|
2001-12-18 09:31:32 +00:00
|
|
|
|
2004-03-29 03:37:46 +00:00
|
|
|
[self outputIndex: type scope: scope title: title style: style
|
|
|
|
target: target to: buf ];
|
2001-12-18 09:31:32 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
else if ([name isEqual: @"ivar"] == YES) // %phrase
|
|
|
|
{
|
|
|
|
[buf appendString: @"<var>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</var>"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"ivariable"] == YES)
|
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSString *n = [prop objectForKey: @"name"];
|
|
|
|
NSString *t = [prop objectForKey: @"type"];
|
|
|
|
NSString *v = [prop objectForKey: @"validity"];
|
|
|
|
NSString *s;
|
2003-04-06 07:51:45 +00:00
|
|
|
GSXMLNode *tmp;
|
2001-10-17 20:58:12 +00:00
|
|
|
|
2003-04-06 07:51:45 +00:00
|
|
|
tmp = children = firstElement(children);
|
2002-01-08 17:31:38 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h3>"];
|
|
|
|
s = [self makeLink: n ofType: @"ivariable" inUnit: nil isRef: NO];
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: n];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: n];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</h3>\n"];
|
|
|
|
if (v == nil)
|
|
|
|
{
|
|
|
|
v = @"public";
|
|
|
|
}
|
|
|
|
[buf appendFormat: @"%@@%@ %@ <b>%@</b>;<br />\n", indent, v, t, n];
|
|
|
|
|
|
|
|
if ([[children name] isEqual: @"desc"] == YES)
|
|
|
|
{
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2002-01-08 17:31:38 +00:00
|
|
|
}
|
|
|
|
/*
|
2003-04-06 07:51:45 +00:00
|
|
|
* List standards with which ivar complies
|
2002-01-08 17:31:38 +00:00
|
|
|
*/
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-01-08 17:31:38 +00:00
|
|
|
if ([[tmp name] isEqual: @"desc"])
|
|
|
|
{
|
|
|
|
[self outputNode: tmp to: buf];
|
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"label"] == YES) // %anchor
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
|
|
|
NSString *text;
|
|
|
|
NSString *val;
|
|
|
|
|
2003-05-12 19:23:02 +00:00
|
|
|
text = [children escapedContent];
|
2001-10-17 20:58:12 +00:00
|
|
|
val = [prop objectForKey: @"id"];
|
|
|
|
if (val == nil)
|
|
|
|
{
|
|
|
|
val = text;
|
2003-03-23 07:06:27 +00:00
|
|
|
if (val == nil) val = @"";
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString:
|
|
|
|
[self makeAnchor: val ofType: @"label" name: text]];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2002-10-09 06:07:38 +00:00
|
|
|
else if ([name isEqual: @"macro"] == YES)
|
|
|
|
{
|
|
|
|
NSString *mac;
|
|
|
|
NSString *str;
|
|
|
|
NSString *s;
|
|
|
|
GSXMLNode *tmp = children;
|
|
|
|
BOOL hadArg = NO;
|
|
|
|
|
|
|
|
mac = [prop objectForKey: @"name"];
|
|
|
|
str = [NSString stringWithFormat: @" %@", mac];
|
|
|
|
children = nil;
|
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
if ([tmp type] == XML_ELEMENT_NODE)
|
|
|
|
{
|
|
|
|
if ([[tmp name] isEqual: @"arg"] == YES)
|
|
|
|
{
|
|
|
|
GSXMLNode *t = [tmp firstChild];
|
|
|
|
|
|
|
|
if (hadArg == YES)
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @", "];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @"("];
|
|
|
|
}
|
|
|
|
|
|
|
|
str = [str stringByAppendingString: @"<b>"];
|
|
|
|
while (t != nil)
|
|
|
|
{
|
|
|
|
if ([t type] == XML_TEXT_NODE)
|
|
|
|
{
|
2003-05-12 19:23:02 +00:00
|
|
|
NSString *content = [t escapedContent];
|
2002-10-09 06:07:38 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
if (content == nil) content = @"";
|
2002-10-09 06:07:38 +00:00
|
|
|
str = [str stringByAppendingString: content];
|
|
|
|
}
|
|
|
|
t = [t next];
|
|
|
|
}
|
|
|
|
str = [str stringByAppendingString: @"</b>"];
|
|
|
|
hadArg = YES;
|
|
|
|
}
|
|
|
|
else if ([[tmp name] isEqual: @"vararg"] == YES)
|
|
|
|
{
|
|
|
|
if (hadArg == YES)
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @"<b>,...</b>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @"<b>(...</b>"];
|
|
|
|
}
|
|
|
|
children = [tmp nextElement];
|
|
|
|
hadArg = YES;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
children = tmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tmp = [tmp nextElement];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Output macro heading.
|
|
|
|
*/
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h3>"];
|
|
|
|
s = [self makeLink: mac ofType: @"macro" isRef: NO];
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: mac];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: mac];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</h3>\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: str];
|
|
|
|
if (hadArg == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @")"];
|
|
|
|
}
|
|
|
|
[buf appendString: @"<br />\n"];
|
|
|
|
|
|
|
|
node = firstElement(children);
|
|
|
|
|
|
|
|
if ([[node name] isEqual: @"declared"] == YES)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
node = [node nextElement];
|
|
|
|
}
|
|
|
|
|
|
|
|
children = node;
|
|
|
|
if ([[children name] isEqual: @"standards"])
|
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2002-10-09 06:07:38 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-10-09 06:07:38 +00:00
|
|
|
|
|
|
|
if ([[node name] isEqual: @"desc"])
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"method"] == YES)
|
|
|
|
{
|
2001-11-21 17:10:22 +00:00
|
|
|
NSString *sel;
|
|
|
|
NSString *str;
|
2001-10-17 20:58:12 +00:00
|
|
|
GSXMLNode *tmp = children;
|
2001-11-21 17:10:22 +00:00
|
|
|
BOOL hadArg = NO;
|
2001-10-17 20:58:12 +00:00
|
|
|
|
|
|
|
sel = [prop objectForKey: @"factory"];
|
2001-11-21 17:10:22 +00:00
|
|
|
str = [prop objectForKey: @"type"];
|
2001-10-17 20:58:12 +00:00
|
|
|
if (sel != nil && [sel boolValue] == YES)
|
|
|
|
{
|
|
|
|
sel = @"+";
|
2001-11-21 17:10:22 +00:00
|
|
|
str = [NSString stringWithFormat: @"+ (%@) ",
|
|
|
|
[self typeRef: str]];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sel = @"-";
|
2001-11-29 07:38:04 +00:00
|
|
|
str = [NSString stringWithFormat: @"- (%@) ",
|
2001-11-21 17:10:22 +00:00
|
|
|
[self typeRef: str]];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
children = nil;
|
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
if ([tmp type] == XML_ELEMENT_NODE)
|
|
|
|
{
|
|
|
|
if ([[tmp name] isEqual: @"sel"] == YES)
|
|
|
|
{
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *t = [tmp firstChild];
|
2001-10-17 20:58:12 +00:00
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
str = [str stringByAppendingString: @"<b>"];
|
2001-10-17 20:58:12 +00:00
|
|
|
while (t != nil)
|
|
|
|
{
|
|
|
|
if ([t type] == XML_TEXT_NODE)
|
|
|
|
{
|
2003-05-12 19:23:02 +00:00
|
|
|
NSString *content = [t escapedContent];
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
if (content == nil) content = @"";
|
2001-11-21 17:10:22 +00:00
|
|
|
sel = [sel stringByAppendingString: content];
|
2004-03-29 03:44:10 +00:00
|
|
|
// these nbsp added for readability, but must
|
|
|
|
// be removed below when making href link
|
|
|
|
sel = [sel stringByAppendingString: @" "];
|
2001-11-21 17:10:22 +00:00
|
|
|
if (hadArg == YES)
|
|
|
|
{
|
|
|
|
str = [str stringByAppendingString: @" "];
|
|
|
|
}
|
|
|
|
str = [str stringByAppendingString: content];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
t = [t next];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
str = [str stringByAppendingString: @"</b>"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([[tmp name] isEqual: @"arg"] == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *t = [tmp firstChild];
|
2001-11-21 17:10:22 +00:00
|
|
|
NSString *s;
|
|
|
|
|
2002-05-23 15:58:15 +00:00
|
|
|
s = [[tmp attributes] objectForKey: @"type"];
|
2001-11-21 17:10:22 +00:00
|
|
|
s = [self typeRef: s];
|
|
|
|
str = [str stringByAppendingFormat: @" (%@)", s];
|
|
|
|
while (t != nil)
|
|
|
|
{
|
|
|
|
if ([t type] == XML_TEXT_NODE)
|
|
|
|
{
|
2003-05-12 19:23:02 +00:00
|
|
|
NSString *content = [t escapedContent];
|
2003-03-23 07:06:27 +00:00
|
|
|
|
|
|
|
if (content == nil) content = @"";
|
|
|
|
str = [str stringByAppendingString: content];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
t = [t next];
|
|
|
|
}
|
|
|
|
hadArg = YES; // Say we have found an arg.
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([[tmp name] isEqual: @"vararg"] == YES)
|
|
|
|
{
|
|
|
|
sel = [sel stringByAppendingString: @",..."];
|
2001-11-21 17:10:22 +00:00
|
|
|
str = [str stringByAppendingString: @"<b>,...</b>"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [tmp nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
children = tmp;
|
|
|
|
break;
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2002-04-25 13:06:59 +00:00
|
|
|
tmp = [tmp nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
if ([sel length] > 1)
|
|
|
|
{
|
2001-12-15 07:54:10 +00:00
|
|
|
NSString *s;
|
2004-03-29 03:44:10 +00:00
|
|
|
NSMutableString *linkRef;
|
2001-12-15 07:54:10 +00:00
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
/*
|
|
|
|
* Output selector heading.
|
|
|
|
*/
|
|
|
|
[buf appendString: indent];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"<h3>"];
|
2004-03-29 03:44:10 +00:00
|
|
|
// get rid of nbsps put in for readability above
|
|
|
|
linkRef = [NSMutableString stringWithCapacity: [sel length]];
|
|
|
|
[linkRef setString:sel];
|
2004-12-13 04:53:01 +00:00
|
|
|
[linkRef replaceString: @" " withString: @""];
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2004-03-29 03:44:10 +00:00
|
|
|
s = [self makeLink: linkRef ofType: @"method" inUnit: nil isRef: NO];
|
2001-12-17 09:49:08 +00:00
|
|
|
if (s != nil)
|
2001-12-15 07:54:10 +00:00
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: [sel substringFromIndex: 1]];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: [sel substringFromIndex: 1]];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</h3>\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: str];
|
|
|
|
[buf appendString: @";<br />\n"];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
node = firstElement(children);
|
2001-11-21 17:10:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* List standards with which method complies
|
|
|
|
*/
|
2005-05-08 20:14:19 +00:00
|
|
|
children = node;
|
2001-11-21 17:10:22 +00:00
|
|
|
if ([[children name] isEqual: @"standards"])
|
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
|
|
|
|
if ((str = [prop objectForKey: @"init"]) != nil
|
|
|
|
&& [str boolValue] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"This is a designated initialiser "
|
|
|
|
@"for the class.<br />\n"];
|
|
|
|
}
|
|
|
|
str = [prop objectForKey: @"override"];
|
|
|
|
if ([str isEqual: @"subclass"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"Subclasses <strong>should</strong> "
|
|
|
|
@"override this method.<br />\n"];
|
|
|
|
}
|
|
|
|
else if ([str isEqual: @"never"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"Subclasses should <strong>NOT</strong> "
|
|
|
|
@"override this method.<br />\n"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ([[node name] isEqual: @"desc"])
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
}
|
|
|
|
[buf appendString: indent];
|
2001-12-18 06:48:20 +00:00
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
else if ([name isEqual: @"p"] == YES)
|
|
|
|
{
|
|
|
|
[self outputBlock: node to: buf inPara: NO];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"prjref"] == YES)
|
|
|
|
{
|
2001-12-26 11:32:46 +00:00
|
|
|
NSLog(@"Element '%@' not implemented", name); // FIXME
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"ref"] == YES) // %xref
|
|
|
|
{
|
|
|
|
NSString *type = [prop objectForKey: @"type"];
|
|
|
|
NSString *r = [prop objectForKey: @"id"];
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *tmp = [node firstChild];
|
2002-10-14 11:05:49 +00:00
|
|
|
NSString *c = [prop objectForKey: @"class"];
|
2001-12-15 07:54:10 +00:00
|
|
|
NSString *s;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2004-03-29 03:37:46 +00:00
|
|
|
// fill in default value
|
|
|
|
if ((type == nil) || [type isEqual: @""])
|
|
|
|
type = @"label";
|
|
|
|
|
2001-12-15 07:54:10 +00:00
|
|
|
if ([type isEqual: @"method"] || [type isEqual: @"ivariable"])
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2002-10-14 11:05:49 +00:00
|
|
|
s = [self makeLink: r ofType: type inUnit: c isRef: YES];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-15 07:54:10 +00:00
|
|
|
s = [self makeLink: r ofType: type isRef: YES];
|
2002-10-09 11:00:03 +00:00
|
|
|
/**
|
|
|
|
* As a special case, if we have a reference to a function,
|
|
|
|
* and we can't find it, we check to see if there is actually
|
|
|
|
* a macro of that name and refer to that instead.
|
|
|
|
*/
|
|
|
|
if (s == nil && [type isEqual: @"function"] == YES)
|
|
|
|
{
|
|
|
|
s = [self makeLink: r ofType: @"macro" isRef: YES];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
if (s == nil)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2002-10-14 11:05:49 +00:00
|
|
|
if (c == nil)
|
|
|
|
{
|
2002-10-14 11:26:28 +00:00
|
|
|
NSLog(@"Location of %@ '%@' (referenced from %@) "
|
|
|
|
@"not found or not unique.", type, r, base);
|
2002-10-14 11:05:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-14 11:26:28 +00:00
|
|
|
NSLog(@"Location of the %@ version of %@ '%@' (referenced "
|
|
|
|
@"from %@) not found.", c, type, r, base);
|
2002-10-14 11:05:49 +00:00
|
|
|
}
|
2002-02-12 12:33:57 +00:00
|
|
|
if (tmp == nil)
|
|
|
|
{
|
|
|
|
[buf appendString: r];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self outputText: tmp to: buf];
|
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: s];
|
2002-02-12 12:33:57 +00:00
|
|
|
if (tmp == nil)
|
|
|
|
{
|
|
|
|
[buf appendString: r];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self outputText: tmp to: buf];
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: @"</a>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"protocol"] == YES)
|
|
|
|
{
|
2004-01-12 19:42:18 +00:00
|
|
|
NSString *value = [prop objectForKey: @"name"];
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2004-01-12 19:42:18 +00:00
|
|
|
unit = [NSString stringWithFormat: @"(%@)", value];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h2>"];
|
|
|
|
[buf appendString:
|
2004-01-12 19:42:18 +00:00
|
|
|
[self makeAnchor: unit ofType: @"protocol" name: value]];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"</h2>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self outputUnit: node to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
unit = nil;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2002-02-04 20:20:07 +00:00
|
|
|
else if ([name isEqual: @"EOEntity"] == YES
|
2002-10-09 06:07:38 +00:00
|
|
|
|| [name isEqual: @"EOModel"] == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-12-26 11:32:46 +00:00
|
|
|
NSLog(@"Element '%@' not implemented", name); // FIXME
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"section"] == YES)
|
|
|
|
{
|
|
|
|
heading = @"h2";
|
2001-12-17 22:36:30 +00:00
|
|
|
sect++;
|
|
|
|
ssect = 0;
|
|
|
|
sssect = 0;
|
2001-11-29 14:26:24 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2002-10-05 17:47:54 +00:00
|
|
|
heading = @"h1";
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"site"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<code>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</code>"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2002-01-02 06:50:30 +00:00
|
|
|
else if ([name isEqual: @"standards"])
|
|
|
|
{
|
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
else if ([name isEqual: @"strong"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<strong>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</strong>"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([name isEqual: @"subsect"] == YES)
|
|
|
|
{
|
|
|
|
heading = @"h3";
|
2001-12-17 22:36:30 +00:00
|
|
|
ssect++;
|
|
|
|
sssect = 0;
|
2001-11-29 14:26:24 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2002-10-05 17:47:54 +00:00
|
|
|
heading = @"h2";
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"subsubsect"] == YES)
|
|
|
|
{
|
|
|
|
heading = @"h4";
|
2001-12-17 22:36:30 +00:00
|
|
|
sssect++;
|
2001-11-29 14:26:24 +00:00
|
|
|
[self outputNodeList: children to: buf];
|
2002-10-05 17:47:54 +00:00
|
|
|
heading = @"h3";
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
else if ([name isEqual: @"type"] == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2002-02-04 20:20:07 +00:00
|
|
|
NSString *nam;
|
|
|
|
NSString *str;
|
2001-12-15 07:54:10 +00:00
|
|
|
NSString *s;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2002-02-04 20:20:07 +00:00
|
|
|
nam = [prop objectForKey: @"name"];
|
|
|
|
str = [prop objectForKey: @"type"];
|
2002-02-12 20:58:10 +00:00
|
|
|
str = [self typeRef: str];
|
2002-02-04 20:20:07 +00:00
|
|
|
str = [NSString stringWithFormat: @"typedef %@ %@", str, nam];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Output typedef heading.
|
|
|
|
*/
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"<h3>"];
|
2002-02-04 20:20:07 +00:00
|
|
|
s = [self makeLink: nam ofType: @"type" isRef: NO];
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: nam];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: nam];
|
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
[buf appendString: @"</h3>\n"];
|
2002-02-04 20:20:07 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: str];
|
|
|
|
[buf appendString: @";<br />\n"];
|
|
|
|
|
|
|
|
node = firstElement(children);
|
2001-11-21 17:10:22 +00:00
|
|
|
|
|
|
|
if (node != nil && [[node name] isEqual: @"declared"] == YES)
|
|
|
|
{
|
2002-01-02 06:50:30 +00:00
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2002-02-04 20:20:07 +00:00
|
|
|
|
2002-04-25 13:06:59 +00:00
|
|
|
children = node;
|
2002-02-04 20:20:07 +00:00
|
|
|
if ([[children name] isEqual: @"standards"])
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
if (node != nil && [[node name] isEqual: @"desc"] == YES)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"uref"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: @"<a href=\""];
|
|
|
|
[buf appendString: [prop objectForKey: @"url"]];
|
|
|
|
[buf appendString: @"\">"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self outputText: children to: buf];
|
2001-11-21 17:10:22 +00:00
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"url"] == YES)
|
|
|
|
{
|
2004-03-29 03:37:46 +00:00
|
|
|
// create an HREF as before but use the URL itself as marker text
|
|
|
|
[buf appendString: @"<a href=\""];
|
|
|
|
[buf appendString: [prop objectForKey: @"url"]];
|
|
|
|
[buf appendString: @"\">"];
|
|
|
|
[buf appendString: [prop objectForKey: @"url"]];
|
|
|
|
[buf appendString: @"</a>"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
else if ([name isEqual: @"var"] == YES) // %phrase
|
|
|
|
{
|
|
|
|
[buf appendString: @"<var>"];
|
|
|
|
[self outputText: children to: buf];
|
|
|
|
[buf appendString: @"</var>"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
else if ([name isEqual: @"variable"] == YES)
|
|
|
|
{
|
2002-02-04 20:20:07 +00:00
|
|
|
NSString *nam;
|
|
|
|
NSString *str;
|
|
|
|
NSString *s;
|
|
|
|
|
|
|
|
nam = [prop objectForKey: @"name"];
|
|
|
|
str = [prop objectForKey: @"type"];
|
2002-02-12 20:58:10 +00:00
|
|
|
str = [self typeRef: str];
|
2002-02-04 20:20:07 +00:00
|
|
|
str = [str stringByAppendingFormat: @" %@", nam];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Output variable heading.
|
|
|
|
*/
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<h3>"];
|
|
|
|
s = [self makeLink: nam ofType: @"variable" isRef: NO];
|
|
|
|
if (s != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: s];
|
|
|
|
[buf appendString: nam];
|
|
|
|
[buf appendString: @"</a>"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[buf appendString: nam];
|
|
|
|
}
|
|
|
|
[buf appendString: @"</h3>\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: str];
|
|
|
|
[buf appendString: @";<br />\n"];
|
|
|
|
|
|
|
|
node = firstElement(children);
|
|
|
|
|
|
|
|
if ([[node name] isEqual: @"declared"] == YES)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
|
|
|
|
2002-04-25 13:06:59 +00:00
|
|
|
children = node;
|
2002-02-04 20:20:07 +00:00
|
|
|
if ([[children name] isEqual: @"standards"])
|
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2002-02-04 20:20:07 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-02-04 20:20:07 +00:00
|
|
|
|
|
|
|
if ([[node name] isEqual: @"desc"])
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
}
|
|
|
|
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"25%\" align=\"left\" />\n"];
|
2001-12-15 07:54:10 +00:00
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GSXMLNode *tmp;
|
|
|
|
/*
|
2004-03-29 03:37:46 +00:00
|
|
|
* Try outputting as any of the list elements.
|
2001-10-17 20:58:12 +00:00
|
|
|
*/
|
2001-11-29 14:26:24 +00:00
|
|
|
tmp = [self outputList: node to: buf];
|
2001-10-17 20:58:12 +00:00
|
|
|
if (tmp == node)
|
|
|
|
{
|
|
|
|
NSLog(@"Element '%@' not implemented", name); // FIXME
|
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
node = tmp;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-21 17:10:22 +00:00
|
|
|
RELEASE(arp);
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
|
2002-10-05 17:47:54 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2001-11-21 17:10:22 +00:00
|
|
|
- (void) outputNodeList: (GSXMLNode*)node to: (NSMutableString*)buf
|
|
|
|
{
|
|
|
|
while (node != nil)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2002-04-25 13:06:59 +00:00
|
|
|
GSXMLNode *next = [node nextElement];
|
2002-10-05 17:47:54 +00:00
|
|
|
GSXMLNode *tmp;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2002-10-05 17:47:54 +00:00
|
|
|
tmp = [self outputText: node to: buf];
|
|
|
|
if (tmp == node)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
node = next;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = tmp;
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Outputs zero or more nodes at the same level as long as the nodes
|
|
|
|
* are valid %block elements. Returns nil or the first node not output.
|
|
|
|
* The value of flag is used to control paragraph nesting ... if YES
|
|
|
|
* we close a paragraph before opening a new one, and open again once
|
|
|
|
* the new paragraph closes.
|
|
|
|
*/
|
|
|
|
- (GSXMLNode*) outputBlock: (GSXMLNode*)node
|
|
|
|
to: (NSMutableString*)buf
|
|
|
|
inPara: (BOOL)flag
|
|
|
|
{
|
2001-11-29 14:26:24 +00:00
|
|
|
if (node != nil && [node type] == XML_ELEMENT_NODE)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-11-29 14:26:24 +00:00
|
|
|
GSXMLNode *tmp = node;
|
|
|
|
NSString *n;
|
2001-10-17 20:58:12 +00:00
|
|
|
|
2001-11-29 14:26:24 +00:00
|
|
|
node = [self outputList: node to: buf];
|
|
|
|
if (node != tmp)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-11-29 14:26:24 +00:00
|
|
|
return node;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
n = [node name];
|
|
|
|
if ([n isEqual: @"p"] == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-11-29 14:26:24 +00:00
|
|
|
if (flag == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</p>\n"];
|
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<p>\n"];
|
|
|
|
[self incIndent];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [node firstChild] to: buf];
|
2001-11-29 14:26:24 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</p>\n"];
|
|
|
|
if (flag == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<p>\n"];
|
|
|
|
[self incIndent];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2002-11-11 10:18:49 +00:00
|
|
|
return [node next];
|
2001-11-29 14:26:24 +00:00
|
|
|
}
|
|
|
|
else if ([n isEqual: @"example"] == YES)
|
|
|
|
{
|
2002-11-28 07:19:48 +00:00
|
|
|
GSXMLNode *c = [node firstChild];
|
|
|
|
|
|
|
|
[buf appendString: @"<pre>"];
|
|
|
|
[self outputText: c to: buf];
|
|
|
|
[buf appendString: @"</pre>\n"];
|
2002-11-11 10:18:49 +00:00
|
|
|
return [node next];
|
2001-11-29 14:26:24 +00:00
|
|
|
}
|
|
|
|
else if ([n isEqual: @"embed"] == YES)
|
|
|
|
{
|
|
|
|
NSLog(@"Element 'embed' not supported");
|
2002-11-11 10:18:49 +00:00
|
|
|
return [node next];
|
2001-12-18 07:06:05 +00:00
|
|
|
}
|
2002-01-05 09:54:28 +00:00
|
|
|
else if ([n isEqual: @"index"] == YES)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
2002-11-11 10:18:49 +00:00
|
|
|
return [node next];
|
2002-01-05 09:54:28 +00:00
|
|
|
}
|
2001-12-18 07:06:05 +00:00
|
|
|
else if ([textNodes member: n] != nil)
|
|
|
|
{
|
2001-12-18 07:20:25 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
node = [self outputText: node to: buf];
|
|
|
|
[buf appendString: @"\n"];
|
|
|
|
return node;
|
2001-11-29 14:26:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NSLog(@"Non-block element '%@' in block ...", n);
|
2004-03-29 03:37:46 +00:00
|
|
|
NSLog(@"%@",node);
|
2002-06-06 14:02:59 +00:00
|
|
|
return nil;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
|
2001-12-18 07:20:25 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
node = [self outputText: node to: buf];
|
|
|
|
[buf appendString: @"\n"];
|
|
|
|
return node;
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-11-29 14:26:24 +00:00
|
|
|
* Outputs a node as long as it is a
|
|
|
|
* valid %list element. Returns next node at this level.
|
2001-10-17 20:58:12 +00:00
|
|
|
*/
|
|
|
|
- (GSXMLNode*) outputList: (GSXMLNode*)node to: (NSMutableString*)buf
|
|
|
|
{
|
2001-11-29 14:26:24 +00:00
|
|
|
NSString *name = [node name];
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *children = [node firstChildElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
|
2001-11-29 14:26:24 +00:00
|
|
|
if ([name isEqual: @"list"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<ul>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
while (children != nil)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *tmp = [children firstChild];
|
2001-12-18 17:46:13 +00:00
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"<li>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self incIndent];
|
2001-12-18 17:46:13 +00:00
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
tmp = [self outputBlock: tmp to: buf inPara: NO];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"</li>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</ul>\n"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"enum"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<ol>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
while (children != nil)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2002-05-22 14:23:17 +00:00
|
|
|
GSXMLNode *tmp = [children firstChild];
|
2001-12-18 17:46:13 +00:00
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"<li>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self incIndent];
|
2001-12-18 17:46:13 +00:00
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
tmp = [self outputBlock: tmp to: buf inPara: NO];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"</li>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</ol>\n"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"deflist"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dl>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
while (children != nil)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-12-18 17:46:13 +00:00
|
|
|
GSXMLNode *tmp;
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"<dt>"];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"</dt>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dd>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self incIndent];
|
2002-05-22 14:23:17 +00:00
|
|
|
tmp = [children firstChild];
|
2001-12-18 17:46:13 +00:00
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
tmp = [self outputBlock: tmp to: buf inPara: NO];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"</dd>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</dl>\n"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"qalist"] == YES)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dl>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
while (children != nil)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-12-18 17:46:13 +00:00
|
|
|
GSXMLNode *tmp;
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"<dt>"];
|
2002-05-22 14:23:17 +00:00
|
|
|
[self outputText: [children firstChild] to: buf];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"</dt>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dd>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
[self incIndent];
|
2002-05-22 14:23:17 +00:00
|
|
|
tmp = [children firstChild];
|
2001-12-18 17:46:13 +00:00
|
|
|
while (tmp != nil)
|
|
|
|
{
|
|
|
|
tmp = [self outputBlock: tmp to: buf inPara: NO];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @"</dd>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
children = [children nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</dl>\n"];
|
|
|
|
}
|
|
|
|
else if ([name isEqual: @"dictionary"] == YES)
|
|
|
|
{
|
2004-03-29 03:37:46 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dl>{\n"];
|
|
|
|
[self incIndent];
|
|
|
|
// all children should be dictionaryItems w/key and value attributes;
|
|
|
|
// if the value attribute is absent, the content is the value
|
|
|
|
for (; children != nil; children = [children nextElement])
|
|
|
|
{
|
|
|
|
GSXMLNode *dItem = children;
|
|
|
|
NSDictionary *dProp = [dItem attributes];
|
|
|
|
NSString *value = [dProp objectForKey: @"value"];
|
|
|
|
GSXMLNode *dChild;
|
|
|
|
if (![@"dictionaryItem" isEqualToString: [dItem name]])
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dt>"];
|
|
|
|
[buf appendString: [dProp objectForKey: @"key"]];
|
|
|
|
[buf appendString: @" = </dt>\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dd>\n"];
|
|
|
|
[self incIndent];
|
|
|
|
if (value != nil)
|
|
|
|
{
|
|
|
|
[buf appendString: value];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dChild = [dItem firstChildElement];
|
|
|
|
if ( dChild == nil )
|
|
|
|
{
|
|
|
|
// no elements, just text contents
|
|
|
|
dChild = [dItem firstChild];
|
|
|
|
[buf appendString: indent];
|
|
|
|
}
|
|
|
|
dItem = [self outputBlock: dChild to: buf inPara: NO];
|
|
|
|
//PENDING should check that dItem is what it should be...
|
|
|
|
}
|
|
|
|
[buf appendString: @"\n"];
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @";</dd>\n"];
|
|
|
|
}
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</dl>}\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return node; // Not a list
|
|
|
|
}
|
2002-11-11 10:18:49 +00:00
|
|
|
node = [node next];
|
2001-10-17 20:58:12 +00:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Outputs zero or more nodes at the same level as long as the nodes
|
|
|
|
* are valid %text elements. Returns nil or the first node not output.
|
|
|
|
*/
|
|
|
|
- (GSXMLNode*) outputText: (GSXMLNode*)node to: (NSMutableString*)buf
|
|
|
|
{
|
|
|
|
while (node != nil)
|
|
|
|
{
|
|
|
|
if ([node type] == XML_TEXT_NODE)
|
|
|
|
{
|
2003-05-12 19:23:02 +00:00
|
|
|
NSString *str = [node escapedContent];
|
2003-01-28 07:38:35 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
if (str == nil) str = @"";
|
2003-01-28 07:38:35 +00:00
|
|
|
[buf appendString: str];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-11-29 14:26:24 +00:00
|
|
|
else if ([node type] == XML_ENTITY_REF_NODE)
|
|
|
|
{
|
|
|
|
[buf appendString: @"&"];
|
2005-02-22 11:22:44 +00:00
|
|
|
[buf appendString: [node name]];
|
2001-11-29 14:26:24 +00:00
|
|
|
[buf appendString: @";"];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
else if ([node type] == XML_ELEMENT_NODE)
|
|
|
|
{
|
|
|
|
NSString *name = [node name];
|
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
if ([textNodes member: name] != nil)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-11-21 17:10:22 +00:00
|
|
|
[self outputNode: node to: buf];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return node; // Not a text node.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
node = [node next];
|
|
|
|
}
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf
|
|
|
|
{
|
2002-01-08 17:31:38 +00:00
|
|
|
NSArray *a;
|
2004-03-29 03:44:10 +00:00
|
|
|
NSMutableString *ivarBuf = ivarsAtEnd ?
|
|
|
|
[NSMutableString stringWithCapacity: 1024] : nil;
|
2005-05-08 20:14:19 +00:00
|
|
|
NSDictionary *prop = [node attributes];
|
2001-12-17 08:27:49 +00:00
|
|
|
|
2002-05-22 14:23:17 +00:00
|
|
|
node = [node firstChildElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
if (node != nil && [[node name] isEqual: @"declared"] == YES)
|
|
|
|
{
|
2002-01-02 06:50:30 +00:00
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-12-18 06:48:20 +00:00
|
|
|
|
|
|
|
if (node != nil && [[node name] isEqual: @"conform"] == YES)
|
2001-10-17 20:58:12 +00:00
|
|
|
{
|
2001-12-18 06:48:20 +00:00
|
|
|
[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>Conforms to:</b></dt>\n"];
|
|
|
|
while (node != nil && [[node name] isEqual: @"conform"] == YES)
|
|
|
|
{
|
2003-05-12 19:23:02 +00:00
|
|
|
NSString *text = [[node firstChild] escapedContent];
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
if (text == nil) text = @"";
|
2001-12-18 06:48:20 +00:00
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<dd>"];
|
|
|
|
[buf appendString: [self protocolRef: text]];
|
|
|
|
[buf appendString: @"</dd>\n"];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2001-12-18 06:48:20 +00:00
|
|
|
}
|
|
|
|
[self decIndent];
|
2001-10-17 20:58:12 +00:00
|
|
|
[buf appendString: indent];
|
2001-12-18 06:48:20 +00:00
|
|
|
[buf appendString: @"</dl>\n"];
|
|
|
|
[self decIndent];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"</blockquote>\n"];
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2001-12-18 06:48:20 +00:00
|
|
|
|
2005-05-08 20:14:19 +00:00
|
|
|
while (node != nil && [[node name] isEqual: @"desc"] == NO)
|
2002-01-02 06:50:30 +00:00
|
|
|
{
|
2005-05-08 20:14:19 +00:00
|
|
|
node = [node nextElement];
|
2002-01-02 06:50:30 +00:00
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
[self outputVersion: prop to: buf];
|
2002-01-02 06:50:30 +00:00
|
|
|
|
2002-01-02 07:09:43 +00:00
|
|
|
if (node != nil && [[node name] isEqual: @"desc"] == YES)
|
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2002-01-02 07:09:43 +00:00
|
|
|
}
|
|
|
|
|
2002-01-08 17:31:38 +00:00
|
|
|
if (node != nil && [[node name] isEqual: @"ivariable"] == YES)
|
|
|
|
{
|
2004-07-09 11:58:44 +00:00
|
|
|
NSMutableString *ibuf = buf;
|
|
|
|
|
2004-03-29 03:44:10 +00:00
|
|
|
/*
|
|
|
|
* If want instance variables at end, throw it all into an alternate
|
|
|
|
* buffer and just put a link here; later alt buf must be appended.
|
|
|
|
*/
|
2004-07-09 11:58:44 +00:00
|
|
|
if (ivarsAtEnd)
|
|
|
|
{
|
|
|
|
ibuf = ivarBuf;
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendFormat: @"<a href=\"#_%@_ivars\">Instance Variables</a>\n",
|
|
|
|
classname];
|
|
|
|
[buf appendString: indent];
|
|
|
|
[buf appendString: @"<br/><br/>\n"];
|
|
|
|
[ibuf appendFormat: @"<a name=\"_%@_ivars\"/>", classname];
|
|
|
|
}
|
2004-03-29 03:44:10 +00:00
|
|
|
[ibuf appendString: indent];
|
|
|
|
[ibuf appendString: @"<br/><hr width=\"50%\" align=\"left\" />\n"];
|
|
|
|
[ibuf appendString: indent];
|
|
|
|
[ibuf appendFormat: @"<h2>Instance Variables for %@ Class</h2>\n",
|
2004-07-09 11:58:44 +00:00
|
|
|
classname];
|
2002-01-08 17:31:38 +00:00
|
|
|
while (node != nil && [[node name] isEqual: @"ivariable"] == YES)
|
|
|
|
{
|
2004-03-29 03:44:10 +00:00
|
|
|
[self outputNode: node to: ibuf];
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2002-01-08 17:31:38 +00:00
|
|
|
}
|
2004-03-29 03:44:10 +00:00
|
|
|
[ibuf appendString: indent];
|
|
|
|
[ibuf appendString: @"<br/><hr width=\"50%\" align=\"left\" /><br/>\n"];
|
2002-01-08 17:31:38 +00:00
|
|
|
}
|
|
|
|
|
2001-12-17 08:27:49 +00:00
|
|
|
a = [localRefs methodsInUnit: unit];
|
|
|
|
if ([a count] > 0)
|
|
|
|
{
|
2002-01-06 10:24:43 +00:00
|
|
|
[self outputIndex: @"method"
|
|
|
|
scope: @"global"
|
|
|
|
title: @"Method summary"
|
2004-03-29 03:37:46 +00:00
|
|
|
style: nil
|
|
|
|
target: nil
|
2002-01-06 10:24:43 +00:00
|
|
|
to: buf];
|
2002-01-08 17:31:38 +00:00
|
|
|
[buf appendString: indent];
|
2001-12-18 06:48:20 +00:00
|
|
|
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
|
2002-02-02 17:04:50 +00:00
|
|
|
while (node != nil)
|
2002-01-08 17:31:38 +00:00
|
|
|
{
|
2002-02-12 12:33:57 +00:00
|
|
|
if ([[node name] isEqual: @"method"] == YES)
|
2002-02-02 17:04:50 +00:00
|
|
|
{
|
|
|
|
[self outputNode: node to: buf];
|
|
|
|
}
|
2002-04-25 13:06:59 +00:00
|
|
|
node = [node nextElement];
|
2002-01-08 17:31:38 +00:00
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
2004-03-29 03:44:10 +00:00
|
|
|
|
|
|
|
// if had ivars docs, insert them now
|
|
|
|
if (ivarsAtEnd)
|
|
|
|
{
|
|
|
|
[buf appendString: ivarBuf];
|
|
|
|
}
|
2001-10-17 20:58:12 +00:00
|
|
|
}
|
|
|
|
|
2005-05-08 20:14:19 +00:00
|
|
|
- (void) outputVersion: (NSDictionary*)prop to: (NSMutableString*)buf
|
|
|
|
{
|
|
|
|
NSString *ovadd = [prop objectForKey: @"ovadd"];
|
|
|
|
NSString *gvadd = [prop objectForKey: @"gvadd"];
|
2005-05-10 05:06:08 +00:00
|
|
|
NSString *ovdep = [prop objectForKey: @"ovdep"];
|
|
|
|
NSString *gvdep = [prop objectForKey: @"gvdep"];
|
2005-05-08 20:14:19 +00:00
|
|
|
NSString *ovrem = [prop objectForKey: @"ovrem"];
|
|
|
|
NSString *gvrem = [prop objectForKey: @"gvrem"];
|
2005-06-05 05:24:45 +00:00
|
|
|
const char *str;
|
|
|
|
int maj;
|
|
|
|
int min;
|
|
|
|
int sub;
|
2005-05-08 20:14:19 +00:00
|
|
|
|
|
|
|
if ([ovadd length] > 0)
|
|
|
|
{
|
2005-06-05 05:24:45 +00:00
|
|
|
int add;
|
|
|
|
int dep;
|
|
|
|
int rem;
|
|
|
|
|
|
|
|
str = [ovadd UTF8String];
|
|
|
|
if (str != 0 && sscanf(str, "%d.%d.%d", &maj, &min, &sub) == 3)
|
|
|
|
add = maj * 10000 + min * 100 + sub;
|
|
|
|
else
|
|
|
|
add = 0;
|
|
|
|
|
|
|
|
str = [ovdep UTF8String];
|
|
|
|
if (str != 0 && sscanf(str, "%d.%d.%d", &maj, &min, &sub) == 3)
|
|
|
|
dep = maj * 10000 + min * 100 + sub;
|
|
|
|
else
|
|
|
|
dep = 0;
|
|
|
|
|
|
|
|
str = [ovrem UTF8String];
|
|
|
|
if (str != 0 && sscanf(str, "%d.%d.%d", &maj, &min, &sub) == 3)
|
|
|
|
rem = maj * 10000 + min * 100 + sub;
|
|
|
|
else
|
|
|
|
rem = 0;
|
2005-05-08 20:14:19 +00:00
|
|
|
|
|
|
|
[buf appendString: indent];
|
2005-06-05 05:24:45 +00:00
|
|
|
[buf appendString: @"<b>Availability:</b> "];
|
|
|
|
if (add < GS_API_OSSPEC)
|
|
|
|
{
|
|
|
|
[buf appendString: @"Not in OpenStep/MacOS-X"];
|
|
|
|
}
|
|
|
|
else if (add < GS_API_OPENSTEP)
|
2005-05-08 20:14:19 +00:00
|
|
|
{
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: @"OpenStep"];
|
2005-05-08 20:14:19 +00:00
|
|
|
}
|
2005-06-05 05:24:45 +00:00
|
|
|
else if (add < GS_API_MACOSX)
|
2005-05-08 20:14:19 +00:00
|
|
|
{
|
2005-06-04 10:55:38 +00:00
|
|
|
[buf appendString: @"OPENSTEP "];
|
2005-05-08 20:14:19 +00:00
|
|
|
[buf appendString: ovadd];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-06-04 10:55:38 +00:00
|
|
|
[buf appendString: @"MacOS-X "];
|
2005-05-08 20:14:19 +00:00
|
|
|
[buf appendString: ovadd];
|
|
|
|
}
|
2005-05-10 05:06:08 +00:00
|
|
|
if (dep > add)
|
2005-05-08 20:14:19 +00:00
|
|
|
{
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: @" deprecated at "];
|
2005-06-05 05:24:45 +00:00
|
|
|
if (dep < GS_API_MACOSX)
|
2005-05-08 20:14:19 +00:00
|
|
|
{
|
2005-06-04 10:55:38 +00:00
|
|
|
[buf appendString: @"OPENSTEP "];
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: ovdep];
|
2005-05-08 20:14:19 +00:00
|
|
|
}
|
2005-05-10 05:06:08 +00:00
|
|
|
else
|
|
|
|
{
|
2005-06-04 10:55:38 +00:00
|
|
|
[buf appendString: @"MacOS-X "];
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: ovdep];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rem > add)
|
|
|
|
{
|
|
|
|
[buf appendString: @" removed at "];
|
2005-06-05 05:24:45 +00:00
|
|
|
if (rem < GS_API_MACOSX)
|
2005-05-08 20:14:19 +00:00
|
|
|
{
|
2005-06-04 10:55:38 +00:00
|
|
|
[buf appendString: @"OPENSTEP "];
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: ovrem];
|
2005-05-08 20:14:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-06-04 10:55:38 +00:00
|
|
|
[buf appendString: @"MacOS-X "];
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: ovrem];
|
2005-05-08 20:14:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ([gvadd length] > 0)
|
|
|
|
{
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: @", "];
|
|
|
|
[buf appendString: project];
|
|
|
|
[buf appendString: @" "];
|
2005-05-08 20:14:19 +00:00
|
|
|
[buf appendString: gvadd];
|
2005-05-10 05:06:08 +00:00
|
|
|
if ([gvdep length] > 0)
|
|
|
|
{
|
|
|
|
[buf appendString: @" deprecated at "];
|
|
|
|
[buf appendString: gvdep];
|
|
|
|
}
|
2005-05-08 20:14:19 +00:00
|
|
|
if ([gvrem length] > 0)
|
|
|
|
{
|
|
|
|
[buf appendString: @" removed at "];
|
|
|
|
[buf appendString: gvrem];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[buf appendString: @"<br />\n"];
|
|
|
|
}
|
|
|
|
else if ([gvadd length] > 0)
|
|
|
|
{
|
|
|
|
[buf appendString: indent];
|
2005-06-05 05:24:45 +00:00
|
|
|
[buf appendString: @"<b>Availability:</b> "];
|
2005-05-10 05:06:08 +00:00
|
|
|
[buf appendString: project];
|
|
|
|
[buf appendString: @" "];
|
2005-05-08 20:14:19 +00:00
|
|
|
[buf appendString: gvadd];
|
2005-05-10 05:06:08 +00:00
|
|
|
if ([gvdep length] > 0)
|
|
|
|
{
|
|
|
|
[buf appendString: @" deprecated at "];
|
|
|
|
[buf appendString: gvdep];
|
|
|
|
}
|
|
|
|
[buf appendString: @"<br />\n"];
|
2005-05-08 20:14:19 +00:00
|
|
|
if ([gvrem length] > 0)
|
|
|
|
{
|
|
|
|
[buf appendString: @" removed at "];
|
|
|
|
[buf appendString: gvrem];
|
|
|
|
}
|
|
|
|
[buf appendString: @"<br />\n"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
/**
|
|
|
|
* Try to make a link to the documentation for the supplied protocol.
|
|
|
|
*/
|
|
|
|
- (NSString*) protocolRef: (NSString*)t
|
|
|
|
{
|
|
|
|
NSString *n;
|
|
|
|
NSString *s;
|
|
|
|
|
|
|
|
t = [t stringByTrimmingSpaces];
|
|
|
|
n = [NSString stringWithFormat: @"(%@)", t];
|
2001-12-15 07:54:10 +00:00
|
|
|
s = [self makeLink: n ofType: @"protocol" isRef: YES];
|
|
|
|
if (s != nil)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2001-12-15 09:36:43 +00:00
|
|
|
s = [s stringByAppendingString: t];
|
2001-12-15 09:34:34 +00:00
|
|
|
t = [s stringByAppendingString: @"</a>"];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
- (void) setGlobalRefs: (AGSIndex*)r
|
|
|
|
{
|
|
|
|
ASSIGN(globalRefs, r);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setLocalRefs: (AGSIndex*)r
|
|
|
|
{
|
|
|
|
ASSIGN(localRefs, r);
|
|
|
|
}
|
|
|
|
|
2001-12-18 09:31:32 +00:00
|
|
|
- (void) setProjectRefs: (AGSIndex*)r
|
|
|
|
{
|
|
|
|
ASSIGN(projectRefs, r);
|
|
|
|
}
|
|
|
|
|
2004-03-29 03:44:10 +00:00
|
|
|
- (void) setInstanceVariablesAtEnd: (BOOL)val
|
|
|
|
{
|
|
|
|
ivarsAtEnd = val;
|
|
|
|
}
|
|
|
|
|
2001-11-21 17:10:22 +00:00
|
|
|
/**
|
|
|
|
* Assuming that the supplied string contains type information (as used
|
|
|
|
* in a method declaration or type cast), we make an attempt at extracting
|
|
|
|
* the basic type, and seeing if we can find a documented declaration for
|
|
|
|
* it. If we can, we return a modified version of the string containing
|
|
|
|
* a link to the appropriate documentation. Otherwise, we just return the
|
|
|
|
* plain type string. In all cases, we strip leading and trailing white space.
|
|
|
|
*/
|
|
|
|
- (NSString*) typeRef: (NSString*)t
|
|
|
|
{
|
2002-10-13 05:51:19 +00:00
|
|
|
NSString *str = [t stringByTrimmingSpaces];
|
2001-11-21 17:10:22 +00:00
|
|
|
NSString *s;
|
2002-10-13 05:51:19 +00:00
|
|
|
unsigned end = [str length];
|
2001-11-21 17:10:22 +00:00
|
|
|
unsigned start;
|
2002-10-13 05:51:19 +00:00
|
|
|
NSMutableString *ms = nil;
|
|
|
|
NSRange er;
|
|
|
|
NSRange sr;
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2003-01-03 15:21:15 +00:00
|
|
|
if (end == 0)
|
|
|
|
{
|
|
|
|
return nil;
|
|
|
|
}
|
2002-10-13 05:51:19 +00:00
|
|
|
t = str;
|
2001-11-21 17:10:22 +00:00
|
|
|
while (end > 0)
|
|
|
|
{
|
|
|
|
unichar c = [t characterAtIndex: end-1];
|
|
|
|
|
|
|
|
if (c != '*' && !isspace(c))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
end--;
|
|
|
|
}
|
|
|
|
start = end;
|
|
|
|
while (start > 0)
|
|
|
|
{
|
|
|
|
unichar c = [t characterAtIndex: start-1];
|
|
|
|
|
|
|
|
if (c != '_' && !isalnum(c))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
start--;
|
|
|
|
}
|
2002-10-13 05:51:19 +00:00
|
|
|
t = [str substringWithRange: NSMakeRange(start, end - start)];
|
2001-11-21 17:10:22 +00:00
|
|
|
|
2001-12-15 07:54:10 +00:00
|
|
|
s = [self makeLink: t ofType: @"type" isRef: YES];
|
|
|
|
if (s == nil)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2001-12-15 07:54:10 +00:00
|
|
|
s = [self makeLink: t ofType: @"class" isRef: YES];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
|
2002-10-13 05:51:19 +00:00
|
|
|
s = [s stringByAppendingFormat: @"%@</a>", t];
|
|
|
|
if (s != nil && [str length] == [t length])
|
|
|
|
{
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Look for protocol spec.
|
|
|
|
*/
|
|
|
|
sr = [str rangeOfString: @"<"];
|
|
|
|
if (sr.length == 0)
|
|
|
|
{
|
|
|
|
sr = [str rangeOfString: @"<"];
|
|
|
|
}
|
|
|
|
if (sr.length == 0)
|
|
|
|
{
|
|
|
|
sr = [str rangeOfString: @"<"];
|
|
|
|
}
|
|
|
|
er = [str rangeOfString: @">"];
|
|
|
|
if (er.length == 0)
|
|
|
|
{
|
|
|
|
er = [str rangeOfString: @">"];
|
|
|
|
}
|
|
|
|
if (er.length == 0)
|
|
|
|
{
|
|
|
|
er = [str rangeOfString: @">"];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Substitute in protocol references.
|
|
|
|
*/
|
|
|
|
if (sr.length > 0 && er.length > 0 && er.location > sr.location)
|
|
|
|
{
|
|
|
|
NSString *pString;
|
|
|
|
NSRange r;
|
|
|
|
NSArray *protocols;
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
r = NSMakeRange(NSMaxRange(sr), er.location - NSMaxRange(sr));
|
|
|
|
pString = [str substringWithRange: r];
|
|
|
|
protocols = [pString componentsSeparatedByString: @","];
|
|
|
|
ms = [str mutableCopy];
|
|
|
|
pString = @"";
|
|
|
|
for (i = 0; i < [protocols count]; i++)
|
|
|
|
{
|
|
|
|
NSString *p = [protocols objectAtIndex: i];
|
|
|
|
NSString *l;
|
|
|
|
|
|
|
|
l = [self makeLink: [NSString stringWithFormat: @"(%@)", p]
|
|
|
|
ofType: @"protocol"
|
|
|
|
isRef: YES];
|
|
|
|
if (l != nil)
|
|
|
|
{
|
|
|
|
p = [l stringByAppendingFormat: @"%@</a>", p];
|
|
|
|
}
|
|
|
|
if (i > 0)
|
|
|
|
{
|
|
|
|
pString = [pString stringByAppendingString: @","];
|
|
|
|
}
|
|
|
|
pString = [pString stringByAppendingString: p];
|
|
|
|
}
|
|
|
|
[ms replaceCharactersInRange: r withString: pString];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Substitute in basic type reference.
|
|
|
|
*/
|
2001-11-21 17:10:22 +00:00
|
|
|
if (s != nil)
|
|
|
|
{
|
2002-10-13 05:51:19 +00:00
|
|
|
if (ms == nil)
|
2001-11-21 17:10:22 +00:00
|
|
|
{
|
2002-10-13 05:51:19 +00:00
|
|
|
ms = [str mutableCopy];
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2002-10-13 05:51:19 +00:00
|
|
|
[ms replaceCharactersInRange: NSMakeRange(start, end - start)
|
|
|
|
withString: s];
|
|
|
|
}
|
|
|
|
if (ms != nil)
|
|
|
|
{
|
|
|
|
str = AUTORELEASE(ms);
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2002-10-13 05:51:19 +00:00
|
|
|
return str;
|
2001-11-21 17:10:22 +00:00
|
|
|
}
|
2001-12-15 07:54:10 +00:00
|
|
|
|
2001-10-17 20:58:12 +00:00
|
|
|
@end
|
|
|
|
|