diff --git a/.gitignore b/.gitignore index 4c085e0..23a2f44 100644 --- a/.gitignore +++ b/.gitignore @@ -28,9 +28,13 @@ venv/ .DS_store # examples -examples/ext/synth_shed/synth_shed/gen/py_module.pybind11 -examples/ext/synth_shed/synth_shed/gen/py_module.yml2 -examples/lib/lib_synth_shed/synth_shed -examples/lib/lib_synth_shed/libsynth_shed.a -examples/lib/lib_test/lib_test +/examples/ext/synth_shed/synth_shed/gen/py_module.pybind11 +/examples/ext/synth_shed/synth_shed/gen/py_module.yml2 +/examples/ext/synth_shed/synth_shed/gen/synth_shed.h.ast.json +/examples/ext/synth_shed/synth_shed/gen/synth_shed.h.acid.json +/examples/ext/synth_shed/synth_shed/gen/synth_shed.h.acid.yml + +/examples/lib/lib_synth_shed/synth_shed +/examples/lib/lib_synth_shed/libsynth_shed.a +/examples/lib/lib_test/lib_test diff --git a/examples/ext/synth_shed/synth_shed/gen/config.json b/examples/ext/synth_shed/synth_shed/gen/config.json index 155ae77..29acd50 100644 --- a/examples/ext/synth_shed/synth_shed/gen/config.json +++ b/examples/ext/synth_shed/synth_shed/gen/config.json @@ -12,5 +12,8 @@ "update_identity", "filtertype_to_string", "play_synth" - ] + ], + "debug_ast" : "True", + "debug_acid" : "True", + "debug_yml" : "True" } diff --git a/pEpACIDgen/__main__.py b/pEpACIDgen/__main__.py index 4dc5170..0533882 100644 --- a/pEpACIDgen/__main__.py +++ b/pEpACIDgen/__main__.py @@ -35,12 +35,55 @@ def gen(): exit(-1) - pymodule_name = data["module_name"] - libclang_path = data["libclang_path"] + pymodule_name = "" + libclang_path = "" + header_filename = "" + vars = [] + funcs = [] + debug_ast = False + debug_acid = False + debug_yml = False + + try: + pymodule_name = data['module_name'] + except: + print('config-warning: "module_name" not specified') + + try: + libclang_path = data['libclang_path'] + except: + print('config-warning: "libclang_path" not specified') + + try: + header_filename = data['header_filename'] + except: + print('config-warning: "header_filename" not speficied') + + try: + vars = data['variables'] + except: + print('config-info no variables specified') + + try: + funcs = data['functions'] + except: + print('config-info: no functions specified') + + try: + debug_ast = bool(data['debug_ast']) + except: + print('config-info: to debug the ast, set "debug_ast" : "True"') + + try: + debug_acid = bool(data['debug_acid']) + except: + print('config-info: to debug the ACID, set "debug_acid" : "True"') + + try: + debug_yml = bool(data['debug_yml']) + except: + print('config-info: to debug the ast-yml, set "debug_yml" : "True"') - header_filename = data["header_filename"] - vars = data["variables"] - funcs = data["functions"] print_indent("CONFIG:") @@ -56,9 +99,13 @@ def gen(): for func in funcs: print_indent(func, indent=2) + print_indent("debug_ast:", debug_ast, indent=1) + print_indent("debug_acid:", debug_acid, indent=1) + print_indent("debug_yml:", debug_yml, indent=1) + - acidgen = pEpACIDgen.pEpACIDGen(libclang_path, header_filename, pymodule_name) - header = acidgen.extract(vars, funcs, debug_ast=False, debug_acid=False, debug_yml=False) + acidgen = pEpACIDgen.pEpACIDGen(libclang_path, header_filename, pymodule_name, out_dir=os.getcwd()) + header = acidgen.extract(vars, funcs, debug_ast=debug_ast, debug_acid=debug_acid, debug_yml=debug_yml) print_indent("OUTPUT:") print_indent(header["acid_yml"])