[cairo-commit] 2 commits - src/cairo-compiler-private.h src/cairo-fixed-private.h src/cairo-fixed-type-private.h src/cairoint.h src/cairo-types-private.h src/cairo-wideint-private.h src/cairo-wideint-type-private.h src/Makefile.am

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Jan 19 23:56:38 PST 2008


 src/Makefile.am                  |    2 
 src/cairo-compiler-private.h     |   10 +++
 src/cairo-fixed-private.h        |   34 ----------
 src/cairo-fixed-type-private.h   |   70 +++++++++++++++++++++
 src/cairo-types-private.h        |    2 
 src/cairo-wideint-private.h      |   71 ---------------------
 src/cairo-wideint-type-private.h |  130 +++++++++++++++++++++++++++++++++++++++
 src/cairoint.h                   |   12 ---
 8 files changed, 218 insertions(+), 113 deletions(-)

New commits:
commit 3339c32b0aa44c4bae6e534f90d26aa342e3d717
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jan 20 02:56:26 2008 -0500

    [cairoint.h] Move MSC inline macros into cairo-compiler-private.h
    where they belong

diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index 758cde5..1c6645e 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -111,6 +111,16 @@ CAIRO_BEGIN_DECLS
 #define __attribute__(x)
 #endif
 
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#undef inline
+#define inline __inline
+#endif
+
+#ifdef __STRICT_ANSI__
+#undef inline
+#define inline __inline__
+#endif
 
 CAIRO_END_DECLS
 
diff --git a/src/cairoint.h b/src/cairoint.h
index 7e1ee73..d8a31b5 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -68,17 +68,6 @@
 
 #include "cairo-compiler-private.h"
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#undef inline
-#define inline __inline
-#endif
-
-#ifdef __STRICT_ANSI__
-#undef inline
-#define inline __inline__
-#endif
-
 CAIRO_BEGIN_DECLS
 
 #ifdef _WIN32
commit ac17ce0f89b494a404756c8d24b21a7fb354218e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jan 20 02:54:16 2008 -0500

    [cairo-fixed/wideint-private.h] Split out typedefs from prototypes
    such that the type definitions can be used from boilerplate without exposing
    the prototypes.

diff --git a/src/Makefile.am b/src/Makefile.am
index 4953d59..b5389a2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -233,6 +233,7 @@ libcairo_la_base_sources =			\
 	cairo-output-stream-private.h		\
 	cairo-wideint.c				\
 	cairo-wideint-private.h			\
+	cairo-wideint-type-private.h		\
 	cairo-meta-surface.c			\
 	cairo-meta-surface-private.h		\
 	cairo-paginated-private.h		\
@@ -263,6 +264,7 @@ libcairo_la_base_sources =			\
 libcairo_la_special_sources =			\
 	cairo-cache-private.h			\
 	cairo-fixed-private.h			\
+	cairo-fixed-type-private.h		\
 	cairo-mutex-list-private.h		\
 	cairo-types-private.h
 
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h
index cb42ac1..626c02a 100644
--- a/src/cairo-fixed-private.h
+++ b/src/cairo-fixed-private.h
@@ -37,39 +37,11 @@
 #ifndef CAIRO_FIXED_PRIVATE_H
 #define CAIRO_FIXED_PRIVATE_H
 
-#include "cairo-wideint-private.h"
-
-/*
- * Fixed-point configuration
- */
-
-typedef int32_t		cairo_fixed_16_16_t;
-typedef cairo_int64_t	cairo_fixed_32_32_t;
-typedef cairo_int64_t	cairo_fixed_48_16_t;
-typedef cairo_int128_t	cairo_fixed_64_64_t;
-typedef cairo_int128_t	cairo_fixed_96_32_t;
-
-/* Eventually, we should allow changing this, but I think
- * there are some assumptions in the tesselator about the
- * size of a fixed type.  For now, it must be 32.
- */
-#define CAIRO_FIXED_BITS	32
+#include "cairo-fixed-type-private.h"
 
-/* The number of fractional bits.  Changing this involves
- * making sure that you compute a double-to-fixed magic number.
- * (see below).
- */
-#define CAIRO_FIXED_FRAC_BITS	16
-
-/* A signed type CAIRO_FIXED_BITS in size; the main fixed point type */
-typedef int32_t cairo_fixed_t;
-
-/* An unsigned type of the same size as cairo_fixed_t */
-typedef uint32_t cairo_fixed_unsigned_t;
+#include "cairo-wideint-private.h"
 
-/*
- * No configurable bits below this.
- */
+/* Implementation */
 
 #if (CAIRO_FIXED_BITS != 32)
 # error CAIRO_FIXED_BITS must be 32, and the type must be a 32-bit type.
