Delphi 7 bindings generator for IBM System Object Model 2.1
Revision | 9867440701d4a19bae3db29047d4196ca8811550 (tree) |
---|---|
Zeit | 2016-10-27 21:42:54 |
Autor | Ivan Levashev <bo_ <gen@octa...> |
Commiter | Ivan Levashev <bo_ |
Left TODO for future; commented sources for testing TypeCode_size
@@ -2,9 +2,9 @@ | ||
2 | 2 | headers when using SOM emitters and being reinserted via "passthru" for C and |
3 | 3 | C++. So when we import these enums from SOM.IR, we get incorrect results. The |
4 | 4 | default enum size in SOM is 4 bytes and the count starts from 1. But these |
5 | -hacked enums start from 0, and what is worse, they seem to 1 byte, as this is | |
6 | -the default enum size in VAC. Also, some difference is found between SOM 2.1 | |
7 | -and SOM 3.0. This needs to be sorted out. | |
5 | +hacked enums start from 0, and what is worse, they seem to be 1 byte, as this | |
6 | +is the default enum size in VAC. Also, some difference is found between SOM | |
7 | +2.1 and SOM 3.0. This needs to be sorted out. | |
8 | 8 | |
9 | 9 | SOMTTypes is the usual enum, so checking on it. |
10 | 10 |
@@ -50,6 +50,41 @@ | ||
50 | 50 | o.somUninit; |
51 | 51 | end; |
52 | 52 | |
53 | +(* | |
54 | +function TypeCodeNew(tag: TCKind): TypeCode; cdecl; varargs; external 'somtc.dll' name 'tcNew'; | |
55 | + | |
56 | +procedure TestAlignmentAndSize; | |
57 | +var | |
58 | + MyTC: TypeCode; | |
59 | +begin | |
60 | + MyTC := TypeCodeNew(tk_struct, 'Test_1', | |
61 | + 'Byte', TypeCodeNew(tk_octet), | |
62 | + 'Integer', TypeCodeNew(tk_long), | |
63 | + nil); | |
64 | + WriteLn('Test_1 size: ', MyTC.Size); | |
65 | + MyTC.Free; | |
66 | + MyTC := TypeCodeNew(tk_struct, 'Test_2', | |
67 | + 'Byte', TypeCodeNew(tk_octet), | |
68 | + 'Subrecord', TypeCodeNew(tk_struct, 'Test_1', | |
69 | + 'Byte', TypeCodeNew(tk_octet), | |
70 | + 'Integer', TypeCodeNew(tk_long), | |
71 | + nil), | |
72 | + nil); | |
73 | + WriteLn('Test_2 size: ', MyTC.Size); | |
74 | + MyTC.Free; | |
75 | + MyTC := TypeCodeNew(tk_struct, 'Test_3', | |
76 | + 'Byte', TypeCodeNew(tk_octet), | |
77 | + 'Subrecord', TypeCodeNew(tk_struct, 'Test_4', | |
78 | + 'Byte', TypeCodeNew(tk_octet), | |
79 | + 'Byte', TypeCodeNew(tk_octet), | |
80 | + 'Integer', TypeCodeNew(tk_long), | |
81 | + nil), | |
82 | + nil); | |
83 | + WriteLn('Test_3 size: ', MyTC.Size); | |
84 | + MyTC.Free; | |
85 | +end; | |
86 | +*) | |
87 | + | |
53 | 88 | begin |
54 | 89 | try |
55 | 90 | WriteLn('Testing SOMObject v', SOM_MajorVersion, '.', SOM_MinorVersion); |
@@ -57,6 +92,7 @@ | ||
57 | 92 | SOMObject.NewClass; |
58 | 93 | TestSOM_Basic; |
59 | 94 | TestSOM_Renew; |
95 | + // TestAlignmentAndSize; | |
60 | 96 | except |
61 | 97 | on e: Exception do |
62 | 98 | WriteLn(GetTypeData(e.ClassInfo).UnitName + '.' + e.ClassName + ':' + e.Message); |
@@ -0,0 +1,5 @@ | ||
1 | +packed records and arrays to match SOM 2.1 ABI | |
2 | +InstanceSize, InitInstance and convert Create from class function to constructor | |
3 | +fix argument type in default assignment and copying constructor (implement Clone?) | |
4 | +make Supports return False if class is not created yet | |
5 | +memory management hints in arguments |