Ruby
1.9.3p392(2013-02-22revision39386)
Main Page
Modules
Data Structures
Files
File List
Globals
ext
fiddle
fiddle.h
Go to the documentation of this file.
1
#ifndef FIDDLE_H
2
#define FIDDLE_H
3
4
#include <ruby.h>
5
#include <errno.h>
6
7
#if defined(_WIN32)
8
#include <windows.h>
9
#endif
10
11
#ifdef HAVE_SYS_MMAN_H
12
#include <sys/mman.h>
13
#endif
14
15
#ifdef USE_HEADER_HACKS
16
#include <ffi/ffi.h>
17
#else
18
#include <ffi.h>
19
#endif
20
21
#undef ffi_type_uchar
22
#undef ffi_type_schar
23
#undef ffi_type_ushort
24
#undef ffi_type_sshort
25
#undef ffi_type_uint
26
#undef ffi_type_sint
27
#undef ffi_type_ulong
28
#undef ffi_type_slong
29
30
#if CHAR_BIT == 8
31
# define ffi_type_uchar ffi_type_uint8
32
# define ffi_type_schar ffi_type_sint8
33
#else
34
# error "CHAR_BIT not supported"
35
#endif
36
37
# if SIZEOF_SHORT == 2
38
# define ffi_type_ushort ffi_type_uint16
39
# define ffi_type_sshort ffi_type_sint16
40
# elif SIZEOF_SHORT == 4
41
# define ffi_type_ushort ffi_type_uint32
42
# define ffi_type_sshort ffi_type_sint32
43
# else
44
# error "short size not supported"
45
# endif
46
47
# if SIZEOF_INT == 2
48
# define ffi_type_uint ffi_type_uint16
49
# define ffi_type_sint ffi_type_sint16
50
# elif SIZEOF_INT == 4
51
# define ffi_type_uint ffi_type_uint32
52
# define ffi_type_sint ffi_type_sint32
53
# elif SIZEOF_INT == 8
54
# define ffi_type_uint ffi_type_uint64
55
# define ffi_type_sint ffi_type_sint64
56
# else
57
# error "int size not supported"
58
# endif
59
60
# if SIZEOF_LONG == 4
61
# define ffi_type_ulong ffi_type_uint32
62
# define ffi_type_slong ffi_type_sint32
63
# elif SIZEOF_LONG == 8
64
# define ffi_type_ulong ffi_type_uint64
65
# define ffi_type_slong ffi_type_sint64
66
# else
67
# error "long size not supported"
68
# endif
69
70
#if HAVE_LONG_LONG
71
# if SIZEOF_LONG_LONG == 8
72
# define ffi_type_slong_long ffi_type_sint64
73
# define ffi_type_ulong_long ffi_type_uint64
74
# else
75
# error "long long size not supported"
76
# endif
77
#endif
78
79
#include <
closure.h
>
80
#include <
conversions.h
>
81
#include <
function.h
>
82
83
/* FIXME
84
* These constants need to match up with DL. We need to refactor this to use
85
* the DL header files or vice versa.
86
*/
87
88
#define TYPE_VOID 0
89
#define TYPE_VOIDP 1
90
#define TYPE_CHAR 2
91
#define TYPE_SHORT 3
92
#define TYPE_INT 4
93
#define TYPE_LONG 5
94
#if HAVE_LONG_LONG
95
#define TYPE_LONG_LONG 6
96
#endif
97
#define TYPE_FLOAT 7
98
#define TYPE_DOUBLE 8
99
100
extern
VALUE
mFiddle
;
101
102
#endif
103
/* vim: set noet sws=4 sw=4: */
104
Generated on Tue Feb 26 2013 08:42:55 for Ruby by
1.8.3