diff --git a/src/cairo-fixed-type-private.h b/src/cairo-fixed-type-private.h
new file mode 100644
index 0000000..78ca672
--- /dev/null
+++ b/src/cairo-fixed-type-private.h
@@ -0,0 +1,70 @@
+/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
+/* Cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2007 Mozilla Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Mozilla Corporation
+ *
+ * Contributor(s):
+ *	Vladimir Vukicevic <vladimir at pobox.com>
+ */
+
+#ifndef CAIRO_FIXED_TYPE_PRIVATE_H
+#define CAIRO_FIXED_TYPE_PRIVATE_H
+
+#include "cairo-wideint-type-private.h"
+
+/*
+ * Fixed-point configuration
+ */
+
+typedef int32_t		cairo_fixed_16_16_t;
+typedef cairo_int64_t	cairo_fixed_32_32_t;
+typedef cairo_int64_t	cairo_fixed_48_16_t;
+typedef cairo_int128_t	cairo_fixed_64_64_t;
+typedef cairo_int128_t	cairo_fixed_96_32_t;
+
+/* Eventually, we should allow changing this, but I think
+ * there are some assumptions in the tesselator about the
+ * size of a fixed type.  For now, it must be 32.
+ */
+#define CAIRO_FIXED_BITS	32
+
+/* The number of fractional bits.  Changing this involves
+ * making sure that you compute a double-to-fixed magic number.
+ * (see below).
+ */
+#define CAIRO_FIXED_FRAC_BITS	16
+
+/* A signed type CAIRO_FIXED_BITS in size; the main fixed point type */
+typedef int32_t cairo_fixed_t;
+
+/* An unsigned type of the same size as cairo_fixed_t */
+typedef uint32_t cairo_fixed_unsigned_t;
+
+#endif /* CAIRO_FIXED_TYPE_PRIVATE_H */
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 8580beb..e38afba 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -41,7 +41,7 @@
 /* This is the only header file not including cairoint.h.  It only contains
  * typedefs.*/
 #include "cairo.h"
-#include "cairo-fixed-private.h"
+#include "cairo-fixed-type-private.h"
 
 typedef struct _cairo_array cairo_array_t;
 typedef struct _cairo_hash_table cairo_hash_table_t;
diff --git a/src/cairo-wideint-private.h b/src/cairo-wideint-private.h
index 69fa156..412fc00 100644
--- a/src/cairo-wideint-private.h
+++ b/src/cairo-wideint-private.h
@@ -37,42 +37,7 @@
 #ifndef CAIRO_WIDEINT_H
 #define CAIRO_WIDEINT_H
 
-#if   HAVE_STDINT_H
-# include <stdint.h>
-#elif HAVE_INTTYPES_H
-# include <inttypes.h>
-#elif HAVE_SYS_INT_TYPES_H
-# include <sys/int_types.h>
-#elif defined(_MSC_VER)
-  typedef __int8 int8_t;
-  typedef unsigned __int8 uint8_t;
-  typedef __int16 int16_t;
-  typedef unsigned __int16 uint16_t;
-  typedef __int32 int32_t;
-  typedef unsigned __int32 uint32_t;
-  typedef __int64 int64_t;
-  typedef unsigned __int64 uint64_t;
-# ifndef HAVE_UINT64_T
-#  define HAVE_UINT64_T 1
-# endif
-# ifndef INT16_MIN
-#  define INT16_MIN	(-32767-1)
-# endif
-# ifndef INT16_MAX
-#  define INT16_MAX	(32767)
-# endif
-# ifndef UINT16_MAX
-#  define UINT16_MAX	(65535)
-# endif
-# ifndef INT32_MIN
-#  define INT32_MIN	(-2147483647-1)
-# endif
-# ifndef INT32_MAX
-#  define INT32_MAX	(2147483647)
-# endif
-#else
-#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
-#endif
+#include "cairo-wideint-type-private.h"
 
 #include "cairo-compiler-private.h"
 
@@ -86,10 +51,6 @@
 
 #if !HAVE_UINT64_T
 
-typedef struct _cairo_uint64 {
-    uint32_t	lo, hi;
-} cairo_uint64_t, cairo_int64_t;
-
 cairo_uint64_t I	_cairo_uint32_to_uint64 (uint32_t i);
 #define			_cairo_uint64_to_uint32(a)  ((a).lo)
 cairo_uint64_t I	_cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b);
@@ -125,9 +86,6 @@ int	       I	_cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b);
 
 #else
 
-typedef uint64_t    cairo_uint64_t;
-typedef int64_t	    cairo_int64_t;
-
 #define			_cairo_uint32_to_uint64(i)  ((uint64_t) (i))
 #define			_cairo_uint64_to_uint32(i)  ((uint32_t) (i))
 #define			_cairo_uint64_add(a,b)	    ((a) + (b))
@@ -181,16 +139,6 @@ typedef int64_t	    cairo_int64_t;
  * a function which returns both for the 'native' type as well
  */
 
-typedef struct _cairo_uquorem64 {
-    cairo_uint64_t	quo;
-    cairo_uint64_t	rem;
-} cairo_uquorem64_t;
-
-typedef struct _cairo_quorem64 {
-    cairo_int64_t	quo;
-    cairo_int64_t	rem;
-} cairo_quorem64_t;
-
 cairo_uquorem64_t I
 _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den);
 
@@ -205,10 +153,6 @@ _cairo_int64_divrem (cairo_int64_t num, cairo_int64_t den);
 
 #if !HAVE_UINT128_T
 
