[cairo-commit] 2 commits - configure.in doc/public Makefile.am Makefile.win32 RELEASING src/cairo.c src/cairo-features-win32.h src/cairo.h src/cairo-image-surface.c src/cairo-misc.c src/cairo-version.h src/Makefile.am Version.mk

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Aug 28 14:29:49 PDT 2008


 Makefile.am                        |    2 -
 Makefile.win32                     |   15 +-----------
 RELEASING                          |   10 ++------
 Version.mk                         |   10 --------
 configure.in                       |   29 ++++--------------------
 doc/public/cairo-sections.txt      |    3 ++
 doc/public/tmpl/cairo-surface.sgml |    4 +--
 doc/public/tmpl/cairo-version.sgml |   16 +++++++++++++
 src/Makefile.am                    |    1 
 src/cairo-features-win32.h         |   26 ---------------------
 src/cairo-image-surface.c          |    3 +-
 src/cairo-misc.c                   |   44 +++++++++++++++++++++++++++++++++++++
 src/cairo-version.h                |    8 ++++++
 src/cairo.c                        |   43 ------------------------------------
 src/cairo.h                        |   37 ++++++++++++++++++++++++++-----
 15 files changed, 118 insertions(+), 133 deletions(-)

New commits:
commit 47b3c9aa3f7860326e624a053675112a7ad24419
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 28 17:29:32 2008 -0400

    Move version functions to cairo-misc.c

diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index 9a0ede0..960a8b6 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -126,6 +126,50 @@ cairo_status_to_string (cairo_status_t status)
 
 
 /**
+ * cairo_version:
+ *
+ * Returns the version of the cairo library encoded in a single
+ * integer as per %CAIRO_VERSION_ENCODE. The encoding ensures that
+ * later versions compare greater than earlier versions.
+ *
+ * A run-time comparison to check that cairo's version is greater than
+ * or equal to version X.Y.Z could be performed as follows:
+ *
+ * <informalexample><programlisting>
+ * if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...}
+ * </programlisting></informalexample>
+ *
+ * See also cairo_version_string() as well as the compile-time
+ * equivalents %CAIRO_VERSION and %CAIRO_VERSION_STRING.
+ *
+ * Return value: the encoded version.
+ **/
+int
+cairo_version (void)
+{
+    return CAIRO_VERSION;
+}
+
+/**
+ * cairo_version_string:
+ *
+ * Returns the version of the cairo library as a human-readable string
+ * of the form "X.Y.Z".
+ *
+ * See also cairo_version() as well as the compile-time equivalents
+ * %CAIRO_VERSION_STRING and %CAIRO_VERSION.
+ *
+ * Return value: a string containing the version.
+ **/
+const char*
+cairo_version_string (void)
+{
+    return CAIRO_VERSION_STRING;
+}
+slim_hidden_def (cairo_version_string);
+
+
+/**
  * cairo_glyph_allocate:
  * @num_glyphs: number of glyphs to allocate
  *
diff --git a/src/cairo.c b/src/cairo.c
index 2ff6470..6b919a3 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -120,49 +120,6 @@ _cairo_set_error (cairo_t *cr, cairo_status_t status)
 }
 
 /**
- * cairo_version:
- *
- * Returns the version of the cairo library encoded in a single
- * integer as per %CAIRO_VERSION_ENCODE. The encoding ensures that
- * later versions compare greater than earlier versions.
- *
- * A run-time comparison to check that cairo's version is greater than
- * or equal to version X.Y.Z could be performed as follows:
- *
- * <informalexample><programlisting>
- * if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...}
- * </programlisting></informalexample>
- *
- * See also cairo_version_string() as well as the compile-time
- * equivalents %CAIRO_VERSION and %CAIRO_VERSION_STRING.
- *
- * Return value: the encoded version.
- **/
-int
-cairo_version (void)
-{
-    return CAIRO_VERSION;
-}
-
-/**
- * cairo_version_string:
- *
- * Returns the version of the cairo library as a human-readable string
- * of the form "X.Y.Z".
- *
- * See also cairo_version() as well as the compile-time equivalents
- * %CAIRO_VERSION_STRING and %CAIRO_VERSION.
- *
- * Return value: a string containing the version.
- **/
-const char*
-cairo_version_string (void)
-{
-    return CAIRO_VERSION_STRING;
-}
-slim_hidden_def (cairo_version_string);
-
-/**
  * cairo_create:
  * @target: target surface for the context
  *
commit 89900525fb78b20c532b8d983c238896f6e4820c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 28 17:21:37 2008 -0400

    Move version number to src/cairo-version.h

diff --git a/Makefile.am b/Makefile.am
index 56026cc..b2eeccd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@ if CAIRO_HAS_PNG_FUNCTIONS
 SUBDIRS += boilerplate test perf
 endif
 
+configure: src/cairo-version.h
 
 .PHONY: doc test retest recheck check-valgrind
 # We have some generated header files, so we really need to build the
@@ -57,7 +58,6 @@ endif
 
 EXTRA_DIST = \
 	autogen.sh \
-	Version.mk \
 	AUTHORS \
 	BIBLIOGRAPHY \
 	BUGS \
diff --git a/Makefile.win32 b/Makefile.win32
index a55f12c..a00ff34 100644
--- a/Makefile.win32
+++ b/Makefile.win32
@@ -2,12 +2,6 @@
 # Win32 makefile
 #
 
-ifeq ($(SUBMAKEFILE),1)
-  include ../Version.mk
-else
-  include Version.mk
-endif
-
 CC := cl
 LINK := link
 
@@ -24,7 +18,7 @@ EXE_LDFLAGS = libpng.lib zlib.lib gdi32.lib msimg32.lib user32.lib
 
 DEFAULT_CFLAGS = -MD -nologo $(OPT)
 DEFAULT_CFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
-DEFAULT_CFLAGS += -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
+DEFAULT_CFLAGS += -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
 DEFAULT_CFLAGS += -I. 
 DEFAULT_CFLAGS += $(PIXMAN_CFLAGS)
 DEFAULT_CFLAGS += -DCAIRO_NO_MUTEX=1  -DLIBCAIRO_EXPORTS
@@ -32,8 +26,6 @@ DEFAULT_CFLAGS += -DCAIRO_NO_MUTEX=1  -DLIBCAIRO_EXPORTS
 CFLAGS := $(DEFAULT_CFLAGS)
 
 
-CAIRO_VERSION = $(CAIRO_VERSION_MAJOR).$(CAIRO_VERSION_MINOR).$(CAIRO_VERSION_MICRO)
-
 # Only if this was called as the top-level makefile
 ifeq ($(SUBMAKEFILE),)
 
@@ -45,10 +37,7 @@ all: inform cairo
 
 src/cairo-features.h:
 	@echo Warning: creating default cairo-features.h
-	@(cat src/cairo-features-win32.h | \
-	      sed 's, at CAIRO_VERSION_MAJOR@,'$(CAIRO_VERSION_MAJOR)',g' | \
-	      sed 's, at CAIRO_VERSION_MINOR@,'$(CAIRO_VERSION_MINOR)',g' | \
-	      sed 's, at CAIRO_VERSION_MICRO@,'$(CAIRO_VERSION_MICRO)',g' > src/cairo-features.h)
+	@cp src/cairo-features-win32.h src/cairo-features.h
 
 cairo: src/cairo-features.h
 	@list='$(SUBDIRS)'; for f in $$list ; do \
diff --git a/RELEASING b/RELEASING
index 3dfe29b..ac306fc 100644
--- a/RELEASING
+++ b/RELEASING
@@ -54,8 +54,7 @@ Here are the steps to follow to create a new cairo release:
 		find src/ -name '*.h' ! -name '*-private.h' ! -name 'cairoint.h' ! -name 'cairo-features-win32.h' | \
 		xargs git diff X.Y.Z.. --
 
-4) Increment cairo_version_{minor|micro} and LT_{CURRENT|VERSION|AGE}
-   in configure.in:
+4) Increment cairo_version_{minor|micro} in src/cairo-version.h:
 
 	If there are backward-incompatible changes in the API, stop
 	now and don't release. Go back and fix the API instead. Cairo
@@ -71,10 +70,7 @@ Here are the steps to follow to create a new cairo release:
 	Otherwise, (ie. there are only bug fixes), increment
 	cairo_version_micro to the next larger (even) number.
 
-	Adjust LT_CURRENT, LT_VERSION, and LT_AGE as described in the
-	comments in configure.in.
-
-5) Commit the changes to NEWS and configure.in
+5) Commit the changes to NEWS and src/cairo-version.h
 
 	It's especially important to mention the new version number in your
 	commit log.
@@ -102,7 +98,7 @@ Here are the steps to follow to create a new cairo release:
 	  prints it for you.
 
 7) Increment cairo_version_micro to the next larger (odd) number in
-   configure, commit, and push.
+   src/cairo-version.h, commit, and push.
 
 8) Push the newly created tag out to the central tree with a command
    something like:
diff --git a/Version.mk b/Version.mk
deleted file mode 100644
index f042602..0000000
--- a/Version.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# cairo package version number, (as distinct from shared library version)
-#
-# For the minor number: odd  => unstable series
-#			even => stable series
-# For the micro number: odd  => in-progress development (from git)
-#			even => tar-file snapshot or release
-cairo_version_major=1
-cairo_version_minor=7
-cairo_version_micro=5
diff --git a/configure.in b/configure.in
index 01ccaf3..41dab9d 100644
--- a/configure.in
+++ b/configure.in
@@ -2,9 +2,11 @@ AC_PREREQ(2.58)
 
 dnl Parse Version.mk and declare m4 variables out of it
 m4_define([cairo_version_macro],
-		m4_bpatsubst(m4_include(Version.mk),
-			     [^\([a-zA-Z0-9_]*\) *= *\(.*\)],
-			     [[m4_define(\1, \[\2\])]]))
+		m4_translit(
+		m4_bpatsubst(m4_include(src/cairo-version.h),
+			     [^.define \([a-zA-Z0-9_]*\)  *\([0-9][0-9]*\)],
+			     [[m4_define(\1, \[\2\])]]),
+			    [A-Z], [a-z]))
 cairo_version_macro
 
 AC_INIT([cairo],
@@ -1023,24 +1025,6 @@ AC_CONFIG_COMMANDS([src/cairo-features.h],
 #ifndef CAIRO_FEATURES_H
 #define CAIRO_FEATURES_H
 
-#ifdef  __cplusplus
-# define CAIRO_BEGIN_DECLS  extern "C" {
-# define CAIRO_END_DECLS    }
-#else
-# define CAIRO_BEGIN_DECLS
-# define CAIRO_END_DECLS
-#endif
-
-#ifndef cairo_public
-# define cairo_public
-#endif
-
-#define CAIRO_VERSION_MAJOR $CAIRO_VERSION_MAJOR
-#define CAIRO_VERSION_MINOR $CAIRO_VERSION_MINOR
-#define CAIRO_VERSION_MICRO $CAIRO_VERSION_MICRO
-
-#define CAIRO_VERSION_STRING "$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
-
 _EOF
 	for FEATURE in $CAIRO_FEATURES; do
 		echo "#define CAIRO_HAS_$FEATURE 1" >> $outfile
@@ -1062,9 +1046,6 @@ _EOF
 ],[
 	CAIRO_FEATURES='$CAIRO_FEATURES'
 	CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
-	CAIRO_VERSION_MAJOR=$CAIRO_VERSION_MAJOR
-	CAIRO_VERSION_MINOR=$CAIRO_VERSION_MINOR
-	CAIRO_VERSION_MICRO=$CAIRO_VERSION_MICRO
 ])
 AC_CONFIG_COMMANDS([src/cairo-no-features.h],
 [
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 622ca91..9a49e42 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -201,8 +201,11 @@ CAIRO_VERSION_MINOR
 CAIRO_VERSION_MICRO
 CAIRO_VERSION_STRING
 CAIRO_VERSION_ENCODE
+CAIRO_VERSION_STRINGIZE
 cairo_version
 cairo_version_string
+<SUBSECTION Private>
+CAIRO_VERSION_STRINGIZE_
 </SECTION>
 
 <SECTION>
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index adc47bb..6b6c2f4 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -255,7 +255,7 @@ cairo_<emphasis>backend</emphasis>_surface_create().
 
 </para>
 
- at surface:
- at Returns:
+ at surface: 
+ at Returns: 
 
 
diff --git a/doc/public/tmpl/cairo-version.sgml b/doc/public/tmpl/cairo-version.sgml
index 62de21d..836c9b8 100644
--- a/doc/public/tmpl/cairo-version.sgml
+++ b/doc/public/tmpl/cairo-version.sgml
@@ -166,6 +166,22 @@ that later versions compare greater than earlier versions.
 @minor: the minor component of the version number
 @micro: the micro component of the version number
 
+ at Returns: the encoded version.
+
+<!-- ##### MACRO CAIRO_VERSION_STRINGIZE ##### -->
+<para>
+This macro encodes the given cairo version into an string.  The numbers
+returned by %CAIRO_VERSION_STRING and cairo_version_string() are encoded using this macro.
+The parameters to this macro must expand to numerical literals.
+</para>
+
+ at major: the major component of the version number
+ at minor: the minor component of the version number
+ at micro: the micro component of the version number
+
+ at Returns: a string literal containing the version.
+ at Since: 1.8
+
 
 <!-- ##### FUNCTION cairo_version ##### -->
 <para>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2b9459b..012f294 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ cairo_base_sources =				\
 	cairo-paginated-surface-private.h	\
 	cairo-analysis-surface.c		\
 	cairo-analysis-surface-private.h	\
+	cairo-version.h				\
 	cairoint.h
 cairo_all_sources = $(cairo_base_sources) $(cairo_base_headers)
 cairo_headers = $(cairo_base_headers)
diff --git a/src/cairo-features-win32.h b/src/cairo-features-win32.h
index 21f9970..754b98a 100644
--- a/src/cairo-features-win32.h
+++ b/src/cairo-features-win32.h
@@ -1,28 +1,6 @@
 #ifndef CAIRO_FEATURES_H
 #define CAIRO_FEATURES_H
 
-#if defined(__cplusplus)
-# define CAIRO_BEGIN_DECLS  extern "C" {
-# define CAIRO_END_DECLS    }
-#else
-# define CAIRO_BEGIN_DECLS
-# define CAIRO_END_DECLS
-#endif
-
-#ifndef cairo_public
-    #ifdef LIBCAIRO_EXPORTS
-        #define cairo_public __declspec(dllexport)
-    #else
-        #define cairo_public __declspec(dllimport)
-    #endif
-#endif
-
-#define CAIRO_VERSION_MAJOR @CAIRO_VERSION_MAJOR@
-#define CAIRO_VERSION_MINOR @CAIRO_VERSION_MINOR@
-#define CAIRO_VERSION_MICRO @CAIRO_VERSION_MICRO@
-
-#define CAIRO_VERSION_STRING "@CAIRO_VERSION_MAJOR at .@CAIRO_VERSION_MINOR at .@CAIRO_VERSION_MICRO@"
-
 #define HAVE_WINDOWS_H 1
 
 #define CAIRO_HAS_SVG_SURFACE 1
@@ -32,9 +10,5 @@
 #define CAIRO_HAS_WIN32_FONT 1
 #define CAIRO_HAS_PNG_FUNCTIONS 1
 
-#define PACKAGE_NAME "cairo"
-#define PACKAGE_TARNAME "cairo"
-#define PACKAGE_STRING "cairo @CAIRO_VERSION_MAJOR at .@CAIRO_VERSION_MINOR at .@CAIRO_VERSION_MICRO@"
-
 #endif
 
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index cfbdd07..4225548 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -259,7 +259,7 @@ _cairo_image_surface_create_with_masks (unsigned char	       *data,
     status = _pixman_format_from_masks (masks, &pixman_format);
     if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 	fprintf (stderr,
-		 "Error: Cairo " PACKAGE_VERSION " does not yet support the requested image format:\n"
+		 "Error: Cairo %s does not yet support the requested image format:\n"
 		 "\tDepth: %d\n"
 		 "\tAlpha mask: 0x%08lx\n"
 		 "\tRed   mask: 0x%08lx\n"
@@ -267,6 +267,7 @@ _cairo_image_surface_create_with_masks (unsigned char	       *data,
 		 "\tBlue  mask: 0x%08lx\n"
 		 "Please file an enhancement request (quoting the above) at:\n"
 		 PACKAGE_BUGREPORT "\n",
+		 cairo_version_string (),
 		 masks->bpp, masks->alpha_mask,
 		 masks->red_mask, masks->green_mask, masks->blue_mask);
 
diff --git a/src/cairo-version.h b/src/cairo-version.h
new file mode 100644
index 0000000..bfe4958
--- /dev/null
+++ b/src/cairo-version.h
@@ -0,0 +1,8 @@
+#ifndef CAIRO_VERSION_H
+#define CAIRO_VERSION_H
+
+#define CAIRO_VERSION_MAJOR 1
+#define CAIRO_VERSION_MINOR 7
+#define CAIRO_VERSION_MICRO 5
+
+#endif
diff --git a/src/cairo.h b/src/cairo.h
index 77bfe28..a201507 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -38,21 +38,46 @@
 #ifndef CAIRO_H
 #define CAIRO_H
 
+#include "cairo-version.h"
 #include "cairo-features.h"
 #include "cairo-deprecated.h"
 
+#ifdef  __cplusplus
+# define CAIRO_BEGIN_DECLS  extern "C" {
+# define CAIRO_END_DECLS    }
+#else
+# define CAIRO_BEGIN_DECLS
+# define CAIRO_END_DECLS
+#endif
+
+#ifndef cairo_public
+# define cairo_public
+#endif
+
 CAIRO_BEGIN_DECLS
 
-#define CAIRO_VERSION_ENCODE(major, minor, micro) (     \
-	  ((major) * 10000)                             \
-	+ ((minor) *   100)                             \
+#define CAIRO_VERSION_ENCODE(major, minor, micro) (	\
+	  ((major) * 10000)				\
+	+ ((minor) *   100)				\
 	+ ((micro) *     1))
 
-#define CAIRO_VERSION CAIRO_VERSION_ENCODE(     \
-	CAIRO_VERSION_MAJOR,                    \
-	CAIRO_VERSION_MINOR,                    \
+#define CAIRO_VERSION CAIRO_VERSION_ENCODE(	\
+	CAIRO_VERSION_MAJOR,			\
+	CAIRO_VERSION_MINOR,			\
 	CAIRO_VERSION_MICRO)
 
+
+#define CAIRO_VERSION_STRINGIZE_(major, minor, micro)	\
+	#major"."#minor"."#micro
+#define CAIRO_VERSION_STRINGIZE(major, minor, micro)	\
+	CAIRO_VERSION_STRINGIZE_(major, minor, micro)
+
+#define CAIRO_VERSION_STRING CAIRO_VERSION_STRINGIZE(	\
+	CAIRO_VERSION_MAJOR,				\
+	CAIRO_VERSION_MINOR,				\
+	CAIRO_VERSION_MICRO)
+
+
 cairo_public int
 cairo_version (void);
 


More information about the cairo-commit mailing list