use crate::stack::{Stack, peek, pop};
use crate::value::Value;
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_peek_int_value(stack: Stack) -> i64 {
assert!(!stack.is_null(), "peek_int_value: stack is empty");
let val = unsafe { peek(stack) };
match val {
Value::Int(i) => i,
other => panic!("peek_int_value: expected Int on stack, got {:?}", other),
}
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_peek_bool_value(stack: Stack) -> bool {
assert!(!stack.is_null(), "peek_bool_value: stack is empty");
let val = unsafe { peek(stack) };
match val {
Value::Bool(b) => b,
other => panic!("peek_bool_value: expected Bool on stack, got {:?}", other),
}
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_pop_stack(stack: Stack) -> Stack {
assert!(!stack.is_null(), "pop_stack: stack is empty");
let (rest, _value) = unsafe { pop(stack) };
rest
}