use core::ffi::c_void;
pub type BOOL = i32;
pub type XCHAR = u16;
pub type RW = i32;
pub type COL = i32;
pub type IDSHEET = usize;
pub type BYTE = u8;
pub type WORD = u16;
pub type HANDLE = *mut c_void;
pub type LPXLREF12 = *mut XLREF12;
pub type LPXLMREF12 = *mut XLMREF12;
pub type LPFP12 = *mut FP12;
pub type LPXLOPER12 = *mut XLOPER12;
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct XLREF12 {
pub rwFirst: RW,
pub rwLast: RW,
pub colFirst: COL,
pub colLast: COL,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct XLMREF12 {
pub count: WORD,
pub reftbl: [XLREF12; 1],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct FP12 {
pub rows: i32,
pub columns: i32,
pub array: [f64; 1],
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct XLOPER12SRef {
pub count: WORD,
pub reference: XLREF12,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct XLOPER12MRef {
pub lpmref: LPXLMREF12,
pub idSheet: IDSHEET,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct XLOPER12Array {
pub lparray: LPXLOPER12,
pub rows: RW,
pub columns: COL,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union XLOPER12FlowValue {
pub level: i32,
pub tbctrl: i32,
pub idSheet: IDSHEET,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct XLOPER12Flow {
pub valflow: XLOPER12FlowValue,
pub rw: RW,
pub col: COL,
pub xlflow: BYTE,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union XLOPER12BigDataHandle {
pub lpbData: *mut BYTE,
pub hdata: HANDLE,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct XLOPER12BigData {
pub h: XLOPER12BigDataHandle,
pub cbData: i32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union XLOPER12Value {
pub num: f64,
pub str: *mut XCHAR,
pub xbool: BOOL,
pub err: i32,
pub w: i32,
pub sref: XLOPER12SRef,
pub mref: XLOPER12MRef,
pub array: XLOPER12Array,
pub flow: XLOPER12Flow,
pub bigdata: XLOPER12BigData,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct XLOPER12 {
pub val: XLOPER12Value,
pub xltype: u32,
}
#[cfg(test)]
mod tests {
use core::mem::{align_of, offset_of, size_of};
use super::*;
#[test]
fn fixed_width_primitives_match_the_sdk() {
assert_eq!(size_of::<BOOL>(), 4);
assert_eq!(size_of::<XCHAR>(), 2);
assert_eq!(size_of::<RW>(), 4);
assert_eq!(size_of::<COL>(), 4);
assert_eq!(size_of::<IDSHEET>(), size_of::<usize>());
}
#[test]
fn flexible_array_headers_preserve_one_c_element() {
assert_eq!(offset_of!(XLMREF12, reftbl), 4);
assert_eq!(size_of::<XLMREF12>(), 20);
assert_eq!(offset_of!(FP12, array), 8);
assert_eq!(size_of::<FP12>(), 16);
}
#[cfg(all(target_os = "windows", target_arch = "x86_64"))]
#[test]
fn xloper12_has_windows_x64_sdk_layout() {
assert_eq!(size_of::<XLOPER12Value>(), 24);
assert_eq!(align_of::<XLOPER12Value>(), 8);
assert_eq!(offset_of!(XLOPER12, val), 0);
assert_eq!(offset_of!(XLOPER12, xltype), 24);
assert_eq!(size_of::<XLOPER12>(), 32);
assert_eq!(align_of::<XLOPER12>(), 8);
}
}