with wrap(['/usr/include/xosd.h'], output='xosd.py', library='xosd') as w: w.add_pointer_class_wrappers( ('xosd', 'XOSD'), ) w.add_init_redirect('XOSD', 'XOSD.create') meth = w.get_pyclass('XOSD').new_method('get_colour') meth.code.extend(transform(\ """r, g, b = c_int(), c_int(), c_int() xosd_get_colour(self._internal, byref(r), byref(g), byref(b)) return (r.value, g.value, b.value) """)) w.add_rules( regex_method('xosd_(.*)', 'XOSD'), regex_match('xosd_init', succeed), regex_match('xosd_get_colour', succeed), regex_classmethod('xosd_(create)', 'XOSD'), ) w.add_wrappers_visitor(make_properties) w.add_synonyms( ('XOSD_(.*)', r'\1') )
('PangoFontMap', 'FontMap'), ('PangoCairoFontMap', 'CairoFontMap'), ) w.wrappers['POINTER(cairo_t)'] = DummyCodegen(name='cairo.Context') # <- hacky, to get pango_cairo_* working w.get_pyclass('CairoFontMap').base = 'FontMap' w.add_init_redirects( ('Context', 'Context.new'), ('Layout', 'Layout.new'), ('FontDescription', 'FontDescription.new'), ('CairoFontMap', 'CairoFontMap.new'), ) w.add_rules( regex_match(r'(pango_cairo_.*)', function), regex_method(r'pango_context_(.*)', 'Context'), regex_classmethod(r'pango_context_(new)', 'Context'), regex_method(r'pango_layout_(.*)', 'Layout'), regex_match(r'pango_layout_get_size', succeed), # separatedly wrapped regex_classmethod(r'pango_layout_(new)', 'Layout'), regex_method(r'pango_font_description_(.*)', 'FontDescription'), regex_classmethod(r'pango_font_description_(new|from_string)$', 'FontDescription'), regex_method(r'pango_font_map_(.*)', 'FontMap'), regex_method(r'pango_cairo_font_map_(.*)', 'CairoFontMap'), regex_classmethod(r'pango_cairo_font_map_(new|new_for_font_type)$', 'CairoFontMap'), )