Beispiel #1
0
    def __init__(self,
                 app,
                 sendComm=None,
                 receiveComm=None,
                 tosbase=True,
                 **callParams):
        """ Find function defs in rpcSchema.xml file and create function objects."""
        # Check for the rpcSchema.xml file
        try:
            xmlFilename = nescDecls.findBuildFile(app.buildDir,
                                                  "rpcSchema.xml")
        except:
            raise Exception(
                """\nWARNING: cannot find file \"rpcSchema.xml\".  No rpc commands will be imported."""
            )

        RoutingMessages.RoutingMessages.__init__(self, app)

        self.defaultCallParams = (("address", None), ("returnAddress", None),
                                  ("timeout", 1), ("blocking", True),
                                  ("responseDesired", True))
        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
        ]
        for funcDef in functions:
            self._messages[funcDef.tagName] = RpcFunction(funcDef, self)
Beispiel #2
0
 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."
   RoutingMessages.RoutingMessages.__init__(self, app)
   self.defaultCallParams = ( ("address", None), ("returnAddress", None),
                       ("timeout", 1), ("blocking", True), ("responseDesired", True) )
   self.initializeCallParams(callParams)
   self.tooLarge = []
   self.sizeIncorrect = []
   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:
         if len(e.args) > 0 and e.args[0].find("No type") == 0:
             self.noType.append(symbolDef)
         elif len(e.args) > 0 and e.args[0].find("Could not discern") == 0:
             self.arraySizeIncorrect.append(symbolDef)
         elif len(e.args) > 0 and e.args[0].find("Ram symbol size too large") == 0:
             self.tooLarge.append(symbolDef)
         elif len(e.args) > 0 and e.args[0].find("Ram symbol size incorrect") == 0:
             self.sizeIncorrect.append(symbolDef)
         else :
             raise
Beispiel #3
0
  def __init__(self, app, sendComm=None, receiveComm=None, tosbase=True, **callParams) :
    """ Find function defs in rpcSchema.xml file and create function objects."""
    # Check for the rpcSchema.xml file
    try :
      xmlFilename = nescDecls.findBuildFile(app.buildDir, "rpcSchema.xml")
    except:
      raise Exception("""\nWARNING: cannot find file \"rpcSchema.xml\".  No rpc commands will be imported.""")

    RoutingMessages.RoutingMessages.__init__(self, app)

    self.defaultCallParams = ( ("address", None), ("returnAddress", None),
                        ("timeout", 1), ("blocking", True), ("responseDesired", True) )
    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]
    for funcDef in functions: 
      self._messages[funcDef.tagName] = RpcFunction(funcDef, self)