c++ - Parse C header file to generate files -
i'm working on porting gtk+ node.js, 1 difficulty converting gtk+ functions corresponding c++ call. example,
void gtk_window_set_title (gtkwindow *window, const gchar *title); g_const_return gchar *gtk_window_get_title (gtkwindow *window); void gtk_window_set_role (gtkwindow *window, const gchar *role); void gtk_window_set_startup_id (gtkwindow *window, const gchar *startup_id); g_const_return gchar *gtk_window_get_role (gtkwindow *window);
will converted to:
setter_method (window , "settitle" , gtk_window_set_title , const gchar*) ; getter_method (window , "gettitle" , gtk_window_get_title , const gchar*) ; setter_method (window , "setrole" , gtk_window_set_role , const gchar*) ; setter_method (window , "setstartupid" , gtk_window_set_startup_id , const gchar*) ; getter_method (window , "getrole" , gtk_window_get_role , const gchar*) ;
so 1) must preserve parameters of c declarations in new macro calls (indeed, expanded template arguments). , 2) functions returning , return nothing must distinguished, called setter_method
or getter_method
, because can't merge them in 1 call needs partial function template specialization.
is there tool achieve this?
node.js seems javascript implementation of v8 javascript engine used google chrome. want create new javascript binding gtk, , should done using gobject-introspection work, not binding each function hand.
give @ has been done gjs , seed official javascript bindings gtk.
Comments
Post a Comment