After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 363231 - Macros autogeneration
Macros autogeneration
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: gobject
2.12.x
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2006-10-18 20:19 UTC by Maciej (Matthew) Piechotka
Modified: 2007-06-15 17:41 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Maciej (Matthew) Piechotka 2006-10-18 20:19:35 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)();
})@
Comment 1 Havoc Pennington 2006-10-18 20:24:29 UTC
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...
Comment 2 Maciej (Matthew) Piechotka 2006-10-18 20:28:43 UTC
I know I can't. However few other's such thing's works (such glib-mkenums).
Comment 3 Tim Janik 2007-06-15 00:14:57 UTC
(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
Comment 4 Maciej (Matthew) Piechotka 2007-06-15 05:27:10 UTC
I know gob - it lacks of few features like support for interfaces.
Comment 5 Behdad Esfahbod 2007-06-15 11:49:25 UTC
(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.
Comment 6 Maciej (Matthew) Piechotka 2007-06-15 17:41:20 UTC
(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...