interface: add api test file
[vpp.git] / src / vpp-api / vapi / vapi_c_gen.py
index 1fae5b3..1a5665e 100755 (executable)
@@ -19,13 +19,13 @@ class CField(Field):
             else:
                 return "vl_api_string_t %s;" % (self.name)
         else:
-            if self.len is not None:
+            if self.len is not None and type(self.len) != dict:
                 return "%s %s[%d];" % (self.type.get_c_name(), self.name, self.len)
             else:
                 return "%s %s;" % (self.type.get_c_name(), self.name)
 
     def get_swap_to_be_code(self, struct, var):
-        if self.len is not None:
+        if self.len is not None and type(self.len) != dict:
             if self.len > 0:
                 return "do { unsigned i; for (i = 0; i < %d; ++i) { %s } }"\
                     " while(0);" % (
@@ -46,7 +46,7 @@ class CField(Field):
         return self.type.get_swap_to_be_code(struct, "%s" % var)
 
     def get_swap_to_host_code(self, struct, var):
-        if self.len is not None:
+        if self.len is not None and type(self.len) != dict:
             if self.len > 0:
                 return "do { unsigned i; for (i = 0; i < %d; ++i) { %s } }"\
                     " while(0);" % (
@@ -705,12 +705,12 @@ def gen_json_unified_header(parser, logger, j, io, name):
     print("#ifdef __cplusplus")
     print("extern \"C\" {")
     print("#endif")
-    if name == "vpe.api.vapi.h":
+    if name == "memclnt.api.vapi.h":
         print("")
         print("static inline vapi_error_e vapi_send_with_control_ping "
               "(vapi_ctx_t ctx, void * msg, u32 context);")
     else:
-        print("#include <vapi/vpe.api.vapi.h>")
+        print("#include <vapi/vlib.api.vapi.h>")
     print("")
     for m in parser.messages_by_json[j].values():
         print("extern vapi_msg_id_t %s;" % m.get_msg_id_name())
@@ -737,7 +737,7 @@ def gen_json_unified_header(parser, logger, j, io, name):
 
     print("")
 
-    if name == "vpe.api.vapi.h":
+    if name == "vlib.api.vapi.h":
         print("%s" % vapi_send_with_control_ping)
         print("")