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