diff options
Diffstat (limited to 'grc/python')
-rw-r--r-- | grc/python/FlowGraph.py | 1 | ||||
-rw-r--r-- | grc/python/block.dtd | 3 | ||||
-rw-r--r-- | grc/python/convert_hier.py | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py index 89a169355..efe362760 100644 --- a/grc/python/FlowGraph.py +++ b/grc/python/FlowGraph.py @@ -64,6 +64,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph): 'type': str(pad.get_param('type').get_evaluated()), 'vlen': str(pad.get_param('vlen').get_evaluated()), 'size': pad.get_param('type').get_opt('size'), + 'optional': bool(pad.get_param('optional').get_evaluated()), } for pad in sorted_pads] def get_pad_sources(self): diff --git a/grc/python/block.dtd b/grc/python/block.dtd index 41a744d07..292ea06cb 100644 --- a/grc/python/block.dtd +++ b/grc/python/block.dtd @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Top level element. A block contains a name, ...parameters list, and list of IO ports. --> -<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?)> +<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?, grc_source?)> <!-- Sub level elements. --> @@ -40,6 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <!ELEMENT category (#PCDATA)> <!ELEMENT import (#PCDATA)> <!ELEMENT doc (#PCDATA)> +<!ELEMENT grc_source (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT key (#PCDATA)> <!ELEMENT check (#PCDATA)> diff --git a/grc/python/convert_hier.py b/grc/python/convert_hier.py index c6ca5b769..b609af24a 100644 --- a/grc/python/convert_hier.py +++ b/grc/python/convert_hier.py @@ -62,6 +62,7 @@ def convert_hier(flow_graph, python_file): sink_n['name'] = input_sig['label'] sink_n['type'] = input_sig['type'] sink_n['vlen'] = input_sig['vlen'] + if input_sig['optional']: sink_n['optional'] = '1' block_n['sink'].append(sink_n) #source data block_n['source'] = list() @@ -70,9 +71,11 @@ def convert_hier(flow_graph, python_file): source_n['name'] = output_sig['label'] source_n['type'] = output_sig['type'] source_n['vlen'] = output_sig['vlen'] + if output_sig['optional']: source_n['optional'] = '1' block_n['source'].append(source_n) #doc data block_n['doc'] = "%s\n%s\n%s"%(block_author, block_desc, python_file) + block_n['grc_source'] = "%s"%(flow_graph.grc_file_path) #write the block_n to file xml_file = python_file + '.xml' ParseXML.to_file({'block': block_n}, xml_file) |