]> granicus.if.org Git - graphviz/commitdiff
Move cmd/dot/args.c to lib/common/args.c so it can be used by other progs
authorellson <devnull@localhost>
Sun, 17 Jul 2005 19:52:21 +0000 (19:52 +0000)
committerellson <devnull@localhost>
Sun, 17 Jul 2005 19:52:21 +0000 (19:52 +0000)
Remove cmd/dot/dotneato-config-*     Use pkgconfig mechanism now.

Add dot.demo/   with two demo programs.

cmd/dot/Makefile.am
cmd/dot/Makefile.old
cmd/dot/dotneato-config.1 [deleted file]
cmd/dot/dotneato-config.in [deleted file]
dot.demo/Makefile [new file with mode: 0644]
dot.demo/demo.c [new file with mode: 0644]
dot.demo/dot.c [new file with mode: 0644]
lib/common/Makefile.am
lib/common/Makefile.old
lib/common/args.c [moved from cmd/dot/args.c with 100% similarity]

index a61fcdc434f27dd92060ffdd1d18f48911bce63d..6fd34cf5edf975f22766b601defa104ccd08cfea 100644 (file)
@@ -11,22 +11,19 @@ AM_CPPFLAGS = \
         -I$(top_srcdir) \
         -I$(top_srcdir)/lib/common \
         -I$(top_srcdir)/lib/gvc \
-       -I$(top_srcdir)/lib/pack \
        -I$(top_srcdir)/lib/pathplan \
        -I$(top_srcdir)/lib/graph \
-       -I$(top_srcdir)/lib/cdt \
-       -I$(top_srcdir)/lib/fdpgen
+       -I$(top_srcdir)/lib/cdt
 
 pkginclude_HEADERS = dotneato.h
 pkglib_LTLIBRARIES = libdotneato.la
 pkgconfig_DATA = libdotneato.pc
-bin_SCRIPTS = dotneato-config
 bin_PROGRAMS = dot
-man_MANS = dot.1 dotneato-config.1
-pdf_DATA = dot.pdf dotneato-config.pdf
+man_MANS = dot.1 
+pdf_DATA = dot.pdf
 
 libdotneato_la_SOURCES = dotneato.c
-dot_SOURCES = dot.c args.c
+dot_SOURCES = dot.c
 
 if DISABLE_LTDL
 libdotneato_la_LIBADD = \
@@ -70,9 +67,6 @@ uninstall-hook:
 dot.pdf: $(top_srcdir)/cmd/dot/dot.1
        groff -Tps -man $(top_srcdir)/cmd/dot/dot.1 | ps2pdf - - >$@
 
-dotneato-config.pdf: $(top_srcdir)/cmd/dot/dotneato-config.1
-       groff -Tps -man $(top_srcdir)/cmd/dot/dotneato-config.1 | ps2pdf - - >$@
+EXTRA_DIST = Makefile.old dot.1 dot.pdf 
 
-EXTRA_DIST = Makefile.old dot.1 dotneato-config.1 dot.pdf dotneato-config.pdf dotneato-config.in
-
-DISTCLEANFILES = dot.pdf dotneato-config.pdf
+DISTCLEANFILES = dot.pdf
index d6c2f0fa4c8cb5a4bd3c9d79c52053d843e5646c..6feca6087c966cc7304bab00fd57216ef92486f4 100644 (file)
@@ -40,7 +40,7 @@ DOTLIBS = ../../lib/common/libcommon.a ../../lib/dotgen/libdotgen.a \
 
 
 LIBDOTNEATO = libdotneato.a
-OBJS = dot.o args.o
+OBJS = dot.o
 SHLIBS = twopigen/libtwopi.a dotgen/libdot.a neatogen/libneato.a pack/libpack.a gvrender/libgvrender.a common/libcommon.a
 
 all : dot $(LIBDOTNEATO)
@@ -52,9 +52,6 @@ dot : $(OBJS) $(DOTLIBS)
 dot.o : dot.c
        $(CC) -c $(CCFLAGS) $(DEFINES) $(INCS) dot.c
 
-args.o : args.c
-       $(CC) -c $(CCFLAGS) $(DEFINES) $(ALLINCS) args.c
-
 plugins.o : plugins.c
        $(CC) -c $(CCFLAGS) $(DEFINES) $(ALLINCS) plugins.c
 
