]> granicus.if.org Git - graphviz/commitdiff
remove WITH_CGRAPH conditionals from MacOS sources
authorJohn Ellson <ellson@research.att.com>
Mon, 21 Oct 2013 14:18:54 +0000 (10:18 -0400)
committerJohn Ellson <ellson@research.att.com>
Mon, 21 Oct 2013 14:18:54 +0000 (10:18 -0400)
macosx/GVGraph.m
macosx/GVGraphDefaultAttributes.h
macosx/GVGraphDefaultAttributes.m

index 7ec33a7c296e5a2b8321961e61c1bedbbbd0b392..eb24db4d54a40118580cffa45a834232bbe9a861 100644 (file)
@@ -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;
index 95e1851ee2ccd3ea0741a35e1377ef16e2d273a4..0a1a1147f28ef94527bcd019b433f5545bbda5d8 100644 (file)
 @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;
index dea31e06ea1ba2f059356e86f7da85cb69b8d5f9..8d5286e66eaabb9e24c2e3d064f04ded17b08bf1 100644 (file)
 
 @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]) {
        }
        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]) {
        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