(self, tinfo: typeinfo.ITypeInfo, ta: typeinfo.TYPEATTR)
| 219 | |
| 220 | # TKIND_MODULE = 2 |
| 221 | def ParseModule(self, tinfo: typeinfo.ITypeInfo, ta: typeinfo.TYPEATTR) -> None: |
| 222 | assert 0 == ta.cImplTypes |
| 223 | # functions |
| 224 | for i in range(ta.cFuncs): |
| 225 | # We skip all function definitions. There are several |
| 226 | # problems with these, and we can, for comtypes, ignore them. |
| 227 | continue |
| 228 | fd = tinfo.GetFuncDesc(i) |
| 229 | dllname, func_name, ordinal = tinfo.GetDllEntry(fd.memid, fd.invkind) |
| 230 | func_doc = tinfo.GetDocumentation(fd.memid)[1] |
| 231 | assert 0 == fd.cParamsOpt # XXX |
| 232 | returns = self.make_type(fd.elemdescFunc.tdesc, tinfo) |
| 233 | |
| 234 | if fd.callconv == typeinfo.CC_CDECL: |
| 235 | attributes = "__cdecl__" |
| 236 | elif fd.callconv == typeinfo.CC_STDCALL: |
| 237 | attributes = "__stdcall__" |
| 238 | else: |
| 239 | raise ValueError(f"calling convention {fd.callconv:d}") |
| 240 | |
| 241 | func = typedesc.Function(func_name, returns, attributes, extern=1) |
| 242 | if func_doc is not None: |
| 243 | func.doc = func_doc.encode("mbcs") |
| 244 | func.dllname = dllname |
| 245 | self._register(func_name, func) |
| 246 | for i in range(fd.cParams): |
| 247 | argtype = self.make_type(fd.lprgelemdescParam[i].tdesc, tinfo) |
| 248 | func.add_argument(argtype) |
| 249 | |
| 250 | # constants |
| 251 | for i in range(ta.cVars): |
| 252 | vd = tinfo.GetVarDesc(i) |
| 253 | name, var_doc = tinfo.GetDocumentation(vd.memid)[0:2] |
| 254 | assert vd.varkind == typeinfo.VAR_CONST |
| 255 | typ = self.make_type(vd.elemdescVar.tdesc, tinfo) |
| 256 | var_value = vd._.lpvarValue[0].value |
| 257 | v = typedesc.Constant(name, typ, var_value, var_doc) |
| 258 | self._register(name, v) |
| 259 | |
| 260 | # TKIND_INTERFACE = 3 |
| 261 | def ParseInterface( |
no test coverage detected