-typedef struct cairo_uint128 {
-    cairo_uint64_t	lo, hi;
-} cairo_uint128_t, cairo_int128_t;
-
 cairo_uint128_t I	_cairo_uint32_to_uint128 (uint32_t i);
 cairo_uint128_t I	_cairo_uint64_to_uint128 (cairo_uint64_t i);
 #define			_cairo_uint128_to_uint64(a)	((a).lo)
@@ -248,9 +192,6 @@ int 	        I	_cairo_int128_lt (cairo_int128_t a, cairo_int128_t b);
 
 #else	/* !HAVE_UINT128_T */
 
-typedef uint128_t	cairo_uint128_t;
-typedef int128_t	cairo_int128_t;
-
 #define			_cairo_uint32_to_uint128(i) ((uint128_t) (i))
 #define			_cairo_uint64_to_uint128(i) ((uint128_t) (i))
 #define			_cairo_uint128_to_uint64(i) ((uint64_t) (i))
@@ -290,16 +231,6 @@ typedef int128_t	cairo_int128_t;
 
 #endif	/* HAVE_UINT128_T */
 
-typedef struct _cairo_uquorem128 {
-    cairo_uint128_t	quo;
-    cairo_uint128_t	rem;
-} cairo_uquorem128_t;
-
-typedef struct _cairo_quorem128 {
-    cairo_int128_t	quo;
-    cairo_int128_t	rem;
-} cairo_quorem128_t;
-
 cairo_uquorem128_t I
 _cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den);
 
diff --git a/src/cairo-wideint-type-private.h b/src/cairo-wideint-type-private.h
new file mode 100644
index 0000000..23e50df
--- /dev/null
+++ b/src/cairo-wideint-type-private.h
@@ -0,0 +1,130 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2004 Keith Packard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Keith Packard
+ *
+ * Contributor(s):
+ *	Keith R. Packard <keithp at keithp.com>
+ *
+ */
+
+#ifndef CAIRO_WIDEINT_TYPE_H
+#define CAIRO_WIDEINT_TYPE_H
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if   HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INT_TYPES_H
+# include <sys/int_types.h>
+#elif defined(_MSC_VER)
+  typedef __int8 int8_t;
+  typedef unsigned __int8 uint8_t;
+  typedef __int16 int16_t;
+  typedef unsigned __int16 uint16_t;
+  typedef __int32 int32_t;
+  typedef unsigned __int32 uint32_t;
+  typedef __int64 int64_t;
+  typedef unsigned __int64 uint64_t;
+# ifndef HAVE_UINT64_T
+#  define HAVE_UINT64_T 1
+# endif
+# ifndef INT16_MIN
+#  define INT16_MIN	(-32767-1)
+# endif
+# ifndef INT16_MAX
+#  define INT16_MAX	(32767)
+# endif
+# ifndef UINT16_MAX
+#  define UINT16_MAX	(65535)
+# endif
+# ifndef INT32_MIN
+#  define INT32_MIN	(-2147483647-1)
+# endif
+# ifndef INT32_MAX
+#  define INT32_MAX	(2147483647)
+# endif
+#else
+#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
+#endif
+
+
+#if !HAVE_UINT64_T
+
+typedef struct _cairo_uint64 {
+    uint32_t	lo, hi;
+} cairo_uint64_t, cairo_int64_t;
+
+#else
+
+typedef uint64_t    cairo_uint64_t;
+typedef int64_t	    cairo_int64_t;
+
+#endif
+
+typedef struct _cairo_uquorem64 {
+    cairo_uint64_t	quo;
+    cairo_uint64_t	rem;
+} cairo_uquorem64_t;
+
+typedef struct _cairo_quorem64 {
+    cairo_int64_t	quo;
+    cairo_int64_t	rem;
+} cairo_quorem64_t;
+
+
+#if !HAVE_UINT128_T
+
+typedef struct cairo_uint128 {
+    cairo_uint64_t	lo, hi;
+} cairo_uint128_t, cairo_int128_t;
+
+#else
+
+typedef uint128_t	cairo_uint128_t;
+typedef int128_t	cairo_int128_t;
+
+#endif
+
+typedef struct _cairo_uquorem128 {
+    cairo_uint128_t	quo;
+    cairo_uint128_t	rem;
+} cairo_uquorem128_t;
+
+typedef struct _cairo_quorem128 {
+    cairo_int128_t	quo;
+    cairo_int128_t	rem;
+} cairo_quorem128_t;
+
+
+#endif /* CAIRO_WIDEINT_H */
diff --git a/src/cairoint.h b/src/cairoint.h
index 889862d..7e1ee73 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2278,6 +2278,7 @@ slim_hidden_proto (cairo_surface_write_to_png_stream);
 CAIRO_END_DECLS
 
 #include "cairo-mutex-private.h"
+#include "cairo-fixed-private.h"
 #include "cairo-wideint-private.h"
 #include "cairo-malloc-private.h"
 #include "cairo-hash-private.h"


More information about the cairo-commit mailing list