From 078e04d32bb8f45c80cf42f2de50c3c1d8694647 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Sun, 12 May 2024 12:40:33 +0530 Subject: [PATCH] ChatON:P2:meta json to hpp conversion - add k-v pairs skeleton --- scripts/chaton-meta-json-to-hpp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/chaton-meta-json-to-hpp.py b/scripts/chaton-meta-json-to-hpp.py index a1272deb2..a5e68d823 100755 --- a/scripts/chaton-meta-json-to-hpp.py +++ b/scripts/chaton-meta-json-to-hpp.py @@ -5,9 +5,17 @@ import sys import json + +def kv(j, tmpl, k1, k2, comma): + print("\t\t{{ \"{}\", \"{}\" }}{}".format("{}-{}".format(k1,k2), j[tmpl][k1][k2], comma)) + + fp=open(sys.argv[1]) j=json.load(fp) print("{") for tmpl in j: - print("\t{{ \"{}\", ".format(tmpl)) + print("\t{{ \"{}\", {{".format(tmpl)) + kv(j, tmpl, "global", "begin", ",") + kv(j, tmpl, "global", "end", ",") + print("\t}},")