From c2dea7e3ab13dd44c4e291b790eb205882b159f9 Mon Sep 17 00:00:00 2001 From: John Ellson Date: Mon, 21 Oct 2013 10:18:54 -0400 Subject: [PATCH] remove WITH_CGRAPH conditionals from MacOS sources --- macosx/GVGraph.m | 14 ----- macosx/GVGraphDefaultAttributes.h | 8 --- macosx/GVGraphDefaultAttributes.m | 91 ------------------------------- 3 files changed, 113 deletions(-) diff --git a/macosx/GVGraph.m b/macosx/GVGraph.m index 7ec33a7c2..eb24db4d5 100644 --- a/macosx/GVGraph.m +++ b/macosx/GVGraph.m @@ -73,11 +73,7 @@ extern char *gvplugin_list(GVC_t * gvc, api_t api, const char *str); return nil; } -#ifdef WITH_CGRAPH _graph = agread(file,0); -#else - _graph = agread(file); -#endif if (!_graph) { if (outError) *outError = [NSError errorWithDomain:GVGraphvizErrorDomain code:GVFileParseError userInfo:nil]; @@ -88,11 +84,7 @@ extern char *gvplugin_list(GVC_t * gvc, api_t api, const char *str); parentDir = (char *)[[URL path] fileSystemRepresentation]; ptr = strrchr(parentDir,'/'); *ptr = 0; -#ifdef WITH_CGRAPH agattr(_graph,AGRAPH,"imagepath",parentDir); -#else - agraphattr(_graph,"imagepath",parentDir); -#endif } fclose(file); } @@ -119,15 +111,9 @@ extern char *gvplugin_list(GVC_t * gvc, api_t api, const char *str); _freeLastLayout = NO; _arguments = [[GVGraphArguments alloc] initWithGraph:self]; -#ifdef WITH_CGRAPH _graphAttributes = [[GVGraphDefaultAttributes alloc] initWithGraph:self prototype:AGRAPH]; _defaultNodeAttributes = [[GVGraphDefaultAttributes alloc] initWithGraph:self prototype:AGNODE]; _defaultEdgeAttributes = [[GVGraphDefaultAttributes alloc] initWithGraph:self prototype:AGEDGE]; -#else - _graphAttributes = [[GVGraphDefaultAttributes alloc] initWithGraph:self prototype:_graph]; - _defaultNodeAttributes = [[GVGraphDefaultAttributes alloc] initWithGraph:self prototype:agprotonode(_graph)]; - _defaultEdgeAttributes = [[GVGraphDefaultAttributes alloc] initWithGraph:self prototype:agprotoedge(_graph)]; -#endif } return self; diff --git a/macosx/GVGraphDefaultAttributes.h b/macosx/GVGraphDefaultAttributes.h index 95e1851ee..0a1a1147f 100644 --- a/macosx/GVGraphDefaultAttributes.h +++ b/macosx/GVGraphDefaultAttributes.h @@ -20,18 +20,10 @@ @interface GVGraphDefaultAttributes : NSMutableDictionary { GVGraph *_graph; -#ifdef WITH_CGRAPH int _kind; -#else - void *_proto; -#endif } -#ifdef WITH_CGRAPH - (id)initWithGraph:(GVGraph *)graph prototype:(int)kind; -#else -- (id)initWithGraph:(GVGraph *)graph prototype:(void *)proto; -#endif /* dictionary primitive methods */ - (NSUInteger)count; diff --git a/macosx/GVGraphDefaultAttributes.m b/macosx/GVGraphDefaultAttributes.m index dea31e06e..8d5286e66 100644 --- a/macosx/GVGraphDefaultAttributes.m +++ b/macosx/GVGraphDefaultAttributes.m @@ -16,20 +16,12 @@ @interface GVGraphDefaultAttributeKeyEnumerator : NSEnumerator { -#ifdef WITH_CGRAPH graph_t *_graph; int _kind; -#else - void *_proto; -#endif Agsym_t *_nextSymbol; } -#ifdef WITH_CGRAPH - (id)initWithGraphLoc:(graph_t *)graph prototype:(int)kind; -#else -- (id)initWithPrototypeLoc:(void *)proto; -#endif - (NSArray *)allObjects; - (id)nextObject; @@ -37,7 +29,6 @@ @implementation GVGraphDefaultAttributeKeyEnumerator -#ifdef WITH_CGRAPH - (id)initWithGraphLoc:(graph_t *)graph prototype:(int)kind; { if (self = [super init]) { @@ -69,44 +60,11 @@ } return nil; } -#else -- (id)initWithPrototypeLoc:(void *)proto -{ - if (self = [super init]) { - _proto = proto; - _nextSymbol = agfstattr(_proto); - } - return self; -} - -- (NSArray *)allObjects -{ - NSMutableArray* all = [NSMutableArray array]; - for (; _nextSymbol; _nextSymbol = agnxtattr(_proto, _nextSymbol)) { - char *attributeValue = _nextSymbol->value; - if (attributeValue && *attributeValue) - [all addObject:[NSString stringWithUTF8String:attributeValue]]; - } - - return all; -} - -- (id)nextObject -{ - for (; _nextSymbol; _nextSymbol = agnxtattr(_proto, _nextSymbol)) { - char *attributeValue = _nextSymbol->value; - if (attributeValue && *attributeValue) - return [NSString stringWithUTF8String:attributeValue]; - } - return nil; -} -#endif @end @implementation GVGraphDefaultAttributes -#ifdef WITH_CGRAPH - (id)initWithGraph:(GVGraph *)graph prototype:(int)kind { if (self = [super init]) { @@ -154,53 +112,4 @@ agattr(_graph->_graph, _kind, (char *)[aKey UTF8String], ""); [_graph noteChanged:YES]; } -#else -- (id)initWithGraph:(GVGraph *)graph prototype:(void *)proto -{ - if (self = [super init]) { - _graph = graph; /* not retained to avoid a retain cycle */ - _proto = proto; - } - return self; -} - -- (NSUInteger)count -{ - NSUInteger symbolCount = 0; - Agsym_t *nextSymbol; - for (nextSymbol = agfstattr(_proto); nextSymbol; nextSymbol = agnxtattr(_proto, nextSymbol)) - if (nextSymbol->value && *(nextSymbol->value)) - ++symbolCount; - return symbolCount; -} - -- (NSEnumerator *)keyEnumerator -{ - return [[[GVGraphDefaultAttributeKeyEnumerator alloc] initWithPrototypeLoc:_proto] autorelease]; -} - -- (id)objectForKey:(id)aKey -{ - id object = nil; - Agsym_t *attributeSymbol = agfindattr(_proto, (char*)[aKey UTF8String]); - if (attributeSymbol) { - char *attributeValue = attributeSymbol->value; - if (attributeValue && *attributeValue) - object = [NSString stringWithUTF8String:attributeValue]; - } - return object; -} - -- (void)setObject:(id)anObject forKey:(id)aKey -{ - agattr(_proto, (char *)[aKey UTF8String], (char *)[anObject UTF8String]); - [_graph noteChanged:YES]; -} - -- (void)removeObjectForKey:(id)aKey -{ - agattr(_proto, (char *)[aKey UTF8String], ""); - [_graph noteChanged:YES]; -} -#endif @end -- 2.40.0