Example #1
0
def declaredType(decl, scopedName, kind, local):
    sname = idlutil.slashName(scopedName)
    if declaredTypeMap.has_key(sname):
        dt = declaredTypeMap[sname]
        if dt.kind() == kind:
            return dt
    dt = Declared(decl, scopedName, kind, local)
    declaredTypeMap[sname] = dt
    return dt
Example #2
0
def findDecl(scopedName):
    """findDecl(scopedName) -> Decl

Find a Decl object given a fully scoped name represented as a list of
strings. Raises DeclNotFound if the name is not recognised."""

    sname = idlutil.slashName(scopedName)
    if not declMap.has_key(sname):
        raise DeclNotFound(scopedName)
    
    return declMap[sname]
Example #3
0
def findDecl(scopedName):
    """findDecl(scopedName) -> Decl

Find a Decl object given a fully scoped name represented as a list of
strings. Raises DeclNotFound if the name is not recognised."""

    sname = idlutil.slashName(scopedName)
    if not declMap.has_key(sname):
        raise DeclNotFound(scopedName)

    return declMap[sname]
Example #4
0
def registerDecl(scopedName, decl):
    """Private function"""
    sname = idlutil.slashName(scopedName)

    if declMap.has_key(sname):

        rdecl = declMap[sname]

        isi = isinstance

        if (isi(decl, Interface) and isi(rdecl, Forward))       or \
           (isi(decl, ValueAbs)  and isi(rdecl, ValueForward))  or \
           (isi(decl, Value)     and isi(rdecl, ValueForward))  or \
           (isi(decl, Struct)    and isi(rdecl, StructForward)) or \
           (isi(decl, Union)     and isi(rdecl, UnionForward)):

            # resolving a forward declaration
            rdecl._fullDecl = decl
            for f in rdecl._more:
                f._fullDecl = decl
            declMap[sname] = decl

        elif (isi(decl, Forward)       and isi(rdecl, Forward))       or \
             (isi(decl, ValueForward)  and isi(rdecl, ValueForward))  or \
             (isi(decl, StructForward) and isi(rdecl, StructForward)) or \
             (isi(decl, UnionForward)  and isi(rdecl, UnionForward)):

            # repeat forward declaration
            rdecl._more.append(decl)

        elif (isi(decl, Forward)       and isi(rdecl, Interface)) or \
             (isi(decl, ValueForward)  and isi(rdecl, ValueAbs))  or \
             (isi(decl, ValueForward)  and isi(rdecl, Value))     or \
             (isi(decl, StructForward) and isi(rdecl, Struct))    or \
             (isi(decl, UnionForward)  and isi(rdecl, Union)):

            # forward declaration of full declaration
            decl._fullDecl = rdecl

        elif (isi(decl, Module) and isi(rdecl, Module)):
            # continued module
            for cc in rdecl._continuations:
                cc._continuations.append(decl)

            rdecl._continuations.append(decl)

        else:
            print "Warning: attempt to re-register", sname

        return

    declMap[sname] = decl
Example #5
0
def registerDecl(scopedName, decl):
    """Private function"""
    sname = idlutil.slashName(scopedName)

    if declMap.has_key(sname):

        rdecl = declMap[sname]

        isi = isinstance

        if (isi(decl, Interface) and isi(rdecl, Forward))       or \
           (isi(decl, ValueAbs)  and isi(rdecl, ValueForward))  or \
           (isi(decl, Value)     and isi(rdecl, ValueForward))  or \
           (isi(decl, Struct)    and isi(rdecl, StructForward)) or \
           (isi(decl, Union)     and isi(rdecl, UnionForward)):

            # resolving a forward declaration
            rdecl._fullDecl = decl
            for f in rdecl._more: f._fullDecl = decl
            declMap[sname] = decl

        elif (isi(decl, Forward)       and isi(rdecl, Forward))       or \
             (isi(decl, ValueForward)  and isi(rdecl, ValueForward))  or \
             (isi(decl, StructForward) and isi(rdecl, StructForward)) or \
             (isi(decl, UnionForward)  and isi(rdecl, UnionForward)):
            
            # repeat forward declaration
            rdecl._more.append(decl)

        elif (isi(decl, Forward)       and isi(rdecl, Interface)) or \
             (isi(decl, ValueForward)  and isi(rdecl, ValueAbs))  or \
             (isi(decl, ValueForward)  and isi(rdecl, Value))     or \
             (isi(decl, StructForward) and isi(rdecl, Struct))    or \
             (isi(decl, UnionForward)  and isi(rdecl, Union)):

            # forward declaration of full declaration
            decl._fullDecl = rdecl

        elif (isi(decl, Module) and isi(rdecl, Module)):
            # continued module
            for cc in rdecl._continuations:
                cc._continuations.append(decl)

            rdecl._continuations.append(decl)

        else:
            print "Warning: attempt to re-register", sname

        return

    declMap[sname] = decl