예제 #1
0
def genCalldesc(decl,eclass,eheader,indent,fqn):
    assert isinstance(decl, idlast.Operation),repr(decl)
    name=decl.identifier()
    nameLen=len(name)
    pns=['p%s'%i for i in range(1, len(decl.parameters())+1)]
    params=''.join([',\n    %s& %s'%(ptype(p),n) for p,n in zip(decl.parameters(),pns)])
    callDescInvocationParams=','.join(['\n      cd->%s_'%n for n in pns])
    paramInits=''.join([',\n      %s_(%s)'%(n,n) for n in pns])
    paramMembers=''.join(['\n  %s %s_;'%(ptype(p),n) for p,n in zip(decl.parameters(),pns)])
    paramMarshals=''.join(['\n    cxy::cdr< %s >::marshal(%s_, s);'%(unqualifiedType(p.paramType()),n) for p,n in zip(decl.parameters(),pns)])
    returnType=unqualifiedType(decl.returnType())
    returnMember=''
    returnUnmarshal=''
    callDescReturnValue=''
    if returnType != 'void':
        returnMember='\n  xju::Optional< %(returnType)s > r_;'%vars()
        returnUnmarshal='\n    r_=cxy::cdr< %(returnType)s >::unmarshalFrom(s);'%vars()
        callDescReturnValue='\n    cd->r_='
        pass
    oneway=0
    if decl.oneway(): oneway=1
    assert len(decl.contexts())==0, 'contexts not yet implemented'
    user_exns=''.join(['\n    "%s",'%_.repoId() for _ in decl.raises()])
    userExceptions=''.join([genCalldescUserException(_) for _ in decl.raises()])
    user_exns_size=len(decl.raises())
    result=reindent(indent,calldesc_operation_t%vars())
    return result
예제 #2
0
def genObjref(decl,eclass,eheader,indent,fqn):
    assert isinstance(decl, idlast.Operation), repr(decl)
    name=decl.identifier()
    nameLen=len(name)
    pns=['p%s'%i for i in range(1, len(decl.parameters())+1)]
    params=','.join(['\n  %s& %s'%(ptype(p),n) for p,n in zip(decl.parameters(),pns)])
    paramNames=''.join([',\n      %s'%n for n in pns])
    assert len(decl.contexts())==0, 'contexts not yet implemented'
    returnType=unqualifiedType(decl.returnType())
    returnValue=''
    if returnType != 'void':
        returnValue='\n    return c.r_.value();'
        pass
    result=reindent(indent,objref_operation_t%vars())
    return result
예제 #3
0
파일: cxysref.py 프로젝트: urnest/urnest
def genOperation(decl,eclass,eheader,indent,fqn):
    result=''
    assert isinstance(decl, idlast.Operation), repr(decl)
    name=decl.identifier()
    paramTypes=[ptype(p,eclass)
                for p in decl.parameters()
                if p.direction()!=DIRECTION_OUT]
    pns=['p{n}'.format(**vars())
         for n in range(1,len(paramTypes)+1)]
    callDescInvocationParams=','.join(['\n          c->%s_.value()'%n
                                       for n in pns])
    returnedTypes=opReturnedTypes(decl,eclass)
    returnType=opReturnType(returnedTypes)
    callDescReturnValue=''
    if returnType != 'void':
        callDescReturnValue='c->r_ ='
        pass
    assert len(decl.contexts())==0, 'contexts not yet implemented'
    catches=''.join([genCatch('::'.join(_.scopedName())) \
                                  for _ in decl.raises()])
    user_exns=''.join(['\n    "%s",'%_.repoId() for _ in decl.raises()])
    result=reindent(indent,operation_t%vars())
    return result