protocol: Make integer explicitly sized

This means 'int' is explicitly 'int32' and 'uint' is explicitly
'uint32' in the protocol XML files.
This commit is contained in:
Jonas Ådahl 2023-02-23 13:40:42 +01:00 committed by Peter Hutterer
parent 312ce6723b
commit cad5bc81bb
2 changed files with 85 additions and 85 deletions

View file

@ -35,8 +35,8 @@ Mapping of allowed protocol types to the single-character signature strings
used in the various code pieces.
"""
PROTOCOL_TYPES = {
"uint": "u",
"int": "i",
"uint32": "u",
"int32": "i",
"float": "f",
"fd": "h",
"new_id": "n",
@ -90,8 +90,8 @@ class Argument:
@property
def c_type(self) -> str:
return {
"uint": "uint32_t",
"int": "int32_t",
"uint32": "uint32_t",
"int32": "int32_t",
"string": "const char *",
"fd": "int",
"float": "float",
@ -742,8 +742,8 @@ def main() -> None:
the interface, depending on the component.
- argument.signature: a single-character signature type mapping
from the protocol XML type:
uint -> "u"
int -> "i"
uint32 -> "u"
int32 -> "i"
float -> "f"
fd -> "h"
new_id -> "n"

View file

@ -46,8 +46,8 @@
- arguments is a variable number of arguments specific to the message.
Types:
- 'uint': a 32-bit unsigned integer
- 'int': a 32-bit signed integer
- 'uint32': a 32-bit unsigned integer
- 'int32': a 32-bit signed integer
- 'float': a 32-bit IEEE-754 float
- 'fd': a file descriptor. Zero bytes in the message itself, transmitted
in the overhead
@ -181,7 +181,7 @@
This request must not be sent more than once and must be sent before
ei_connection_setup.done.
</description>
<arg name="context_type" type="uint" enum="context_type" summary="the client context type"/>
<arg name="context_type" type="uint32" enum="context_type" summary="the client context type"/>
</request>
<request name="name" since="1">
@ -224,7 +224,7 @@
sent before ei_connection_setup.done.
</description>
<arg name="name" type="string" summary="the interface name"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</request>
<!-- ei_connection_setup events version 1 -->
@ -260,7 +260,7 @@
interfaces) before the ei_connection_setup.connection event.
</description>
<arg name="name" type="string" summary="the interface name"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</event>
<event name="connection" type="destructor" since="1">
@ -279,10 +279,10 @@
interface as announced by ei_connection_setup.interface_version, or any
lower version.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
<arg name="connection" type="new_id" interface="ei_connection"
summary="the connection object" />
<arg name="version" type="uint" summary="the version of the connection object"/>
<arg name="version" type="uint32" summary="the version of the connection object"/>
</event>
</interface>
@ -383,8 +383,8 @@
There is no guarantee this event is sent - the connection may be closed
without a disconnection event.
</description>
<arg name="last_serial" type="uint" summary="the last serial sent by the EIS implementation"/>
<arg name="reason" type="uint" enum="disconnect_reason" summary="the reason for being disconnected"/>
<arg name="last_serial" type="uint32" summary="the last serial sent by the EIS implementation"/>
<arg name="reason" type="uint32" enum="disconnect_reason" summary="the reason for being disconnected"/>
<arg name="explanation" type="string" summary="an explanation for debugging purposes"/>
</event>
@ -401,7 +401,7 @@
interface.
</description>
<arg name="seat" type="new_id" interface="ei_seat"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</event>
<event name="invalid_object" since="1">
@ -421,8 +421,8 @@
It is the client's responsibilty to unwind any state changes done
to the object since the last successful message.
</description>
<arg name="last_serial" type="uint" summary="the last serial sent by the EIS implementation"/>
<arg name="invalid_id" type="uint" />
<arg name="last_serial" type="uint32" summary="the last serial sent by the EIS implementation"/>
<arg name="invalid_id" type="uint32" />
</event>
<event name="ping" since="1">
@ -444,7 +444,7 @@
</description>
<arg name="ping" type="new_id" interface="ei_pingpong"
summary="callback object for the ping request"/>
<arg name="version" type="uint" summary="the version of the callback object"/>
<arg name="version" type="uint32" summary="the version of the callback object"/>
</event>
</interface>
@ -466,7 +466,7 @@
the ei_callback object is destroyed by the EIS implementation and as such the
client must not attempt to use it after that point.
</description>
<arg name="callback_data" type="uint" summary="request-specific data for the callback"/>
<arg name="callback_data" type="uint32" summary="request-specific data for the callback"/>
</event>
</interface>
@ -488,7 +488,7 @@
the ei_callback object is destroyed by the client and as such must not be used
any further.
</description>
<arg name="callback_data" type="uint" summary="request-specific data for the callback"/>
<arg name="callback_data" type="uint32" summary="request-specific data for the callback"/>
</request>
<!-- ei_pingpong events version 1 -->
@ -553,7 +553,7 @@
is interested in. If capabilities are dropped, the EIS implementation may
ei_device.remove devices that have these capabilities.
</description>
<arg name="capabilities" type="uint" enum="capabilities"/>
<arg name="capabilities" type="uint32" enum="capabilities"/>
</request>
<!-- ei_seat events version 1 -->
@ -567,7 +567,7 @@
after this event is sent and as such the client must not attempt to use
it after that point.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="name" since="1">
@ -590,7 +590,7 @@
It is a protocol violation to send this event after the ei_seat.done event.
</description>
<arg name="capabilities" type="uint" enum="capabilities" summary="the seat capabilities"/>
<arg name="capabilities" type="uint32" enum="capabilities" summary="the seat capabilities"/>
</event>
<event name="done" since="1">
@ -613,7 +613,7 @@
interface.
</description>
<arg name="device" type="new_id" interface="ei_device" summary="the new device"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</event>
</interface>
@ -673,8 +673,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="last_serial" type="uint" summary="the last serial sent by the EIS implementation"/>
<arg name="sequence" type="uint"/>
<arg name="last_serial" type="uint32" summary="the last serial sent by the EIS implementation"/>
<arg name="sequence" type="uint32"/>
</request>
<request name="stop_emulating" since="1">
@ -685,7 +685,7 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="last_serial" type="uint" summary="the last serial sent by the EIS implementation"/>
<arg name="last_serial" type="uint32" summary="the last serial sent by the EIS implementation"/>
</request>
<request name="frame" since="1">
@ -705,9 +705,9 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="last_serial" type="uint" summary="the last serial sent by the EIS implementation"/>
<arg name="timestamp" type="uint" summary="timestamp in milliseconds"/>
<arg name="micros" type="uint" summary="microseconds in addition to the millis"/>
<arg name="last_serial" type="uint32" summary="the last serial sent by the EIS implementation"/>
<arg name="timestamp" type="uint32" summary="timestamp in milliseconds"/>
<arg name="micros" type="uint32" summary="microseconds in addition to the millis"/>
</request>
<!-- ei_device events version 1 -->
@ -721,7 +721,7 @@
after this event is sent and as such the client must not attempt to use
it after that point.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="name" since="1">
@ -751,7 +751,7 @@
This event must be is sent once immediately after object creation.
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="capabilities" type="uint" enum="capabilities" summary="the device name"/>
<arg name="capabilities" type="uint32" enum="capabilities" summary="the device name"/>
</event>
<enum name="device_type" since="1">
@ -780,7 +780,7 @@
This event is sent once immediately after object creation.
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="device_type" type="uint" enum="device_type" summary="the device type"/>
<arg name="device_type" type="uint32" enum="device_type" summary="the device type"/>
</event>
<event name="dimensions" since="1">
@ -792,8 +792,8 @@
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="width" type="uint" summary="the device physical width in mm"/>
<arg name="height" type="uint" summary="the device physical height in mm"/>
<arg name="width" type="uint32" summary="the device physical width in mm"/>
<arg name="height" type="uint32" summary="the device physical height in mm"/>
</event>
<event name="region" since="1">
@ -828,10 +828,10 @@
has multiple regions, this event is sent once for each region.
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="offset_x" type="uint" summary="region x offset in logical pixels"/>
<arg name="offset_y" type="uint" summary="region y offset in logical pixels"/>
<arg name="width" type="uint" summary="region width in logical pixels"/>
<arg name="hight" type="uint" summary="region height in logical pixels"/>
<arg name="offset_x" type="uint32" summary="region x offset in logical pixels"/>
<arg name="offset_y" type="uint32" summary="region y offset in logical pixels"/>
<arg name="width" type="uint32" summary="region width in logical pixels"/>
<arg name="hight" type="uint32" summary="region height in logical pixels"/>
<arg name="scale" type="float" summary="the physical scale for this region"/>
</event>
@ -853,7 +853,7 @@
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="pointer" type="new_id" interface="ei_pointer"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</event>
<event name="keyboard" since="1">
@ -873,7 +873,7 @@
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="keyboard" type="new_id" interface="ei_keyboard"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</event>
<event name="touchscreen" since="1">
@ -893,7 +893,7 @@
It is a protocol violation to send this event after the ei_device.done event.
</description>
<arg name="touchscreen" type="new_id" interface="ei_touchscreen"/>
<arg name="version" type="uint" summary="the interface version"/>
<arg name="version" type="uint32" summary="the interface version"/>
</event>
<event name="done" since="1">
@ -917,7 +917,7 @@
A newly advertised device is in the ei_device.paused state.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="paused" since="1">
@ -946,7 +946,7 @@
A newly advertised device is in the ei_device.paused state.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="start_emulating" since="1">
@ -956,8 +956,8 @@
It is a protocol violation to send this event for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="sequence" type="uint"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
<arg name="sequence" type="uint32"/>
</event>
<event name="stop_emulating" since="1">
@ -967,7 +967,7 @@
It is a protocol violation to send this event for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="frame" since="1">
@ -977,9 +977,9 @@
It is a protocol violation to send this event for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="timestamp" type="uint" summary="timestamp in milliseconds"/>
<arg name="micros" type="uint" summary="microseconds in addition to the millis"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
<arg name="timestamp" type="uint32" summary="timestamp in milliseconds"/>
<arg name="micros" type="uint32" summary="microseconds in addition to the millis"/>
</event>
</interface>
@ -1077,8 +1077,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="x" type="int" summary="the x movement in fractions or multiple of 120"/>
<arg name="y" type="int" summary="the y movement in fractions or multiple of 120"/>
<arg name="x" type="int32" summary="the x movement in fractions or multiple of 120"/>
<arg name="y" type="int32" summary="the y movement in fractions or multiple of 120"/>
</request>
<request name="scroll_stop" since="1">
@ -1106,9 +1106,9 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="x" type="uint" summary="nonzero if this axis stopped scrolling"/>
<arg name="y" type="uint" summary="nonzero if this axis stopped scrolling"/>
<arg name="is_cancel" type="uint" summary="nonzero to indicate this is a cancel event"/>
<arg name="x" type="uint32" summary="nonzero if this axis stopped scrolling"/>
<arg name="y" type="uint32" summary="nonzero if this axis stopped scrolling"/>
<arg name="is_cancel" type="uint32" summary="nonzero to indicate this is a cancel event"/>
</request>
<enum name="button_state" since="1">
@ -1128,8 +1128,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="button" type="uint" summary="button code"/>
<arg name="state" type="uint" enum="button_state"/>
<arg name="button" type="uint32" summary="button code"/>
<arg name="state" type="uint32" enum="button_state"/>
</request>
<!-- ei_pointer events version 1 -->
@ -1143,7 +1143,7 @@
after this event is sent and as such the client must not attempt to use
it after that point.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="motion_relative" since="1">
@ -1186,8 +1186,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="x" type="int"/>
<arg name="y" type="int"/>
<arg name="x" type="int32"/>
<arg name="y" type="int32"/>
</event>
<event name="scroll_stop" since="1">
@ -1197,9 +1197,9 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="x" type="uint"/>
<arg name="y" type="uint"/>
<arg name="is_cancel" type="uint"/>
<arg name="x" type="uint32"/>
<arg name="y" type="uint32"/>
<arg name="is_cancel" type="uint32"/>
</event>
<event name="button" since="1">
@ -1209,8 +1209,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="button" type="uint"/>
<arg name="state" type="uint" enum="button_state"/>
<arg name="button" type="uint32"/>
<arg name="state" type="uint32" enum="button_state"/>
</event>
</interface>
@ -1257,8 +1257,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than sender.
</description>
<arg name="key" type="uint" summary="the key code"/>
<arg name="state" type="uint" enum="key_state" summary="logical state of the key"/>
<arg name="key" type="uint32" summary="the key code"/>
<arg name="state" type="uint32" enum="key_state" summary="logical state of the key"/>
</request>
<!-- ei_keyboard events version 1 -->
@ -1272,7 +1272,7 @@
after this event is sent and as such the client must not attempt to use
it after that point.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<enum name="keymap_type" since="1">
@ -1297,8 +1297,8 @@
and before the ei_device.done event. It is a protocol violation to send this
event after the ei_device.done event.
</description>
<arg name="keymap_type" type="uint" enum="keymap_type" summary="the keymap type"/>
<arg name="size" type="uint" summary="the keymap size in bytes"/>
<arg name="keymap_type" type="uint32" enum="keymap_type" summary="the keymap type"/>
<arg name="size" type="uint32" summary="the keymap size in bytes"/>
<arg name="keymap" type="fd" summary="file descriptor to the keymap"/>
</event>
@ -1309,8 +1309,8 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="key" type="uint"/>
<arg name="state" type="uint" enum="key_state"/>
<arg name="key" type="uint32"/>
<arg name="state" type="uint32" enum="key_state"/>
</event>
<event name="modifiers" since="1">
@ -1329,11 +1329,11 @@
This event is only sent for devices with an ei_device.keymap.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="depressed" type="uint" summary="depressed modifiers"/>
<arg name="locked" type="uint" summary="locked modifiers"/>
<arg name="latched" type="uint" summary="latched modifiers"/>
<arg name="group" type="uint" summary="the keyboard group (layout)"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
<arg name="depressed" type="uint32" summary="depressed modifiers"/>
<arg name="locked" type="uint32" summary="locked modifiers"/>
<arg name="latched" type="uint32" summary="latched modifiers"/>
<arg name="group" type="uint32" summary="the keyboard group (layout)"/>
</event>
</interface>
@ -1370,7 +1370,7 @@
The x/y coordinates must be within the device's regions or the event and future
ei_touchscreen.motion events with the same touchid are silently discarded.
</description>
<arg name="touchid" type="uint" summary="a unique touch id to identify this touch"/>
<arg name="touchid" type="uint32" summary="a unique touch id to identify this touch"/>
<arg name="x" type="float" summary="touch x coordinate in logical pixels"/>
<arg name="y" type="float" summary="touch y coordinate in logical pixels"/>
</request>
@ -1384,7 +1384,7 @@
The x/y coordinates must be within the device's regions or the event is
silently discarded.
</description>
<arg name="touchid" type="uint" summary="a unique touch id to identify this touch"/>
<arg name="touchid" type="uint32" summary="a unique touch id to identify this touch"/>
<arg name="x" type="float" summary="touch x coordinate in logical pixels"/>
<arg name="y" type="float" summary="touch y coordinate in logical pixels"/>
</request>
@ -1397,7 +1397,7 @@
The touchid may be re-used after this request.
</description>
<arg name="touchid" type="uint" summary="a unique touch id to identify this touch"/>
<arg name="touchid" type="uint32" summary="a unique touch id to identify this touch"/>
</request>
<!-- ei_touchscreen events version 1 -->
@ -1411,7 +1411,7 @@
after this event is sent and as such the client must not attempt to use
it after that point.
</description>
<arg name="serial" type="uint" summary="this event's serial number"/>
<arg name="serial" type="uint32" summary="this event's serial number"/>
</event>
<event name="down" since="1">
@ -1421,7 +1421,7 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="touchid" type="uint"/>
<arg name="touchid" type="uint32"/>
<arg name="x" type="float"/>
<arg name="y" type="float"/>
</event>
@ -1433,7 +1433,7 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="touchid" type="uint"/>
<arg name="touchid" type="uint32"/>
<arg name="x" type="float"/>
<arg name="y" type="float"/>
</event>
@ -1445,7 +1445,7 @@
It is a protocol violation to send this request for a client
of an ei_connection_setup.context_type other than receiver.
</description>
<arg name="touchid" type="uint"/>
<arg name="touchid" type="uint32"/>
</event>
</interface>
</protocol>