diff options
author | Stanislav Zaikin <zstaseg@gmail.com> | 2022-07-21 19:06:26 +0200 |
---|---|---|
committer | Stanislav Zaikin <zstaseg@gmail.com> | 2023-01-23 21:01:06 +0100 |
commit | 139b2da5c533a84faca0ae1bf5b37c3185d9d4fb (patch) | |
tree | 872b69e16be5cd683aea0555fe157a8024644102 /src/tools/vppapigen/vppapigen_c.py | |
parent | 3b5ab65bd3a821dd82acfc34069293ff39dc1ef7 (diff) |
vppapigen: enable codegen for stream message types
Enable codegen for C type from 'rpc A returns B stream C' notation
Type: improvement
Change-Id: I05cfce71c385d414d7b177a080009628bc8c8fad
Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com>
Diffstat (limited to 'src/tools/vppapigen/vppapigen_c.py')
-rwxr-xr-x[-rw-r--r--] | src/tools/vppapigen/vppapigen_c.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py index 5ca2ed51ff6..26a348f3910 100644..100755 --- a/src/tools/vppapigen/vppapigen_c.py +++ b/src/tools/vppapigen/vppapigen_c.py @@ -1250,6 +1250,11 @@ static inline void vl_api_{name}_t_endian (vl_api_{name}_t *a) output += signature.format(name=t.name) + # make Array type appear before the others: + # some arrays have dynamic length, and we want to iterate over + # them before changing endiann for the length field + t.block.sort(key=lambda x: x.type) + for o in t.block: output += endianfun_obj(o) output += "}\n\n" @@ -1576,6 +1581,31 @@ def generate_c_boilerplate(services, defines, counters, file_crc, module, stream except KeyError: pass + try: + if s.stream: + d = define_hash[s.stream_message] + write( + " c = (vl_msg_api_msg_config_t) " + "{{.id = VL_API_{ID} + msg_id_base,\n" + ' .name = "{n}",\n' + " .handler = 0,\n" + " .endian = vl_api_{n}_t_endian,\n" + " .format_fn = vl_api_{n}_t_format,\n" + " .traced = 1,\n" + " .replay = 1,\n" + " .tojson = vl_api_{n}_t_tojson,\n" + " .fromjson = vl_api_{n}_t_fromjson,\n" + " .calc_size = vl_api_{n}_t_calc_size,\n" + " .is_autoendian = {auto}}};\n".format( + n=s.stream_message, + ID=s.stream_message.upper(), + auto=d.autoendian, + ) + ) + write(" vl_msg_api_config (&c);\n") + except KeyError: + pass + write(" return msg_id_base;\n") write("}\n") |