From d038dbf4aa42781a3962326eb49235b04a95f416 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Sat, 30 Jul 2016 11:43:14 -0700 Subject: Addition of u16[] to JVPP generator Change-Id: I8d746cfae4d64ae200ff0053de23b80ee951c290 Signed-off-by: Keith Burns (alagalah) --- vpp-api/java/jvpp/gen/jvpp_c_gen.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'vpp-api/java/jvpp') 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 -- cgit 1.2.3-korg