diff --git a/cmd/dot/dotneato-config.1 b/cmd/dot/dotneato-config.1
deleted file mode 100644 (file)
index 66257e7..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-.\" Process this file with
-.\" groff -man -Tascii dotneato-config.1
-.\"
-.TH dotneato-config 1 "FEBRUARY 1999" "Library Configuration" "User Manuals"
-.SH NAME
-dotneato-config \- Display Dotneato Library Configuration
-.SH SYNOPSIS
-.B dotneato-config 
-.I OPTION 
-.B [
-.I OPTION
-.B ... ]
-.SH DESCRIPTION
-.B dotneato-config
-is a script that is used to display the compiler and linker flags that are 
-required for building applications that link to the dotneato libraries
-from GraphViz.
-
-.SH OPTIONS
-.IP --version
-dotneato version information
-.IP --prefix
-displays prefix of directory where dotneato was installed.
-.IP --exec-prefix
-displays exec-prefix of the directory where architecture-specific parts
-of dotneato were installed.
-.IP --cflags
-C pre-processor and compiler flags for use with dotneato.
-.IP --libs
-dotneato library linking information
-.IP --libtool
-dotneato libtool information
-.SH "SEE ALSO"
-.BR dot (1)
-.SH AUTHOR
-John Ellson <ellson@graphviz.org>
diff --git a/cmd/dot/dotneato-config.in b/cmd/dot/dotneato-config.in
deleted file mode 100644 (file)
index aa41f0f..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#! /bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-pkglibdir=@libdir@/@PACKAGE@
-includedir=@includedir@
-pkgincludedir=${includedir}/@PACKAGE@
-
-usage()
-{
-  cat <<EOF
-Usage: dotneato-config [OPTIONS] [LIBRARIES]
-Options:
- [--prefix[=DIR]]
- [--exec-prefix[=DIR]]
- [--version]
- [--cflags]
- [--ldflags]
- [--libs]
- [--rlibs]
- [--libtool]
-EOF
-  exit $1
-}
-
-if test $# -eq 0 ; then
-  usage 1 1>&2
-fi
-
-while test $# -gt 0 ; do
-  case "$1" in
-  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) optarg= ;;
-  esac
-
-  case $1 in
-  --prefix=*)
-    prefix=$optarg
-    local_prefix=yes
-    ;;
-  --prefix)
-    echo_prefix=yes
-    ;;
-  --exec-prefix=*)
-    exec_prefix=$optarg
-    exec_prefix_set=yes
-    local_prefix=yes
-    ;;
-  --exec-prefix)
-    echo_exec_prefix=yes
-    ;;
-  --version)
-    echo @VERSION@
-    exit 0
-    ;;
-  --cflags)
-    echo_cflags=yes
-    ;;
-  --ldflags)
-    echo_ldflags=yes
-    ;;
-  --libs)
-    echo_libs=yes
-    ;;
-  --rlibs)
-    echo_rlibs=yes
-    ;;
-  --libtool)
-    echo_libtool=yes
-    ;;
-  *)
-    usage 1 1>&2
-    ;;
-  esac
-  shift
-done
-
-if test "$local_prefix" = "yes" ; then
-    if test "$exec_prefix_set" != "yes" ; then
-      exec_prefix=$prefix
-    fi
-fi
-
-if test "$echo_prefix" = "yes" ; then
- echo $prefix
-fi
-
-if test "$echo_exec_prefix" = "yes" ; then
- echo $exec_prefix
-fi
-
-if test "$echo_cflags" = "yes" ; then
- echo -I$pkgincludedir $cflags
-fi
-
-if test "$echo_ldflags" = "yes" ; then
- echo "-L$pkglibdir"
-fi
-
-if test "$echo_libs" = "yes" ; then
- echo "-ldotneato"
-fi
-
-if test "$echo_rlibs" = "yes" ; then
- echo ""
-fi
-
-if test "$echo_libtool" = "yes" ; then
- echo "$pkglibdir/libdotneato.la"
-fi
-
-# EOF
diff --git a/dot.demo/Makefile b/dot.demo/Makefile
new file mode 100644 (file)
index 0000000..6f83caf
--- /dev/null
@@ -0,0 +1,22 @@
+COMPILE=libtool --tag=CC --mode=compile ${CC} -c
+LINK=libtool --tag=CC --mode=link ${CC}
+
+CFLAGS=`pkg-config libdotneato --cflags`
+LDFLAGS=`pkg-config libdotneato --libs`
+
+all: dot demo
+
+dot: dot.lo
+       ${LINK} ${LDFLAGS} -o $@ dot.lo
+
+dot.lo: dot.c
+       ${COMPILE} ${CFLAGS} -o $@ dot.c
+
+demo: demo.lo
+       ${LINK} ${LDFLAGS} -o $@ demo.lo
+
+demo.lo: demo.c
+       ${COMPILE} ${CFLAGS} -o $@ demo.c
+
+clean:
+       rm -rf .libs dot demo *.o *.lo
diff --git a/dot.demo/demo.c b/dot.demo/demo.c
new file mode 100644 (file)
index 0000000..b87da72
--- /dev/null
@@ -0,0 +1,60 @@
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+#include <dotneato.h>
+
+int main(int argc, char **argv)
+{
+    Agraph_t *g;
+    Agnode_t *n, *m;
+    Agedge_t *e;
+    Agsym_t *a;
+    GVC_t *gvc;
+
+    /* set up renderer context */
+    gvc = gvContext();
+
+    /* parse command line args - minimally argv[0] sets layout engine */
+    parse_args(gvc, argc, argv);
+
+    /* Create a simple digraph */
+    g = agopen("g", AGDIGRAPH);
+    n = agnode(g, "n");
+    m = agnode(g, "m");
+    e = agedge(g, n, m);
+
+    /* Set an attribute - in this case one that affects the visible rendering */
+    if (!(a = agfindattr(g->proto->n, "color")))
+       a = agnodeattr(g, "color", "");
+    agxset(n, a->index, "red");
+
+    /* Compute a layout */
+    gvlayout_layout(gvc, g);
+
+    /* Write the graph according to -T and -o options */
+    emit_jobs(gvc, g);
+
+    /* Clean out layout data */
+    gvlayout_cleanup(gvc, g);
+
+    /* Free graph structures */
+    agclose(g);
+
+    /* Clean up output file and errors */
+    dotneato_terminate(gvc);
+
+    return 0;
+}
diff --git a/dot.demo/dot.c b/dot.demo/dot.c
new file mode 100644 (file)
index 0000000..583d4bf
--- /dev/null
@@ -0,0 +1,38 @@
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+#include <dotneato.h>
+
+int main(int argc, char **argv)
+{
+    graph_t *g, *prev = NULL;
+    GVC_t *gvc;
+
+    gvc = gvContext();
+    parse_args(gvc, argc, argv);
+
+    while ((g = next_input_graph())) {
+       if (prev) {
+           gvlayout_cleanup(gvc, prev);
+           agclose(prev);
+       }
+       gvlayout_layout(gvc, g);
+       emit_jobs(gvc, g);
+       prev = g;
+    }
+    dotneato_terminate(gvc);
+    return 0;
+}
index 5babf714796c86f4d41f7ba989885dd5c6581414..0ac3051d94b1f9f703462e178976655bd5493724 100644 (file)
@@ -3,6 +3,8 @@
 AM_CPPFLAGS = \
         -I$(top_srcdir) \
        -I$(top_srcdir)/lib/gvc \
