This was superseded by lib/agraph, which was in turn superseded by lib/cgraph.
Related to #1549.
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\GTK2\lib\glib-2.0\include;$(SolutionDir)windows\dependencies\GTK2\include\glib-2.0;$(SolutionDir)windows\dependencies\GTK2\include\pango-1.0\;$(SolutionDir)windows\dependencies\GTK2\include\cairo;$(SolutionDir)windows\dependencies\GTK2\include\freetype2;$(SolutionDir)windows\dependencies\GTK2\include;$(SolutionDir)/libltdl;$(SolutionDir)/lib/neatogen;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/graph;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;$(SolutionDir)/cmd/lefty/ws/mswin32;$(SolutionDir)/cmd/lefty;$(SolutionDir)/cmd/lefty/dot2l;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\GTK2\lib\glib-2.0\include;$(SolutionDir)windows\dependencies\GTK2\include\glib-2.0;$(SolutionDir)windows\dependencies\GTK2\include\pango-1.0\;$(SolutionDir)windows\dependencies\GTK2\include\cairo;$(SolutionDir)windows\dependencies\GTK2\include\freetype2;$(SolutionDir)windows\dependencies\GTK2\include;$(SolutionDir)/libltdl;$(SolutionDir)/lib/neatogen;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;$(SolutionDir)/cmd/lefty/ws/mswin32;$(SolutionDir)/cmd/lefty;$(SolutionDir)/cmd/lefty/dot2l;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
- <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\GTK2\lib\glib-2.0\include;$(SolutionDir)windows\dependencies\GTK2\include\glib-2.0;$(SolutionDir)windows\dependencies\GTK2\include\pango-1.0\;$(SolutionDir)windows\dependencies\GTK2\include\cairo;$(SolutionDir)windows\dependencies\GTK2\include\freetype2;$(SolutionDir)windows\dependencies\GTK2\include;$(SolutionDir)/libltdl;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/graph;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;$(SolutionDir)/cmd/lefty/ws/mswin32;$(SolutionDir)/cmd/lefty;$(SolutionDir)/cmd/lefty/dot2l;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\GTK2\lib\glib-2.0\include;$(SolutionDir)windows\dependencies\GTK2\include\glib-2.0;$(SolutionDir)windows\dependencies\GTK2\include\pango-1.0\;$(SolutionDir)windows\dependencies\GTK2\include\cairo;$(SolutionDir)windows\dependencies\GTK2\include\freetype2;$(SolutionDir)windows\dependencies\GTK2\include;$(SolutionDir)/libltdl;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;$(SolutionDir)/cmd/lefty/ws/mswin32;$(SolutionDir)/cmd/lefty;$(SolutionDir)/cmd/lefty/dot2l;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader />
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
+ AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_DLL;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
+ AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_DLL;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
+ AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
+ AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
+++ /dev/null
-parser.grammar
+++ /dev/null
-# $Id$ $Revision$
-## Process this file with automake to produce Makefile.in
-
-GRAPH_VERSION="5:0:0"
-
-pdfdir = $(pkgdatadir)/doc/pdf
-pkgconfigdir = $(libdir)/pkgconfig
-
-AM_CPPFLAGS = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/lib/cdt
-
-man_MANS = graph.3
-pkginclude_HEADERS = graph.h
-noinst_HEADERS = libgraph.h triefa.h parser.h agxbuf.h
-noinst_LTLIBRARIES = libgraph_C.la
-lib_LTLIBRARIES = libgraph.la
-pkgconfig_DATA = libgraph.pc
-pdf_DATA = graph.3.pdf
-
-libgraph_C_la_SOURCES = \
- attribs.c agxbuf.c edge.c graph.c graphio.c lexer.c \
- node.c parser.y refstr.c trie.c
-
-libgraph_la_LDFLAGS = -version-info $(GRAPH_VERSION) -no-undefined
-libgraph_la_SOURCES = $(libgraph_C_la_SOURCES)
-libgraph_la_LIBADD = $(top_builddir)/lib/cdt/libcdt.la
-
-lexer.o lexer.lo trie.o trie.lo: parser.h
-
-parser.c: y.tab.c
- @SED@ "s/yy/ag/g" < y.tab.c > parser.c
-
-parser.h: y.tab.h
- @SED@ "s/yy/ag/g" < y.tab.h > parser.h
-
-y.tab.c y.tab.h: y.output
-
-y.output: $(top_srcdir)/lib/graph/parser.y
- @YACC@ -dv $(top_srcdir)/lib/graph/parser.y
-
-# this is a home-made tool
-# trie.c : trie_input
-# triegen < trie_input > trie.c
-
-graph.3.pdf: $(srcdir)/graph.3
- @GROFF@ -Tps -man $(srcdir)/graph.3 | @PS2PDF@ - - > graph.3.pdf
-
-EXTRA_DIST = $(man_MANS) $(pdf_DATA) triefa.cP \
- parser.c parser.h \
- y.tab.c y.tab.h y.output graph.vcxproj* graph.def
-
-DISTCLEANFILES = y.output parser.c parser.h y.tab.[ch] $(pdf_DATA)
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <agxbuf.h>
-
-#define N_GNEW(n,t) (t*)malloc((n)*sizeof(t))
-
-/* agxbinit:
- * Assume if init is non-null, hint = sizeof(init[])
- */
-void agxbinit(agxbuf * xb, unsigned int hint, unsigned char *init)
-{
- if (init) {
- xb->buf = init;
- xb->dyna = 0;
- } else {
- if (hint == 0)
- hint = BUFSIZ;
- xb->dyna = 1;
- xb->buf = N_GNEW(hint, unsigned char);
- }
- xb->eptr = xb->buf + hint;
- xb->ptr = xb->buf;
- *xb->ptr = '\0';
-}
-
-/* agxbmore;
- * Expand buffer to hold at least ssz more bytes.
- */
-int agxbmore(agxbuf * xb, unsigned int ssz)
-{
- int cnt; /* current no. of characters in buffer */
- int size; /* current buffer size */
- int nsize; /* new buffer size */
- unsigned char *nbuf; /* new buffer */
-
- size = xb->eptr - xb->buf;
- nsize = 2 * size;
- if (size + ssz > nsize)
- nsize = size + ssz;
- cnt = xb->ptr - xb->buf;
- if (xb->dyna) {
- nbuf = (unsigned char*)realloc(xb->buf, nsize);
- } else {
- nbuf = N_GNEW(nsize, unsigned char);
- memcpy(nbuf, xb->buf, cnt);
- xb->dyna = 1;
- }
- xb->buf = nbuf;
- xb->ptr = xb->buf + cnt;
- xb->eptr = xb->buf + nsize;
- return 0;
-}
-
-/* agxbput_n:
- * Append string s of length n onto xb
- */
-int agxbput_n(agxbuf * xb, const char *s, unsigned int ssz)
-{
- if (xb->ptr + ssz > xb->eptr)
- agxbmore(xb, ssz);
- memcpy(xb->ptr, s, ssz);
- xb->ptr += ssz;
- return ssz;
-}
-
-/* agxbput:
- * Append string s into xb
- */
-int agxbput(agxbuf * xb, const char *s)
-{
- unsigned int ssz = strlen(s);
-
- return agxbput_n(xb, s, ssz);
-}
-
-/* agxbfree:
- * Free any malloced resources.
- */
-void agxbfree(agxbuf * xb)
-{
- if (xb->dyna)
- free(xb->buf);
-}
-
-/* agxbpop:
- * Removes last character added, if any.
- */
-int agxbpop(agxbuf * xb)
-{
- int c;
- if (xb->ptr > xb->buf) {
- c = *xb->ptr--;
- return c;
- } else
- return -1;
-
-}
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef AGXBUF_H
-#define AGXBUF_H
-
-/* Extensible buffer:
- * Malloc'ed memory is never released until agxbfree is called.
- */
- typedef struct {
- unsigned char *buf; /* start of buffer */
- unsigned char *ptr; /* next place to write */
- unsigned char *eptr; /* end of buffer */
- int dyna; /* true if buffer is malloc'ed */
- } agxbuf;
-
-/* agxbinit:
- * Initializes new agxbuf; caller provides memory.
- * Assume if init is non-null, hint = sizeof(init[])
- */
- extern void agxbinit(agxbuf * xb, unsigned int hint,
- unsigned char *init);
-
-/* agxbput_n:
- * Append string s of length n into xb
- */
- extern int agxbput_n(agxbuf * xb, const char *s, unsigned int n);
-
-/* agxbput:
- * Append string s into xb
- */
- extern int agxbput(agxbuf * xb, const char *s);
-
-/* agxbfree:
- * Free any malloced resources.
- */
- extern void agxbfree(agxbuf * xb);
-
-/* agxbpop:
- * Removes last character added, if any.
- */
- extern int agxbpop(agxbuf * xb);
-
-/* agxbmore:
- * Expand buffer to hold at least ssz more bytes.
- */
- extern int agxbmore(agxbuf * xb, int unsigned ssz);
-
-/* agxbputc:
- * Add character to buffer.
- * int agxbputc(agxbuf*, char)
- */
-#define agxbputc(X,C) ((((X)->ptr >= (X)->eptr) ? agxbmore(X,1) : 0), \
- (int)(*(X)->ptr++ = ((unsigned char)C)))
-
-/* agxbuse:
- * Null-terminates buffer; resets and returns pointer to data;
- * char* agxbuse(agxbuf* xb)
- */
-#define agxbuse(X) (agxbputc(X,'\0'),(char*)((X)->ptr = (X)->buf))
-
-/* agxbstart:
- * Return pointer to beginning of buffer.
- * char* agxbstart(agxbuf* xb)
- */
-#define agxbstart(X) ((char*)((X)->buf))
-
-/* agxblen:
- * Return number of characters currently stored.
- * int agxblen(agxbuf* xb)
- */
-#define agxblen(X) (((X)->ptr)-((X)->buf))
-
-/* agxbclear:
- * Resets pointer to data;
- * void agxbclear(agxbuf* xb)
- */
-#define agxbclear(X) ((void)((X)->ptr = (X)->buf))
-
-/* agxbnext:
- * Next position for writing.
- * char* agxbnext(agxbuf* xb)
- */
-#define agxbnext(X) ((char*)((X)->ptr))
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#include <limits.h>
-
-#define EXTERN
-#include "libgraph.h"
-
-Agdict_t *agdictof(void *obj)
-{
- Agdict_t *d = NULL;
-
- switch (TAG_OF(obj)) {
- case TAG_GRAPH:
- d = ((Agraph_t *) obj)->univ->globattr;
- break;
- case TAG_NODE:
- d = ((Agnode_t *) obj)->graph->univ->nodeattr;
- break;
- case TAG_EDGE:
- d = ((Agedge_t *) obj)->tail->graph->univ->edgeattr;
- break;
- }
- return d;
-}
-
-Agsym_t *agNEWsym(Agdict_t * dict, char *name, char *value)
-{
- Agsym_t *a;
- int i;
-
- a = NEW(Agsym_t);
- a->name = agstrdup(name);
- a->value = agstrdup(value);
- a->printed = TRUE;
- i = a->index = dtsize(dict->dict);
- dict->list = ALLOC(i + 2, dict->list, Agsym_t *);
- dict->list[i++] = a;
- dict->list[i++] = NULL;
- dtinsert(dict->dict, a);
- return a;
-}
-
-static void obj_init_attr(void *obj, Agsym_t * attr, int isnew)
-{
- int i;
- Agraph_t *gobj; /* generic object */
-
- gobj = (Agraph_t *) obj;
- i = attr->index;
- if (isnew) {
- gobj->attr = ALLOC(i + 1, gobj->attr, char *);
- gobj->attr[i] = agstrdup(attr->value);
- if (i % CHAR_BIT == 0) {
- /* allocate in chunks of CHAR_BIT bits */
- gobj->didset = ALLOC(i / CHAR_BIT + 1, gobj->didset, char);
- gobj->didset[i / CHAR_BIT] = 0;
- }
- }
- else if ((gobj->didset[i / CHAR_BIT] & (1 << (i % CHAR_BIT))) == 0) {
- /* the i-th attr was not set by agxset, so we can replace it */
- agstrfree(gobj->attr[i]);
- gobj->attr[i] = agstrdup(attr->value);
- }
-}
-
-static void add_graph_attr(Agraph_t * g, Agsym_t * attr, int isnew)
-{
- Agnode_t *n;
-
- if (g->meta_node) {
- for (n = agfstnode(g->meta_node->graph); n;
- n = agnxtnode(g->meta_node->graph, n))
- obj_init_attr(agusergraph(n), attr, isnew);
- } else
- obj_init_attr(g, attr, isnew);
-}
-
-static void add_node_attr(Agraph_t * g, Agsym_t * attr, int isnew)
-{
- Agnode_t *n;
- Agproto_t *proto;
-
- for (n = agfstnode(g); n; n = agnxtnode(g, n))
- obj_init_attr(n, attr, isnew);
- if (g->meta_node) {
- for (n = agfstnode(g->meta_node->graph); n;
- n = agnxtnode(g->meta_node->graph, n))
- for (proto = agusergraph(n)->proto; proto; proto = proto->prev)
- obj_init_attr(proto->n, attr, isnew);
- } else
- for (proto = g->proto; proto; proto = proto->prev)
- obj_init_attr(proto->n, attr, isnew);
-}
-
-static void add_edge_attr(Agraph_t * g, Agsym_t * attr, int isnew)
-{
- Agnode_t *n;
- Agedge_t *e;
- Agproto_t *proto;
-
- for (n = agfstnode(g); n; n = agnxtnode(g, n))
- for (e = agfstout(g, n); e; e = agnxtout(g, e))
- obj_init_attr(e, attr, isnew);
- if (g->meta_node) {
- for (n = agfstnode(g->meta_node->graph); n;
- n = agnxtnode(g->meta_node->graph, n))
- for (proto = agusergraph(n)->proto; proto; proto = proto->prev)
- obj_init_attr(proto->e, attr, isnew);
- } else
- for (proto = g->proto; proto; proto = proto->prev)
- obj_init_attr(proto->e, attr, isnew);
-}
-
-Agsym_t *agattr(void *obj, char *name, char *value)
-{
- Agsym_t *rv;
- int isnew = 1;
-
- rv = agfindattr(obj, name);
- if (rv) {
- if (strcmp(rv->value, value)) {
- agstrfree(rv->value);
- rv->value = agstrdup(value);
- isnew = 0;
- }
- else
- return rv;
- }
- else
- rv = agNEWsym(agdictof(obj), name, value);
- if (rv) {
- switch (TAG_OF(obj)) {
- case TAG_GRAPH:
- add_graph_attr((Agraph_t *) obj, rv, isnew);
- break;
- case TAG_NODE:
- add_node_attr(((Agnode_t *) obj)->graph, rv, isnew);
- break;
- case TAG_EDGE:
- add_edge_attr(((Agedge_t *) obj)->head->graph, rv, isnew);
- break;
- }
- }
- return rv;
-}
-
-Agraph_t *agprotograph()
-{
- return AG.proto_g;
-}
-
-Agnode_t *agprotonode(Agraph_t *g)
-{
- return g->proto->n;
-}
-
-
-Agedge_t *agprotoedge(Agraph_t *g)
-{
- return g->proto->e;
-}
-
-
-static int initproto(void)
-{
- Agsym_t *a;
- Agraph_t *g;
- g = AG.proto_g = agopen("ProtoGraph", AGRAPH);
- a = agattr(g->proto->e, KEY_ID, "");
- if (a->index != KEYX)
- return 1;
- a = agattr(g->proto->e, TAIL_ID, "");
- if (a->index != TAILX)
- return 1;
- a->printed = FALSE;
- a = agattr(g->proto->e, HEAD_ID, "");
- if (a->index != HEADX)
- return 1;
- a->printed = FALSE;
- return 0;
-}
-
-Agsym_t *agraphattr(Agraph_t * g, char *name, char *value)
-{
- if (g == NULL)
- g = AG.proto_g;
- if (g != g->root)
- return NULL;
- return agattr(g, name, value);
-}
-
-Agsym_t *agnodeattr(Agraph_t * g, char *name, char *value)
-{
- if (g == NULL)
- g = AG.proto_g;
- if (g != g->root)
- return NULL;
- return agattr(g->proto->n, name, value);
-}
-
-Agsym_t *agedgeattr(Agraph_t * g, char *name, char *value)
-{
- if (g == NULL)
- g = AG.proto_g;
- if (g != g->root)
- return NULL;
- return agattr(g->proto->e, name, value);
-}
-
-/* attribute dictionaries */
-
-static void agfreesym(void *ptr)
-{
- Agsym_t *a;
- a = (Agsym_t *) ptr;
- agstrfree(a->name);
- agstrfree(a->value);
- free(a);
-}
-
-void agFREEdict(Agraph_t * g, Agdict_t * dict)
-{
- int i;
- Agsym_t *a;
-
- g = g;
- dtclose(dict->dict);
- if (dict->list) {
- i = 0;
- while ((a = dict->list[i++]))
- agfreesym(a);
- free(dict->list);
- }
- free(dict);
-}
-
-Agdict_t *agNEWdict(char *name)
-{
- Agdict_t *dict;
- static Dtdisc_t symdisc = {
- offsetof(Agsym_t, name), /* key */
- -1, /* size */
- -1, /* link */
- (Dtmake_f) 0,
- (Dtfree_f) 0,
- (Dtcompar_f) 0, /* use strcmp */
- (Dthash_f) 0,
- (Dtmemory_f) 0,
- (Dtevent_f) 0
- };
-
- dict = NEW(Agdict_t);
- dict->name = name;
- dict->dict = dtopen(&symdisc, Dttree);
- dict->list = NULL;
- return dict;
-}
-
-void agcopydict(Agdict_t * to_dict, Agdict_t * from_dict)
-{
- int i, n;
- Agsym_t *a, *b;
-
- n = dtsize(from_dict->dict);
- for (i = 0; i < n; i++) {
- a = from_dict->list[i];
- b = agNEWsym(to_dict, a->name, a->value);
- b->printed = a->printed;
- b->fixed = a->fixed;
-#ifdef WIN32
- /* Microsoft C is a thing of wonder. */
- fprintf(stderr, "", a->name, a->value);
-#endif
- }
-}
-
-Agsym_t *agfindattr(void *obj, char *name)
-{
- Agsym_t *rv;
- Agdict_t *dict = agdictof(obj);
-
- rv = (Agsym_t *) dtmatch(dict->dict, name);
- return rv;
-}
-
-Agsym_t *agfstattr(void *obj)
-{
- Agdict_t *dict = agdictof(obj);
- return (Agsym_t *)dtfirst(dict->dict);
-}
-
-Agsym_t *agnxtattr(void *obj, Agsym_t *a)
-{
- Agdict_t *dict = agdictof(obj);
- return (Agsym_t *)dtnext(dict->dict, a);
-}
-
-Agsym_t *aglstattr(void *obj)
-{
- Agdict_t *dict = agdictof(obj);
- return (Agsym_t *)dtlast(dict->dict);
-}
-
-Agsym_t *agprvattr(void *obj, Agsym_t *a)
-{
- Agdict_t *dict = agdictof(obj);
- return (Agsym_t *)dtprev(dict->dict, a);
-}
-
- /* this is normally called by the aginit() macro */
-int aginitlib(int gs, int ns, int es)
-{
- int rv = 0;
- if (AG.proto_g == NULL) {
- AG.graph_nbytes = gs;
- AG.node_nbytes = ns;
- AG.edge_nbytes = es;
- AG.init_called = TRUE;
- if (initproto()) {
- agerr(AGERR, "aginitlib: initproto failed\n");
- rv = 1;
- }
- } else
- if ((AG.graph_nbytes != gs) || (AG.node_nbytes != ns)
- || (AG.edge_nbytes != es))
- agerr(AGWARN, "aginit() called multiply with inconsistent args\n");
- return rv;
-}
-
-char *agget(void *obj, char *attr)
-{
- return agxget(obj, agindex(obj, attr));
-}
-
-int agset(void *obj, char *attr, char *value)
-{
- return agxset(obj, agindex(obj, attr), value);
-}
-
-int agindex(void *obj, char *name)
-{
- Agsym_t *a;
- int rv = -1;
-
- a = agfindattr(obj, name);
- if (a)
- rv = a->index;
- return rv;
-}
-
-char *agxget(void *obj, int index)
-{
- if (index >= 0)
- return ((Agraph_t *) obj)->attr[index];
- return NULL;
-}
-
-int agxset(void *obj, int index, char *buf)
-{
- char **p;
- if (index >= 0) {
- Agraph_t *gobj = (Agraph_t *)obj;
- p = gobj->attr;
- agstrfree(p[index]);
- p[index] = agstrdup(buf);
- /* the index-th attr was set by agxset */
- gobj->didset[index / CHAR_BIT] |= 1 << (index % CHAR_BIT);
- return 0;
- } else
- return -1;
-}
-
-int agsafeset(void* obj, char* name, char* value, char* def)
-{
- Agsym_t* a = agfindattr(obj, name);
-
- if (a == NULL) {
- if (!def) def = "";
- switch (TAG_OF(obj)) {
- case TAG_GRAPH:
- a = agraphattr(((Agraph_t*)obj)->root, name, def);
- break;
- case TAG_NODE:
- a = agnodeattr(((Agnode_t*)obj)->graph, name, def);
- break;
- case TAG_EDGE:
- a = agedgeattr(((Agedge_t*)obj)->head->graph, name, def);
- break;
- }
- }
- return agxset(obj, a->index, value);
-}
-
-/* agcopyattr:
- * Assumes attributes have already been declared.
- * Do not copy key attribute for edges, as this must be distinct.
- * Returns non-zero on failure or if objects have different type.
- */
-int agcopyattr(void *oldobj, void *newobj)
-{
- Agdict_t *d = agdictof(oldobj);
- Agsym_t **list = d->list;
- Agsym_t *sym;
- Agsym_t *newsym;
- int r = 0;
- int isEdge = (TAG_OF(oldobj) == TAG_EDGE);
-
- if (TAG_OF(oldobj) != TAG_OF(newobj)) return 1;
- while (!r && (sym = *list++)) {
- if (isEdge && sym->index == KEYX) continue;
- newsym = agfindattr(newobj,sym->name);
- if (!newsym) return 1;
- r = agxset(newobj, newsym->index, agxget(oldobj, sym->index));
- }
- return r;
-}
-
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#include <limits.h>
-
-#include "libgraph.h"
-
-#if 0
-/* graphs_of_e() is never used - suppress compiler warnings. */
-static void graphs_of_e(Agedge_t * e, Dict_t * g_e, Agraph_t * g)
-{
- Agedge_t *sub;
-
- if (dtsearch(g->inedges, e) == NULL)
- return;
- if (dtsearch(g_e, g->meta_node))
- return;
- dtinsert(g_e, g->meta_node);
- for (sub = agfstin(g->meta_node->graph, g->meta_node); sub;
- sub = agnxtin(g->meta_node->graph, sub))
- graphs_of_e(e, g_e, agusergraph(sub->head));
-}
-#endif
-
-static Agedge_t *esearch(Agraph_t * g, Agnode_t * tail, Agnode_t * head,
- char *usrkey)
-{
- Agedge_t key, *e;
- char *attr[KEYX + 1];
-
- attr[KEYX] = usrkey;
- key.tail = tail;
- key.head = head;
- key.attr = (usrkey ? attr : 0);
- if (usrkey)
- e = (Agedge_t *) dtsearch(g->inedges, &key);
- else {
- e = (Agedge_t *) dtnext(g->inedges, &key);
- if (e && ((e->tail != tail) || (e->head != head)))
- e = NULL;
- }
- return e;
-}
-
-Agedge_t *agfindedge(Agraph_t * g, Agnode_t * tail, Agnode_t * head)
-{
- Agedge_t *e;
-
- e = esearch(g, tail, head, NULL);
- if ((e == NULL) && !(AG_IS_DIRECTED(g)))
- e = esearch(g, head, tail, NULL);
- return e;
-}
-
-static void install_edge(Agraph_t * g, Agedge_t * e)
-{
- Agraph_t *meta;
- Agedge_t *f;
-
- if (dtsearch(g->inedges, e))
- return;
- agINSnode(g, e->tail);
- agINSnode(g, e->head);
- dtinsert(g->outedges, e);
- dtinsert(g->inedges, e);
- f = (Agedge_t *) dtprev(g->outedges, e);
- if (f && (f->tail == e->tail) && (f->head == e->head)
- && (e->printkey == NOPRINT))
- e->printkey = MULTIPLE;
- if (AG_IS_METAGRAPH(g) == FALSE) {
- meta = g->meta_node->graph;
- for (f = agfstin(meta, g->meta_node); f; f = agnxtin(meta, f)) {
- install_edge(agusergraph(f->tail), e);
- }
- }
-}
-
-void agINSedge(Agraph_t * g, Agedge_t * e)
-{
- if (e->printkey == MULTIPLE)
- e->printkey = MUSTPRINT;
- install_edge(g, e);
-}
-
-
-static int printedge(Dict_t * d, void *p, void *ignored)
-{
- Agedge_t *e = (Agedge_t *) p;
- agerr(AGPREV, "\t%p %s,%s\n", e, e->tail->name, e->head->name);
- return 0;
-}
-
-Agedge_t *agfstedge(Agraph_t * g, Agnode_t * n)
-{
- Agedge_t *e;
-
- e = NULL;
- if ((g != NULL) && (n != NULL)) {
- e = agfstout(g, n);
- if (e == NULL)
- e = agfstin(g, n);
- }
- return e;
-}
-
-Agedge_t *agnxtedge(Agraph_t * g, Agedge_t * e, Agnode_t * n)
-{
- Agedge_t *f;
-
- f = NULL;
- if ((g != NULL) && (e != NULL) && (n != NULL)) {
- if (e->tail == n) {
- f = (Agedge_t *) dtnext(g->outedges, e);
- if ((f != NULL) && (f->tail == n))
- return f;
- f = agfstin(g, n);
- while (f && (f->head == f->tail) && (f->head == n))
- f = (Agedge_t *) dtnext(g->inedges, f);
- } else {
- if (e->head != n)
- return NULL;
- else
- f = (Agedge_t *) dtnext(g->inedges, e);
- }
- while (f && (f->head == f->tail) && (f->head == n))
- f = (Agedge_t *) dtnext(g->inedges, f);
- if (f && (f->head != n))
- f = NULL;
- }
- return f;
-}
-
-Agedge_t *agfstout(Agraph_t * g, Agnode_t * n)
-{
- Agedge_t *f, key;
-
- f = NULL;
- if ((g != NULL) && (n != NULL)) {
- key.tail = n;
- key.head = NULL;
- key.attr = NULL;
- f = (Agedge_t *) dtnext(g->outedges, &key);
- if (f && (f->tail != n))
- f = NULL;
- }
- return f;
-}
-
-Agedge_t *agnxtout(Agraph_t * g, Agedge_t * e)
-{
- Agedge_t *f;
- f = (Agedge_t *) dtnext(g->outedges, e);
- if (f && (f->tail != e->tail))
- f = NULL;
- return f;
-}
-
-Agedge_t *agfstin(Agraph_t * g, Agnode_t * n)
-{
- Agedge_t *f, key;
-
- f = NULL;
- if ((g != NULL) && (n != NULL)) {
- key.head = n;
- key.tail = NULL;
- key.attr = NULL;
- f = (Agedge_t *) dtnext(g->inedges, &key);
- if (f && (f->head != n))
- f = NULL;
- }
- return f;
-}
-
-Agedge_t *agnxtin(Agraph_t * g, Agedge_t * e)
-{
- Agedge_t *f;
-
- f = (Agedge_t *) dtnext(g->inedges, e);
- if (f && (f->head != e->head))
- f = NULL;
- return f;
-}
-
-Agedge_t *agNEWedge(Agraph_t * subg, Agnode_t * tail, Agnode_t * head,
- Agedge_t * proto)
-{
- int i, nobj;
- Agedge_t *e;
-
- e = (Agedge_t *) calloc(1, AG.edge_nbytes);
- e->tag = TAG_EDGE;
- e->tail = tail;
- e->head = head;
- e->id = subg->univ->max_edge_id++;
-
- nobj = dtsize(subg->univ->edgeattr->dict);
- if (nobj) {
- e->attr = N_NEW(nobj, char *);
- e->didset = N_NEW((nobj + CHAR_BIT - 1) / CHAR_BIT, char);
- }
- else {
- e->attr = NULL;
- e->didset = NULL;
- }
- for (i = 0; i < nobj; i++)
- e->attr[i] =
- agstrdup(proto ? proto->attr[i] : subg->univ->edgeattr->
- list[i]->value);
- return e;
-}
-
-Agedge_t *agedge(Agraph_t * g, Agnode_t * tail, Agnode_t * head)
-{
- Agedge_t *e;
- char *keystr, key[SMALLBUF], printkey = NOPRINT;
- static int ctr;
-
- keystr = g->proto->e->attr[KEYX]; /* temporarily set aside */
- e = NULL;
- g->proto->e->head = head;
- g->proto->e->tail = tail;
- if (AG_IS_STRICT(g)) {
- e = esearch(g, tail, head, NULL);
- if (!e && !AG_IS_DIRECTED(g))
- e = esearch(g, head, tail, NULL);
- if (e)
- install_edge(g, e);
- } else {
- if (keystr[0]) {
- e = esearch(g, tail, head, keystr);
- if (!e && !AG_IS_DIRECTED(g))
- e = esearch(g, head, tail, keystr);
- if (e)
- agINSedge(g, e);
- else
- printkey = MUSTPRINT;
- } else {
- sprintf(key, "%d", ctr++);
- g->proto->e->attr[KEYX] = key;
- }
- }
- if (e == NULL) {
- e = agNEWedge(g, tail, head, g->proto->e);
- install_edge(g, e);
- g->proto->e->head = g->proto->e->tail = g->proto->n;
- e->printkey = printkey;
- }
- g->proto->e->attr[KEYX] = keystr;
- return e;
-}
-
-void agFREEedge(Agedge_t * e)
-{
- int i, nobj;
- Agdict_t *dict = agdictof(e);
-
- dict = dict;
- TAG_OF(e) = -1;
- nobj = dtsize(e->tail->graph->univ->edgeattr->dict);
- for (i = 0; i < nobj; i++)
- agstrfree(e->attr[i]);
- free(e->attr);
- free(e->didset);
- free(e);
-}
-
-void agDELedge(Agraph_t * g, Agedge_t * e)
-{
- Agraph_t *meta;
- Agraph_t *g0;
- Agedge_t *f;
-
- if (dtsearch(g->inedges, e) == NULL) {
- agerr(AGERR, "Edge %p was not found\n", e);
- dtwalk(g->inedges, printedge, NIL(void *));
- return;
- }
- if (AG_IS_METAGRAPH(g) == FALSE) {
- meta = g->meta_node->graph;
- for (f = agfstout(meta, g->meta_node); f; f = agnxtout(meta, f)) {
- g0 = agusergraph(f->head);
- if (dtsearch(g0->inedges, e))
- agDELedge(g0, e);
- }
- }
- dtdelete(g->inedges, e);
- dtdelete(g->outedges, e);
- if (g == g->root)
- agFREEedge(e);
-}
+++ /dev/null
-.TH LIBGRAPH 3 "01 MARCH 1993"
-.SH NAME
-\fBlibgraph\fR \- abstract graph library
-.SH SYNOPSIS
-.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
-.PP
-.nf
-\f5
-#include <graphviz/graph.h>
-void aginit();
-Agraph_t *agread(FILE*);
-int agwrite(Agraph_t*, FILE*);
-int agerrors();
-Agraph_t *agopen(char *name, int kind);
-void agclose(Agraph_t *g);
-Agraph_t *agsubg(Agraph_t *g, char *name);
-Agraph_t *agfindsubg(Agraph_t *g, char *name);
-Agnode_t *agmetanode(Agraph_t *g);
-Agraph_t *agusergraph(Agnode_t *metanode);
-int agnnodes(Agraph_t *g), agnedges(Agraph_t *g);
-.sp .i1
-int agcontains(Agraph_t *g, void *obj);
-int aginsert(Agraph_t *g, void *obj);
-int agdelete(Agraph_t *g, void *obj);
-.sp .1i
-Agnode_t *agnode(Agraph_t *g, char *name);
-Agnode_t *agfindnode(Agraph_t *g, char *name);
-Agnode_t *agfstnode(Agraph_t *g);
-Agnode_t *agnxtnode(Agraph_t *g, Agnode_t *n);
-Agnode_t *aglstnode(Agraph_t *g);
-Agnode_t *agprvnode(Agraph_t *g, Agnode_t *n);
-.sp .1i
-Agedge_t *agedge(Agraph_t *g, Agnode_t *tail, Agnode_t *head);
-Agedge_t *agfindedge(Agraph_t *g, Agnode_t *tail, Agnode_t *head);
-Agedge_t *agfstedge(Agraph_t *g, Agnode_t *n);
-Agedge_t *agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n);
-Agedge_t *agfstin(Agraph_t *g, Agnode_t *n);
-Agedge_t *agnxtin(Agraph_t *g, Agedge_t *e);
-Agedge_t *agfstout(Agraph_t *g, Agnode_t *n);
-Agedge_t *agnxtout(Agraph_t *g, Agedge_t *e);
-.sp .1i
-char *agget(void *obj, char *name);
-char *agxget(void *obj, int index);
-void agset(void *obj, char *name, char *value);
-void agxset(void *obj, int index, char *value);
-int agindex(void *obj, char *name);
-.sp .1i
-Agsym_t* agraphattr(Agraph_t *g,char *name,char *value);
-Agsym_t* agnodeattr(Agraph_t *g,char *name,char *value);
-Agsym_t* agedgeattr(Agraph_t *g,char *name,char *value);
-Agsym_t* agfindattr(void *obj,char *name);
-\fP
-.fi
-.SH DESCRIPTION
-\fIlibgraph\fP maintains directed and undirected attributed graphs
-in memory and reads and writes graph files. Graphs are composed of
-nodes, edges, and nested subgraphs. A subgraph may contain any
-nodes and edges of its parents, and may be passed to any
-\fIlibgraph\fP function taking a graph pointer, except the three
-that create new attributes (where a main graph is required).
-
-Attributes are internal or external.
-Internal attributes are fields in the graph, node and edge structs
-defined at compile time.
-These allow efficient representation and direct access to values
-such as marks, weights, and pointers for writing graph algorithms.
-External attributes, on the other hand, are character strings
-(name\(hyvalue pairs) dynamically allocated at runtime and accessed
-through \fIlibgraph\fP calls. External attributes are used in
-graph file I/O; internal attributes are not. Conversion between
-internal and external attributes must be explicitly programmed.
-
-The subgraphs in a main graph are represented by an auxiliary directed
-graph (a meta\(hygraph). Meta\(hynodes correspond to subgraphs, and meta\(hyedges
-signify containment of one subgraph in another.
-\f5agmetanode\fP and \f5agusergraph\fP map between
-subgraphs and meta\(hynodes. The nodes and edges of the meta\(hygraph may
-be traversed by the usual \fIlibgraph\fP functions for this purpose.
-
-.SH USE
-1. Define types \f5Agraphinfo_t\fP, \f5Agnodeinfo_t\fP,
-and \f5Agedgeinfo_t\fP (usually in a header file) before
-including \f5<graphviz/graph.h>\fP.
-
-2. Call \f5aginit()\fP before any other \fIlibgraph\fP functions.
-(This is a macro that calls \f5aginitlib()\fP to define the sizes
-of Agraphinfo_t, Agnodeinfo_t, and Agedgeinfo_t.)
-
-3. Compile with \-lgraph \-lcdt.
-
-Except for the \fBu\fP fields, \fIlibgraph\fP
-data structures must be considered read\(hyonly.
-Corrupting their contents by direct updates can cause
-catastrophic errors.
-
-Warning: the library is not thread-safe.
-
-.SH "GRAPHS"
-.nf
-\f5
-typedef struct Agraph_t {
- char kind;
- char *name;
- Agraph_t *root;
- char **attr;
- graphdata_t *univ;
- Dict_t *nodes,*inedges,*outedges;
- proto_t *proto;
- Agraphinfo_t u;
-} Agraph_t;
-
-typedef struct graphdata_t {
- Dict_t *node_dict;
- attrdict_t *nodeattr, *edgeattr, *globattr;
-} graphdata_t;
-
-typedef struct proto_t {
- Agnode_t *n;
- Agedge_t *e;
- proto_t *prev;
-} proto_t;
-\fP
-.fi
-A graph \fIkind\fP is one of:
-AGRAPH, AGRAPHSTRICT, AGDIGRAPH, or AGDIGRAPHSTRICT.
-There are related macros for testing the properties of a graph:
-AG_IS_DIRECTED(g) and AG_IS_STRICT(g).
-Strict graphs cannot have self\(hyarcs or multi\(hyedges.
-\fBattr\fP is the array of external attribute values.
-\fBuniv\fP points to values shared by all subgraphs of a main graph.
-\fBnodes\fP, \fBinedges\fP, and \fBoutedges\fP are sets maintained
-by \fBcdt(3)\fP. Normally you don't access these dictionaries
-directly, though the edge dictionaries may be re\(hyordered to support
-programmer\(hydefined ordered edges (see \f5dtreorder\fP in \fIcdt(3)\fP).
-\fBproto\fP is a stack of templates for node and edge initialization.
-The attributes of these nodes and edges are set in the usual way (\f5agget\fP,
-\f5agset\fP, etc.) to set defaults.
-.PP
-\f5agread\fP reads a file and returns a new graph if one
-was successfully parsed, otherwise returns NULL if
-\f5EOF\fP or a syntax error was encountered.
-Errors are reported on stderr and a count is returned from
-\g5agerrors()\fP.
-\f5write_graph\fP prints a graph on a file.
-\f5agopen\fP and \f5agsubg\fP create new empty graph and subgraphs.
-\f5agfindsubg\fP searches for a subgraph by name, returning NULL
-when the search fails.
-
-.SH ALL OBJECTS
-\f5agcontains\fP, \f5aginsert\fP, \f5agdelete\fP are generic functions
-for nodes, edges, and graphs. \f5gcontains\fP is a predicate that tests
-if an object belongs to the given graph. \f5aginsert\fP inserts an
-object in a graph and \f5agdelete\fP undoes this operation.
-A node or edge is destroyed (and its storage freed) at the time it
-is deleted from the main graph. Likewise a subgraph is destroyed
-when it is deleted from its last parent or when its last parent is deleted.
-
-.SH NODES
-.nf
-\f5
-typedef struct Agnode_t {
- char *name;
- Agraph_t *graph;
- char **attr;
- Agnodeinfo_t u;
-} Agnode_t;
-\fP
-.fi
-
-\f5agnode\fP attempts to create a node.
-If one with the requested name already exists, the old node
-is returned unmodified.
-Otherwise a new node is created, with attributed copied from g\->proto\->n.
-\f5agfstnode\fP (\f5agnxtnode\fP) return the first (next) element
-in the node set of a graph, respectively, or NULL.
-\f5aglstnode\fP (\f5agprvnode\fP) return the last (previous) element
-in the node set of a graph, respectively, or NULL.
-
-.SH EDGES
-.nf
-\f5
-typedef struct Agedge_t {
- Agnode_t *head,*tail;
- char **attr;
- Agedgeinfo_t u;
-} Agedge_t;
-\fP
-.fi
-\f5agedge\fP creates a new edge with the attributes of g\->proto\->e
-including its key if not empty.
-\f5agfindedge\fP finds the first (u,v) edge in \f5g\fP.
-\f5agfstedge\fP (\f5agnxtedge\fP) return the first (next) element
-in the edge set of a graph, respectively, or NULL.
-\f5agfstin\fP, \f5agnxtin\fP, \f5agfstout\fP, \f5agnxtout\fP
-refer to in\(hy or out\(hyedge sets.
-The idiomatic usage in a directed graph is:
-.sp
-\f5 for (e = agfstout(g,n); e; e = agnextout(g,e)) your_fun(e);\fP
-.P
-An edge is uniquely identified by its endpoints and its \f5key\fP
-attribute (if there are multiple edges).
-If the \f5key\fP of \f5g\->proto\->e\fP is empty,
-new edges are assigned an internal value.
-Edges also have \f5tailport\fP and \f5headport\fP values.
-These have special syntax in the graph file language but are
-not otherwise interpreted.
-.PP
-.SH ATTRIBUTES
-.nf
-\f5
-typedef struct attrsym_t {
- char *name,*value;
- int index;
- unsigned char printed;
-} attrsym_t;
-.bp
-typedef struct attrdict_t {
- char *name;
- Dict_t *dict;
- attrsym_t **list;
-} attrdict_t;
-\fP
-.fi
-\f5agraphattr\fP, \f5agnodeattr\fP, and \f5agedgeattr\fP make new attributes.
-\f5g\fP should be a main graph, or \f5NULL\fP for declarations
-applying to all graphs subsequently read or created.
-\f5agfindattr\fP searches for an existing attribute.
-.PP
-External attributes are accessed by \f5agget\fP and \f5agset\fP
-These take a pointer to any graph, node, or edge, and an attribute name.
-Also, each attribute has an integer index. For efficiency this index
-may be passed instead of the name, by calling \f5agxget\fP and \f5agxset\fP.
-The \f5printed\fP flag of an attribute may be set to 0 to skip it
-when writing a graph file.
-.PP
-The \f5list\fP in an attribute dictionary is maintained in order of creation
-and is NULL terminated.
-Here is a program fragment to print node attribute names:
-.nf
- \f5attrsym_t *aptr;
- for (i = 0; aptr = g\->univ\->nodedict\->list[i]; i++) puts(aptr\->name);\fP
-.fi
-.SH EXAMPLE GRAPH FILES
-.nf
-graph any_name { /* an undirected graph */
- a \-\- b; /* a simple edge */
- a \-\- x1 \-\- x2 \-\- x3; /* a chain of edges */
- "x3.a!" \-\- a; /* quotes protect special characters */
- b \-\- {q r s t}; /* edges that fan out */
- b [color="red",size=".5,.5"]; /* set various node attributes */
- node [color=blue]; /* set default attributes */
- b \-\- c [weight=25]; /* set edge attributes */
- subgraph sink_nodes {a b c}; /* make a subgraph */
-}
-
-digraph G {
- size="8.5,11"; /* sets a graph attribute */
- a \-> b; /* makes a directed edge */
- chip12.pin1 \-> chip28.pin3; /* uses named node "ports" */
-}
-.fi
-
-.SH SEE ALSO
-.BR dot (1),
-.BR neato (1),
-.BR libdict (3)
-.br
-S. C. North and K. P. Vo, "Dictionary and Graph Libraries''
-1993 Winter USENIX Conference Proceedings, pp. 1\(hy11.
-
-.SH AUTHOR
-Stephen North (north@ulysses.att.com), AT&T Bell Laboratories.
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#include <limits.h>
-
-#include "libgraph.h"
-
-Dtdisc_t agNamedisc = {
- offsetof(Agnode_t, name),
- -1,
- -1, /* link offset */
- NIL(Dtmake_f),
- NIL(Dtfree_f),
- NIL(Dtcompar_f), /* use strcmp */
- NIL(Dthash_f),
- NIL(Dtmemory_f),
- NIL(Dtevent_f)
-};
-
-Dtdisc_t agNodedisc = {
- offsetof(Agnode_t, id),
- sizeof(int),
- -1, /* link offset */
- NIL(Dtmake_f),
- NIL(Dtfree_f),
- (Dtcompar_f) agcmpid,
- NIL(Dthash_f),
- NIL(Dtmemory_f),
- NIL(Dtevent_f)
-};
-
-Dtdisc_t agIndisc = {
- 0, /* pass whole object as key */
- 0,
- -1, /* link offset */
- NIL(Dtmake_f),
- NIL(Dtfree_f),
- (Dtcompar_f) agcmpin,
- NIL(Dthash_f),
- NIL(Dtmemory_f),
- NIL(Dtevent_f)
-};
-
-Dtdisc_t agOutdisc = {
- 0, /* pass whole object as key */
- 0,
- -1, /* link offset */
- (Dtmake_f) 0,
- (Dtfree_f) 0,
- (Dtcompar_f) agcmpout,
- (Dthash_f) 0,
- (Dtmemory_f) 0,
- (Dtevent_f) 0
-};
-
-int agcmpid(Dt_t * dict, int *id0, int *id1, Dtdisc_t * disc)
-{
- return (*id0) - *(id1);
-}
-
-#ifdef DEBUG
-static int myinedgecmp(e0, e1)
-Agedge_t *e0, *e1;
-{
- int rv = myinedgecmp(e0, e1);
- printf("compare (%s,%s:%s),(%s,%s:%s) = %d\n",
- e0->head ? e0->head->name : "nil",
- e0->tail ? e0->tail->name : "nil",
- e0->attr && e0->attr[KEYX]? e0->attr[KEYX] : "nil",
- e1->head ? e1->head->name : "nil",
- e1->tail ? e1->tail->name : "nil",
- e1->attr && e1->attr[KEYX]? e1->attr[KEYX] : "nil",
- rv);
- return rv;
-}
-#endif
-
-static int keycmp(Agedge_t * e0, Agedge_t * e1)
-{
- char *key0, *key1;
- key0 = e0->attr ? e0->attr[KEYX] : NULL;
- key1 = e1->attr ? e1->attr[KEYX] : NULL;
- if (key0 == NULL)
- return (key1 ? -1 : 0);
- if (key1 == NULL)
- return 1;
- return strcmp(key0, key1);
-}
-
-int agcmpin(Dict_t * d, Agedge_t * e0, Agedge_t * e1, Dtdisc_t * disc)
-{
- int e0tailid, e0headid, e1tailid, e1headid;
-
- e0tailid = e0->tail ? e0->tail->id : -1;
- e0headid = e0->head ? e0->head->id : -1;
- e1tailid = e1->tail ? e1->tail->id : -1;
- e1headid = e1->head ? e1->head->id : -1;
-
- if (e0headid != e1headid)
- return e0headid - e1headid;
- if (e0tailid != e1tailid)
- return e0tailid - e1tailid;
- return keycmp(e0, e1);
-}
-
-int agcmpout(Dict_t * d, Agedge_t * e0, Agedge_t * e1, Dtdisc_t * disc)
-{
- int e0tailid, e0headid, e1tailid, e1headid;
-
- e0tailid = e0->tail ? e0->tail->id : -1;
- e0headid = e0->head ? e0->head->id : -1;
- e1tailid = e1->tail ? e1->tail->id : -1;
- e1headid = e1->head ? e1->head->id : -1;
-
- if (e0tailid != e1tailid)
- return e0tailid - e1tailid;
- if (e0headid != e1headid)
- return e0headid - e1headid;
- return keycmp(e0, e1);
-}
-
-static Agdata_t *agnewdata(void)
-{
- Agdata_t *rv;
-
- rv = NEW(Agdata_t);
- rv->node_dict = dtopen(&agNamedisc, Dttree);
- rv->globattr = agNEWdict("graph");
- rv->nodeattr = agNEWdict("node");
- rv->edgeattr = agNEWdict("edge");
- if (AG.proto_g) {
- agcopydict(rv->globattr, AG.proto_g->univ->globattr);
- agcopydict(rv->nodeattr, AG.proto_g->univ->nodeattr);
- agcopydict(rv->edgeattr, AG.proto_g->univ->edgeattr);
- }
- return rv;
-}
-
-static void agfreedata(Agraph_t * g)
-{
- agFREEdict(g, g->univ->globattr);
- agFREEdict(g, g->univ->nodeattr);
- agFREEdict(g, g->univ->edgeattr);
- dtclose(g->univ->node_dict);
- free(g->univ);
-}
-
-static void dup_proto(Agraph_t * g, Agproto_t * proto)
-{
- Agnode_t *n = NULL;
- Agedge_t *e = NULL;
- Agproto_t *s = NEW(Agproto_t);
-
- s->prev = g->proto;
- if (proto) {
- n = proto->n;
- e = proto->e;
- }
- s->n = agNEWnode(g, "\001proto", n);
- s->e = agNEWedge(g, s->n, s->n, e);
- g->proto = s;
-}
-
-void agpushproto(Agraph_t * g)
-{
- dup_proto(g, g->proto);
-}
-
-void agpopproto(Agraph_t * g)
-{
- Agproto_t *s = g->proto;
- if (s != NULL) {
- g->proto = s->prev;
- s->e->tail = s->e->head = s->n;
- agFREEedge(s->e);
- agFREEnode(s->n);
- free(s);
- }
-}
-
-static Agraph_t *agNEWgraph(char *name, Agraph_t * parent, int kind)
-{
- int i, nobj;
- Agraph_t *g;
-
- if (AG.init_called == FALSE) {
- agerr(AGERR, "libag error -- aginit() was not called\n");
- return 0;
- }
- g = (Agraph_t *) calloc(1, AG.graph_nbytes);
- g->tag = TAG_GRAPH;
- g->kind = kind;
- g->nodes = dtopen(&agNodedisc, Dttree);
- g->inedges = dtopen(&agIndisc, Dttree);
- g->outedges = dtopen(&agOutdisc, Dttree);
-
- if (parent == NULL) {
- g->univ = agnewdata();
- g->root = g;
- nobj = dtsize(g->univ->globattr->dict);
- if (nobj) {
- g->attr = N_NEW(nobj, char *);
- g->didset = N_NEW((nobj + CHAR_BIT - 1) / CHAR_BIT, char);
- }
- else {
- g->attr = NULL;
- g->didset = NULL;
- }
- for (i = 0; i < nobj; i++)
- g->attr[i] = agstrdup(AG.proto_g->attr[i]);
- } else {
- g->univ = parent->univ;
- g->root = parent->root;
- nobj = dtsize(parent->univ->globattr->dict);
- if (nobj) {
- g->attr = N_NEW(nobj, char *);
- g->didset = N_NEW((nobj + CHAR_BIT - 1) / CHAR_BIT, char);
- }
- else {
- g->attr = NULL;
- g->didset = NULL;
- }
- for (i = 0; i < nobj; i++)
- g->attr[i] = agstrdup(parent->attr[i]);
-
- }
-
- g->meta_node = NULL;
- g->name = agstrdup(name);
- g->proto = NULL;
-
- if (parent)
- dup_proto(g, parent->proto);
- else
- agpushproto(g);
- return g;
-}
-
-static int reach0(Dict_t * m, Agnode_t * from, Agnode_t * to)
-{
- Agedge_t *e;
-
- if (from == to)
- return TRUE;
- if (agfindedge(from->graph->root, from, to))
- return TRUE;
- dtinsert(m, from);
- for (e = agfstout(from->graph, from); e; e = agnxtout(from->graph, e))
- if ((dtsearch(m, e->head) == NULL) && reach0(m, e->head, to))
- return TRUE;
- return FALSE;
-}
-
-static int reach(Agnode_t * from, Agnode_t * to)
-{
- Dict_t *m;
- int rv;
-
- m = dtopen(&agNodedisc, Dttree);
- rv = reach0(m, from, to);
- dtclose(m);
- return rv;
-}
-
-Agraph_t *agusergraph(Agnode_t * n)
-{
- return (n->graph->meta_node ? NULL : (Agraph_t *) (n->attr[0]));
-}
-
-
-
-
-Agraph_t *agopen(char *name, int kind)
-{
- Agraph_t *g, *meta;
-
- g = agNEWgraph(name, NULL, kind);
- meta = agNEWgraph(name, NULL, AGMETAGRAPH);
- if (!g || !meta)
- return 0;
- agnodeattr(meta, "agusergraph", NULL);
- g->meta_node = agnode(meta, name);
- g->meta_node->attr[0] = (char *) g;
- return g;
-}
-
-Agraph_t *agsubg(Agraph_t * g, char *name)
-{
- Agraph_t *subg, *meta;
- Agnode_t *n;
-
- meta = g->meta_node->graph;
- n = agfindnode(meta, name);
- if (n)
- subg = agusergraph(n);
- else {
- subg = agNEWgraph(name, g, g->kind);
- if (!subg)
- return 0;
- n = agnode(meta, name);
- subg->meta_node = n;
- n->attr[0] = (char *) subg;
- }
- agINSgraph(g, subg);
- return subg;
-}
-
-Agraph_t *agfindsubg(Agraph_t * g, char *name)
-{
- Agnode_t *n;
-
- if (g->meta_node) {
- n = agfindnode(g->meta_node->graph, name);
- if (n)
- return agusergraph(n);
- }
- return NULL;
-}
-
-void agINSgraph(Agraph_t * g, Agraph_t * subg)
-{
- Agnode_t *h, *t;
- t = g->meta_node;
- h = subg->meta_node;
- if (t && h && (reach(h, t) == FALSE))
- agedge(t->graph, t, h);
-}
-
-void agclose(Agraph_t * g)
-{
- Agedge_t *e, *f;
- Agnode_t *n, *nn;
- Agraph_t *meta = NULL;
- int i, nobj, flag, is_meta;
-
- if ((g == NULL) || (TAG_OF(g) != TAG_GRAPH))
- return;
- is_meta = AG_IS_METAGRAPH(g);
- if (is_meta == FALSE) {
- meta = g->meta_node->graph;
- /* recursively remove its subgraphs */
- do { /* better semantics would be to find strong component */
- flag = FALSE;
- for (e = agfstout(meta, g->meta_node); e; e = f) {
- f = agnxtout(meta, e);
- if (agnxtin(meta, agfstin(meta, e->head)) == NULL) {
- agclose(agusergraph(e->head));
- flag = TRUE;
- }
- }
- } while (flag);
- }
- while (g->proto)
- agpopproto(g);
- if (is_meta == FALSE) {
- nobj = dtsize(g->univ->globattr->dict);
- for (i = 0; i < nobj; i++)
- agstrfree(g->attr[i]);
- }
- if (g->attr)
- free(g->attr);
- if (g->didset)
- free(g->didset);
- if (g == g->root) {
- for (n = agfstnode(g); n; n = nn) {
- nn = agnxtnode(g, n);
- agDELnode(g, n);
- }
- if (is_meta == FALSE)
- agclose(g->meta_node->graph);
- agfreedata(g);
- } else {
- if (is_meta == FALSE)
- agdelete(meta, g->meta_node);
- }
- dtclose(g->nodes);
- dtclose(g->inedges);
- dtclose(g->outedges);
- agstrfree(g->name);
- TAG_OF(g) = -1;
- free(g);
-}
-
-int agcontains(Agraph_t * g, void *obj)
-{
- switch (TAG_OF(obj)) {
- case TAG_NODE:
- return (agidnode(g, ((Agnode_t *) obj)->id) != NULL);
- case TAG_EDGE:
- return (dtsearch(g->inedges, (Agedge_t *) obj) != NULL);
- case TAG_GRAPH:
- return (reach(g->meta_node, ((Agraph_t *) obj)->meta_node));
- }
- return FALSE;
-}
-
-void aginsert(Agraph_t * g, void *obj)
-{
- switch (TAG_OF(obj)) {
- case TAG_NODE:
- agINSnode(g, (Agnode_t*)obj);
- break;
- case TAG_EDGE:
- agINSedge(g, (Agedge_t*)obj);
- break;
- case TAG_GRAPH:
- agINSgraph(g, (Agraph_t*)obj);
- break;
- }
-}
-
-void agdelete(Agraph_t * g, void *obj)
-{
- switch (TAG_OF(obj)) {
- case TAG_NODE:
- agDELnode(g, (Agnode_t*)obj);
- break;
- case TAG_EDGE:
- agDELedge(g, (Agedge_t*)obj);
- break;
- case TAG_GRAPH:
- agclose((Agraph_t*)obj);
- break;
- }
-}
-
-int agnnodes(Agraph_t * g)
-{
- return dtsize(g->nodes);
-}
-
-int agnedges(Agraph_t * g)
-{
- return dtsize(g->outedges);
-}
+++ /dev/null
-LIBRARY "graph"
-EXPORTS
-AG
-agattr
-agcanon
-agcanonical
-agchar
-agclose
-agcmpid
-agcmpin
-agcmpout
-agcontains
-agcopyattr
-agcopydict
-agDELedge
-agdelete
-agDELnode
-agdictof
-agedge
-agedgeattr
-agEdgedisc
-agerr
-agerrno
-agerror
-agerrorf
-agerrors
-agfindattr
-agfindedge
-agfindnode
-agfindsubg
-agFREEdict
-agFREEedge
-agFREEnode
-agfstattr
-agfstedge
-agfstin
-agfstnode
-agfstout
-agget
-aghtmlstr
-agidnode
-agindex
-agIndisc
-aginitlib
-agINSedge
-aginsert
-agINSgraph
-agINSnode
-aglasterr
-aglex
-aglexinit
-aglinenumber
-aglstattr
-aglstnode
-aglval
-agmemread
-agNamedisc
-agnedges
-agnerrs
-agNEWdict
-agNEWedge
-agNEWnode
-agNEWsym
-agnnodes
-agnode
-agnodeattr
-agNodedisc
-agnxtattr
-agnxtedge
-agnxtin
-agnxtnode
-agnxtout
-agopen
-agOutdisc
-agparse
-agpopproto
-agprotoedge
-agprotograph
-agprotonode
-agprvattr
-agprvnode
-agpushproto
-agraphattr
-agread
-agread_usergets
-agreadline
-agsafeset
-agset
-agseterr
-agsetfile
-agstrcanon
-agstrdup
-agstrdup_html
-agstrfree
-agsubg
-agtoken
-agusergraph
-agwarningf
-agwredge
-agwrite
-agwrnode
-agxbfree
-agxbinit
-agxbmore
-agxbpop
-agxbput
-agxbput_n
-agxget
-agxset
-Line_number
-myaglex
-TrieStateTbl
-TrieTransTbl
-agsetiodisc
-agputc
-agputs
-
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-
-#ifndef _GRAPH_H
-#define _GRAPH_H 1
-
-#if defined(_PACKAGE_ast)
-#include <ast.h>
-#else
-#include <sys/types.h>
-#include <stdlib.h>
-#endif
-#include <stdio.h>
-#include "cdt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TAIL_ID "tailport"
-#define HEAD_ID "headport"
-
- typedef struct Agraph_t Agraph_t;
- typedef struct Agnode_t Agnode_t;
- typedef struct Agedge_t Agedge_t;
- typedef struct Agdict_t Agdict_t;
- typedef struct Agsym_t Agsym_t;
- typedef struct Agdata_t Agdata_t;
- typedef struct Agproto_t Agproto_t;
-
- typedef char *(*gets_f) (char *ubuf, int n, FILE * fp);
-
-#define AGFLAG_DIRECTED (1<<0)
-#define AGFLAG_STRICT (1<<1)
-#define AGFLAG_METAGRAPH (1<<2)
-
-#define AGRAPH 0
-#define AGRAPHSTRICT (AGRAPH | AGFLAG_STRICT)
-#define AGDIGRAPH AGFLAG_DIRECTED
-#define AGDIGRAPHSTRICT (AGDIGRAPH | AGFLAG_STRICT)
-#define AGMETAGRAPH (AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH)
-
-#define AG_IS_DIRECTED(g) ((g)->kind & AGFLAG_DIRECTED)
-#define AG_IS_STRICT(g) ((g)->kind & AGFLAG_STRICT)
-#define AG_IS_METAGRAPH(g) ((g)->kind & AGFLAG_METAGRAPH)
-#define aginit() aginitlib(sizeof(Agraph_t),sizeof(Agnode_t),sizeof(Agedge_t))
-
- struct Agraph_t {
- int tag:4;
- int kind:4;
- int handle:24;
- char **attr;
- char *didset;
- char *name;
- Agdata_t *univ;
- Dict_t *nodes, *inedges, *outedges;
- Agraph_t *root;
- Agnode_t *meta_node;
- Agproto_t *proto;
- Agraphinfo_t u;
- };
-
- struct Agnode_t {
- int tag:4;
- int pad:4;
- int handle:24;
- char **attr;
- char *didset;
- char *name;
- int id;
- Agraph_t *graph;
- Agnodeinfo_t u;
- };
-
- struct Agedge_t {
- int tag:4;
- int printkey:4;
- int handle:24;
- char **attr;
- char *didset;
- Agnode_t *head, *tail;
- int id;
- Agedgeinfo_t u;
- };
-
- struct Agdata_t { /* for main graph */
- Dict_t *node_dict;
- Agdict_t *nodeattr;
- Agdict_t *edgeattr;
- Agdict_t *globattr;
- int max_node_id, max_edge_id;
- };
-
- struct Agsym_t {
- char *name, *value;
- int index;
- unsigned char printed;
- unsigned char fixed;
- };
-
- struct Agdict_t {
- char *name;
- Dict_t *dict;
- Agsym_t **list;
- };
-
- struct Agproto_t {
- Agnode_t *n;
- Agedge_t *e;
- Agproto_t *prev;
- };
-
-#if defined(_PACKAGE_ast)
- _BEGIN_EXTERNS_ /* public data */
-#if _BLD_graph && defined(__EXPORT__)
-#define extern __EXPORT__
-#endif
-#if !_BLD_graph && defined(__IMPORT__) && 0
-#define extern __IMPORT__
-#endif
-#endif
-/*visual studio*/
-#ifdef WIN32_DLL
-#ifndef GRAPH_EXPORTS
-#define extern __declspec(dllimport)
-#else
-#define extern __declspec(dllexport)
-#endif
-
-#endif
-/*end visual studio*/
- extern char *agstrcanon(char *, char *);
- extern char *agcanonical(char *);
- extern char *agcanon(char *);
- extern int aghtmlstr(char *s);
- extern char *agget(void *, char *);
- extern char *agxget(void *, int);
- extern int agset(void *, char *, char *);
- extern int agsafeset(void *, char *, char *, char*);
- extern int agxset(void *, int, char *);
- extern int agindex(void *, char *);
-
- extern int aginitlib(int, int, int);
- extern Agraph_t *agopen(char *, int);
- extern Agraph_t *agsubg(Agraph_t *, char *);
- extern Agraph_t *agfindsubg(Agraph_t *, char *);
- extern void agclose(Agraph_t *);
- extern Agraph_t *agread(FILE *);
- extern Agraph_t *agread_usergets(FILE *, gets_f);
- extern void agreadline(int);
- extern void agsetfile(char *);
- extern Agraph_t *agmemread(char *);
- extern void agsetiodisc(
- char * (*myfgets) (char *s, int size, FILE *stream),
- size_t (*myfwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream),
- int (*myferror) (FILE *stream) );
- extern int agputs(const char *s, FILE *fp);
- extern int agputc(int c, FILE *fp);
- extern int agwrite(Agraph_t *, FILE *);
- extern int agerrors(void);
- extern int agreseterrors(void);
- extern Agraph_t *agprotograph(void);
- extern Agnode_t *agprotonode(Agraph_t *);
- extern Agedge_t *agprotoedge(Agraph_t *);
- extern Agraph_t *agusergraph(Agnode_t *);
- extern int agnnodes(Agraph_t *);
- extern int agnedges(Agraph_t *);
-
- extern void aginsert(Agraph_t *, void *);
- extern void agdelete(Agraph_t *, void *);
- extern int agcontains(Agraph_t *, void *);
-
- extern Agnode_t *agnode(Agraph_t *, char *);
- extern Agnode_t *agfindnode(Agraph_t *, char *);
- extern Agnode_t *agfstnode(Agraph_t *);
- extern Agnode_t *agnxtnode(Agraph_t *, Agnode_t *);
- extern Agnode_t *aglstnode(Agraph_t *);
- extern Agnode_t *agprvnode(Agraph_t *, Agnode_t *);
-
- extern Agedge_t *agedge(Agraph_t *, Agnode_t *, Agnode_t *);
- extern Agedge_t *agfindedge(Agraph_t *, Agnode_t *, Agnode_t *);
- extern Agedge_t *agfstedge(Agraph_t *, Agnode_t *);
- extern Agedge_t *agnxtedge(Agraph_t *, Agedge_t *, Agnode_t *);
- extern Agedge_t *agfstin(Agraph_t *, Agnode_t *);
- extern Agedge_t *agnxtin(Agraph_t *, Agedge_t *);
- extern Agedge_t *agfstout(Agraph_t *, Agnode_t *);
- extern Agedge_t *agnxtout(Agraph_t *, Agedge_t *);
-
- extern Agsym_t *agattr(void *, char *, char *);
- extern Agsym_t *agraphattr(Agraph_t *, char *, char *);
- extern Agsym_t *agnodeattr(Agraph_t *, char *, char *);
- extern Agsym_t *agedgeattr(Agraph_t *, char *, char *);
- extern Agsym_t *agfindattr(void *, char *);
- extern Agsym_t *agfstattr(void *);
- extern Agsym_t *agnxtattr(void *, Agsym_t *);
- extern Agsym_t *aglstattr(void *);
- extern Agsym_t *agprvattr(void *, Agsym_t *);
- extern int agcopyattr(void *, void *);
-
- typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
- typedef int (*agusererrf) (char*);
- extern agerrlevel_t agerrno;
- extern void agseterr(agerrlevel_t);
- extern char *aglasterr(void);
- extern int agerr(agerrlevel_t level, char *fmt, ...);
- extern void agerrorf(const char *fmt, ...);
- extern void agwarningf(char *fmt, ...);
- extern agusererrf agseterrf(agusererrf);
-
- extern char *agstrdup(char *);
- extern char *agstrdup_html(char *s);
- extern void agstrfree(char *);
-
- typedef enum { AGNODE = 1, AGEDGE, AGGRAPH } agobjkind_t;
-#define agobjkind(p) ((agobjkind_t)(((Agraph_t*)(p))->tag))
-
-#define agmetanode(g) ((g)->meta_node)
-
-#undef extern
-#if defined(_PACKAGE_ast)
- _END_EXTERNS_
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif /* _GRAPH_H */
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="graph"
- ProjectGUID="{A8018B47-1FB9-4966-A02C-1F64D65C33C9}"
- RootNamespace="graph"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GRAPH_EXPORTS;WIN32_DLL;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="0"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib gtk-win32-2.0.lib asprintf.lib atk-1.0.lib bz2.lib cairo.lib charset.lib croco-0.6.lib expat.lib expatw.lib glade-2.0.lib fontconfig.lib freetype.lib gdk_pixbuf-2.0.lib gdkglext-win32-1.0.lib gdk-win32-2.0.lib glib-2.0.lib gmodule-2.0.lib gobject-2.0.lib gsf-1.lib gsf-win32-1.lib gthread-2.0.lib gtkglext-win32-1.0.lib iconv.lib intl.lib jpeg.lib libexpat.lib libexpatw.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib popt.lib rsvg-2.lib tiff.lib xml2.lib libgdkglext-win32-1.0.dll.a libgtkglext-win32-1.0.dll.a glu32.lib opengl32.lib ltdl.lib zdll.lib cdt.lib $(NOINHERIT)"
- OutputFile="c:/graphviz-ms/bin/$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="C:\graphviz-ms\bin;C:\gtk\lib"
- ModuleDefinitionFile="graph.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GRAPH_EXPORTS;WIN32_DLL;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="0"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib gtk-win32-2.0.lib asprintf.lib atk-1.0.lib bz2.lib cairo.lib charset.lib croco-0.6.lib expat.lib expatw.lib glade-2.0.lib fontconfig.lib freetype.lib gdk_pixbuf-2.0.lib gdkglext-win32-1.0.lib gdk-win32-2.0.lib glib-2.0.lib gmodule-2.0.lib gobject-2.0.lib gsf-1.lib gsf-win32-1.lib gthread-2.0.lib gtkglext-win32-1.0.lib iconv.lib intl.lib jpeg.lib libexpat.lib libexpatw.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib popt.lib rsvg-2.lib tiff.lib xml2.lib libgdkglext-win32-1.0.dll.a libgtkglext-win32-1.0.dll.a glu32.lib opengl32.lib ltdl.lib zdll.lib cdt.lib $(NOINHERIT)"
- OutputFile="c:/graphviz-ms/bin/$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="C:\graphviz-ms\bin;C:\gtk\lib"
- ModuleDefinitionFile="graph.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\agxbuf.h"
- >
- </File>
- <File
- RelativePath=".\graph.h"
- >
- </File>
- <File
- RelativePath=".\libgraph.h"
- >
- </File>
- <File
- RelativePath=".\parser.h"
- >
- </File>
- <File
- RelativePath=".\triefa.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\agxbuf.c"
- >
- </File>
- <File
- RelativePath=".\attribs.c"
- >
- </File>
- <File
- RelativePath=".\edge.c"
- >
- </File>
- <File
- RelativePath=".\graph.c"
- >
- </File>
- <File
- RelativePath=".\graph.def"
- >
- </File>
- <File
- RelativePath=".\graphio.c"
- >
- </File>
- <File
- RelativePath=".\lexer.c"
- >
- </File>
- <File
- RelativePath=".\node.c"
- >
- </File>
- <File
- RelativePath=".\parser.c"
- >
- </File>
- <File
- RelativePath=".\refstr.c"
- >
- </File>
- <File
- RelativePath=".\trie.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-#include "libgraph.h"
-
-typedef struct printdict_t {
- Dict_t *nodesleft, *edgesleft, *subgleft, *e_insubg, *n_insubg;
-} printdict_t;
-
-/*
- * memgets - same api as gets
- *
- * gets one line at a time from a memory buffer and places it in a user buffer
- * up to a maximum of n characters
- *
- * returns pointer to obtained line in user buffer, or
- * returns NULL when last line read from memory buffer
- */
-static char *memgets(char *ubuf, int n, FILE * mbuf)
-{
- static char *mempos;
- char *to, *clp; /* clp = current line pointer */
- int i;
-
- if (!n) { /* a call with n==0 (from aglexinit) resets */
- mempos = (char *) mbuf; /* cast from FILE* required by API */
- }
-
- clp = to = ubuf;
- for (i = 0; i < n - 1; i++) { /* leave room for terminator */
- if (*mempos == '\0') {
- if (i) { /* if mbuf doesn't end in \n, provide one */
- *to++ = '\n';
- } else { /* all done */
- clp = NULL;
- mempos = NULL;
- }
- break; /* last line or end-of-buffer */
- }
- if (*mempos == '\n') {
- *to++ = *mempos++;
- break; /* all done with this line */
- }
- *to++ = *mempos++; /* copy character */
- }
- *to++ = '\0'; /* place terminator in ubuf */
- return clp;
-}
-
-static Agraph_t*
-finish (int rv, Agraph_t *g)
-{
- if (rv) {
- if (g) agclose (g);
- return NULL;
- }
- else
- return g;
-}
-
-Agraph_t *agread(FILE * fp)
-{
- int rv;
- aglexinit(fp, NULL); /* use fgets from current io discipline */
- rv = agparse();
- return finish(rv, AG.parsed_g);
-}
-
-Agraph_t *agmemread(char *cp)
-{
- int rv;
- gets_f savefgets = AG.fgets;
-
- AG.fgets = memgets; /* memgets defined above */
- /* cast cp into a file pointer */
- aglexinit((FILE *) cp, NULL);
- rv = agparse();
- AG.fgets = savefgets;
- return finish(rv, AG.parsed_g);
-}
-
-Agraph_t *agread_usergets(FILE * fp, gets_f usergets)
-{
- int rv;
- gets_f savefgets = AG.fgets;
-
- AG.fgets = usergets; /* usergets provided externally */
- aglexinit(fp, NULL);
- rv = agparse();
- AG.fgets = savefgets;
- return finish(rv, AG.parsed_g);
-}
-
-static int
-_is_number_char(char c)
-{
- return (isdigit(c) || (c == '.'));
-}
-
-/* _agstrcanon:
- * Canonicalize an ordinary string if necessary.
- */
-static char*
-_agstrcanon (char* arg, char* buf)
-{
- char *s = arg;
- unsigned char uc;
- char *p = buf;
- int cnt = 0, dotcnt = 0;
- int has_special = FALSE;
- int maybe_num;
- int backslash_pending = FALSE;
-
- if (ISEMPTYSTR(arg))
- return "\"\"";
- *p++ = '\"';
- uc = *(unsigned char *) s++;
- maybe_num = _is_number_char(uc) || (uc == '-');
- while (uc) {
- if (uc == '\"') {
- *p++ = '\\';
- has_special = TRUE;
- }
- else if (maybe_num) {
- if (uc == '-') {
- if (cnt) {
- maybe_num = FALSE;
- has_special = TRUE;
- }
- }
- else if (uc == '.') {
- if (dotcnt++) {
- maybe_num = FALSE;
- has_special = TRUE;
- }
- }
- else if (!isdigit(uc)) {
- maybe_num = FALSE;
- has_special = TRUE;
- }
- }
- else if (!ISALNUM(uc))
- has_special = TRUE;
- *p++ = (char) uc;
- uc = *(unsigned char *) s++;
- cnt++;
- if (uc && backslash_pending && !((_is_number_char(p[-1]) || isalpha(p[-1]) || (p[-1] == '\\')) && (_is_number_char(uc) || isalpha(uc)))) {
- *p++ = '\\';
- *p++ = '\n';
- has_special = TRUE;
- backslash_pending = FALSE;
- } else if (uc && cnt % SMALLBUF == 0) {
- if (!((_is_number_char(p[-1]) || isalpha(p[-1]) || (p[-1] == '\\')) && (_is_number_char(uc) || isalpha(uc)))) {
- *p++ = '\\';
- *p++ = '\n';
- has_special = TRUE;
- } else {
- backslash_pending = TRUE;
- }
- }
- }
- *p++ = '\"';
- *p = '\0';
- if (has_special || ((cnt == 1) && ((*arg == '.') || (*arg == '-'))))
- return buf;
-
- /* use quotes to protect tokens (example, a node named "node") */
- if (agtoken(arg) >= 0)
- return buf;
- return arg;
-}
-
-/* agstrcanon:
- * handles both html and ordinary strings.
- * canonicalize a string for printing.
- * changes to the semantics of this function
- * also involve the string scanner in lexer.c
- * Unsafe if buf is not large enough.
- */
-char *agstrcanon(char *arg, char *buf)
-{
- char *s = arg;
- char *p = buf;
-
- if (aghtmlstr(arg)) {
- *p++ = '<';
- while (*s)
- *p++ = *s++;
- *p++ = '>';
- *p = '\0';
- return buf;
- }
- else
- return (_agstrcanon(arg, buf));
-}
-
-void agsetiodisc(
- char * (*myfgets) (char *s, int size, FILE *stream),
- size_t (*myfwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream),
- int (*myferror) (FILE *stream)
-)
-{
- if (myfgets) AG.fgets = myfgets;
- if (myfwrite) AG.fwrite = myfwrite;
-#if defined(__SUNPRO_C) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__FreeBSD__)
-#undef ferror
-#endif
- if (myferror) AG.ferror = myferror;
-}
-
-
-int agputs(const char *s, FILE *fp)
-{
- size_t len = strlen(s);
-
- if (AG.fwrite(s, sizeof(char), len, fp) != len) {
- return EOF;
- }
- return +1;
-}
-
-int agputc(int c, FILE *fp)
-{
- const char cc = c;
-
- if (AG.fwrite (&cc, sizeof(char), 1, fp) != 1) {
- return EOF;
- }
- return c;
-}
-
-static void tabover(FILE * fp, int tab)
-{
- while (tab--)
- agputc('\t', fp);
-}
-
-static char *getoutputbuffer(char *str)
-{
- static char *rv;
- static int len;
- int req;
-
- req = MAX(2 * strlen(str) + 2, BUFSIZ);
- if (req > len) {
- if (rv)
- rv = (char*)realloc(rv, req);
- else
- rv = (char*)malloc(req);
- len = req;
- }
- return rv;
-}
-
-/* agcanonical:
- * Safe version of agstrcanon.
- */
-char*
-agcanonical(char *str)
-{
- return agstrcanon(str, getoutputbuffer(str));
-}
-
-/* agcanon:
- * Safe version of agstrcanon but using only double quotes.
- * Any string can be used, but there is no check for html strings.
- */
-char*
-agcanon(char *str)
-{
- return _agstrcanon(str, getoutputbuffer(str));
-}
-
-static void write_dict(Agdict_t * dict, FILE * fp)
-{
- int i, cnt = 0;
- Agsym_t *a;
-
- for (i = 0; i < dtsize(dict->dict); i++) {
- a = dict->list[i];
- if (ISEMPTYSTR(a->value) == FALSE) {
- if (cnt++ == 0) {
- agputc('\t', fp);
- agputs(dict->name, fp);
- agputs(" [", fp);
- }
- else {
- agputs(", ", fp);
- }
- agputs(a->name, fp);
- agputc('=', fp);
- agputs(agcanonical(a->value), fp);
- }
- }
- if (cnt > 0)
- agputs("];\n", fp);
-}
-
-static void write_diffattr(FILE * fp, int indent, void *obj, void *par,
- Agdict_t * dict)
-{
- Agsym_t *a;
- int i;
- char *p, *q;
- int cnt = 0;
-
- for (i = 0; i < dtsize(dict->dict); i++) {
- a = dict->list[i];
- if (a->printed == FALSE)
- continue;
- p = agxget(obj, a->index);
- if (par)
- q = agxget(par, a->index);
- else
- q = a->value;
- if (strcmp(p, q)) {
- if (cnt++ == 0) {
- tabover(fp, indent);
- agputs(dict->name, fp);
- agputs(" [", fp);
- } else {
- agputs(",\n", fp);
- tabover(fp, indent + 1);
- }
- agputs(agcanonical(a->name), fp);
- agputc('=', fp);
- agputs(agcanonical(p), fp);
- }
- }
- if (cnt > 0)
- agputs("];\n", fp);
-}
-
-static void writeattr(FILE * fp, int *npp, char *name, char *val)
-{
- agputs(++(*npp) > 1 ? ", " : " [", fp);
- agputs(agcanonical(name), fp);
- agputc('=', fp);
- agputs(agcanonical(val), fp);
-}
-
-void agwrnode(Agraph_t * g, FILE * fp, Agnode_t * n, int full, int indent)
-{
- char *myval, *defval;
- int i, didwrite = FALSE;
- int nprint = 0;
- Agdict_t *d = n->graph->univ->nodeattr;
- Agsym_t *a;
-
- if (full) {
- for (i = 0; i < dtsize(d->dict); i++) {
- a = d->list[i];
- if (a->printed == FALSE)
- continue;
- myval = agget(n, a->name);
- if (g == n->graph)
- defval = a->value;
- else
- defval = agget(g->proto->n, a->name);
- if (strcmp(defval, myval)) {
- if (didwrite == FALSE) {
- tabover(fp, indent);
- agputs(agcanonical(n->name), fp);
- didwrite = TRUE;
- }
- writeattr(fp, &nprint, a->name, myval);
- }
- }
- if (didwrite) {
- agputs(nprint > 0 ? "];\n" : ";\n", fp);
- return;
- }
- }
- if ((agfstout(g, n) == NULL) && (agfstin(g, n) == NULL)) {
- tabover(fp, indent);
- agputs(agcanonical(n->name), fp);
- agputs(";\n", fp);
- }
-}
-
-/* writenodeandport:
- */
-static void writenodeandport(FILE * fp, char *node, char *port)
-{
- char *ss;
- agputs(agcanonical(node), fp); /* slimey i know */
- if (port && *port) {
- if (aghtmlstr(port)) {
- agputc(':', fp);
- agputs(agstrcanon(port, getoutputbuffer(port)), fp);
- }
- else {
- ss = strchr (port, ':');
- if (ss) {
- *ss = '\0';
- agputc(':', fp);
- agputs(_agstrcanon(port, getoutputbuffer(port)), fp);
- agputc(':', fp);
- agputs(_agstrcanon(ss+1, getoutputbuffer(ss+1)), fp);
- *ss = ':';
- }
- else {
- agputc(':', fp);
- agputs(_agstrcanon(port, getoutputbuffer(port)), fp);
- }
- }
- }
-}
-
-void agwredge(Agraph_t * g, FILE * fp, Agedge_t * e, int list_all)
-{
- char *myval, *defval, *tport, *hport;
- int i, nprint = 0;
- Agdict_t *d = e->tail->graph->univ->edgeattr;
- Agsym_t *a;
-
- if (e->attr) {
- tport = e->attr[TAILX];
- hport = e->attr[HEADX];
- }
- else tport = hport = "";
- writenodeandport(fp, e->tail->name, tport);
- agputs(((g->kind & AGFLAG_DIRECTED) ? " -> " : " -- "), fp);
- writenodeandport(fp, e->head->name, hport);
- if (list_all) {
- for (i = 0; i < dtsize(d->dict); i++) {
- a = d->list[i];
- if ((a->printed == FALSE)
- || ((i == KEYX) && (e->printkey != MUSTPRINT)))
- continue;
- myval = agget(e, a->name);
- if (g == g->root)
- defval = a->value;
- else
- defval = agget(g->proto->e, a->name);
- if (strcmp(defval, myval))
- writeattr(fp, &nprint, a->name, myval);
- }
- }
- agputs(nprint > 0 ? "];\n" : ";\n", fp);
-}
-
-Dtdisc_t agEdgedisc = {
- offsetof(Agedge_t, id),
- sizeof(int),
- -1,
- NIL(Dtmake_f),
- NIL(Dtfree_f),
- (Dtcompar_f) agcmpid,
- NIL(Dthash_f),
- NIL(Dtmemory_f),
- NIL(Dtevent_f)
-};
-static void
-write_subg(Agraph_t * g, FILE * fp, Agraph_t * par, int indent,
- printdict_t * state)
-{
- Agraph_t *subg, *meta;
- Agnode_t *n, *pn;
- Agedge_t *e, *pe;
- Dict_t *save_e, *save_n;
-
- if (indent) {
- tabover(fp, indent++);
- if (dtsearch(state->subgleft, g->meta_node)) {
- if (strncmp(g->name, "_anonymous", 10)) {
- agputs("subgraph ", fp);
- agputs(agcanonical(g->name), fp);
- agputs(" {\n", fp);
- }
- else {
- agputs("{\n", fp); /* no name printed for anonymous subg */
- }
- write_diffattr(fp, indent, g, par, g->univ->globattr);
- /* The root node and edge environment use the dictionaries,
- * not the proto node or edge, so the next level down must
- * record differences with the dictionaries.
- */
- if (par == g->root) {
- pn = NULL;
- pe = NULL;
- } else {
- pn = par->proto->n;
- pe = par->proto->e;
- }
- write_diffattr(fp, indent, g->proto->n, pn, g->univ->nodeattr);
- write_diffattr(fp, indent, g->proto->e, pe, g->univ->edgeattr);
- dtdelete(state->subgleft, g->meta_node);
- } else {
- agputs("subgraph ", fp);
- agputs(agcanonical(g->name), fp);
- agputs(";\n", fp);
- return;
- }
- } else
- write_diffattr(fp, ++indent, g, NULL, g->univ->globattr);
-
- save_n = state->n_insubg;
- save_e = state->e_insubg;
- meta = g->meta_node->graph;
- state->n_insubg = dtopen(&agNamedisc, Dttree);
- state->e_insubg = dtopen(&agOutdisc, Dttree);
- for (e = agfstout(meta, g->meta_node); e; e = agnxtout(meta, e)) {
- subg = agusergraph(e->head);
- write_subg(subg, fp, g, indent, state);
- }
- for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- if (dtsearch(state->nodesleft, n)) {
- agwrnode(g, fp, n, TRUE, indent);
- dtdelete(state->nodesleft, n);
- } else {
- if (dtsearch(state->n_insubg, n) == NULL) {
- agwrnode(g, fp, n, FALSE, indent);
- }
- }
- dtinsert(save_n, n);
- }
-
- dtdisc(g->outedges, &agEdgedisc, 0); /* sort by id */
- for (e = (Agedge_t *) dtfirst(g->outedges); e;
- e = (Agedge_t *) dtnext(g->outedges, e)) {
- if (dtsearch(state->edgesleft, e)) {
- tabover(fp, indent);
- agwredge(g, fp, e, TRUE);
- dtdelete(state->edgesleft, e);
- } else {
- if (dtsearch(state->e_insubg, e) == NULL) {
- tabover(fp, indent);
- agwredge(g, fp, e, FALSE);
- }
- }
- dtinsert(save_e, e);
- }
- dtdisc(g->outedges, &agOutdisc, 0); /* sort by name */
- dtclose(state->n_insubg);
- state->n_insubg = save_n;
- dtclose(state->e_insubg);
- state->e_insubg = save_e;
-
- if (indent > 1) {
- tabover(fp, indent - 1);
- agputs("}\n", fp);
- }
-}
-
-static Dict_t *Copy;
-static int copydictf(Dict_t * d, void *a, void *ignored)
-{
- dtinsert(Copy, (Agsym_t *) a);
- return 0;
-}
-
-static void copydict(Dict_t * from, Dict_t * to)
-{
- Copy = to;
- dtwalk(from, copydictf, 0);
-}
-
-static printdict_t *new_printdict_t(Agraph_t * g)
-{
- printdict_t *rv = NEW(printdict_t);
- rv->nodesleft = dtopen(&agNodedisc, Dttree);
- copydict(g->nodes, rv->nodesleft);
- rv->edgesleft = dtopen(&agEdgedisc, Dttree);
- copydict(g->outedges, rv->edgesleft);
- rv->n_insubg = dtopen(&agNodedisc, Dttree);
- rv->e_insubg = dtopen(&agOutdisc, Dttree);
- rv->subgleft = dtopen(&agNodedisc, Dttree);
- copydict(g->meta_node->graph->nodes, rv->subgleft);
- return rv;
-}
-
-static void free_printdict_t(printdict_t * dict)
-{
- dtclose(dict->nodesleft);
- dtclose(dict->n_insubg);
- dtclose(dict->edgesleft);
- dtclose(dict->e_insubg);
- dtclose(dict->subgleft);
- free(dict);
-}
-
-#ifdef ferror
-/* if ferror is a macro (__SUNPRO_C __CYGWIN__ __MINGW32__ __FreeBSD__ and poss others)
- * then wrap it in a function */
-static int agferror(FILE *stream)
-{
- return ferror(stream);
-}
-#endif
-
-
-int agwrite(Agraph_t * g, FILE * fp)
-{
- printdict_t *p;
-
- if (AG.fwrite == NULL) {
- AG.fwrite = fwrite; /* init to system version of fwrite() */
- }
- if (AG.ferror == NULL) {
-#ifdef ferror
-#undef ferror
- /* if ferror is a macro, then use our wrapper function, but
- * undef the macro first so it doesn't subst in "AG.ferror" */
- AG.ferror = agferror; /* init to ferror macro wrapper function */
-#else
- AG.ferror = ferror; /* init to system version of ferror() */
-#endif
- }
-
- /* write the graph header */
- agputs((AG_IS_STRICT(g)) ? "strict " : "", fp);
- agputs((AG_IS_DIRECTED(g)) ? "digraph" : "graph", fp);
- if (strncmp(g->name, "_anonymous", 10)) {
- agputc(' ', fp);
- agputs(agcanonical(g->name), fp);
- }
- agputs(" {\n", fp);
-
- /* write the top level attribute defs */
- write_dict(g->univ->globattr, fp);
- write_dict(g->univ->nodeattr, fp);
- write_dict(g->univ->edgeattr, fp);
-
- /* write the graph contents */
- p = new_printdict_t(g);
- write_subg(g, fp, (Agraph_t *) 0, 0, p);
- agputs("}\n", fp);
- free_printdict_t(p);
- return AG.ferror(fp);
-}
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include "libgraph.h"
-#include "parser.h"
-#include "triefa.cP"
-#include "agxbuf.h"
-
-#define InfileName (InputFile?InputFile:"<unknown>")
-
-static FILE *Lexer_fp;
-static char *LexPtr, *TokenBuf;
-static int LineBufSize;
-static unsigned char In_comment;
-static unsigned char Comment_start;
-static unsigned char Start_html_string;
-int Line_number;
-static char *InputFile;
-static int agmaxerr;
-
-static void
-storeFileName (char* fname, int len)
-{
- static int cnt;
- static char* buf;
-
- if (len > cnt) {
- if (cnt) buf = (char*)realloc (buf, len+1);
- else buf = (char*)malloc (len+1);
- cnt = len;
- }
- strcpy (buf, fname);
- InputFile = buf;
-}
-
- /* Reset line number.
- * Argument n is indexed from 1, so we decrement it.
- */
-void agreadline(int n)
-{
- Line_number = n - 1;
-}
-
-int aglinenumber ()
-{
- return Line_number;
-}
-
- /* (Re)set file:
- */
-void agsetfile(char *f)
-{
- InputFile = f;
- Line_number = 0;
-}
-
-void aglexinit(FILE * fp, gets_f mygets)
-{
- if (Lexer_fp != fp)
- LexPtr = NULL;
- Lexer_fp = fp;
- if (mygets)
- AG.fgets = mygets;
- if (AG.fgets == NULL)
- AG.fgets = fgets;
- if (AG.linebuf == NULL) {
- LineBufSize = BUFSIZ;
- AG.linebuf = N_NEW(LineBufSize, char);
- TokenBuf = N_NEW(LineBufSize, char);
- }
- AG.fgets (AG.linebuf, 0, fp); /* reset mygets */
- AG.syntax_errors = 0;
-}
-
-#define ISSPACE(c) ((c != 0) && ((isspace(c) || iscntrl(c))))
-
-/* skip leading white space and comments in a string p
- * whitespace includes control characters
- */
-static char *skip_wscomments(char *pp)
-{
- unsigned char *p = (unsigned char *) pp;
- do {
- while (ISSPACE(*p))
- p++;
- while (In_comment && p[0]) {
- while (p[0] && (p[0] != '*'))
- p++;
- if (p[0]) {
- if (p[1] == '/') {
- In_comment = FALSE;
- p += 2;
- break;
- } else
- p++;
- }
- }
- if (p[0] == '/') {
- if (p[1] == '/')
- while (*p)
- p++; /* skip to end of line */
- else {
- if (p[1] == '*') {
- In_comment = TRUE;
- Comment_start = Line_number;
- p += 2;
- continue;
- } else
- break; /* return a slash */
- }
- } else {
- if (!ISSPACE(*p))
- break;
- }
- } while (p[0]);
- return (char *) p;
-}
-
-/* scan an unquoted token and return the position after its terminator */
-static char *scan_token(unsigned char *p, unsigned char *token)
-{
- unsigned char *q;
-
- q = token;
- if (p == '\0')
- return NULL;
- while (ISALNUM(*p)) {
- *q++ = *p++;
- }
- *q = '\0';
- return p;
-}
-
-static char *scan_num(char *p, char *token)
-{
- unsigned char *q, *z;
- int saw_rp = FALSE;
- int saw_digit = FALSE;
-
- z = (unsigned char *) p;
- q = (unsigned char *) token;
- if (*z == '-')
- *q++ = *z++;
- if (*z == '.') {
- saw_rp = TRUE;
- *q++ = *z++;
- }
- while (isdigit(*z)) {
- saw_digit = TRUE;
- *q++ = *z++;
- }
- if ((*z == '.') && (saw_rp == FALSE)) {
- saw_rp = TRUE;
- *q++ = *z++;
- while (isdigit(*z)) {
- saw_digit = TRUE;
- *q++ = *z++;
- }
- }
- *q = '\0';
- if (saw_digit && *z && ((isalpha(*z)) || (*z == '_'))) {
- unsigned char *endp = z + 1;
- unsigned char c;
- while ((c = *endp) && ((isalpha(c)) || (c == '_')))
- endp++;
- *endp = '\0';
- agerr(AGWARN,
- "%s:%d: ambiguous \"%s\" splits into two names: \"%s\" and \"%s\"\n",
- InfileName, Line_number, p, token, z);
- *endp = c;
- }
-
- if (saw_digit == FALSE)
- z = NULL;
- return (char *) z;
-}
-
-/* scan a quoted string and return the position after its terminator */
-static char *quoted_string(char *p, char *token)
-{
- char quote, *q;
-
- quote = *p++;
- q = token;
- while ((*p) && (*p != quote)) {
- if (*p == '\\') {
- if (*(p + 1) == quote)
- p++;
- else {
- if (*(p + 1) == '\\')
- *q++ = *p++;
- }
- }
- *q++ = *p++;
- }
- if (*p == '\0')
- agerr(AGWARN, "%s:%d: string ran past end of line\n",
- InfileName, Line_number);
- else
- p++;
- *q = 0;
- return p;
-}
-
-int myaglex(void)
-{ /* for debugging */
- int rv = aglex();
- fprintf(stderr, "returning %d\n", rv);
- if (rv == T_symbol)
- fprintf(stderr, "string val is %s\n", aglval.str);
- return rv;
-}
-
-/*
- * Return a logical line in AG.linebuf.
- * In particular, the buffer will contain a '\n' as the last non-null char.
- * Ignore lines beginning with '#'; update cpp line number if applicable.
- * Fold long lines, i.e., ignore escaped newlines.
- * Assume the AG.fgets function reads up to newline or buffer length
- * like fgets.
- * Need to be careful that AG.fgets might not return full physical line
- * because buffer is too small to hold it.
- */
-static char *lex_gets(void)
-{
- char *clp;
- int len, curlen;
-
- len = curlen = 0;
-
- do {
- /* make sure there is room for at least another SMALLBUF worth */
- if (curlen + SMALLBUF >= LineBufSize) {
- LineBufSize += BUFSIZ;
- AG.linebuf = (char*)realloc(AG.linebuf, LineBufSize);
- TokenBuf = (char*)realloc(TokenBuf, LineBufSize);
- }
-
- /* off by one so we can back up in LineBuf */
- clp = AG.fgets (AG.linebuf + curlen + 1,
- LineBufSize - curlen - 1, Lexer_fp);
- if (clp == NULL)
- break;
-
-
- len = strlen(clp); /* since clp != NULL, len > 0 */
- if (clp[len - 1] == '\n') { /* have physical line */
- if ((clp[0] == '#') && (curlen == 0)) {
- /* comment line or cpp line sync */
- int r, cnt;
- char buf[2];
- char* s = clp + 1;
-
- if (strncmp(s, "line", 4) == 0) s += 4;
- r = sscanf(s, "%d %1[\"]%n", &Line_number, buf, &cnt);
- if (r <= 0) Line_number++;
- else { /* got line number */
- Line_number--;
- if (r > 1) { /* saw quote */
- char* p = s + cnt;
- char* e = p;
- while (*e && (*e != '"')) e++;
- if (e != p) {
- *e = '\0';
- storeFileName (p, e-p);
- }
- }
- }
- clp[0] = 0;
- len = 1; /* this will make the while test below succeed */
- continue;
- }
- Line_number++;
- /* Note it is possible len == 1 and last character in
- * previous read was '\\'
- * It is also possible to have curlen=0, and read in
- * "\\\n".
- */
- if (clp[len - 2] == '\\') { /* escaped newline */
- len = len - 2;
- clp[len] = '\0';
- }
- }
- curlen += len;
- /* the following test relies on having AG.linebuf[0] == '\0' */
- } while (clp[len - 1] != '\n');
-
- if (curlen > 0)
- return AG.linebuf + 1;
- else
- return NULL;
-}
-
-/* html_pair:
- * Iteratively scan nested "<...>"
- * p points to first character after initial '<'
- * Store characters up to but not including matching '>'
- * Return pointer to matching '>'
- * We do not check for any escape sequences; pure HTML is
- * expected, so special characters need to be HTML escapes.
- * We read them in and allow the HTML parser to convert them.
- */
-static char *html_pair(char *p, agxbuf * tokp)
-{
- unsigned char c;
- int rc, depth = 1;
-
- while (1) {
- while ((c = *p)) {
- if (c == '>') {
- depth--;
- if (depth == 0)
- return p; /* p points to closing > */
- } else if (c == '<')
- depth++;
- rc = agxbputc(tokp, c);
- p++;
- }
- if ((p = lex_gets()) == NULL) {
- agerr(AGWARN,
- "non-terminated HTML string starting line %d, file %s\n",
- Start_html_string, InfileName);
- return 0;
- }
- }
-}
-
-/* html_string:
- * scan an html string and return the position after its terminator
- * The string is stored in token.
- * p points to the opening <.
- */
-
-static char *html_string(char *p, agxbuf * token)
-{
- Start_html_string = Line_number;
- p = html_pair(p + 1, token);
- if (p)
- p++; /* skip closing '>' */
- return p;
-}
-
-int agtoken(char *p)
-{
- char ch;
- TFA_Init();
- while ((ch = *p)) {
- /* any non-ascii characters converted to ascii DEL (127) */
- TFA_Advance(ch & ~127 ? 127 : ch);
- p++;
- }
- return TFA_Definition();
-}
-
-int aglex(void)
-{
- int token;
- char *tbuf, *p;
- static unsigned char BOM[] = { 0xEF, 0xBB, 0xBF }; /* UTF-8 byte order marker */
-
- /* if the parser has accepted a graph, reset and return EOF */
- if (AG.accepting_state) {
- AG.accepting_state = FALSE;
- return EOF;
- }
-
- /* get a nonempty lex buffer */
- do {
- if ((LexPtr == NULL) || (LexPtr[0] == '\0'))
- if ((LexPtr = lex_gets()) == NULL) {
- if (In_comment)
- agerr(AGWARN, "nonterminated comment in line %d\n",
- Comment_start);
- return EOF;
- }
- /* skip UTF-8 Byte Order Marker if at beginning of file */
- if ((Line_number == 1) && !strncmp(LexPtr, (char *) BOM, 3))
- LexPtr += 3;
- LexPtr = (char *) skip_wscomments(LexPtr);
- } while (LexPtr[0] == '\0');
-
- tbuf = TokenBuf;
-
- /* scan quoted strings */
- if (LexPtr[0] == '\"') {
- LexPtr = quoted_string(LexPtr, tbuf);
- aglval.str = agstrdup(tbuf);
- return T_qsymbol;
- }
-
- /* scan HTML strings */
- if (LexPtr[0] == '<') {
- agxbuf xb;
- unsigned char htmlbuf[BUFSIZ];
- agxbinit(&xb, BUFSIZ, htmlbuf);
- LexPtr = html_string(LexPtr, &xb);
- aglval.str = agstrdup_html(agxbuse(&xb));
- agxbfree(&xb);
- return T_symbol;
- }
-
- /* scan edge operator */
- if (AG.edge_op
- && (strncmp(LexPtr, AG.edge_op, strlen(AG.edge_op)) == 0)) {
- LexPtr += strlen(AG.edge_op);
- return T_edgeop;
- }
-
- /* scan numbers */
- if ((p = scan_num(LexPtr, tbuf))) {
- LexPtr = p;
- aglval.str = agstrdup(tbuf);
- return T_symbol;
- } else {
- unsigned char uc = *(unsigned char *) LexPtr;
- if (ispunct(uc) && (uc != '_'))
- return *LexPtr++;
- else
- LexPtr = scan_token(LexPtr, tbuf);
- }
-
- /* scan other tokens */
- token = agtoken(tbuf);
- if (token == -1) {
- aglval.str = agstrdup(tbuf);
- token = T_symbol;
- }
- return token;
-}
-
-static void error_context(void)
-{
- char *p;
- char c;
- char *buf = AG.linebuf + 1; /* characters are always put at AG.linebuf[1] */
- /* or later; AG.linebuf[0] = '\0' */
-
- if (LexPtr == NULL)
- return;
- agerr(AGPREV, "context: ");
- for (p = LexPtr - 1; (p > buf) && (!isspace(*(unsigned char *) p));
- p--);
- if (buf < p) {
- c = *p;
- *p = '\0';
- agerr(AGPREV, "%s", buf);
- *p = c;
- }
- agerr(AGPREV, " >>> ");
- c = *LexPtr;
- *LexPtr = '\0';
- agerr(AGPREV, "%s", p);
- *LexPtr = c;
- agerr(AGPREV, " <<< ");
- agerr(AGPREV, "%s", LexPtr);
-}
-
-void agerror(char *msg)
-{
- if (AG.syntax_errors++)
- return;
- agerr(AGERR, "%s:%d: %s near line %d\n",
- InfileName, Line_number, msg, Line_number);
- error_context();
-}
-
-agerrlevel_t agerrno; /* Last error */
-static agerrlevel_t agerrlevel = AGWARN; /* Report errors >= agerrlevel */
-static long aglast; /* Last message */
-static FILE *agerrout; /* Message file */
-static agusererrf usererrf; /* User-set error function */
-
-agusererrf
-agseterrf (agusererrf newf)
-{
- agusererrf oldf = usererrf;
- usererrf = newf;
- return oldf;
-}
-
-void agseterr(agerrlevel_t lvl)
-{
- agerrlevel = lvl;
-}
-
-int agerrors(void)
-{
- return MAX(agmaxerr, AG.syntax_errors);
-}
-
-int agreseterrors(void)
-{
- int rc = MAX(agmaxerr, AG.syntax_errors);
- agmaxerr = 0;
- return rc;
-}
-
-char *aglasterr()
-{
- long endpos;
- long len;
- char *buf;
-
- if (!agerrout)
- return 0;
- fflush(agerrout);
- endpos = ftell(agerrout);
- len = endpos - aglast;
- buf = (char*)malloc(len + 1);
- fseek(agerrout, aglast, SEEK_SET);
- fread(buf, sizeof(char), len, agerrout);
- buf[len] = '\0';
- fseek(agerrout, endpos, SEEK_SET);
-
- return buf;
-}
-
-static void
-userout (agerrlevel_t level, const char *fmt, va_list args)
-{
- static char* buf;
- static int bufsz = 1024;
- char* np;
- int n;
-
- if (!buf) {
- buf = (char*)malloc(bufsz);
- if (!buf) {
- fputs("userout: could not allocate memory\n", stderr );
- return;
- }
- }
-
- if (level != AGPREV) {
- usererrf ((level == AGERR) ? "Error" : "Warning");
- usererrf (": ");
- }
-
- while (1) {
- n = vsnprintf(buf, bufsz, fmt, args);
- if ((n > -1) && (n < bufsz)) {
- usererrf (buf);
- break;
- }
- bufsz = MAX(bufsz*2,n+1);
- if ((np = (char*)realloc(buf, bufsz)) == NULL) {
- fputs("userout: could not allocate memory\n", stderr );
- return;
- }
- }
- va_end(args);
-}
-
-/* agerr_va:
- * Main error reporting function
- */
-static int agerr_va(agerrlevel_t level, const char *fmt, va_list args)
-{
- agerrlevel_t lvl;
-
- /* Use previous error level if continuation message;
- * Convert AGMAX to AGERROR;
- * else use input level
- */
- lvl = (level == AGPREV ? agerrno : (level == AGMAX) ? AGERR : level);
-
- /* store this error level and maximum error level used */
- agerrno = lvl;
- agmaxerr = MAX(agmaxerr, agerrno);
-
- /* We report all messages whose level is bigger than the user set agerrlevel
- * Setting agerrlevel to AGMAX turns off immediate error reporting.
- */
- if (lvl >= agerrlevel) {
- if (usererrf)
- userout (level, fmt, args);
- else {
- if (level != AGPREV)
- fprintf(stderr, "%s: ", (level == AGERR) ? "Error" : "Warning");
- vfprintf(stderr, fmt, args);
- va_end(args);
- }
- return 0;
- }
-
- /* If error is not immediately reported, store in log file */
- if (!agerrout) {
- agerrout = tmpfile();
- if (!agerrout)
- return 1;
- }
-
- if (level != AGPREV)
- aglast = ftell(agerrout);
- vfprintf(agerrout, fmt, args);
- va_end(args);
- return 0;
-}
-
-/* agerr:
- * Varargs function for reporting errors with level argument
- */
-int agerr(agerrlevel_t level, char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- return agerr_va(level, fmt, args);
-}
-
-/* agerrorf:
- * Varargs function for reporting errors
- */
-void agerrorf(const char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- agerr_va(AGERR, fmt, args);
-}
-
-/* agwarningf:
- * Varargs function for reporting warnings
- */
-void agwarningf(char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- agerr_va(AGWARN, fmt, args);
-}
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifndef _LIBGRAPH_H
-#define _LIBGRAPH_H 1
-
-#if defined(_PACKAGE_ast)
-#include <ast.h>
-#else
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#if !defined(WIN32)
-#include <unistd.h>
-#endif
-#endif
-#include <ctype.h>
-
-
-#ifndef EXTERN
-#define EXTERN extern
-#endif
-
-#ifndef NIL
-#define NIL(t) ((t)0)
-#endif
-
- void ag_yyerror(char *);
- int ag_yylex(void);
-
- typedef struct Agraphinfo_t {
- char notused;
- } Agraphinfo_t;
- typedef struct Agnodeinfo_t {
- char notused;
- } Agnodeinfo_t;
- typedef struct Agedgeinfo_t {
- char notused;
- } Agedgeinfo_t;
-
-#ifndef _BLD_graph
-#define _BLD_graph 1
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "graph.h"
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#ifdef offsetof
-#undef offsetof
-#endif
-#ifdef HAVE_INTPTR_T
-#define offsetof(typ,fld) ((intptr_t)(&(((typ*)0)->fld)))
-#else
-#define offsetof(typ,fld) ((int)(&(((typ*)0)->fld)))
-#endif
-
-#ifndef NOT
-#define NOT(v) (!(v))
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE NOT(FALSE)
-#endif
-#define NEW(t) (t*)calloc(1,sizeof(t))
-#define N_NEW(n,t) (t*)calloc((n),sizeof(t))
-#define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type)))
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#define SMALLBUF 128
-
-#define ISALNUM(c) ((isalnum(c)) || ((c) == '_') || (!isascii(c)))
-
-#define NOPRINT 0
-#define MULTIPLE 1
-#define MUSTPRINT 2
-
-#define ISEMPTYSTR(s) (((s) == NULL) || (*(s) == '\0'))
-#define NULL_FN(t) (t(*)())0
-#define ZFREE(p) if (p) free(p);
-
-#define TAG_NODE 1
-#define TAG_EDGE 2
-#define TAG_GRAPH 3
-#define TAG_OF(p) (((Agraph_t*)(p))->tag)
-
-#define AGFLAG_STRICT (1<<1)
-#define AGFLAG_METAGRAPH (1<<2)
-#define METAGRAPH (AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH)
-
-#define KEY_ID "key"
-#define KEYX 0
-#define TAILX 1
-#define HEADX 2
-
- EXTERN struct AG_s {
- int graph_nbytes, node_nbytes, edge_nbytes;
- Agraph_t *proto_g, *parsed_g;
- char *edge_op;
- char *linebuf;
- short syntax_errors;
- unsigned char accepting_state, init_called;
- char * (*fgets) (char *s, int size, FILE *stream);
- size_t (*fwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream);
- int (*ferror) (FILE *stream);
- } AG;
-
-/* follow structs used in graph parser */
- typedef struct objport_t {
- void *obj;
- char *port;
- } objport_t;
-
- typedef struct objlist_t {
- objport_t data;
- struct objlist_t *link;
- } objlist_t;
-
- typedef struct objstack_t {
- Agraph_t *subg;
- objlist_t *list, *last;
- int in_edge_stmt;
- struct objstack_t *link;
- } objstack_t;
-
- Agdict_t *agdictof(void *);
- Agnode_t *agidnode(Agraph_t *, int);
- Agdict_t *agNEWdict(char *);
- Agedge_t *agNEWedge(Agraph_t *, Agnode_t *, Agnode_t *, Agedge_t *);
- Agnode_t *agNEWnode(Agraph_t *, char *, Agnode_t *);
- Agsym_t *agNEWsym(Agdict_t *, char *, char *);
- int agcmpid(Dt_t *, int *, int *, Dtdisc_t *);
- int agcmpin(Dt_t *, Agedge_t *, Agedge_t *, Dtdisc_t *);
- int agcmpout(Dt_t *, Agedge_t *, Agedge_t *, Dtdisc_t *);
- void agcopydict(Agdict_t *, Agdict_t *);
- void agDELedge(Agraph_t *, Agedge_t *);
- void agDELnode(Agraph_t *, Agnode_t *);
- void agerror(char *);
- void agFREEdict(Agraph_t *, Agdict_t *);
- void agFREEedge(Agedge_t *);
- void agFREEnode(Agnode_t *);
- void agINSedge(Agraph_t *, Agedge_t *);
- void agINSgraph(Agraph_t *, Agraph_t *);
- void agINSnode(Agraph_t *, Agnode_t *);
- int aglex(void);
- void aglexinit(FILE *, gets_f mygets);
- int agparse(void);
- void agpopproto(Agraph_t *);
- void agpushproto(Agraph_t *);
- int agtoken(char *);
- int aglinenumber(void);
- void agwredge(Agraph_t *, FILE *, Agedge_t *, int);
- void agwrnode(Agraph_t *, FILE *, Agnode_t *, int, int);
- extern Dtdisc_t agNamedisc, agNodedisc, agOutdisc, agIndisc,
- agEdgedisc;
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/@PACKAGE@
-
-Name: libgraph
-Description: Graph library (file i/o, dot language parsing, graph, subgraph, node, edge, attribute, data structure manipulation)
-Version: @VERSION@
-Libs: -L${libdir} -lgraph -lcdt
-Cflags: -I${includedir}
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#include <limits.h>
-
-#include "libgraph.h"
-
-Agnode_t *agfindnode(Agraph_t * g, char *name)
-{
- Agnode_t *rv;
-
- rv = (Agnode_t *) dtmatch(g->univ->node_dict, name);
- if (rv && (g != g->root))
- rv = (Agnode_t *) dtsearch(g->nodes, rv);
- return rv;
-}
-
-Agnode_t *agidnode(Agraph_t * g, int index)
-{
- Agnode_t *rv;
- rv = (Agnode_t *) dtmatch(g->nodes, &index);
- return rv;
-}
-
-Agnode_t *agnode(Agraph_t * g, char *name)
-{
- Agnode_t *n;
- if ((n = agfindnode(g->root, name)) == NULL) {
- n = agNEWnode(g, name, g->proto->n);
- dtinsert(g->univ->node_dict, n);
- }
- agINSnode(g, n);
- return n;
-}
-
-void agINSnode(Agraph_t * g, Agnode_t * n)
-{
- Agraph_t *meta;
- Agedge_t *e;
-
- if (agidnode(g, n->id))
- return;
- dtinsert(g->nodes, n);
- if (AG_IS_METAGRAPH(g) == FALSE) {
- meta = g->meta_node->graph;
- for (e = agfstin(meta, g->meta_node); e; e = agnxtin(meta, e))
- agINSnode(agusergraph(e->tail), n);
- }
-}
-
-void agDELnode(Agraph_t * g, Agnode_t * n)
-{
- Agedge_t *e, *f;
- Agraph_t *meta, *h;
-
- for (e = agfstedge(g, n); e; e = f) {
- f = agnxtedge(g, e, n);
- agDELedge(g, e);
- }
-
- if (AG_IS_METAGRAPH(g) == FALSE) {
- meta = g->meta_node->graph;
- for (e = agfstout(meta, g->meta_node); e; e = agnxtout(meta, e)) {
- h = agusergraph(e->head);
- if (dtsearch(h->nodes, n))
- agDELnode(h, n);
- }
- }
- dtdelete(g->nodes, n);
- if (g == g->root)
- agFREEnode(n);
-}
-
-Agnode_t *agfstnode(Agraph_t * g)
-{
- return (Agnode_t *) dtfirst(g->nodes);
-}
-
-Agnode_t *agnxtnode(Agraph_t * g, Agnode_t * n)
-{
- return (Agnode_t *) dtnext(g->nodes, n);
-}
-
-Agnode_t *aglstnode(Agraph_t * g)
-{
- return (Agnode_t *) dtlast(g->nodes);
-}
-
-Agnode_t *agprvnode(Agraph_t * g, Agnode_t * n)
-{
- return (Agnode_t *) dtprev(g->nodes, n);
-}
-
-Agnode_t *agNEWnode(Agraph_t * subg, char *name, Agnode_t * proto)
-{
- int i, nobj;
- Agnode_t *n;
-
- n = (Agnode_t *) calloc(1, AG.node_nbytes);
- n->tag = TAG_NODE;
- n->name = agstrdup(name);
- n->id = subg->univ->max_node_id++;
- n->graph = subg->root;
- nobj = dtsize(subg->univ->nodeattr->dict);
- if (nobj) {
- n->attr = N_NEW(nobj, char *);
- n->didset = N_NEW((nobj + CHAR_BIT - 1) / CHAR_BIT, char);
- }
- else {
- n->attr = NULL;
- n->didset = NULL;
- }
- for (i = 0; i < nobj; i++)
- n->attr[i] = agstrdup(proto ? proto->attr[i] :
- subg->univ->nodeattr->list[i]->value);
- return n;
-}
-
-void agFREEnode(Agnode_t * n)
-{
- int i, nobj;
- Agdict_t *dict = agdictof(n);
-
- dict = dict;
- dtdelete(n->graph->univ->node_dict, n);
- TAG_OF(n) = -1;
- agstrfree(n->name);
- if (AG_IS_METAGRAPH(n->graph) == FALSE) {
- nobj = dtsize(n->graph->univ->nodeattr->dict);
- for (i = 0; i < nobj; i++)
- agstrfree(n->attr[i]);
- }
- free(n->attr);
- free(n->didset);
- free(n);
-}
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-%{
-
-#include "libgraph.h"
-
-static char *Port;
-static char In_decl,In_edge_stmt;
-static int Current_class,Agraph_type;
-static Agsym_t *headsubsym;
-static Agsym_t *tailsubsym;
-static Agraph_t *G;
-static Agnode_t *N;
-static Agedge_t *E;
-static objstack_t *SP;
-#define GSTACK_SIZE 64
-static Agraph_t *Gstack[GSTACK_SIZE];
-static int GSP;
-
-static void subgraph_warn (void)
-{
- agerr (AGWARN, "The use of \"subgraph %s\", line %d, without a body is deprecated.\n",
- G->name, aglinenumber());
- agerr (AGPREV, "This may cause unexpected behavior or crash the program.\n");
- agerr (AGPREV, "Please use a single definition of the subgraph within the context of its parent graph \"%s\"\n", Gstack[GSP-2]->name);
-}
-
-static int push_subg(Agraph_t *g)
-{
- if (GSP >= GSTACK_SIZE) {
- agerr (AGERR, "Gstack overflow in graph parser\n"); return(1);
- }
- G = Gstack[GSP++] = g;
- return 0;
-}
-
-static Agraph_t *pop_subg(void)
-{
- Agraph_t *g;
- if (GSP == 0) {
- agerr (AGERR, "Gstack underflow in graph parser\n"); return(NULL);
- }
- g = Gstack[--GSP]; /* graph being popped off */
- if (GSP > 0) G = Gstack[GSP - 1]; /* current graph */
- else G = 0;
- return g;
-}
-
-static objport_t pop_gobj(void)
-{
- objport_t rv;
- rv.obj = pop_subg();
- rv.port = NULL;
- return rv;
-}
-
-static void anonname(char* buf)
-{
- static int anon_id = 0;
-
- sprintf(buf,"_anonymous_%d",anon_id++);
-}
-
-static int begin_graph(char *name)
-{
- Agraph_t *g;
- char buf[SMALLBUF];
-
- if (!name) {
- anonname(buf);
- name = buf;
- }
- g = AG.parsed_g = agopen(name,Agraph_type);
- Current_class = TAG_GRAPH;
- headsubsym = tailsubsym = NULL;
- if (push_subg(g)) return 1;
- In_decl = TRUE;
- return 0;
-}
-
-static Agraph_t* end_graph(void)
-{
- return (pop_subg());
-}
-
-static Agnode_t *bind_node(char *name)
-{
- Agnode_t *n = agnode(G,name);
- In_decl = FALSE;
- return n;
-}
-
-static int anonsubg(void)
-{
- char buf[SMALLBUF];
- Agraph_t *subg;
-
- In_decl = FALSE;
- anonname(buf);
- subg = agsubg(G,buf);
- if (push_subg(subg)) return 1;
- else return 0;
-}
-
-#if 0 /* NOT USED */
-static int isanonsubg(Agraph_t *g)
-{
- return (strncmp("_anonymous_",g->name,11) == 0);
-}
-#endif
-
-static void begin_edgestmt(objport_t objp)
-{
- struct objstack_t *new_sp;
-
- new_sp = NEW(objstack_t);
- new_sp->link = SP;
- SP = new_sp;
- SP->list = SP->last = NEW(objlist_t);
- SP->list->data = objp;
- SP->list->link = NULL;
- SP->in_edge_stmt = In_edge_stmt;
- SP->subg = G;
- agpushproto(G);
- In_edge_stmt = TRUE;
-}
-
-static void mid_edgestmt(objport_t objp)
-{
- SP->last->link = NEW(objlist_t);
- SP->last = SP->last->link;
- SP->last->data = objp;
- SP->last->link = NULL;
-}
-
-static int end_edgestmt(void)
-{
- objstack_t *old_SP;
- objlist_t *tailptr,*headptr,*freeptr;
- Agraph_t *t_graph,*h_graph;
- Agnode_t *t_node,*h_node,*t_first,*h_first;
- Agedge_t *e;
- char *tport,*hport;
-
- for (tailptr = SP->list; tailptr->link; tailptr = tailptr->link) {
- headptr = tailptr->link;
- tport = tailptr->data.port;
- hport = headptr->data.port;
- if (TAG_OF(tailptr->data.obj) == TAG_NODE) {
- t_graph = NULL;
- t_first = (Agnode_t*)(tailptr->data.obj);
- }
- else {
- t_graph = (Agraph_t*)(tailptr->data.obj);
- t_first = agfstnode(t_graph);
- }
- if (TAG_OF(headptr->data.obj) == TAG_NODE) {
- h_graph = NULL;
- h_first = (Agnode_t*)(headptr->data.obj);
- }
- else {
- h_graph = (Agraph_t*)(headptr->data.obj);
- h_first = agfstnode(h_graph);
- }
-
- for (t_node = t_first; t_node; t_node = t_graph ?
- agnxtnode(t_graph,t_node) : NULL) {
- for (h_node = h_first; h_node; h_node = h_graph ?
- agnxtnode(h_graph,h_node) : NULL ) {
- e = agedge(G,t_node,h_node);
- if (e) {
- char *tp = tport;
- char *hp = hport;
- if ((e->tail != e->head) && (e->head == t_node)) {
- /* could happen with an undirected edge */
- char *temp;
- temp = tp; tp = hp; hp = temp;
- }
- if (tp && tp[0]) {
- agxset(e,TAILX,tp);
- agstrfree(tp);
- }
- if (hp && hp[0]) {
- agxset(e,HEADX,hp);
- agstrfree(hp);
- }
- }
- }
- }
- }
- tailptr = SP->list;
- while (tailptr) {
- freeptr = tailptr;
- tailptr = tailptr->link;
- if (TAG_OF(freeptr->data.obj) == TAG_NODE)
- free(freeptr);
- }
- if (G != SP->subg) return 1;
- agpopproto(G);
- In_edge_stmt = SP->in_edge_stmt;
- old_SP = SP;
- SP = SP->link;
- In_decl = FALSE;
- free(old_SP);
- Current_class = TAG_GRAPH;
- return 0;
-}
-
-#if 0 /* NOT USED */
-static Agraph_t *parent_of(Agraph_t *g)
-{
- Agraph_t *rv;
- rv = agusergraph(agfstin(g->meta_node->graph,g->meta_node)->tail);
- return rv;
-}
-#endif
-
-static void attr_set(char *name, char *value)
-{
- Agsym_t *ap = NULL;
- char *defval = "";
-
- if (In_decl && (G->root == G)) defval = value;
- switch (Current_class) {
- case TAG_NODE:
- ap = agfindattr(G->proto->n,name);
- if (ap == NULL)
- ap = agnodeattr(AG.parsed_g,name,defval);
- else if (ap->fixed && In_decl)
- return;
- agxset(N,ap->index,value);
- break;
- case TAG_EDGE:
- ap = agfindattr(G->proto->e,name);
- if (ap == NULL)
- ap = agedgeattr(AG.parsed_g,name,defval);
- else if (ap->fixed && In_decl && (G->root == G))
- return;
- agxset(E,ap->index,value);
- break;
- case 0: /* default */
- case TAG_GRAPH:
- ap = agfindattr(G,name);
- if (ap == NULL)
- ap = agraphattr(AG.parsed_g,name,defval);
- else if (ap->fixed && In_decl)
- return;
- agxset(G,ap->index,value);
- break;
- }
-}
-
-/* concat:
- */
-static char*
-concat (char* s1, char* s2)
-{
- char* s;
- char buf[BUFSIZ];
- char* sym;
- int len = strlen(s1) + strlen(s2) + 1;
-
- if (len <= BUFSIZ) sym = buf;
- else sym = (char*)malloc(len);
- strcpy(sym,s1);
- strcat(sym,s2);
- s = agstrdup (sym);
- if (sym != buf) free (sym);
- return s;
-}
-
-/* concat3:
- */
-static char*
-concat3 (char* s1, char* s2, char*s3)
-{
- char* s;
- char buf[BUFSIZ];
- char* sym;
- int len = strlen(s1) + strlen(s2) + strlen(s3) + 1;
-
- if (len <= BUFSIZ) sym = buf;
- else sym = (char*)malloc(len);
- strcpy(sym,s1);
- strcat(sym,s2);
- strcat(sym,s3);
- s = agstrdup (sym);
- if (sym != buf) free (sym);
- return s;
-}
-
-%}
-
-%union {
- int i;
- char *str;
- struct objport_t obj;
- struct Agnode_t *n;
-}
-
-%token <i> T_graph T_digraph T_strict
-%token <i> T_node T_edge T_edgeop
-%token <str> T_symbol T_qsymbol
-%type <str> symbol qsymbol optgraphname
-%type <n> node_name
-%type <obj> node_id subg_stmt
-%left <i> T_subgraph /* to avoid subgraph hdr shift/reduce conflict */
-%left '{'
-%%
-
-file : graph_type optgraphname
- {if (begin_graph($2)) YYABORT; agstrfree($2);}
- '{' stmt_list '}'
- {AG.accepting_state = TRUE; if (!end_graph()) YYABORT;}
- | error
- {
- if (AG.parsed_g)
- agclose(AG.parsed_g);
- AG.parsed_g = NULL;
- }
- | /* empty*/ {AG.parsed_g = NULL;}
- ;
-
-optgraphname: symbol {$$=$1;} | /* empty */ {$$=0;} ;
-
- /* it is safe to change graph type and name before contents appear */
-graph_type : T_graph
- {Agraph_type = AGRAPH; AG.edge_op = "--";}
- | T_strict T_graph
- {Agraph_type = AGRAPHSTRICT; AG.edge_op = "--";}
- | T_digraph
- {Agraph_type = AGDIGRAPH; AG.edge_op = "->";}
- | T_strict T_digraph
- {Agraph_type = AGDIGRAPHSTRICT; AG.edge_op = "->";}
- ;
-
-attr_class : T_graph
- {Current_class = TAG_GRAPH;}
- | T_node
- {Current_class = TAG_NODE; N = G->proto->n;}
- | T_edge
- {Current_class = TAG_EDGE; E = G->proto->e;}
- ;
-
-inside_attr_list : iattr_set optcomma inside_attr_list
- | /* empty */
- ;
-
-optcomma : /* empty */
- | ','
- ;
-
-attr_list : '[' inside_attr_list ']'
- ;
-
-rec_attr_list : rec_attr_list attr_list
- | /* empty */
- ;
-
-opt_attr_list : rec_attr_list
- ;
-
-attr_set : symbol '=' symbol
- {attr_set($1,$3); agstrfree($1); agstrfree($3);}
- ;
-
-iattr_set : attr_set
- | symbol
- {attr_set($1,"true"); agstrfree($1); }
- ;
-
-stmt_list : stmt_list1
- | /* empty */
- ;
-
-stmt_list1 : stmt
- | stmt_list1 stmt
- ;
-
-stmt : stmt1
- | stmt1 ';'
- | error {agerror("syntax error, statement skipped");}
- ;
-
-stmt1 : node_stmt
- | edge_stmt
- | attr_stmt
- | subg_stmt {}
- ;
-
-attr_stmt : attr_class attr_list
- {Current_class = TAG_GRAPH; /* reset */}
- | attr_set
- {Current_class = TAG_GRAPH;}
- ;
-
-node_id : node_name node_port
- {
- objport_t rv;
- rv.obj = $1;
- rv.port = Port;
- Port = NULL;
- $$ = rv;
- }
- ;
-
-node_name : symbol {$$ = bind_node($1); agstrfree($1);}
- ;
-
-node_port : /* empty */
- | ':' symbol { Port=$2;}
- | ':' symbol ':' symbol {Port=concat3($2,":",$4);agstrfree($2); agstrfree($4);}
- ;
-
-node_stmt : node_id
- {Current_class = TAG_NODE; N = (Agnode_t*)($1.obj);}
- opt_attr_list
- {agstrfree($1.port);Current_class = TAG_GRAPH; /* reset */}
- ;
-
-edge_stmt : node_id
- {begin_edgestmt($1);}
- edgeRHS
- { E = SP->subg->proto->e;
- Current_class = TAG_EDGE; }
- opt_attr_list
- {if(end_edgestmt()) YYABORT;}
- | subg_stmt
- {begin_edgestmt($1);}
- edgeRHS
- { E = SP->subg->proto->e;
- Current_class = TAG_EDGE; }
- opt_attr_list
- {if(end_edgestmt()) YYABORT;}
- ;
-
-edgeRHS : T_edgeop node_id {mid_edgestmt($2);}
- | T_edgeop node_id
- {mid_edgestmt($2);}
- edgeRHS
- | T_edgeop subg_stmt
- {mid_edgestmt($2);}
- | T_edgeop subg_stmt
- {mid_edgestmt($2);}
- edgeRHS
- ;
-
-
-subg_stmt : subg_hdr '{' stmt_list '}'%prec '{' {$$ = pop_gobj(); if (!$$.obj) YYABORT;}
- | T_subgraph '{' { if(anonsubg()) YYABORT; } stmt_list '}' {$$ = pop_gobj(); if (!$$.obj) YYABORT;}
- | '{' { if(anonsubg()) YYABORT; } stmt_list '}' {$$ = pop_gobj(); if (!$$.obj) YYABORT;}
- | subg_hdr %prec T_subgraph {subgraph_warn(); $$ = pop_gobj(); if (!$$.obj) YYABORT;}
- ;
-
-subg_hdr : T_subgraph symbol
- { Agraph_t *subg;
- if ((subg = agfindsubg(AG.parsed_g,$2))) aginsert(G,subg);
- else subg = agsubg(G,$2);
- push_subg(subg);
- In_decl = FALSE;
- agstrfree($2);
- }
- ;
-
-symbol : T_symbol {$$ = $1; }
- | qsymbol {$$ = $1; }
- ;
-
-qsymbol : T_qsymbol {$$ = $1; }
- | qsymbol '+' T_qsymbol {$$ = concat($1,$3); agstrfree($1); agstrfree($3);}
- ;
-%%
-#ifdef UNUSED
-/* grammar allowing port variants */
-/* at present, these are not used, so we remove them from the grammar */
-/* NOTE: If used, these should be rewritten to take into account the */
-/* move away from using ':' in the string and that symbols come from */
-/* agstrdup and need to be freed. */
-node_port : /* empty */
- | port_location
- | port_angle /* undocumented */
- | port_angle port_location /* undocumented */
- | port_location port_angle /* undocumented */
- ;
-
-port_location : ':' symbol {strcat(Port,":"); strcat(Port,$2);}
- | ':' '(' symbol {Symbol = strdup($3);} ',' symbol ')'
- { char buf[SMALLBUF];
- sprintf(buf,":(%s,%s)",Symbol,$6);
- strcat(Port,buf); free(Symbol);
- }
- ;
-
-port_angle : '@' symbol
- { char buf[SMALLBUF];
- sprintf(buf,"@%s",$2);
- strcat(Port,buf);
- }
- ;
-
-#endif
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-#include "libgraph.h"
-#include <assert.h>
-
-static unsigned int HTML_BIT;
-static unsigned int CNT_BITS;
-
-typedef struct refstr_t {
- Dtlink_t link;
- unsigned int refcnt;
- char s[1];
-} refstr_t;
-
-static Dtdisc_t Refstrdisc = {
- offsetof(refstr_t, s[0]),
- 0,
- 0,
- ((Dtmake_f) 0),
- ((Dtfree_f) 0),
- ((Dtcompar_f) 0), /* use strcmp */
- ((Dthash_f) 0),
- ((Dtmemory_f) 0),
- ((Dtevent_f) 0)
-};
-
-static Dict_t *StringDict;
-
-#ifdef DEBUG
-static int refstrprint(Dt_t * d, Void_t * obj, Void_t * env)
-{
- refstr_t *r = (refstr_t *) obj;
- fprintf(stderr, "%s\n", r->s);
- return 0;
-}
-
-void agrefstrdump(void)
-{
- dtwalk(StringDict, refstrprint, 0);
-}
-#endif
-
-/* initialize_strings:
- * Create dictionary and masks for HTML strings.
- * HTML_BIT must be the most significant bit. We assume 8-bit bytes.
- */
-static void initialize_strings(void)
-{
- StringDict = dtopen(&Refstrdisc, Dttree);
- HTML_BIT = ((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1);
- CNT_BITS = ~HTML_BIT;
-}
-
-char *agstrdup(char *s)
-{
- refstr_t *key, *r;
-
- if (StringDict == NULL)
- initialize_strings();
- if (s == NULL)
- return s;
-
- key = (refstr_t *) (s - offsetof(refstr_t, s[0]));
- r = (refstr_t *) dtsearch(StringDict, key);
- if (r)
- r->refcnt++;
- else {
- r = (refstr_t *) malloc(sizeof(refstr_t) + strlen(s));
- r->refcnt = 1;
- strcpy(r->s, s);
- dtinsert(StringDict, r);
- }
- return r->s;
-}
-
-/* agstrdup_html:
- * For various purposes, including deparsing, we have to recognize
- * strings coming from <...> rather than "...". To do this, we set
- * the top bit of the refcnt field. Since the use of html strings
- * is localized, we allow the application to make the distinction.
- */
-char *agstrdup_html(char *s)
-{
- refstr_t *key, *r;
-
- if (StringDict == NULL)
- initialize_strings();
- if (s == NULL)
- return s;
-
- key = (refstr_t *) (s - offsetof(refstr_t, s[0]));
- r = (refstr_t *) dtsearch(StringDict, key);
- if (r)
- r->refcnt++;
- else {
- r = (refstr_t *) malloc(sizeof(refstr_t) + strlen(s));
- r->refcnt = 1 | HTML_BIT;
- strcpy(r->s, s);
- dtinsert(StringDict, r);
- }
- return r->s;
-}
-
-void agstrfree(char *s)
-{
- refstr_t *key, *r;
-
- if ((StringDict == NULL) || (s == NULL))
- return;
- key = (refstr_t *) (s - offsetof(refstr_t, s[0]));
- r = (refstr_t *) dtsearch(StringDict, key);
-
- if (r) {
- r->refcnt--;
- if ((r->refcnt && CNT_BITS) == 0) {
- dtdelete(StringDict, r);
- free(r);
- }
- } else
- agerr(AGERR, "agstrfree lost %s\n", s);
-}
-
-/* aghtmlstr:
- * Return true if s is an HTML string.
- * We assume s points to the datafield s[0] of a refstr.
- */
-int aghtmlstr(char *s)
-{
- refstr_t *key;
-
- if ((StringDict == NULL) || (s == NULL))
- return 0;
- key = (refstr_t *) (s - offsetof(refstr_t, s[0]));
- return (key->refcnt & HTML_BIT);
-}
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-#include "libgraph.h"
-#include "parser.h"
-#include "triefa.h"
-
-TrieState TrieStateTbl[34] = {
- {-1, 0, 0x42058}
- ,
- {-1, 5, 0x100}
- ,
- {-1, 6, 0x40}
- ,
- {-1, 7, 0x20000}
- ,
- {-1, 8, 0x1}
- ,
- {-1, 9, 0x8000}
- ,
- {-1, 10, 0x80}
- ,
- {T_digraph, 11, 0x0}
- ,
- {-1, 11, 0x8}
- ,
- {-1, 12, 0x40}
- ,
- {-1, 13, 0x10}
- ,
- {T_edge, 14, 0x0}
- ,
- {-1, 14, 0x20000}
- ,
- {-1, 15, 0x1}
- ,
- {-1, 16, 0x8000}
- ,
- {-1, 17, 0x80}
- ,
- {T_graph, 18, 0x0}
- ,
- {-1, 18, 0x4000}
- ,
- {-1, 19, 0x8}
- ,
- {-1, 20, 0x10}
- ,
- {T_node, 21, 0x0}
- ,
- {-1, 21, 0x180000}
- ,
- {-1, 23, 0x20000}
- ,
- {-1, 24, 0x100}
- ,
- {-1, 25, 0x4}
- ,
- {-1, 26, 0x80000}
- ,
- {T_strict, 27, 0x0}
- ,
- {-1, 27, 0x2}
- ,
- {-1, 28, 0x40}
- ,
- {-1, 29, 0x20000}
- ,
- {-1, 30, 0x1}
- ,
- {-1, 31, 0x8000}
- ,
- {-1, 32, 0x80}
- ,
- {T_subgraph, 33, 0x0}
- ,
-};
-TrieTrans TrieTransTbl[33] = {
- /* State 0 */ {'s', 21}
- , {'e', 8}
- , {'g', 12}
- , {'n', 17}
- , {'d', 1}
- ,
- /* State 1 */ {'i', 2}
- ,
- /* State 2 */ {'g', 3}
- ,
- /* State 3 */ {'r', 4}
- ,
- /* State 4 */ {'a', 5}
- ,
- /* State 5 */ {'p', 6}
- ,
- /* State 6 */ {'h', 7}
- ,
- /* State 8 */ {'d', 9}
- ,
- /* State 9 */ {'g', 10}
- ,
- /* State 10 */ {'e', 11}
- ,
- /* State 12 */ {'r', 13}
- ,
- /* State 13 */ {'a', 14}
- ,
- /* State 14 */ {'p', 15}
- ,
- /* State 15 */ {'h', 16}
- ,
- /* State 17 */ {'o', 18}
- ,
- /* State 18 */ {'d', 19}
- ,
- /* State 19 */ {'e', 20}
- ,
- /* State 21 */ {'t', 22}
- , {'u', 27}
- ,
- /* State 22 */ {'r', 23}
- ,
- /* State 23 */ {'i', 24}
- ,
- /* State 24 */ {'c', 25}
- ,
- /* State 25 */ {'t', 26}
- ,
- /* State 27 */ {'b', 28}
- ,
- /* State 28 */ {'g', 29}
- ,
- /* State 29 */ {'r', 30}
- ,
- /* State 30 */ {'a', 31}
- ,
- /* State 31 */ {'p', 32}
- ,
- /* State 32 */ {'h', 33}
- ,
-};
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-/* File - TrieFA.ins.c
- *
- * This file contains code to be included in the scanner file using a
- * generated trie-based FA.
- */
-
-#include "triefa.h"
-
-#ifdef UNDERLINE
-static long CharMask[28] = {
- 0x0000001, 0x0000000, 0x0000004, 0x0000008,
- 0x0000010, 0x0000020, 0x0000040, 0x0000080,
- 0x0000100, 0x0000200, 0x0000400, 0x0000800,
- 0x0001000, 0x0002000, 0x0004000, 0x0008000,
- 0x0010000, 0x0020000, 0x0040000, 0x0080000,
- 0x0100000, 0x0200000, 0x0400000, 0x0800000,
- 0x1000000, 0x2000000, 0x4000000, 0x8000000,
-};
-
-#define IN_MASK_RANGE(C) (islower(C) || ((C) == '_'))
-#define MASK_INDEX(C) ((C) - '_')
-
-#else
-static long CharMask[26] = {
- 0x0000001, 0x0000002, 0x0000004, 0x0000008,
- 0x0000010, 0x0000020, 0x0000040, 0x0000080,
- 0x0000100, 0x0000200, 0x0000400, 0x0000800,
- 0x0001000, 0x0002000, 0x0004000, 0x0008000,
- 0x0010000, 0x0020000, 0x0040000, 0x0080000,
- 0x0100000, 0x0200000, 0x0400000, 0x0800000,
- 0x1000000, 0x2000000
-};
-
-#define IN_MASK_RANGE(C) islower(C)
-#define MASK_INDEX(C) ((C) - 'a')
-
-#endif
-
-static short TFA_State;
-
-/* TFA_Init:
- *
- * Initialize the trie FA.
- */
-#define TFA_Init() TFA_State = 0
-
-/* TFA_Advance:
- *
- * Advance to the next state (or -1) on the lowercase letter c. This should be an
- * inline routine, but the C++ implementation isn't advanced enough so we use a macro.
- */
-#define TFA_Advance(C) { \
- unsigned char c = C; \
- if (TFA_State >= 0) { \
- if (isupper(c)) \
- c = tolower(c); \
- else if (! IN_MASK_RANGE(c)) { \
- TFA_State = -1; \
- goto TFA_done; \
- } \
- if (TrieStateTbl[TFA_State].mask & CharMask[MASK_INDEX(c)]) { \
- short i = TrieStateTbl[TFA_State].trans_base; \
- while (TrieTransTbl[i].c != c) \
- i++; \
- TFA_State = TrieTransTbl[i].next_state; \
- } \
- else \
- TFA_State = -1; \
- } \
- TFA_done:; \
-} /* end of TFA_Advance. */
-
-/* TFA_Definition:
- *
- * Return the definition (if any) associated with the current state.
- */
-#define TFA_Definition() \
- ((TFA_State < 0) ? -1 : TrieStateTbl[TFA_State].def)
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* File - TrieFA.h
- *
- * The data types for the generated trie-based finite automata.
- */
-
- struct TrieState { /* An entry in the FA state table */
- short def; /* If this state is an accepting state then */
- /* this is the definition, otherwise -1. */
- short trans_base; /* The base index into the transition table. */
- long mask; /* The transition mask. */
- };
-
- struct TrieTrans { /* An entry in the FA transition table. */
- short c; /* The transition character (lowercase). */
- short next_state; /* The next state. */
- };
-
- typedef struct TrieState TrieState;
- typedef struct TrieTrans TrieTrans;
-
- extern TrieState TrieStateTbl[];
- extern TrieTrans TrieTransTbl[];
-
-#ifdef __cplusplus
-}
-#endif
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\x86\include;$(SolutionDir)windows\dependencies\libraries\x86\include\cairo;$(SolutionDir)/libltdl;$(SolutionDir)/lib/neatogen;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/graph;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\x86\include;$(SolutionDir)windows\dependencies\libraries\x86\include\cairo;$(SolutionDir)/libltdl;$(SolutionDir)/lib/neatogen;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
- <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\x86\include;$(SolutionDir)windows\dependencies\libraries\x86\include\cairo;$(SolutionDir)/libltdl;$(SolutionDir)/lib/neatogen;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/graph;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\x86\include;$(SolutionDir)windows\dependencies\libraries\x86\include\cairo;$(SolutionDir)/libltdl;$(SolutionDir)/lib/neatogen;$(SolutionDir)/lib/agutil;$(SolutionDir)/windows/lib/cdt;$(SolutionDir)/;$(SolutionDir)/lib/vpsc;$(SolutionDir)/lib/vmalloc;$(SolutionDir)/lib/twopigen;$(SolutionDir)/lib/sparse;$(SolutionDir)/lib/sfio;$(SolutionDir)/lib/sfpdpgen;$(SolutionDir)/lib/rbtree;$(SolutionDir)/lib/pathplan;$(SolutionDir)/lib/patchwork;$(SolutionDir)/lib/pack;$(SolutionDir)/lib/ortho;$(SolutionDir)/lib/inkpot;$(SolutionDir)/lib/ingraphs;$(SolutionDir)/lib/filter;$(SolutionDir)/lib/fdpgen;$(SolutionDir)/lib/expr;$(SolutionDir)/lib/dotgen;$(SolutionDir)/lib/circogen;$(SolutionDir)/lib/ast;$(SolutionDir)/lib/agraph;$(SolutionDir)/lib/common;$(SolutionDir)/lib/gvc;$(SolutionDir)/lib/cdt;$(SolutionDir)/lib/cgraph;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<EnablePREfast>true</EnablePREfast>