def operator(g,n):
    name=n.getAttribute('name')
    opCode = opEnum(implName(n))
    if (exec_(n) == 'MRF'):
     name=name+'_mrf'
     opCode=opEnum(name)

    iOpImpl="0" # # FTTB, some not implemented yet, hence if:
    if DomUtils.childInNameSet(n, self.supported) != None or \
       exec_(n) in self.onExec:
        biName=implName(n)
        if exec_(n) == 'MRF':
          biName=biName+"_mrf"
        iOpImpl= '&builtIn_%s' % biName

    p=DomUtils.childInNameSet(n, self.pointCode)

    # mark by setting the domain arg to setPointOn
    setPointOn=""
    if p != None and p.hasAttribute("function") and name not in [ "sin", "cos", "tan" ]:
      setPointOn=self.domainIll(p)

    if implName(n) == "ifthenelse":
      setPointOn="noDomainIll"

    tail= int(inputTailRepeat(n))
    if (tail > 0):
     assert tail <= len(DomUtils.childrenInNameSet(n,["Input"]))

    g.write('{IOpImpl   *i= %s;' % iOpImpl)
    g.write(' Operator *c= new Operator(')
    g.write('''  "%s","%s",%s, SYNTAX_%s, EXEC_TYPE_%s, i,%s,%s);'''
            % (name,implName(n),opCode,syntax(n),exec_(n),commutative(n),tail))
    if setPointOn != "":
      g.write(' c->setPointOn(%s);' % setPointOn)
    for f in DomUtils.childrenInNameSet(n,["Input"]):
      g.write('  c->pushBackInput(%s);' % pcrxml.DataType(f).arg())
    for f in DomUtils.childrenInNameSet(n,["Result"]):
      g.write('  c->pushBackResult(%s);' % pcrxml.DataType(f).str())
    g.write(' add(c);')
    g.write('}')
示例#2
0
   def operator(g,n):
    name=n.getAttribute('name')
    opCode = opEnum(implName(n))
    if (exec_(n) == 'MRF'):
     name=name+'_mrf'
     opCode=opEnum(name)

    iOpImpl="0" # # FTTB, some not implemented yet, hence if:
    if DomUtils.childInNameSet(n, self.supported) != None or \
       exec_(n) in self.onExec:
        biName=implName(n)
        if exec_(n) == 'MRF':
          biName=biName+"_mrf"
        iOpImpl= '&builtIn_%s' % biName

    p=DomUtils.childInNameSet(n, self.pointCode)

    # mark by setting the domain arg to setPointOn
    setPointOn=""
    if p != None and p.hasAttribute("function") and name not in [ "sin", "cos", "tan" ]:
      setPointOn=self.domainIll(p)

    if implName(n) == "ifthenelse":
      setPointOn="noDomainIll"

    tail= int(inputTailRepeat(n))
    if (tail > 0):
     assert tail <= len(DomUtils.childrenInNameSet(n,["Input"]))

    g.write('{IOpImpl   *i= %s;' % iOpImpl)
    g.write(' Operator *c= new Operator(')
    g.write('''  "%s","%s",%s, SYNTAX_%s, EXEC_TYPE_%s, i,%s,%s);'''
            % (name,implName(n),opCode,syntax(n),exec_(n),commutative(n),tail))
    if setPointOn != "":
      g.write(' c->setPointOn(%s);' % setPointOn)
    for f in DomUtils.childrenInNameSet(n,["Input"]):
      g.write('  c->pushBackInput(%s);' % pcrxml.DataType(f).arg())
    for f in DomUtils.childrenInNameSet(n,["Result"]):
      g.write('  c->pushBackResult(%s);' % pcrxml.DataType(f).str())
    g.write(' add(c);')
    g.write('}')