+       -I$(top_srcdir)/lib/pack \
+       -I$(top_srcdir)/lib/fdpgen \
        -I$(top_srcdir)/lib/pathplan \
        -I$(top_srcdir)/lib/graph \
        -I$(top_srcdir)/lib/cdt  @GD_INCLUDES@ @EXPAT_INCLUDES@ @Z_INCLUDES@
@@ -18,7 +20,7 @@ endif
 
 
 libcommon_la_SOURCES = arrows.c colxlate.c fontmetrics.c \
-       gdtextsize.c gdusershape.c \
+       args.c gdtextsize.c gdusershape.c \
        globals.c htmllex.c htmlparse.y htmltable.c input.c \
        pointset.c postproc.c psusershape.c routespl.c splines.c \
        svgusershape.c timing.c labels.c ns.c shapes.c utils.c \
index 1872c744e43c8860603665c7562ace306f4bb056..d93a64c05cb2517833fc111e8477e9350173672c 100644 (file)
@@ -6,6 +6,8 @@ include $(ROOT)/makearch/$(ARCH)
 INCS =  -I. \
         -I$(ROOT) \
         -I../cdt \
+       -I../pack \
+       -I../fdpgen \
         -I../pathplan \
        -I../gd \
        -I../graph \
similarity index 100%
rename from cmd/dot/args.c
rename to lib/common/args.c