[cairo] [rcaio] integrate and install header

Kouhei Sutou kou at cozmixng.org
Thu Sep 8 19:33:54 PDT 2005


Hi,

I want to use rcairo's C API. So I want rcairo to install
rb_cairo.h.

The attached patch details:

  * packages/cairo/ext/rb_cairo_*.h are removed. The
    contents of packages/cairo/ext/rb_cairo_*.h are moved to
    packages/cairo/ext/rb_cairo.h.

  * Init_*() declarations are moved to
    packages/cairo/ext/rb_cairo.c.

  * packages/cairo/ext/rb_cairo*.c include rb_cairo.h
    instead of rb_cairo_*.h.


Thanks,
--
kou
-------------- next part --------------
File packages/cairo/ext/rb_cairo_constants.h should be removed!
File packages/cairo/ext/rb_cairo_context.h should be removed!
File packages/cairo/ext/rb_cairo_exception.h should be removed!
File packages/cairo/ext/rb_cairo_font_extents.h should be removed!
File packages/cairo/ext/rb_cairo_font_face.h should be removed!
File packages/cairo/ext/rb_cairo_glyph.h should be removed!
File packages/cairo/ext/rb_cairo_matrix.h should be removed!
File packages/cairo/ext/rb_cairo_pattern.h should be removed!
File packages/cairo/ext/rb_cairo_surface.h should be removed!
File packages/cairo/ext/rb_cairo_text_extents.h should be removed!
Index: packages/cairo/ext/post-install.rb
--- /dev/null
+++ packages/cairo/ext/post-install.rb
@@ -0,0 +1 @@
+install_files(["rb_cairo.h"], config('so-dir'), 0555)
Index: packages/cairo/ext/rb_cairo.c
--- packages/cairo/ext/rb_cairo.c
+++ packages/cairo/ext/rb_cairo.c
@@ -11,7 +11,16 @@
 
 #include "rb_cairo.h"
 
-VALUE rb_mCairo;
+extern void Init_cairo_context (void);
+extern void Init_cairo_matrix (void);
+extern void Init_cairo_surface (void);
+extern void Init_cairo_constants (void);
+extern void Init_cairo_exception (void);
+extern void Init_cairo_font (void);
+extern void Init_cairo_text_extents (void);
+extern void Init_cairo_font_extents (void);
+extern void Init_cairo_pattern (void);
+extern void Init_cairo_glyph (void);
 
 void
 Init_cairo ()
Index: packages/cairo/ext/rb_cairo.h
--- packages/cairo/ext/rb_cairo.h
+++ packages/cairo/ext/rb_cairo.h
@@ -18,16 +18,42 @@
 #include "ruby.h"
 
 extern VALUE rb_mCairo;
+extern VALUE rb_cCairo_Context;
+extern VALUE rb_cCairo_Matrix;
+extern VALUE rb_cCairo_Pattern;
+extern VALUE rb_cCairo_FontFace;
+extern VALUE rb_cCairo_FontExtents;
+extern VALUE rb_cCairo_TextExtents;
+extern VALUE rb_cCairo_Glyph;
+extern VALUE rb_cCairo_Surface;
 
-#include "rb_cairo_constants.h"
-#include "rb_cairo_context.h"
-#include "rb_cairo_exception.h"
-#include "rb_cairo_matrix.h"
-#include "rb_cairo_pattern.h"
-#include "rb_cairo_font_face.h"
-#include "rb_cairo_font_extents.h"
-#include "rb_cairo_text_extents.h"
-#include "rb_cairo_glyph.h"
-#include "rb_cairo_surface.h"
+VALUE    rb_cairo_new_from  (cairo_t *cr);
+cairo_t *rb_v_to_cairo_t    (VALUE value);
+void     rb_free_context    (void *ptr);
+
+void rb_cairo_raise_exception (cairo_status_t  status);
+
+cairo_matrix_t *rb_v_to_cairo_matrix_t (VALUE value);
+VALUE           rb_cairo_matrix_wrap   (cairo_matrix_t *matrix);
+void            rb_free_matrix         (void *ptr);
+
+VALUE            rb_cairo_pattern_wrap   (cairo_pattern_t *pat);
+cairo_pattern_t *rb_v_to_cairo_pattern_t (VALUE value);
+void             rb_free_pattern         (void *ptr);
+
+cairo_font_face_t *value_to_font_face   (VALUE value);
+void               rb_free_font_face    (void *ptr);
+
+cairo_font_extents_t *rb_v_to_cairo_font_extents_t (VALUE value);
+void                  rb_free_font_extents         (void *ptr);
+
+cairo_text_extents_t *rb_v_to_cairo_text_extents_t (VALUE value);
+void                  rb_free_text_extents         (void *ptr);
+
+cairo_glyph_t *rb_v_to_cairo_glyph_t (VALUE value);
+void           rb_free_glyph         (void *ptr);
+
+cairo_surface_t *rb_v_to_cairo_surface_t (VALUE value);
+void             rb_free_surface         (void *ptr);
 
 #endif
