[Xcb] Using COMMENT, and a Better Way for enums
Andrew Howe
andy@cooper-mtn.com
Thu, 6 Nov 2003 15:28:54 -0800
>Hello, all.
> I'm working on a perl version of XCB (can we get a name that isn't
>tied to C, BTW?), and I've got a minor rant, and a proposal.
>
>First, the minor rant: While COMMENT is defined, it's almost never used.
> The m4 files contain comments in the form of /* ... */. This makes it
>quite obnoxious to try to generate things other then c with it.
>
>That one is easy, since there's already a defined API for it.
I agree, we should be using COMMENT instead of using c-style comments.
The code is currently being reworked in several places, so this will get
changed soon. (I'll be adding it to the TODO list right after I finish
this email)
>enums, my
>next topic, require a new one, since the existing one is rather poor.
>
>I propose the following.
>ENUM(`CW', `
> ENUMELEM(`BackPixmap', NTHBIT(0))
> ENUMELEM(`BackPixel', NTHBIT(1))
>')
>
>The definition of ENUM needn't change in this proposal (I'm using ENUM
>instead of XCBENUM here. The only difference seems to be that XCBENUM
>prepends XCB to the name given.
>The definitions of the other two macros could be, for client-c.xcb:
>DEFINE(`ENUMELEM', $1` = '$2)
>DEFINE(`NTHBIT', `1L<<'$1)
>
>That should allow me to define them the way I need for perl. Other
>languages may be a problem if they have different ideas of numeric
>literals then C, but this seems unlikely in practice. (In particular,
>almost all enums will be 42, 0x2a, or NTHBIT(4).)
This is already on the TODO list.
>Oh, one other thing. The extensions/ files seem to have another sort of
>literal C -- typedefs. I'd much rather see TYPEDEF(`INT32', `FIXED'),
>and the related make_fixed be in some higher layer completely.
These two things are from xcb_render.xcb, and they are both my fault. :)
You'll note that updating the render extension is also on the TODO list.
I'll be updating it tonight, so you should see this change soon.
---Andy Howe