gtk2-perl / a script to help converting basic functions



Hi,

I've added gtk2-perl/genscripts/convert_funcs.pl to the CVS. It's
a script I've made because I was tired to write down by hand
the conversions of dumb/simple functions :).

So, for simple functions, you may use it if you like. It will
kind of work for simple constructors and simple get/set/do_action
functions (the heuristic for detecting constructors is not very
good, though). It won't work when we need to g_malloc structs by
hand before calling the gtk function, of course, nor when we want
to return an arrayref, or when we are dealing with more complex
functions (but it's still helpful for the function prototype and
the gtk function call).

Of course you need to double check by hand the results :).


For example, when you give it:

-=-=---=-=---=-=---=-=---=-=---=-=---=-=--
void        gtk_text_buffer_set_text        (GtkTextBuffer *buffer,
                                             const gchar *text,
                                             gint len);
gchar*      gtk_text_buffer_get_text        (GtkTextBuffer *buffer,
                                             const GtkTextIter *start,
                                             const GtkTextIter *end,
                                             gboolean include_hidden_chars);
-=-=---=-=---=-=---=-=---=-=---=-=---=-=--


It will output:

-=-=---=-=---=-=---=-=---=-=---=-=---=-=--
void gtkperl_text_buffer_set_text(SV* buffer, char* text, int len)
{
    gtk_text_buffer_set_text(SvGtkTextBuffer(buffer), text, len);
}

char* gtkperl_text_buffer_get_text(SV* buffer, SV* start, SV* end, int include_hidden_chars)
{
    return gtk_text_buffer_get_text(SvGtkTextBuffer(buffer), SvGtkTextIter(start), SvGtkTextIter(end), 
include_hidden_chars);
}
-=-=---=-=---=-=---=-=---=-=---=-=---=-=--


Which is correct, and pretty helpful :).


-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]