diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-06-30 14:04:03 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-06-30 16:59:21 +0100 |
commit | ab2e608239d0518241454bd7cb6abe3f680764c1 (patch) | |
tree | 950be0f34dffe5e3962c6f850e54bd770459fd21 /src/tests/eolian/data | |
parent | ff7a5e4f1b1286b1226fb0a9a1729759d1f72e18 (diff) |
eolian: add support for static and terminated arrays
Adds two new type types, STATIC_ARRAY and TERMINATED_ARRAY. Static arrays are
only allowed as struct members right now - they translate to regular C static
arrays (allowing them elsewhere wouldn't be good, as C isn't very good at
working with the size information). Terminated arrays are basically sequences
of data terminated at the end. The base type of static arrays can be any type
that is not marked ref (explicit ref may get allowed later). The base type of
terminated arrays has the same restriction plus that it has to be either
implicitly reference type (i.e. translating to pointer in C), integer type
or a character. In case of ref types, the terminator is NULL. In case of
integer types, the terminator is a zero. In case of character types, the
terminator is also a zero (null terminator like C strings).
@feature
Diffstat (limited to 'src/tests/eolian/data')
-rw-r--r-- | src/tests/eolian/data/struct.eo | 2 | ||||
-rw-r--r-- | src/tests/eolian/data/struct_ref.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/tests/eolian/data/struct.eo b/src/tests/eolian/data/struct.eo index 077e499..81429b9 100644 --- a/src/tests/eolian/data/struct.eo +++ b/src/tests/eolian/data/struct.eo | |||
@@ -1,6 +1,8 @@ | |||
1 | struct Named { | 1 | struct Named { |
2 | field: ref(int); | 2 | field: ref(int); |
3 | something: string; | 3 | something: string; |
4 | arr: static_array<int, 16>; | ||
5 | tarr: terminated_array<string>; | ||
4 | } | 6 | } |
5 | 7 | ||
6 | struct Another { | 8 | struct Another { |
diff --git a/src/tests/eolian/data/struct_ref.c b/src/tests/eolian/data/struct_ref.c index 1fbec77..dd9c64e 100644 --- a/src/tests/eolian/data/struct_ref.c +++ b/src/tests/eolian/data/struct_ref.c | |||
@@ -15,6 +15,8 @@ typedef struct _Named | |||
15 | { | 15 | { |
16 | int *field; | 16 | int *field; |
17 | const char *something; | 17 | const char *something; |
18 | int arr[16]; | ||
19 | const char **tarr; | ||
18 | } Named; | 20 | } Named; |
19 | 21 | ||
20 | typedef struct _Another | 22 | typedef struct _Another |