[Xcb-commit] xcb/proto: 2 commits - doc src xcbgen

Christian Linhart clinhart at kemper.freedesktop.org
Sun Jan 31 22:58:54 PST 2016


 doc/xml-xcb.txt  |    9 ++++++++-
 src/xkb.xml      |   10 +++++-----
 xcbgen/xtypes.py |    2 ++
 3 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 2ba8cdb2ef7d12b9615329b50ff14d69e6fa4a37
Author: Christian Linhart <chris at demorecorder.com>
Date:   Mon Jan 18 06:52:03 2016 +0100

    enforce serialization of pads where needed for ABI compat
    
    Signed-off-by: Christian Linhart <chris at demorecorder.com>

diff --git a/src/xkb.xml b/src/xkb.xml
index 06488e7..8778c07 100644
--- a/src/xkb.xml
+++ b/src/xkb.xml
@@ -1356,7 +1356,7 @@ authorization from the authors.
 					<list name="acts_rtrn_count" type="CARD8">
 						<fieldref>nKeyActions</fieldref>
 					</list>
-                                        <pad align="4" />
+                                        <pad align="4" serialize="true"/>
 					<list name="acts_rtrn_acts" type="Action">
 						<fieldref>totalActions</fieldref>
 					</list>
@@ -1372,21 +1372,21 @@ authorization from the authors.
 					<list name="vmods_rtrn" type="CARD8" mask="ModMask">
 						<popcount><fieldref>virtualMods</fieldref></popcount>
 					</list>
-                                        <pad align="4" />
+                                        <pad align="4" serialize="true" />
 				</bitcase>
 				<bitcase>
 					<enumref ref="MapPart">ExplicitComponents</enumref>
 					<list name="explicit_rtrn" type="SetExplicit">
 						<fieldref>totalKeyExplicit</fieldref>
 					</list>
-                                        <pad align="4" />
+                                        <pad align="4" serialize="true" />
 				</bitcase>
 				<bitcase>
 					<enumref ref="MapPart">ModifierMap</enumref>
 					<list name="modmap_rtrn" type="KeyModMap">
 						<fieldref>totalModMapKeys</fieldref>
 					</list>
-                                        <pad align="4" />
+                                        <pad align="4" serialize="true" />
 				</bitcase>
 				<bitcase>
 					<enumref ref="MapPart">VirtualModMap</enumref>
@@ -1670,7 +1670,7 @@ authorization from the authors.
 					       <fieldref>nKTLevels</fieldref> -->
 					        <fieldref>nTypes</fieldref>
 					</list>
-					<pad align="4" />
+					<pad align="4" serialize="true" />
 					<list name="ktLevelNames" type="ATOM">
 						<sumof ref="nLevelsPerType" />
 					</list>
commit 21b11ee553a0bf074e9672be9107e11c97704195
Author: Christian Linhart <chris at demorecorder.com>
Date:   Mon Jan 18 06:52:02 2016 +0100

    optionally enforce serialization of pads
    
    From now on, due to a patch in libxcb, pads will not be serialized
    anymore. This is to maintain ABI-compatibility when adding
    explicit align pads.
    
    However, some align pads were already be serialized in prior
    official versions of libxcb. Therefore we need a method to
    enforce serialization, so we can maintainn ABI compatibility
    with that legacy.
    
    Signed-off-by: Christian Linhart <chris at demorecorder.com>

diff --git a/doc/xml-xcb.txt b/doc/xml-xcb.txt
index 12c0881..9cef1de 100644
--- a/doc/xml-xcb.txt
+++ b/doc/xml-xcb.txt
@@ -191,11 +191,18 @@ enum; the value is restricted to one of the constants named in the enum.
 "mask" refers to an exhaustive enum to be used as a bitmask.
 "altmask" may be a mask from the referred enum, but it need not be.
 
-<pad bytes="integer" />
+<pad bytes="integer" serialize="bool" />
 
   This element declares some padding in a data structure.  The bytes
   attribute declares the number of bytes of padding.
 
+  If serialize="true", then the pad will be serialized/deserialized.
+  This is only needed for ABI compatibility with legacy.
+  Newly added pads should not be defined with serialize="true".
+
+  The serialize attribute may be omitted.
+  Default is serialize="false".
+
 <field type="identifier" name="identifier" />
 
   This element represents a field in a data structure.  The type attribute
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 1f604de..c3b5758 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -6,6 +6,7 @@ from xcbgen.align import Alignment, AlignmentLog
 import __main__
 
 verbose_align_log = False
+true_values = ['true', '1', 'yes']
 
 class Type(object):
     '''
@@ -429,6 +430,7 @@ class PadType(Type):
         if elt != None:
             self.nmemb = int(elt.get('bytes', "1"), 0)
             self.align = int(elt.get('align', "1"), 0)
+            self.serialize = elt.get('serialize', "false").lower() in true_values
 
         # pads don't require any alignment at their start
         self.required_start_align = Alignment(1,0)


More information about the xcb-commit mailing list