Re: A problem about reading the source code
Uli Schlachter <[email protected]> Tue, 2 Jan 2024 06:48:59 +0100
| Newsgroups | gmane.comp.freedesktop.xcb |
|---|---|
| Message-ID | <[email protected]> |
Hi, Am 01.01.24 um 14:39 schrieb starcold14: > Hi=EF=BC=8CUli Schlachter=EF=BC=8C > I am very grateful for your reply. > I am now a little confused about the XML specification. I cannot unders= tand how > the XML specification describes a function like xcb_grab_pointer_reply(= ) . > Is there any documents describe the rules of turning XML to C code? I don't know about such a document. But the rule is quite simple, I think= . The <request> tag provides the name of the request. Since it contains a=20 <reply> tag, the request has a reply (some requests do not generate a=20 reply). Thus, a function xcb_NameOfTheRequest_reply() is generated. The=20 contents of that function is always the same: a call to=20 xcb_wait_for_reply(). It's just that the result of xcb_wait_for_reply()=20 needs to be cast to xcb_NameOfTheRequest_reply_t. What the XML really describes are the contents of the struct, in this=20 case xcb_grab_pointer_reply_t. There is a single field called "status"=20 in our case here. I don't know why you want to look at the source code of=20 xcb_grab_pointer_reply(), but there is nothing interesting there.=20 Perhaps it makes more sense to talk about that reason. Cheers, Uli [...] > <https://maas.mail.163.com/dashi-web-extend/html/proSignature.html?ftlI= d=3D1&name=3Dstarcold14&uid=3Dstarcold14%40gmail.com&iconUrl=3Dhttps%3A%2= F%2Fmail-online.nosdn.127.net%2Fqiyelogo%2FdefaultAvatar.png&items=3D%5B%= 22starcold14%40gmail.com%22%5D> > On 12/29/2023 21:00=EF=BC=8CUli Schlachter<[email protected]> <mailto:psyc= [email protected]> wrote=EF=BC=9A >=20 > Hi starcold, >=20 > Am 29.12.23 um 09:37 schrieb starcold14: >=20 > Hi=EF=BC=8C > I'm a newbie and don't know much about libxcb, >=20 >=20 > There is xcb/proto and libxcb. proto contains a XML description of= the > X11 protocol and libxcb uses this XML to generate C code. >=20 > and I'm currently having a > problem where when I want to find a function named xcb_grab_po= inter_reply, I > can't find it in the code from > gitlab(https://gitlab.freedesktop.org/xorg/lib/libxcb > <https://gitlab.freedesktop.org/xorg/lib/libxcb>) using the gr= ep tool. >=20 >=20 > You can find he XML specification for GrabPointer here: [0] >=20 > [0]: > https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/blob/1388374c= 7149114888a6a5cd6e9bf6ad4b42adf8/src/xproto.xml#L2585-2596 >=20 > When you build libxcb from source, the appropriate C code is then > generated. You won't find much helpful in there. This is the gener= ated > code for xcb_grab_pointer_reply(): >=20 > xcb_grab_pointer_reply_t * > xcb_grab_pointer_reply (xcb_connection_t *c, > xcb_grab_pointer_cookie_t cookie /**< */, > xcb_generic_error_t **e) > { > return (xcb_grab_pointer_reply_t *) xcb_wait_for_reply(c, > cookie.sequence, e); > } >=20 > Cheers, > Uli > -- > =E2=80=9CSome people are worth melting for.=E2=80=9D - Olaf >=20 --=20 Homophobia - The fear that another man will treat you the way you treat=20 women.