ยปCore Development>Code coverage>Modules/_ctypes/libffi_msvc/types.c

Python code coverage for Modules/_ctypes/libffi_msvc/types.c

#countcontent
1n/a/* -----------------------------------------------------------------------
2n/a types.c - Copyright (c) 1996, 1998 Red Hat, Inc.
3n/a
4n/a Predefined ffi_types needed by libffi.
5n/a
6n/a Permission is hereby granted, free of charge, to any person obtaining
7n/a a copy of this software and associated documentation files (the
8n/a ``Software''), to deal in the Software without restriction, including
9n/a without limitation the rights to use, copy, modify, merge, publish,
10n/a distribute, sublicense, and/or sell copies of the Software, and to
11n/a permit persons to whom the Software is furnished to do so, subject to
12n/a the following conditions:
13n/a
14n/a The above copyright notice and this permission notice shall be included
15n/a in all copies or substantial portions of the Software.
16n/a
17n/a THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18n/a OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19n/a MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20n/a IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21n/a OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22n/a ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23n/a OTHER DEALINGS IN THE SOFTWARE.
24n/a ----------------------------------------------------------------------- */
25n/a
26n/a#include <ffi.h>
27n/a#include <ffi_common.h>
28n/a
29n/a/* Type definitions */
30n/a
31n/a#define FFI_INTEGRAL_TYPEDEF(n, s, a, t) ffi_type ffi_type_##n = { s, a, t, NULL }
32n/a#define FFI_AGGREGATE_TYPEDEF(n, e) ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e }
33n/a
34n/a/* Size and alignment are fake here. They must not be 0. */
35n/aFFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID);
36n/a
37n/aFFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8);
38n/aFFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8);
39n/aFFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16);
40n/aFFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16);
41n/aFFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32);
42n/aFFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
43n/aFFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
44n/a
45n/a#if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \
46n/a || defined IA64 || defined _WIN64
47n/a
48n/aFFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
49n/a
50n/a#else
51n/a
52n/aFFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER);
53n/a
54n/a#endif
55n/a
56n/a#if defined X86 || defined X86_WIN32 || defined ARM || defined M68K
57n/a
58n/aFFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
59n/aFFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
60n/a
61n/a#elif defined SH
62n/a
63n/aFFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
64n/aFFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
65n/a
66n/a#else
67n/a
68n/aFFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
69n/aFFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
70n/a
71n/a#endif
72n/a
73n/a
74n/a#if defined X86 || defined X86_WIN32 || defined M68K
75n/a
76n/aFFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
77n/aFFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
78n/a
79n/a#elif defined ARM || defined SH || defined POWERPC_AIX || defined POWERPC_DARWIN
80n/a
81n/aFFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
82n/aFFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
83n/a
84n/a#elif defined SPARC
85n/a
86n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
87n/a#ifdef SPARC64
88n/aFFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
89n/a#else
90n/aFFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
91n/a#endif
92n/a
93n/a#elif defined X86_64
94n/a
95n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
96n/aFFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
97n/a
98n/a#else
99n/a
100n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
101n/aFFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
102n/a
103n/a#endif
104n/a