use crate::{c, cstr, fcstr, get_scalar, get_varr, init_scalar, malloc, mallocstr, mptr};
use spice_derive::{cspice_proc, return_output};
use std::ops::{Deref, DerefMut};
#[cfg(any(feature = "lock", doc))]
use {crate::core::lock::SpiceLock, spice_derive::impl_for};
#[allow(clippy::upper_case_acronyms)]
pub type DLADSC = c::SpiceDLADescr;
#[allow(clippy::upper_case_acronyms)]
pub type DSKDSC = c::SpiceDSKDescr;
#[allow(clippy::upper_case_acronyms)]
pub type CELL = c::SpiceCell;
pub const CELL_MAXID: usize = 10_000;
#[derive(Debug)]
pub struct Cell(c::SpiceCell);
impl Cell {
pub fn new_int() -> Self {
let base = malloc!(i32, CELL_MAXID + c::SPICE_CELL_CTRLSZ as usize);
Self(CELL {
dtype: c::_SpiceDataType_SPICE_INT,
length: 0i32,
size: CELL_MAXID as i32,
card: 0i32,
isSet: 1i32,
adjust: 0i32,
init: 0i32,
base: base as *mut libc::c_void,
data: base.wrapping_add(c::SPICE_CELL_CTRLSZ as usize) as *mut libc::c_void,
})
}
pub fn get_data_int(&self, index: usize) -> i32 {
unsafe { *(self.data as *mut i32).wrapping_add(index) }
}
}
impl Deref for Cell {
type Target = c::SpiceCell;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for Cell {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
cspice_proc! {
pub fn bodc2n(code: i32, lenout: i32) -> (String, bool) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bodfnd(body: i32, item: &str) -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bodn2c(name: &str) -> (i32, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dascls(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasopr(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlabfs(handle: i32) -> (DLADSC, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskgd(handle: i32, dladsc: DLADSC) -> DSKDSC {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskn02(handle: i32, dladsc: DLADSC, plid: i32) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskobj(dsk: &str) -> Cell {}
}
pub fn dskp02(handle: i32, mut dladsc: DLADSC, start: i32, room: i32) -> (i32, Vec<[i32; 3]>) {
let mut varout_0 = init_scalar!();
let varout_1 = malloc!([i32; 3], room);
unsafe {
crate::c::dskp02_c(handle, &mut dladsc, start, room, mptr!(varout_0), varout_1);
(
get_scalar!(varout_0),
get_varr!(varout_1, get_scalar!(varout_0)),
)
}
}
pub fn dskv02(handle: i32, mut dladsc: DLADSC, start: i32, room: i32) -> (i32, Vec<[f64; 3]>) {
let mut varout_0 = init_scalar!();
let varout_1 = malloc!([f64; 3], room);
unsafe {
crate::c::dskv02_c(handle, &mut dladsc, start, room, mptr!(varout_0), varout_1);
(
get_scalar!(varout_0),
get_varr!(varout_1, get_scalar!(varout_0)),
)
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskx02(
handle: i32,
dladsc: DLADSC,
vertex: [f64; 3],
raydir: [f64; 3]
) -> (i32, [f64; 3], bool) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskz02(handle: i32, dladsc: DLADSC) -> (i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn georec(lon: f64, lat: f64, alt: f64, re: f64, f: f64) -> [f64; 3] {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn illumf(
method: &str,
target: &str,
ilusrc: &str,
et: f64,
fixref: &str,
abcorr: &str,
obsrvr: &str,
spoint: [f64; 3]
) -> (f64, [f64; 3], f64, f64, f64, bool, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn furnsh(name: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn kclear() {}
}
pub fn kdata(
which: i32,
kind: &str,
fillen: i32,
typlen: i32,
srclen: i32,
) -> (String, String, String, i32, bool) {
#[allow(unused_unsafe)]
unsafe {
let varout_0 = mallocstr!(fillen);
let varout_1 = mallocstr!(typlen);
let varout_2 = mallocstr!(srclen);
let mut varout_3 = 0i32;
let mut varout_4 = 0i32;
crate::c::kdata_c(
which,
cstr!(kind),
fillen,
typlen,
srclen,
varout_0,
varout_1,
varout_2,
&mut varout_3,
&mut varout_4,
);
(
fcstr!(varout_0),
fcstr!(varout_1),
fcstr!(varout_2),
varout_3,
varout_4 != 0,
)
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ktotal(kind: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn latrec(radius: f64, longitude: f64, latitude: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mxv(m1: [[f64; 3]; 3], vin: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn occult(
targ1: &str,
shape1: &str,
frame1: &str,
targ2: &str,
shape2: &str,
frame2: &str,
abcorr: &str,
obsrvr: &str,
et: f64,
) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pxform(from: &str, to: &str, et: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pxfrm2(from: &str, to: &str, etfrom: f64, etto: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn radrec(range: f64, ra: f64, dec: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn recrad(rectan: [f64; 3]) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkcls(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkopn(fname: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkw09(handle: i32, body: i32, center: i32, frame: &str, first: f64, last: f64, segid: &str, degree: i32, n: i32, states: &mut [[f64; 6]], epochs: &mut [f64]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkpos(targ: &str, et: f64, frame: &str, abcorr: &str, obs: &str) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkezr(targ: &str, et: f64, frame: &str, abcorr: &str, obs: &str) -> ([f64; 6], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn str2et(targ: &str) -> f64 {}
}
pub fn timout(et: f64, pictur: &str, lenout: usize) -> String {
let varout_0 = mallocstr!(lenout);
unsafe {
crate::c::timout_c(et, cstr!(pictur), lenout as i32, varout_0);
}
fcstr!(varout_0)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn unload(name: &str) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vsep(v1: [f64; 3], v2: [f64; 3]) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vdot(v1: [f64; 3], v2: [f64; 3]) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vcrss(v1: [f64; 3], v2: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xpose(m1: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}