Exemple #1
0
 def union_types(self) -> Iterator["Type"]:
     if self.cdata.base != self.UNION:
         return
     t = self.cdata
     while t.info.uni.count == 0:
         t = ffi.addressof(t.der.type)
     for i in range(t.info.uni.count):
         yield Type(self.context, t.info.uni.types[i])
Exemple #2
0
 def union_types(self):
     if self._type.base != self.UNION:
         return
     t = self._type
     while t.info.uni.count == 0:
         t = ffi.addressof(t.der.type)
     for i in range(t.info.uni.count):
         yield Type(self.context, t.info.uni.types[i])
Exemple #3
0
 def bits(self):
     if self._type.base != self.BITS:
         return
     t = self._type
     while t.info.bits.count == 0:
         t = ffi.addressof(t.der.type)
     for i in range(t.info.bits.count):
         b = t.info.bits.bit[i]
         yield c2str(b.name), c2str(b.dsc)
Exemple #4
0
 def enums(self):
     if self._type.base != self.ENUM:
         return
     t = self._type
     while t.info.enums.count == 0:
         t = ffi.addressof(t.der.type)
     for i in range(t.info.enums.count):
         e = t.info.enums.enm[i]
         yield c2str(e.name), c2str(e.dsc)
Exemple #5
0
 def bits(self) -> Iterator[Tuple[str, Optional[str]]]:
     if self.cdata.base != self.BITS:
         return
     t = self.cdata
     while t.info.bits.count == 0:
         t = ffi.addressof(t.der.type)
     for i in range(t.info.bits.count):
         b = t.info.bits.bit[i]
         yield c2str(b.name), c2str(b.dsc)
Exemple #6
0
 def enums(self) -> Iterator[Tuple[str, Optional[str]]]:
     if self.cdata.base != self.ENUM:
         return
     t = self.cdata
     while t.info.enums.count == 0:
         t = ffi.addressof(t.der.type)
     for i in range(t.info.enums.count):
         e = t.info.enums.enm[i]
         yield c2str(e.name), c2str(e.dsc)
Exemple #7
0
    def idents(self) -> Iterator[Tuple[str, Optional[str]]]:
        if self.cdata.base != self.IDENT:
            return
        t = self.cdata
        while t.info.ident.count == 0:
            t = ffi.addressof(t.der.type)

        for i in range(t.info.ident.count):
            e = t.info.ident.ref[i]
            yield c2str(e.name), c2str(e.dsc)
Exemple #8
0
    def candidate_idents(self) -> Iterator[Tuple[str, Optional[str]]]:
        if self.cdata.base != self.IDENT:
            return
        t = self.cdata
        while t.info.ident.count == 0:
            t = ffi.addressof(t.der.type)
        for i in range(t.info.ident.count):
            e = t.info.ident.ref[i]

            for s in range(e.der.number):
                x = e.der.set.s[s]
                if not x: continue
                yield "{}:{}".format(c2str(x.module.name), c2str(x.name)), c2str(x.dsc)
Exemple #9
0
 def type(self):
     return Type(self.context, ffi.addressof(self._leaflist.type))
Exemple #10
0
 def leafref_type(self):
     if self._type.base != self.LEAFREF:
         return None
     lref = self._type.info.lref
     return Type(self.context, ffi.addressof(lref.target.type))
Exemple #11
0
 def derived_type(self):
     if not self._type.der:
         return None
     return Type(self.context, ffi.addressof(self._type.der.type))
Exemple #12
0
 def leafref_type(self) -> Optional["Type"]:
     if self.cdata.base != self.LEAFREF:
         return None
     lref = self.cdata.info.lref
     return Type(self.context, ffi.addressof(lref.target.type))
Exemple #13
0
 def derived_type(self) -> Optional["Type"]:
     if not self.cdata.der:
         return None
     return Type(self.context, ffi.addressof(self.cdata.der.type))
Exemple #14
0
 def type(self) -> Type:
     return Type(self.context, ffi.addressof(self.cdata_leaflist.type))