in scripts/gen_wrappers.py [0:0]
def get_full_struct_dict(processed_src, array_shapes):
# ===== Parse and extract structs =====
ast = pycparser.c_parser.CParser().parse(processed_src)
struct_dict = OrderedDict()
for node in ast.children():
assert (node[1].name is None) == isinstance(
node[1].type, pycparser.c_ast.Struct)
if isinstance(node[1].type, pycparser.c_ast.Struct):
(_, struct), = node[1].children()
assert struct.name.startswith('_mj')
struct_name = struct.name[1:] # take out leading underscore
assert struct_name not in struct_dict
struct_dict = struct_dict.copy()
struct_dict.update(get_struct_dict(struct, struct_name, array_shapes))
assert isinstance(struct_dict, OrderedDict), 'Must be deterministic'
return struct_dict