[Tinyos-commits] CVS: tinyos-1.x/tools/python/pytos/tools RamSymbols.py, 1.3, 1.4 Rpc.py, 1.4, 1.5

Kamin Whitehouse kaminw at users.sourceforge.net
Thu Jan 12 14:50:47 PST 2006


Update of /cvsroot/tinyos/tinyos-1.x/tools/python/pytos/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10273/python/pytos/tools

Modified Files:
	RamSymbols.py Rpc.py 
Log Message:
This should help Pytos startup three times faster.  

It also allows poking and peeking of global ram symbols, like TOS_AM_GROUP, through the new app.ramSymbols.Globals object.

Most of this patch is from Henri Dubois-ferriere from switzerland



Index: RamSymbols.py
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tools/python/pytos/tools/RamSymbols.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RamSymbols.py	27 Oct 2005 02:23:37 -0000	1.3
--- RamSymbols.py	12 Jan 2006 22:50:45 -0000	1.4
***************
*** 31,35 ****
  import pytos.util.nescDecls as nescDecls
  import pytos.util.RoutingMessages as RoutingMessages
! import pytos.Comm as Comm 
  from copy import deepcopy
  
--- 31,36 ----
  import pytos.util.nescDecls as nescDecls
  import pytos.util.RoutingMessages as RoutingMessages
! import pytos.Comm as Comm
! import re
  from copy import deepcopy
  
***************
*** 295,300 ****
    """
    
!   def __init__(self, app, sendComm=None, receiveComm=None, tosbase=True, **callParams) :
!     """ Find function defs in rpcSchema.xml file and create function objects."""
      if not "ramSymbol_t" in app.types._types :
        print "The RamSymbolsM module was not compiled in.  No ram symbols will be imported."
--- 296,301 ----
    """
    
!   def __init__(self, app, sendComm=None, receiveComm=None, tosbase=True, xmlFileDOM=None, **callParams) :
!     """ Find function defs in nescDecls.xml file and create function objects."""
      if not "ramSymbol_t" in app.types._types :
        print "The RamSymbolsM module was not compiled in.  No ram symbols will be imported."
***************
*** 308,316 ****
      self.noType = []
      self.arraySizeIncorrect = []
!     schema = minidom.parse("%snescDecls.xml" % app.buildDir)
!     symbols, = schema.childNodes[0].getElementsByTagName("ramSymbols")
      symbols = [node for node in symbols.childNodes if node.nodeType == 1]
      for symbolDef in symbols: 
        try :
            self._messages[symbolDef.getAttribute("name")] = RamSymbol(symbolDef, self)
        except Exception, e:
--- 309,323 ----
      self.noType = []
      self.arraySizeIncorrect = []
!     if xmlFileDOM == None:
!       xmlFileDOM = minidom.parse(nescDecls.findBuildFile(buildDir, "nescDecls.xml"))
!     symbols, = xmlFileDOM.childNodes[0].getElementsByTagName("ramSymbols")
      symbols = [node for node in symbols.childNodes if node.nodeType == 1]
+     regexp = re.compile("\w+\.\w+")
      for symbolDef in symbols: 
        try :
+           if (not regexp.match(symbolDef.getAttribute("name"))):
+             # If the identifier is not of form Module.variable, then it is defined in a .c/.h file and not in a
+             # nesc module. Add it to the "Globals" pseudo-module.
+             symbolDef.setAttribute("name", "Globals."+symbolDef.getAttribute("name"))
            self._messages[symbolDef.getAttribute("name")] = RamSymbol(symbolDef, self)
        except Exception, e:

Index: Rpc.py
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tools/python/pytos/tools/Rpc.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Rpc.py	17 Nov 2005 02:03:40 -0000	1.4
--- Rpc.py	12 Jan 2006 22:50:45 -0000	1.5
***************
*** 230,234 ****
      self.initializeCallParams(callParams)
  
!     schema = minidom.parse("%srpcSchema.xml" % app.buildDir)
      functions, = schema.childNodes[0].getElementsByTagName("rpcFunctions")
      functions = [node for node in functions.childNodes if node.nodeType == 1]
--- 230,234 ----
      self.initializeCallParams(callParams)
  
!     schema = minidom.parse(nescDecls.findBuildFile(app.buildDir, "rpcSchema.xml"))
      functions, = schema.childNodes[0].getElementsByTagName("rpcFunctions")
      functions = [node for node in functions.childNodes if node.nodeType == 1]



More information about the Tinyos-commits mailing list