commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11257 - in gnuradio/branches/developers/jblum/grc/grc


From: jblum
Subject: [Commit-gnuradio] r11257 - in gnuradio/branches/developers/jblum/grc/grc: blocks python
Date: Sun, 21 Jun 2009 20:12:55 -0600 (MDT)

Author: jblum
Date: 2009-06-21 20:12:55 -0600 (Sun, 21 Jun 2009)
New Revision: 11257

Modified:
   gnuradio/branches/developers/jblum/grc/grc/blocks/variable_config.xml
   gnuradio/branches/developers/jblum/grc/grc/python/FlowGraph.py
   gnuradio/branches/developers/jblum/grc/grc/python/expr_utils.py
Log:
use the variable make to determine dependency, fixes variable config block issue

Modified: gnuradio/branches/developers/jblum/grc/grc/blocks/variable_config.xml
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/blocks/variable_config.xml       
2009-06-22 01:03:19 UTC (rev 11256)
+++ gnuradio/branches/developers/jblum/grc/grc/blocks/variable_config.xml       
2009-06-22 02:12:55 UTC (rev 11257)
@@ -82,10 +82,5 @@
 To save the value back into the config file: \
 enter the name of another variable into the writeback param. \
 When the other variable is changed at runtime, the config file will be 
re-written.
-
-!!! FIXME !!!
-
-Do not use variables for the file path, section, or option. \
-Variable dependencies are not yet handled for those parameters.
        </doc>
 </block>

Modified: gnuradio/branches/developers/jblum/grc/grc/python/FlowGraph.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/FlowGraph.py      
2009-06-22 01:03:19 UTC (rev 11256)
+++ gnuradio/branches/developers/jblum/grc/grc/python/FlowGraph.py      
2009-06-22 02:12:55 UTC (rev 11257)
@@ -26,17 +26,6 @@
 _variable_matcher = re.compile('^(variable\w*)$')
 _parameter_matcher = re.compile('^(parameter)$')
 
-def _get_value_expr(variable_block):
-       """
-       Get the expression to evaluate from the value param.
-       Parameter blocks need to be evaluated so the stringify flag can be 
determined.
-       @param variable_block the variable or parameter block
-       @return the expression string
-       """
-       value_param = variable_block.get_param('value')
-       if _parameter_matcher.match(variable_block.get_key()): 
value_param.evaluate()
-       return value_param.to_code()
-
 class FlowGraph(_FlowGraph):
 
        _eval_cache = dict()
@@ -114,7 +103,7 @@
                id2var = dict([(var.get_id(), var) for var in variables])
                #map var id to variable code
                #variable code is a concatenation of all param code (without 
the id param)
-               id2expr = dict([(var.get_id(), _get_value_expr(var)) for var in 
variables])
+               id2expr = dict([(var.get_id(), var.get_var_make()) for var in 
variables])
                #sort according to dependency
                sorted_ids = expr_utils.sort_variables(id2expr)
                #create list of sorted variable blocks
@@ -148,14 +137,14 @@
                        np = dict()
                        for parameter in self.get_parameters():
                                try:
-                                       e = eval(_get_value_expr(parameter), n, 
n)
+                                       e = 
eval(parameter.get_param('value').to_code(), n, n)
                                        np[parameter.get_id()] = e
                                except: pass
                        n.update(np) #merge param namespace
                        #load variables
                        for variable in self.get_variables():
                                try:
-                                       e = eval(_get_value_expr(variable), n, 
n)
+                                       e = 
eval(variable.get_param('value').to_code(), n, n)
                                        n[variable.get_id()] = e
                                except: pass
                        #make namespace public

Modified: gnuradio/branches/developers/jblum/grc/grc/python/expr_utils.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/expr_utils.py     
2009-06-22 01:03:19 UTC (rev 11256)
+++ gnuradio/branches/developers/jblum/grc/grc/python/expr_utils.py     
2009-06-22 02:12:55 UTC (rev 11257)
@@ -110,7 +110,7 @@
        for var in vars: var_graph.add_node(var)
        for var, expr in exprs.iteritems():
                for dep in get_variable_dependencies(expr, vars):
-                       var_graph.add_edge(dep, var)
+                       if dep != var: var_graph.add_edge(dep, var)
        return var_graph
 
 def sort_variables(exprs):





reply via email to

[Prev in Thread] Current Thread [Next in Thread]