[PATCH wayland v3] protocol: add support for cross-interface enum attributes
Auke Booij
auke at tulcod.com
Tue May 3 19:57:05 UTC 2016
On 3 May 2016 at 13:04, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Sat, 5 Dec 2015 12:39:12 +0000
> Auke Booij <auke at tulcod.com> wrote:
>
>> The enum attribute, for which scanner support was introduced in
>> 1771299, can be used to link message arguments to <enum>s. However,
>> some arguments refer to <enum>s in a different <interface>.
>>
>> This adds scanner support for referring to an <enum> in a different
>> <interface> using dot notation. It also sets the attributes in this
>> style in the wayland XML protocol (wl_shm_pool::create_buffer::format
>> to wl_shm::format, and wl_surface::set_buffer_transform::transform to
>> wl_output::transform), and updates the documentation XSL so that this
>> new style is supported.
>>
>> Changes since v2:
>> - add object:: prefix for all enumerations in the documentation
>> - fix whitespace in scanner.c
>> - minor code fixup to return early and avoid casts in scanner.c
>>
>> Changes since v1:
>> - several implementation bugs fixed
>>
>> Signed-off-by: Auke Booij <auke at tulcod.com>
>> ---
>> doc/publican/protocol-to-docbook.xsl | 19 +++++++++--
>> protocol/wayland.xml | 4 +--
>> src/scanner.c | 63 +++++++++++++++++++++++++++---------
>> 3 files changed, 65 insertions(+), 21 deletions(-)
>>
>> diff --git a/doc/publican/protocol-to-docbook.xsl b/doc/publican/protocol-to-docbook.xsl
>> index fad207a..7e892c3 100644
>> --- a/doc/publican/protocol-to-docbook.xsl
>> +++ b/doc/publican/protocol-to-docbook.xsl
>> @@ -103,9 +103,22 @@
>> <listitem>
>> <simpara>
>> <xsl:if test="@enum">
>> - <link linkend="protocol-spec-{../../@name}-enum-{@enum}">
>> - <xsl:value-of select="@enum"/>
>> - </link>
>> + <xsl:choose>
>> + <xsl:when test="contains(@enum, '.')">
>> + <link linkend="protocol-spec-{substring-before(@enum, '.')}-enum-{substring-after(@enum, '.')}">
>> + <xsl:value-of select="substring-before(@enum, '.')"/>
>> + <xsl:text>::</xsl:text>
>> + <xsl:value-of select="substring-after(@enum, '.')"/>
>> + </link>
>> + </xsl:when>
>> + <xsl:otherwise>
>> + <link linkend="protocol-spec-{../../@name}-enum-{@enum}">
>> + <xsl:value-of select="../../@name"/>
>> + <xsl:text>::</xsl:text>
>> + <xsl:value-of select="@enum"/>
>> + </link>
>> + </xsl:otherwise>
>> + </xsl:choose>
>> <xsl:text> </xsl:text>
>> </xsl:if>
>> <xsl:value-of select="@type"/>
>
> Hi,
>
> thanks for this.
>
> This XSL snippet does not work when the enum is defined in a different
> XML file, does it? Just making sure I know what the expected behaviour
> is.
Correct; I don't think this is worth implementing at this stage.
> Ok, there would be quite some things to polish, but since this patch
> has waited for so long so I just rebased the xsl hunk myself, made some
> whitespace fixes and pushed it:
> e21aeb5..7ccf35d master -> master
>
> Please have a look at the merged patch in case I missed something.
>
> If you want to do more clean-ups, those can land after the alpha release.
>
>
> Thanks,
> pq
The patch you pushed looks correct; thanks!
More information about the wayland-devel
mailing list