Landin library reference source

platform/c/c.ldn

1--  The selected SysV, Darwin, standard AAPCS64 or RISC-V LP64D C scalar
2--  spelling layer. These are ordinary aliases, not distinct scalar kinds: an
3--  extern(c) signature keeps the same Landin scalar identity that its C
4--  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 and RISC-V LP64D.
9
10--  landin/compiler is implicit. The ABI fact, not pointer width or
11--  architecture alone, keeps LP64 aliases from crossing data models.
12compiler.assert(compiler.c_sysv_lp64 or compiler.c_darwin_lp64
13                or compiler.c_aapcs64_lp64 or compiler.c_riscv_lp64d)
14
15fixed if compiler.c_aapcs64_lp64 or compiler.c_riscv_lp64d then
16    --- The selected ABI's plain C char: unsigned under standard AAPCS64 and
17    --- RISC-V LP64D, signed under SysV and Darwin LP64. A numeric byte, not a
18    --- Unicode scalar.
19    public c_char: type = u8
20else
21    --- The selected ABI's plain C char: unsigned under standard AAPCS64 and
22    --- RISC-V LP64D, signed under SysV and Darwin LP64. A numeric byte, not a
23    --- Unicode scalar.
24    public c_char: type = i8
25end if
26--- Alias for C signed char under the supported LP64 ABIs.
27public c_schar: type = i8
28--- Alias for C unsigned char under the supported LP64 ABIs.
29public c_uchar: type = u8
30--- Alias for C signed short under the supported LP64 ABIs.
31public c_short: type = i16
32--- Alias for C unsigned short under the supported LP64 ABIs.
33public c_ushort: type = u16
34--- Alias for C signed int under the supported LP64 ABIs.
35public c_int: type = i32
36--- Alias for C unsigned int under the supported LP64 ABIs.
37public c_uint: type = u32
38--- Alias for C signed long under the supported LP64 ABIs.
39public c_long: type = i64
40--- Alias for C unsigned long under the supported LP64 ABIs.
41public c_ulong: type = u64
42--- Alias for C signed long long under the supported LP64 ABIs.
43public c_longlong: type = i64
44--- Alias for C unsigned long long under the supported LP64 ABIs.
45public c_ulonglong: type = u64
46--- Alias for C size_t under the supported LP64 ABIs.
47public c_size: type = usize
48--- Alias for C ptrdiff_t under the supported LP64 ABIs.
49public c_ptrdiff: type = isize
50--- Alias for C float under the supported LP64 ABIs.
51public c_float: type = f32
52--- Alias for C double under the supported LP64 ABIs.
53public c_double: type = f64
54--- Alias for C _Bool under the supported LP64 ABIs.
55public c_bool: type = bool