On Tue,  9 Oct 2012 22:38:02 -0400
Kristian Høgsberg <[email protected]> wrote:

> This makes the scanner generate the code and meta data to send the
> interface name and version when we pass a typeless new_id.  This way, the
> generic factory mechanism provided by wl_display.bind can be provided by
> any interface.
> ---
>  protocol/wayland.xml |    6 ++----
>  src/scanner.c        |   56 
> ++++++++++++++++++++++++++++++++++----------------
>  2 files changed, 40 insertions(+), 22 deletions(-)
> 
> diff --git a/protocol/wayland.xml b/protocol/wayland.xml
> index e9f8034..86b82b8 100644
> --- a/protocol/wayland.xml
> +++ b/protocol/wayland.xml
> @@ -38,9 +38,7 @@
>       the identifier.
>        </description>
>        <arg name="name" type="uint" summary="unique number id for object"/>
> -      <arg name="interface" type="string"/>
> -      <arg name="version" type="uint"/>
> -      <arg name="id" type="new_id" interface="wl_object"/>
> +      <arg name="id" type="new_id"/>
>      </request>
>  
>      <request name="sync">
> @@ -58,7 +56,7 @@
>       The error event is sent out when a fatal (non-recoverable)
>       error has occurred.
>        </description>
> -      <arg name="object_id" type="object" interface="wl_object"/>
> +      <arg name="object_id" type="object"/>
>        <arg name="code" type="uint"/>
>        <arg name="message" type="string"/>
>      </event>
> diff --git a/src/scanner.c b/src/scanner.c
> index 0fc26e7..bf5df26 100644
> --- a/src/scanner.c
> +++ b/src/scanner.c
...
> @@ -645,8 +656,8 @@ emit_stubs(struct wl_list *message_list, struct interface 
> *interface)
>                              interface->name);
>  
>               if (ret)
> -                     printf("\n\treturn (struct %s *) %s;\n",
> -                            ret->interface_name, ret->name);
> +                     printf("\n\treturn (void *) %s;\n",
> +                            ret->name);

This changes the cast on all wrapper functions. While it's not wrong in
any way, could we keep the cast to the same type as returned from the
function?

>  
>               printf("}\n\n");
>       }
> @@ -799,6 +810,11 @@ emit_structs(struct wl_list *message_list, struct 
> interface *interface)
>  
>                       if (is_interface && a->type == OBJECT)
>                               printf("struct wl_resource *");
> +                     else if (is_interface && a->type == NEW_ID && 
> a->interface_name == NULL)
> +                             printf("const char *interface, uint32_t 
> version, uint32_t ");

We miss documentation comments for interface and version in the
generated header.

> +                     else if (!is_interface && a->type == OBJECT && 
> a->interface_name == NULL)
> +                             printf("struct wl_object *");
> +
>                       else if (!is_interface && a->type == NEW_ID)
>                               printf("struct %s *", a->interface_name);
>                       else
...


Thanks,
pq
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to