[cairo-commit] rcairo/src rb_cairo.h, 1.16, 1.17 rb_cairo_constants.c, 1.7, 1.8 rb_cairo_surface.c, 1.33, 1.34

Kouhei Sutou commit at pdx.freedesktop.org
Thu Jun 19 06:00:21 PDT 2008


Committed by: kou

Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv10404/src

Modified Files:
	rb_cairo.h rb_cairo_constants.c rb_cairo_surface.c 
Log Message:
* src/: use #ifdef for CAIRO_HAS_*.


Index: rb_cairo.h
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- rb_cairo.h	30 Apr 2008 04:57:51 -0000	1.16
+++ rb_cairo.h	19 Jun 2008 13:00:18 -0000	1.17
@@ -18,15 +18,15 @@
 
 #include <cairo.h>
 
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
 #  include <cairo-ps.h>
 #endif
 
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
 #  include <cairo-pdf.h>
 #endif
 
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 #  include <cairo-svg.h>
 #endif
 
@@ -210,10 +210,10 @@
 #define RVAL2CRFORMAT(obj)        (rb_cairo_format_from_ruby_object(obj))
 #define RVAL2CREXTEND(obj)        (rb_cairo_extend_from_ruby_object(obj))
 #define RVAL2CRFILTER(obj)        (rb_cairo_filter_from_ruby_object(obj))
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 #define RVAL2CRSVGVERSION(obj)    (rb_cairo_svg_version_from_ruby_object(obj))
 #endif
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
 #  if CAIRO_CHECK_VERSION(1, 5, 2)
 #define RVAL2CRPSLEVEL(obj)       (rb_cairo_ps_level_from_ruby_object(obj))
 #  endif
@@ -234,10 +234,10 @@
 cairo_format_t         rb_cairo_format_from_ruby_object         (VALUE obj);
 cairo_extend_t         rb_cairo_extend_from_ruby_object         (VALUE obj);
 cairo_filter_t         rb_cairo_filter_from_ruby_object         (VALUE obj);
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 cairo_svg_version_t    rb_cairo_svg_version_from_ruby_object    (VALUE obj);
 #endif
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
 #  if CAIRO_CHECK_VERSION(1, 5, 2)
 cairo_ps_level_t       rb_cairo_ps_level_from_ruby_object       (VALUE obj);
 #  endif

Index: rb_cairo_constants.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_constants.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rb_cairo_constants.c	4 Apr 2008 04:25:16 -0000	1.7
+++ rb_cairo_constants.c	19 Jun 2008 13:00:18 -0000	1.8
@@ -124,23 +124,27 @@
 DEFINE_RVAL2ENUM(format, FORMAT)
 DEFINE_RVAL2ENUM(extend, EXTEND)
 DEFINE_RVAL2ENUM(filter, FILTER)
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 DEFINE_RVAL2ENUM(svg_version, SVG_VERSION)
 #endif
-#if CAIRO_HAS_PS_SURFACE && CAIRO_CHECK_VERSION(1, 5, 2)
+
+#ifdef CAIRO_HAS_PS_SURFACE
+#  if CAIRO_CHECK_VERSION(1, 5, 2)
 DEFINE_RVAL2ENUM(ps_level, PS_LEVEL)
-#else
-#  ifdef RB_CAIRO_PLATFORM_WIN32
+#define PS_LEVEL_ENUM_DEFINED 1
+#  endif
+#endif
+
+#if defined(RB_CAIRO_PLATFORM_WIN32) && !defined(PS_LEVEL_ENUM_DEFINED)
 void
 rb_cairo_ps_level_from_ruby_object (VALUE rb_ps_level)
 {
   /* dummy */
 }
-#  endif
 #endif
 
 
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 static VALUE
 cr_svg_get_versions (VALUE self)
 {
@@ -187,7 +191,7 @@
 }
 #endif
 
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
 #  if CAIRO_CHECK_VERSION(1, 5, 8)
 static VALUE
 cr_ps_get_levels (VALUE self)
