1-- The selected SysV, Darwin, standard AAPCS64, RISC-V LP64D, Cortex-M
2-- AAPCS32, Windows x64 or Windows arm64 C scalar spelling layer. These are ordinary aliases, not distinct
3-- scalar kinds: an extern(c) signature keeps the same Landin scalar identity
4-- that its C spelling names.
5--
6-- c_char is the selected ABI's plain char, a numeric byte and never Landin's
7-- Unicode scalar u32: signed i8 under SysV and Apple's arm64 ABI, and
8-- unsigned u8 under standard AAPCS64, RISC-V LP64D and AAPCS32; signed
9-- under Windows x64 and Windows arm64 as under SysV.
10--
11-- Four ABIs are LP64, whose long is 64 bits. AAPCS32 is ILP32 (D921): int,
12-- long, size_t and pointers are all 32 bits, and long long 64. Windows x64
13-- and Windows arm64 are LLP64: long is 32 bits beside 64-bit pointers and
14-- size_t.
15
16-- landin/compiler is implicit. The ABI fact, not pointer width or
17-- architecture alone, keeps the aliases from crossing data models.
18compiler.assert(compiler.c_sysv_lp64 or compiler.c_darwin_lp64
19 or compiler.c_aapcs64_lp64 or compiler.c_riscv_lp64d
20 or compiler.c_aapcs32 or compiler.c_win64_llp64
21 or compiler.c_windows_arm64_llp64)
22
23fixed if compiler.c_aapcs64_lp64 or compiler.c_riscv_lp64d
24 or compiler.c_aapcs32 then
25 --- The selected ABI's plain C char: unsigned under standard AAPCS64,
26 --- RISC-V LP64D and AAPCS32, signed under SysV and Darwin LP64. A numeric
27 --- byte, not a Unicode scalar.
28 public c_char: type = u8
29else
30 --- The selected ABI's plain C char: unsigned under standard AAPCS64,
31 --- RISC-V LP64D and AAPCS32, signed under SysV and Darwin LP64. A numeric
32 --- byte, not a Unicode scalar.
33 public c_char: type = i8
34end if
35--- Alias for C signed char under every supported ABI.
36public c_schar: type = i8
37--- Alias for C unsigned char under every supported ABI.
38public c_uchar: type = u8
39--- Alias for C signed short under every supported ABI.
40public c_short: type = i16
41--- Alias for C unsigned short under every supported ABI.
42public c_ushort: type = u16
43--- Alias for C signed int under every supported ABI.
44public c_int: type = i32
45--- Alias for C unsigned int under every supported ABI.
46public c_uint: type = u32
47fixed if compiler.c_aapcs32 or compiler.c_win64_llp64
48 or compiler.c_windows_arm64_llp64 then
49 --- Alias for C signed long: 32 bits under AAPCS32's ILP32 and the
50 --- LLP64 of both Windows ABIs, 64 under the LP64 ABIs.
51 public c_long: type = i32
52 --- Alias for C unsigned long: 32 bits under AAPCS32's ILP32 and the
53 --- LLP64 of both Windows ABIs, 64 under the LP64 ABIs.
54 public c_ulong: type = u32
55else
56 --- Alias for C signed long: 32 bits under AAPCS32's ILP32 and the
57 --- LLP64 of both Windows ABIs, 64 under the LP64 ABIs.
58 public c_long: type = i64
59 --- Alias for C unsigned long: 32 bits under AAPCS32's ILP32 and the
60 --- LLP64 of both Windows ABIs, 64 under the LP64 ABIs.
61 public c_ulong: type = u64
62end if
63--- Alias for C signed long long under every supported ABI.
64public c_longlong: type = i64
65--- Alias for C unsigned long long under every supported ABI.
66public c_ulonglong: type = u64
67--- Alias for C size_t under every supported ABI: the target's usize, 32 bits
68--- under AAPCS32.
69public c_size: type = usize
70--- Alias for C ptrdiff_t under every supported ABI: the target's isize, 32
71--- bits under AAPCS32.
72public c_ptrdiff: type = isize
73--- Alias for C float under every supported ABI.
74public c_float: type = f32
75--- Alias for C double under every supported ABI.
76public c_double: type = f64
77--- Alias for C _Bool under every supported ABI.
78public c_bool: type = bool