[gegl/xml: 6/12] add a small program to help convert xml files



commit 0cf49f054432a45d894137def312a99d47eaefb4
Author: Michael Muré <mure michael gmail com>
Date:   Sun Jul 29 20:31:11 2012 +0900

    add a small program to help convert xml files

 tools/Makefile.am |  6 +++---
 tools/xml1to2.c   | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 3 deletions(-)
---
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 8f1077d..bf2bf4c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -24,11 +24,11 @@ AM_LDFLAGS = \
        $(top_builddir)/gegl/libgegl-$(GEGL_API_VERSION).la \
        $(DEP_LIBS) $(BABL_LIBS)
 
-noinst_PROGRAMS = introspect operation_reference img_cmp
+noinst_PROGRAMS = introspect operation_reference img_cmp xml1to2
 
 if HAVE_EXIV2
-noinst_PROGRAMS     += exp_combine 
+noinst_PROGRAMS     += exp_combine
 exp_combine_SOURCES  = exp_combine.cpp
-exp_combine_LDADD    = $(EXIV2_LIBS) 
+exp_combine_LDADD    = $(EXIV2_LIBS)
 exp_combine_CXXFLAGS = $(AM_CFLAGS) $(EXIV2_CFLAGS)
 endif
diff --git a/tools/xml1to2.c b/tools/xml1to2.c
new file mode 100644
index 0000000..57e8030
--- /dev/null
+++ b/tools/xml1to2.c
@@ -0,0 +1,52 @@
+/* This file is part of GEGL editor -- a gtk frontend for GEGL
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2012 Michael Muré <batolettre gmail com>
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <gegl.h>
+#include <gegl-xml-v2.h>
+
+static G_GNUC_NORETURN void
+usage (char *application_name)
+{
+    g_print ( "usage: %s file\n"
+              "\n"
+              "Convert a xml v1 grah into a xml v2 graph.\n"
+              , application_name);
+    exit (0);
+}
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+  GeglNode    *gegl      = NULL;
+
+  gegl_init (&argc, &argv);
+
+  if (argc==1)
+      usage (argv[0]);
+
+  gegl = gegl_node_new_from_file(argv[1]);
+
+  g_print (gegl_node_to_xml_v2 (gegl, g_get_current_dir ()));
+
+  gegl_exit ();
+  return 0;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]