@@ -428,7 +432,7 @@
   rb_define_const (rb_mCairo_Filter,    "GAUSSIAN",
                    INT2FIX (CAIRO_FILTER_GAUSSIAN));
 
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
   /* cairo_svg_version_t */
   rb_mCairo_SVGVersion = rb_define_module_under (rb_mCairo, "SVGVersion");
   rb_define_const (rb_mCairo_SVGVersion, "VERSION_1_1",
@@ -442,7 +446,8 @@
                               cr_svg_version_to_string, -1);
 #endif
 
-#if CAIRO_HAS_PS_SURFACE && CAIRO_CHECK_VERSION(1, 5, 2)
+#ifdef CAIRO_HAS_PS_SURFACE
+#  if CAIRO_CHECK_VERSION(1, 5, 2)
   /* cairo_ps_level_t */
   rb_mCairo_PSLevel = rb_define_module_under (rb_mCairo, "PSLevel");
   rb_define_const (rb_mCairo_PSLevel, "LEVEL_2", INT2FIX (CAIRO_PS_LEVEL_2));
@@ -452,5 +457,6 @@
                               cr_ps_get_levels, 0);
   rb_define_singleton_method (rb_mCairo_PSLevel, "name",
                               cr_ps_level_to_string, -1);
+#  endif
 #endif
 }

Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- rb_cairo_surface.c	19 Jun 2008 12:52:31 -0000	1.33
+++ rb_cairo_surface.c	19 Jun 2008 13:00:19 -0000	1.34
@@ -15,7 +15,7 @@
 #include "rb_cairo.h"
 #include "rb_cairo_private.h"
 
-#if CAIRO_HAS_WIN32_SURFACE
+#ifdef CAIRO_HAS_WIN32_SURFACE
 #  define OpenFile OpenFile_win32
 #  include <cairo-win32.h>
 #  undef OpenFile
@@ -23,7 +23,7 @@
 
 #include <rubyio.h>
 
-#if CAIRO_HAS_QUARTZ_SURFACE
+#ifdef CAIRO_HAS_QUARTZ_SURFACE
 #  ifndef HAVE_TYPE_ENUM_RUBY_VALUE_TYPE
 enum ruby_value_type {
   RUBY_T_DATA = T_DATA
@@ -34,7 +34,9 @@
 #  define T_DATA RUBY_T_DATA
 #endif
 
-#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_SVG_SURFACE
+#if defined(CAIRO_HAS_PS_SURFACE) || \
+  defined(CAIRO_HAS_PDF_SURFACE) || \
+  defined(CAIRO_HAS_SVG_SURFACE)
 #  define HAS_CREATE_CR_CLOSURE_SURFACE 1
 #else
 #  define HAS_CREATE_CR_CLOSURE_SURFACE 0
@@ -418,7 +420,7 @@
 }
 
 
-#if CAIRO_HAS_PNG_FUNCTIONS
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
 static VALUE
 cr_surface_write_to_png_stream (VALUE self, VALUE target)
 {
@@ -563,7 +565,7 @@
 #endif
 
 /* Image-surface functions */
-#if CAIRO_HAS_PNG_FUNCTIONS
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
 static cairo_surface_t *
 cr_image_surface_create_from_png_stream (VALUE target)
 {
@@ -803,7 +805,7 @@
   return Qnil;                                                          \
 }
 
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
 /* PS-surface functions */
 DEFINE_SURFACE(ps)
 DEFINE_SURFACE_SET_SIZE(ps)
@@ -863,13 +865,13 @@
 #  endif
 #endif
 
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
 /* PDF-surface functions */
 DEFINE_SURFACE(pdf)
 DEFINE_SURFACE_SET_SIZE(pdf)
 #endif
 
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 /* SVG-surface functions */
 DEFINE_SURFACE(svg)
 
@@ -882,7 +884,7 @@
 }
 #endif
 
-#if CAIRO_HAS_WIN32_SURFACE
+#ifdef CAIRO_HAS_WIN32_SURFACE
 /* WIN32-surface functions */
 
 /* from dl/dl.h (ruby 1.9) */
@@ -1020,7 +1022,7 @@
 #  endif
 #endif
 
-#if CAIRO_HAS_QUARTZ_SURFACE && defined(HAVE_RUBY_COCOA)
+#if defined(CAIRO_HAS_QUARTZ_SURFACE) && defined(HAVE_RUBY_COCOA)
 /* Quartz-surface functions */
 
 #include <objc/objc-runtime.h>
@@ -1181,7 +1183,7 @@
                     cr_surface_show_page, 2);
 #endif
 
-#if CAIRO_HAS_PNG_FUNCTIONS
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
   rb_define_method (rb_cCairo_Surface, "write_to_png",
                     cr_surface_write_to_png_generic, 1);
 #endif
@@ -1192,7 +1194,7 @@
   rb_cCairo_ImageSurface =
     rb_define_class_under (rb_mCairo, "ImageSurface", rb_cCairo_Surface);
   
-#if CAIRO_HAS_PNG_FUNCTIONS
+#ifdef CAIRO_HAS_PNG_FUNCTIONS
   rb_define_singleton_method (rb_cCairo_ImageSurface, "from_png",
                               cr_image_surface_create_from_png_generic, 1);
 #endif
@@ -1219,7 +1221,7 @@
   rb_define_method (rb_cCairo_ ## name ## Surface, "initialize",        \
                     cr_ ## type ## _surface_initialize, -1);
 
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
   /* PS-surface */
   INIT_SURFACE(ps, PS)
 
@@ -1231,17 +1233,17 @@
   rb_define_method (rb_cCairo_PSSurface, "dsc_begin_page_setup",
                     cr_ps_surface_dsc_begin_page_setup, 0);
 
-#if CAIRO_CHECK_VERSION(1, 5, 2)
+#  if CAIRO_CHECK_VERSION(1, 5, 2)
   rb_define_method (rb_cCairo_PSSurface, "restrict_to_level",
                     cr_ps_surface_restrict_to_level, 1);
   rb_define_method (rb_cCairo_PSSurface, "eps?", cr_ps_surface_get_eps, 0);
   rb_define_method (rb_cCairo_PSSurface, "set_eps", cr_ps_surface_set_eps, 1);
-#endif
+#  endif
 
   RB_CAIRO_DEF_SETTERS (rb_cCairo_PSSurface);
 #endif
 
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
   /* PDF-surface */
   INIT_SURFACE(pdf, PDF)
 
@@ -1251,7 +1253,7 @@
   RB_CAIRO_DEF_SETTERS (rb_cCairo_PDFSurface);
 #endif
 
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
   /* SVG-surface */
   INIT_SURFACE(svg, SVG)
 
@@ -1261,7 +1263,7 @@
   RB_CAIRO_DEF_SETTERS (rb_cCairo_SVGSurface);
 #endif
 
-#if CAIRO_HAS_WIN32_SURFACE
+#ifdef CAIRO_HAS_WIN32_SURFACE
   /* Win32-surface */
   rb_cCairo_Win32Surface =
     rb_define_class_under (rb_mCairo, "Win32Surface", rb_cCairo_Surface);
@@ -1287,7 +1289,7 @@
 
 #endif
 
-#if CAIRO_HAS_QUARTZ_SURFACE && defined(HAVE_RUBY_COCOA)
+#if defined(CAIRO_HAS_QUARTZ_SURFACE) && defined(HAVE_RUBY_COCOA)
   /* Quartz-surface */
 
   rb_cCairo_QuartzSurface =



More information about the cairo-commit mailing list