GNOME Bugzilla – Bug 363231
Macros autogeneration
Last modified: 2007-06-15 17:41:20 UTC
In each header file it's repeated the nearly same lines: #define FOO_TYPE_BAR (...) #define FOO_BAR(obj) (...) #define FOO_BAR_CLASS(klass) (...) #define FOO_IS_BAR(obj) (...) #define FOO_IS_BAR_CLASS(klass) (...) ... It would be much simpler to have prepreprocesor: @DEFINE_CLASS(FooBar, FooBarParent, { int some_value; }, { int (*some_virtual_function)(); })@
You can't define macros in macros, so to do this you'd need some hacky extra preprocessor in addition to cpp, which would be a cure worse than the disease...
I know I can't. However few other's such thing's works (such glib-mkenums).
(In reply to comment #0) > In each header file it's repeated the nearly same lines: > > #define FOO_TYPE_BAR (...) > #define FOO_BAR(obj) (...) > #define FOO_BAR_CLASS(klass) (...) > #define FOO_IS_BAR(obj) (...) > #define FOO_IS_BAR_CLASS(klass) (...) > ... > > It would be much simpler to have prepreprocesor: > @DEFINE_CLASS(FooBar, FooBarParent, { [...] this is exactly the route the Qt people took with moc. for gtk/glib, this was deliberately not done. there are tools out there that do part of what you request though, e.g. gob: http://www.google.com/search?&q=gob2
I know gob - it lacks of few features like support for interfaces.
(In reply to comment #4) > I know gob - it lacks of few features like support for interfaces. I saw patches on the gob mailing list to support interfaces a few months ago. Not sure if they are committed.
(In reply to comment #5) > (In reply to comment #4) > > I know gob - it lacks of few features like support for interfaces. > > I saw patches on the gob mailing list to support interfaces a few months ago. > Not sure if they are committed. > Last news on http://www.5z.com/jirka/gob.html is January 2006 so I don't think so...