use crate::c::{SpiceChar, SpiceDouble, SpiceInt};
use crate::core::cell::{Cell, CellItem};
use crate::core::ffi::{from_cbuf, from_strided, to_cstring, to_strided};
use crate::core::ffi::{UdBail, UdFunb, UdFunc, UdFuns, UdRefn, UdRepf, UdRepi, UdRepu, UdStep};
use spice_derive::cspice_proc;
#[cfg(any(feature = "lock", doc))]
use {crate::core::lock::SpiceLock, spice_derive::impl_for};
#[allow(clippy::upper_case_acronyms)]
pub type DLADSC = crate::c::SpiceDLADescr;
#[allow(clippy::upper_case_acronyms)]
pub type DSKDSC = crate::c::SpiceDSKDescr;
#[allow(clippy::upper_case_acronyms)]
pub type PLANE = crate::c::SpicePlane;
#[allow(clippy::upper_case_acronyms)]
pub type ELLIPSE = crate::c::SpiceEllipse;
#[allow(clippy::upper_case_acronyms, dead_code)]
pub type CELL = crate::c::SpiceCell;
cspice_proc! {
pub fn bodc2n(code: i32, #[lenout] lenout: i32) -> (String, bool) {}
}
cspice_proc! {
pub fn bodc2s(code: i32, #[lenout] lenout: i32) -> String {}
}
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 bods2c(name: &str) -> (i32, bool) {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bodvrd(bodynm: &str, item: &str, maxn: usize) -> Vec<f64> {
let bodynm = to_cstring(bodynm);
let item = to_cstring(item);
let mut dim = 0;
let mut values = vec![0.0; maxn];
unsafe {
crate::c::bodvrd_c(
bodynm.as_ptr() as *mut SpiceChar,
item.as_ptr() as *mut SpiceChar,
maxn as SpiceInt,
&mut dim,
values.as_mut_ptr(),
)
};
values.truncate(dim.max(0) as usize);
values
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bodvar(body: i32, item: &str, maxn: usize) -> Vec<f64> {
let item = to_cstring(item);
let mut dim = 0;
let mut values = vec![0.0; maxn];
unsafe {
crate::c::bodvar_c(
body,
item.as_ptr() as *mut SpiceChar,
&mut dim,
values.as_mut_ptr(),
)
};
values.truncate(dim.max(0) as usize);
values
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bodvcd(bodyid: i32, item: &str, maxn: usize) -> Vec<f64> {
let item = to_cstring(item);
let mut dim = 0;
let mut values = vec![0.0; maxn];
unsafe {
crate::c::bodvcd_c(
bodyid,
item.as_ptr() as *mut SpiceChar,
maxn as SpiceInt,
&mut dim,
values.as_mut_ptr(),
)
};
values.truncate(dim.max(0) as usize);
values
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
pub fn ckcov(
ck: &str,
idcode: i32,
needav: bool,
level: &str,
tol: f64,
timsys: &str,
cover: &mut Cell<f64>
) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckgp(inst: i32, sclkdp: f64, tol: f64, frame: &str) -> ([[f64; 3]; 3], f64, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckgpav(
inst: i32,
sclkdp: f64,
tol: f64,
frame: &str
) -> ([[f64; 3]; 3], [f64; 3], f64, bool) {
}
}
cspice_proc! {
pub fn ckobj(ck: &str, ids: &mut Cell<i32>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckopn(fname: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckcls(handle: i32) {}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckw03(
handle: i32,
begtim: f64,
endtim: f64,
inst: i32,
frame: &str,
avflag: bool,
segid: &str,
nrec: i32,
sclkdp: &[f64],
quats: &[[f64; 4]],
avvs: &[[f64; 3]],
nints: i32,
starts: &[f64],
) {
let records = usize::try_from(nrec).expect("the number of records cannot be negative");
let intervals = usize::try_from(nints).expect("the number of intervals cannot be negative");
assert!(
records <= sclkdp.len() && records <= quats.len(),
"ckw03 was asked for {records} records but got {} clock times and {} quaternions",
sclkdp.len(),
quats.len()
);
assert!(
!avflag || records <= avvs.len(),
"ckw03 was asked for {records} angular velocities but got {}",
avvs.len()
);
assert!(
intervals <= starts.len(),
"ckw03 was asked for {intervals} intervals but got {} start times",
starts.len()
);
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::ckw03_c(
handle,
begtim,
endtim,
inst,
frame.as_ptr() as *mut SpiceChar,
avflag as crate::c::SpiceBoolean,
segid.as_ptr() as *mut SpiceChar,
nrec,
sclkdp.as_ptr() as *mut SpiceDouble,
quats.as_ptr() as *mut [SpiceDouble; 4],
avvs.as_ptr() as *mut [SpiceDouble; 3],
nints,
starts.as_ptr() as *mut SpiceDouble,
);
}
}
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 dlabbs(handle: i32) -> (DLADSC, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlafns(handle: i32, dladsc: DLADSC) -> (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! {
pub fn dskobj(dsk: &str, bodids: &mut Cell<i32>) {}
}
cspice_proc! {
pub fn dsksrf(dsk: &str, bodyid: i32, srfids: &mut Cell<i32>) {}
}
pub fn dskp02(handle: i32, dladsc: DLADSC, start: usize, room: usize) -> Vec<[i32; 3]> {
let mut dladsc = dladsc;
let mut n = 0;
let mut plates = vec![[0; 3]; room];
unsafe {
crate::c::dskp02_c(
handle,
&mut dladsc,
start as SpiceInt,
room as SpiceInt,
&mut n,
plates.as_mut_ptr(),
);
}
plates.truncate(n.max(0) as usize);
plates
}
pub fn dskv02(handle: i32, dladsc: DLADSC, start: usize, room: usize) -> Vec<[f64; 3]> {
let mut dladsc = dladsc;
let mut n = 0;
let mut vrtces = vec![[0.0; 3]; room];
unsafe {
crate::c::dskv02_c(
handle,
&mut dladsc,
start as SpiceInt,
room as SpiceInt,
&mut n,
vrtces.as_mut_ptr(),
);
}
vrtces.truncate(n.max(0) as usize);
vrtces
}
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) {}
}
pub const DSKXSI_DCSIZE: usize = 1;
pub const DSKXSI_ICSIZE: usize = 1;
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskxsi(
pri: bool,
target: &str,
srflst: &[i32],
et: f64,
fixref: &str,
vertex: [f64; 3],
raydir: [f64; 3],
) -> (
[f64; 3],
i32,
DLADSC,
DSKDSC,
[f64; DSKXSI_DCSIZE],
[i32; DSKXSI_ICSIZE],
bool,
) {
let target = to_cstring(target);
let fixref = to_cstring(fixref);
let mut xpt = [0.0; 3];
let mut handle = 0;
let mut dladsc: DLADSC = unsafe { std::mem::zeroed() };
let mut dskdsc: DSKDSC = unsafe { std::mem::zeroed() };
let mut dc = [0.0; DSKXSI_DCSIZE];
let mut ic = [0; DSKXSI_ICSIZE];
let mut found = 0;
unsafe {
crate::c::dskxsi_c(
pri as crate::c::SpiceBoolean,
target.as_ptr() as *mut SpiceChar,
srflst.len() as SpiceInt,
srflst.as_ptr() as *mut SpiceInt,
et,
fixref.as_ptr() as *mut SpiceChar,
vertex.as_ptr() as *mut SpiceDouble,
raydir.as_ptr() as *mut SpiceDouble,
DSKXSI_DCSIZE as SpiceInt,
DSKXSI_ICSIZE as SpiceInt,
xpt.as_mut_ptr(),
&mut handle,
&mut dladsc,
&mut dskdsc,
dc.as_mut_ptr(),
ic.as_mut_ptr(),
&mut found,
);
}
(xpt, handle, dladsc, dskdsc, dc, ic, found != 0)
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskxv(
pri: bool,
target: &str,
srflst: &[i32],
et: f64,
fixref: &str,
vtxarr: &[[f64; 3]],
dirarr: &[[f64; 3]],
) -> (Vec<[f64; 3]>, Vec<bool>) {
let rays = vtxarr.len().min(dirarr.len());
let target = to_cstring(target);
let fixref = to_cstring(fixref);
let mut xptarr = vec![[0.0; 3]; rays];
let mut fndarr = vec![0 as crate::c::SpiceBoolean; rays];
unsafe {
crate::c::dskxv_c(
pri as crate::c::SpiceBoolean,
target.as_ptr() as *mut SpiceChar,
srflst.len() as SpiceInt,
srflst.as_ptr() as *mut SpiceInt,
et,
fixref.as_ptr() as *mut SpiceChar,
rays as SpiceInt,
vtxarr.as_ptr() as *mut [f64; 3],
dirarr.as_ptr() as *mut [f64; 3],
xptarr.as_mut_ptr(),
fndarr.as_mut_ptr(),
);
}
(xptarr, fndarr.into_iter().map(|flag| flag != 0).collect())
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskopn(fname: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskcls(handle: i32, optmiz: bool) {}
}
pub const DSK_KEYXFR: i32 = 1;
pub const DSK_KEYSGR: i32 = 2;
pub const DSK_KEYSPM: i32 = 3;
pub const DSK_KEYPTM: i32 = 4;
pub const DSK_KEYAMG: i32 = 5;
pub const DSK_KEYLAL: i32 = 6;
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskgtl(keywrd: i32) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskstl(keywrd: i32, dpval: f64) {}
}
pub mod dsk02 {
pub const KWNV: i32 = 1;
pub const KWNP: i32 = 2;
pub const KWNVXT: i32 = 3;
pub const KWVGRX: i32 = 4;
pub const KWCGSC: i32 = 5;
pub const KWVXPS: i32 = 6;
pub const KWVXLS: i32 = 7;
pub const KWVTLS: i32 = 8;
pub const KWPLAT: i32 = 9;
pub const KWVXPT: i32 = 10;
pub const KWVXPL: i32 = 11;
pub const KWVTPT: i32 = 12;
pub const KWVTPL: i32 = 13;
pub const KWCGPT: i32 = 14;
pub const KWDSC: i32 = 15;
pub const KWVTBD: i32 = 16;
pub const KWVXOR: i32 = 17;
pub const KWVXSZ: i32 = 18;
pub const KWVERT: i32 = 19;
}
pub const DSK02_SPADSZ: usize = 10;
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskmi2(
vrtces: &[[f64; 3]],
plates: &[[i32; 3]],
finscl: f64,
corscl: i32,
worksz: usize,
voxpsz: usize,
voxlsz: usize,
makvtl: bool,
spxisz: usize,
) -> (Vec<f64>, Vec<i32>) {
let mut work = vec![[0; 2]; worksz.max(1)];
let mut spaixd = vec![0.0; DSK02_SPADSZ];
let mut spaixi = vec![0; spxisz.max(1)];
unsafe {
crate::c::dskmi2_c(
vrtces.len() as SpiceInt,
vrtces.as_ptr() as *mut [f64; 3],
plates.len() as SpiceInt,
plates.as_ptr() as *mut [SpiceInt; 3],
finscl,
corscl,
worksz as SpiceInt,
voxpsz as SpiceInt,
voxlsz as SpiceInt,
makvtl as SpiceInt,
spxisz as SpiceInt,
work.as_mut_ptr(),
spaixd.as_mut_ptr(),
spaixi.as_mut_ptr(),
);
}
(spaixd, spaixi)
}
pub const DSK_NSYPAR: usize = 10;
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskw02(
handle: i32,
center: i32,
surfce: i32,
dclass: i32,
frame: &str,
corsys: i32,
corpar: &[f64],
mncor1: f64,
mxcor1: f64,
mncor2: f64,
mxcor2: f64,
mncor3: f64,
mxcor3: f64,
first: f64,
last: f64,
vrtces: &[[f64; 3]],
plates: &[[i32; 3]],
spaixd: &[f64],
spaixi: &[i32],
) {
assert!(
corpar.len() >= DSK_NSYPAR,
"dskw02 needs {DSK_NSYPAR} coordinate parameters but got {}",
corpar.len()
);
let frame = to_cstring(frame);
unsafe {
crate::c::dskw02_c(
handle,
center,
surfce,
dclass,
frame.as_ptr() as *mut SpiceChar,
corsys,
corpar.as_ptr() as *mut SpiceDouble,
mncor1,
mxcor1,
mncor2,
mxcor2,
mncor3,
mxcor3,
first,
last,
vrtces.len() as SpiceInt,
vrtces.as_ptr() as *mut [f64; 3],
plates.len() as SpiceInt,
plates.as_ptr() as *mut [SpiceInt; 3],
spaixd.as_ptr() as *mut SpiceDouble,
spaixi.as_ptr() as *mut SpiceInt,
);
}
}
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 unload(name: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn kclear() {}
}
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 ldpool(filename: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn clpool() {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn expool(name: &str) -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dtpool(name: &str) -> (bool, i32, String) {}
}
#[allow(clippy::too_many_arguments)]
pub fn kdata(
which: i32,
kind: &str,
fillen: i32,
typlen: i32,
srclen: i32,
) -> (String, String, String, i32, bool) {
let kind = to_cstring(kind);
let mut file = vec![0 as SpiceChar; fillen.max(1) as usize];
let mut filtyp = vec![0 as SpiceChar; typlen.max(1) as usize];
let mut source = vec![0 as SpiceChar; srclen.max(1) as usize];
let mut handle = 0;
let mut found = 0;
unsafe {
crate::c::kdata_c(
which,
kind.as_ptr() as *mut SpiceChar,
fillen,
typlen,
srclen,
file.as_mut_ptr(),
filtyp.as_mut_ptr(),
source.as_mut_ptr(),
&mut handle,
&mut found,
);
}
(
from_cbuf(&file),
from_cbuf(&filtyp),
from_cbuf(&source),
handle,
found != 0,
)
}
pub fn kinfo(file: &str, typlen: i32, srclen: i32) -> (String, String, i32, bool) {
let file = to_cstring(file);
let mut filtyp = vec![0 as SpiceChar; typlen.max(1) as usize];
let mut source = vec![0 as SpiceChar; srclen.max(1) as usize];
let mut handle = 0;
let mut found = 0;
unsafe {
crate::c::kinfo_c(
file.as_ptr() as *mut SpiceChar,
typlen,
srclen,
filtyp.as_mut_ptr(),
source.as_mut_ptr(),
&mut handle,
&mut found,
);
}
(from_cbuf(&filtyp), from_cbuf(&source), handle, found != 0)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gdpool(name: &str, start: usize, room: usize) -> Vec<f64> {
let name = to_cstring(name);
let mut n = 0;
let mut values = vec![0.0; room];
let mut found = 0;
unsafe {
crate::c::gdpool_c(
name.as_ptr() as *mut SpiceChar,
start as SpiceInt,
room as SpiceInt,
&mut n,
values.as_mut_ptr(),
&mut found,
)
}
values.truncate(if found != 0 { n.max(0) as usize } else { 0 });
values
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gipool(name: &str, start: usize, room: usize) -> Vec<i32> {
let name = to_cstring(name);
let mut n = 0;
let mut values = vec![0; room];
let mut found = 0;
unsafe {
crate::c::gipool_c(
name.as_ptr() as *mut SpiceChar,
start as SpiceInt,
room as SpiceInt,
&mut n,
values.as_mut_ptr(),
&mut found,
)
}
values.truncate(if found != 0 { n.max(0) as usize } else { 0 });
values
}
pub fn gcpool(name: &str, start: usize, room: usize, lenout: usize) -> Vec<String> {
let name = to_cstring(name);
let lenout = lenout.max(1);
let mut n = 0;
let mut values = vec![0 as SpiceChar; room * lenout];
let mut found = 0;
unsafe {
crate::c::gcpool_c(
name.as_ptr() as *mut SpiceChar,
start as SpiceInt,
room as SpiceInt,
lenout as SpiceInt,
&mut n,
values.as_mut_ptr().cast(),
&mut found,
)
}
let count = if found != 0 { n.max(0) as usize } else { 0 };
(0..count)
.map(|index| from_cbuf(&values[index * lenout..(index + 1) * lenout]))
.collect()
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn swpool<S: AsRef<str>>(agent: &str, names: &[S]) {
let agent = to_cstring(agent);
let (buffer, lenvals) = to_strided(names);
unsafe {
crate::c::swpool_c(
agent.as_ptr() as *mut SpiceChar,
names.len() as SpiceInt,
lenvals as SpiceInt,
buffer.as_ptr().cast(),
)
}
}
pub fn gnpool(name: &str, start: usize, room: usize, lenout: usize) -> Vec<String> {
let name = to_cstring(name);
let lenout = lenout.max(1);
let mut buffer = vec![0 as SpiceChar; room.max(1) * lenout];
let mut n = 0;
let mut found = 0;
unsafe {
crate::c::gnpool_c(
name.as_ptr() as *mut SpiceChar,
start as SpiceInt,
room as SpiceInt,
lenout as SpiceInt,
&mut n,
buffer.as_mut_ptr().cast(),
&mut found,
)
};
let count = if found != 0 { n.max(0) as usize } else { 0 };
from_strided(&buffer, lenout, count)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pdpool(name: &str, values: &[f64]) {
let name = to_cstring(name);
unsafe {
crate::c::pdpool_c(
name.as_ptr() as *mut SpiceChar,
values.len() as SpiceInt,
values.as_ptr() as *mut SpiceDouble,
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pipool(name: &str, values: &[i32]) {
let name = to_cstring(name);
unsafe {
crate::c::pipool_c(
name.as_ptr() as *mut SpiceChar,
values.len() as SpiceInt,
values.as_ptr() as *mut SpiceInt,
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pcpool<S: AsRef<str>>(name: &str, values: &[S]) {
let name = to_cstring(name);
let (buffer, lenvals) = to_strided(values);
unsafe {
crate::c::pcpool_c(
name.as_ptr() as *mut SpiceChar,
values.len() as SpiceInt,
lenvals as SpiceInt,
buffer.as_ptr().cast(),
)
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn str2et(targ: &str) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn utc2et(utcstr: &str) -> f64 {}
}
cspice_proc! {
pub fn et2utc(et: f64, format: &str, prec: i32, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
pub fn timout(et: f64, pictur: &str, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
pub fn tparse(string: &str, #[lenout] lenout: i32) -> (f64, String) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn deltet(epoch: f64, eptype: &str) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn unitim(epoch: f64, insys: &str, outsys: &str) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sce2c(sc: i32, et: f64) -> f64 {}
}
cspice_proc! {
pub fn sce2s(sc: i32, et: f64, #[lenout] sclklen: i32) -> String {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn scencd(sc: i32, sclkch: &str) -> f64 {}
}
cspice_proc! {
pub fn scdecd(sc: i32, sclkdp: f64, #[lenout] sclklen: i32) -> String {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn scs2e(sc: i32, sclkch: &str) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sct2e(sc: i32, sclkdp: f64) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lspcn(body: &str, et: f64, abcorr: &str) -> f64 {}
}
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 sxform(from: &str, to: &str, et: f64) -> [[f64; 6]; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn namfrm(frname: &str) -> i32 {}
}
cspice_proc! {
pub fn frmnam(frcode: i32, #[lenout] lenout: i32) -> String {}
}
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! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn recgeo(rectan: [f64; 3], re: f64, f: f64) -> (f64, f64, f64) {}
}
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 reclat(rectan: [f64; 3]) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sphrec(r: f64, colat: f64, lon: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn recsph(rectan: [f64; 3]) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cylrec(r: f64, lon: f64, z: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn reccyl(rectan: [f64; 3]) -> (f64, f64, f64) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pgrrec(body: &str, lon: f64, lat: f64, alt: f64, re: f64, f: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn recpgr(body: &str, rectan: [f64; 3], re: f64, f: f64) -> (f64, f64, f64) {}
}
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 srfrec(body: i32, lon: f64, lat: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vpack(x: f64, y: f64, z: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vupack(v: [f64; 3]) -> (f64, f64, f64) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vzero(v: [f64; 3]) -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vperp(a: [f64; 3], b: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vproj(a: [f64; 3], b: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vrotv(v: [f64; 3], axis: [f64; 3], theta: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vlcom(a: f64, v1: [f64; 3], b: f64, v2: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vlcom3(
a: f64,
v1: [f64; 3],
b: f64,
v2: [f64; 3],
c: f64,
v3: [f64; 3]
) -> [f64; 3] {
}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vtmv(v1: [f64; 3], matrix: [[f64; 3]; 3], v2: [f64; 3]) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ident() -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mequ(m1: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xpose6(m1: [[f64; 6]; 6]) -> [[f64; 6]; 6] {}
}
macro_rules! vector_g {
($($name:ident($($arg:ident),*) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// # Panics
///
/// Panics if the vectors have different lengths.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name($($arg: &[f64]),*) -> Vec<f64> {
let ndim = same_length(&[$($arg),*]);
let mut vout = vec![0.0; ndim];
unsafe {
crate::c::$cname(
$($arg.as_ptr() as *mut SpiceDouble,)*
ndim as SpiceInt,
vout.as_mut_ptr(),
);
}
vout
}
)*};
}
macro_rules! scalar_g {
($($name:ident($($arg:ident),*) -> $ret:ty => $cname:ident, $conv:expr, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// # Panics
///
/// Panics if the vectors have different lengths.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name($($arg: &[f64]),*) -> $ret {
let ndim = same_length(&[$($arg),*]);
let returned = unsafe {
crate::c::$cname($($arg.as_ptr() as *mut SpiceDouble,)* ndim as SpiceInt)
};
#[allow(clippy::redundant_closure_call)]
($conv)(returned)
}
)*};
}
fn same_length(slices: &[&[f64]]) -> usize {
let ndim = slices[0].len();
assert!(
slices.iter().all(|slice| slice.len() == ndim),
"the vectors must all have the same length, got {:?}",
slices.iter().map(|slice| slice.len()).collect::<Vec<_>>()
);
ndim
}
vector_g! {
vaddg(v1, v2) => vaddg_c, "Add two vectors of arbitrary dimension.";
vsubg(v1, v2) => vsubg_c, "Subtract one vector of arbitrary dimension from another.";
vhatg(v1) => vhatg_c, "The unit vector along a vector of arbitrary dimension.";
vequg(vin) => vequg_c, "Copy a vector of arbitrary dimension.";
vminug(vin) => vminug_c, "Negate a vector of arbitrary dimension.";
vprojg(a, b) => vprojg_c, "The projection of one vector onto another, in arbitrary dimension.";
}
scalar_g! {
vdotg(v1, v2) -> f64 => vdotg_c, |value| value,
"The dot product of two vectors of arbitrary dimension.";
vnormg(v1) -> f64 => vnormg_c, |value| value,
"The magnitude of a vector of arbitrary dimension.";
vdistg(v1, v2) -> f64 => vdistg_c, |value| value,
"The distance between two vectors of arbitrary dimension.";
vrelg(v1, v2) -> f64 => vrelg_c, |value| value,
"The relative difference between two vectors of arbitrary dimension.";
vsepg(v1, v2) -> f64 => vsepg_c, |value| value,
"The angular separation of two vectors of arbitrary dimension.";
vzerog(v) -> bool => vzerog_c, |value: crate::c::SpiceBoolean| value != 0,
"Whether a vector of arbitrary dimension is the zero vector.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vsclg(s: f64, v1: &[f64]) -> Vec<f64> {
let mut vout = vec![0.0; v1.len()];
unsafe {
crate::c::vsclg_c(
s,
v1.as_ptr() as *mut SpiceDouble,
v1.len() as SpiceInt,
vout.as_mut_ptr(),
)
};
vout
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn unormg(v1: &[f64]) -> (Vec<f64>, f64) {
let mut vout = vec![0.0; v1.len()];
let mut vmag = 0.0;
unsafe {
crate::c::unormg_c(
v1.as_ptr() as *mut SpiceDouble,
v1.len() as SpiceInt,
vout.as_mut_ptr(),
&mut vmag,
)
};
(vout, vmag)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vlcomg(a: f64, v1: &[f64], b: f64, v2: &[f64]) -> Vec<f64> {
let ndim = same_length(&[v1, v2]);
let mut sum = vec![0.0; ndim];
unsafe {
crate::c::vlcomg_c(
ndim as SpiceInt,
a,
v1.as_ptr() as *mut SpiceDouble,
b,
v2.as_ptr() as *mut SpiceDouble,
sum.as_mut_ptr(),
)
};
sum
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn moved(arrfrm: &[f64]) -> Vec<f64> {
let mut arrto = vec![0.0; arrfrm.len()];
unsafe {
crate::c::moved_c(
arrfrm.as_ptr() as *mut SpiceDouble,
arrfrm.len() as SpiceInt,
arrto.as_mut_ptr(),
)
};
arrto
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vtmvg(v1: &[f64], matrix: &[f64], v2: &[f64], nrow: usize, ncol: usize) -> f64 {
assert_matrix(matrix, nrow, ncol);
assert!(
v1.len() == nrow && v2.len() == ncol,
"vtmvg needs a vector of {nrow} and one of {ncol}, got {} and {}",
v1.len(),
v2.len()
);
unsafe {
crate::c::vtmvg_c(
v1.as_ptr().cast(),
matrix.as_ptr().cast(),
v2.as_ptr().cast(),
nrow as SpiceInt,
ncol as SpiceInt,
)
}
}
fn assert_matrix(matrix: &[f64], rows: usize, cols: usize) {
assert!(
matrix.len() == rows * cols,
"a {rows}x{cols} matrix needs {} elements, got {}",
rows * cols,
matrix.len()
);
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mxmg(m1: &[f64], m2: &[f64], nr1: usize, nc1r2: usize, nc2: usize) -> Vec<f64> {
assert_matrix(m1, nr1, nc1r2);
assert_matrix(m2, nc1r2, nc2);
let mut mout = vec![0.0; nr1 * nc2];
unsafe {
crate::c::mxmg_c(
m1.as_ptr().cast(),
m2.as_ptr().cast(),
nr1 as SpiceInt,
nc1r2 as SpiceInt,
nc2 as SpiceInt,
mout.as_mut_ptr().cast(),
)
};
mout
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mtxmg(m1: &[f64], m2: &[f64], nc1: usize, nr1r2: usize, nc2: usize) -> Vec<f64> {
assert_matrix(m1, nr1r2, nc1);
assert_matrix(m2, nr1r2, nc2);
let mut mout = vec![0.0; nc1 * nc2];
unsafe {
crate::c::mtxmg_c(
m1.as_ptr().cast(),
m2.as_ptr().cast(),
nc1 as SpiceInt,
nr1r2 as SpiceInt,
nc2 as SpiceInt,
mout.as_mut_ptr().cast(),
)
};
mout
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mxmtg(m1: &[f64], m2: &[f64], nr1: usize, nc1c2: usize, nr2: usize) -> Vec<f64> {
assert_matrix(m1, nr1, nc1c2);
assert_matrix(m2, nr2, nc1c2);
let mut mout = vec![0.0; nr1 * nr2];
unsafe {
crate::c::mxmtg_c(
m1.as_ptr().cast(),
m2.as_ptr().cast(),
nr1 as SpiceInt,
nc1c2 as SpiceInt,
nr2 as SpiceInt,
mout.as_mut_ptr().cast(),
)
};
mout
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mxvg(m1: &[f64], v2: &[f64], nrow1: usize, nc1r2: usize) -> Vec<f64> {
assert_matrix(m1, nrow1, nc1r2);
assert_matrix(v2, nc1r2, 1);
let mut vout = vec![0.0; nrow1];
unsafe {
crate::c::mxvg_c(
m1.as_ptr().cast(),
v2.as_ptr().cast(),
nrow1 as SpiceInt,
nc1r2 as SpiceInt,
vout.as_mut_ptr().cast(),
)
};
vout
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mtxvg(m1: &[f64], v2: &[f64], ncol1: usize, nr1r2: usize) -> Vec<f64> {
assert_matrix(m1, nr1r2, ncol1);
assert_matrix(v2, nr1r2, 1);
let mut vout = vec![0.0; ncol1];
unsafe {
crate::c::mtxvg_c(
m1.as_ptr().cast(),
v2.as_ptr().cast(),
ncol1 as SpiceInt,
nr1r2 as SpiceInt,
vout.as_mut_ptr().cast(),
)
};
vout
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xposeg(matrix: &[f64], nrow: usize, ncol: usize) -> Vec<f64> {
assert_matrix(matrix, nrow, ncol);
let mut xposem = vec![0.0; nrow * ncol];
unsafe {
crate::c::xposeg_c(
matrix.as_ptr().cast(),
nrow as SpiceInt,
ncol as SpiceInt,
xposem.as_mut_ptr().cast(),
)
};
xposem
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mequg(m1: &[f64], nr: usize, nc: usize) -> Vec<f64> {
assert_matrix(m1, nr, nc);
let mut mout = vec![0.0; nr * nc];
unsafe {
crate::c::mequg_c(
m1.as_ptr().cast(),
nr as SpiceInt,
nc as SpiceInt,
mout.as_mut_ptr().cast(),
)
};
mout
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn latcyl(radius: f64, lon: f64, lat: f64) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cyllat(r: f64, lonc: f64, z: f64) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn latsph(radius: f64, lon: f64, lat: f64) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sphlat(r: f64, colat: f64, lons: f64) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cylsph(r: f64, lonc: f64, z: f64) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sphcyl(radius: f64, colat: f64, slon: f64) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn azlrec(range: f64, az: f64, el: f64, azccw: bool, elplsz: bool) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn recazl(rectan: [f64; 3], azccw: bool, elplsz: bool) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlatdr(x: f64, y: f64, z: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn drdlat(r: f64, lon: f64, lat: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dsphdr(x: f64, y: f64, z: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn drdsph(r: f64, colat: f64, lon: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dcyldr(x: f64, y: f64, z: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn drdcyl(r: f64, lon: f64, z: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dgeodr(x: f64, y: f64, z: f64, re: f64, f: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn drdgeo(lon: f64, lat: f64, alt: f64, re: f64, f: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dpgrdr(body: &str, x: f64, y: f64, z: f64, re: f64, f: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn drdpgr(body: &str, lon: f64, lat: f64, alt: f64, re: f64, f: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dazldr(x: f64, y: f64, z: f64, azccw: bool, elplsz: bool) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn drdazl(range: f64, az: f64, el: f64, azccw: bool, elplsz: bool) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xfmsta(
input_state: [f64; 6],
input_coord_sys: &str,
output_coord_sys: &str,
body: &str
) -> [f64; 6] {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vadd(v1: [f64; 3], v2: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vsub(v1: [f64; 3], v2: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vscl(s: f64, v1: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vequ(vin: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vminus(v1: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vhat(v1: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn unorm(v1: [f64; 3]) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vnorm(v1: [f64; 3]) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vdist(v1: [f64; 3], v2: [f64; 3]) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vrel(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! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vsep(v1: [f64; 3], v2: [f64; 3]) -> f64 {}
}
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! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mtxv(m1: [[f64; 3]; 3], vin: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mxm(m1: [[f64; 3]; 3], m2: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mxmt(m1: [[f64; 3]; 3], m2: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn mtxm(m1: [[f64; 3]; 3], m2: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xpose(m1: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn invert(m1: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn det(m1: [[f64; 3]; 3]) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn trace(matrix: [[f64; 3]; 3]) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn twovec(axdef: [f64; 3], indexa: i32, plndef: [f64; 3], indexp: i32) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn rotate(angle: f64, iaxis: i32) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn rotmat(m1: [[f64; 3]; 3], angle: f64, iaxis: i32) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn m2q(r: [[f64; 3]; 3]) -> [f64; 4] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn q2m(q: [f64; 4]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn qxq(q1: [f64; 4], q2: [f64; 4]) -> [f64; 4] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn axisar(axis: [f64; 3], angle: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn raxisa(matrix: [[f64; 3]; 3]) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eul2m(
angle3: f64,
angle2: f64,
angle1: f64,
axis3: i32,
axis2: i32,
axis1: i32
) -> [[f64; 3]; 3] {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn m2eul(r: [[f64; 3]; 3], axis3: i32, axis2: i32, axis1: i32) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eul2xf(eulang: [f64; 6], axisa: i32, axisb: i32, axisc: i32) -> [[f64; 6]; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xf2eul(xform: [[f64; 6]; 6], axisa: i32, axisb: i32, axisc: i32) -> ([f64; 6], bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn xf2rav(xform: [[f64; 6]; 6]) -> ([[f64; 3]; 3], [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn rav2xf(rot: [[f64; 3]; 3], av: [f64; 3]) -> [[f64; 6]; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn invort(m: [[f64; 3]; 3]) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn isrot(m: [[f64; 3]; 3], ntol: f64, dtol: f64) -> bool {}
}
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 spkez(targ: i32, et: f64, frame: &str, abcorr: &str, obs: i32) -> ([f64; 6], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkezp(targ: i32, et: f64, frame: &str, abcorr: &str, obs: i32) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkgeo(targ: i32, et: f64, frame: &str, obs: i32) -> ([f64; 6], f64) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkcpo(
target: &str,
et: f64,
outref: &str,
refloc: &str,
abcorr: &str,
obssta: [f64; 6],
obsctr: &str,
obsref: &str
) -> ([f64; 6], f64) {
}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkcpt(
trgpos: [f64; 3],
trgctr: &str,
trgref: &str,
et: f64,
outref: &str,
refloc: &str,
abcorr: &str,
obsrvr: &str
) -> ([f64; 6], f64) {
}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkcvo(
target: &str,
et: f64,
outref: &str,
refloc: &str,
abcorr: &str,
obssta: [f64; 6],
obsepc: f64,
obsctr: &str,
obsref: &str
) -> ([f64; 6], f64) {
}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkcvt(
trgsta: [f64; 6],
trgepc: f64,
trgctr: &str,
trgref: &str,
et: f64,
outref: &str,
refloc: &str,
abcorr: &str,
obsrvr: &str
) -> ([f64; 6], f64) {
}
}
cspice_proc! {
pub fn spkobj(spk: &str, ids: &mut Cell<i32>) {}
}
cspice_proc! {
pub fn spkcov(spk: &str, idcode: i32, cover: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkopn(fname: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkopa(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkcls(handle: i32) {}
}
#[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: &[[f64; 6]],
epochs: &[f64],
) {
let count = usize::try_from(n).expect("the number of states cannot be negative");
assert!(
count <= states.len() && count <= epochs.len(),
"spkw09 was asked for {count} records but got {} states and {} epochs",
states.len(),
epochs.len()
);
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::spkw09_c(
handle,
body,
center,
frame.as_ptr() as *mut SpiceChar,
first,
last,
segid.as_ptr() as *mut SpiceChar,
degree,
n,
states.as_ptr() as *mut [SpiceDouble; 6],
epochs.as_ptr() as *mut SpiceDouble,
);
}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sincpt(
method: &str,
target: &str,
et: f64,
fixref: &str,
abcorr: &str,
obsrvr: &str,
dref: &str,
dvec: [f64; 3]
) -> ([f64; 3], f64, [f64; 3], bool) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn subpnt(
method: &str,
target: &str,
et: f64,
fixref: &str,
abcorr: &str,
obsrvr: &str
) -> ([f64; 3], f64, [f64; 3]) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn subslr(
method: &str,
target: &str,
et: f64,
fixref: &str,
abcorr: &str,
obsrvr: &str
) -> ([f64; 3], f64, [f64; 3]) {
}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ilumin(
method: &str,
target: &str,
et: f64,
fixref: &str,
abcorr: &str,
obsrvr: &str,
spoint: [f64; 3]
) -> (f64, [f64; 3], f64, f64, f64) {
}
}
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 surfpt(positn: [f64; 3], u: [f64; 3], a: f64, b: f64, c: f64) -> ([f64; 3], bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn nearpt(positn: [f64; 3], a: f64, b: f64, c: f64) -> ([f64; 3], f64) {}
}
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! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn phaseq(et: f64, target: &str, illumn: &str, obsrvr: &str, abcorr: &str) -> f64 {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn srfnrm(
method: &str,
target: &str,
et: f64,
fixref: &str,
srfpts: &[[f64; 3]],
) -> Vec<[f64; 3]> {
let method = to_cstring(method);
let target = to_cstring(target);
let fixref = to_cstring(fixref);
let mut normls = vec![[0.0; 3]; srfpts.len()];
unsafe {
crate::c::srfnrm_c(
method.as_ptr() as *mut SpiceChar,
target.as_ptr() as *mut SpiceChar,
et,
fixref.as_ptr() as *mut SpiceChar,
srfpts.len() as SpiceInt,
srfpts.as_ptr() as *mut [f64; 3],
normls.as_mut_ptr(),
);
}
normls
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn latsrf(
method: &str,
target: &str,
et: f64,
fixref: &str,
lonlat: &[[f64; 2]],
) -> Vec<[f64; 3]> {
let method = to_cstring(method);
let target = to_cstring(target);
let fixref = to_cstring(fixref);
let mut srfpts = vec![[0.0; 3]; lonlat.len()];
unsafe {
crate::c::latsrf_c(
method.as_ptr() as *mut SpiceChar,
target.as_ptr() as *mut SpiceChar,
et,
fixref.as_ptr() as *mut SpiceChar,
lonlat.len() as SpiceInt,
lonlat.as_ptr() as *mut [f64; 2],
srfpts.as_mut_ptr(),
);
}
srfpts
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn edterm(
trmtyp: &str,
source: &str,
target: &str,
et: f64,
fixfrm: &str,
abcorr: &str,
obsrvr: &str,
npts: usize,
) -> (f64, [f64; 3], Vec<[f64; 3]>) {
let trmtyp = to_cstring(trmtyp);
let source = to_cstring(source);
let target = to_cstring(target);
let fixfrm = to_cstring(fixfrm);
let abcorr = to_cstring(abcorr);
let obsrvr = to_cstring(obsrvr);
let mut trgepc = 0.0;
let mut obspos = [0.0; 3];
let mut termpts = vec![[0.0; 3]; npts];
unsafe {
crate::c::edterm_c(
trmtyp.as_ptr() as *mut SpiceChar,
source.as_ptr() as *mut SpiceChar,
target.as_ptr() as *mut SpiceChar,
et,
fixfrm.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
npts as SpiceInt,
&mut trgepc,
obspos.as_mut_ptr(),
termpts.as_mut_ptr(),
);
}
(trgepc, obspos, termpts)
}
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn limbpt(
method: &str,
target: &str,
et: f64,
fixref: &str,
abcorr: &str,
corloc: &str,
obsrvr: &str,
refvec: [f64; 3],
rolstp: f64,
ncuts: usize,
schstp: f64,
soltol: f64,
maxn: usize,
) -> (Vec<i32>, Vec<[f64; 3]>, Vec<f64>, Vec<[f64; 3]>) {
let method = to_cstring(method);
let target = to_cstring(target);
let fixref = to_cstring(fixref);
let abcorr = to_cstring(abcorr);
let corloc = to_cstring(corloc);
let obsrvr = to_cstring(obsrvr);
let mut npts = vec![0; ncuts.max(1)];
let mut points = vec![[0.0; 3]; maxn];
let mut epochs = vec![0.0; maxn];
let mut tangts = vec![[0.0; 3]; maxn];
unsafe {
crate::c::limbpt_c(
method.as_ptr() as *mut SpiceChar,
target.as_ptr() as *mut SpiceChar,
et,
fixref.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
corloc.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
refvec.as_ptr() as *mut SpiceDouble,
rolstp,
ncuts as SpiceInt,
schstp,
soltol,
maxn as SpiceInt,
npts.as_mut_ptr(),
points.as_mut_ptr(),
epochs.as_mut_ptr(),
tangts.as_mut_ptr(),
);
}
truncate_cuts(npts, points, epochs, tangts)
}
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn termpt(
method: &str,
ilusrc: &str,
target: &str,
et: f64,
fixref: &str,
abcorr: &str,
corloc: &str,
obsrvr: &str,
refvec: [f64; 3],
rolstp: f64,
ncuts: usize,
schstp: f64,
soltol: f64,
maxn: usize,
) -> (Vec<i32>, Vec<[f64; 3]>, Vec<f64>, Vec<[f64; 3]>) {
let method = to_cstring(method);
let ilusrc = to_cstring(ilusrc);
let target = to_cstring(target);
let fixref = to_cstring(fixref);
let abcorr = to_cstring(abcorr);
let corloc = to_cstring(corloc);
let obsrvr = to_cstring(obsrvr);
let mut npts = vec![0; ncuts.max(1)];
let mut points = vec![[0.0; 3]; maxn];
let mut epochs = vec![0.0; maxn];
let mut tangts = vec![[0.0; 3]; maxn];
unsafe {
crate::c::termpt_c(
method.as_ptr() as *mut SpiceChar,
ilusrc.as_ptr() as *mut SpiceChar,
target.as_ptr() as *mut SpiceChar,
et,
fixref.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
corloc.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
refvec.as_ptr() as *mut SpiceDouble,
rolstp,
ncuts as SpiceInt,
schstp,
soltol,
maxn as SpiceInt,
npts.as_mut_ptr(),
points.as_mut_ptr(),
epochs.as_mut_ptr(),
tangts.as_mut_ptr(),
);
}
truncate_cuts(npts, points, epochs, tangts)
}
#[allow(clippy::type_complexity)]
fn truncate_cuts(
npts: Vec<SpiceInt>,
mut points: Vec<[f64; 3]>,
mut epochs: Vec<f64>,
mut tangts: Vec<[f64; 3]>,
) -> (Vec<i32>, Vec<[f64; 3]>, Vec<f64>, Vec<[f64; 3]>) {
let found = npts.iter().map(|count| count.max(&0)).sum::<SpiceInt>() as usize;
points.truncate(found);
epochs.truncate(found);
tangts.truncate(found);
(npts, points, epochs, tangts)
}
pub fn getfov(
instid: i32,
room: usize,
shapelen: usize,
framelen: usize,
) -> (String, String, [f64; 3], Vec<[f64; 3]>) {
let mut shape = vec![0 as SpiceChar; shapelen.max(1)];
let mut frame = vec![0 as SpiceChar; framelen.max(1)];
let mut bsight = [0.0; 3];
let mut n = 0;
let mut bounds = vec![[0.0; 3]; room];
unsafe {
crate::c::getfov_c(
instid,
room as SpiceInt,
shapelen as SpiceInt,
framelen as SpiceInt,
shape.as_mut_ptr(),
frame.as_mut_ptr(),
bsight.as_mut_ptr(),
&mut n,
bounds.as_mut_ptr(),
)
};
bounds.truncate(n.max(0) as usize);
(from_cbuf(&shape), from_cbuf(&frame), bsight, bounds)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn nvc2pl(normal: [f64; 3], constant: f64) -> PLANE {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn nvp2pl(normal: [f64; 3], point: [f64; 3]) -> PLANE {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn psv2pl(point: [f64; 3], span1: [f64; 3], span2: [f64; 3]) -> PLANE {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pl2nvc(plane: PLANE) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pl2nvp(plane: PLANE) -> ([f64; 3], [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pl2psv(plane: PLANE) -> ([f64; 3], [f64; 3], [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cgv2el(center: [f64; 3], vec1: [f64; 3], vec2: [f64; 3]) -> ELLIPSE {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn el2cgv(ellipse: ELLIPSE) -> ([f64; 3], [f64; 3], [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn saelgv(vec1: [f64; 3], vec2: [f64; 3]) -> ([f64; 3], [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn inedpl(a: f64, b: f64, c: f64, plane: PLANE) -> (ELLIPSE, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn inelpl(ellips: ELLIPSE, plane: PLANE) -> (i32, [f64; 3], [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn inrypl(vertex: [f64; 3], dir: [f64; 3], plane: PLANE) -> (i32, [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn edlimb(a: f64, b: f64, c: f64, viewpt: [f64; 3]) -> ELLIPSE {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pjelpl(elin: ELLIPSE, plane: PLANE) -> ELLIPSE {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vprjp(vin: [f64; 3], plane: PLANE) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn vprjpi(vin: [f64; 3], projpl: PLANE, invpl: PLANE) -> ([f64; 3], bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn npelpt(point: [f64; 3], ellips: ELLIPSE) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn npedln(
a: f64,
b: f64,
c: f64,
linept: [f64; 3],
linedr: [f64; 3]
) -> ([f64; 3], f64) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn nplnpt(linpt: [f64; 3], lindir: [f64; 3], point: [f64; 3]) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn surfnm(a: f64, b: f64, c: f64, point: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn surfpv(
stvrtx: [f64; 6],
stdir: [f64; 6],
a: f64,
b: f64,
c: f64
) -> ([f64; 6], bool) {
}
}
cspice_proc! {
pub fn srfc2s(code: i32, bodyid: i32, #[lenout] srflen: i32) -> (String, bool) {}
}
cspice_proc! {
pub fn srfcss(code: i32, bodstr: &str, #[lenout] srflen: i32) -> (String, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn srfs2c(srfstr: &str, bodstr: &str) -> (i32, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn srfscc(surfce: &str, bodyid: i32) -> (i32, bool) {}
}
cspice_proc! {
pub fn pckcov(pck: &str, idcode: i32, cover: &mut Cell<f64>) {}
}
cspice_proc! {
pub fn pckfrm(pck: &str, ids: &mut Cell<i32>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn conics(elts: [f64; 8], et: f64) -> [f64; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn oscelt(state: [f64; 6], et: f64, mu: f64) -> [f64; 8] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn oscltx(state: [f64; 6], et: f64, mu: f64) -> [f64; 20] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn prop2b(gm: f64, pvinit: [f64; 6], dt: f64) -> [f64; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wninsd(left: f64, right: f64, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnfetd(window: &mut Cell<f64>, n: i32) -> (f64, f64) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wncard(window: &mut Cell<f64>) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wncomd(left: f64, right: f64, window: &mut Cell<f64>, result: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wncond(left: f64, right: f64, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnexpd(left: f64, right: f64, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wndifd(a: &mut Cell<f64>, b: &mut Cell<f64>, c: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnintd(a: &mut Cell<f64>, b: &mut Cell<f64>, c: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnunid(a: &mut Cell<f64>, b: &mut Cell<f64>, c: &mut Cell<f64>) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnelmd(point: f64, window: &mut Cell<f64>) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnincd(left: f64, right: f64, window: &mut Cell<f64>) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnreld(a: &mut Cell<f64>, op: &str, b: &mut Cell<f64>) -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnextd(side: char, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnfild(sml: f64, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnfltd(sml: f64, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
#[allow(clippy::type_complexity)]
pub fn wnsumd(window: &mut Cell<f64>) -> (f64, f64, f64, i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn wnvald(size: i32, n: i32, window: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn union<T: CellItem>(a: &mut Cell<T>, b: &mut Cell<T>, c: &mut Cell<T>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn inter<T: CellItem>(a: &mut Cell<T>, b: &mut Cell<T>, c: &mut Cell<T>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn diff<T: CellItem>(a: &mut Cell<T>, b: &mut Cell<T>, c: &mut Cell<T>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn copy<T: CellItem>(a: &mut Cell<T>, b: &mut Cell<T>) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn card<T: CellItem>(cell: &mut Cell<T>) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn scard<T: CellItem>(card: i32, cell: &mut Cell<T>) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn size<T: CellItem>(cell: &mut Cell<T>) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ssize<T: CellItem>(size: i32, cell: &mut Cell<T>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn valid<T: CellItem>(size: i32, n: i32, a: &mut Cell<T>) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn elemi(item: i32, set: &mut Cell<i32>) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn elemd(item: f64, set: &mut Cell<f64>) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn elemc(item: &str, set: &mut Cell<String>) -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn insrti(item: i32, set: &mut Cell<i32>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn insrtd(item: f64, set: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn insrtc(item: &str, set: &mut Cell<String>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn removi(item: i32, set: &mut Cell<i32>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn removd(item: f64, set: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn removc(item: &str, set: &mut Cell<String>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn appndi(item: i32, cell: &mut Cell<i32>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn appndd(item: f64, cell: &mut Cell<f64>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn appndc(item: &str, cell: &mut Cell<String>) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
pub fn gfoclt(
occtyp: &str,
front: &str,
fshape: &str,
fframe: &str,
back: &str,
bshape: &str,
bframe: &str,
abcorr: &str,
obsrvr: &str,
step: f64,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>
) {
}
}
pub const TLE_NELTS: usize = 10;
pub const TLE_NGEOPHS: usize = 8;
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn getelm<S: AsRef<str>>(frstyr: i32, lines: &[S]) -> (f64, [f64; TLE_NELTS]) {
assert!(
lines.len() == 2,
"a two-line element set has two lines, got {}",
lines.len()
);
let lineln = lines
.iter()
.map(|line| line.as_ref().len())
.max()
.unwrap_or(0)
+ 1;
let mut buffer = vec![0 as SpiceChar; 2 * lineln];
for (index, line) in lines.iter().enumerate() {
let slot = &mut buffer[index * lineln..(index + 1) * lineln];
for (target, byte) in slot.iter_mut().zip(line.as_ref().as_bytes()) {
*target = *byte as SpiceChar;
}
}
let mut epoch = 0.0;
let mut elems = [0.0; TLE_NELTS];
unsafe {
crate::c::getelm_c(
frstyr,
lineln as SpiceInt,
buffer.as_ptr().cast(),
&mut epoch,
elems.as_mut_ptr(),
);
}
(epoch, elems)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn evsgp4(et: f64, geophs: [f64; 8], elems: [f64; 10]) -> [f64; 6] {}
}
macro_rules! search {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// Returns the index found, or `-1`.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(value: $ty, array: &[$ty]) -> i32 {
unsafe { crate::c::$cname(value, array.len() as SpiceInt, array.as_ptr() as *mut _) }
}
)*};
}
search! {
bsrchd(f64) => bsrchd_c, "Binary search a sorted array of doubles.";
bsrchi(i32) => bsrchi_c, "Binary search a sorted array of integers.";
lstled(f64) => lstled_c, "Last index of the doubles less than or equal to a value.";
lstlei(i32) => lstlei_c, "Last index of the integers less than or equal to a value.";
lstltd(f64) => lstltd_c, "Last index of the doubles strictly less than a value.";
lstlti(i32) => lstlti_c, "Last index of the integers strictly less than a value.";
}
macro_rules! sort_in_place {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(array: &mut [$ty]) {
unsafe { crate::c::$cname(array.len() as SpiceInt, array.as_mut_ptr()) }
}
)*};
}
sort_in_place! {
shelld(f64) => shelld_c, "Sort an array of doubles in place.";
shelli(i32) => shelli_c, "Sort an array of integers in place.";
}
macro_rules! order_of {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(array: &[$ty]) -> Vec<i32> {
let mut iorder = vec![0; array.len()];
unsafe {
crate::c::$cname(
array.as_ptr() as *mut _,
array.len() as SpiceInt,
iorder.as_mut_ptr(),
)
};
iorder
}
)*};
}
order_of! {
orderd(f64) => orderd_c, "The order vector that sorts an array of doubles.";
orderi(i32) => orderi_c, "The order vector that sorts an array of integers.";
}
macro_rules! reorder {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// # Panics
///
/// Panics if the order vector is not as long as the array.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(iorder: &[i32], array: &mut [$ty]) {
assert!(
iorder.len() == array.len(),
"the order vector has {} entries for an array of {}",
iorder.len(),
array.len()
);
unsafe {
crate::c::$cname(
iorder.as_ptr() as *mut SpiceInt,
array.len() as SpiceInt,
array.as_mut_ptr(),
)
};
}
)*};
}
reorder! {
reordd(f64) => reordd_c, "Reorder an array of doubles in place.";
reordi(i32) => reordi_c, "Reorder an array of integers in place.";
reordl(crate::c::SpiceBoolean) => reordl_c, "Reorder an array of logical flags in place.";
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn brcktd(number: f64, end1: f64, end2: f64) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn brckti(number: i32, end1: i32, end2: i32) -> i32 {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sumad(array: &[f64]) -> f64 {
unsafe { crate::c::sumad_c(array.as_ptr() as *mut SpiceDouble, array.len() as SpiceInt) }
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sumai(array: &[i32]) -> i32 {
unsafe { crate::c::sumai_c(array.as_ptr() as *mut SpiceInt, array.len() as SpiceInt) }
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn isordv(array: &[i32]) -> bool {
unsafe { crate::c::isordv_c(array.as_ptr() as *mut SpiceInt, array.len() as SpiceInt) != 0 }
}
macro_rules! search_strings {
($($name:ident => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name<S: AsRef<str>>(value: &str, array: &[S]) -> i32 {
let value = to_cstring(value);
let (buffer, stride) = to_strided(array);
unsafe {
crate::c::$cname(
value.as_ptr() as *mut SpiceChar,
array.len() as SpiceInt,
stride as SpiceInt,
buffer.as_ptr().cast(),
)
}
}
)*};
}
search_strings! {
bsrchc => bsrchc_c, "Binary search a sorted array of strings.";
esrchc => esrchc_c, "Search an array of strings, ignoring case and trailing blanks.";
lstlec => lstlec_c, "Last index of the strings less than or equal to a value.";
lstltc => lstltc_c, "Last index of the strings strictly less than a value.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bschoi(value: i32, array: &[i32], order: &[i32]) -> i32 {
unsafe {
crate::c::bschoi_c(
value,
array.len() as SpiceInt,
array.as_ptr() as *mut SpiceInt,
order.as_ptr() as *mut SpiceInt,
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bschoc<S: AsRef<str>>(value: &str, array: &[S], order: &[i32]) -> i32 {
let value = to_cstring(value);
let (buffer, stride) = to_strided(array);
unsafe {
crate::c::bschoc_c(
value.as_ptr() as *mut SpiceChar,
array.len() as SpiceInt,
stride as SpiceInt,
buffer.as_ptr().cast(),
order.as_ptr() as *mut SpiceInt,
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn orderc<S: AsRef<str>>(array: &[S]) -> Vec<i32> {
let (buffer, stride) = to_strided(array);
let mut iorder = vec![0; array.len()];
unsafe {
crate::c::orderc_c(
stride as SpiceInt,
buffer.as_ptr().cast(),
array.len() as SpiceInt,
iorder.as_mut_ptr(),
)
};
iorder
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn reordc<S: AsRef<str>>(iorder: &[i32], array: &[S]) -> Vec<String> {
assert!(
iorder.len() == array.len(),
"the order vector has {} entries for an array of {}",
iorder.len(),
array.len()
);
let (mut buffer, stride) = to_strided(array);
unsafe {
crate::c::reordc_c(
iorder.as_ptr() as *mut SpiceInt,
array.len() as SpiceInt,
stride as SpiceInt,
buffer.as_mut_ptr().cast(),
)
};
from_strided(&buffer, stride, array.len())
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn shellc<S: AsRef<str>>(array: &[S]) -> Vec<String> {
let (mut buffer, stride) = to_strided(array);
unsafe {
crate::c::shellc_c(
array.len() as SpiceInt,
stride as SpiceInt,
buffer.as_mut_ptr().cast(),
)
};
from_strided(&buffer, stride, array.len())
}
cspice_proc! {
pub fn lcase(input: &str, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
pub fn ucase(input: &str, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
pub fn cmprss(delim: char, n: i32, input: &str, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eqstr(a: &str, b: &str) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn matchi(string: &str, templ: &str, wstr: char, wchr: char) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn matchw(string: &str, templ: &str, wstr: char, wchr: char) -> bool {}
}
cspice_proc! {
pub fn repmc(input: &str, marker: &str, value: &str, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
pub fn repmd(
input: &str,
marker: &str,
value: f64,
sigdig: i32,
#[lenout] lenout: i32
) -> String {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
#[allow(clippy::too_many_arguments)]
pub fn repmf(
input: &str,
marker: &str,
value: f64,
sigdig: i32,
format: char,
#[lenout] lenout: i32
) -> String {
}
}
cspice_proc! {
pub fn repmi(input: &str, marker: &str, value: i32, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn repml(
input: &str,
marker: &str,
value: bool,
rtcase: char,
#[lenout] outlen: i32
) -> String {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
#[cname(repmot_c)]
pub fn repmot(
input: &str,
marker: &str,
value: i32,
strcase: char,
#[lenout] lenout: i32
) -> String {
}
}
pub fn nextwd(string: &str, nexlen: usize, reslen: usize) -> (String, String) {
let string = to_cstring(string);
let mut next = vec![0 as SpiceChar; nexlen.max(1)];
let mut rest = vec![0 as SpiceChar; reslen.max(1)];
unsafe {
crate::c::nextwd_c(
string.as_ptr() as *mut SpiceChar,
nexlen as SpiceInt,
reslen as SpiceInt,
next.as_mut_ptr(),
rest.as_mut_ptr(),
)
};
(from_cbuf(&next), from_cbuf(&rest))
}
pub fn lparse(list: &str, delim: &str, nmax: usize, lenout: usize) -> Vec<String> {
let list = to_cstring(list);
let delim = to_cstring(delim);
let lenout = lenout.max(1);
let mut buffer = vec![0 as SpiceChar; nmax.max(1) * lenout];
let mut n = 0;
unsafe {
crate::c::lparse_c(
list.as_ptr() as *mut SpiceChar,
delim.as_ptr() as *mut SpiceChar,
nmax as SpiceInt,
lenout as SpiceInt,
&mut n,
buffer.as_mut_ptr().cast(),
)
};
from_strided(&buffer, lenout, n.max(0) as usize)
}
pub fn lparsm(list: &str, delims: &str, nmax: usize, lenout: usize) -> Vec<String> {
let list = to_cstring(list);
let delims = to_cstring(delims);
let lenout = lenout.max(1);
let mut buffer = vec![0 as SpiceChar; nmax.max(1) * lenout];
let mut n = 0;
unsafe {
crate::c::lparsm_c(
list.as_ptr() as *mut SpiceChar,
delims.as_ptr() as *mut SpiceChar,
nmax as SpiceInt,
lenout as SpiceInt,
&mut n,
buffer.as_mut_ptr().cast(),
)
};
from_strided(&buffer, lenout, n.max(0) as usize)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn convrt(x: f64, input: &str, output: &str) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dpmax() -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dpmin() -> f64 {}
}
cspice_proc! {
pub fn dp2hx(number: f64, #[lenout] lenout: i32) -> (String, i32) {}
}
cspice_proc! {
pub fn hx2dp(string: &str, #[lenout] lenout: i32) -> (f64, bool, String) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cpos(string: &str, chars: &str, start: i32) -> i32 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cposr(string: &str, chars: &str, start: i32) -> i32 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pos(string: &str, substr: &str, start: i32) -> i32 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn posr(string: &str, substr: &str, start: i32) -> i32 {}
}
cspice_proc! {
pub fn etcal(et: f64, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn tparch(kind: &str) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn badkpv(caller: &str, name: &str, comp: &str, size: i32, divby: i32, kind: char) -> bool {}
}
cspice_proc! {
pub fn ccifrm(frclss: i32, clssid: i32, #[lenout] lenout: i32) -> (i32, String, i32, bool) {}
}
cspice_proc! {
pub fn cidfrm(cent: i32, #[lenout] lenout: i32) -> (i32, String, bool) {}
}
cspice_proc! {
pub fn cnmfrm(cname: &str, #[lenout] lenout: i32) -> (i32, String, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn bltfrm(frmcls: i32, idset: &mut Cell<i32>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cvpool(agent: &str) -> bool {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn azlcpo(method: &str, target: &str, et: f64, abcorr: &str, azccw: bool, elplsz: bool, obspos: [f64; 3], obsctr: &str, obsref: &str) -> ([f64; 6], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn boddef(name: &str, code: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn chkin(module: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn chkout(module: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dnearp(state: [f64; 6], a: f64, b: f64, c: f64) -> ([f64; 6], [f64; 2], bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ducrss(s1: [f64; 6], s2: [f64; 6]) -> [f64; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dvcrss(s1: [f64; 6], s2: [f64; 6]) -> [f64; 6] {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dvdot(s1: [f64; 6], s2: [f64; 6]) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dvhat(s1: [f64; 6]) -> [f64; 6] {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dvnorm(state: [f64; 6]) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dvpool(name: &str) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dvsep(s1: [f64; 6], s2: [f64; 6]) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ednmpt(a: f64, b: f64, c: f64, normal: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn edpnt(p: [f64; 3], a: f64, b: f64, c: f64) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eqncpv(et: f64, epoch: f64, eqel: [f64; 9], rapol: f64, decpol: f64) -> [f64; 6] {}
}
cspice_proc! {
#[return_output]
#[cname(return_c)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn return_c() -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sigerr(message: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn errdp(marker: &str, number: f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn errint(marker: &str, number: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn errch(marker: &str, string: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ftncls(unit: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn illum(target: &str, et: f64, abcorr: &str, obsrvr: &str, spoint: [f64; 3]) -> (f64, f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn invstm(mat: [[f64; 6]; 6]) -> [[f64; 6]; 6] {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn iswhsp(string: &str) -> bool {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lastnb(string: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ltime(etobs: f64, obs: i32, dir: &str, targ: i32) -> (f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lx4dec(string: &str, first: i32) -> (i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lx4num(string: &str, first: i32) -> (i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lx4sgn(string: &str, first: i32) -> (i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lx4uns(string: &str, first: i32) -> (i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lxqstr(string: &str, qchar: char, first: i32) -> (i32, i32) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ncpos(string: &str, chars: &str, start: i32) -> i32 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ncposr(string: &str, chars: &str, start: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pltexp(iverts: [[f64; 3]; 3], delta: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn prsdp(string: &str) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn prsint(string: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn qdq2av(q: [f64; 4], dq: [f64; 4]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn rotvec(v1: [f64; 3], angle: f64, iaxis: i32) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn rquad(a: f64, b: f64, c: f64) -> ([f64; 2], [f64; 2]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sce2t(sc: i32, et: f64) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sctiks(sc: i32, clkstr: &str) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn setmsg(msg: &str) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
#[allow(clippy::type_complexity)]
pub fn srfxpt(method: &str, target: &str, et: f64, abcorr: &str, obsrvr: &str, dref: &str, dvec: [f64; 3]) -> ([f64; 3], f64, f64, [f64; 3], bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn stelab(pobj: [f64; 3], vobs: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn stlabx(pobj: [f64; 3], vobs: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn subpt(method: &str, target: &str, et: f64, abcorr: &str, obsrvr: &str) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn subsol(method: &str, target: &str, et: f64, abcorr: &str, obsrvr: &str) -> [f64; 3] {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
#[allow(clippy::type_complexity)]
pub fn tangpt(method: &str, target: &str, et: f64, fixref: &str, abcorr: &str, corloc: &str, obsrvr: &str, dref: &str, dvec: [f64; 3]) -> ([f64; 3], f64, f64, [f64; 3], f64, [f64; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn tipbod(frame: &str, body: i32, et: f64) -> [[f64; 3]; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn tisbod(frame: &str, body: i32, et: f64) -> [[f64; 6]; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn tkfram(frcode: i32) -> ([[f64; 3]; 3], i32, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn trcdep() -> i32 {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn trgsep(et: f64, targ1: &str, shape1: &str, frame1: &str, targ2: &str, shape2: &str, frame2: &str, obsrvr: &str, abcorr: &str) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn tsetyr(year: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn twovxf(axdef: [f64; 6], indexa: i32, plndef: [f64; 6], indexp: i32) -> [[f64; 6]; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ucrss(v1: [f64; 3], v2: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckfrot(inst: i32, et: f64) -> ([[f64; 3]; 3], i32, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckfxfm(inst: i32, et: f64) -> ([[f64; 6]; 6], i32, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn cklpf(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckmeta(ckid: i32, meta: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckupf(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafbbs(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafbfs(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafcls(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafcs(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafdc(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn daffna() -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn daffpa() -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafgh() -> i32 {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafgsr(handle: i32, recno: i32, begin: i32, end: i32) -> (Vec<f64>, bool) {
let words = (end - begin + 1).max(0) as usize;
let mut data = vec![0.0; words.max(1)];
let mut found = 0;
unsafe { crate::c::dafgsr_c(handle, recno, begin, end, data.as_mut_ptr(), &mut found) };
data.truncate(words);
(data, found != 0)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafhsf(handle: i32) -> (i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafopr(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafopw(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasdc(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
#[allow(clippy::type_complexity)]
pub fn dashfs(handle: i32) -> (i32, i32, i32, i32, i32, [i32; 3], [i32; 3], [i32; 3]) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn daslla(handle: i32) -> (i32, i32, i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasllc(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasonw(fname: &str, ftype: &str, ifname: &str, ncomr: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasops() -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasopw(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn daswbr(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlabns(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlaens(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlaopn(fname: &str, ftype: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pckcls(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pcklof(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pckopn(name: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pckuof(handle: i32) {}
}
pub const DAF_MAXSUM: usize = 125;
macro_rules! daf_read {
($($name:ident => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(handle: i32, begin: i32, end: i32) -> Vec<f64> {
let words = (end - begin + 1).max(0) as usize;
let mut data = vec![0.0; words.max(1)];
unsafe { crate::c::$cname(handle, begin, end, data.as_mut_ptr()) };
data.truncate(words);
data
}
)*};
}
daf_read! {
dafgda => dafgda_c, "Read double precision data from the current array of a DAF.";
dafrda => dafrda_c, "Read double precision data from a DAF; superseded by `dafgda`.";
}
cspice_proc! {
pub fn dafgn(#[lenout] lenout: i32) -> String {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafgs() -> Vec<f64> {
let mut summary = vec![0.0; DAF_MAXSUM];
unsafe { crate::c::dafgs_c(summary.as_mut_ptr()) };
summary
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafps(dc: &[f64], ic: &[i32]) -> Vec<f64> {
let words = dc.len() + (ic.len() + 1) / 2 + 1;
let mut summary = vec![0.0; words.max(1)];
unsafe {
crate::c::dafps_c(
dc.len() as SpiceInt,
ic.len() as SpiceInt,
dc.as_ptr() as *mut SpiceDouble,
ic.as_ptr() as *mut SpiceInt,
summary.as_mut_ptr(),
)
};
summary
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafus(summary: &[f64], nd: usize, ni: usize) -> (Vec<f64>, Vec<i32>) {
let mut dc = vec![0.0; nd.max(1)];
let mut ic = vec![0; ni.max(1)];
unsafe {
crate::c::dafus_c(
summary.as_ptr() as *mut SpiceDouble,
nd as SpiceInt,
ni as SpiceInt,
dc.as_mut_ptr(),
ic.as_mut_ptr(),
)
};
dc.truncate(nd);
ic.truncate(ni);
(dc, ic)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafrs(summary: &[f64]) {
unsafe { crate::c::dafrs_c(summary.as_ptr() as *mut SpiceDouble) }
}
#[allow(clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafrfr(handle: i32, lenout: usize) -> (i32, i32, String, i32, i32, i32) {
let mut ifname = vec![0 as SpiceChar; lenout.max(1)];
let (mut nd, mut ni, mut fward, mut bward, mut free) = (0, 0, 0, 0, 0);
unsafe {
crate::c::dafrfr_c(
handle,
lenout as SpiceInt,
&mut nd,
&mut ni,
ifname.as_mut_ptr(),
&mut fward,
&mut bward,
&mut free,
)
};
(nd, ni, from_cbuf(&ifname), fward, bward, free)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dafac<S: AsRef<str>>(handle: i32, buffer: &[S]) {
let (packed, lenvals) = to_strided(buffer);
unsafe {
crate::c::dafac_c(
handle,
buffer.len() as SpiceInt,
lenvals as SpiceInt,
packed.as_ptr().cast(),
)
}
}
pub fn dafec(handle: i32, bufsiz: usize, lenout: usize) -> (Vec<String>, bool) {
let lenout = lenout.max(1);
let mut buffer = vec![0 as SpiceChar; bufsiz.max(1) * lenout];
let (mut n, mut done) = (0, 0);
unsafe {
crate::c::dafec_c(
handle,
bufsiz as SpiceInt,
lenout as SpiceInt,
&mut n,
buffer.as_mut_ptr().cast(),
&mut done,
)
};
(from_strided(&buffer, lenout, n.max(0) as usize), done != 0)
}
macro_rules! das_read {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// Returns the `last - first + 1` words, addressed from one.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(handle: i32, first: i32, last: i32) -> Vec<$ty> {
let words = (last - first + 1).max(0) as usize;
let mut data = vec![<$ty>::default(); words.max(1)];
unsafe { crate::c::$cname(handle, first, last, data.as_mut_ptr()) };
data.truncate(words);
data
}
)*};
}
das_read! {
dasrdd(f64) => dasrdd_c, "Read double precision data from a DAS.";
dasrdi(i32) => dasrdi_c, "Read integer data from a DAS.";
}
macro_rules! das_update {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(handle: i32, first: i32, last: i32, data: &[$ty]) {
unsafe { crate::c::$cname(handle, first, last, data.as_ptr() as *mut _) }
}
)*};
}
das_update! {
dasudd(f64) => dasudd_c, "Update double precision data in a DAS.";
dasudi(i32) => dasudi_c, "Update integer data in a DAS.";
}
macro_rules! das_add {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(handle: i32, data: &[$ty]) {
unsafe {
crate::c::$cname(handle, data.len() as SpiceInt, data.as_ptr() as *mut _)
}
}
)*};
}
das_add! {
dasadd(f64) => dasadd_c, "Append double precision data to a DAS.";
dasadi(i32) => dasadi_c, "Append integer data to a DAS.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasadc<S: AsRef<str>>(handle: i32, bpos: i32, epos: i32, data: &[S]) {
let (packed, datlen) = to_strided(data);
let sublen = (epos - bpos + 1).max(0) as usize;
unsafe {
crate::c::dasadc_c(
handle,
(data.len() * sublen) as SpiceInt,
bpos,
epos,
datlen as SpiceInt,
packed.as_ptr().cast(),
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasrdc(handle: i32, first: i32, last: i32, bpos: i32, epos: i32) -> Vec<String> {
let sublen = (epos - bpos + 1).max(1) as usize;
let datlen = (epos + 1).max(1) as usize;
let lines = ((last - first + 1).max(0) as usize + sublen - 1) / sublen;
let mut data = vec![b' ' as SpiceChar; lines.max(1) * datlen];
unsafe {
crate::c::dasrdc_c(
handle,
first,
last,
bpos,
epos,
datlen as SpiceInt,
data.as_mut_ptr().cast(),
)
};
(0..lines)
.map(|line| {
data[line * datlen..(line + 1) * datlen]
.iter()
.map(|&byte| byte as u8 as char)
.collect()
})
.collect()
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasudc<S: AsRef<str>>(handle: i32, first: i32, last: i32, bpos: i32, epos: i32, data: &[S]) {
let datlen = (epos + 1).max(1) as usize;
let mut packed = vec![b' ' as SpiceChar; data.len().max(1) * datlen];
for (line, value) in data.iter().enumerate() {
let slot = &mut packed[line * datlen..(line + 1) * datlen];
for (target, byte) in slot.iter_mut().zip(value.as_ref().as_bytes()) {
*target = *byte as SpiceChar;
}
}
unsafe {
crate::c::dasudc_c(
handle,
first,
last,
bpos,
epos,
datlen as SpiceInt,
packed.as_ptr().cast(),
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasac<S: AsRef<str>>(handle: i32, buffer: &[S]) {
let (packed, buflen) = to_strided(buffer);
unsafe {
crate::c::dasac_c(
handle,
buffer.len() as SpiceInt,
buflen as SpiceInt,
packed.as_ptr().cast(),
)
}
}
pub fn dasec(handle: i32, bufsiz: usize, buflen: usize) -> (Vec<String>, bool) {
let buflen = buflen.max(1);
let mut buffer = vec![0 as SpiceChar; bufsiz.max(1) * buflen];
let (mut n, mut done) = (0, 0);
unsafe {
crate::c::dasec_c(
handle,
bufsiz as SpiceInt,
buflen as SpiceInt,
&mut n,
buffer.as_mut_ptr().cast(),
&mut done,
)
};
(from_strided(&buffer, buflen, n.max(0) as usize), done != 0)
}
cspice_proc! {
pub fn dashfn(handle: i32, #[lenout] namlen: i32) -> String {}
}
#[allow(clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dasrfr(handle: i32, idwlen: usize, ifnlen: usize) -> (String, String, i32, i32, i32, i32) {
let mut idword = vec![0 as SpiceChar; idwlen.max(1)];
let mut ifname = vec![0 as SpiceChar; ifnlen.max(1)];
let (mut nresvr, mut nresvc, mut ncomr, mut ncomc) = (0, 0, 0, 0);
unsafe {
crate::c::dasrfr_c(
handle,
idwlen as SpiceInt,
ifnlen as SpiceInt,
idword.as_mut_ptr(),
ifname.as_mut_ptr(),
&mut nresvr,
&mut nresvc,
&mut ncomr,
&mut ncomc,
)
};
(
from_cbuf(&idword),
from_cbuf(&ifname),
nresvr,
nresvc,
ncomr,
ncomc,
)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dlafps(handle: i32, descr: DLADSC) -> (DLADSC, bool) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spk14b(handle: i32, segid: &str, body: i32, center: i32, frame: &str, first: f64, last: f64, chbdeg: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spk14e(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkacs(targ: i32, et: f64, frame: &str, abcorr: &str, obs: i32) -> ([f64; 6], f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkapo(targ: i32, et: f64, frame: &str, sobs: [f64; 6], abcorr: &str) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkapp(targ: i32, et: f64, frame: &str, sobs: [f64; 6], abcorr: &str) -> ([f64; 6], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkaps(targ: i32, et: f64, frame: &str, abcorr: &str, stobs: [f64; 6], accobs: [f64; 3]) -> ([f64; 6], f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkgps(targ: i32, et: f64, frame: &str, obs: i32) -> ([f64; 3], f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkltc(targ: i32, et: f64, frame: &str, abcorr: &str, stobs: [f64; 6]) -> ([f64; 6], f64, f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkpds(body: i32, center: i32, frame: &str, kind: i32, first: f64, last: f64) -> [f64; 5] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkpvn(handle: i32, descr: [f64; 5], et: f64) -> (i32, [f64; 6], i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkssb(targ: i32, et: f64, frame: &str) -> [f64; 6] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkuef(handle: i32) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkw15(handle: i32, body: i32, center: i32, frame: &str, first: f64, last: f64, segid: &str, epoch: f64, tp: [f64; 3], pa: [f64; 3], p: f64, ecc: f64, j2flg: f64, pv: [f64; 3], gm: f64, j2: f64, radius: f64) {}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkw17(handle: i32, body: i32, center: i32, frame: &str, first: f64, last: f64, segid: &str, epoch: f64, eqel: [f64; 9], rapol: f64, decpol: f64) {}
}
pub const SPK_DSCSIZ: usize = 5;
macro_rules! spk_chebyshev {
($($name:ident => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
body: i32,
center: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
intlen: f64,
n: i32,
polydg: i32,
cdata: &[f64],
btime: f64,
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::$cname(
handle, body, center,
frame.as_ptr() as *mut SpiceChar,
first, last,
segid.as_ptr() as *mut SpiceChar,
intlen, n, polydg,
cdata.as_ptr() as *mut SpiceDouble,
btime,
);
}
}
)*};
}
spk_chebyshev! {
spkw02 => spkw02_c, "Write a type 2 segment: Chebyshev polynomials for position.";
spkw03 => spkw03_c, "Write a type 3 segment: Chebyshev polynomials for position and velocity.";
}
macro_rules! spk_states_at_epochs {
($($name:ident($mid:ident: $midty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// # Panics
///
/// Panics if `n` is larger than `states` or `epochs`.
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
body: i32,
center: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
$mid: $midty,
n: i32,
states: &[[f64; 6]],
epochs: &[f64],
) {
let count = usize::try_from(n).expect("the record count cannot be negative");
assert!(
count <= states.len() && count <= epochs.len(),
"asked for {count} records but got {} states and {} epochs",
states.len(),
epochs.len()
);
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::$cname(
handle, body, center,
frame.as_ptr() as *mut SpiceChar,
first, last,
segid.as_ptr() as *mut SpiceChar,
$mid, n,
states.as_ptr() as *mut [SpiceDouble; 6],
epochs.as_ptr() as *mut SpiceDouble,
);
}
}
)*};
}
spk_states_at_epochs! {
spkw05(gm: f64) => spkw05_c,
"Write a type 5 segment: discrete states propagated with two body dynamics.";
spkw13(degree: i32) => spkw13_c,
"Write a type 13 segment: Hermite interpolation of unequally spaced states.";
}
macro_rules! spk_states_evenly_spaced {
($($name:ident => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
body: i32,
center: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
degree: i32,
n: i32,
states: &[[f64; 6]],
epoch0: f64,
step: f64,
) {
let count = usize::try_from(n).expect("the record count cannot be negative");
assert!(count <= states.len(), "asked for {count} states but got {}", states.len());
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::$cname(
handle, body, center,
frame.as_ptr() as *mut SpiceChar,
first, last,
segid.as_ptr() as *mut SpiceChar,
degree, n,
states.as_ptr() as *mut [SpiceDouble; 6],
epoch0, step,
);
}
}
)*};
}
spk_states_evenly_spaced! {
spkw08 => spkw08_c, "Write a type 8 segment: Lagrange interpolation of evenly spaced states.";
spkw12 => spkw12_c, "Write a type 12 segment: Hermite interpolation of evenly spaced states.";
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkw10(
handle: i32,
body: i32,
center: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
consts: &[f64],
n: i32,
elems: &[f64],
epochs: &[f64],
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::spkw10_c(
handle,
body,
center,
frame.as_ptr() as *mut SpiceChar,
first,
last,
segid.as_ptr() as *mut SpiceChar,
consts.as_ptr() as *mut SpiceDouble,
n,
elems.as_ptr() as *mut SpiceDouble,
epochs.as_ptr() as *mut SpiceDouble,
);
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkw18(
handle: i32,
subtyp: i32,
body: i32,
center: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
degree: i32,
n: i32,
packts: &[f64],
epochs: &[f64],
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::spkw18_c(
handle,
subtyp as crate::c::SpiceSPK18Subtype,
body,
center,
frame.as_ptr() as *mut SpiceChar,
first,
last,
segid.as_ptr() as *mut SpiceChar,
degree,
n,
packts.as_ptr().cast(),
epochs.as_ptr() as *mut SpiceDouble,
);
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkw20(
handle: i32,
body: i32,
center: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
intlen: f64,
n: i32,
polydg: i32,
cdata: &[f64],
dscale: f64,
tscale: f64,
initjd: f64,
initfr: f64,
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::spkw20_c(
handle,
body,
center,
frame.as_ptr() as *mut SpiceChar,
first,
last,
segid.as_ptr() as *mut SpiceChar,
intlen,
n,
polydg,
cdata.as_ptr() as *mut SpiceDouble,
dscale,
tscale,
initjd,
initfr,
);
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spk14a(handle: i32, ncsets: i32, coeffs: &[f64], epochs: &[f64]) {
unsafe {
crate::c::spk14a_c(
handle,
ncsets,
coeffs.as_ptr() as *mut SpiceDouble,
epochs.as_ptr() as *mut SpiceDouble,
)
}
}
pub fn spksfs(body: i32, et: f64, idlen: usize) -> (i32, [f64; SPK_DSCSIZ], String, bool) {
let mut descr = [0.0; SPK_DSCSIZ];
let mut ident = vec![0 as SpiceChar; idlen.max(1)];
let (mut handle, mut found) = (0, 0);
unsafe {
crate::c::spksfs_c(
body,
et,
idlen as SpiceInt,
&mut handle,
descr.as_mut_ptr(),
ident.as_mut_ptr(),
&mut found,
)
};
(handle, descr, from_cbuf(&ident), found != 0)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spklef(filename: &str) -> i32 {}
}
#[allow(clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spkuds(descr: &[f64]) -> (i32, i32, i32, i32, f64, f64, i32, i32) {
let (mut body, mut center, mut frame, mut kind) = (0, 0, 0, 0);
let (mut first, mut last) = (0.0, 0.0);
let (mut begin, mut end) = (0, 0);
unsafe {
crate::c::spkuds_c(
descr.as_ptr() as *mut SpiceDouble,
&mut body,
&mut center,
&mut frame,
&mut kind,
&mut first,
&mut last,
&mut begin,
&mut end,
)
};
(body, center, frame, kind, first, last, begin, end)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn spksub(handle: i32, descr: &mut [f64], ident: &str, begin: f64, end: f64, newh: i32) {
let ident = to_cstring(ident);
unsafe {
crate::c::spksub_c(
handle,
descr.as_mut_ptr(),
ident.as_ptr() as *mut SpiceChar,
begin,
end,
newh,
)
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckw01(
handle: i32,
begtime: f64,
endtime: f64,
inst: i32,
frame: &str,
avflag: bool,
segid: &str,
nrec: i32,
sclkdp: &[f64],
quats: &[[f64; 4]],
avvs: &[[f64; 3]],
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::ckw01_c(
handle,
begtime,
endtime,
inst,
frame.as_ptr() as *mut SpiceChar,
avflag as crate::c::SpiceBoolean,
segid.as_ptr() as *mut SpiceChar,
nrec,
sclkdp.as_ptr() as *mut SpiceDouble,
quats.as_ptr() as *mut [SpiceDouble; 4],
avvs.as_ptr() as *mut [SpiceDouble; 3],
);
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckw02(
handle: i32,
begtim: f64,
endtim: f64,
inst: i32,
frame: &str,
segid: &str,
nrec: i32,
start: &[f64],
stop: &[f64],
quats: &[[f64; 4]],
avvs: &[[f64; 3]],
rates: &[f64],
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::ckw02_c(
handle,
begtim,
endtim,
inst,
frame.as_ptr() as *mut SpiceChar,
segid.as_ptr() as *mut SpiceChar,
nrec,
start.as_ptr() as *mut SpiceDouble,
stop.as_ptr() as *mut SpiceDouble,
quats.as_ptr() as *mut [SpiceDouble; 4],
avvs.as_ptr() as *mut [SpiceDouble; 3],
rates.as_ptr() as *mut SpiceDouble,
);
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ckw05(
handle: i32,
subtyp: i32,
degree: i32,
begtim: f64,
endtim: f64,
inst: i32,
frame: &str,
avflag: bool,
segid: &str,
n: i32,
sclkdp: &[f64],
packets: &[f64],
rate: f64,
nints: i32,
starts: &[f64],
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::ckw05_c(
handle,
subtyp as crate::c::SpiceCK05Subtype,
degree,
begtim,
endtim,
inst,
frame.as_ptr() as *mut SpiceChar,
avflag as crate::c::SpiceBoolean,
segid.as_ptr() as *mut SpiceChar,
n,
sclkdp.as_ptr() as *mut SpiceDouble,
packets.as_ptr().cast(),
rate,
nints,
starts.as_ptr() as *mut SpiceDouble,
);
}
}
macro_rules! ck_record {
($($name:ident => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(handle: i32, descr: &[f64], recno: i32, room: usize) -> Vec<f64> {
let mut record = vec![0.0; room.max(1)];
unsafe {
crate::c::$cname(
handle,
descr.as_ptr() as *mut SpiceDouble,
recno,
record.as_mut_ptr(),
)
};
record
}
)*};
}
ck_record! {
ckgr02 => ckgr02_c, "Read a pointing record from a type 2 CK segment.";
ckgr03 => ckgr03_c, "Read a pointing record from a type 3 CK segment.";
}
macro_rules! ck_record_count {
($($name:ident => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(handle: i32, descr: &[f64]) -> i32 {
let mut nrec = 0;
unsafe {
crate::c::$cname(handle, descr.as_ptr() as *mut SpiceDouble, &mut nrec)
};
nrec
}
)*};
}
ck_record_count! {
cknr02 => cknr02_c, "Number of pointing records in a type 2 CK segment.";
cknr03 => cknr03_c, "Number of pointing records in a type 3 CK segment.";
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pckw02(
handle: i32,
clssid: i32,
frame: &str,
first: f64,
last: f64,
segid: &str,
intlen: f64,
n: i32,
polydg: i32,
cdata: &[f64],
btime: f64,
) {
let frame = to_cstring(frame);
let segid = to_cstring(segid);
unsafe {
crate::c::pckw02_c(
handle,
clssid,
frame.as_ptr() as *mut SpiceChar,
first,
last,
segid.as_ptr() as *mut SpiceChar,
intlen,
n,
polydg,
cdata.as_ptr() as *mut SpiceDouble,
btime,
);
}
}
#[allow(clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskb02(
handle: i32,
dladsc: DLADSC,
) -> (
i32,
i32,
i32,
[[f64; 2]; 3],
f64,
[f64; 3],
[i32; 3],
i32,
i32,
i32,
i32,
) {
let mut dladsc = dladsc;
let (mut nv, mut np, mut nvxtot) = (0, 0, 0);
let mut vtxbds = [[0.0; 2]; 3];
let mut voxsiz = 0.0;
let mut voxori = [0.0; 3];
let mut vgrext = [0; 3];
let (mut cgscal, mut vtxnpl, mut voxnpt, mut voxnpl) = (0, 0, 0, 0);
unsafe {
crate::c::dskb02_c(
handle,
&mut dladsc,
&mut nv,
&mut np,
&mut nvxtot,
vtxbds.as_mut_ptr(),
&mut voxsiz,
voxori.as_mut_ptr(),
vgrext.as_mut_ptr(),
&mut cgscal,
&mut vtxnpl,
&mut voxnpt,
&mut voxnpl,
)
};
(
nv, np, nvxtot, vtxbds, voxsiz, voxori, vgrext, cgscal, vtxnpl, voxnpt, voxnpl,
)
}
macro_rules! dsk_fetch {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// `item` is one of the [`dsk02`] keywords and at most `room` values are returned.
///
/// `start` counts from **zero**, unlike most of the toolkit: the vertex indices of the
/// first plate are at `start` 0, even though plate IDs themselves start at 1.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
dladsc: DLADSC,
item: i32,
start: i32,
room: usize,
) -> Vec<$ty> {
let mut dladsc = dladsc;
let mut values = vec![<$ty>::default(); room.max(1)];
let mut n = 0;
unsafe {
crate::c::$cname(
handle,
&mut dladsc,
item,
start,
room as SpiceInt,
&mut n,
values.as_mut_ptr(),
)
};
values.truncate(n.max(0) as usize);
values
}
)*};
}
dsk_fetch! {
dskd02(f64) => dskd02_c, "Fetch double precision data from a type 2 DSK segment.";
dski02(i32) => dski02_c, "Fetch integer data from a type 2 DSK segment.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn dskrb2(vrtces: &[[f64; 3]], plates: &[[i32; 3]], corsys: i32, corpar: &[f64]) -> (f64, f64) {
assert!(
corpar.len() >= DSK_NSYPAR,
"dskrb2 needs {DSK_NSYPAR} coordinate parameters but got {}",
corpar.len()
);
let (mut mncor3, mut mxcor3) = (0.0, 0.0);
unsafe {
crate::c::dskrb2_c(
vrtces.len() as SpiceInt,
vrtces.as_ptr() as *mut [f64; 3],
plates.len() as SpiceInt,
plates.as_ptr() as *mut [SpiceInt; 3],
corsys,
corpar.as_ptr() as *mut SpiceDouble,
&mut mncor3,
&mut mxcor3,
)
};
(mncor3, mxcor3)
}
cspice_proc! {
pub fn scfmt(sc: i32, ticks: f64, #[lenout] clkstrlen: i32) -> String {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn scpart(sc: i32, maxparts: usize) -> (Vec<f64>, Vec<f64>) {
let mut pstart = vec![0.0; maxparts.max(1)];
let mut pstop = vec![0.0; maxparts.max(1)];
let mut nparts = 0;
unsafe { crate::c::scpart_c(sc, &mut nparts, pstart.as_mut_ptr(), pstop.as_mut_ptr()) };
let count = nparts.max(0) as usize;
pstart.truncate(count);
pstop.truncate(count);
(pstart, pstop)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn chbint(cp: &[f64], degp: i32, x2s: [f64; 2], x: f64) -> (f64, f64) {
let (mut p, mut dpdx) = (0.0, 0.0);
unsafe {
crate::c::chbint_c(
cp.as_ptr() as *mut SpiceDouble,
degp,
x2s.as_ptr() as *mut SpiceDouble,
x,
&mut p,
&mut dpdx,
)
};
(p, dpdx)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn chbval(cp: &[f64], degp: i32, x2s: [f64; 2], x: f64) -> f64 {
let mut p = 0.0;
unsafe {
crate::c::chbval_c(
cp.as_ptr() as *mut SpiceDouble,
degp,
x2s.as_ptr() as *mut SpiceDouble,
x,
&mut p,
)
};
p
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn chbigr(degp: i32, cp: &[f64], x2s: [f64; 2], x: f64) -> (f64, f64) {
let (mut p, mut itgrlp) = (0.0, 0.0);
unsafe {
crate::c::chbigr_c(
degp,
cp.as_ptr() as *mut SpiceDouble,
x2s.as_ptr() as *mut SpiceDouble,
x,
&mut p,
&mut itgrlp,
)
};
(p, itgrlp)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn chbder(cp: &[f64], degp: i32, x2s: [f64; 2], x: f64, nderiv: i32) -> Vec<f64> {
let count = nderiv.max(0) as usize + 1;
let mut partdp = vec![0.0; 3 * count.max(1)];
let mut dpdxs = vec![0.0; count.max(1)];
let mut x2s = x2s;
unsafe {
crate::c::chbder_c(
cp.as_ptr() as *mut SpiceDouble,
degp,
x2s.as_mut_ptr(),
x,
nderiv,
partdp.as_mut_ptr(),
dpdxs.as_mut_ptr(),
)
};
dpdxs
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn polyds(coeffs: &[f64], deg: i32, nderiv: i32, t: f64) -> Vec<f64> {
let mut p = vec![0.0; nderiv.max(0) as usize + 1];
unsafe {
crate::c::polyds_c(
coeffs.as_ptr() as *mut SpiceDouble,
deg,
nderiv,
t,
p.as_mut_ptr(),
)
};
p
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn hrmesp(first: f64, step: f64, yvals: &[f64], x: f64) -> (f64, f64) {
let n = (yvals.len() / 2) as SpiceInt;
let (mut f, mut df) = (0.0, 0.0);
unsafe {
crate::c::hrmesp_c(
n,
first,
step,
yvals.as_ptr() as *mut SpiceDouble,
x,
&mut f,
&mut df,
)
};
(f, df)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn hrmint(xvals: &[f64], yvals: &[f64], x: f64) -> (f64, f64) {
let n = xvals.len() as SpiceInt;
let mut work = vec![0.0; (4 * xvals.len() + 4).max(1)];
let (mut f, mut df) = (0.0, 0.0);
unsafe {
crate::c::hrmint_c(
n,
xvals.as_ptr() as *mut SpiceDouble,
yvals.as_ptr() as *mut SpiceDouble,
x,
work.as_mut_ptr(),
&mut f,
&mut df,
)
};
(f, df)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lgresp(first: f64, step: f64, yvals: &[f64], x: f64) -> f64 {
unsafe {
crate::c::lgresp_c(
yvals.len() as SpiceInt,
first,
step,
yvals.as_ptr() as *mut SpiceDouble,
x,
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lgrint(xvals: &[f64], yvals: &[f64], x: f64) -> f64 {
unsafe {
crate::c::lgrint_c(
xvals.len() as SpiceInt,
xvals.as_ptr() as *mut SpiceDouble,
yvals.as_ptr() as *mut SpiceDouble,
x,
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lgrind(xvals: &[f64], yvals: &[f64], x: f64) -> (f64, f64) {
let mut work = vec![0.0; (2 * xvals.len() + 2).max(1)];
let (mut p, mut dp) = (0.0, 0.0);
unsafe {
crate::c::lgrind_c(
xvals.len() as SpiceInt,
xvals.as_ptr() as *mut SpiceDouble,
yvals.as_ptr() as *mut SpiceDouble,
work.as_mut_ptr(),
x,
&mut p,
&mut dp,
)
};
(p, dp)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn qderiv(f0: &[f64], f2: &[f64], delta: f64) -> Vec<f64> {
let ndim = f0.len().min(f2.len());
let mut dfdt = vec![0.0; ndim.max(1)];
unsafe {
crate::c::qderiv_c(
ndim as SpiceInt,
f0.as_ptr() as *mut SpiceDouble,
f2.as_ptr() as *mut SpiceDouble,
delta,
dfdt.as_mut_ptr(),
)
};
dfdt.truncate(ndim);
dfdt
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pltar(vrtces: &[[f64; 3]], plates: &[[i32; 3]]) -> f64 {
unsafe {
crate::c::pltar_c(
vrtces.len() as SpiceInt,
vrtces.as_ptr() as *mut [f64; 3],
plates.len() as SpiceInt,
plates.as_ptr() as *mut [SpiceInt; 3],
)
}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pltvol(vrtces: &[[f64; 3]], plates: &[[i32; 3]]) -> f64 {
unsafe {
crate::c::pltvol_c(
vrtces.len() as SpiceInt,
vrtces.as_ptr() as *mut [f64; 3],
plates.len() as SpiceInt,
plates.as_ptr() as *mut [SpiceInt; 3],
)
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pltnrm(v1: [f64; 3], v2: [f64; 3], v3: [f64; 3]) -> [f64; 3] {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn pltnp(
point: [f64; 3],
v1: [f64; 3],
v2: [f64; 3],
v3: [f64; 3]
) -> ([f64; 3], f64) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn diags2(symmat: [[f64; 2]; 2]) -> ([[f64; 2]; 2], [[f64; 2]; 2]) {}
}
macro_rules! linear_search {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// Returns the index found, or `-1`.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(value: $ty, array: &[$ty]) -> i32 {
unsafe { crate::c::$cname(value, array.len() as SpiceInt, array.as_ptr() as *mut _) }
}
)*};
}
linear_search! {
isrchd(f64) => isrchd_c, "Search an unordered array of doubles.";
isrchi(i32) => isrchi_c, "Search an unordered array of integers.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn isrchc<S: AsRef<str>>(value: &str, array: &[S]) -> i32 {
let value = to_cstring(value);
let (buffer, stride) = to_strided(array);
unsafe {
crate::c::isrchc_c(
value.as_ptr() as *mut SpiceChar,
array.len() as SpiceInt,
stride as SpiceInt,
buffer.as_ptr().cast(),
)
}
}
macro_rules! ordinal {
($($name:ident($ty:ty, $cell:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// Positions run from zero; the result is `-1` when the item is not in the set.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(item: $ty, set: &mut Cell<$cell>) -> i32 {
let raw = set.as_mut_ptr();
unsafe { crate::c::$cname(item, raw) }
}
)*};
}
ordinal! {
ordd(f64, f64) => ordd_c, "The ordinal position of a double precision number in a set.";
ordi(i32, i32) => ordi_c, "The ordinal position of an integer in a set.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ordc(item: &str, set: &mut Cell<String>) -> i32 {
let item = to_cstring(item);
let raw = set.as_mut_ptr();
unsafe { crate::c::ordc_c(item.as_ptr() as *mut SpiceChar, raw) }
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn sdiff<T: CellItem>(a: &mut Cell<T>, b: &mut Cell<T>, c: &mut Cell<T>) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn set<T: CellItem>(a: &mut Cell<T>, op: &str, b: &mut Cell<T>) -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lparss(list: &str, delims: &str, set: &mut Cell<String>) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn kplfrm(frmcls: i32, idset: &mut Cell<i32>) {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn lmpool<S: AsRef<str>>(cvals: &[S]) {
let (buffer, lenvals) = to_strided(cvals);
unsafe {
crate::c::lmpool_c(
buffer.as_ptr().cast(),
lenvals as SpiceInt,
cvals.len() as SpiceInt,
)
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn szpool(name: &str) -> (i32, bool) {}
}
pub fn stpool(item: &str, nth: i32, contin: &str, lenout: usize) -> (String, i32, bool) {
let item = to_cstring(item);
let contin = to_cstring(contin);
let mut string = vec![0 as SpiceChar; lenout.max(1)];
let (mut size, mut found) = (0, 0);
unsafe {
crate::c::stpool_c(
item.as_ptr() as *mut SpiceChar,
nth,
contin.as_ptr() as *mut SpiceChar,
lenout as SpiceInt,
string.as_mut_ptr(),
&mut size,
&mut found,
)
};
(from_cbuf(&string), size, found != 0)
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn exists(name: &str) -> bool {}
}
pub fn getfat(file: &str, arclen: usize, typlen: usize) -> (String, String) {
let file = to_cstring(file);
let mut arch = vec![0 as SpiceChar; arclen.max(1)];
let mut kind = vec![0 as SpiceChar; typlen.max(1)];
unsafe {
crate::c::getfat_c(
file.as_ptr() as *mut SpiceChar,
arclen as SpiceInt,
typlen as SpiceInt,
arch.as_mut_ptr(),
kind.as_mut_ptr(),
)
};
(from_cbuf(&arch), from_cbuf(&kind))
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn rdtext(file: &str, lenout: usize) -> (String, bool) {
let file = to_cstring(file);
let mut line = vec![0 as SpiceChar; lenout.max(1)];
let mut eof = 0;
unsafe {
crate::c::rdtext_c(
file.as_ptr() as *mut SpiceChar,
lenout as SpiceInt,
line.as_mut_ptr(),
&mut eof,
)
};
(from_cbuf(&line), eof != 0)
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn frinfo(frcode: i32) -> (i32, i32, i32, bool) {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn frame(x: [f64; 3]) -> ([f64; 3], [f64; 3], [f64; 3]) {
let mut x = x;
let (mut y, mut z) = ([0.0; 3], [0.0; 3]);
unsafe { crate::c::frame_c(x.as_mut_ptr(), y.as_mut_ptr(), z.as_mut_ptr()) };
(x, y, z)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn fovray(
inst: &str,
raydir: [f64; 3],
rframe: &str,
abcorr: &str,
obsrvr: &str,
et: f64,
) -> bool {
let inst = to_cstring(inst);
let rframe = to_cstring(rframe);
let abcorr = to_cstring(abcorr);
let obsrvr = to_cstring(obsrvr);
let mut raydir = raydir;
let mut et = et;
let mut visible = 0;
unsafe {
crate::c::fovray_c(
inst.as_ptr() as *mut SpiceChar,
raydir.as_mut_ptr(),
rframe.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
&mut et,
&mut visible,
)
};
visible != 0
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn fovtrg(
inst: &str,
target: &str,
tshape: &str,
tframe: &str,
abcorr: &str,
obsrvr: &str,
et: f64,
) -> bool {
let inst = to_cstring(inst);
let target = to_cstring(target);
let tshape = to_cstring(tshape);
let tframe = to_cstring(tframe);
let abcorr = to_cstring(abcorr);
let obsrvr = to_cstring(obsrvr);
let mut et = et;
let mut visible = 0;
unsafe {
crate::c::fovtrg_c(
inst.as_ptr() as *mut SpiceChar,
target.as_ptr() as *mut SpiceChar,
tshape.as_ptr() as *mut SpiceChar,
tframe.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
&mut et,
&mut visible,
)
};
visible != 0
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn illumg(
method: &str,
target: &str,
ilusrc: &str,
et: f64,
fixref: &str,
abcorr: &str,
obsrvr: &str,
spoint: [f64; 3]
) -> (f64, [f64; 3], f64, f64, f64) {
}
}
pub fn getfvn(
inst: &str,
room: usize,
shalen: usize,
fralen: usize,
) -> (String, String, [f64; 3], Vec<[f64; 3]>) {
let inst = to_cstring(inst);
let mut shape = vec![0 as SpiceChar; shalen.max(1)];
let mut frame = vec![0 as SpiceChar; fralen.max(1)];
let mut bsight = [0.0; 3];
let mut n = 0;
let mut bounds = vec![[0.0; 3]; room.max(1)];
unsafe {
crate::c::getfvn_c(
inst.as_ptr() as *mut SpiceChar,
room as SpiceInt,
shalen as SpiceInt,
fralen as SpiceInt,
shape.as_mut_ptr(),
frame.as_mut_ptr(),
bsight.as_mut_ptr(),
&mut n,
bounds.as_mut_ptr(),
)
};
bounds.truncate(n.max(0) as usize);
(from_cbuf(&shape), from_cbuf(&frame), bsight, bounds)
}
#[allow(clippy::type_complexity)]
pub fn et2lst(
et: f64,
body: i32,
lon: f64,
kind: &str,
timlen: usize,
ampmlen: usize,
) -> (i32, i32, i32, String, String) {
let kind = to_cstring(kind);
let mut time = vec![0 as SpiceChar; timlen.max(1)];
let mut ampm = vec![0 as SpiceChar; ampmlen.max(1)];
let (mut hr, mut mn, mut sc) = (0, 0, 0);
unsafe {
crate::c::et2lst_c(
et,
body,
lon,
kind.as_ptr() as *mut SpiceChar,
timlen as SpiceInt,
ampmlen as SpiceInt,
&mut hr,
&mut mn,
&mut sc,
time.as_mut_ptr(),
ampm.as_mut_ptr(),
)
};
(hr, mn, sc, from_cbuf(&time), from_cbuf(&m))
}
pub fn tpictr(sample: &str, lenpictur: usize, lenerror: usize) -> (String, bool, String) {
let sample = to_cstring(sample);
let mut pictur = vec![0 as SpiceChar; lenpictur.max(1)];
let mut errmsg = vec![0 as SpiceChar; lenerror.max(1)];
let mut ok = 0;
unsafe {
crate::c::tpictr_c(
sample.as_ptr() as *mut SpiceChar,
lenpictur as SpiceInt,
lenerror as SpiceInt,
pictur.as_mut_ptr(),
&mut ok,
errmsg.as_mut_ptr(),
)
};
(from_cbuf(&pictur), ok != 0, from_cbuf(&errmsg))
}
pub fn timdef(action: &str, item: &str, value: &str, lenout: usize) -> String {
let action = to_cstring(action);
let item = to_cstring(item);
let mut buffer = vec![0 as SpiceChar; lenout.max(value.len() + 1)];
for (target, byte) in buffer.iter_mut().zip(value.as_bytes()) {
*target = *byte as SpiceChar;
}
unsafe {
crate::c::timdef_c(
action.as_ptr() as *mut SpiceChar,
item.as_ptr() as *mut SpiceChar,
buffer.len() as SpiceInt,
buffer.as_mut_ptr(),
)
};
from_cbuf(&buffer)
}
cspice_proc! {
pub fn trcnam(index: i32, #[lenout] namelen: i32) -> String {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn trcoff() {}
}
cspice_proc! {
pub fn repmct(
input: &str,
marker: &str,
value: i32,
strcase: char,
#[lenout] lenout: i32
) -> String {
}
}
#[allow(clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn kxtrct<S: AsRef<str>>(
keywd: &str,
terms: &[S],
string: &str,
stringlen: usize,
substrlen: usize,
) -> (String, bool, String) {
let keywd = to_cstring(keywd);
let (packed, termlen) = to_strided(terms);
let mut buffer = vec![0 as SpiceChar; stringlen.max(string.len() + 1)];
for (target, byte) in buffer.iter_mut().zip(string.as_bytes()) {
*target = *byte as SpiceChar;
}
let mut substr = vec![0 as SpiceChar; substrlen.max(1)];
let mut found = 0;
unsafe {
crate::c::kxtrct_c(
keywd.as_ptr() as *mut SpiceChar,
termlen as SpiceInt,
packed.as_ptr().cast(),
terms.len() as SpiceInt,
buffer.len() as SpiceInt,
substrlen as SpiceInt,
buffer.as_mut_ptr(),
&mut found,
substr.as_mut_ptr(),
)
};
(from_cbuf(&buffer), found != 0, from_cbuf(&substr))
}
macro_rules! gf_search {
($($name:ident($($arg:ident: $ty:ty),*) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// `relate` is one of `"="`, `"<"`, `">"`, `"LOCMIN"`, `"ABSMIN"`, `"LOCMAX"` or
/// `"ABSMAX"`; `nintvls` is the room to make in `result`, in intervals.
#[allow(clippy::too_many_arguments)]
pub fn $name(
$($arg: $ty,)*
relate: &str,
refval: f64,
adjust: f64,
step: f64,
nintvls: i32,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>,
) {
$(let $arg = crate::core::ffi::In::new($arg);)*
let relate = to_cstring(relate);
#[allow(unused_mut)]
let ($(mut $arg,)*) = ($($arg,)*);
let cnfine = cnfine.as_mut_ptr();
let result = result.as_mut_ptr();
unsafe {
crate::c::$cname(
$($arg.raw() as _,)*
relate.as_ptr() as *mut SpiceChar,
refval,
adjust,
step,
nintvls,
cnfine,
result,
);
}
}
)*};
}
gf_search! {
gfdist(target: &str, abcorr: &str, obsrvr: &str) => gfdist_c,
"Search for times when the distance to a target meets a condition.";
gfrr(target: &str, abcorr: &str, obsrvr: &str) => gfrr_c,
"Search for times when the range rate of a target meets a condition.";
gfpa(target: &str, illmn: &str, abcorr: &str, obsrvr: &str) => gfpa_c,
"Search for times when the phase angle of a target meets a condition.";
gfposc(
target: &str, frame: &str, abcorr: &str, obsrvr: &str, crdsys: &str, coord: &str
) => gfposc_c,
"Search for times when a coordinate of a target's position meets a condition.";
gfsubc(
target: &str, fixref: &str, method: &str, abcorr: &str, obsrvr: &str, crdsys: &str,
coord: &str
) => gfsubc_c,
"Search for times when a coordinate of the sub-observer point meets a condition.";
gfsntc(
target: &str, fixref: &str, method: &str, abcorr: &str, obsrvr: &str, dref: &str,
dvec: [f64; 3], crdsys: &str, coord: &str
) => gfsntc_c,
"Search for times when a coordinate of a ray-surface intercept meets a condition.";
gfsep(
targ1: &str, shape1: &str, frame1: &str, targ2: &str, shape2: &str, frame2: &str,
abcorr: &str, obsrvr: &str
) => gfsep_c,
"Search for times when the angular separation of two targets meets a condition.";
gfilum(
method: &str, angtyp: &str, target: &str, illmn: &str, fixref: &str, abcorr: &str,
obsrvr: &str, spoint: [f64; 3]
) => gfilum_c,
"Search for times when an illumination angle at a surface point meets a condition.";
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
pub fn gfrfov(
inst: &str,
raydir: [f64; 3],
rframe: &str,
abcorr: &str,
obsrvr: &str,
step: f64,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>
) {
}
}
cspice_proc! {
#[allow(clippy::too_many_arguments)]
pub fn gftfov(
inst: &str,
target: &str,
tshape: &str,
tframe: &str,
abcorr: &str,
obsrvr: &str,
step: f64,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>
) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfsstp(step: f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfstep(time: f64) -> f64 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfstol(value: f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfrefn(t1: f64, t2: f64, s1: bool, s2: bool) -> f64 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfbail() -> bool {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfclrh() {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfinth(sigcode: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfrepi(window: &mut Cell<f64>, begmss: &str, endmss: &str) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfrepu(ivbeg: f64, ivend: f64, time: f64) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfrepf() {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn udf(x: f64) -> f64 {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn uddc(udfunc: UdFunc, x: f64, dx: f64) -> bool {
let mut isdecr = 0;
unsafe { crate::c::uddc_c(Some(udfunc), x, dx, &mut isdecr) };
isdecr != 0
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn uddf(udfunc: UdFunc, x: f64, dx: f64) -> f64 {
let mut deriv = 0.0;
unsafe { crate::c::uddf_c(Some(udfunc), x, dx, &mut deriv) };
deriv
}
#[allow(clippy::too_many_arguments)]
pub fn gfuds(
udfuns: UdFuns,
udfunb: UdFunb,
relate: &str,
refval: f64,
adjust: f64,
step: f64,
nintvls: i32,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>,
) {
let relate = to_cstring(relate);
let cnfine = cnfine.as_mut_ptr();
let result = result.as_mut_ptr();
unsafe {
crate::c::gfuds_c(
Some(udfuns),
Some(udfunb),
relate.as_ptr() as *mut SpiceChar,
refval,
adjust,
step,
nintvls,
cnfine,
result,
);
}
}
pub fn gfudb(
udfuns: UdFuns,
udfunb: UdFunb,
step: f64,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>,
) {
let cnfine = cnfine.as_mut_ptr();
let result = result.as_mut_ptr();
unsafe { crate::c::gfudb_c(Some(udfuns), Some(udfunb), step, cnfine, result) };
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfocce(
occtyp: &str,
front: &str,
fshape: &str,
fframe: &str,
back: &str,
bshape: &str,
bframe: &str,
abcorr: &str,
obsrvr: &str,
tol: f64,
udstep: UdStep,
udrefn: UdRefn,
rpt: bool,
udrepi: UdRepi,
udrepu: UdRepu,
udrepf: UdRepf,
bail: bool,
udbail: UdBail,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>,
) {
let occtyp = to_cstring(occtyp);
let front = to_cstring(front);
let fshape = to_cstring(fshape);
let fframe = to_cstring(fframe);
let back = to_cstring(back);
let bshape = to_cstring(bshape);
let bframe = to_cstring(bframe);
let abcorr = to_cstring(abcorr);
let obsrvr = to_cstring(obsrvr);
let cnfine = cnfine.as_mut_ptr();
let result = result.as_mut_ptr();
unsafe {
crate::c::gfocce_c(
occtyp.as_ptr() as *mut SpiceChar,
front.as_ptr() as *mut SpiceChar,
fshape.as_ptr() as *mut SpiceChar,
fframe.as_ptr() as *mut SpiceChar,
back.as_ptr() as *mut SpiceChar,
bshape.as_ptr() as *mut SpiceChar,
bframe.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
tol,
Some(udstep),
Some(udrefn),
rpt as crate::c::SpiceBoolean,
Some(udrepi),
Some(udrepu),
Some(udrepf),
bail as crate::c::SpiceBoolean,
Some(udbail),
cnfine,
result,
);
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gffove(
inst: &str,
tshape: &str,
raydir: [f64; 3],
target: &str,
tframe: &str,
abcorr: &str,
obsrvr: &str,
tol: f64,
udstep: UdStep,
udrefn: UdRefn,
rpt: bool,
udrepi: UdRepi,
udrepu: UdRepu,
udrepf: UdRepf,
bail: bool,
udbail: UdBail,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>,
) {
let inst = to_cstring(inst);
let tshape = to_cstring(tshape);
let target = to_cstring(target);
let tframe = to_cstring(tframe);
let abcorr = to_cstring(abcorr);
let obsrvr = to_cstring(obsrvr);
let mut raydir = raydir;
let cnfine = cnfine.as_mut_ptr();
let result = result.as_mut_ptr();
unsafe {
crate::c::gffove_c(
inst.as_ptr() as *mut SpiceChar,
tshape.as_ptr() as *mut SpiceChar,
raydir.as_mut_ptr(),
target.as_ptr() as *mut SpiceChar,
tframe.as_ptr() as *mut SpiceChar,
abcorr.as_ptr() as *mut SpiceChar,
obsrvr.as_ptr() as *mut SpiceChar,
tol,
Some(udstep),
Some(udrefn),
rpt as crate::c::SpiceBoolean,
Some(udrepi),
Some(udrepu),
Some(udrepf),
bail as crate::c::SpiceBoolean,
Some(udbail),
cnfine,
result,
);
}
}
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn gfevnt<S: AsRef<str>, T: AsRef<str>>(
udstep: UdStep,
udrefn: UdRefn,
gquant: &str,
qpnams: &[S],
qcpars: &[T],
qdpars: &[f64],
qipars: &[i32],
qlpars: &[bool],
op: &str,
refval: f64,
tol: f64,
adjust: f64,
rpt: bool,
udrepi: UdRepi,
udrepu: UdRepu,
udrepf: UdRepf,
nintvls: i32,
bail: bool,
udbail: UdBail,
cnfine: &mut Cell<f64>,
result: &mut Cell<f64>,
) {
let gquant = to_cstring(gquant);
let op = to_cstring(op);
let (names, namelen) = to_strided(qpnams);
let (values, valuelen) = to_strided(qcpars);
let lenvals = namelen.max(valuelen);
let (names, _) = if namelen == lenvals {
(names, namelen)
} else {
repack(qpnams, lenvals)
};
let (values, _) = if valuelen == lenvals {
(values, valuelen)
} else {
repack(qcpars, lenvals)
};
let count = qpnams.len().max(1);
let mut reals = qdpars.to_vec();
let mut ints = qipars.to_vec();
let mut flags = qlpars
.iter()
.map(|&flag| flag as crate::c::SpiceBoolean)
.collect::<Vec<_>>();
reals.resize(count, 0.0);
ints.resize(count, 0);
flags.resize(count, 0);
let cnfine = cnfine.as_mut_ptr();
let result = result.as_mut_ptr();
unsafe {
crate::c::gfevnt_c(
Some(udstep),
Some(udrefn),
gquant.as_ptr() as *mut SpiceChar,
qpnams.len() as SpiceInt,
lenvals as SpiceInt,
names.as_ptr().cast(),
values.as_ptr().cast(),
reals.as_ptr() as *mut SpiceDouble,
ints.as_ptr() as *mut SpiceInt,
flags.as_ptr() as *mut crate::c::SpiceBoolean,
op.as_ptr() as *mut SpiceChar,
refval,
tol,
adjust,
rpt as crate::c::SpiceBoolean,
Some(udrepi),
Some(udrepu),
Some(udrepf),
nintvls,
bail as crate::c::SpiceBoolean,
Some(udbail),
cnfine,
result,
);
}
}
fn repack<S: AsRef<str>>(values: &[S], stride: usize) -> (Vec<SpiceChar>, usize) {
let mut buffer = vec![0 as SpiceChar; values.len().max(1) * stride];
for (index, value) in values.iter().enumerate() {
let slot = &mut buffer[index * stride..(index + 1) * stride];
for (target, byte) in slot.iter_mut().zip(value.as_ref().as_bytes()) {
*target = *byte as SpiceChar;
}
}
(buffer, stride)
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn intmax() -> i32 {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn intmin() -> i32 {}
}
macro_rules! constants {
($($name:ident => $doc:expr),* $(,)?) => {$(
cspice_proc! {
#[doc = $doc]
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name() -> f64 {}
}
)*};
}
constants! {
b1900 => "Julian Date of the epoch B1900.",
b1950 => "Julian Date of the epoch B1950.",
clight => "Speed of light in a vacuum, in km/s.",
dpr => "Number of degrees per radian.",
halfpi => "Half the value of pi.",
j1900 => "Julian Date of 1899 DEC 31 12:00:00 (1900 JAN 0.5).",
j1950 => "Julian Date of 1950 JAN 01 00:00:00 (1950 JAN 1.0).",
j2000 => "Julian Date of 2000 JAN 01 12:00:00 (2000 JAN 1.5).",
j2100 => "Julian Date of 2100 JAN 01 12:00:00 (2100 JAN 1.5).",
jyear => "Number of seconds in a Julian year.",
pi => "Value of pi.",
rpd => "Number of radians per degree.",
spd => "Number of seconds in a day.",
twopi => "Twice the value of pi.",
tyear => "Number of seconds in a tropical year.",
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn tkvrsn(item: &str) -> String {}
}
#[allow(clippy::upper_case_acronyms)]
pub type EKATTDSC = crate::c::SpiceEKAttDsc;
#[allow(clippy::upper_case_acronyms)]
pub type EKSEGSUM = crate::c::SpiceEKSegSum;
pub const EK_MXCLSG: usize = 100;
pub const EK_MAXQSEL: usize = 50;
pub const EK_CSTRLN: usize = 33;
pub const EK_TSTRLN: usize = 65;
pub const EK_VARSIZ: i32 = -1;
pub const EK_CHR: crate::c::SpiceEKDataType = crate::c::_SpiceDataType_SPICE_CHR;
pub const EK_DP: crate::c::SpiceEKDataType = crate::c::_SpiceDataType_SPICE_DP;
pub const EK_INT: crate::c::SpiceEKDataType = crate::c::_SpiceDataType_SPICE_INT;
pub const EK_TIME: crate::c::SpiceEKDataType = crate::c::_SpiceDataType_SPICE_TIME;
pub const EK_EXP_COL: crate::c::SpiceEKExprClass = crate::c::_SpiceEKExprClass_SPICE_EK_EXP_COL;
pub const EK_EXP_FUNC: crate::c::SpiceEKExprClass = crate::c::_SpiceEKExprClass_SPICE_EK_EXP_FUNC;
pub const EK_EXP_EXPR: crate::c::SpiceEKExprClass = crate::c::_SpiceEKExprClass_SPICE_EK_EXP_EXPR;
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekopn(fname: &str, ifname: &str, ncomch: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekopr(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekopw(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekops() -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekcls(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eklef(fname: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekuef(handle: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekntab() -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ektnam(n: i32, #[lenout] lenout: i32) -> String {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekccnt(table: &str) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekcii(table: &str, cindex: i32, #[lenout] lenout: i32) -> (String, EKATTDSC) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eknseg(handle: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekssum(handle: i32, segno: i32) -> EKSEGSUM {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekfind(query: &str, #[lenout] lenout: i32) -> (i32, bool, String) {}
}
cspice_proc! {
#[return_output]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn eknelt(selidx: i32, row: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekgc(
selidx: i32,
row: i32,
elment: i32,
#[lenout] lenout: i32
) -> (String, bool, bool) {
}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekgd(selidx: i32, row: i32, elment: i32) -> (f64, bool, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekgi(selidx: i32, row: i32, elment: i32) -> (i32, bool, bool) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekappr(handle: i32, segno: i32) -> i32 {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekinsr(handle: i32, segno: i32, recno: i32) {}
}
cspice_proc! {
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekdelr(handle: i32, segno: i32, recno: i32) {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekbseg<S: AsRef<str>, T: AsRef<str>>(
handle: i32,
tabnam: &str,
cnames: &[S],
decls: &[T],
) -> i32 {
let tabnam = to_cstring(tabnam);
let (names, cnmlen) = to_strided(cnames);
let (declarations, declen) = to_strided(decls);
let mut segno = 0;
unsafe {
crate::c::ekbseg_c(
handle,
tabnam.as_ptr() as *mut SpiceChar,
cnames.len() as SpiceInt,
cnmlen as SpiceInt,
names.as_ptr().cast(),
declen as SpiceInt,
declarations.as_ptr().cast(),
&mut segno,
);
}
segno
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekifld<S: AsRef<str>, T: AsRef<str>>(
handle: i32,
tabnam: &str,
nrows: i32,
cnames: &[S],
decls: &[T],
) -> (i32, Vec<i32>) {
let tabnam = to_cstring(tabnam);
let (names, cnmlen) = to_strided(cnames);
let (declarations, declen) = to_strided(decls);
let mut segno = 0;
let mut rcptrs = vec![0; (nrows.max(0) as usize).max(1)];
unsafe {
crate::c::ekifld_c(
handle,
tabnam.as_ptr() as *mut SpiceChar,
cnames.len() as SpiceInt,
nrows,
cnmlen as SpiceInt,
names.as_ptr().cast(),
declen as SpiceInt,
declarations.as_ptr().cast(),
&mut segno,
rcptrs.as_mut_ptr(),
);
}
rcptrs.truncate(nrows.max(0) as usize);
(segno, rcptrs)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekffld(handle: i32, segno: i32, rcptrs: &mut [i32]) {
unsafe { crate::c::ekffld_c(handle, segno, rcptrs.as_mut_ptr()) };
}
macro_rules! ek_add_column {
($name:ident, $cname:ident, $ty:ty, $values:ident, $doc:expr) => {
#[doc = $doc]
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
segno: i32,
column: &str,
$values: &[$ty],
entszs: &[i32],
nlflgs: &[bool],
rcptrs: &[i32],
) {
let column = to_cstring(column);
let flags = nlflgs
.iter()
.map(|&flag| flag as crate::c::SpiceBoolean)
.collect::<Vec<_>>();
let mut wkindx = vec![0 as SpiceInt; rcptrs.len().max(1)];
unsafe {
crate::c::$cname(
handle,
segno,
column.as_ptr() as *mut SpiceChar,
$values.as_ptr() as *mut _,
entszs.as_ptr() as *mut SpiceInt,
flags.as_ptr() as *mut crate::c::SpiceBoolean,
rcptrs.as_ptr() as *mut SpiceInt,
wkindx.as_mut_ptr(),
);
}
}
};
}
ek_add_column!(
ekacld,
ekacld_c,
f64,
dvals,
"Write a whole double precision column of a segment started by [`ekifld`]."
);
ek_add_column!(
ekacli,
ekacli_c,
i32,
ivals,
"Write a whole integer column of a segment started by [`ekifld`]."
);
#[allow(clippy::too_many_arguments)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekaclc<S: AsRef<str>>(
handle: i32,
segno: i32,
column: &str,
cvals: &[S],
entszs: &[i32],
nlflgs: &[bool],
rcptrs: &[i32],
) {
let column = to_cstring(column);
let (values, vallen) = to_strided(cvals);
let flags = nlflgs
.iter()
.map(|&flag| flag as crate::c::SpiceBoolean)
.collect::<Vec<_>>();
let mut wkindx = vec![0 as SpiceInt; rcptrs.len().max(1)];
unsafe {
crate::c::ekaclc_c(
handle,
segno,
column.as_ptr() as *mut SpiceChar,
vallen as SpiceInt,
values.as_ptr().cast(),
entszs.as_ptr() as *mut SpiceInt,
flags.as_ptr() as *mut crate::c::SpiceBoolean,
rcptrs.as_ptr() as *mut SpiceInt,
wkindx.as_mut_ptr(),
);
}
}
macro_rules! ek_record_write {
($name:ident, $cname:ident, $ty:ty, $values:ident, $doc:expr) => {
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
segno: i32,
recno: i32,
column: &str,
$values: &[$ty],
isnull: bool,
) {
let column = to_cstring(column);
unsafe {
crate::c::$cname(
handle,
segno,
recno,
column.as_ptr() as *mut SpiceChar,
$values.len() as SpiceInt,
$values.as_ptr() as *mut _,
isnull as crate::c::SpiceBoolean,
);
}
}
};
}
ek_record_write!(
ekaced,
ekaced_c,
f64,
dvals,
"Write a double precision entry into a record of a segment of an open events kernel."
);
ek_record_write!(
ekacei,
ekacei_c,
i32,
ivals,
"Write an integer entry into a record of a segment of an open events kernel."
);
ek_record_write!(
ekuced,
ekuced_c,
f64,
dvals,
"Replace a double precision entry of a record of a segment of an open events kernel."
);
ek_record_write!(
ekucei,
ekucei_c,
i32,
ivals,
"Replace an integer entry of a record of a segment of an open events kernel."
);
macro_rules! ek_record_write_c {
($name:ident, $cname:ident, $doc:expr) => {
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name<S: AsRef<str>>(
handle: i32,
segno: i32,
recno: i32,
column: &str,
cvals: &[S],
isnull: bool,
) {
let column = to_cstring(column);
let (values, vallen) = to_strided(cvals);
unsafe {
crate::c::$cname(
handle,
segno,
recno,
column.as_ptr() as *mut SpiceChar,
cvals.len() as SpiceInt,
vallen as SpiceInt,
values.as_ptr().cast(),
isnull as crate::c::SpiceBoolean,
);
}
}
};
}
ek_record_write_c!(
ekacec,
ekacec_c,
"Write a character entry into a record of a segment of an open events kernel."
);
ek_record_write_c!(
ekucec,
ekucec_c,
"Replace a character entry of a record of a segment of an open events kernel."
);
macro_rules! ek_record_read {
($name:ident, $cname:ident, $ty:ty, $zero:expr, $doc:expr) => {
#[doc = $doc]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(
handle: i32,
segno: i32,
recno: i32,
column: &str,
maxvals: usize,
) -> (Vec<$ty>, bool) {
let column = to_cstring(column);
let mut values = vec![$zero; maxvals.max(1)];
let (mut nvals, mut isnull) = (0, 0);
unsafe {
crate::c::$cname(
handle,
segno,
recno,
column.as_ptr() as *mut SpiceChar,
&mut nvals,
values.as_mut_ptr(),
&mut isnull,
);
}
values.truncate((nvals.max(0) as usize).min(maxvals));
(values, isnull != 0)
}
};
}
ek_record_read!(
ekrced,
ekrced_c,
f64,
0.0,
"Read a double precision entry of a record of a segment of an open events kernel."
);
ek_record_read!(
ekrcei,
ekrcei_c,
i32,
0,
"Read an integer entry of a record of a segment of an open events kernel."
);
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekrcec(
handle: i32,
segno: i32,
recno: i32,
column: &str,
maxvals: usize,
lenout: usize,
) -> (Vec<String>, bool) {
let column = to_cstring(column);
let stride = lenout.max(1);
let mut buffer = vec![0 as SpiceChar; maxvals.max(1) * stride];
let (mut nvals, mut isnull) = (0, 0);
unsafe {
crate::c::ekrcec_c(
handle,
segno,
recno,
column.as_ptr() as *mut SpiceChar,
stride as SpiceInt,
&mut nvals,
buffer.as_mut_ptr().cast(),
&mut isnull,
);
}
let count = (nvals.max(0) as usize).min(maxvals);
(from_strided(&buffer, stride, count), isnull != 0)
}
#[allow(clippy::type_complexity)]
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn ekpsel(
query: &str,
msglen: usize,
tablen: usize,
collen: usize,
) -> (
Vec<i32>,
Vec<i32>,
Vec<crate::c::SpiceEKDataType>,
Vec<crate::c::SpiceEKExprClass>,
Vec<String>,
Vec<String>,
bool,
String,
) {
let query = to_cstring(query);
let (tablen, collen) = (tablen.max(1), collen.max(1));
let mut xbegs = vec![0 as SpiceInt; EK_MAXQSEL];
let mut xends = vec![0 as SpiceInt; EK_MAXQSEL];
let mut xtypes = vec![EK_CHR; EK_MAXQSEL];
let mut xclass = vec![EK_EXP_COL; EK_MAXQSEL];
let mut tabs = vec![0 as SpiceChar; EK_MAXQSEL * tablen];
let mut cols = vec![0 as SpiceChar; EK_MAXQSEL * collen];
let mut errmsg = vec![0 as SpiceChar; msglen.max(1)];
let (mut n, mut error) = (0, 0);
unsafe {
crate::c::ekpsel_c(
query.as_ptr() as *mut SpiceChar,
errmsg.len() as SpiceInt,
tablen as SpiceInt,
collen as SpiceInt,
&mut n,
xbegs.as_mut_ptr(),
xends.as_mut_ptr(),
xtypes.as_mut_ptr(),
xclass.as_mut_ptr(),
tabs.as_mut_ptr().cast(),
cols.as_mut_ptr().cast(),
&mut error,
errmsg.as_mut_ptr(),
);
}
let count = (n.max(0) as usize).min(EK_MAXQSEL);
xbegs.truncate(count);
xends.truncate(count);
xtypes.truncate(count);
xclass.truncate(count);
(
xbegs,
xends,
xtypes,
xclass,
from_strided(&tabs, tablen, count),
from_strided(&cols, collen, count),
error != 0,
from_cbuf(&errmsg),
)
}
macro_rules! fill_array {
($($name:ident($ty:ty, $value:expr) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// `vec![]` does the same thing without leaving Rust; this is here for completeness.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(value: $ty, ndim: usize) -> Vec<$ty> {
let mut array = vec![$value; ndim.max(1)];
unsafe { crate::c::$cname(value, ndim as SpiceInt, array.as_mut_ptr()) };
array.truncate(ndim);
array
}
)*};
}
fill_array! {
filld(f64, 0.0) => filld_c, "Fill a double precision array with a value.";
filli(i32, 0) => filli_c, "Fill an integer array with a value.";
}
macro_rules! clear_array {
($($name:ident($ty:ty, $value:expr) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// `vec![]` does the same thing without leaving Rust; this is here for completeness.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(ndim: usize) -> Vec<$ty> {
let mut array = vec![$value; ndim.max(1)];
unsafe { crate::c::$cname(ndim as SpiceInt, array.as_mut_ptr()) };
array.truncate(ndim);
array
}
)*};
}
clear_array! {
cleard(f64, 1.0) => cleard_c, "Set every element of a double precision array to zero.";
cleari(i32, 1) => cleari_c, "Set every element of an integer array to zero.";
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn clearc(ndim: usize, arrlen: usize) -> Vec<String> {
let arrlen = arrlen.max(1);
let mut array = vec![b'x' as SpiceChar; ndim.max(1) * arrlen];
unsafe {
crate::c::clearc_c(
ndim as SpiceInt,
arrlen as SpiceInt,
array.as_mut_ptr().cast(),
)
};
from_strided(&array, arrlen, ndim)
}
macro_rules! extremum {
($($name:ident($ty:ty) => $cname:ident, $doc:expr);* $(;)?) => {$(
#[doc = $doc]
///
/// The C routine is variadic, which Rust cannot hand a list whose length is only known
/// while it runs; folding the two argument form over the slice gives the same answer for
/// any length. An empty slice gives zero, as the C routine does for a count of none.
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn $name(values: &[$ty]) -> $ty {
values
.iter()
.copied()
.reduce(|left, right| unsafe { crate::c::$cname(2, left, right) })
.unwrap_or_else(|| unsafe { crate::c::$cname(0) })
}
)*};
}
extremum! {
maxd(f64) => maxd_c, "The largest of a set of double precision numbers.";
maxi(i32) => maxi_c, "The largest of a set of integers.";
mind(f64) => mind_c, "The smallest of a set of double precision numbers.";
mini(i32) => mini_c, "The smallest of a set of integers.";
}
cspice_proc! {
pub fn nthwd(string: &str, nth: i32, #[lenout] worlen: i32) -> (String, i32) {}
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn prompt(dspmsg: &str, buflen: usize) -> String {
let dspmsg = to_cstring(dspmsg);
let mut buffer = vec![0 as SpiceChar; buflen.max(1)];
unsafe {
crate::c::prompt_c(
dspmsg.as_ptr() as *mut SpiceChar,
buffer.len() as SpiceInt,
buffer.as_mut_ptr(),
)
};
from_cbuf(&buffer)
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn putcml<S: AsRef<str>>(argv: &[S]) {
let pointers = argv
.iter()
.map(|value| to_cstring(value).into_raw())
.collect::<Vec<_>>();
let pointers = Box::leak(pointers.into_boxed_slice());
unsafe { crate::c::putcml_c(argv.len() as SpiceInt, pointers.as_mut_ptr()) }
}
#[cfg_attr(any(feature = "lock", doc), impl_for(SpiceLock))]
pub fn getcml() -> Vec<String> {
let (mut argc, mut argv) = (0, std::ptr::null_mut());
unsafe { crate::c::getcml_c(&mut argc, &mut argv) };
if argv.is_null() {
return Vec::new();
}
(0..argc.max(0) as usize)
.map(|index| unsafe {
std::ffi::CStr::from_ptr(*argv.add(index))
.to_string_lossy()
.into_owned()
})
.collect()
}