[Xcb-commit] configure.ac src

Arnaud Fontaine arnau at kemper.freedesktop.org
Tue May 24 22:08:11 PDT 2011


 configure.ac       |    9 ---
 src/.gitignore     |    3 -
 src/Makefile.am    |   17 -------
 src/atomlist.m4    |   71 -------------------------------
 src/atoms.c        |   76 +++++++++++++++++++++++++++++++++
 src/atoms.gperf.m4 |  121 -----------------------------------------------------
 src/xcb_atom.h     |   18 +++++++
 src/xcb_atom.h.m4  |   21 ---------
 8 files changed, 96 insertions(+), 240 deletions(-)

New commits:
commit 69fd3c5ec820dedfa743ea677d0618c63fe292de
Author: Arnaud Fontaine <arnau at debian.org>
Date:   Wed May 25 14:08:58 2011 +0900

    Do not rely anymore on gperf and m4 following removal of deprecated atoms.
    
    As atoms were deprecated by 0a5c59f, gperf and m4 are not needed anymore, thus
    rename files accordingly and downgrade minimum required version of autoconf
    (2.62 was only needed to check for M4 in M4 util macro).
    
    Also, remove xcb_atom_get_predefined() and xcb_atom_get_name_predefined()
    which were only meaningful for those atoms and bump the SONAME accordingly.
    
    Signed-off-by: Arnaud Fontaine <arnau at debian.org>

diff --git a/configure.ac b/configure.ac
index 0153adf..b951ec6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,19 +1,12 @@
-dnl XCB_UTIL_M4_WITH_INCLUDE_PATH requires Autoconf >= 2.62
-AC_PREREQ(2.62)
+AC_PREREQ(2.59c)
 AC_INIT([xcb-util],0.3.8,[xcb at lists.freedesktop.org])
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
-XCB_UTIL_M4_WITH_INCLUDE_PATH
 XCB_UTIL_COMMON([1.4], [1.6])
 
