- if io.name == "vpe.api.vapi.h":
- print("%s" % vapi_send_with_control_ping)
- print("")
-
- print("#endif")
- sys.stdout = orig_stdout
-
-
-def gen_json_code(parser, logger, j, io):
- logger.info("Generating code `%s'" % io.name)
- orig_stdout = sys.stdout
- sys.stdout = io
- print("#include <%s>" % json_to_header_name(j))
- print("#include <stdlib.h>")
- print("#include <stddef.h>")
- print("#include <arpa/inet.h>")
- print("#include <vapi_internal.h>")
- print("#include <vapi_dbg.h>")
- print("")
- for t in parser.types_by_json[j].values():
- print("%s" % t.get_swap_to_be_func_def())
- print("")
- print("%s" % t.get_swap_to_host_func_def())
- print("")
- for m in parser.messages_by_json[j].values():
- if m.has_payload():
- print("%s" % m.get_swap_payload_to_be_func_def())
- print("")
- print("%s" % m.get_swap_payload_to_host_func_def())
- print("")
- print("%s" % m.get_calc_msg_size_func_def())
- print("")
- print("%s" % m.get_swap_to_be_func_def())
- print("")
- print("%s" % m.get_swap_to_host_func_def())
- print("")
- for m in parser.messages_by_json[j].values():
- if m.is_reply():
- continue
- print("%s" % m.get_alloc_func_def())
- print("")
- print("%s" % m.get_op_func_def())
- print("")
- print("")
- for m in parser.messages_by_json[j].values():
- print("%s" % m.get_c_constructor())
- print("")
- print("")
- for m in parser.messages_by_json[j].values():
- if not m.is_reply():
- continue
- print("%s;" % m.get_event_cb_func_def())
- print("")
- print("")
- for m in parser.messages_by_json[j].values():
- print("vapi_msg_id_t %s;" % m.get_msg_id_name())
- sys.stdout = orig_stdout