apply diff from previous commits
authorJosh Blum <josh@joshknows.com>
Tue, 11 Aug 2009 05:29:55 +0000 (22:29 -0700)
committerJosh Blum <josh@joshknows.com>
Tue, 11 Aug 2009 05:29:55 +0000 (22:29 -0700)
Makefile.am
grc/base/Param.py
grc/python/Constants.py
grc/python/Platform.py
grc/python/Port.py
grc/python/block.dtd
grc/todo.txt

index e8328c263963e6e5b043138246b751af6484cb9e..ec71be725bff59bd746c9f6d8e4b5b667ce6fca7 100644 (file)
@@ -37,3 +37,16 @@ EXTRA_DIST = \
 
 SUBDIRS = @build_dirs@
 DIST_SUBDIRS = @build_dirs@ @skipped_dirs@ @with_dirs@
+
+if PYTHON
+
+export pythondir
+
+install-data-hook:
+       @if ! python -c "import gnuradio" > /dev/null 2>&1; then\
+               printf "\n*** Post-Install Message ***\
+               \nWarning: python could not find the gnuradio module.\
+               \nMake sure that $${pythondir} is in your PYTHONPATH\n\n";\
+       fi
+
+endif
index 8166d54ecca0d1a6bf892ea3cc0f98c80b6e7322..93c1c52bdef38114ccc948c9d08dfe1b5856e9dd 100644 (file)
@@ -165,6 +165,8 @@ class Param(Element):
                        try: assert self.get_value() in self.get_option_keys()
                        except AssertionError: raise Exception, 'The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys())
                else: self._value = value or ''
+               #begin the testing
+               self.test()
 
        def test(self):
                """
index 5f203237f30185e4f6d1a7dbad1daa2d9e78cddf..2f629d1bf4e5124429869ba8cd00aca8aeb6ee56 100644 (file)
@@ -61,3 +61,4 @@ SHORT_VECTOR_COLOR_SPEC = '#CCCC33'
 BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
 ID_COLOR_SPEC = '#DDDDDD'
 WILDCARD_COLOR_SPEC = '#FFFFFF'
+MSG_COLOR_SPEC = '#FF6600'
index f56e3fb2df169dc0f7b218829f1ce1b88a1b48ce..d55dbf4ce71a224fa89fd710a396f466db7c2391 100644 (file)
@@ -42,7 +42,8 @@ COLORS = (#title, #color spec
        ('Integer Vector', Constants.INT_VECTOR_COLOR_SPEC),
        ('Short Vector', Constants.SHORT_VECTOR_COLOR_SPEC),
        ('Byte Vector', Constants.BYTE_VECTOR_COLOR_SPEC),
-       ('Wildcard Type', Constants.WILDCARD_COLOR_SPEC),
+       ('Wildcard', Constants.WILDCARD_COLOR_SPEC),
+       ('Message', Constants.MSG_COLOR_SPEC),
 )
 
 class Platform(_Platform):
index 5a2b047f0ef05c4017b5ddc447fd1001a141efb9..c01884cc3dbfbcb25862bf63a867e3f0b05e50ea 100644 (file)
@@ -23,27 +23,23 @@ import Constants
 class Port(_Port):
 
        ##possible port types
-       TYPES = ['complex', 'float', 'int', 'short', 'byte']
+       TYPES = ['complex', 'float', 'int', 'short', 'byte', 'msg']
 
        def __init__(self, block, n):
                """
                Make a new port from nested data.
                @param block the parent element
                @param n the nested odict
-               @return a new port
                """
-               vlen = n.find('vlen') or '1'
-               nports = n.find('nports') or ''
-               optional = n.find('optional') or ''
                #build the port
                _Port.__init__(
                        self,
                        block=block,
                        n=n,
                )
-               self._nports = nports
-               self._vlen = vlen
-               self._optional = bool(optional)
+               self._nports = n.find('nports') or ''
+               self._vlen = n.find('vlen') or '1'
+               self._optional = bool(n.find('optional'))
 
        def validate(self):
                _Port.validate(self)
@@ -94,6 +90,7 @@ class Port(_Port):
                                        'int': Constants.INT_COLOR_SPEC,
                                        'short': Constants.SHORT_COLOR_SPEC,
                                        'byte': Constants.BYTE_COLOR_SPEC,
+                                       'msg': Constants.MSG_COLOR_SPEC,
                                }[self.get_type()]
                        return {#vlen is non 1
                                'complex': Constants.COMPLEX_VECTOR_COLOR_SPEC,
@@ -108,10 +105,10 @@ class Source(Port):
 
        def __init__(self, block, n):
                self._n = n #save n
-               #key is port index
-               n['key'] = str(block._source_count)
-               block._source_count = block._source_count + 1
-               Port.__init__(self, block, n)
+               if n['type'] != 'msg': #key is port index
+                       n['key'] = str(block._source_count)
+                       block._source_count = block._source_count + 1
+                       Port.__init__(self, block, n)
 
        def __del__(self):
                self.get_parent()._source_count = self.get_parent()._source_count - 1
@@ -120,10 +117,14 @@ class Sink(Port):
 
        def __init__(self, block, n):
                self._n = n #save n
-               #key is port index
-               n['key'] = str(block._sink_count)
-               block._sink_count = block._sink_count + 1
-               Port.__init__(self, block, n)
+               if n['type'] != 'msg': #key is port index
+                       n['key'] = str(block._sink_count)
+                       block._sink_count = block._sink_count + 1
+                       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 
index 7c6c398114e818c46cf11544842e58712c9601f3..8681d1255e930e13d9c09972e4a0d88b327c8f51 100644 (file)
@@ -31,8 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  -->
 <!ELEMENT param (name, key, value?, type, hide?, option*)>
 <!ELEMENT option (name, key, opt*)>
-<!ELEMENT sink (name, type, vlen?, nports?, optional?)>
-<!ELEMENT source (name, type, vlen?, nports?, optional?)>
+<!ELEMENT sink (name, key?, type, vlen?, nports?, optional?)>
+<!ELEMENT source (name, key?, type, vlen?, nports?, optional?)>
 <!--
        Bottom level elements.
        Character data only.
index f8c8021b65fccf2834e24cd4dd125b43d8f2892a..bb40e1f160fe4009dec974596cefed2ca38f0284 100644 (file)
@@ -26,6 +26,7 @@
 * callbacks for set average on fft, waterfall, number sinks
 * add units to params: Sps, Hz, dB...
 * command line options should replace _ with - for the --option
+  * add bool type to command line option store_true or store_false
 
 ##################################################
 # Features