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

Python code coverage for Modules/_ctypes/libffi_osx/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#define FFI_INTEGRAL_TYPEDEF(n, s, a, t) \
31n/a ffi_type ffi_type_##n = { s, a, t, NULL }
32n/a#define FFI_AGGREGATE_TYPEDEF(n, e) \
33n/a ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e }
34n/a
35n/aFFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8);
36n/aFFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8);
37n/aFFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16);
38n/aFFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16);
39n/aFFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32);
40n/aFFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
41n/aFFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
42n/a
43n/a/* Size and alignment are fake here. They must not be 0. */
44n/aFFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID);
45n/a
46n/a#if defined ALPHA || defined SPARC64 || defined X86_64 || \
47n/a defined S390X || defined IA64 || defined POWERPC64
48n/aFFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
49n/a#else
50n/aFFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER);
51n/a#endif
52n/a
53n/a#if defined X86 || defined ARM || defined M68K || defined(X86_DARWIN)
54n/a
55n/a# ifdef X86_64
56n/a FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
57n/a FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
58n/a# else
59n/a FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
60n/a FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
61n/a# endif
62n/a
63n/a#elif defined(POWERPC_DARWIN)
64n/aFFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
65n/aFFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
66n/a#elif defined SH
67n/aFFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
68n/aFFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
69n/a#else
70n/aFFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
71n/aFFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
72n/a#endif
73n/a
74n/a#if defined X86 || defined X86_WIN32 || defined M68K || defined(X86_DARWIN)
75n/a
76n/a# if defined X86_WIN32 || defined X86_64
77n/a FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
78n/a# else
79n/a FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
80n/a# endif
81n/a
82n/a# ifdef X86_DARWIN
83n/a FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
84n/a# else
85n/a FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
86n/a# endif
87n/a
88n/a#elif defined ARM || defined SH || defined POWERPC_AIX
89n/aFFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
90n/aFFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
91n/a#elif defined POWERPC_DARWIN
92n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
93n/a
94n/a# if __GNUC__ >= 4
95n/a FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
96n/a# else
97n/a FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
98n/a# endif
99n/a
100n/a#elif defined SPARC
101n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
102n/a
103n/a# ifdef SPARC64
104n/a FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
105n/a# else
106n/a FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
107n/a# endif
108n/a
109n/a#elif defined X86_64 || defined POWERPC64
110n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
111n/aFFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
112n/a#else
113n/aFFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
114n/aFFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
115n/a#endif