Change-Id: I20cfbae8b704ca68fd8dda9c811dc282ce723871
Signed-off-by: Klement Sekera <ksekera@cisco.com>
-def emit_definition(parser, json_file, emitted, o, logger):
+def emit_definition(parser, json_file, emitted, o):
- logger.debug("emit definition for %s" % o)
if o.name in ("msg_header1_t", "msg_header2_t"):
return
if hasattr(o, "depends"):
for x in o.depends:
if o.name in ("msg_header1_t", "msg_header2_t"):
return
if hasattr(o, "depends"):
for x in o.depends:
- emit_definition(parser, json_file, emitted, x, logger)
+ emit_definition(parser, json_file, emitted, x)
- emit_definition(parser, json_file, emitted, o.reply, logger)
+ emit_definition(parser, json_file, emitted, o.reply)
if hasattr(o, "get_c_def"):
if (o not in parser.enums_by_json[json_file] and
o not in parser.types_by_json[json_file] and
o not in parser.unions_by_json[json_file] and
o.name not in parser.messages_by_json[json_file]):
return
if hasattr(o, "get_c_def"):
if (o not in parser.enums_by_json[json_file] and
o not in parser.types_by_json[json_file] and
o not in parser.unions_by_json[json_file] and
o.name not in parser.messages_by_json[json_file]):
return
- logger.debug("writing def")
guard = "defined_%s" % o.get_c_name()
print("#ifndef %s" % guard)
print("#define %s" % guard)
guard = "defined_%s" % o.get_c_name()
print("#ifndef %s" % guard)
print("#define %s" % guard)
print("")
function_attrs = "static inline "
if o.name in parser.messages_by_json[json_file]:
print("")
function_attrs = "static inline "
if o.name in parser.messages_by_json[json_file]:
- logger.debug("o is %s" % o.name)
- logger.debug("o has payload ")
print("%s%s" % (function_attrs,
o.get_swap_payload_to_be_func_def()))
print("")
print("%s%s" % (function_attrs,
o.get_swap_payload_to_be_func_def()))
print("")
print("")
print("%s" % o.get_c_constructor())
print("")
print("")
print("%s" % o.get_c_constructor())
print("")
- if o.is_reply and not o.is_event:
+ if o.is_reply or o.is_event:
print("%s%s;" % (function_attrs, o.get_event_cb_func_def()))
print("")
elif hasattr(o, "get_swap_to_be_func_def"):
print("%s%s;" % (function_attrs, o.get_event_cb_func_def()))
print("")
elif hasattr(o, "get_swap_to_be_func_def"):
print("")
emitted = []
for e in parser.enums_by_json[j]:
print("")
emitted = []
for e in parser.enums_by_json[j]:
- emit_definition(parser, j, emitted, e, logger)
+ emit_definition(parser, j, emitted, e)
for u in parser.unions_by_json[j]:
for u in parser.unions_by_json[j]:
- emit_definition(parser, j, emitted, u, logger)
+ emit_definition(parser, j, emitted, u)
for t in parser.types_by_json[j]:
for t in parser.types_by_json[j]:
- emit_definition(parser, j, emitted, t, logger)
+ emit_definition(parser, j, emitted, t)
for m in parser.messages_by_json[j].values():
for m in parser.messages_by_json[j].values():
- emit_definition(parser, j, emitted, m, logger)
+ emit_definition(parser, j, emitted, m)
+ "services": {
+ "test_fake_msg": {
+ "reply":"test_fake_msg_reply"
+ },
+ "test_fake_dump": {
+ "reply":"test_fake_details",
+ "stream":"true"
+ }
+ },
+ "enums" : [
+ ],
+ "unions" : [
+ ],
],
"messages" : [
["test_fake_msg",
],
"messages" : [
["test_fake_msg",