1 |
14 |
jlechner |
/* -----------------------------------------------------------------------
|
2 |
|
|
types.c - Copyright (c) 1996, 1998 Red Hat, Inc.
|
3 |
|
|
|
4 |
|
|
Predefined ffi_types needed by libffi.
|
5 |
|
|
|
6 |
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
7 |
|
|
a copy of this software and associated documentation files (the
|
8 |
|
|
``Software''), to deal in the Software without restriction, including
|
9 |
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
10 |
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
11 |
|
|
permit persons to whom the Software is furnished to do so, subject to
|
12 |
|
|
the following conditions:
|
13 |
|
|
|
14 |
|
|
The above copyright notice and this permission notice shall be included
|
15 |
|
|
in all copies or substantial portions of the Software.
|
16 |
|
|
|
17 |
|
|
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
18 |
|
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19 |
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20 |
|
|
IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
21 |
|
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22 |
|
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
|
|
OTHER DEALINGS IN THE SOFTWARE.
|
24 |
|
|
----------------------------------------------------------------------- */
|
25 |
|
|
|
26 |
|
|
#include <ffi.h>
|
27 |
|
|
#include <ffi_common.h>
|
28 |
|
|
|
29 |
|
|
/* Type definitions */
|
30 |
|
|
|
31 |
|
|
#define FFI_TYPEDEF(name, type, id) \
|
32 |
|
|
struct struct_align_##name { \
|
33 |
|
|
char c; \
|
34 |
|
|
type x; \
|
35 |
|
|
}; \
|
36 |
|
|
ffi_type ffi_type_##name = { \
|
37 |
|
|
sizeof(type), \
|
38 |
|
|
offsetof(struct struct_align_##name, x), \
|
39 |
|
|
id, NULL \
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
/* Size and alignment are fake here. They must not be 0. */
|
43 |
|
|
ffi_type ffi_type_void = {
|
44 |
|
|
1, 1, FFI_TYPE_VOID, NULL
|
45 |
|
|
};
|
46 |
|
|
|
47 |
|
|
FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8);
|
48 |
|
|
FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8);
|
49 |
|
|
FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16);
|
50 |
|
|
FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16);
|
51 |
|
|
FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32);
|
52 |
|
|
FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32);
|
53 |
|
|
FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64);
|
54 |
|
|
FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64);
|
55 |
|
|
|
56 |
|
|
FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER);
|
57 |
|
|
|
58 |
|
|
FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT);
|
59 |
|
|
FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE);
|
60 |
|
|
FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE);
|