Index: packages/cairo/ext/rb_cairo_constants.c
--- packages/cairo/ext/rb_cairo_constants.c
+++ packages/cairo/ext/rb_cairo_constants.c
@@ -9,7 +9,7 @@
 */
 
 
-#include "rb_cairo_constants.h"
+#include "rb_cairo.h"
 
 void
 Init_cairo_constants (void)
Index: packages/cairo/ext/rb_cairo_context.c
--- packages/cairo/ext/rb_cairo_context.c
+++ packages/cairo/ext/rb_cairo_context.c
@@ -8,9 +8,7 @@
  *
 */
 
-#include "rb_cairo_context.h"
-
-VALUE rb_cCairo_Context;
+#include "rb_cairo.h"
 
 #define _SELF  (DATA_PTR(self))
 
Index: packages/cairo/ext/rb_cairo_font_extents.c
--- packages/cairo/ext/rb_cairo_font_extents.c
+++ packages/cairo/ext/rb_cairo_font_extents.c
@@ -9,12 +9,10 @@
  */
 
 
-#include "rb_cairo_font_extents.h"
+#include "rb_cairo.h"
 
 #define _SELF  ((cairo_font_extents_t *)DATA_PTR(self))
 
-VALUE rb_cCairo_FontExtents;
-
 cairo_font_extents_t *
 rb_v_to_cairo_font_extents_t (VALUE value)
 {
Index: packages/cairo/ext/rb_cairo_font_face.c
--- packages/cairo/ext/rb_cairo_font_face.c
+++ packages/cairo/ext/rb_cairo_font_face.c
@@ -9,12 +9,10 @@
 */
 
 
-#include "rb_cairo_font_face.h"
+#include "rb_cairo.h"
 
 #define _SELF  (DATA_PTR(self))
 
-VALUE rb_cCairo_FontFace;
-
 cairo_font_face_t *
 value_to_font_face (VALUE value)
 {
Index: packages/cairo/ext/rb_cairo_glyph.c
--- packages/cairo/ext/rb_cairo_glyph.c
+++ packages/cairo/ext/rb_cairo_glyph.c
@@ -9,9 +9,7 @@
  */
 
 
-#include "rb_cairo_glyph.h"
-
-VALUE rb_cCairo_Glyph;
+#include "rb_cairo.h"
 
 #define _SELF  ((cairo_glyph_t *)DATA_PTR(self))
 
Index: packages/cairo/ext/rb_cairo_matrix.c
--- packages/cairo/ext/rb_cairo_matrix.c
+++ packages/cairo/ext/rb_cairo_matrix.c
@@ -9,12 +9,10 @@
  */
 
 
-#include "rb_cairo_matrix.h"
+#include "rb_cairo.h"
 
 #define _SELF  (DATA_PTR(self))
 
-VALUE rb_cCairo_Matrix;
-
 cairo_matrix_t *
 rb_v_to_cairo_matrix_t (VALUE value)
 {
Index: packages/cairo/ext/rb_cairo_pattern.c
--- packages/cairo/ext/rb_cairo_pattern.c
+++ packages/cairo/ext/rb_cairo_pattern.c
@@ -12,8 +12,6 @@
 
 #define _SELF  (DATA_PTR(self))
 
-VALUE rb_cCairo_Pattern;
-
 cairo_pattern_t *
 rb_v_to_cairo_pattern_t (VALUE value)
 {
Index: packages/cairo/ext/rb_cairo_surface.c
--- packages/cairo/ext/rb_cairo_surface.c
+++ packages/cairo/ext/rb_cairo_surface.c
@@ -50,8 +50,6 @@
 }
 
 
-VALUE rb_cCairo_Surface;
-
 cairo_surface_t *
 rb_v_to_cairo_surface_t (VALUE value)
 {
Index: packages/cairo/ext/rb_cairo_text_extents.c
--- packages/cairo/ext/rb_cairo_text_extents.c
+++ packages/cairo/ext/rb_cairo_text_extents.c
@@ -10,9 +10,7 @@
 
 #define _SELF  ((cairo_text_extents_t *)DATA_PTR(self))
 
-#include "rb_cairo_text_extents.h"
-
-VALUE rb_cCairo_TextExtents;
+#include "rb_cairo.h"
 
 cairo_text_extents_t *
 rb_v_to_cairo_text_extents_t (VALUE value)


More information about the cairo mailing list