-AC_CHECK_PROGS(GPERF, gperf, [no])
-if test $GPERF = "no"; then
-        AC_MSG_ERROR([Can't find gperf, please install it and try again])
-fi
-
 AC_CHECK_FUNCS_ONCE(vasprintf)
 AC_TYPE_SSIZE_T
 
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 53b2643..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-atoms.c
-atoms.gperf
-xcb_atom.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 43a4ec5..2545ad6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,10 @@
-
 lib_LTLIBRARIES = libxcb-util.la
 
 AM_CPPFLAGS = $(XCB_CFLAGS)
 AM_CFLAGS = $(CWARNFLAGS)
 
 libxcb_util_la_LIBADD = $(XCB_LIBS)
-libxcb_util_la_LDFLAGS = -version-info 0:0:0 -no-undefined
+libxcb_util_la_LDFLAGS = -version-info 1:0:0 -no-undefined
 libxcb_util_la_SOURCES = \
 	atoms.c		\
 	event.c		\
@@ -16,17 +15,3 @@ xcbinclude_HEADERS =	\
 	xcb_atom.h	\
 	xcb_aux.h	\
 	xcb_event.h
-
-BUILT_SOURCES = atoms.c atoms.gperf xcb_atom.h
-CLEANFILES = $(BUILT_SOURCES)
-EXTRA_DIST = atomlist.m4  atoms.gperf.m4  xcb_atom.h.m4
-
-atoms.c: atoms.gperf
-	$(GPERF) --output-file $@ $<
-
-atoms.gperf: $(srcdir)/atoms.gperf.m4 $(srcdir)/atomlist.m4
-	$(M4) -I$(srcdir) $< >$@
-
-xcb_atom.h: $(srcdir)/xcb_atom.h.m4 $(srcdir)/atomlist.m4
-	$(M4) -I$(srcdir) $< >$@
-
diff --git a/src/atomlist.m4 b/src/atomlist.m4
deleted file mode 100644
index 1c84740..0000000
--- a/src/atomlist.m4
+++ /dev/null
@@ -1,71 +0,0 @@
-define(`FOREACH', `ifelse(`$1', , , `DO($1)
-FOREACH(shift($@))')')FOREACH(
-PRIMARY,
-SECONDARY,
-ARC,
-ATOM,
-BITMAP,
-CARDINAL,
-COLORMAP,
-CURSOR,
-CUT_BUFFER0,
-CUT_BUFFER1,
-CUT_BUFFER2,
-CUT_BUFFER3,
-CUT_BUFFER4,
-CUT_BUFFER5,
-CUT_BUFFER6,
-CUT_BUFFER7,
-DRAWABLE,
-FONT,
-INTEGER,
-PIXMAP,
-POINT,
-RECTANGLE,
-RESOURCE_MANAGER,
-RGB_COLOR_MAP,
-RGB_BEST_MAP,
-RGB_BLUE_MAP,
-RGB_DEFAULT_MAP,
-RGB_GRAY_MAP,
-RGB_GREEN_MAP,
-RGB_RED_MAP,
-STRING,
-VISUALID,
-WINDOW,
-WM_COMMAND,
-WM_HINTS,
-WM_CLIENT_MACHINE,
-WM_ICON_NAME,
-WM_ICON_SIZE,
-WM_NAME,
-WM_NORMAL_HINTS,
-WM_SIZE_HINTS,
-WM_ZOOM_HINTS,
-MIN_SPACE,
-NORM_SPACE,
-MAX_SPACE,
-END_SPACE,
-SUPERSCRIPT_X,
-SUPERSCRIPT_Y,
-SUBSCRIPT_X,
-SUBSCRIPT_Y,
-UNDERLINE_POSITION,
-UNDERLINE_THICKNESS,
-STRIKEOUT_ASCENT,
-STRIKEOUT_DESCENT,
-ITALIC_ANGLE,
-X_HEIGHT,
-QUAD_WIDTH,
-WEIGHT,
-POINT_SIZE,
-RESOLUTION,
-COPYRIGHT,
-NOTICE,
-FONT_NAME,
-FAMILY_NAME,
-FULL_NAME,
-CAP_HEIGHT,
-WM_CLASS,
-WM_TRANSIENT_FOR,
-)dnl
diff --git a/src/atoms.c b/src/atoms.c
new file mode 100644
index 0000000..7b3aec6
--- /dev/null
+++ b/src/atoms.c
@@ -0,0 +1,76 @@
+/* Rely on vasprintf (GNU extension) instead of vsnprintf if
+   possible... */
+#ifdef HAVE_VASPRINTF
+#define _GNU_SOURCE
+#include <stdio.h>
+#endif
+
+#include <xcb/xcb.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "xcb_atom.h"
+
+static char *makename(const char *fmt, ...)
+{
+	char *ret;
+	int n;
+	va_list ap;
+
+#ifndef HAVE_VASPRINTF
+	char *np;
+	int size = 64;
+
+	/* First allocate 'size' bytes, should be enough usually */
+	if((ret = malloc(size)) == NULL)
+		return NULL;
+
+	while(1)
+	{
+		va_start(ap, fmt);
+		n = vsnprintf(ret, size, fmt, ap);
+		va_end(ap);
+
+		if(n < 0)
+			return NULL;
+
+		if(n < size)
+			return ret;
+
+		size = n + 1;
+		if((np = realloc(ret, size)) == NULL)
+		{
+			free(ret);
+			return NULL;
+		}
+
+		ret = np;
+	}
+#else
+	va_start(ap, fmt);
+	n = vasprintf(&ret, fmt, ap);
+	va_end(ap);
+
+	if(n < 0)
+		return NULL;
+
+	return ret;
+#endif
+}
+
+char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
+{
+	return makename("%s_S%u", base, screen);
+}
+
+char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
+{
+	return makename("%s_R%08X", base, resource);
+}
+
+char *xcb_atom_name_unique(const char *base, uint32_t id)
+{
+	if(base)
+		return makename("%s_U%lu", base, id);
+	else
+		return makename("U%lu", id);
+}
diff --git a/src/atoms.gperf.m4 b/src/atoms.gperf.m4
deleted file mode 100644
index 8876e26..0000000
--- a/src/atoms.gperf.m4
+++ /dev/null
@@ -1,121 +0,0 @@
-%{
-
-/* Rely on vasprintf (GNU extension) instead of vsnprintf if
-   possible... */
-#ifdef HAVE_VASPRINTF
-#define _GNU_SOURCE
-#include <stdio.h>
-#endif
-
-#include <xcb/xcb.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "xcb_atom.h"
-
-%}
-
-%readonly-tables
-%pic
-%null-strings
-%enum
-%includes
-%compare-strncmp
-
-%struct-type
-struct atom_map { int name; xcb_atom_t value; };
-%%
-define(`COUNT', 0)dnl
-define(`DO', `$1,define(`COUNT', incr(COUNT))COUNT')dnl
-include(atomlist.m4)`'dnl
-%%
-
-static const char atom_names[] =
-define(`DO', `	"$1\0"')dnl
-include(atomlist.m4);
-
-static const uint16_t atom_name_offsets[] = {
-define(`OFFSET', 0)dnl
-define(`DO', `	OFFSET,define(`OFFSET', eval(OFFSET+1+len($1)))')dnl
-include(atomlist.m4)`'dnl
-};
-
-xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name)
-{
-	const struct atom_map *value = in_word_set(name, name_len);
-	xcb_atom_t ret = XCB_NONE;
-	if(value)
-		ret = value->value;
-	return ret;
-}
-
-const char *xcb_atom_get_name_predefined(xcb_atom_t atom)
-{
-	if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets)))
-		return 0;
-	return atom_names + atom_name_offsets[atom - 1];
-}
-
-static char *makename(const char *fmt, ...)
-{
-	char *ret;
-	int n;
-	va_list ap;
-
-#ifndef HAVE_VASPRINTF
-	char *np;
-	int size = 64;
-
-	/* First allocate 'size' bytes, should be enough usually */
-	if((ret = malloc(size)) == NULL)
-		return NULL;
-
-	while(1)
-	{
-		va_start(ap, fmt);
-		n = vsnprintf(ret, size, fmt, ap);
-		va_end(ap);
-
-		if(n < 0)
-			return NULL;
-
-		if(n < size)
-			return ret;
-
-		size = n + 1;
-		if((np = realloc(ret, size)) == NULL)
-		{
-			free(ret);
-			return NULL;
-		}
-
-		ret = np;
-	}
-#else
-	va_start(ap, fmt);
-	n = vasprintf(&ret, fmt, ap);
-	va_end(ap);
-
-	if(n < 0)
-		return NULL;
-
-	return ret;
-#endif
-}
-
-char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
-{
-	return makename("%s_S%u", base, screen);
-}
-
-char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
-{
-	return makename("%s_R%08X", base, resource);
-}
-
-char *xcb_atom_name_unique(const char *base, uint32_t id)
-{
-	if(base)
-		return makename("%s_U%lu", base, id);
-	else
-		return makename("U%lu", id);
-}
diff --git a/src/xcb_atom.h b/src/xcb_atom.h
new file mode 100644
index 0000000..d5c4d6b
--- /dev/null
+++ b/src/xcb_atom.h
@@ -0,0 +1,18 @@
+#ifndef __XCB_ATOM_H__
+#define __XCB_ATOM_H__
+
+#include <xcb/xcb.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *xcb_atom_name_by_screen(const char *base, uint8_t screen);
+char *xcb_atom_name_by_resource(const char *base, uint32_t resource);
+char *xcb_atom_name_unique(const char *base, uint32_t id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XCB_ATOM_H__ */
diff --git a/src/xcb_atom.h.m4 b/src/xcb_atom.h.m4
deleted file mode 100644
index 27449bd..0000000
--- a/src/xcb_atom.h.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __XCB_ATOM_H__
-#define __XCB_ATOM_H__
-
-#include <xcb/xcb.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name);
-const char *xcb_atom_get_name_predefined(xcb_atom_t atom);
-
-char *xcb_atom_name_by_screen(const char *base, uint8_t screen);
-char *xcb_atom_name_by_resource(const char *base, uint32_t resource);
-char *xcb_atom_name_unique(const char *base, uint32_t id);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XCB_ATOM_H__ */


More information about the xcb-commit mailing list