[cairo] Adding to_string() functions for all enums.

Behdad Esfahbod behdad at behdad.org
Mon Nov 20 21:16:00 PST 2006


Hi,

While working on the cairocairo probe (a tool to output cairo calls an
app makes), I figured it should be useful for bindings of all kinds to
have to_string() functions for all cairo enum types.  One that prints
out the name of the enum value.  The problem is, we already have
cairo_status_to_string() that unfortunately /describes/ the error, not
just writing out the status name.  So, at least for that one the name
to_string() cannot be used.  Suggestions on alternate names?  Unless
someone beats me, I'm going to do the grunge work of adding all 20 soon:

cairo.h:typedef enum _cairo_status {
cairo.h:typedef enum _cairo_content {
cairo.h:typedef enum _cairo_operator {
cairo.h:typedef enum _cairo_antialias {
cairo.h:typedef enum _cairo_fill_rule {
cairo.h:typedef enum _cairo_line_cap {
cairo.h:typedef enum _cairo_line_join {
cairo.h:typedef enum _cairo_font_slant {
cairo.h:typedef enum _cairo_font_weight {
cairo.h:typedef enum _cairo_subpixel_order {
cairo.h:typedef enum _cairo_hint_style {
cairo.h:typedef enum _cairo_hint_metrics {
cairo.h:typedef enum _cairo_font_type {
cairo.h:typedef enum _cairo_path_data_type {
cairo.h:typedef enum _cairo_surface_type {
cairo.h:typedef enum _cairo_format {
cairo.h:typedef enum _cairo_pattern_type {
cairo.h:typedef enum _cairo_extend {
cairo.h:typedef enum _cairo_filter {
cairo-svg.h:typedef enum _cairo_svg_version {

Carl, do you think writing a small script to extract them automatically
makes enough sense to do?  Glib has such a tool, but we don't have that
of course.

I'm also going to separate the typedef from the enum definition, such
that text processing the headers can easily extract all enum types.


-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list