451 lines
9.4 KiB
YAML
451 lines
9.4 KiB
YAML
|
|
---
|
||
|
|
name: param string
|
||
|
|
desc:
|
||
|
|
params:
|
||
|
|
dir:
|
||
|
|
- "in"
|
||
|
|
- "out"
|
||
|
|
- "inout"
|
||
|
|
idl: |
|
||
|
|
interface foo {
|
||
|
|
bar({dir} string a @nullable @max_length(8)) -> void
|
||
|
|
}
|
||
|
|
test_client.cpp:
|
||
|
|
- re: void foo_client::bar\(\w*\s*char \* a\)
|
||
|
|
- if (a == NULL)
|
||
|
|
- codec->writeNullFlag(true)
|
||
|
|
- if: dir in ('in', 'inout')
|
||
|
|
then:
|
||
|
|
- uint32_t a_len = strlen((const char*)a);
|
||
|
|
- codec->writeString(a_len, (const char*)a);
|
||
|
|
- if: dir == 'out'
|
||
|
|
then:
|
||
|
|
- not: codec->writeString(a_len, (const char*)a);
|
||
|
|
- not: codec->writeString(strlen((const char*)a), (const char*)a);
|
||
|
|
- if: dir in ('out', 'inout')
|
||
|
|
then:
|
||
|
|
- if (a != NULL)
|
||
|
|
- codec->readString(a_len, &a_local);
|
||
|
|
test_server.cpp:
|
||
|
|
- ::bar_shim
|
||
|
|
- char * a = NULL;
|
||
|
|
- bool isNull;
|
||
|
|
- codec->readNullFlag(isNull)
|
||
|
|
- if (!isNull)
|
||
|
|
- if: dir in ('in', 'inout')
|
||
|
|
then:
|
||
|
|
- codec->readString(a_len, &a_local)
|
||
|
|
- if: dir == 'out'
|
||
|
|
then:
|
||
|
|
- not: codec->readString(a_len, &a_local)
|
||
|
|
- else
|
||
|
|
- a = NULL;
|
||
|
|
- if: dir in ('out', 'inout')
|
||
|
|
then:
|
||
|
|
- if (a != NULL)
|
||
|
|
- uint32_t a_len = strlen((const char*)a);
|
||
|
|
- codec->writeString(a_len, (const char*)a);
|
||
|
|
---
|
||
|
|
name: param ustring
|
||
|
|
desc:
|
||
|
|
params:
|
||
|
|
dir:
|
||
|
|
- "in"
|
||
|
|
- "out"
|
||
|
|
- "inout"
|
||
|
|
idl: |
|
||
|
|
interface foo {
|
||
|
|
bar({dir} ustring a @nullable @max_length(8)) -> void
|
||
|
|
}
|
||
|
|
test_client.cpp:
|
||
|
|
- re: void foo_client::bar\(\w*\s*unsigned\s*char\s*\* a\)
|
||
|
|
- if (a == NULL)
|
||
|
|
- codec->writeNullFlag(true)
|
||
|
|
- if: dir in ('in', 'inout')
|
||
|
|
then:
|
||
|
|
- uint32_t a_len = strlen((const char*)a);
|
||
|
|
- codec->writeString(a_len, (const char*)a);
|
||
|
|
- if: dir == 'out'
|
||
|
|
then:
|
||
|
|
- not: codec->writeString(a_len, (const char*)a);
|
||
|
|
- not: codec->writeString(strlen((const char*)a), (const char*)a);
|
||
|
|
- if: dir in ('out', 'inout')
|
||
|
|
then:
|
||
|
|
- if (a != NULL)
|
||
|
|
- codec->readString(a_len, &a_local);
|
||
|
|
test_server.cpp:
|
||
|
|
- ::bar_shim
|
||
|
|
- unsigned char* a = NULL;
|
||
|
|
- bool isNull;
|
||
|
|
- codec->readNullFlag(isNull)
|
||
|
|
- if (!isNull)
|
||
|
|
- if: dir in ('in', 'inout')
|
||
|
|
then:
|
||
|
|
- codec->readString(a_len, &a_local)
|
||
|
|
- if: dir == 'out'
|
||
|
|
then:
|
||
|
|
- not: codec->readString(a_len, &a_local)
|
||
|
|
- else
|
||
|
|
- a = NULL;
|
||
|
|
- if: dir in ('out', 'inout')
|
||
|
|
then:
|
||
|
|
- if (a != NULL)
|
||
|
|
- uint32_t a_len = strlen((const char*)a);
|
||
|
|
- codec->writeString(a_len, (const char*)a);
|
||
|
|
---
|
||
|
|
name: in param struct
|
||
|
|
desc:
|
||
|
|
params:
|
||
|
|
type:
|
||
|
|
- [bool, bool]
|
||
|
|
- [int8, int8_t]
|
||
|
|
- [int16, int16_t]
|
||
|
|
- [int32, int32_t]
|
||
|
|
- [uint8, uint8_t]
|
||
|
|
- [uint16, uint16_t]
|
||
|
|
- [uint32, uint32_t]
|
||
|
|
- [float, float]
|
||
|
|
- [double, double]
|
||
|
|
idl: |
|
||
|
|
struct Vector {
|
||
|
|
{type[0]}[3] v
|
||
|
|
}
|
||
|
|
interface foo {
|
||
|
|
bar(Vector v @nullable) -> void
|
||
|
|
}
|
||
|
|
test_common.h:
|
||
|
|
- '{type[1]} v[3]'
|
||
|
|
c_test_client.h:
|
||
|
|
- void bar(const Vector * v);
|
||
|
|
test_client.cpp:
|
||
|
|
- re: void foo_client::bar\(const Vector \* v\)
|
||
|
|
- if (v == NULL)
|
||
|
|
- writeNullFlag(true)
|
||
|
|
- "{"
|
||
|
|
- writeNullFlag(false)
|
||
|
|
- write_Vector_struct
|
||
|
|
- "}"
|
||
|
|
test_server.cpp:
|
||
|
|
- ::bar_shim
|
||
|
|
- bool isNull
|
||
|
|
- readNullFlag
|
||
|
|
- if (!isNull)
|
||
|
|
- read_Vector_struct
|
||
|
|
- else
|
||
|
|
- v = NULL
|
||
|
|
|
||
|
|
---
|
||
|
|
name: struct list field
|
||
|
|
desc:
|
||
|
|
idl: |
|
||
|
|
struct erpc_pair {
|
||
|
|
string a
|
||
|
|
list<bool> b @nullable
|
||
|
|
}
|
||
|
|
interface foo {
|
||
|
|
bar(erpc_pair s) -> void
|
||
|
|
}
|
||
|
|
test_client.cpp:
|
||
|
|
- void write_erpc_pair_struct
|
||
|
|
- if (data->b.elements == NULL)
|
||
|
|
- writeNullFlag(true)
|
||
|
|
- '{'
|
||
|
|
- writeNullFlag(false)
|
||
|
|
- write_list_bool_1_t_struct
|
||
|
|
- '}'
|
||
|
|
- void foo_client::bar(const erpc_pair * s)
|
||
|
|
- write_erpc_pair_struct
|
||
|
|
test_server.cpp:
|
||
|
|
- void read_erpc_pair_struct
|
||
|
|
- bool isNull
|
||
|
|
- readNullFlag
|
||
|
|
- if (!isNull)
|
||
|
|
- read_list_bool_1_t_struct
|
||
|
|
- else
|
||
|
|
- data->b.elements = NULL
|
||
|
|
- data->b.elementsCount = 0
|
||
|
|
|
||
|
|
---
|
||
|
|
name: struct binary field
|
||
|
|
desc:
|
||
|
|
idl: |
|
||
|
|
struct erpc_pair {
|
||
|
|
binary b @nullable
|
||
|
|
}
|
||
|
|
interface foo {
|
||
|
|
bar(erpc_pair s) -> void
|
||
|
|
}
|
||
|
|
test_client.cpp:
|
||
|
|
- void write_erpc_pair_struct
|
||
|
|
- if (data->b.data == NULL)
|
||
|
|
- writeNullFlag(true)
|
||
|
|
- '{'
|
||
|
|
- writeNullFlag(false)
|
||
|
|
- write_binary_t_struct
|
||
|
|
- '}'
|
||
|
|
- void foo_client::bar(const erpc_pair * s)
|
||
|
|
- write_erpc_pair_struct
|
||
|
|
test_server.cpp:
|
||
|
|
- void read_erpc_pair_struct
|
||
|
|
- bool isNull
|
||
|
|
- readNullFlag
|
||
|
|
- if (!isNull)
|
||
|
|
- read_binary_t_struct
|
||
|
|
- else
|
||
|
|
- data->b.data = NULL
|
||
|
|
- data->b.dataLength = 0
|
||
|
|
|
||
|
|
---
|
||
|
|
name: struct string field
|
||
|
|
desc:
|
||
|
|
params:
|
||
|
|
dir:
|
||
|
|
- "in"
|
||
|
|
- "out"
|
||
|
|
- "inout"
|
||
|
|
idl: |
|
||
|
|
struct erpc_pair {
|
||
|
|
string a @nullable
|
||
|
|
}
|
||
|
|
|
||
|
|
interface foo {
|
||
|
|
bar({dir} erpc_pair s) -> void
|
||
|
|
}
|
||
|
|
test_client.cpp:
|
||
|
|
- if: dir in ('in', 'inout')
|
||
|
|
then:
|
||
|
|
- void write_erpc_pair_struct
|
||
|
|
- if (data->a == NULL)
|
||
|
|
- codec->writeNullFlag(true);
|
||
|
|
- else
|
||
|
|
- codec->writeNullFlag(false);
|
||
|
|
- uint32_t a_len = strlen((const char*)data->a);
|
||
|
|
- codec->writeString(a_len, (const char*)data->a);
|
||
|
|
- if: dir in ('out', 'inout')
|
||
|
|
then:
|
||
|
|
- void read_erpc_pair_struct
|
||
|
|
- bool isNull;
|
||
|
|
- codec->readNullFlag(isNull);
|
||
|
|
- if (!isNull)
|
||
|
|
- codec->readString(a_len, &a_local);
|
||
|
|
- else
|
||
|
|
- data->a = NULL;
|
||
|
|
- data->a = 0;
|
||
|
|
test_server.cpp:
|
||
|
|
- if: dir in ('in', 'inout')
|
||
|
|
then:
|
||
|
|
- void read_erpc_pair_struct
|
||
|
|
- bool isNull;
|
||
|
|
- codec->readNullFlag(isNull);
|
||
|
|
- if (!isNull)
|
||
|
|
- codec->readString(a_len, &a_local);
|
||
|
|
- else
|
||
|
|
- data->a = NULL;
|
||
|
|
- data->a = 0;
|
||
|
|
- if: dir in ('out', 'inout')
|
||
|
|
then:
|
||
|
|
- void write_erpc_pair_struct
|
||
|
|
- if (data->a == NULL)
|
||
|
|
- codec->writeNullFlag(true);
|
||
|
|
- else
|
||
|
|
- codec->writeNullFlag(false);
|
||
|
|
- uint32_t a_len = strlen((const char*)data->a);
|
||
|
|
- codec->writeString(a_len, (const char*)data->a);
|
||
|
|
|
||
|
|
---
|
||
|
|
name: return struct
|
||
|
|
desc:
|
||
|
|
idl: |
|
||
|
|
struct erpc_pair {
|
||
|
|
string a
|
||
|
|
}
|
||
|
|
|
||
|
|
interface foo {
|
||
|
|
bar() -> @nullable erpc_pair
|
||
|
|
}
|
||
|
|
|
||
|
|
test_client.cpp:
|
||
|
|
- erpc_pair * result = NULL;
|
||
|
|
- bool isNull;
|
||
|
|
- codec->readNullFlag(isNull);
|
||
|
|
- if (!isNull)
|
||
|
|
|
||
|
|
test_server.cpp:
|
||
|
|
- if (result == NULL)
|
||
|
|
- codec->writeNullFlag(true);
|
||
|
|
- codec->writeNullFlag(false);
|
||
|
|
|
||
|
|
---
|
||
|
|
name: inout scalar type
|
||
|
|
desc:
|
||
|
|
idl: |
|
||
|
|
|
||
|
|
interface foo {
|
||
|
|
bar(inout uint32 param1 @nullable, out uint32 param2 @nullable) -> void
|
||
|
|
}
|
||
|
|
|
||
|
|
test_client.cpp:
|
||
|
|
- not: _var
|
||
|
|
- not: _listLen
|
||
|
|
|
||
|
|
- if (param1 == NULL)
|
||
|
|
- codec->writeNullFlag
|
||
|
|
- codec->write(*param1);
|
||
|
|
- if (param2 == NULL)
|
||
|
|
- codec->writeNullFlag
|
||
|
|
- not: codec->write(*param2);
|
||
|
|
- if (param1 != NULL)
|
||
|
|
- codec->read(*param1);
|
||
|
|
- if (param2 != NULL)
|
||
|
|
- codec->read(*param2);
|
||
|
|
|
||
|
|
test_server.cpp:
|
||
|
|
- uint32_t param1;
|
||
|
|
- uint32_t *_param1 = NULL;
|
||
|
|
- uint32_t param2;
|
||
|
|
- uint32_t *_param2 = NULL;
|
||
|
|
- bool isNull;
|
||
|
|
|
||
|
|
- codec->readNullFlag(isNull);
|
||
|
|
- codec->read(param1);
|
||
|
|
- _param1 = ¶m1;
|
||
|
|
- _param1 = NULL;
|
||
|
|
- codec->readNullFlag(isNull);
|
||
|
|
- not: codec->read(
|
||
|
|
- _param2 = ¶m2;
|
||
|
|
- _param2 = NULL;
|
||
|
|
|
||
|
|
- bar(_param1, _param2);
|
||
|
|
|
||
|
|
- if (_param1 != NULL)
|
||
|
|
- codec->write(param1)
|
||
|
|
- if (_param2 != NULL)
|
||
|
|
- codec->write(param2)
|
||
|
|
|
||
|
|
---
|
||
|
|
name: in list param
|
||
|
|
desc: verify in list params with @length
|
||
|
|
params:
|
||
|
|
dir:
|
||
|
|
- "in"
|
||
|
|
- "inout"
|
||
|
|
ann:
|
||
|
|
- ""
|
||
|
|
- "@nullable"
|
||
|
|
idl: |
|
||
|
|
interface foo {
|
||
|
|
bar(list<bool> l @length(c) @nullable, {dir} uint32 c {ann}) -> void
|
||
|
|
}
|
||
|
|
|
||
|
|
test_client.cpp:
|
||
|
|
- if: dir == 'inout'
|
||
|
|
then:
|
||
|
|
- void foo_client::bar(const bool * l, uint32_t * c)
|
||
|
|
else:
|
||
|
|
- void foo_client::bar(const bool * l, uint32_t c)
|
||
|
|
- if: dir == 'inout' and ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if ((l == NULL) || (c == NULL))
|
||
|
|
else:
|
||
|
|
- if (l == NULL)
|
||
|
|
- codec->writeNullFlag
|
||
|
|
- if: dir == 'inout'
|
||
|
|
then:
|
||
|
|
- codec->startWriteList(*c);
|
||
|
|
else:
|
||
|
|
- codec->startWriteList(c);
|
||
|
|
- codec->write(l[listCount0])
|
||
|
|
- if: ann == '@nullable' and dir == 'inout'
|
||
|
|
then:
|
||
|
|
- if (c == NULL)
|
||
|
|
- codec->writeNullFlag
|
||
|
|
- codec->write
|
||
|
|
- if: dir == 'inout'
|
||
|
|
then:
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if (c != NULL)
|
||
|
|
- codec->read
|
||
|
|
else:
|
||
|
|
- not: if (c != NULL)
|
||
|
|
- not: codec->read
|
||
|
|
test_server.cpp:
|
||
|
|
- codec->readNullFlag
|
||
|
|
- uint32_t lengthTemp_0;
|
||
|
|
- codec->startReadList(lengthTemp_0);
|
||
|
|
- c = lengthTemp_0;
|
||
|
|
- codec->read(l[listCount0])
|
||
|
|
- if: ann == '@nullable' and dir == 'inout'
|
||
|
|
then:
|
||
|
|
- codec->readNullFlag
|
||
|
|
- codec->read
|
||
|
|
- if: dir == 'inout'
|
||
|
|
then:
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if (_c != NULL)
|
||
|
|
- codec->write
|
||
|
|
else:
|
||
|
|
- not: if (_c != NULL)
|
||
|
|
- not: codec->write
|
||
|
|
|
||
|
|
---
|
||
|
|
name: out list param
|
||
|
|
desc: verify in list params with @length
|
||
|
|
params:
|
||
|
|
dir:
|
||
|
|
- "out"
|
||
|
|
- "inout"
|
||
|
|
ann:
|
||
|
|
- ""
|
||
|
|
- "@nullable"
|
||
|
|
idl: |
|
||
|
|
interface foo {
|
||
|
|
bar(out list<bool> l @length(c) @nullable @max_length(20), {dir} uint32 c {ann}) -> void
|
||
|
|
}
|
||
|
|
|
||
|
|
test_client.cpp:
|
||
|
|
- void foo_client::bar(bool * l, uint32_t * c)
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if ((l == NULL) || (c == NULL))
|
||
|
|
else:
|
||
|
|
- if (l == NULL)
|
||
|
|
- codec->writeNullFlag
|
||
|
|
- not: codec->startWriteList
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if (c == NULL)
|
||
|
|
- codec->writeNullFlag
|
||
|
|
- if: dir == 'inout'
|
||
|
|
then:
|
||
|
|
- codec->write
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if ((l != NULL) && (c != NULL))
|
||
|
|
else:
|
||
|
|
- if (l != NULL)
|
||
|
|
- codec->startReadList
|
||
|
|
- codec->read(l[listCount0])
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if (c != NULL)
|
||
|
|
- codec->read
|
||
|
|
|
||
|
|
test_server.cpp:
|
||
|
|
- codec->readNullFlag
|
||
|
|
- not: codec->startReadList
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- codec->readNullFlag
|
||
|
|
- if: dir == 'inout'
|
||
|
|
then:
|
||
|
|
- codec->read
|
||
|
|
- if (l != NULL)
|
||
|
|
- codec->startWriteList
|
||
|
|
- codec->write(l[listCount0])
|
||
|
|
- if: ann == '@nullable'
|
||
|
|
then:
|
||
|
|
- if (_c != NULL)
|
||
|
|
- codec->write
|