|
|
@ -149,6 +149,7 @@ def extract_enum_decl(ast, name): |
|
|
|
|
|
|
|
def filter(data): |
|
|
|
if (data["kind"] == "CursorKind.ENUM_DECL" |
|
|
|
and data["is_definition"] == True # no forward decl |
|
|
|
and data["type"] == name |
|
|
|
): |
|
|
|
return True |
|
|
@ -167,6 +168,7 @@ def extract_struct_decl(ast, name): |
|
|
|
|
|
|
|
def filter(data): |
|
|
|
if (data["kind"] == "CursorKind.STRUCT_DECL" |
|
|
|
and data["is_definition"] == True # no forward decl |
|
|
|
and data["type"] == name |
|
|
|
): |
|
|
|
return True |
|
|
@ -236,11 +238,13 @@ def remove_typedefs_of_primitive(types): |
|
|
|
return types_struct_enum |
|
|
|
|
|
|
|
|
|
|
|
def parse(libclang_path, header_filename, function_names, var_names): |
|
|
|
def parse(libclang_path, header_filename, function_names, var_names, debug_ast=False): |
|
|
|
astp = ast_parser.ASTParser(libclang_path) |
|
|
|
# header = create_header("/Users/heck/local-default/include/pEp/pEpEngine.h", out_dir="./") |
|
|
|
header = create_header(header_filename) |
|
|
|
header["ast"] = astp.parse(header["path"], follow_includes=True) |
|
|
|
if debug_ast: |
|
|
|
utils.write_json(header["ast"], header["out_dir"] + "/" + header["filename"] + ".ast.json") |
|
|
|
# CDL |
|
|
|
cid = {"functions": "", |
|
|
|
"vars": "", |
|
|
|