winIDEA SDK
test_get_expression_type.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_getExpressionType():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 dataCtrl2 = ic.CDataController2(connMgr)
16
17 rt = dataCtrl2.getExpressionType(0, "g_complexStruct")
18 try:
19 exp = rt.Expression()
20 exp: ic.IVariable
21 print(f"Name: {exp.Name()}")
22 print(f"\tQualified name: {exp.QualifiedName()}")
23 print(f"\tAddress: {exp.Address()}")
24 print(f"\tModule: {exp.Module()}")
25 print(f"\tMemory area: {exp.MemArea()}")
26 print(f"\tNum of bytes: {exp.NumBytes()}")
27 print(f"\tScope: {exp.Scope()}")
28 print(f"\tArray dimension: {exp.ArrayDimension()}")
29 print(f"\tArray first element: {exp.ArrayFirstElement()}")
30 print(f"\tSize: {exp.Size()}")
31 print(f"\tType: {exp.Type()}")
32 print(f"\tType name: {exp.TypeName()}")
33
34 expType = exp.GetIType()
35 expType: ic.IType
36 print(f"\tType name: {expType.TypeName()}")
37 print(f"\tType bit size: {expType.Type().m_byBitSize}")
38
39 childrensNames = []
40 children = rt.Children()
41 for index in range(children.size()):
42 chData = children.at(index)
43 chData: ic.IVariable
44 childrensNames.append(chData.Name())
45 print(f"\tChildrens: {childrensNames}\n")
46
47 finally:
48 dataCtrl2.release(rt)
49
50
51if __name__ == "__main__":
52 test_getExpressionType()