summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Piñeiro <apinheiro@igalia.com>2012-12-19 20:38:33 +0100
committerAlejandro Piñeiro <apinheiro@igalia.com>2012-12-28 17:01:25 +0100
commit4be5925ff700ea14aca81b021ee0544469ac837d (patch)
tree968b6c46af93433c12bc8a94e561c43366ab29a7
parent8e6a0349f7e2b63f2c82ebbb26d38394cae67eae (diff)
downloadatk-4be5925ff700ea14aca81b021ee0544469ac837d.tar.gz
ATK lacks any kind of version utilities
Added some versioning methods heavily based on gtk ones https://bugzilla.gnome.org/show_bug.cgi?id=690379
-rw-r--r--.gitignore1
-rw-r--r--atk/Makefile.am4
-rwxr-xr-xatk/atk.h1
-rw-r--r--atk/atkversion.c127
-rw-r--r--atk/atkversion.h.in115
-rw-r--r--configure.ac1
-rw-r--r--docs/atk-docs.sgml6
-rw-r--r--docs/atk-sections.txt14
8 files changed, 268 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d9e6ce3..b48d386 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,4 @@ Makefile.in
/missing
/mkinstalldirs
/stamp-h1
+atkversion.h \ No newline at end of file
diff --git a/atk/Makefile.am b/atk/Makefile.am
index 1532bdf..573f21f 100644
--- a/atk/Makefile.am
+++ b/atk/Makefile.am
@@ -58,6 +58,7 @@ atk_sources = \
atkutil.c \
atkmisc.c \
atkvalue.c \
+ atkversion.c \
atkwindow.c
libatk_1_0_la_SOURCES = \
@@ -100,6 +101,7 @@ atk_headers = \
libatkinclude_HEADERS = \
$(atk_headers) \
+ atkversion.h \
atk-enum-types.h
@@ -216,7 +218,7 @@ atk-$(ATK_API_VERSION).lib: libatk-$(ATK_API_VERSION).la atk.def
lib -machine:$(LIB_EXE_MACHINE_FLAG) -name:libatk-$(ATK_API_VERSION)-$(LT_CURRENT_MINUS_AGE).dll -def:atk.def -out:$@
-EXTRA_DIST = atk.symbols atk.rc.in atkmarshal.list atkintl.h atk.rc
+EXTRA_DIST = atk.symbols atk.rc.in atkmarshal.list atkintl.h atk.rc atkversion.h.in
dist-hook: ../build/win32/vs9/atk.vcproj ../build/win32/vs10/atk.vcxproj ../build/win32/vs10/atk.vcxproj.filters
diff --git a/atk/atk.h b/atk/atk.h
index d51aa52..f686212 100755
--- a/atk/atk.h
+++ b/atk/atk.h
@@ -50,6 +50,7 @@
#include <atk/atkutil.h>
#include <atk/atkmisc.h>
#include <atk/atkvalue.h>
+#include <atk/atkversion.h>
#include <atk/atkwindow.h>
#undef __ATK_H_INSIDE__
diff --git a/atk/atkversion.c b/atk/atkversion.c
new file mode 100644
index 0000000..51f64b3
--- /dev/null
+++ b/atk/atkversion.c
@@ -0,0 +1,127 @@
+/* ATK - Accessibility Toolkit
+ *
+ * Copyright (C) 2012 Igalia, S.L.
+ *
+ * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "atk.h"
+
+/**
+ * SECTION:atkversion
+ * @Short_description: Variables and functions to check the ATK version
+ * @Title: Versioning macros
+ *
+ * ATK provides a set of macros and methods for checking the version
+ * of the library at compile and run time.
+ */
+
+/**
+ * atk_get_major_version:
+ *
+ * Returns the major version number of the ATK library. (e.g. in ATK
+ * version 2.7.4 this is 2.)
+ *
+ * This function is in the library, so it represents the ATK library
+ * your code is running against. In contrast, the #ATK_MAJOR_VERSION
+ * macro represents the major version of the ATK headers you have
+ * included when compiling your code.
+ *
+ * Returns: the major version number of the ATK library
+ *
+ * Since: 2.7.4
+ */
+guint
+atk_get_major_version (void)
+{
+ return ATK_MAJOR_VERSION;
+}
+
+/**
+ * atk_get_minor_version:
+ *
+ * Returns the minor version number of the ATK library. (e.g. in ATK
+ * version 2.7.4 this is 7.)
+ *
+ * This function is in the library, so it represents the ATK library
+ * your code is are running against. In contrast, the
+ * #ATK_MINOR_VERSION macro represents the minor version of the ATK
+ * headers you have included when compiling your code.
+ *
+ * Returns: the minor version number of the ATK library
+ *
+ * Since: 2.7.4
+ */
+guint
+atk_get_minor_version (void)
+{
+ return ATK_MINOR_VERSION;
+}
+
+/**
+ * atk_get_micro_version:
+ *
+ * Returns the micro version number of the ATK library. (e.g. in ATK
+ * version 2.7.4 this is 4.)
+ *
+ * This function is in the library, so it represents the ATK library
+ * your code is are running against. In contrast, the
+ * #ATK_MICRO_VERSION macro represents the micro version of the ATK
+ * headers you have included when compiling your code.
+ *
+ * Returns: the micro version number of the ATK library
+ *
+ * Since: 2.7.4
+ */
+guint
+atk_get_micro_version (void)
+{
+ return ATK_MICRO_VERSION;
+}
+
+/**
+ * atk_get_binary_age:
+ *
+ * Returns the binary age as passed to libtool when building the ATK
+ * library the process is running against.
+ *
+ * Returns: the binary age of the ATK library
+ *
+ * Since: 2.7.4
+ */
+guint
+atk_get_binary_age (void)
+{
+ return ATK_BINARY_AGE;
+}
+
+/**
+ * atk_get_interface_age:
+ *
+ * Returns the interface age as passed to libtool when building the
+ * ATK library the process is running against.
+ *
+ * Returns: the interface age of the ATK library
+ *
+ * Since: 2.7.4
+ */
+guint
+atk_get_interface_age (void)
+{
+ return ATK_INTERFACE_AGE;
+}
diff --git a/atk/atkversion.h.in b/atk/atkversion.h.in
new file mode 100644
index 0000000..65c9ece
--- /dev/null
+++ b/atk/atkversion.h.in
@@ -0,0 +1,115 @@
+/* ATK - Accessibility Toolkit
+ *
+ * Copyright (C) 2012 Igalia, S.L.
+ *
+ * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
+#error "Only <atk/atk.h> can be included directly."
+#endif
+
+#ifndef __ATK_VERSION_H__
+#define __ATK_VERSION_H__
+
+/**
+ * ATK_MAJOR_VERSION:
+ *
+ * Like atk_get_major_version(), but from the headers used at
+ * application compile time, rather than from the library linked
+ * against at application run time.
+ *
+ * Since: 2.7.4
+ */
+#define ATK_MAJOR_VERSION (@ATK_MAJOR_VERSION@)
+
+/**
+ * ATK_MINOR_VERSION:
+ *
+ * Like atk_get_minor_version(), but from the headers used at
+ * application compile time, rather than from the library linked
+ * against at application run time.
+ *
+ * Since: 2.7.4
+ */
+#define ATK_MINOR_VERSION (@ATK_MINOR_VERSION@)
+
+/**
+ * ATK_MICRO_VERSION:
+ *
+ * Like atk_get_micro_version(), but from the headers used at
+ * application compile time, rather than from the library linked
+ * against at application run time.
+ *
+ * Since: 2.7.4
+ */
+#define ATK_MICRO_VERSION (@ATK_MICRO_VERSION@)
+
+/**
+ * ATK_BINARY_AGE:
+ *
+ * Like atk_get_binary_age(), but from the headers used at
+ * application compile time, rather than from the library linked
+ * against at application run time.
+ *
+ * Since: 2.7.4
+ */
+#define ATK_BINARY_AGE (@ATK_BINARY_AGE@)
+
+/**
+ * ATK_INTERFACE_AGE:
+ *
+ * Like atk_get_interface_age(), but from the headers used at
+ * application compile time, rather than from the library linked
+ * against at application run time.
+ *
+ * Since: 2.7.4
+ */
+#define ATK_INTERFACE_AGE (@ATK_INTERFACE_AGE@)
+
+/**
+ * ATK_CHECK_VERSION:
+ * @major: major version (e.g. 1 for version 1.2.5)
+ * @minor: minor version (e.g. 2 for version 1.2.5)
+ * @micro: micro version (e.g. 5 for version 1.2.5)
+ *
+ * Returns %TRUE if the version of the ATK header files is the same as
+ * or newer than the passed-in version.
+ *
+ * Since: 2.7.4
+ */
+#define ATK_CHECK_VERSION(major,minor,micro) \
+ (ATK_MAJOR_VERSION > (major) || \
+ (ATK_MAJOR_VERSION == (major) && ATK_MINOR_VERSION > (minor)) || \
+ (ATK_MAJOR_VERSION == (major) && ATK_MINOR_VERSION == (minor) && \
+ ATK_MICRO_VERSION >= (micro)))
+
+
+guint atk_get_major_version (void) G_GNUC_CONST;
+guint atk_get_minor_version (void) G_GNUC_CONST;
+guint atk_get_micro_version (void) G_GNUC_CONST;
+guint atk_get_binary_age (void) G_GNUC_CONST;
+guint atk_get_interface_age (void) G_GNUC_CONST;
+
+#define atk_major_version atk_get_major_version ()
+#define atk_minor_version atk_get_minor_version ()
+#define atk_micro_version atk_get_micro_version ()
+#define atk_binary_age atk_get_binary_age ()
+#define atk_interface_age atk_get_interface_age ()
+
+#endif /* __ATK_VERSION_H__ */
diff --git a/configure.ac b/configure.ac
index 81df4ce..dcb73a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,6 +222,7 @@ atk.pc
atk-uninstalled.pc
atk/Makefile
atk/atk.rc
+atk/atkversion.h
tests/Makefile
build/Makefile
build/win32/Makefile
diff --git a/docs/atk-docs.sgml b/docs/atk-docs.sgml
index 71f0987..f7b22aa 100644
--- a/docs/atk-docs.sgml
+++ b/docs/atk-docs.sgml
@@ -28,6 +28,7 @@
<!ENTITY atk-AtkUtil SYSTEM "xml/atkutil.xml">
<!ENTITY atk-AtkValue SYSTEM "xml/atkvalue.xml">
<!ENTITY atk-AtkWindow SYSTEM "xml/atkwindow.xml">
+ <!ENTITY atk-AtkVersion SYSTEM "xml/atkversion.xml">
<!ENTITY version SYSTEM "version.xml">
]>
@@ -69,6 +70,11 @@
&atk-AtkWindow;
</chapter>
+ <chapter id="atk">
+ <title>Utilities</title>
+ &atk-AtkVersion;
+ </chapter>
+
<index id="api-index-full">
<title>Index of all symbols</title>
</index>
diff --git a/docs/atk-sections.txt b/docs/atk-sections.txt
index 79f58b6..cebef89 100644
--- a/docs/atk-sections.txt
+++ b/docs/atk-sections.txt
@@ -654,3 +654,17 @@ ATK_TYPE_WINDOW
AtkWindowClass
atk_window_get_type
</SECTION>
+
+<SECTION>
+<FILE>atkversion</FILE>
+<TITLE>Versioning Utilities</TITLE>
+atk_get_major_version
+atk_get_minor_version
+atk_get_micro_version
+atk_get_binary_age
+atk_get_interface_age
+ATK_MAJOR_VERSION
+ATK_MINOR_VERSION
+ATK_MICRO_VERSION
+ATK_CHECK_VERSION
+</SECTION>