A problem about reading the source code

Uli Schlachter psychon at znc.in
Tue Jan 2 05:48:59 UTC 2024


Hi,

Am 01.01.24 um 14:39 schrieb starcold14:
> Hi,Uli Schlachter,
> I am very grateful for your reply.
> I am now a little confused about the XML specification. I cannot understand 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 
<reply> tag, the request has a reply (some requests do not generate a 
reply). Thus, a function xcb_NameOfTheRequest_reply() is generated. The 
contents of that function is always the same: a call to 
xcb_wait_for_reply(). It's just that the result of xcb_wait_for_reply() 
needs to be cast to xcb_NameOfTheRequest_reply_t.

What the XML really describes are the contents of the struct, in this 
case xcb_grab_pointer_reply_t. There is a single field called "status" 
in our case here.

I don't know why you want to look at the source code of 
xcb_grab_pointer_reply(), but there is nothing interesting there. 
Perhaps it makes more sense to talk about that reason.

Cheers,
Uli

[...]
> <https://maas.mail.163.com/dashi-web-extend/html/proSignature.html?ftlId=1&name=starcold14&uid=starcold14%40gmail.com&iconUrl=https%3A%2F%2Fmail-online.nosdn.127.net%2Fqiyelogo%2FdefaultAvatar.png&items=%5B%22starcold14%40gmail.com%22%5D>
> On 12/29/2023 21:00,Uli Schlachter<psychon at znc.in> <mailto:psychon at znc.in> wrote:
> 
>      Hi starcold,
> 
>      Am 29.12.23 um 09:37 schrieb starcold14:
> 
>          Hi,
>          I'm a newbie and don't know much about libxcb,
> 
> 
>      There is xcb/proto and libxcb. proto contains a XML description of the
>      X11 protocol and libxcb uses this XML to generate C code.
> 
>          and I'm currently having a
>          problem where when I want to find a function named xcb_grab_pointer_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 grep tool.
> 
> 
>      You can find he XML specification for GrabPointer here: [0]
> 
>      [0]:
>      https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/blob/1388374c7149114888a6a5cd6e9bf6ad4b42adf8/src/xproto.xml#L2585-2596
> 
>      When you build libxcb from source, the appropriate C code is then
>      generated. You won't find much helpful in there. This is the generated
>      code for xcb_grab_pointer_reply():
> 
>      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);
>      }
> 
>      Cheers,
>      Uli
>      --
>      “Some people are worth melting for.” - Olaf
> 

-- 
Homophobia - The fear that another man will treat you the way you treat 
women.



More information about the Xcb mailing list