mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 09:31:07 +00:00
Cross reference protocols
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14746 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f856d3ec00
commit
6fbe8ca530
3 changed files with 90 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-10-13 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Tools/AGSHtml.m: Create automatic references to protocols in
|
||||||
|
type specifications of the form (id<protocol1,protocol2,...>)
|
||||||
|
|
||||||
2002-10-12 Richard Frith-Macdonald <rfm@gnu.org>
|
2002-10-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSProcessInfo.m: Make safe to reinitialise with args.
|
* Source/NSProcessInfo.m: Make safe to reinitialise with args.
|
||||||
|
|
|
@ -2158,12 +2158,15 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
|
||||||
*/
|
*/
|
||||||
- (NSString*) typeRef: (NSString*)t
|
- (NSString*) typeRef: (NSString*)t
|
||||||
{
|
{
|
||||||
NSString *orig = [t stringByTrimmingSpaces];
|
NSString *str = [t stringByTrimmingSpaces];
|
||||||
NSString *s;
|
NSString *s;
|
||||||
unsigned end = [orig length];
|
unsigned end = [str length];
|
||||||
unsigned start;
|
unsigned start;
|
||||||
|
NSMutableString *ms = nil;
|
||||||
|
NSRange er;
|
||||||
|
NSRange sr;
|
||||||
|
|
||||||
t = orig;
|
t = str;
|
||||||
while (end > 0)
|
while (end > 0)
|
||||||
{
|
{
|
||||||
unichar c = [t characterAtIndex: end-1];
|
unichar c = [t characterAtIndex: end-1];
|
||||||
|
@ -2185,7 +2188,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
|
||||||
}
|
}
|
||||||
start--;
|
start--;
|
||||||
}
|
}
|
||||||
t = [orig substringWithRange: NSMakeRange(start, end - start)];
|
t = [str substringWithRange: NSMakeRange(start, end - start)];
|
||||||
|
|
||||||
s = [self makeLink: t ofType: @"type" isRef: YES];
|
s = [self makeLink: t ofType: @"type" isRef: YES];
|
||||||
if (s == nil)
|
if (s == nil)
|
||||||
|
@ -2193,16 +2196,88 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
|
||||||
s = [self makeLink: t ofType: @"class" isRef: YES];
|
s = [self makeLink: t ofType: @"class" isRef: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s != nil)
|
|
||||||
{
|
|
||||||
s = [s stringByAppendingFormat: @"%@</a>", t];
|
s = [s stringByAppendingFormat: @"%@</a>", t];
|
||||||
if ([orig length] == [t length])
|
if (s != nil && [str length] == [t length])
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
return [orig stringByReplacingString: t withString: s];
|
|
||||||
|
/*
|
||||||
|
* Look for protocol spec.
|
||||||
|
*/
|
||||||
|
sr = [str rangeOfString: @"<"];
|
||||||
|
if (sr.length == 0)
|
||||||
|
{
|
||||||
|
sr = [str rangeOfString: @"<"];
|
||||||
}
|
}
|
||||||
return orig;
|
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.
|
||||||
|
*/
|
||||||
|
if (s != nil)
|
||||||
|
{
|
||||||
|
if (ms == nil)
|
||||||
|
{
|
||||||
|
ms = [str mutableCopy];
|
||||||
|
}
|
||||||
|
[ms replaceCharactersInRange: NSMakeRange(start, end - start)
|
||||||
|
withString: s];
|
||||||
|
}
|
||||||
|
if (ms != nil)
|
||||||
|
{
|
||||||
|
str = AUTORELEASE(ms);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1253,7 +1253,7 @@ main(int argc, char **argv, char **env)
|
||||||
file, gDate, hDate);
|
file, gDate, hDate);
|
||||||
}
|
}
|
||||||
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
|
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
|
||||||
[parser substituteEntities: YES];
|
[parser substituteEntities: NO];
|
||||||
[parser doValidityChecking: YES];
|
[parser doValidityChecking: YES];
|
||||||
[parser keepBlanks: NO];
|
[parser keepBlanks: NO];
|
||||||
if ([parser parse] == NO)
|
if ([parser parse] == NO)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue