use core::ffi::c_int;

pub type __jmp_buf = [usize; 8];
pub type __sigjmp_buf = [usize; 8];

// TODO

#[no_mangle]
#[unsafe(naked)]
unsafe extern "C" fn sigsetjmp(buf: *mut __sigjmp_buf, savesigs: c_int) -> c_int {
    core::arch::naked_asm!("j .")
}

#[no_mangle]
#[unsafe(naked)]
unsafe extern "C" fn setjmp(buf: *mut __jmp_buf) -> c_int {
    core::arch::naked_asm!(
        r#"
        j .
    "#
    );
}

#[no_mangle]
#[unsafe(naked)]
unsafe extern "C" fn _setjmp(buf: *mut __jmp_buf) -> c_int {
    core::arch::naked_asm!("j .");
}

#[no_mangle]
#[unsafe(naked)]
unsafe extern "C" fn longjmp(buf: *mut __jmp_buf, val: c_int) -> c_int {
    core::arch::naked_asm!(
        r#"
        j .
    "#
    )
}

#[no_mangle]
#[unsafe(naked)]
unsafe extern "C" fn siglongjmp(buf: *mut __sigjmp_buf, val: c_int) -> ! {
    core::arch::naked_asm!("j .")
}

#[no_mangle]
#[unsafe(naked)]
unsafe extern "C" fn _longjmp(buf: *mut __jmp_buf, val: c_int) -> c_int {
    core::arch::naked_asm!("j .")
}
