# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = cmd/dot \
+INPUT = cmd/dot \
lib/cdt \
lib/circogen \
lib/common \
lib/pack \
lib/pathplan \
lib/twopigen \
- lib/plugin
+ lib/plugin \
+ tclpkg/gv
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
{
graph_t *prev = NULL;
- Gvc = gvNEWcontext(Info, username());
+ Gvc = gvNEWcontext(Info, gvUsername());
gvParseArgs(Gvc, argc, argv);
#ifndef MSWIN32
- signal(SIGUSR1, toggle);
+ signal(SIGUSR1, gvToggle);
signal(SIGINT, intr);
fpinit();
#endif
-I$(top_srcdir)/lib/graph \
-I$(top_srcdir)/lib/cdt @GD_INCLUDES@ @EXPAT_INCLUDES@ @Z_INCLUDES@
-pkginclude_HEADERS = logic.h arith.h geom.h geomprocs.h \
- color.h colorprocs.h colortbl.h \
- const.h macros.h types.h globals.h utils.h memory.h \
- htmllex.h htmltable.h pointset.h render.h
+pkginclude_HEADERS = logic.h arith.h geom.h color.h types.h globals.h
+noinst_HEADERS = render.h utils.h memory.h \
+ geomprocs.h colorprocs.h colortbl.h \
+ const.h macros.h htmllex.h htmltable.h pointset.h
noinst_LTLIBRARIES = libcommon.la
if !DISABLE_CODEGENS
AWKDIR = $(ROOT)/awk
-INST_HDRS = const.h globals.h macros.h render.h \
- types.h utils.h geom.h geomprocs.h logic.h \
- color.h colorprocs.h arith.h memory.h
-
-NOINST_HDRS = colortbl.h ps.h htmltable.h htmlparse.h htmllex.h
+INST_HDRS = logic.h arith.h geom.h color.h types.h globals.h
+NOINST_HDRS = render.h utils.h memory.h \
+ geomprocs.h colorprocs.h const.h macros.h h pointset.h
+NOINST_GENERATED_HDRS = colortbl.h ps.h htmltable.h htmlparse.h htmllex.h
OBJS = args.o arrows.o gdusershape.o mapgen.o psgen.o svgusershape.o \
colxlate.o globals.o mifgen.o psusershape.o timing.o \
$(MKPATH) $(LIBDIR)
$(INSTALL) libcommon.a $(LIBDIR)
-$(OBJS) : $(INST_HDRS)
+$(OBJS) : $(INST_HDRS) $(NOINST_HDRS)
colxlate.o : colortbl.h
psgen.o : ps.h
emit.o mapgen.o utils.o htmllex.o htmltable.o htmlparse.o : htmltable.h
#ifndef GV_ARITH_H
#define GV_ARITH_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
/* for sincos */
#define _GNU_SOURCE 1
#ifdef HAVE_LIMITS_H
#include "config.h"
#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#else
-#ifdef HAVE_VALUES_H
-#include <values.h>
-#endif
-#endif
-
-#include <signal.h>
-#include <assert.h>
-#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <string.h>
#endif
+#include "types.h"
#include "macros.h"
#include "const.h"
-#include "types.h"
#include "globals.h"
#include "memory.h"
#include "colorprocs.h" /* must collow color.h (in types.h) */
#define GV_TYPES_H
#include <stdio.h>
+#include <assert.h>
+#include <signal.h>
#include "geom.h"
#include "pathplan.h"
}
#endif
-char *username()
+char *gvUsername()
{
char *user = NULL;
#ifndef MSWIN32
}
static int Tflag;
-void toggle(int s)
+void gvToggle(int s)
{
Tflag = !Tflag;
#ifndef MSWIN32
- signal(SIGUSR1, toggle);
+ signal(SIGUSR1, gvToggle);
#endif
}
extern void UF_singleton(Agnode_t *);
extern void UF_setname(Agnode_t *, Agnode_t *);
- extern char *username(void);
extern char *safefile(char *shapefilename);
extern void cat_libfile(FILE *, char **, char **);
extern int mapbool(char *);
extern int maptoken(char *, char **, int *);
- extern void toggle(int);
extern int test_toggle(void);
extern void common_init_node(node_t * n);
LIBS = $(LIBLTDL) $(SOCKET_LIBS)
-pkginclude_HEADERS = gvc.h gvcint.h gvcjob.h gvcext.h gvplugin.h gvcproc.h \
- gvplugin_render.h gvplugin_layout.h gvplugin_textlayout.h \
- gvplugin_device.h gvplugin_usershape.h
+pkginclude_HEADERS = gvc.h gvcext.h gvplugin.h gvcjob.h gvcint.h \
+ gvplugin_render.h \
+ gvplugin_layout.h \
+ gvplugin_textlayout.h \
+ gvplugin_device.h \
+ gvplugin_usershape.h
+noinst_HEADERS = gvcproc.h
pkglib_LTLIBRARIES = libgvc.la
pkgconfig_DATA = libgvc.pc
DEFINES = -DHAVE_CONFIG_H -DGVLIBDIR=\"$(LIBDIR)\"
-HDRS = gvc.h gvcint.h gvcjob.h gvcext.h gvcproc.h gvplugin.h \
+INST_HDRS = gvc.h gvcint.h gvcjob.h gvcext.h gvplugin.h \
gvplugin_render.h gvplugin_device.h \
gvplugin_layout.h gvplugin_textlayout.h \
gvplugin_usershape.h
+NOINST_HDRS = gvcproc.h
+
OBJS = gvrender.o gvlayout.o gvdevice.o gvcontext.o gvjobs.o \
gvplugin.o gvconfig.o gvevent.o gvtextlayout.o gvusershape.o gvc.o
#include "gvcint.h"
#include "gvcproc.h"
+extern GVC_t *gvNEWcontext(char **info, char *user);
+extern char *gvUsername(void);
+
char *LibInfo[] = {
"libgvc", /* Program */
VERSION, /* Version */
aginit();
agnodeattr(NULL, "label", NODENAME_ESC);
- gvc = gvNEWcontext(LibInfo, username());
+ gvc = gvNEWcontext(LibInfo, gvUsername());
gvconfig(gvc, FALSE); /* configure for available plugins and codegens */
return gvc;
}
return 0;
}
+/* Render layout in a specified format to an open FILE */
int gvRender(GVC_t *gvc, graph_t *g, char *format, FILE *out)
{
int rc;
job = gvc->job;
job->output_lang = gvrender_select(job, job->output_langname);
+ if (!GD_drawing(g) && job->output_lang != CANONICAL_DOT) {
+ fprintf(stderr, "Layout was not done\n");
+ return -1;
+ }
job->output_file = out;
+ gvRenderJobs(gvc, g);
+ gvrender_delete_jobs(gvc);
+
+ return 0;
+}
+
+/* Render layout in a specified format to an open FILE */
+int gvRenderFilename(GVC_t *gvc, graph_t *g, char *format, char *filename)
+{
+ int rc;
+ GVJ_t *job;
+ g = g->root;
+
+ /* create a job for the required format */
+ rc = gvrender_output_langname_job(gvc, format);
+ if (rc == NO_SUPPORT) {
+ agerr(AGERR, "Renderer type: \"%s\" not recognized. Use one of:%s\n", format, gvplugin_list(gvc, API_render, format));
+ return -1;
+ }
+
+ job = gvc->job;
+ job->output_lang = gvrender_select(job, job->output_langname);
+ if (!GD_drawing(g) && job->output_lang != CANONICAL_DOT) {
+ fprintf(stderr, "Layout was not done\n");
+ return -1;
+ }
+ gvrender_output_filename_job(gvc, filename);
gvRenderJobs(gvc, g);
gvrender_delete_jobs(gvc);
#ifndef GVC_H
#define GVC_H
-#include "render.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "types.h"
+#include "globals.h"
+#include "graph.h"
#include "gvplugin.h"
-#include "gvcint.h"
-#include "gvcproc.h"
#ifdef __cplusplus
extern "C" {
#define gvCleanup gvCleanup_DEPRECATED_BY_gvFreeContext
#define dotneato_terminate dotneato_terminate_DEPRECATED_BY_gvFreeContext
+/* misc */
+/* FIXME - these need eliminating or renaming */
+extern void gvToggle(int);
+extern graph_t *next_input_graph(void);
/* set up a graphviz context */
+extern GVC_t *gvNEWcontext(char **info, char *user);
+extern char *gvUsername(void);
+
+/* set up a graphviz context - alternative */
+/* (wraps the above two functions using info built into libgvc) */
extern GVC_t *gvContext(void);
/* parse command line args - minimally argv[0] sets layout engine */
extern int gvParseArgs(GVC_t *gvc, int argc, char **argv);
-
/* Compute a layout using a specified engine */
extern int gvLayout(GVC_t *gvc, graph_t *g, char *engine);
/* Compute a layout using layout engine from command line args */
extern int gvLayoutJobs(GVC_t *gvc, graph_t *g);
-/* Render layout in a specified format to a specified output file */
+/* Render layout in a specified format to an open FILE */
extern int gvRender(GVC_t *gvc, graph_t *g, char *format, FILE *out);
+/* Render layout in a specified format to an open FILE */
+extern int gvRenderFilename(GVC_t *gvc, graph_t *g, char *format, char *filename);
+
/* Render layout according to -T and -o options found by gvParseArgs */
extern int gvRenderJobs(GVC_t *gvc, graph_t *g);
/* these are intended to be private entry points - see gvc.h for the public ones */
-/* context */
-
- extern GVC_t *gvNEWcontext(char **info, char *user);
-
/* configuration */
extern char *gvconfig_libdir(void);
* AT&T Research, Florham Park NJ *
**********************************************************/
-#define BUILTINS
#include "gvc.h"
+#include "graph.h"
GVC_t *gvc;
-char *Info[] = {
- "gv",
- VERSION,
- BUILDDATE
-};
-
static void gvinit()
{
- aginit();
- agnodeattr(NULL, "label", NODENAME_ESC);
- gvc = gvNEWcontext(Info, username());
-
- /* configure for available plugins and codegens */
- gvconfig(gvc, FALSE);
+ gvc = gvContext();
}
Agraph_t *digraph(char *name)
agdelete(e->head->graph->root, e);
}
-static void reset_layout(Agraph_t *g)
-{
- g = g->root;
- if (GD_drawing(g)) { /* only cleanup once between layouts */
- gvFreeLayout(gvc, g);
- GD_drawing(g) = NULL;
- }
-}
-
void layout(Agraph_t *g, char *engine)
{
int err;
err = gvLayout(gvc, g, engine);
- if (err) {
- fprintf(stderr, "Layout type: \"%s\" not recognized. Use one of:%s\n", engine, gvplugin_list(gvc, API_layout, engine));
- return;
- }
}
void writegraph(Agraph_t *g, char *filename, char *format)
{
int err;
- GVJ_t *job;
-
- g = g->root;
- /* create a job for the required format */
- err = gvrender_output_langname_job(gvc, format);
- if (err == NO_SUPPORT) {
- fprintf(stderr, "Renderer type: \"%s\" not recognized. Use one of:%s\n",
- format, gvplugin_list(gvc, API_render, format));
- return;
- }
-
- job = gvc->job;
- job->output_lang = gvrender_select(job, job->output_langname);
- if (!GD_drawing(g) && job->output_lang != CANONICAL_DOT) {
- fprintf(stderr, "Layout was not done\n");
- return;
- }
- gvrender_output_filename_job(gvc, filename);
-
- gvRenderJobs(gvc, g);
- gvrender_delete_jobs(gvc);
+ err = gvRenderFilename(gvc, g, format, filename);
}
%module gv
%{
+#define BUILTINS
#include "gvc.h"
%}
/* avoid compiler warnings with template changes in Tcl8.4 */
/* specifically just the change to Tcl_CmdProc */
#define USE_NON_CONST
+#define BUILTINS
+#include "render.h"
#include "gvc.h"
#include "tcl.h"
#include "tclhandle.h"
agnodeattr(NULL, "label", NODENAME_ESC);
/* create a GraphViz Context and pass a pointer to it in clientdata */
- gvc = gvNEWcontext(Info, username());
+ gvc = gvNEWcontext(Info, gvUsername());
/* configure for available plugins and codegens */
gvconfig(gvc, FALSE);
/* builtins are defined in tcldot.c - prevent duplicate */
#define BUILTINS
+#include "render.h"
#include "gvc.h"
#include "tcl.h"