]> granicus.if.org Git - graphviz/commitdiff
Initial version of Cgraph created.
authornorth <devnull@localhost>
Thu, 25 Oct 2007 20:27:57 +0000 (20:27 +0000)
committernorth <devnull@localhost>
Thu, 25 Oct 2007 20:27:57 +0000 (20:27 +0000)
lib/cgraph/Makefile [new file with mode: 0644]
lib/cgraph/bla.h [new file with mode: 0644]

diff --git a/lib/cgraph/Makefile b/lib/cgraph/Makefile
new file mode 100644 (file)
index 0000000..61c7414
--- /dev/null
@@ -0,0 +1,67 @@
+LIBNAME = libxcgraph.a
+
+all:   $(LIBNAME)
+
+include $(HOME)/src/graphviz2/Config.mk.old
+include $(HOME)/src/graphviz2/makearch/$(ARCH)
+
+INCS = -I. -I$(HOME)/arch/$(ARCH)/include
+CCFLAGS = -g
+
+DEFINES = -DHAVE_CONFIG_H
+
+OBJS = apply.o attr.o edge.o agerror.o flatten.o \
+       grammar.o graph.o id.o imap.o io.o mem.o \
+       node.o obj.o pend.o rec.o refstr.o scan.o \
+       subg.o utils.o write.o
+
+$(LIBNAME): $(OBJS)
+       $(AR) cr $(LIBNAME) $(OBJS)
+       $(RANLIB) $(LIBNAME)
+
+# this is a home-made tool
+# trie.c : trie_input
+#      triegen  < trie_input > trie.c
+
+lexer.o : grammar.o
+
+grammar.c : grammar.y
+       $(YACC) -dv grammar.y
+       $(SED) "s/yy/aag/g" < y.tab.c > grammar.c
+       $(SED) "s/yy/aag/g" < y.tab.h > grammar.h
+       $(RM) y.tab.c y.tab.h
+
+scan.c : scan.l
+       $(FLEX) -i scan.l
+       $(SED) "s/yy/aag/g" < lex.yy.c > scan.c
+       $(RM) lex.yy.c
+
+install: $(LIBNAME)
+       $(MKPATH) $(LIBDIR)
+       $(INSTALL) $(LIBNAME) $(LIBDIR)
+#      $(SHLIB_LD) -o $(LIBDIR)/libcgraph.so.$(VERSION) $(OBJS)
+       $(MKPATH) $(INCDIR)
+       $(INSTALL) cgraph.h $(INCDIR)
+       $(MKPATH) $(LIBMANDIR)
+       $(INSTALL) cgraph.3 $(LIBMANDIR)
+
+clean:
+       $(RM) *.o core grammar.[ch] scan.c
+
+distclean: clean
+       $(RM) *.a lib*.so.*
+
+tester:  tester.c $(LIBNAME)
+       $(CC) -static tester.c $(INCS) $(LIBNAME) -L$(HOME)/arch/$(ARCH)/lib/ -lcdt -o tester
+
+main1:  main1.c $(LIBNAME)
+       $(CC) $(CCFLAGS) main1.c $(INCS) $(LIBNAME) -L$(HOME)/arch/$(ARCH)/lib -lcdt -o main1
+
+main2:  main2.c $(LIBNAME)
+       $(CC) $(CCFLAGS) main2.c $(INCS) $(LIBNAME) -L$(HOME)/arch/$(ARCH)/lib -lcdt -o main2
+
+main3:  main3.c $(LIBNAME)
+       $(CC) $(CCFLAGS) main3.c $(INCS) $(LIBNAME) -L$(HOME)/arch/$(ARCH)/lib -lcdt -o main3
+
+main:  main.c $(LIBNAME)
+       $(CC) $(CCFLAGS) main.c $(INCS) $(LIBNAME) -L$(HOME)/arch/$(ARCH)/lib -lcdt -o main
diff --git a/lib/cgraph/bla.h b/lib/cgraph/bla.h
new file mode 100644 (file)
index 0000000..cf1f409
--- /dev/null
@@ -0,0 +1,16 @@
+typedef Agsubnode_t    Agnoderef_t;
+typedef Dtlink_t       Agedgeref_t;
+
+#define FIRSTNREF(g)   (agflatten(g), (Agnoderef_t*)(dtfirst((g)->n_seq)))
+#define NEXTNREF(rep)          ((Agnoderef_t*)((rep)->seq_link.right?(rep)->seq_link.right - offsetof(Agsubnode_t,seq_link):0))
+#define PREVNREF(rep)          ((rep)->seq_link.left)  FIXME
+#define NODEOF(rep)            ((rep)->node)
+
+#define FIRSTOUTREF(g,sn)      (agflatten(g), (sn)->out_seq)
+#define FIRSTINREF(g,sn)       (agflatten(g), (sn)->in_seq)
+#define NEXTEREF(sn,rep)       ((rep)->right)
+#define PREVEREF(sn,rep)       ((rep)->left)
+/* this is expedient but a bit slimey because it "knows" that dict entries of both nodes
+and edges are embedded in main graph objects but allocated separately in subgraphs */
+#define AGSNMAIN(sn)        ((sn)==(&((sn)->node->mainsub)))
+#define EDGEOF(sn,rep)         (AGSNMAIN(sn)?((Agedge_t*)((rep) - offsetof(Agedge_t,seq_link))) : ((Dthold_t*)(rep))->obj)