diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-10-14 16:27:42 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-10-14 16:27:42 +0200 |
commit | 7d3a3a317351d0f63f01a134f450bb81ba67fff7 (patch) | |
tree | 1c6c92b55e82e1c36bb2750549fc5a86402a2643 /techlibs/common/cellhelp.py | |
parent | 3c315721525d40c14b4a29daf9983be474374908 (diff) |
Added first help messages for cell types
Diffstat (limited to 'techlibs/common/cellhelp.py')
-rw-r--r-- | techlibs/common/cellhelp.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/techlibs/common/cellhelp.py b/techlibs/common/cellhelp.py new file mode 100644 index 00000000..7844ccb4 --- /dev/null +++ b/techlibs/common/cellhelp.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import fileinput +import json + +current_help_msg = [] +current_module_code = [] +current_module_name = None + +def print_current_cell(): + print("cell_help[\"%s\"] = %s;" % (current_module_name, "\n".join([json.dumps(line) for line in current_help_msg]))) + print("cell_code[\"%s+\"] = %s;" % (current_module_name, "\n".join([json.dumps(line) for line in current_module_code]))) + +for line in fileinput.input(): + if line.startswith("//-"): + current_help_msg.append(line[4:] if len(line) > 4 else "\n") + if line.startswith("module "): + current_module_name = line.split()[1].strip("\\") + current_module_code = [] + current_module_code.append(line) + if line.startswith("endmodule"): + if len(current_help_msg) > 0: + print_current_cell() + current_help_msg = [] + |