コード例 #1
0
    def _amiName(self, scopedName, kind):
        ident  = scopedName[-1]
        scope  = scopedName[:-1]
        prefix = ""

        while 1:
            candidate = "AMI_%s%s%s" % (prefix, ident, kind)
            try:
                idlast.findDecl(scope + [candidate])

            except idlast.DeclNotFound:
                return candidate

            prefix = prefix + "AMI_"
コード例 #2
0
ファイル: xpidlgen.py プロジェクト: cellmlapi/cellml-api
    def visitEnum(self, node):
        scoped_name = node.scopedName()[:-1]
        if len(scoped_name) and isinstance(idlast.findDecl(scoped_name),
                                           idlast.Interface):
            value = 0

            for enum in node.enumerators():
                name = enum.identifier()
                self._idl.out("const unsigned long @name@ = @value@;",
                              name=name, value=str(value))
                value = value + 1
コード例 #3
0
    def visitEnum(self, node):
        scoped_name = node.scopedName()[:-1]
        if len(scoped_name) and isinstance(idlast.findDecl(scoped_name),
                                           idlast.Interface):
            value = 0

            for enum in node.enumerators():
                name = enum.identifier()
                self._idl.out("const unsigned long @name@ = @value@;",
                              name=name,
                              value=str(value))
                value = value + 1
コード例 #4
0
ファイル: xpidlgen.py プロジェクト: cellmlapi/cellml-api
    def visitConst(self, node):
        scoped_name = node.scopedName()[:-1]

        if len(scoped_name) and isinstance(idlast.findDecl(scoped_name),
                                           idlast.Interface):
            name = node.identifier()

            ti = typeinfo.GetTypeInformation(node.constType().unalias())

            cleaned_value = str(node.value())
            if cleaned_value[-1] == 'L':
                cleaned_value = cleaned_value[0:-1]

            self._idl.out("const @type@ @name@ = @value@;",
                          type=ti.type_xpidl, name=name,
                          value=cleaned_value)
コード例 #5
0
    def visitConst(self, node):
        scoped_name = node.scopedName()[:-1]

        if len(scoped_name) and isinstance(idlast.findDecl(scoped_name),
                                           idlast.Interface):
            name = node.identifier()

            ti = typeinfo.GetTypeInformation(node.constType().unalias())

            cleaned_value = str(node.value())
            if cleaned_value[-1] == 'L':
                cleaned_value = cleaned_value[0:-1]

            self._idl.out("const @type@ @name@ = @value@;",
                          type=ti.type_xpidl,
                          name=name,
                          value=cleaned_value)
コード例 #6
0
ファイル: dump.py プロジェクト: DiegoReiriz/p2p-corba
def relativeScope(fromScope, destScope):
    """relativeScope variant that handles invented fromScopes"""
    rs = idlutil.relativeScope(fromScope, destScope)

    if rs[0] is None:
        try:
            rd = idlast.findDecl(destScope)

        except idlast.DeclNotFound:
            return rs

        new_rs = rs
        while new_rs[0] is None and len(fromScope) > 1:
            fromScope = fromScope[:-1]
            new_rs = idlutil.relativeScope(fromScope, destScope)

        if new_rs[0] is not None:
            return new_rs

    return rs
コード例 #7
0
ファイル: dump.py プロジェクト: gmwu/corba_examples
def relativeScope(fromScope, destScope):
    """relativeScope variant that handles invented fromScopes"""
    rs = idlutil.relativeScope(fromScope, destScope)

    if rs[0] is None:
        try:
            rd = idlast.findDecl(destScope)

        except idlast.DeclNotFound:
            return rs

        new_rs = rs
        while new_rs[0] is None and len(fromScope) > 1:
            fromScope = fromScope[:-1]
            new_rs = idlutil.relativeScope(fromScope, destScope)

        if new_rs[0] is not None:
            return new_rs

    return rs