|
| 1 | + |
1 | 2 | // Auto-generated by geninterop.py. |
2 | | -// DO NOT MODIFIY BY HAND. |
| 3 | +// DO NOT MODIFY BY HAND. |
3 | 4 |
|
4 | 5 |
|
5 | 6 | #if PYTHON27 |
|
12 | 13 |
|
13 | 14 | namespace Python.Runtime |
14 | 15 | { |
15 | | - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] |
16 | | - internal class TypeOffset |
17 | | - { |
18 | | - static TypeOffset() |
19 | | - { |
20 | | - Type type = typeof(TypeOffset); |
21 | | - FieldInfo[] fi = type.GetFields(); |
22 | | - int size = IntPtr.Size; |
23 | | - for (int i = 0; i < fi.Length; i++) |
24 | | - { |
25 | | - fi[i].SetValue(null, i * size); |
26 | | - } |
27 | | - } |
28 | | - |
29 | | - public static int magic() |
30 | | - { |
31 | | - return ob_size; |
32 | | - } |
33 | 16 |
|
| 17 | + [StructLayout(LayoutKind.Sequential)] |
| 18 | + internal static partial class TypeOffset |
| 19 | + { |
34 | 20 | // Auto-generated from PyHeapTypeObject in Python.h |
35 | 21 | public static int ob_refcnt = 0; |
36 | 22 | public static int ob_type = 0; |
@@ -145,6 +131,94 @@ public static int magic() |
145 | 131 | /* here are optional user slots, followed by the members. */ |
146 | 132 | public static int members = 0; |
147 | 133 | } |
148 | | -} |
149 | 134 |
|
| 135 | + [StructLayout(LayoutKind.Sequential)] |
| 136 | + internal struct PyNumberMethods |
| 137 | + { |
| 138 | + public IntPtr nb_add; |
| 139 | + public IntPtr nb_subtract; |
| 140 | + public IntPtr nb_multiply; |
| 141 | + public IntPtr nb_divide; |
| 142 | + public IntPtr nb_remainder; |
| 143 | + public IntPtr nb_divmod; |
| 144 | + public IntPtr nb_power; |
| 145 | + public IntPtr nb_negative; |
| 146 | + public IntPtr nb_positive; |
| 147 | + public IntPtr nb_absolute; |
| 148 | + public IntPtr nb_nonzero; |
| 149 | + public IntPtr nb_invert; |
| 150 | + public IntPtr nb_lshift; |
| 151 | + public IntPtr nb_rshift; |
| 152 | + public IntPtr nb_and; |
| 153 | + public IntPtr nb_xor; |
| 154 | + public IntPtr nb_or; |
| 155 | + public IntPtr nb_coerce; |
| 156 | + public IntPtr nb_int; |
| 157 | + public IntPtr nb_long; |
| 158 | + public IntPtr nb_float; |
| 159 | + public IntPtr nb_oct; |
| 160 | + public IntPtr nb_hex; |
| 161 | + public IntPtr nb_inplace_add; |
| 162 | + public IntPtr nb_inplace_subtract; |
| 163 | + public IntPtr nb_inplace_multiply; |
| 164 | + public IntPtr nb_inplace_divide; |
| 165 | + public IntPtr nb_inplace_remainder; |
| 166 | + public IntPtr nb_inplace_power; |
| 167 | + public IntPtr nb_inplace_lshift; |
| 168 | + public IntPtr nb_inplace_rshift; |
| 169 | + public IntPtr nb_inplace_and; |
| 170 | + public IntPtr nb_inplace_xor; |
| 171 | + public IntPtr nb_inplace_or; |
| 172 | + public IntPtr nb_floor_divide; |
| 173 | + public IntPtr nb_true_divide; |
| 174 | + public IntPtr nb_inplace_floor_divide; |
| 175 | + public IntPtr nb_inplace_true_divide; |
| 176 | + public IntPtr nb_index; |
| 177 | + } |
| 178 | + |
| 179 | + [StructLayout(LayoutKind.Sequential)] |
| 180 | + internal struct PySequenceMethods |
| 181 | + { |
| 182 | + public IntPtr sq_length; |
| 183 | + public IntPtr sq_concat; |
| 184 | + public IntPtr sq_repeat; |
| 185 | + public IntPtr sq_item; |
| 186 | + public IntPtr sq_slice; |
| 187 | + public IntPtr sq_ass_item; |
| 188 | + public IntPtr sq_ass_slice; |
| 189 | + public IntPtr sq_contains; |
| 190 | + public IntPtr sq_inplace_concat; |
| 191 | + public IntPtr sq_inplace_repeat; |
| 192 | + } |
| 193 | + |
| 194 | + [StructLayout(LayoutKind.Sequential)] |
| 195 | + internal struct PyMappingMethods |
| 196 | + { |
| 197 | + public IntPtr mp_length; |
| 198 | + public IntPtr mp_subscript; |
| 199 | + public IntPtr mp_ass_subscript; |
| 200 | + } |
| 201 | + |
| 202 | + [StructLayout(LayoutKind.Sequential)] |
| 203 | + internal struct PyBufferProcs |
| 204 | + { |
| 205 | + public IntPtr bf_getreadbuffer; |
| 206 | + public IntPtr bf_getwritebuffer; |
| 207 | + public IntPtr bf_getsegcount; |
| 208 | + public IntPtr bf_getcharbuffer; |
| 209 | + public IntPtr bf_getbuffer; |
| 210 | + public IntPtr bf_releasebuffer; |
| 211 | + } |
| 212 | + |
| 213 | + internal static partial class SlotTypes |
| 214 | + { |
| 215 | + public static readonly Type[] Types = { |
| 216 | + typeof(PyNumberMethods), |
| 217 | + typeof(PySequenceMethods), |
| 218 | + typeof(PyMappingMethods), |
| 219 | + typeof(PyBufferProcs), |
| 220 | + }; |
| 221 | + } |
| 222 | + |
| 223 | +} |
150 | 224 | #endif |
0 commit comments