diff options
author | Keith Burns (alagalah) <alagalah@gmail.com> | 2016-07-30 11:43:14 -0700 |
---|---|---|
committer | Keith Burns (alagalah) <alagalah@gmail.com> | 2016-07-30 11:43:14 -0700 |
commit | d038dbf4aa42781a3962326eb49235b04a95f416 (patch) | |
tree | 0b6f7e2ae9272520afb1331ddbeaaac0128a4ad1 | |
parent | a4525d5d8f1a054bb7cb49832a03c03d651d7ab7 (diff) |
Addition of u16[] to JVPP generator
Change-Id: I8d746cfae4d64ae200ff0053de23b80ee951c290
Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
-rw-r--r-- | vpp-api/java/jvpp/gen/jvpp_c_gen.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_c_gen.py b/vpp-api/java/jvpp/gen/jvpp_c_gen.py index c1169863..592c362a 100644 --- a/vpp-api/java/jvpp/gen/jvpp_c_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_c_gen.py @@ -129,6 +129,20 @@ u32_array_struct_setter_template = Template(""" (*env)->ReleaseIntArrayElements (env, ${java_name}, ${java_name}ArrayElements, 0); """) +u16_array_struct_setter_template = Template(""" + jint * ${java_name}ArrayElements = (*env)->GetIntArrayElements(env, ${java_name}, NULL); + { + size_t _i; + jsize cnt = (*env)->GetArrayLength (env, ${java_name}); + size_t max_size = ${field_length}; + if (max_size != 0 && cnt > max_size) cnt = max_size; + for (_i = 0; _i < cnt; _i++) { + mp->${c_name}[_i] = clib_host_to_net_u16(${java_name}ArrayElements[_i]); + } + } + (*env)->ReleaseIntArrayElements (env, ${java_name}, ${java_name}ArrayElements, 0); + """) + vl_api_ip4_fib_counter_t_array_struct_setter_template = Template(""" // vl_api_ip4_fib_counter_t_array_field_setter_template FIXME""") @@ -141,6 +155,7 @@ struct_setter_templates = {'u8': u8_struct_setter_template, 'i32': u32_struct_setter_template, 'u64': u64_struct_setter_template, 'u8[]': u8_array_struct_setter_template, + 'u16[]': u16_array_struct_setter_template, 'u32[]': u32_array_struct_setter_template, 'vl_api_ip4_fib_counter_t[]': vl_api_ip4_fib_counter_t_array_struct_setter_template, 'vl_api_ip6_fib_counter_t[]': vl_api_ip6_fib_counter_t_array_struct_setter_template |