forked from Papierkorb/bindgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builtin_types.yml
107 lines (94 loc) · 4.75 KB
/
builtin_types.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Built-in types for Bindgen.
# Describes sane defaults to map built-in C/C++ types to Crystal.
void: { binding_type: Void, kind: Struct, builtin: true }
# Boolean type
_Bool: { binding_type: Bool, crystal_type: Bool, cpp_type: bool, kind: Struct, builtin: true }
bool: { binding_type: Bool, crystal_type: Bool, cpp_type: bool, kind: Struct, builtin: true }
# Integer types
char: { binding_type: UInt8, kind: Struct, builtin: true }
"unsigned char": { binding_type: UInt8, kind: Struct, builtin: true }
short: { binding_type: Int16, kind: Struct, builtin: true }
"unsigned short": { binding_type: UInt16, kind: Struct, builtin: true }
int: { binding_type: Int32, kind: Struct, builtin: true }
unsigned: { binding_type: UInt32, kind: Struct, builtin: true }
"unsigned int": { binding_type: UInt32, kind: Struct, builtin: true }
_Int: { binding_type: Int, crystal_type: Int, cpp_type: int, kind: Struct, builtin: true }
# Long types
"long": { binding_type: "LibC::Long", kind: Struct, builtin: true }
"long int": { binding_type: "LibC::Long", kind: Struct, builtin: true }
"long long": { binding_type: "LibC::LongLong", kind: Struct, builtin: true }
"long long int": { binding_type: "LibC::LongLong", kind: Struct, builtin: true }
"unsigned long": { binding_type: "LibC::ULong", kind: Struct, builtin: true }
"unsigned long int": { binding_type: "LibC::ULong", kind: Struct, builtin: true }
"unsigned long long": { binding_type: "LibC::ULongLong", kind: Struct, builtin: true }
"unsigned long long int": { binding_type: "LibC::ULongLong", kind: Struct, builtin: true }
int8_t: { binding_type: Int8, kind: Struct, builtin: true }
int16_t: { binding_type: Int16, kind: Struct, builtin: true }
int32_t: { binding_type: Int32, kind: Struct, builtin: true }
int64_t: { binding_type: Int64, kind: Struct, builtin: true }
uint8_t: { binding_type: UInt8, kind: Struct, builtin: true }
uint16_t: { binding_type: UInt16, kind: Struct, builtin: true }
uint32_t: { binding_type: UInt32, kind: Struct, builtin: true }
uint64_t: { binding_type: UInt64, kind: Struct, builtin: true }
size_t: { binding_type: "LibC::SizeT", kind: Struct, builtin: true }
ssize_t: { binding_type: "LibC::SSizeT", kind: Struct, builtin: true }
# Float types
float: { binding_type: Float32, kind: Struct, builtin: true }
double: { binding_type: Float64, kind: Struct, builtin: true }
# C++ STL
"std::string":
builtin: true
kind: Struct
opaque: true
pass_by: Value
wrapper_pass_by: Value
crystal_type: String
cpp_type: CrystalString
binding_type: CrystalString
to_cpp: "bindgen_crystal_to_stdstring(%)"
from_cpp: "bindgen_stdstring_to_crystal(%)"
from_crystal: "Binding::CrystalString.new(ptr: %.to_unsafe, size: %.bytesize)"
to_crystal: "String.new(%.ptr, %.size)"
# Qt specific types
uchar: { binding_type: UInt8, kind: Struct, builtin: true }
ushort: { binding_type: UInt16, kind: Struct, builtin: true }
uint: { binding_type: UInt32, kind: Struct, builtin: true }
if_os_is_windows: # LLP64
ulong: { binding_type: UInt32, kind: Struct, builtin: true }
else: # LP64
ulong: { binding_type: UInt64, kind: Struct, builtin: true }
ulonglong: { binding_type: UInt64, kind: Struct, builtin: true }
if_pointersize_is_32:
qptrdiff: { binding_type: Int32, kind: Struct, builtin: true }
qintptr: { binding_type: Int32, kind: Struct, builtin: true }
quintptr: { binding_type: UInt32, kind: Struct, builtin: true }
else:
qptrdiff: { binding_type: Int64, kind: Struct, builtin: true }
qintptr: { binding_type: Int64, kind: Struct, builtin: true }
quintptr: { binding_type: UInt64, kind: Struct, builtin: true }
quint8: { binding_type: UInt8, kind: Struct, builtin: true }
quint16: { binding_type: UInt16, kind: Struct, builtin: true }
quint32: { binding_type: UInt32, kind: Struct, builtin: true }
quint64: { binding_type: UInt64, kind: Struct, builtin: true }
qulonglong: { binding_type: UInt64, kind: Struct, builtin: true }
qint8: { binding_type: Int8, kind: Struct, builtin: true }
qint16: { binding_type: Int16, kind: Struct, builtin: true }
qint32: { binding_type: Int32, kind: Struct, builtin: true }
qint64: { binding_type: Int64, kind: Struct, builtin: true }
qlonglong: { binding_type: Int64, kind: Struct, builtin: true }
qsizetype: { binding_type: "LibC::SizeT", kind: Struct, builtin: true } # Since Qt5.10
if_architecture_is_arm: # Only Float32 on ARM
qreal: { binding_type: Float32, kind: Struct, builtin: true }
elsif_architecture_is_armhf:
qreal: { binding_type: Float32, kind: Struct, builtin: true }
else: # Float64 on everything else
qreal: { binding_type: Float64, kind: Struct, builtin: true }
# Bindgen specific
CrystalProc:
wrapper_type: Proc
binding_type: CrystalProc
kind: Struct
builtin: true # We don't want a binding alias for this.
pass_by: Value
wrapper_pass_by: Value
from_crystal: "BindgenHelper.wrap_proc(%)"