mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
Add support for signed 24.8 decimal numbers
'fixed' is a signed decimal type which offers a sign bit, 23 bits of integer precision, and 8 bits of decimal precision. This is exposed as an opaque struct with conversion helpers to and from double and int on the C API side. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
c49f632dae
commit
c5aba11acc
6 changed files with 81 additions and 3 deletions
|
|
@ -83,6 +83,7 @@ enum arg_type {
|
|||
NEW_ID,
|
||||
INT,
|
||||
UNSIGNED,
|
||||
FIXED,
|
||||
STRING,
|
||||
OBJECT,
|
||||
ARRAY,
|
||||
|
|
@ -334,6 +335,8 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
arg->type = INT;
|
||||
else if (strcmp(type, "uint") == 0)
|
||||
arg->type = UNSIGNED;
|
||||
else if (strcmp(type, "fixed") == 0)
|
||||
arg->type = FIXED;
|
||||
else if (strcmp(type, "string") == 0)
|
||||
arg->type = STRING;
|
||||
else if (strcmp(type, "array") == 0)
|
||||
|
|
@ -484,6 +487,9 @@ emit_type(struct arg *a)
|
|||
case UNSIGNED:
|
||||
printf("uint32_t ");
|
||||
break;
|
||||
case FIXED:
|
||||
printf("wl_fixed_t ");
|
||||
break;
|
||||
case STRING:
|
||||
printf("const char *");
|
||||
break;
|
||||
|
|
@ -972,6 +978,9 @@ emit_messages(struct wl_list *message_list,
|
|||
case UNSIGNED:
|
||||
printf("u");
|
||||
break;
|
||||
case FIXED:
|
||||
printf("f");
|
||||
break;
|
||||
case STRING:
|
||||
printf("s");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue