Minor parsing fixes for autogsdoc and fix for NSHosting

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12078 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-01-10 16:33:11 +00:00
parent 55a6888584
commit 237c04eca6
4 changed files with 111 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2002-01-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDistributedNotificationCentre.m: Use NSHost user default
to determine which server to connect to.
* Tools/AGSParser.m: Minor parsing fixes ... correct GS_EXPORT
Wed Jan 9 11:55:54 2002 Nicola Pero <n.pero@mi.flashnet.it>
* configure.in: Call AC_CONFIG_AUX_DIR with

View file

@ -37,6 +37,8 @@
#include <Foundation/NSRunLoop.h>
#include <Foundation/NSTask.h>
#include <Foundation/NSDistributedNotificationCenter.h>
#include <Foundation/NSUserDefaults.h>
#include <Foundation/NSHost.h>
#include "../Tools/gdnc.h"
@ -317,11 +319,34 @@ static NSDistributedNotificationCenter *defCenter = nil;
{
if (_remote == nil)
{
NSString *host;
/*
* Connect to the NSDistributedNotificationCenter for this host.
*/
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
if (host == nil)
{
host = @"";
}
else
{
NSHost *h;
/*
* If we have a host specified, but it is the current host,
* we do not need to ask for a host by name (nameserver lookup
* can be faster) and the empty host name can be used to
* indicate that we may start a gdnc server locally.
*/
h = [NSHost hostWithName: host];
if ([h isEqual: [NSHost currentHost]] == YES)
{
host = @"";
}
}
_remote = RETAIN([NSConnection rootProxyForConnectionWithRegisteredName:
GDNC_SERVICE host: @""]);
GDNC_SERVICE host: host]);
if (_remote != nil)
{
@ -340,7 +365,7 @@ static NSDistributedNotificationCenter *defCenter = nil;
object: c];
[_remote registerClient: (id<GDNCClient>)self];
}
else
else if ([host isEqual: @""] == YES)
{
static BOOL recursion = NO;
@ -373,6 +398,11 @@ NSLog(@"Connection to GDNC server established.\n");
MAKE_GDNC_ERR];
}
}
else
{
[NSException raise: NSInternalInconsistencyException
format: @"unable to contact GDNC server on %@", host];
}
}
}

View file

@ -89,6 +89,7 @@
- (void) setGenerateStandards: (BOOL)flag;
- (void) setStandards: (NSMutableDictionary*)dict;
- (void) setupBuffer;
- (unsigned) skipArray;
- (unsigned) skipBlock;
- (unsigned) skipComment;
- (unsigned) skipLiteral;

View file

@ -126,7 +126,7 @@
{
while ([self skipWhiteSpace] < length)
{
while (buffer[pos] == '*')
while (pos < length && buffer[pos] == '*')
{
[a addObject: @"*"];
pos++;
@ -206,7 +206,15 @@
a2 = [NSMutableArray array];
while ((s = [self parseIdentifier]) != nil)
{
if ([s isEqualToString: @"GS_EXTERN"] == YES)
if ([s isEqualToString: @"static"] == YES)
{
/*
* We don't want to document static declarations.
*/
[self skipStatementLine];
goto fail;
}
if ([s isEqualToString: @"GS_EXPORT"] == YES)
{
s = @"extern";
}
@ -279,14 +287,18 @@
if ([self skipWhiteSpace] < length)
{
if (buffer[pos] == ';')
if (buffer[pos] == '[')
{
[self skipStatement];
}
else if (buffer[pos] == '[')
{
[self log: @"ignoring array variable ... not supported yet"];
[self skipStatement];
while (buffer[pos] == '[')
{
unsigned old = pos;
if ([self skipArray] == old)
{
break;
}
[a1 addObject: @"[]"];
}
}
else if (buffer[pos] == '(')
{
@ -296,6 +308,14 @@
RELEASE(arp);
return nil;
}
}
if ([self skipWhiteSpace] < length)
{
if (buffer[pos] == ';')
{
[self skipStatement];
}
else if (buffer[pos] == ',')
{
[self log: @"ignoring multiple comma separated declarations"];
@ -305,6 +325,10 @@
{
[self skipStatement];
}
else if (buffer[pos] == '{')
{
[self skipBlock];
}
else
{
[self log: @"unexpected char (%c) parsing declaration", buffer[pos]];
@ -440,8 +464,10 @@ fail:
default:
/*
* Must be some sort of statement ... skip and ignore comments.
* Must be some sort of declaration ...
*/
// pos--;
// [self parseDeclIsSource: isSource];
[self skipStatementLine];
break;
}
@ -1651,6 +1677,42 @@ fail:
AUTORELEASE(data);
}
/**
* Skip until we encounter an ']' marking the end of an array.
* Expect the current character position to be pointing to the
* '[' at the start of an array.
*/
- (unsigned) skipArray
{
pos++;
while ([self skipWhiteSpace] < length)
{
unichar c = buffer[pos++];
switch (c)
{
case '#': // preprocessor directive.
[self skipPreprocessor];
break;
case '\'':
case '"':
pos--;
[self skipLiteral];
break;
case '[':
pos--;
[self skipArray];
break;
case ']':
return pos;
}
}
return pos;
}
/**
* Skip until we encounter an '}' marking the end of a block.
* Expect the current character position to be pointing to the