@interface GVGraph : NSObject
{
+@public
graph_t *_graph;
+@protected
BOOL _freeLastLayout;
GVGraphArguments *_arguments;
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];
parentDir = (char *)[[URL path] fileSystemRepresentation];
ptr = strrchr(parentDir,'/');
*ptr = 0;
+#ifdef WITH_CGRAPH
agraphattr(_graph,"imagepath",parentDir);
+#else
+ agattr(_graph,AGRAPH,"imagepath",parentDir);
+#endif
}
fclose(file);
}
_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;
#import <Foundation/Foundation.h>
-#include "types.h"
-#include "graph.h"
+#include "gvc.h"
@class GVGraph;
@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;
@interface GVGraphDefaultAttributeKeyEnumerator : NSEnumerator
{
+#ifdef WITH_CGRAPH
+ graph_t *_graph;
+ int _kind;
+#else
void *_proto;
+#endif
Agsym_t *_nextSymbol;
}
+#ifdef WITH_CGRAPH
+- (id)initWithGraph:(graph_t *)graph prototype:(int)kind;
+#else
- (id)initWithPrototype:(void *)proto;
+#endif
- (NSArray *)allObjects;
- (id)nextObject;
@implementation GVGraphDefaultAttributeKeyEnumerator
+#ifdef WITH_CGRAPH
+- (id)initWithGraph:(graph_t *)graph prototype:(int)kind;
+{
+ if (self = [super init]) {
+ _kind = kind;
+ _graph = graph;
+ _nextSymbol = agnxtattr(_graph, _kind, NULL);
+ }
+ return self;
+}
+
+- (NSArray *)allObjects
+{
+ NSMutableArray* all = [NSMutableArray array];
+ for (; _nextSymbol; _nextSymbol = agnxtattr(_graph, _kind, _nextSymbol)) {
+ char *attributeValue = _nextSymbol->defval;
+ if (attributeValue && *attributeValue)
+ [all addObject:[NSString stringWithUTF8String:attributeValue]];
+ }
+
+ return all;
+}
+
+- (id)nextObject
+{
+ for (; _nextSymbol; _nextSymbol = agnxtattr(_graph, _kind, _nextSymbol)) {
+ char *attributeValue = _nextSymbol->defval;
+ if (attributeValue && *attributeValue)
+ return [NSString stringWithUTF8String:attributeValue];
+ }
+ return nil;
+}
+#else
- (id)initWithPrototype:(void *)proto
{
if (self = [super init]) {
}
return nil;
}
+#endif
@end
@implementation GVGraphDefaultAttributes
+#ifdef WITH_CGRAPH
+- (id)initWithGraph:(GVGraph *)graph prototype:(int)kind
+{
+ if (self = [super init]) {
+ _graph = graph;
+ _kind = kind;
+ }
+ return self;
+}
+
+- (NSUInteger)count
+{
+ NSUInteger symbolCount = 0;
+ Agsym_t *nextSymbol = NULL;
+ for (nextSymbol = agnxtattr(_graph->_graph,_kind, nextSymbol); nextSymbol; nextSymbol = agnxtattr(_graph->_graph, _kind, nextSymbol))
+ if (nextSymbol->defval && *(nextSymbol->defval))
+ ++symbolCount;
+ return symbolCount;
+}
+
+- (NSEnumerator *)keyEnumerator
+{
+ return [[[GVGraphDefaultAttributeKeyEnumerator alloc] initWithGraph:_graph->_graph prototype:_kind] autorelease];
+}
+
+- (id)objectForKey:(id)aKey
+{
+ id object = nil;
+ Agsym_t *attributeSymbol = agattr(_graph->_graph, _kind, (char*)[aKey UTF8String], 0);
+ if (attributeSymbol) {
+ char *attributeValue = attributeSymbol->defval;
+ if (attributeValue && *attributeValue)
+ object = [NSString stringWithUTF8String:attributeValue];
+ }
+ return object;
+}
+
+- (void)setObject:(id)anObject forKey:(id)aKey
+{
+ agattr(_graph->_graph, _kind, (char *)[aKey UTF8String], (char *)[anObject UTF8String]);
+ [_graph noteChanged:YES];
+}
+
+- (void)removeObjectForKey:(id)aKey
+{
+ agattr(_graph->_graph, _kind, (char *)[aKey UTF8String], "");
+ [_graph noteChanged:YES];
+}
+#else
- (id)initWithGraph:(GVGraph *)graph prototype:(void *)proto
{
if (self = [super init]) {
agattr(_proto, (char *)[aKey UTF8String], "");
[_graph noteChanged:YES];
}
+#endif
@end
{
active = YES;
name = DYLD_LIBRARY_PATH;
- value = "../lib/cdt/.libs:../lib/pathplan/.libs:../lib/graph/.libs:../lib/gvc/.libs";
+ value = "../lib/cdt/.libs:../lib/pathplan/.libs:../lib/cgraph/.libs:../lib/gvc/.libs";
},
);
executableSystemSymbolLevel = 0;
D8798BDD0D5D5BD700CCC6E3 /* GVAttributeSchema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVAttributeSchema.h; sourceTree = "<group>"; };
D8798BDE0D5D5BD700CCC6E3 /* GVAttributeSchema.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVAttributeSchema.m; sourceTree = "<group>"; };
D88584190D54866C00D35701 /* Graphviz.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Graphviz.icns; sourceTree = "<group>"; };
- D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/graph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
+ D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/cgraph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
D88585F90D56D3FB00D35701 /* libgvc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgvc.dylib; path = ../lib/gvc/.libs/libgvc.dylib; sourceTree = SOURCE_ROOT; };
D885863B0D56DC2C00D35701 /* GVWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVWindowController.h; sourceTree = "<group>"; };
D885863C0D56DC2C00D35701 /* GVWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVWindowController.m; sourceTree = "<group>"; };
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
VALID_ARCHS = "i386 x86_64";
WRAPPER_EXTENSION = app;
};
D8798BDD0D5D5BD700CCC6E3 /* GVAttributeSchema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVAttributeSchema.h; sourceTree = "<group>"; };
D8798BDE0D5D5BD700CCC6E3 /* GVAttributeSchema.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVAttributeSchema.m; sourceTree = "<group>"; };
D88584190D54866C00D35701 /* Graphviz.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Graphviz.icns; sourceTree = "<group>"; };
- D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/graph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
+ D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/cgraph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
D88585F90D56D3FB00D35701 /* libgvc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgvc.dylib; path = ../lib/gvc/.libs/libgvc.dylib; sourceTree = SOURCE_ROOT; };
D885863B0D56DC2C00D35701 /* GVWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVWindowController.h; sourceTree = "<group>"; };
D885863C0D56DC2C00D35701 /* GVWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVWindowController.m; sourceTree = "<group>"; };
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
VALID_ARCHS = x86_64;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
VALID_ARCHS = x86_64;
WRAPPER_EXTENSION = app;
};
D8798BDD0D5D5BD700CCC6E3 /* GVAttributeSchema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVAttributeSchema.h; sourceTree = "<group>"; };
D8798BDE0D5D5BD700CCC6E3 /* GVAttributeSchema.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVAttributeSchema.m; sourceTree = "<group>"; };
D88584190D54866C00D35701 /* Graphviz.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Graphviz.icns; sourceTree = "<group>"; };
- D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/graph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
+ D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/cgraph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
D88585F90D56D3FB00D35701 /* libgvc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgvc.dylib; path = ../lib/gvc/.libs/libgvc.dylib; sourceTree = SOURCE_ROOT; };
D885863B0D56DC2C00D35701 /* GVWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVWindowController.h; sourceTree = "<group>"; };
D885863C0D56DC2C00D35701 /* GVWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVWindowController.m; sourceTree = "<group>"; };
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
VALID_ARCHS = "i386 x86_64";
WRAPPER_EXTENSION = app;
};
D8798BDD0D5D5BD700CCC6E3 /* GVAttributeSchema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVAttributeSchema.h; sourceTree = "<group>"; };
D8798BDE0D5D5BD700CCC6E3 /* GVAttributeSchema.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVAttributeSchema.m; sourceTree = "<group>"; };
D88584190D54866C00D35701 /* Graphviz.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Graphviz.icns; sourceTree = "<group>"; };
- D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/graph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
+ D88585F70D56D3D700D35701 /* libgraph.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgraph.dylib; path = ../lib/cgraph/.libs/libgraph.dylib; sourceTree = SOURCE_ROOT; };
D88585F90D56D3FB00D35701 /* libgvc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgvc.dylib; path = ../lib/gvc/.libs/libgvc.dylib; sourceTree = SOURCE_ROOT; };
D885863B0D56DC2C00D35701 /* GVWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVWindowController.h; sourceTree = "<group>"; };
D885863C0D56DC2C00D35701 /* GVWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVWindowController.m; sourceTree = "<group>"; };
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = (
../lib/cdt/.libs,
- ../lib/graph/.libs,
+ ../lib/cgraph/.libs,
../lib/gvc/.libs,
);
PRODUCT_NAME = Graphviz;
- USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/graph ../lib/gvc";
+ USER_HEADER_SEARCH_PATHS = "../lib/common ../lib/cdt ../lib/pathplan ../lib/cgraph ../lib/gvc";
VALID_ARCHS = "i386 x86_64";
WRAPPER_EXTENSION = app;
};