87/87 regression tests pass (was 86; +ffi-01-primitives).
vendors/ffi_primitives/{.h,.c} exposes a trivial identity roundtrip
per primitive C type — int/uint/short/ushort/long long/unsigned long
long/signed char/unsigned char/float/double/void* — plus two-arg
add helpers (int + double) for multi-arg ABI exercise. The sx-side
example imports the .h via `#import c { #include / #source }` and
prints each result; the snapshot in tests/expected pins today's
parameter + return ABI so Phase 1's #objc_call / #jni_call lowering
work can't silently regress primitive marshalling.
Two findings logged in current/CHECKPOINT-FFI.md's Known issues
section (current behavior, not new bugs): (1) c_import.zig maps
`signed char` -> `u8` not `s8`, and (2) sx integer-literal parser
rejects values >= 2^63 as overflow even when the receiver is u64.
Both worked around in this test without blocking the baseline.
14 lines
451 B
Plaintext
14 lines
451 B
Plaintext
ffi_id_int(-42) = -42
|
|
ffi_id_short(-1234) = -1234
|
|
ffi_id_s64(huge) = 9000000000000000000
|
|
ffi_id_uint(0xDEADBEEF) = 3735928559
|
|
ffi_id_ushort(0xFFFF) = 65535
|
|
ffi_id_u64(0x7FEE...) = 9218551421072305134
|
|
ffi_id_schar(127) = 127
|
|
ffi_id_uchar(255) = 255
|
|
ffi_id_f32(3.5) = 3.500000
|
|
ffi_id_f64(1.5) = 1.500000
|
|
ffi_id_ptr roundtrip = true
|
|
ffi_add_int(7, 8) = 15
|
|
ffi_add_double(0.25, 0.75) = 1.000000
|