From fe8b8fa3d493c137fe1d56a69d744c5fc6144ff2 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 26 Jun 1998 20:39:50 +0000 Subject: [PATCH] Updated distributed objects code to cope with triangular relationships - Process A vends object to B which vends object to C. There was a problem where B could give the object to C and release it in A before C could get a proxy to the original in A. Now we give it 30 seconds to establish the connection. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2824 72102866-910b-0410-8b05-ffd578937521 --- Headers/gnustep/base/DistributedObjects.h | 2 +- Headers/gnustep/base/NSConnection.h | 4 +- Headers/gnustep/base/NSDistantObject.h | 1 + Source/NSConnection.m | 216 +++- Source/NSDistantObject.m | 44 +- Source/TcpPort.m | 37 +- Source/proplist.tab.h | 8 +- Source/proplist.tab.m | 1354 ++++++++++++++------- Source/stringsfile.tab.h | 12 +- Source/stringsfile.tab.m | 1216 ++++++++++++------ 10 files changed, 2023 insertions(+), 871 deletions(-) diff --git a/Headers/gnustep/base/DistributedObjects.h b/Headers/gnustep/base/DistributedObjects.h index 65b5384b0..6cfd96351 100644 --- a/Headers/gnustep/base/DistributedObjects.h +++ b/Headers/gnustep/base/DistributedObjects.h @@ -61,7 +61,7 @@ enum { METHODTYPE_REQUEST, /* these two only needed with NeXT runtime */ METHODTYPE_REPLY, /* these two only needed with NeXT runtime */ PROXY_RELEASE, - PROXY_RETAIN + PROXY_RETAIN, }; diff --git a/Headers/gnustep/base/NSConnection.h b/Headers/gnustep/base/NSConnection.h index 13a5e140f..1875d92b3 100644 --- a/Headers/gnustep/base/NSConnection.h +++ b/Headers/gnustep/base/NSConnection.h @@ -210,11 +210,11 @@ extern NSString *NSConnectionProxyCount; /* Objects received */ /* Only subclassers and power-users need worry about these */ - (void) addProxy: (NSDistantObject*)aProxy; -- (BOOL) includesProxyForTarget: (unsigned)target; +- (id) includesProxyForTarget: (void*)target; - (void) removeProxy: (NSDistantObject*)aProxy; - (id ) localObjects; - (void) addLocalObject: anObj; -- (BOOL) includesLocalObject: anObj; +- (id) includesLocalObject: anObj; - (void) removeLocalObject: anObj; - (retval_t) forwardForProxy: (NSDistantObject*)object selector: (SEL)sel diff --git a/Headers/gnustep/base/NSDistantObject.h b/Headers/gnustep/base/NSDistantObject.h index 557601413..e690b4022 100644 --- a/Headers/gnustep/base/NSDistantObject.h +++ b/Headers/gnustep/base/NSDistantObject.h @@ -35,6 +35,7 @@ NSConnection* _connection; id _object; BOOL _isLocal; + BOOL _isVended; id _protocol; } diff --git a/Source/NSConnection.m b/Source/NSConnection.m index f2e245638..63d9ffe09 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -61,6 +61,22 @@ NSString *NSConnectionRequestsSent = @"NSConnectionRequestsSent"; NSString *NSConnectionLocalCount = @"NSConnectionLocalCount"; NSString *NSConnectionProxyCount = @"NSConnectionProxyCount"; +@interface NSDistantObject (NSConnection) +- (BOOL) isVended; +- (void) setVended; +@end + +@implementation NSDistantObject (NSConnection) +- (BOOL) isVended +{ + return _isVended; +} +- (void) setVended +{ + _isVended = YES; +} +@end + /* * ConnectionLocalCounter is a trivial class to keep track of how * many different connections a particular local object is vended @@ -104,6 +120,57 @@ NSString *NSConnectionProxyCount = @"NSConnectionProxyCount"; } @end + + +/* + * CachedLocalObject is a trivial class to keep track of how + * many different connections a particular local object is vended + * over. This is required so that we know when to remove an object + * from the global list when it is removed from the list of objects + * vended on a particular connection. + */ +@interface CachedLocalObject : NSObject +{ + id obj; + int time; +} +- (BOOL)countdown; +- (id) obj; ++ (CachedLocalObject*) itemWithObject: (id)o time: (int)t; +@end + +@implementation CachedLocalObject + +- (void) dealloc +{ + [obj release]; + [super dealloc]; +} + +- (BOOL) countdown +{ + if (time-- > 0) + return YES; + return NO; +} + +- (id) obj +{ + return obj; +} + ++ (CachedLocalObject*) itemWithObject: (id)o time: (int)t +{ + CachedLocalObject *item = [self alloc]; + + item = [super init]; + item->obj = [o retain]; + item->time = t; + return [item autorelease]; +} + +@end + @interface NSConnection (GettingCoderInterface) - (void) _handleRmc: rmc; @@ -116,6 +183,7 @@ NSString *NSConnectionProxyCount = @"NSConnectionProxyCount"; @interface NSConnection (Private) - _superInit; ++ setDebug: (int)val; @end #define proxiesHashGate refGate @@ -167,6 +235,7 @@ static id default_encoding_class; static id default_decoding_class; static int default_reply_timeout; static int default_request_timeout; +static NSTimer *timer; static int debug_connection = 0; @@ -186,6 +255,7 @@ static Lock *root_object_dictionary_gate; static NSMapTable *receive_port_2_ancestor; static NSMapTable *all_connections_local_targets = NULL; +static NSMapTable *all_connections_local_cached = NULL; /* rmc handling */ static NSMutableArray *received_request_rmc_queue; @@ -256,6 +326,9 @@ static int messages_received_count; all_connections_local_targets = NSCreateMapTable (NSNonOwnedPointerMapKeyCallBacks, NSObjectMapValueCallBacks, 0); + all_connections_local_cached = + NSCreateMapTable (NSNonOwnedPointerMapKeyCallBacks, + NSObjectMapValueCallBacks, 0); received_request_rmc_queue = [[NSMutableArray alloc] initWithCapacity:32]; received_request_rmc_queue_gate = [Lock new]; received_reply_rmc_queue = [[NSMutableArray alloc] initWithCapacity:32]; @@ -294,6 +367,21 @@ static int messages_received_count; return [self rootProxyAtPort: [p autorelease]]; } ++ (void) timeout: (NSTimer*)t +{ + NSArray *cached_locals; + int i; + + cached_locals = NSAllMapTableValues(all_connections_local_cached); + for (i = [cached_locals count]; i > 0; i--) { + CachedLocalObject *item = [cached_locals objectAtIndex: i-1]; + + if ([item countdown] == NO) { + NSMapRemove(all_connections_local_cached, [item obj]); + } + } +} + - (void) addRequestMode: (NSString*)mode { if (![request_modes containsObject:mode]) { @@ -306,7 +394,7 @@ static int messages_received_count; - (void) dealloc { if (debug_connection) - printf("deallocating 0x%x\n", (unsigned)self); + NSLog(@"deallocating 0x%x\n", (unsigned)self); [self invalidate]; /* Remove rootObject from root_object_dictionary @@ -424,10 +512,8 @@ static int messages_received_count; #endif if (debug_connection) - fprintf(stderr, "Invalidating connection 0x%x\n\t%s\n\t%s\n", - (unsigned)self, - [[receive_port description] cStringNoCopy], - [[send_port description] cStringNoCopy]); + NSLog(@"Invalidating connection 0x%x\n\t%@\n\t%@\n", (unsigned)self, + [receive_port description], [send_port description]); [NotificationDispatcher postNotificationName: NSConnectionDidDieNotification @@ -456,6 +542,9 @@ static int messages_received_count; [super retain]; [connection_array_gate lock]; [connection_array removeObject: self]; + [timer invalidate]; + timer = nil; + NSResetMapTable(all_connections_local_cached); [connection_array_gate unlock]; [super release]; } @@ -773,10 +862,8 @@ static int messages_received_count; newConn = [[NSConnection alloc] _superInit]; if (debug_connection) - fprintf(stderr, "Created new connection 0x%x\n\t%s\n\t%s\n", - (unsigned)newConn, - [[ip description] cStringNoCopy], - [[op description] cStringNoCopy]); + NSLog(@"Created new connection 0x%x\n\t%@\n\t%@\n", + (unsigned)newConn, [ip description], [op description]); newConn->is_valid = 1; newConn->receive_port = ip; [ip retain]; @@ -973,6 +1060,10 @@ static int messages_received_count; return self; } ++ setDebug: (int)val +{ + debug_connection = val; +} /* Creating new rmc's for encoding requests and replies */ @@ -1070,6 +1161,8 @@ static int messages_received_count; out_parameters = mframe_dissect_call (argframe, type, encoder); /* Send the rmc */ [op dismiss]; + if (debug_connection > 1) + NSLog(@"Sent message to 0x%x\n", (unsigned)self); req_out_count++; /* Sent a request. */ /* Get the reply rmc, and decode it. */ @@ -1223,6 +1316,8 @@ static int messages_received_count; at:&forward_type withName:NULL]; + if (debug_connection > 1) + NSLog(@"Handling message from 0x%x\n", (unsigned)self); req_in_count++; /* Handling an incoming request. */ mframe_do_call (forward_type, decoder, encoder); [op dismiss]; @@ -1268,12 +1363,12 @@ static int messages_received_count; NSParameterAssert([rmc connection] == self); [op encodeObject: rootObject withName: @"root object"]; [op dismiss]; + [rmc dismiss]; } - (void) _service_release: rmc forConnection: receiving_connection { unsigned int count; - unsigned int target; unsigned int pos; NSParameterAssert (is_valid); @@ -1288,11 +1383,23 @@ static int messages_received_count; withName: NULL]; for (pos = 0; pos < count; pos++) { + unsigned int target; + char vended; + NSDistantObject *prox; + [rmc decodeValueOfCType: @encode(typeof(target)) at: &target withName: NULL]; - if ([self includesLocalObject:(void*)target]) { + [rmc decodeValueOfCType: @encode(typeof(char)) + at: &vended + withName: NULL]; + + prox = [self includesLocalObject:(void*)target]; + if (prox != nil) { + if (vended) { + [prox setVended]; + } [self removeLocalObject: (id)target]; } } @@ -1315,8 +1422,8 @@ static int messages_received_count; at: &target withName: NULL]; - if ([self includesLocalObject:(void*)target] == NO) { - if ([[self class] includesLocalObject:(void*)target] == YES) { + if ([self includesLocalObject:(void*)target] == nil) { + if ([[self class] includesLocalObject:(void*)target] != nil) { [NSDistantObject proxyWithLocal: (id)target connection: self]; } } @@ -1411,6 +1518,7 @@ static int messages_received_count; at:&type withName:@"Requested Method Type for Target"]; [op dismiss]; + [rmc dismiss]; } @@ -1436,13 +1544,11 @@ static int messages_received_count; /* It won't take much time to handle this, so go ahead and service it, even if we are waiting for a reply. */ [conn _service_rootObject: rmc]; - [rmc dismiss]; break; case METHODTYPE_REQUEST: /* It won't take much time to handle this, so go ahead and service it, even if we are waiting for a reply. */ [conn _service_typeForSelector: rmc]; - [rmc dismiss]; break; case METHOD_REQUEST: /* We just got a new request; we need to decide whether to queue @@ -1538,7 +1644,7 @@ static int messages_received_count; && [a_rmc sequenceNumber] == sn) { if (debug_connection) - printf("Getting received reply from queue\n"); + NSLog(@"Getting received reply from queue\n"); [received_reply_rmc_queue removeObjectAtIndex: i]; the_rmc = a_rmc; break; @@ -1625,6 +1731,9 @@ static int messages_received_count; NSMapInsert(all_connections_local_targets, (void*)local, counter); [counter release]; } + if (debug_connection > 2) + NSLog(@"add local object (0x%x) to connection (0x%x) (ref %d)\n", + (unsigned)local, (unsigned) self, [counter value]); [proxiesHashGate unlock]; } @@ -1658,9 +1767,9 @@ static int messages_received_count; - (void) removeLocalObject: anObj { id counter; + unsigned val = 0; [proxiesHashGate lock]; - NSMapRemove (local_targets, (void*)anObj); /* * If all references to a local proxy have gone - remove the @@ -1669,15 +1778,40 @@ static int messages_received_count; counter = NSMapGet(all_connections_local_targets, (void*)anObj); if (counter) { [counter decrement]; - if ([counter value] == 0) { + if ((val = [counter value]) == 0) { + NSDistantObject *prox = NSMapGet(local_targets, (void*)anObj); + NSMapRemove(all_connections_local_targets, (void*)anObj); + /* + * If this proxy has been vended onwards by another process, we + * need to keep a reference to the local object around for a + * while in case that other process needs it. + */ + if ([prox isVended]) { + id item; + if (timer == nil) { + timer = [NSTimer scheduledTimerWithTimeInterval: 1.0 + target: [NSConnection class] + selector: @selector(_timeout:) + userInfo: nil + repeats: YES]; + } + item = [CachedLocalObject itemWithObject: anObj time: 30]; + NSMapInsert(all_connections_local_cached, anObj, item); + } } } + NSMapRemove (local_targets, (void*)anObj); + + if (debug_connection > 2) + NSLog(@"remove local object (0x%x) to connection (0x%x) (ref %d)\n", + (unsigned)anObj, (unsigned) self, val); + [proxiesHashGate unlock]; } -- (void) _release_targets: (unsigned int*)list count:(unsigned int)number +- (void) _release_targets: (NSDistantObject**)list count:(unsigned int)number { NS_DURING { @@ -1700,11 +1834,15 @@ static int messages_received_count; withName: NULL]; for (i = 0; i < number; i++) { - unsigned int target = list[i]; + unsigned target = (unsigned)[list[i] targetForProxy]; + char vended = [list[i] isVended]; [op encodeValueOfCType: @encode(typeof(target)) at: &target withName: NULL]; + [op encodeValueOfCType: @encode(char) + at: &vended + withName: NULL]; } [op dismiss]; @@ -1713,8 +1851,7 @@ static int messages_received_count; NS_HANDLER { if (debug_connection) - fprintf (stderr, "failed to release targets - %s\n", - [[localException name] cStringNoCopy]); + NSLog(@"failed to release targets - %@\n", [localException name]); } NS_ENDHANDLER } @@ -1730,10 +1867,11 @@ static int messages_received_count; if (receive_port && is_valid) { id op; unsigned int i; + int seq_num = [self _newMsgNumber]; op = [[self encodingClass] newForWritingWithConnection: self - sequenceNumber: [self _newMsgNumber] + sequenceNumber: seq_num identifier: PROXY_RETAIN]; [op encodeValueOfCType: @encode(typeof(target)) @@ -1746,8 +1884,7 @@ static int messages_received_count; NS_HANDLER { if (debug_connection) - fprintf (stderr, "failed to retain target - %s\n", - [[localException name] cStringNoCopy]); + NSLog(@"failed to retain target - %@\n", [localException name]); } NS_ENDHANDLER } @@ -1766,7 +1903,7 @@ static int messages_received_count; * Tell the remote application that we have removed our proxy and * it can release it's local object. */ - [self _release_targets:&target count:1]; + [self _release_targets:&aProxy count:1]; } - (id ) localObjects @@ -1818,24 +1955,24 @@ static int messages_received_count; [proxiesHashGate unlock]; } -- (BOOL) includesProxyForTarget: (unsigned)target +- (id) includesProxyForTarget: (void*)target { - BOOL ret; + NSDistantObject *ret; /* Don't assert (is_valid); */ [proxiesHashGate lock]; - ret = NSMapGet (remote_proxies, (void*)target) ? YES : NO; + ret = NSMapGet (remote_proxies, (void*)target); [proxiesHashGate unlock]; return ret; } -- (BOOL) includesLocalObject: anObj +- (id) includesLocalObject: anObj { - BOOL ret; + NSDistantObject* ret; /* Don't assert (is_valid); */ [proxiesHashGate lock]; - ret = NSMapGet (local_targets, (void*)anObj) ? YES : NO; + ret = NSMapGet(local_targets, (void*)anObj); [proxiesHashGate unlock]; return ret; } @@ -1846,14 +1983,17 @@ static int messages_received_count; for the Proxy to check the Proxy's connection only (using -includesLocalObject), because the proxy may have come from a triangle connection. */ -+ (BOOL) includesLocalObject: anObj ++ (id) includesLocalObject: anObj { - BOOL ret; + id ret; /* Don't assert (is_valid); */ NSParameterAssert (all_connections_local_targets); [proxiesHashGate lock]; - ret = NSMapGet (all_connections_local_targets, (void*)anObj) ? YES : NO; + ret = NSMapGet (all_connections_local_targets, (void*)anObj); + if (ret == nil) { + ret = NSMapGet (all_connections_local_cached, (void*)anObj); + } [proxiesHashGate unlock]; return ret; } @@ -2000,9 +2140,9 @@ static int messages_received_count; id port = [notification object]; if (debug_connection) - fprintf (stderr, "Received port invalidation notification for " - "connection 0x%x\n\t%s\n", (unsigned)self, - [[port description] cStringNoCopy]); + NSLog(@"Received port invalidation notification for " + @"connection 0x%x\n\t%@\n", (unsigned)self, + [port description]); /* We shouldn't be getting any port invalidation notifications, except from our own ports; this is how we registered ourselves diff --git a/Source/NSDistantObject.m b/Source/NSDistantObject.m index 2c377e93e..b89d0eeaa 100644 --- a/Source/NSDistantObject.m +++ b/Source/NSDistantObject.m @@ -28,6 +28,17 @@ static int debug_proxy; +@interface NSDistantObject (Debug) ++ (void) setDebug: (int)val; +@end + +@implementation NSDistantObject (Debug) ++ (void) setDebug: (int)val +{ + debug_proxy = val; +} +@end + @implementation NSDistantObject /* This is the proxy tag; it indicates where the local object is, @@ -127,8 +138,7 @@ format: @"NSDistantObject objects only encode with PortEncoder class"]; proxy_tag = PROXY_LOCAL_FOR_SENDER; if (debug_proxy) - fprintf(stderr, "Sending a proxy, will be remote 0x%x " - "connection 0x%x\n", + NSLog(@"Sending a proxy, will be remote 0x%x connection 0x%x\n", (unsigned)_object, (unsigned)_connection); @@ -147,8 +157,7 @@ format: @"NSDistantObject objects only encode with PortEncoder class"]; proxy_tag = PROXY_LOCAL_FOR_RECEIVER; if (debug_proxy) - fprintf(stderr, "Sending a proxy, will be local 0x%x " - "connection 0x%x\n", + NSLog(@"Sending a proxy, will be local 0x%x connection 0x%x\n", (unsigned)_object, (unsigned)_connection); @@ -174,8 +183,8 @@ format: @"NSDistantObject objects only encode with PortEncoder class"]; proxy_tag = PROXY_REMOTE_FOR_BOTH; if (debug_proxy) - fprintf(stderr, "Sending triangle-connection proxy 0x%x " - "proxy-conn 0x%x to-conn 0x%x\n", + NSLog(@"Sending triangle-connection proxy 0x%x " + @"proxy-conn 0x%x to-conn 0x%x\n", (unsigned)_object, (unsigned)_connection, (unsigned)encoder_connection); @@ -193,6 +202,10 @@ format: @"NSDistantObject objects only encode with PortEncoder class"]; [aRmc encodeBycopyObject: proxy_connection_out_port withName: @"Proxy outPort"]; + /* + * Make a note that we have passed this on to another process. + */ + _isVended = YES; } } @@ -244,7 +257,7 @@ format: @"NSDistantObject objects only encode with PortEncoder class"]; [_connection addLocalObject: self]; if (debug_proxy) - printf("Created new local=0x%x object 0x%x connection 0x%x\n", + NSLog(@"Created new local=0x%x object 0x%x connection 0x%x\n", (unsigned)self, (unsigned)_object, (unsigned)_connection); return self; @@ -280,7 +293,7 @@ format: @"NSDistantObject objects only encode with PortEncoder class"]; [_connection addProxy: self]; if (debug_proxy) - printf("Created new proxy=0x%x object 0x%x connection 0x%x\n", + NSLog(@"Created new proxy=0x%x object 0x%x connection 0x%x\n", (unsigned)self, (unsigned)_object, (unsigned)_connection); return self; @@ -370,8 +383,8 @@ format: @"NSDistantObject objects only decode with PortDecoder class"]; withName: NULL]; if (debug_proxy) - fprintf(stderr, "Receiving a proxy for local object 0x%x " - "connection 0x%x\n", target, (unsigned)decoder_connection); + NSLog(@"Receiving a proxy for local object 0x%x " + @"connection 0x%x\n", target, (unsigned)decoder_connection); if (![[decoder_connection class] includesLocalObject: (id)target]) [NSException raise: @"ProxyDecodedBadTarget" @@ -381,6 +394,9 @@ format: @"NSDistantObject objects only decode with PortDecoder class"]; id local = [NSDistantObject proxyWithLocal: (id)target connection: decoder_connection]; + if (debug_proxy) + NSLog(@"Local object is 0x%x (0x%x)\n", + (unsigned)local, (unsigned)[local targetForProxy]); return [[local targetForProxy] retain]; } @@ -396,7 +412,7 @@ format: @"NSDistantObject objects only decode with PortDecoder class"]; at: &target withName: NULL]; if (debug_proxy) - fprintf(stderr, "Receiving a proxy, was local 0x%x connection 0x%x\n", + NSLog(@"Receiving a proxy, was local 0x%x connection 0x%x\n", (unsigned)target, (unsigned)decoder_connection); return [[NSDistantObject proxyWithTarget: (id)target connection: decoder_connection] retain]; @@ -453,8 +469,8 @@ format: @"NSDistantObject objects only decode with PortDecoder class"]; ancestorConnection: decoder_connection]; if (debug_proxy) - fprintf(stderr, "Receiving a triangle-connection proxy 0x%x " - "connection 0x%x\n", target, (unsigned)proxy_connection); + NSLog(@"Receiving a triangle-connection proxy 0x%x " + @"connection 0x%x\n", target, (unsigned)proxy_connection); assert (proxy_connection != decoder_connection); assert ([proxy_connection isValid]); @@ -511,7 +527,7 @@ format: @"NSDistantObject objects only decode with PortDecoder class"]; - forward: (SEL)aSel :(arglist_t)frame { if (debug_proxy) - printf("NSDistantObject forwarding %s\n", sel_get_name(aSel)); + NSLog(@"NSDistantObject forwarding %s\n", sel_get_name(aSel)); if (![_connection isValid]) [NSException diff --git a/Source/TcpPort.m b/Source/TcpPort.m index c7cb050b4..012572b89 100644 --- a/Source/TcpPort.m +++ b/Source/TcpPort.m @@ -96,6 +96,17 @@ static int debug_tcp_port = 0; @end +@interface NSPort (Debug) ++ (void) setDebug: (int)val; +@end + +@implementation NSPort (Debug) ++ (void) setDebug: (int)val +{ + debug_tcp_port = val; +} +@end + /* Private interfaces */ @@ -997,10 +1008,8 @@ static NSMapTable* port_number_2_port; [self _addClientOutPort: op]; [op release]; if (debug_tcp_port) - fprintf (stderr, - "%s: Accepted connection from\n %s.\n", - object_get_class_name (self), - [[op description] cString]); + NSLog(@"%s: Accepted connection from\n %@.\n", + object_get_class_name (self), [op description]); [NotificationDispatcher postNotificationName: InPortAcceptedClientNotification object: self @@ -1074,6 +1083,9 @@ static NSMapTable* port_number_2_port; the packet is complete; return it. */ assert (packet && [packet class]); NSMapRemove(_client_sock_2_packet, (void*)fd_index); + if (debug_tcp_port > 1) + NSLog(@"%s: Read from socket %d\n", + object_get_class_name (self), fd_index); return packet; } } @@ -1161,10 +1173,8 @@ assert(type == ET_RPORT); assert (is_valid); if (debug_tcp_port) - fprintf (stderr, - "%s: Closed connection from\n %s\n", - object_get_class_name (self), - [[p description] cString]); + NSLog(@"%s: Closed connection from\n %@\n", + object_get_class_name (self), [p description]); packet = NSMapGet (_client_sock_2_packet, (void*)s); if (packet) @@ -1453,8 +1463,8 @@ static NSMapTable *out_port_bag = NULL; sockaddr, sizeof (p->_remote_in_port_address)); if (debug_tcp_port) - printf ("TcpOutPort setting remote address\n%s\n", - [[self description] cString]); + NSLog(@"TcpOutPort setting remote address\n%@\n", + [self description]); } } if (p) @@ -1803,7 +1813,7 @@ static NSMapTable *out_port_bag = NULL; count: sizeof (_remote_in_port_address.sin_addr.s_addr) withName: @"inet address"]; if (debug_tcp_port) - printf ("TcpOutPort encoded port %hd host %s\n", + NSLog(@"TcpOutPort encoded port %hd host %s\n", ntohs (_remote_in_port_address.sin_port), inet_ntoa (_remote_in_port_address.sin_addr)); } @@ -1820,7 +1830,7 @@ static NSMapTable *out_port_bag = NULL; count: sizeof (addr.sin_addr.s_addr) withName: NULL]; if (debug_tcp_port) - printf ("TcpOutPort decoded port %hd host %s\n", + NSLog(@"TcpOutPort decoded port %hd host %s\n", ntohs (addr.sin_port), inet_ntoa (addr.sin_addr)); return [TcpOutPort newForSendingToSockaddr: &addr @@ -1938,6 +1948,9 @@ static NSMapTable *out_port_bag = NULL; { int c; + if (debug_tcp_port > 1) + NSLog(@"%s: Write to socket %d\n", object_get_class_name (self), s); + /* Put the packet size in the first four bytes of the packet. */ assert (prefix == PREFIX_SIZE); *(PREFIX_LENGTH_TYPE*)[data mutableBytes] = htonl (eof_position); diff --git a/Source/proplist.tab.h b/Source/proplist.tab.h index ea74556d1..ff07ec35d 100644 --- a/Source/proplist.tab.h +++ b/Source/proplist.tab.h @@ -1,7 +1,9 @@ -#define NSSTRING 257 -#define NSDATA 258 -#define ERROR 259 typedef union { id obj; } YYSTYPE; +#define NSSTRING 258 +#define NSDATA 259 +#define ERROR 260 + + extern YYSTYPE pllval; diff --git a/Source/proplist.tab.m b/Source/proplist.tab.m index 5f929aaa8..3008d6541 100644 --- a/Source/proplist.tab.m +++ b/Source/proplist.tab.m @@ -1,471 +1,941 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; -#endif -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) + +/* A Bison parser, made from proplist.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + #define yyparse plparse #define yylex pllex #define yyerror plerror -#define yychar plchar -#define yyval plval #define yylval pllval +#define yychar plchar #define yydebug pldebug #define yynerrs plnerrs -#define yyerrflag plerrflag -#define yyss plss -#define yyssp plssp -#define yyvs plvs -#define yyvsp plvsp -#define yylhs pllhs -#define yylen pllen -#define yydefred pldefred -#define yydgoto pldgoto -#define yysindex plsindex -#define yyrindex plrindex -#define yygindex plgindex -#define yytable pltable -#define yycheck plcheck -#define yyname plname -#define yyrule plrule -#define YYPREFIX "pl" -#line 5 "proplist.y" +#define NSSTRING 258 +#define NSDATA 259 +#define ERROR 260 + +#line 4 "proplist.y" + #include #include #include #include #include #include + #line 16 "proplist.y" typedef union { id obj; } YYSTYPE; -#line 47 "y.tab.c" -#define NSSTRING 257 -#define NSDATA 258 -#define ERROR 259 -#define YYERRCODE 256 -short pllhs[] = { -1, - 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, - 3, 4, 4, 4, 5, 5, 6, -}; -short pllen[] = { 2, - 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, - 1, 3, 4, 2, 3, 1, 3, -}; -short pldefred[] = { 0, - 2, 4, 5, 3, 0, 0, 0, 1, 6, 7, - 9, 11, 0, 0, 14, 0, 16, 8, 0, 0, - 12, 0, 10, 17, 13, 15, -}; -short pldgoto[] = { 7, - 8, 9, 13, 10, 16, 17, -}; -short plsindex[] = { -40, - 0, 0, 0, 0, -37, -124, 0, 0, 0, 0, - 0, 0, -33, -52, 0, -53, 0, 0, -35, -35, - 0, -123, 0, 0, 0, 0, -}; -short plrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -}; -short plgindex[] = { 0, - 2, 0, 0, 0, 0, -12, -}; -#define YYTABLESIZE 223 -short pltable[] = { 5, - 15, 25, 5, 11, 5, 22, 12, 18, 20, 26, - 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 6, 0, 6, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 14, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 2, 3, 4, 2, - 3, 2, 3, -}; -short plcheck[] = { 40, - 125, 125, 40, 41, 40, 59, 5, 41, 61, 22, - 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 19, 20, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 125, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 123, -1, -1, 123, -1, 123, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 257, 257, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 256, 257, 258, 259, 257, - 258, 257, 258, -}; -#define YYFINAL 7 -#ifndef YYDEBUG -#define YYDEBUG 0 +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const #endif -#define YYMAXTOKEN 259 -#if YYDEBUG -char *plname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,"'='",0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -"NSSTRING","NSDATA","ERROR", +#endif + + + +#define YYFINAL 29 +#define YYFLAG -32768 +#define YYNTBASE 13 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 260 ? yytranslate[x] : 20) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, + 7, 2, 2, 8, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 11, 2, + 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 9, 2, 10, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5 }; -char *plrule[] = { -"$accept : root", -"root : object", -"root : error", -"root : ERROR", -"object : NSSTRING", -"object : NSDATA", -"object : array", -"object : dictionary", -"array : '(' objlist ')'", -"array : '(' ')'", -"objlist : objlist ',' object", -"objlist : object", -"dictionary : '{' keyval_list '}'", -"dictionary : '{' keyval_list ';' '}'", -"dictionary : '{' '}'", -"keyval_list : keyval_list ';' keyval_pair", -"keyval_list : keyval_pair", -"keyval_pair : NSSTRING '=' object", + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 6, 8, 10, 12, 14, 18, 23, + 26, 30, 32, 36, 41, 44, 48, 50 +}; + +static const short yyrhs[] = { 14, + 0, 1, 0, 5, 0, 3, 0, 4, 0, 15, + 0, 17, 0, 6, 16, 7, 0, 6, 16, 8, + 7, 0, 6, 7, 0, 16, 8, 14, 0, 14, + 0, 9, 18, 10, 0, 9, 18, 11, 10, 0, + 9, 10, 0, 18, 11, 19, 0, 19, 0, 3, + 12, 14, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 24, 29, 33, 39, 40, 41, 42, 45, 47, 49, + 53, 58, 66, 68, 70, 73, 79, 85 }; #endif -#ifdef YYSTACKSIZE + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","NSSTRING", +"NSDATA","ERROR","'('","')'","','","'{'","'}'","';'","'='","root","object","array", +"objlist","dictionary","keyval_list","keyval_pair", NULL +}; +#endif + +static const short yyr1[] = { 0, + 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, + 16, 16, 17, 17, 17, 18, 18, 19 +}; + +static const short yyr2[] = { 0, + 1, 1, 1, 1, 1, 1, 1, 3, 4, 2, + 3, 1, 3, 4, 2, 3, 1, 3 +}; + +static const short yydefact[] = { 0, + 2, 4, 5, 3, 0, 0, 1, 6, 7, 10, + 12, 0, 0, 15, 0, 17, 8, 0, 0, 13, + 0, 9, 11, 18, 14, 16, 0, 0, 0 +}; + +static const short yydefgoto[] = { 27, + 7, 8, 12, 9, 15, 16 +}; + +static const short yypact[] = { 0, +-32768,-32768,-32768,-32768, 15, 5,-32768,-32768,-32768,-32768, +-32768, 4, -10,-32768, 26,-32768,-32768, 22, 29,-32768, + 7,-32768,-32768,-32768,-32768,-32768, 16, 20,-32768 +}; + +static const short yypgoto[] = {-32768, + -5,-32768,-32768,-32768,-32768, -14 +}; + + +#define YYLAST 38 + + +static const short yytable[] = { 11, + 1, 19, 2, 3, 4, 5, 26, 13, 6, 13, + 17, 18, 23, 24, 14, 28, 25, 2, 3, 29, + 5, 10, 0, 6, 2, 3, 0, 5, 22, 0, + 6, 2, 3, 0, 5, 20, 21, 6 +}; + +static const short yycheck[] = { 5, + 1, 12, 3, 4, 5, 6, 21, 3, 9, 3, + 7, 8, 18, 19, 10, 0, 10, 3, 4, 0, + 6, 7, -1, 9, 3, 4, -1, 6, 7, -1, + 9, 3, 4, -1, 6, 10, 11, 9 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/lib/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 #undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + #endif #endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 91 "proplist.y" + +#line 196 "/usr/lib/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +#line 25 "proplist.y" +{ + /* want an object, followed by nothing else (<>) */ + return (int)yyvsp[0].obj; + ; + break;} +case 2: +#line 30 "proplist.y" +{ + return (int)nil; + ; + break;} +case 3: +#line 34 "proplist.y" +{ + return (int)nil; + ; + break;} +case 8: +#line 46 "proplist.y" +{yyval.obj = yyvsp[-1].obj;; + break;} +case 9: +#line 48 "proplist.y" +{yyval.obj = yyvsp[-2].obj;; + break;} +case 10: +#line 50 "proplist.y" +{yyval.obj = [NSArray array];; + break;} +case 11: +#line 54 "proplist.y" +{ + yyval.obj = yyvsp[-2].obj; + [yyval.obj addObject:yyvsp[0].obj]; + ; + break;} +case 12: +#line 59 "proplist.y" +{ + yyval.obj = [[[NSMutableArray alloc] +initWithCapacity:1] autorelease]; + [yyval.obj addObject:yyvsp[0].obj]; + ; + break;} +case 13: +#line 67 "proplist.y" +{yyval.obj = yyvsp[-1].obj;; + break;} +case 14: +#line 69 "proplist.y" +{yyval.obj = yyvsp[-2].obj;; + break;} +case 15: +#line 71 "proplist.y" +{yyval.obj = [NSDictionary dictionary];; + break;} +case 16: +#line 74 "proplist.y" +{ + yyval.obj = yyvsp[-2].obj; + [yyval.obj addEntriesFromDictionary:yyvsp[0].obj]; + [yyvsp[0].obj release]; + ; + break;} +case 17: +#line 80 "proplist.y" +{ + yyval.obj = yyvsp[0].obj; + [yyval.obj autorelease]; + ; + break;} +case 18: +#line 86 "proplist.y" +{ + yyval.obj = [[NSMutableDictionary alloc] +initWithCapacity:1]; + [yyval.obj setObject:yyvsp[0].obj forKey:yyvsp[-2].obj]; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 498 "/usr/lib/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 92 "proplist.y" + /* C code section */ int plerror(char *s) { return 0; } -#line 198 "y.tab.c" -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 1: -#line 25 "proplist.y" -{ - /* want an object, followed by nothing else (<>) */ - return (int)yyvsp[0].obj; - } -break; -case 2: -#line 30 "proplist.y" -{ - return (int)nil; - } -break; -case 3: -#line 34 "proplist.y" -{ - return (int)nil; - } -break; -case 8: -#line 46 "proplist.y" -{yyval.obj = yyvsp[-1].obj;} -break; -case 9: -#line 48 "proplist.y" -{yyval.obj = [NSArray array];} -break; -case 10: -#line 52 "proplist.y" -{ - yyval.obj = yyvsp[-2].obj; - [yyval.obj addObject:yyvsp[0].obj]; - } -break; -case 11: -#line 57 "proplist.y" -{ - yyval.obj = [[[NSMutableArray alloc] -initWithCapacity:1] autorelease]; - [yyval.obj addObject:yyvsp[0].obj]; - } -break; -case 12: -#line 65 "proplist.y" -{yyval.obj = yyvsp[-1].obj;} -break; -case 13: -#line 67 "proplist.y" -{yyval.obj = yyvsp[-2].obj;} -break; -case 14: -#line 69 "proplist.y" -{yyval.obj = [NSDictionary dictionary];} -break; -case 15: -#line 72 "proplist.y" -{ - yyval.obj = yyvsp[-2].obj; - [yyval.obj addEntriesFromDictionary:yyvsp[0].obj]; - [yyvsp[0].obj release]; - } -break; -case 16: -#line 78 "proplist.y" -{ - yyval.obj = yyvsp[0].obj; - [yyval.obj autorelease]; - } -break; -case 17: -#line 84 "proplist.y" -{ - yyval.obj = [[NSMutableDictionary alloc] -initWithCapacity:1]; - [yyval.obj setObject:yyvsp[0].obj forKey:yyvsp[-2].obj]; - } -break; -#line 416 "y.tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} diff --git a/Source/stringsfile.tab.h b/Source/stringsfile.tab.h index de1a85bd3..aacd6344c 100644 --- a/Source/stringsfile.tab.h +++ b/Source/stringsfile.tab.h @@ -1,9 +1,11 @@ -#define QUOTED 257 -#define LABEL 258 -#define SEMICOLEN 259 -#define EQUALS 260 -#define ERROR 261 typedef union { id obj; } YYSTYPE; +#define QUOTED 258 +#define LABEL 259 +#define SEMICOLEN 260 +#define EQUALS 261 +#define ERROR 262 + + extern YYSTYPE sflval; diff --git a/Source/stringsfile.tab.m b/Source/stringsfile.tab.m index 416df01f2..8baff7af1 100644 --- a/Source/stringsfile.tab.m +++ b/Source/stringsfile.tab.m @@ -1,139 +1,887 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; -#endif -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) + +/* A Bison parser, made from stringsfile.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + #define yyparse sfparse #define yylex sflex #define yyerror sferror -#define yychar sfchar -#define yyval sfval #define yylval sflval +#define yychar sfchar #define yydebug sfdebug #define yynerrs sfnerrs -#define yyerrflag sferrflag -#define yyss sfss -#define yyssp sfssp -#define yyvs sfvs -#define yyvsp sfvsp -#define yylhs sflhs -#define yylen sflen -#define yydefred sfdefred -#define yydgoto sfdgoto -#define yysindex sfsindex -#define yyrindex sfrindex -#define yygindex sfgindex -#define yytable sftable -#define yycheck sfcheck -#define yyname sfname -#define yyrule sfrule -#define YYPREFIX "sf" -#line 3 "stringsfile.y" +#define QUOTED 258 +#define LABEL 259 +#define SEMICOLEN 260 +#define EQUALS 261 +#define ERROR 262 + +#line 2 "stringsfile.y" + #include #include #include static NSMutableDictionary *properties; + #line 14 "stringsfile.y" typedef union { id obj; } YYSTYPE; -#line 46 "y.tab.c" -#define QUOTED 257 -#define LABEL 258 -#define SEMICOLEN 259 -#define EQUALS 260 -#define ERROR 261 -#define YYERRCODE 256 -short sflhs[] = { -1, - 0, 0, 0, 2, 2, 3, 3, 1, 1, -}; -short sflen[] = { 2, - 1, 1, 1, 1, 2, 4, 2, 1, 1, -}; -short sfdefred[] = { 0, - 2, 9, 8, 3, 0, 0, 0, 4, 7, 0, - 5, 0, 6, -}; -short sfdgoto[] = { 5, - 6, 7, 8, -}; -short sfsindex[] = { -256, - 0, 0, 0, 0, 0, -253, -254, 0, 0, -254, - 0, -251, 0, -}; -short sfrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, - 0, 0, 0, -}; -short sfgindex[] = { 0, - 1, 0, 3, -}; -#define YYTABLESIZE 11 -short sftable[] = { 1, - 2, 3, 2, 3, 4, 9, 10, 13, 1, 11, - 12, -}; -short sfcheck[] = { 256, - 257, 258, 257, 258, 261, 259, 260, 259, 0, 7, - 10, -}; -#define YYFINAL 5 -#ifndef YYDEBUG -#define YYDEBUG 0 +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const #endif -#define YYMAXTOKEN 261 -#if YYDEBUG -char *sfname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"QUOTED","LABEL","SEMICOLEN", -"EQUALS","ERROR", +#endif + + + +#define YYFINAL 15 +#define YYFLAG -32768 +#define YYNTBASE 8 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 12) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7 }; -char *sfrule[] = { -"$accept : file", -"file : asignments", -"file : error", -"file : ERROR", -"asignments : asignment", -"asignments : asignments asignment", -"asignment : value EQUALS value SEMICOLEN", -"asignment : value SEMICOLEN", -"value : LABEL", -"value : QUOTED", + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 6, 8, 11, 16, 19, 21 +}; + +static const short yyrhs[] = { 9, + 0, 1, 0, 7, 0, 10, 0, 9, 10, 0, + 11, 6, 11, 5, 0, 11, 5, 0, 4, 0, + 3, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 22, 26, 30, 36, 37, 40, 44, 50, 54 }; #endif -#ifdef YYSTACKSIZE + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","QUOTED", +"LABEL","SEMICOLEN","EQUALS","ERROR","file","asignments","asignment","value", NULL +}; +#endif + +static const short yyr1[] = { 0, + 8, 8, 8, 9, 9, 10, 10, 11, 11 +}; + +static const short yyr2[] = { 0, + 1, 1, 1, 1, 2, 4, 2, 1, 1 +}; + +static const short yydefact[] = { 0, + 2, 9, 8, 3, 1, 4, 0, 5, 7, 0, + 0, 6, 0, 0, 0 +}; + +static const short yydefgoto[] = { 13, + 5, 6, 7 +}; + +static const short yypact[] = { -1, +-32768,-32768,-32768,-32768, 1,-32768, 2,-32768,-32768, 1, + -4,-32768, 9, 10,-32768 +}; + +static const short yypgoto[] = {-32768, +-32768, 6, 3 +}; + + +#define YYLAST 13 + + +static const short yytable[] = { 1, + 12, 2, 3, 2, 3, 4, 9, 10, 14, 15, + 8, 0, 11 +}; + +static const short yycheck[] = { 1, + 5, 3, 4, 3, 4, 7, 5, 6, 0, 0, + 5, -1, 10 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/lib/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 #undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + #endif #endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 60 "stringsfile.y" + +#line 196 "/usr/lib/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +#line 23 "stringsfile.y" +{ + return 1; + ; + break;} +case 2: +#line 27 "stringsfile.y" +{ + return 0; + ; + break;} +case 3: +#line 31 "stringsfile.y" +{ + return 0; + ; + break;} +case 6: +#line 41 "stringsfile.y" +{ + [(NSMutableDictionary *)properties setObject: yyvsp[-1].obj forKey: (NSString *) yyvsp[-3].obj]; + ; + break;} +case 7: +#line 45 "stringsfile.y" +{ + [(NSMutableDictionary *)properties setObject: nil forKey: (NSString *) yyvsp[-1].obj]; + ; + break;} +case 8: +#line 51 "stringsfile.y" +{ + yyval.obj = yyvsp[0].obj; + ; + break;} +case 9: +#line 55 "stringsfile.y" +{ + yyval.obj = yyvsp[0].obj; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 498 "/usr/lib/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 59 "stringsfile.y" + int sferror(char *s) { @@ -146,243 +894,3 @@ sfSetDict(NSMutableDictionary *aDict) properties = aDict; } -#line 150 "y.tab.c" -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 1: -#line 23 "stringsfile.y" -{ - return 1; - } -break; -case 2: -#line 27 "stringsfile.y" -{ - return 0; - } -break; -case 3: -#line 31 "stringsfile.y" -{ - return 0; - } -break; -case 6: -#line 41 "stringsfile.y" -{ - [(NSMutableDictionary *)properties setObject: yyvsp[-1].obj forKey: (NSString *) yyvsp[-3].obj]; - } -break; -case 7: -#line 45 "stringsfile.y" -{ - [(NSMutableDictionary *)properties setObject: nil forKey: (NSString *) yyvsp[-1].obj]; - } -break; -case 8: -#line 51 "stringsfile.y" -{ - yyval.obj = yyvsp[0].obj; - } -break; -case 9: -#line 55 "stringsfile.y" -{ - yyval.obj = yyvsp[0].obj; - } -break; -#line 333 "y.tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -}