]> granicus.if.org Git - graphviz/commitdiff
move lasi plugin to graphviz-x
authorJohn Ellson <ellson@research.att.com>
Sun, 22 Jan 2012 22:22:30 +0000 (17:22 -0500)
committerJohn Ellson <ellson@research.att.com>
Sun, 22 Jan 2012 22:22:30 +0000 (17:22 -0500)
awk/stringize.awk
cmd/dot/Makefile.am
cmd/dot/dot_builtins.c
graphviz.spec.in
plugin/core/gvloadimage_core.c
plugin/lasi/Makefile.am
plugin/lasi/gvloadimage_lasi.c [new file with mode: 0644]
plugin/lasi/gvplugin_lasi.c

index 1e73dc14c75ad17a61e4b395aa7ecc23fb093b7d..05a75914e59d3d71cc3a9139ce6e20b98e74d0b5 100755 (executable)
@@ -9,7 +9,7 @@
 # * Contributors: See CVS logs. Details at http://www.graphviz.org/
 # *************************************************************************/
 
-BEGIN  { s = ARGV[1]; gsub (".*/", "", s); gsub("\\.","_",s); printf("const char *%s[] = {\n",s); }
+BEGIN  { s = ARGV[1]; gsub (".*/", "", s); gsub("\\.","_",s); printf("static const char *%s[] = {\n",s); }
 /^#/   { print $0; next; }
                { gsub("\\\\","&&",$0); printf("\"%s\",\n",$0); }
 END            { printf("(char*)0 };\n"); }
index 750e9644e21ce4ae2c9565cc16d3f1a162874749..2f544aa7354cd6989e6cb6e4acb850e3c65f95f4 100644 (file)
@@ -124,6 +124,11 @@ dot_builtins_LDADD += $(top_builddir)/plugin/webp/libgvplugin_webp.la $(WEBP_LIB
 endif
 endif
 
+if WITH_LASI
+dot_static_LDADD += $(top_builddir)/plugin/lasi/.libs/libgvplugin_lasi_C.a $(LASI_LIBS) -lstdc++
+dot_builtins_LDADD += $(top_builddir)/plugin/lasi/libgvplugin_lasi.la $(LASI_LIBS) -lstdc++
+endif
+
 EXTRA_DIST = Makefile.old dot.1 dot.1.pdf osage.1 osage.1.pdf patchwork.1 patchwork.1.pdf dot.vcproj
 
 DISTCLEANFILES = dot.1.pdf osage.1.pdf
index 2a83732435358e90fc2ef4b2684fc1d76d4c1fda..398c930230c66aa945a9d48d97dfe20a4e79eacf 100644 (file)
@@ -32,6 +32,9 @@ extern gvplugin_library_t gvplugin_pango_LTX_library;
 extern gvplugin_library_t gvplugin_webp_LTX_library;
 #endif
 #endif
+#ifdef HAVE_LASI
+extern gvplugin_library_t gvplugin_lasi_LTX_library;
+#endif
 extern gvplugin_library_t gvplugin_core_LTX_library;
 
 
@@ -44,6 +47,9 @@ lt_symlist_t lt_preloaded_symbols[] = {
        { "gvplugin_webp_LTX_library", (void*)(&gvplugin_webp_LTX_library) },
 #endif
 #endif
+#ifdef HAVE_LASI
+       { "gvplugin_lasi_LTX_library", (void*)(&gvplugin_lasi_LTX_library) },
+#endif
 #ifdef HAVE_LIBGD
        { "gvplugin_gd_LTX_library", (void*)(&gvplugin_gd_LTX_library) },
 #endif
index ee3e6a7b817343f7e0a66ad866cf0bcf67032df8..5bdc3232513ce9bf33acab3aff18f8c9f3253601 100644 (file)
@@ -205,6 +205,9 @@ fi
 %if 0%{?PANGOCAIRO}
 %exclude %{_libdir}/graphviz/libgvplugin_pango.*
 %endif
+%if 0%{?LASI}
+%exclude %{_libdir}/graphviz/libgvplugin_lasi.*
+%endif
 %if 0%{?GDK_PIXBUF}
 %exclude %{_libdir}/graphviz/libgvplugin_gdk_pixbuf.*
 %endif
@@ -225,6 +228,7 @@ fi
 %exclude %{_libdir}/graphviz/*fdb
 %endif
 %if 0%{?SMYRNA}
+%exclude %{_bindir}/smyrna
 %exclude %{_datadir}/graphviz/smyrna
 %endif
 
@@ -253,6 +257,9 @@ LD_LIBRARY_PATH=$RPM_INSTALL_PREFIX0/%{_lib} $RPM_INSTALL_PREFIX0/bin/dot -c
 %if 0%{?PANGOCAIRO}
 %{_libdir}/graphviz/libgvplugin_pango.*
 %endif
+%if 0%{?LASI}
+%{_libdir}/graphviz/libgvplugin_lasi.*
+%endif
 %if 0%{?GDK_PIXBUF}
 %{_libdir}/graphviz/libgvplugin_gdk_pixbuf.*
 %endif
@@ -263,6 +270,7 @@ LD_LIBRARY_PATH=$RPM_INSTALL_PREFIX0/%{_lib} $RPM_INSTALL_PREFIX0/bin/dot -c
 %endif
 %{_libdir}/graphviz/libgvplugin_xlib.*
 %if 0%{?SMYRNA}
+%{_bindir}/smyrna
 %{_datadir}/graphviz/smyrna
 %endif
 
@@ -502,12 +510,17 @@ Perl extension for graphviz.
 Group:          Applications/Multimedia
 Summary:        PHP extension for graphviz
 Requires:       graphviz = %{version}-%{release} php
+%if 0%{?fedora} >= 17
+Requires:       php(zend-abi) = %{php_zend_api}
+Requires:       php(api) = %{php_core_api}
+%else
 %if 0%{?fedora} == 16
 Requires:       php-api = %{php_apiver}
 %else
 Requires:       php(zend-abi) = %{php_zend_api}
 Requires:       php(api) = %{php_core_api}
 %endif
+%endif
 
 %description php
 PHP extension for graphviz.
index a31730235adf22b104645d7b6ac62947c874c644..ebefe511087ce757453dbf9ccd4cf626dab8a30b 100644 (file)
@@ -297,9 +297,7 @@ gvplugin_installed_t gvloadimage_core_types[] = {
     {FORMAT_JPEG_VRML, "jpg:vrml", 1, &engine_vrml, NULL},
 
     {FORMAT_PS_PS, "eps:ps", 1, &engine_ps, NULL},
-    {FORMAT_PS_PS, "eps:lasi", 1, &engine_ps, NULL},
     {FORMAT_PS_PS, "ps:ps", 1, &engine_ps, NULL},
-    {FORMAT_PS_PS, "ps:lasi", 1, &engine_ps, NULL},
     {FORMAT_PSLIB_PS, "(lib):ps", 1, &engine_pslib, NULL},  /* for pslib */
 
     {FORMAT_PNG_MAP, "png:map", 1, &engine_null, NULL},
index 5a508ddab09cd793ff5dfcf57fb1fa0fe35f4554..734c1d9d9392388e70f571ab58364e34237cdc9b 100644 (file)
@@ -30,6 +30,7 @@ endif
 libgvplugin_lasi_C_la_SOURCES = \
        gvplugin_lasi.c \
        gvrender_lasi.cpp \
+       gvloadimage_lasi.c \
        ps.txt
 
 libgvplugin_lasi_la_LDFLAGS = -version-info @GVPLUGIN_VERSION_INFO@
diff --git a/plugin/lasi/gvloadimage_lasi.c b/plugin/lasi/gvloadimage_lasi.c
new file mode 100644 (file)
index 0000000..612baaa
--- /dev/null
@@ -0,0 +1,111 @@
+/* $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 HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#ifdef _MSC_VER
+#include <io.h>
+#endif
+
+#include "gvplugin_loadimage.h"
+#include "agxbuf.h"
+#include "utils.h"
+#include "gvio.h"
+
+extern shape_desc *find_user_shape(char *name);
+
+typedef enum {
+    FORMAT_PS_PS,
+} format_type;
+
+static void ps_freeimage(usershape_t *us)
+{
+#if HAVE_SYS_MMAN_H
+    munmap(us->data, us->datasize);
+#else
+    free(us->data);
+#endif
+}
+
+/* usershape described by a postscript file */
+static void lasi_loadimage_ps(GVJ_t * job, usershape_t *us, boxf b, boolean filled)
+{
+    assert(job);
+    assert(us);
+    assert(us->name);
+
+    if (us->data) {
+        if (us->datafree != ps_freeimage) {
+            us->datafree(us);        /* free incompatible cache data */
+            us->data = NULL;
+            us->datafree = NULL;
+            us->datasize = 0;
+        }
+    }
+
+    if (!us->data) { /* read file into cache */
+        int fd;
+       struct stat statbuf;
+
+       if (!gvusershape_file_access(us))
+           return;
+       fd = fileno(us->f);
+        switch (us->type) {
+            case FT_PS:
+            case FT_EPS:
+               fstat(fd, &statbuf);
+               us->datasize = statbuf.st_size;
+#if HAVE_SYS_MMAN_H
+               us->data = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
+#else
+               us->data = malloc(statbuf.st_size);
+               read(fd, us->data, statbuf.st_size);
+#endif
+               us->must_inline = TRUE;
+                break;
+            default:
+                break;
+        }
+        if (us->data)
+            us->datafree = ps_freeimage;
+       gvusershape_file_release(us);
+    }
+
+    if (us->data) {
+        gvprintf(job, "gsave %g %g translate newpath\n",
+               b.LL.x - (double)(us->x), b.LL.y - (double)(us->y));
+        if (us->must_inline)
+            epsf_emit_body(job, us);
+        else
+            gvprintf(job, "user_shape_%d\n", us->macro_id);
+        gvprintf(job, "grestore\n");
+    }
+}
+
+static gvloadimage_engine_t engine_ps = {
+    lasi_loadimage_ps
+};
+
+gvplugin_installed_t gvloadimage_lasi_types[] = {
+    {FORMAT_PS_PS, "eps:lasi", 1, &engine_ps, NULL},
+    {FORMAT_PS_PS, "ps:lasi", 1, &engine_ps, NULL},
+    {0, NULL, 0, NULL, NULL}
+};
index 72a161251fa688a5cf41aa6f4d582182bc7768e9..571102e568a5d3c76b0147a62a7fa7fd7737b110 100644 (file)
 
 extern gvplugin_installed_t gvdevice_lasi_types[];
 extern gvplugin_installed_t gvrender_lasi_types[];
+extern gvplugin_installed_t gvloadimage_lasi_types[];
 
 static gvplugin_api_t apis[] = {
     {API_device, gvdevice_lasi_types},
     {API_render, gvrender_lasi_types},
+    {API_render, gvloadimage_lasi_types},
     {(api_t)0, 0},
 };