From: Mark Thom Date: Sun, 10 Aug 2025 20:14:15 +0000 (-0700) Subject: Merge pull request #2786 from Skgland/ffi-f64-tests X-Git-Tag: v0.10.0~29 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=c0fb3fd4290ec3fe2a0e80ee4cf7b4393d289b71;p=scryer-prolog.git Merge pull request #2786 from Skgland/ffi-f64-tests add ffi tests & fix ffi --- c0fb3fd4290ec3fe2a0e80ee4cf7b4393d289b71 diff --cc src/machine/machine_errors.rs index c6836709,8fe536d9..f9b9318d --- a/src/machine/machine_errors.rs +++ b/src/machine/machine_errors.rs @@@ -603,24 -590,21 +603,30 @@@ impl MachineState } } + pub(super) fn unreachable_error(&self) -> MachineError { + let stub = functor!(atom!("system_error")); + + MachineError { + stub, + location: None, + } + } + #[cfg(feature = "ffi")] - pub(super) fn ffi_error(&self, err: FFIError) -> MachineError { + pub(super) fn ffi_error(&self, err: FfiError) -> MachineError { let error_atom = match err { - FFIError::ValueCast => atom!("value_cast"), - FFIError::ValueDontFit => atom!("value_dont_fit"), - FFIError::InvalidFFIType => atom!("invalid_ffi_type"), - FFIError::InvalidStructName => atom!("invalid_struct_name"), - FFIError::FunctionNotFound => atom!("function_not_found"), - FFIError::StructNotFound => atom!("struct_not_found"), + FfiError::ValueCast => atom!("value_cast"), + FfiError::ValueOutOfRange => atom!("value_out_of_range"), + FfiError::InvalidFfiType => atom!("invalid_ffi_type"), + FfiError::InvalidArgumentType => atom!("invalid_argument_type"), + FfiError::InvalidArgument => atom!("invalid_argument"), + FfiError::InvalidStruct => atom!("invalid_struct"), + FfiError::FunctionNotFound => atom!("function_not_found"), + FfiError::StructNotFound => atom!("struct_not_found"), + FfiError::ArgCountMismatch => atom!("mismatched_argument_count"), + FfiError::AllocationFailed => atom!("allocation_failed"), + FfiError::LayoutError => atom!("layout_error"), + FfiError::UnsupportedAbi => atom!("unsupported_abi"), }; let stub = functor!(atom!("ffi_error"), [atom_as_cell(error_atom)]);