]> Repositorios git - scryer-prolog.git/commitdiff
Merge pull request #2786 from Skgland/ffi-f64-tests
authorMark Thom <[email protected]>
Sun, 10 Aug 2025 20:14:15 +0000 (13:14 -0700)
committerGitHub <[email protected]>
Sun, 10 Aug 2025 20:14:15 +0000 (13:14 -0700)
add ffi tests & fix ffi

1  2 
Cargo.toml
src/machine/machine_errors.rs
src/machine/system_calls.rs
tests/scryer/main.rs

diff --cc Cargo.toml
Simple merge
index c6836709e89dcbd58d51f7de146095f6b5120f60,8fe536d9116616bade1f3b664a3c38b47185c0e4..f9b9318d3ee48e10294ec11c2d9a32e3823b92db
@@@ -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)]);
  
Simple merge
Simple merge