[Xcb] Iter
Jeremy Kolb
jkolb at brandeis.edu
Sat Dec 17 11:28:10 PST 2005
As much as I enjoy iters a lot of xlib code was written using pointers
and then you could simply use array syntax. I've noticed that sometimes
XCB will generate a function that allows me to do this: it simply
returns a pointer to an array of some structure. Then when I modify
that structure it decides to only make an Iter function.
For instance:
<request name="QueryEncodings" opcode="2">
<field type="PORT" name="port" />
<reply>
<pad bytes="1" />
<field type="CARD16" name="num_encodings" />
<pad bytes="24" />
<list type="EncodingInfo" name="info">
<fieldref>num_encodings</fieldref>
</list>
</reply>
</request>
and
<struct name="EncodingInfo">
<field type="ENCODING" name="encoding" />
<field type="CARD16" name="name_size" />
<field type="CARD16" name="width" />
<field type="CARD16" name="height" />
<field type="Rational" name="rate" />
<field type="CARD16" name="pad" />
<!--<list type="char" name="name">
<fieldref>name_size</fieldref>
</list>-->
</struct>
Gives me:
XCBXvEncodingInfo *
XCBXvQueryEncodingsInfo (XCBXvQueryEncodingsRep *R);
int
XCBXvQueryEncodingsInfoLength (XCBXvQueryEncodingsRep *R);
XCBXvEncodingInfoIter
XCBXvQueryEncodingsInfoIter (XCBXvQueryEncodingsRep *R);
However if I change EnocodingInfo:
<struct name="EncodingInfo">
<field type="ENCODING" name="encoding" />
<field type="CARD16" name="name_size" />
<field type="CARD16" name="width" />
<field type="CARD16" name="height" />
<field type="Rational" name="rate" />
<field type="CARD16" name="pad" />
<list type="char" name="name">
<fieldref>name_size</fieldref>
</list>
</struct>
I get these:
int
XCBXvQueryEncodingsInfoLength (XCBXvQueryEncodingsRep *R);
XCBXvEncodingInfoIter
XCBXvQueryEncodingsInfoIter (XCBXvQueryEncodingsRep *R);
And now I'm missing that first function and only get an Iter function.
This seems pretty inconsistent to me, and I would really like the
XCBXvQueryEncodingsInfo function both times.
Is this a bug or is it because of the list inside the structure?
Jeremy
More information about the Xcb
mailing list