[libgxps] Add version macros
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Add version macros
- Date: Tue, 11 Oct 2011 16:50:33 +0000 (UTC)
commit 9531079bc9c942eba02e5b02ff8c8caf9d10ce3b
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue Oct 11 18:47:07 2011 +0200
Add version macros
TODO | 1 -
configure.ac | 1 +
docs/reference/libgxps-docs.sgml | 1 +
docs/reference/libgxps-sections.txt | 9 ++++
libgxps/Makefile.am | 11 ++++-
libgxps/gxps-version.h.in | 76 +++++++++++++++++++++++++++++++++++
6 files changed, 96 insertions(+), 3 deletions(-)
---
diff --git a/TODO b/TODO
index e6612d2..6420b12 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
General
-------
-- Version API (Check macros)
- Tools: xps2ps, xps2pdf, xps2html, ...
- Regression tests
- API tests
diff --git a/configure.ac b/configure.ac
index d4ceb4e..b96be98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,6 +181,7 @@ AC_CONFIG_FILES([
Makefile
libgxps.pc
libgxps/Makefile
+libgxps/gxps-version.h
test/Makefile
docs/Makefile
docs/reference/Makefile
diff --git a/docs/reference/libgxps-docs.sgml b/docs/reference/libgxps-docs.sgml
index d945a10..4e30497 100644
--- a/docs/reference/libgxps-docs.sgml
+++ b/docs/reference/libgxps-docs.sgml
@@ -19,6 +19,7 @@
<xi:include href="xml/gxps-links.xml"/>
<xi:include href="xml/gxps-document-structure.xml"/>
<xi:include href="xml/gxps-error.xml"/>
+ <xi:include href="xml/gxps-version.xml"/>
</chapter>
<index id="api-index-full">
diff --git a/docs/reference/libgxps-sections.txt b/docs/reference/libgxps-sections.txt
index 4745bd9..49c32be 100644
--- a/docs/reference/libgxps-sections.txt
+++ b/docs/reference/libgxps-sections.txt
@@ -135,3 +135,12 @@ GXPSError
<SUBSECTION Private>
gxps_error_quark
</SECTION>
+
+<SECTION>
+<FILE>gxps-version</FILE>
+<TITLE>Version Information</TITLE>
+GXPS_MAJOR_VERSION
+GXPS_MINOR_VERSION
+GXPS_MICRO_VERSION
+GXPS_CHECK_VERSION
+</SECTION>
diff --git a/libgxps/Makefile.am b/libgxps/Makefile.am
index 57dfc18..c833f82 100644
--- a/libgxps/Makefile.am
+++ b/libgxps/Makefile.am
@@ -15,7 +15,8 @@ INST_H_FILES = \
gxps-error.h \
gxps-file.h \
gxps-links.h \
- gxps-page.h
+ gxps-page.h \
+ gxps-version.h
libgxpsincludedir = $(includedir)/libgxps
libgxpsinclude_HEADERS = $(INST_H_FILES)
@@ -60,6 +61,12 @@ libgxps_la_LIBADD = \
$(LIBJPEG) \
$(LIBTIFF)
+EXTRA_DIST = \
+ gxps-version.h.in
+
+DISTCLEANFILES = \
+ gxps-version.h
+
CLEANFILES =
-include $(INTROSPECTION_MAKEFILE)
@@ -68,7 +75,7 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --identifie
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
-introspection_sources = $(filter-out $(NOINST_H_FILES) gxps-archive.c gxps-fonts.c gxps-images.c gxps-parse-utils.c, $(libgxps_la_SOURCES))
+introspection_sources = $(filter-out $(NOINST_H_FILES) gxps-archive.c gxps-fonts.c gxps-images.c gxps-parse-utils.c gxps-version.h, $(libgxps_la_SOURCES))
GXPS-0.1.gir: libgxps.la
GXPS_0_1_gir_INCLUDES = GObject-2.0 Gio-2.0 cairo-1.0
diff --git a/libgxps/gxps-version.h.in b/libgxps/gxps-version.h.in
new file mode 100644
index 0000000..cb15cd4
--- /dev/null
+++ b/libgxps/gxps-version.h.in
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 Carlos Garcia Campos <carlosgc gnome org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * SECTION:gxps-version
+ * @Short_description: Variables and functions to check the GXPS version
+ * @Title: Version Information
+ *
+ * GXPS provides version information, primarily useful in configure checks
+ * for builds that have a configure script. Applications will not typically
+ * use the features described here.
+ */
+
+#if !defined (__GXPS_H_INSIDE__) && !defined (GXPS_COMPILATION)
+#error "Only <libgxps/gxps.h> can be included directly."
+#endif
+
+#ifndef __GXPS_VERSION_H__
+#define __GXPS_VERSION_H__
+
+/**
+ * GXPS_MAJOR_VERSION:
+ *
+ * The major version number of the GXPS header files (e.g. in GXPS version
+ * 0.1.2 this is 0.)
+ */
+#define GXPS_MAJOR_VERSION(@GXPS_MAJOR_VERSION@)
+
+/**
+ * GXPS_MINOR_VERSION:
+ *
+ * The major version number of the GXPS header files (e.g. in GXPS version
+ * 0.1.2 this is 1.)
+ */
+#define GXPS_MINOR_VERSION(@GXPS_MINOR_VERSION@)
+
+/**
+ * GXPS_MICRO_VERSION:
+ *
+ * The micro version number of the GXPS header files (e.g. in GXPS version
+ * 0.1.2 this is 2.)
+ */
+#define GXPS_MICRO_VERSION(@GXPS_MICRO_VERSION@)
+
+/**
+ * GXPS_CHECK_VERSION:
+ * @major: major version (e.g. 0 for version 0.1.2)
+ * @minor: minor version (e.g. 1 for version 0.1.2)
+ * @micro: micro version (e.g. 2 for version 0.1.2)
+ *
+ * Checks the version fo the GXPS library
+ *
+ * Returns: %TRUE if the version of the GXPS header files is the same
+ * as or newer than the passed-in version
+ */
+#define GXPS_CHECK_VERSION(major,minor,micro) \
+ (GXPS_MAJOR_VERSION > (major) || \
+ (GXPS_MAJOR_VERSION == (major) && GXPS_MINOR_VERSION > (minor)) || \
+ (GXPS_MAJOR_VERSION == (major) && GXPS_MINOR_VERSION == (minor) && GXPS_MICRO_VERSION >= (micro)))
+
+#endif /* __GXPS_VERSION_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]