From: Josh Blum Date: Fri, 14 Aug 2009 06:59:06 +0000 (-0700) Subject: this time commit the file changes X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0a73facce3ce4eba23676df5f22f222df319ed87;p=debian%2Fgnuradio this time commit the file changes --- diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index 025c261f..fbd8f4bb 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -123,6 +123,8 @@ dist_ourdata_DATA = \ gr_kludge_copy.xml \ gr_map_bb.xml \ gr_max_xx.xml \ + gr_message_sink.xml \ + gr_message_source.xml \ gr_moving_average_xx.xml \ gr_mpsk_receiver_cc.xml \ gr_mpsk_sync_cc.xml \ diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 9eda2fdc..2cedb45a 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -20,6 +20,7 @@ gr_udp_source audio_source gr_wavfile_source + gr_message_source pad_source @@ -32,6 +33,7 @@ gr_udp_sink audio_sink gr_wavfile_sink + gr_message_sink pad_sink diff --git a/grc/blocks/gr_message_sink.xml b/grc/blocks/gr_message_sink.xml index e69de29b..76537f28 100644 --- a/grc/blocks/gr_message_sink.xml +++ b/grc/blocks/gr_message_sink.xml @@ -0,0 +1,72 @@ + + + + Message Sink + gr_message_sink + from gnuradio import gr + gr.message_sink($type.size*$vlen, $(id)_msgq, $dont_block) + + Input Type + type + enum + + + + + + + + Don't Block + dont_block + False + enum + + + + + Vec Length + vlen + 1 + int + + $vlen > 0 + + in + $type + $vlen + + + out + msg + + diff --git a/grc/blocks/gr_message_source.xml b/grc/blocks/gr_message_source.xml index e69de29b..44378ae8 100644 --- a/grc/blocks/gr_message_source.xml +++ b/grc/blocks/gr_message_source.xml @@ -0,0 +1,58 @@ + + + + Message Source + gr_message_source + from gnuradio import gr + gr.message_source($type.size*$vlen, $(id)_msgq) + + Output Type + type + enum + + + + + + + + Vec Length + vlen + 1 + int + + $vlen > 0 + + in + msg + + + out + $type + $vlen + + diff --git a/grc/python/Block.py b/grc/python/Block.py index 957fee18..6693f6f8 100644 --- a/grc/python/Block.py +++ b/grc/python/Block.py @@ -70,6 +70,8 @@ class Block(_Block): (self._sources, self.get_parent().get_parent().Source), (self._sinks, self.get_parent().get_parent().Sink), ): + #TODO #FIXME we want to filter out msg ports and run the regular code below this line + if any([port.get_type() == 'msg' for port in ports.values()]): continue #how many ports? num_ports = len(ports) #do nothing for 0 ports diff --git a/grc/python/Connection.py b/grc/python/Connection.py index d8a894bb..5eba9f24 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -21,6 +21,9 @@ from .. base.Connection import Connection as _Connection class Connection(_Connection): + def is_msg(self): + return self.get_source().get_type() == self.get_sink().get_type() == 'msg' + def validate(self): """ Validate the connections. diff --git a/grc/python/Constants.py b/grc/python/Constants.py index 2f629d1b..439a5242 100644 --- a/grc/python/Constants.py +++ b/grc/python/Constants.py @@ -61,4 +61,4 @@ SHORT_VECTOR_COLOR_SPEC = '#CCCC33' BYTE_VECTOR_COLOR_SPEC = '#CC66CC' ID_COLOR_SPEC = '#DDDDDD' WILDCARD_COLOR_SPEC = '#FFFFFF' -MSG_COLOR_SPEC = '#FF6600' +MSG_COLOR_SPEC = '#777777' diff --git a/grc/python/Generator.py b/grc/python/Generator.py index 33be4a72..ed799571 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -98,7 +98,8 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') #list of regular blocks (all blocks minus the special ones) blocks = filter(lambda b: b not in (imports + parameters + variables + probes + notebooks), blocks) + probes #list of connections where each endpoint is enabled - connections = self._flow_graph.get_enabled_connections() + connections = filter(lambda c: not c.is_msg(), self._flow_graph.get_enabled_connections()) + messages = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections()) #list of variable names var_ids = [var.get_id() for var in parameters + variables] #prepend self. @@ -124,6 +125,7 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') 'parameters': parameters, 'blocks': blocks, 'connections': connections, + 'messages': messages, 'generate_options': self._generate_options, 'var_id2cbs': var_id2cbs, } diff --git a/grc/python/Port.py b/grc/python/Port.py index c01884cc..14adc061 100644 --- a/grc/python/Port.py +++ b/grc/python/Port.py @@ -105,10 +105,11 @@ class Source(Port): def __init__(self, block, n): self._n = n #save n - if n['type'] != 'msg': #key is port index + if n['type'] == 'msg': n['key'] = 'msg' + else: n['key'] = str(block._source_count) block._source_count = block._source_count + 1 - Port.__init__(self, block, n) + Port.__init__(self, block, n) def __del__(self): self.get_parent()._source_count = self.get_parent()._source_count - 1 @@ -117,14 +118,14 @@ class Sink(Port): def __init__(self, block, n): self._n = n #save n - if n['type'] != 'msg': #key is port index + if n['type'] == 'msg': n['key'] = 'msg' + else: n['key'] = str(block._sink_count) block._sink_count = block._sink_count + 1 - Port.__init__(self, block, n) + Port.__init__(self, block, n) def __del__(self): self.get_parent()._sink_count = self.get_parent()._sink_count - 1 -#TODO merge source and sink classes into port class -#TODO check that key is only defined if and only if type is message -#TODO check that nports is undefined when type is message +#TODO check that nports and vlen is undefined when type is message +#TODO only allow up to one port of type msg diff --git a/grc/python/block.dtd b/grc/python/block.dtd index 8681d125..7c6c3981 100644 --- a/grc/python/block.dtd +++ b/grc/python/block.dtd @@ -31,8 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA --> - - + +