mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Tweak automatic markup .. recognize C/ObjC types
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21978 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f9dd4ffccc
commit
a7f29c00b9
3 changed files with 95 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-11-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/win32/NSMessagePortWin32.m: more changes
|
||||
* Source/win32/NSMessagePortNameServerWin32.m: ditto
|
||||
* Source/Tools/AGSOutput.m: search for C/ObjC types in text, and
|
||||
render them as <strong> automatically as suggested by Fabien Vallon.
|
||||
|
||||
2005-11-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/win32/NSMessagePortWin32.m: Lots of work towards implementing
|
||||
|
|
|
@ -140,8 +140,8 @@ typedef enum {
|
|||
* Callback message sent to object when the event it it waiting
|
||||
* for occurs. The 'data' and 'type' values are those passed in the
|
||||
* original -addEvent:type:watcher:forMode: method.<br />
|
||||
* The 'extra' value may be additional data returned depending
|
||||
* on the type of event. In the case of ET_WINMSG 'extra' is a pointer
|
||||
* The 'extra' value may be additional data returned depending on the type
|
||||
* of event. In the case of <code>ET_WINMSG</code> 'extra' is a pointer
|
||||
* to a windows <code>MSG</code> structure containing the received event.
|
||||
*/
|
||||
- (void) receivedEvent: (void*)data
|
||||
|
|
|
@ -1566,6 +1566,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
for (l = 0; l < [a count]; l++)
|
||||
{
|
||||
static NSArray *constants = nil;
|
||||
static NSArray *types = nil;
|
||||
unsigned count;
|
||||
NSString *tmp = [a objectAtIndex: l];
|
||||
unsigned pos;
|
||||
|
@ -1577,6 +1578,25 @@ static BOOL snuggleStart(NSString *t)
|
|||
@"YES", @"NO", @"nil", nil];
|
||||
}
|
||||
|
||||
if (types == nil)
|
||||
{
|
||||
types = [[NSArray alloc] initWithObjects:
|
||||
@"Class",
|
||||
@"SEL",
|
||||
@"char",
|
||||
@"double",
|
||||
@"float",
|
||||
@"id",
|
||||
@"int",
|
||||
@"long",
|
||||
@"short",
|
||||
@"signed",
|
||||
@"unichar",
|
||||
@"unsigned",
|
||||
@"void",
|
||||
nil];
|
||||
}
|
||||
|
||||
if (l == 0 || [[a objectAtIndex: l-1] isEqual: @"<code>"] == NO)
|
||||
{
|
||||
/*
|
||||
|
@ -1643,6 +1663,72 @@ static BOOL snuggleStart(NSString *t)
|
|||
}
|
||||
}
|
||||
|
||||
if (l == 0 || [[a objectAtIndex: l-1] isEqual: @"<strong>"] == NO)
|
||||
{
|
||||
/*
|
||||
* Ensure that well known types are rendered as 'strong'
|
||||
*/
|
||||
count = [types count];
|
||||
for (pos = 0; pos < count; pos++)
|
||||
{
|
||||
NSString *t = [types objectAtIndex: pos];
|
||||
|
||||
r = [tmp rangeOfString: t];
|
||||
|
||||
if (r.length > 0)
|
||||
{
|
||||
NSString *start;
|
||||
NSString *end;
|
||||
|
||||
if (r.location > 0)
|
||||
{
|
||||
start = [tmp substringToIndex: r.location];
|
||||
}
|
||||
else
|
||||
{
|
||||
start = nil;
|
||||
}
|
||||
if (NSMaxRange(r) < [tmp length])
|
||||
{
|
||||
end = [tmp substringFromIndex: NSMaxRange(r)];
|
||||
}
|
||||
else
|
||||
{
|
||||
end = nil;
|
||||
}
|
||||
if ((start == nil || snuggleStart(start) == YES)
|
||||
&& (end == nil || snuggleEnd(end) == YES))
|
||||
{
|
||||
NSString *sub;
|
||||
|
||||
if (start != nil || end != nil)
|
||||
{
|
||||
sub = [tmp substringWithRange: r];
|
||||
}
|
||||
else
|
||||
{
|
||||
sub = nil;
|
||||
}
|
||||
if (start != nil)
|
||||
{
|
||||
[a insertObject: start atIndex: l++];
|
||||
}
|
||||
[a insertObject: @"<strong>" atIndex: l++];
|
||||
if (sub != nil)
|
||||
{
|
||||
[a replaceObjectAtIndex: l withObject: sub];
|
||||
}
|
||||
l++;
|
||||
[a insertObject: @"</strong>" atIndex: l];
|
||||
if (end != nil)
|
||||
{
|
||||
[a insertObject: end atIndex: ++l];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure that method arguments are rendered as 'var'
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue