[cairo-commit] rcairo/packages/cairo/ext cairo.def, 1.4, 1.5 rb_cairo.h, 1.10, 1.11 rb_cairo_context.c, 1.13, 1.14 rb_cairo_exception.c, 1.7, 1.8 rb_cairo_font_options.c, 1.2, 1.3 rb_cairo_matrix.c, 1.9, 1.10 rb_cairo_pattern.c, 1.8, 1.9 rb_cairo_surface.c, 1.11, 1.12

Kouhei Sutou commit at pdx.freedesktop.org
Sun Oct 9 00:04:42 PDT 2005


Committed by: kou

Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory gabe:/tmp/cvs-serv7986/packages/cairo/ext

Modified Files:
	cairo.def rb_cairo.h rb_cairo_context.c rb_cairo_exception.c 
	rb_cairo_font_options.c rb_cairo_matrix.c rb_cairo_pattern.c 
	rb_cairo_surface.c 
Log Message:
* packages/cairo/ext/rb_cairo_exception.c: Tidied exceptions.
* packages/cairo/ext/cairo.def: ditto.
* packages/cairo/ext/rb_cairo.h: ditto.
* packages/cairo/ext/rb_cairo_context.c: ditto.
* packages/cairo/ext/rb_cairo_font_options.c: ditto.
* packages/cairo/ext/rb_cairo_matrix.c: ditto.
* packages/cairo/ext/rb_cairo_pattern.c: ditto.
* packages/cairo/ext/rb_cairo_surface.c: ditto.


Index: cairo.def
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/cairo.def,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo.def	8 Oct 2005 17:15:54 -0000	1.4
+++ cairo.def	9 Oct 2005 07:04:40 -0000	1.5
@@ -36,3 +36,4 @@
     rb_cairo_glyph_to_ruby_object
     rb_cairo_surface_from_ruby_object
     rb_cairo_surface_to_ruby_object
+    rb_cairo_check_status

Index: rb_cairo.h
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- rb_cairo.h	8 Oct 2005 17:15:54 -0000	1.10
+++ rb_cairo.h	9 Oct 2005 07:04:40 -0000	1.11
@@ -106,6 +106,6 @@
 
 
 
-void rb_cairo_raise_exception (cairo_status_t status);
+void rb_cairo_check_status (cairo_status_t status);
 
 #endif

Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_context.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- rb_cairo_context.c	8 Oct 2005 17:15:54 -0000	1.13
+++ rb_cairo_context.c	9 Oct 2005 07:04:40 -0000	1.14
@@ -43,7 +43,7 @@
   *glyphs = ALLOCA_N (cairo_glyph_t, *length);
 
   if (!*glyphs)
-    rb_cairo_raise_exception (CAIRO_STATUS_NO_MEMORY);
+    rb_cairo_check_status (CAIRO_STATUS_NO_MEMORY);
 
   for (i = 0; i < *length; i++)
     {
@@ -56,12 +56,7 @@
 static inline void
 cr_check_status (cairo_t *context)
 {
-  cairo_status_t status;
-  status = cairo_status (context);
-  if (status)
-    {
-      rb_cairo_raise_exception (status);
-    }
+  rb_cairo_check_status (cairo_status (context));
 }
 
 /* Functions for manipulating state objects */
@@ -370,7 +365,7 @@
       values = ALLOCA_N (double, length);
       if (!values)
         {
-          rb_cairo_raise_exception (CAIRO_STATUS_NO_MEMORY);
+          rb_cairo_check_status (CAIRO_STATUS_NO_MEMORY);
         }
       for (i = 0; i < length; i++)
         {
@@ -981,7 +976,7 @@
 
   if (source)
     {
-      rb_cairo_raise_exception (cairo_pattern_status (source));
+      rb_cairo_check_status (cairo_pattern_status (source));
       return CRPATTERN2RVAL (source, rb_ivar_get (self, cr_id_source_class));
     }
   else
@@ -1053,7 +1048,7 @@
   cairo_surface_t *surface;
 
   surface = cairo_get_target (_SELF);
-  rb_cairo_raise_exception (cairo_surface_status (surface));
+  rb_cairo_check_status (cairo_surface_status (surface));
   return CRSURFACE2RVAL (surface);
 }
 

Index: rb_cairo_exception.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_exception.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rb_cairo_exception.c	7 Oct 2005 14:08:13 -0000	1.7
+++ rb_cairo_exception.c	9 Oct 2005 07:04:40 -0000	1.8
@@ -31,7 +31,7 @@
 static VALUE rb_eCairo_InvalidDashError;
 
 void
-rb_cairo_raise_exception (cairo_status_t  status)
+rb_cairo_check_status (cairo_status_t status)
 {
   const char *string = cairo_status_to_string (status);
   
@@ -102,15 +102,18 @@
 void
 Init_cairo_exception ()
 {
+  VALUE rb_eCairo_Error;
+  rb_eCairo_Error =
+    rb_define_class_under (rb_mCairo, "Error", rb_eStandardError);
   rb_eCairo_InvalidRestoreError =
     rb_define_class_under (rb_mCairo, "InvalidRestoreError",
-                           rb_eRuntimeError);
+                           rb_eCairo_Error);
   rb_eCairo_InvalidPopGroupError =
     rb_define_class_under (rb_mCairo, "InvalidPopGroupError",
-                           rb_eRuntimeError);
+                           rb_eCairo_Error);
   rb_eCairo_NoCurrentPointError =
     rb_define_class_under (rb_mCairo, "NoCurrentPointError",
-                           rb_eRuntimeError);
+                           rb_eCairo_Error);
   rb_eCairo_InvalidMatrixError =
     rb_define_class_under (rb_mCairo, "InvalidMatrixError",
                            rb_eArgError);
@@ -128,13 +131,13 @@
                            rb_eArgError);
   rb_eCairo_ReadError =
     rb_define_class_under (rb_mCairo, "ReadError",
-                           rb_eRuntimeError);
+                           rb_eIOError);
   rb_eCairo_WriteError =
     rb_define_class_under (rb_mCairo, "WriteError",
-                           rb_eRuntimeError);
+                           rb_eIOError);
   rb_eCairo_SurfaceFinishedError =
     rb_define_class_under (rb_mCairo, "SurfaceFinishedError",
-                           rb_eRuntimeError);
+                           rb_eCairo_Error);
   rb_eCairo_SurfaceTypeMismatchError =
     rb_define_class_under (rb_mCairo, "SurfaceTypeMismatchError",
                            rb_eTypeError);
@@ -152,7 +155,7 @@
                            rb_eArgError);
   rb_eCairo_FileNotFoundError =
     rb_define_class_under (rb_mCairo, "FileNotFound",
-                           rb_eRuntimeError);
+                           rb_eCairo_Error);
   rb_eCairo_InvalidDashError =
     rb_define_class_under (rb_mCairo, "InvalidDashError",
                            rb_eArgError);

Index: rb_cairo_font_options.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_font_options.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_font_options.c	8 Oct 2005 03:10:10 -0000	1.2
+++ rb_cairo_font_options.c	9 Oct 2005 07:04:40 -0000	1.3
@@ -17,7 +17,7 @@
 static inline void
 cr_options_check_status (cairo_font_options_t *options)
 {
-  rb_cairo_raise_exception (cairo_font_options_status (options));
+  rb_cairo_check_status (cairo_font_options_status (options));
 }
 
 cairo_font_options_t *

Index: rb_cairo_matrix.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_matrix.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- rb_cairo_matrix.c	7 Oct 2005 14:08:13 -0000	1.9
+++ rb_cairo_matrix.c	9 Oct 2005 07:04:40 -0000	1.10
@@ -154,13 +154,7 @@
 static    VALUE
 cr_matrix_invert (VALUE self)
 {
-  cairo_status_t status;
-  status = cairo_matrix_invert (_SELF);
-  if (status)
-    {
-      rb_cairo_raise_exception (status);
-    }
-      
+  rb_cairo_check_status (cairo_matrix_invert (_SELF));
   return self;
 }
 

Index: rb_cairo_pattern.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_pattern.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- rb_cairo_pattern.c	8 Oct 2005 17:15:54 -0000	1.8
+++ rb_cairo_pattern.c	9 Oct 2005 07:04:40 -0000	1.9
@@ -23,7 +23,7 @@
 static inline void
 cr_pattern_check_status (cairo_pattern_t *pattern)
 {
-  rb_cairo_raise_exception (cairo_pattern_status (pattern));
+  rb_cairo_check_status (cairo_pattern_status (pattern));
 }
 
 cairo_pattern_t *

Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- rb_cairo_surface.c	8 Oct 2005 15:38:05 -0000	1.11
+++ rb_cairo_surface.c	9 Oct 2005 07:04:40 -0000	1.12
@@ -34,7 +34,7 @@
 static inline void
 cr_surface_check_status (cairo_surface_t *surface)
 {
-  rb_cairo_raise_exception (cairo_surface_status (surface));
+  rb_cairo_check_status (cairo_surface_status (surface));
 }
 
 static void
@@ -43,7 +43,7 @@
   cairo_status_t status;
   status = cairo_surface_set_user_data (surface, &klass_key,
                                         (void *)klass, NULL);
-  rb_cairo_raise_exception (status);
+  rb_cairo_check_status (status);
 }
 
 static VALUE
@@ -204,7 +204,7 @@
                 "invalid argument (expect (filename) or (&block))");
     }
   
-  rb_cairo_raise_exception (status);
+  rb_cairo_check_status (status);
   return self;
 }
 #endif
@@ -216,7 +216,7 @@
   cairo_surface_get_font_options (_SELF, options);
   cr_surface_check_status (_SELF);
   options = cairo_font_options_copy (options);
-  rb_cairo_raise_exception (cairo_font_options_status (options));
+  rb_cairo_check_status (cairo_font_options_status (options));
   return CRFONTOPTIONS2RVAL (options);
 }
 



More information about the cairo-commit mailing list