use super::*;
use f2rust_std::*;
pub const LBCELL: i32 = -5;
pub fn PODREI(N: i32, LOC: i32, POD: &mut [i32], ctx: &mut Context) -> f2rust_std::Result<()> {
let mut POD = DummyArrayMut::new(POD, LBCELL..);
let mut END: i32 = 0;
let mut NUMBER: i32 = 0;
let mut OFFSET: i32 = 0;
if spicelib::RETURN(ctx) {
return Ok(());
} else {
spicelib::CHKIN(b"PODREI", ctx)?;
}
PODONI(POD.as_slice(), &mut OFFSET, &mut NUMBER, ctx)?;
if (N < 1) {
spicelib::CHKOUT(b"PODREI", ctx)?;
return Ok(());
} else if (((LOC + N) - 1) > NUMBER) {
spicelib::SETMSG(b"LOC = #; N = #; there are only # elements.", ctx);
spicelib::ERRINT(b"#", LOC, ctx);
spicelib::ERRINT(b"#", N, ctx);
spicelib::ERRINT(b"#", NUMBER, ctx);
spicelib::SIGERR(b"SPICE(NOTENOUGHPEAS)", ctx)?;
spicelib::CHKOUT(b"PODREI", ctx)?;
return Ok(());
} else if ((LOC < 1) || (LOC > NUMBER)) {
spicelib::SETMSG(b"Location (#) must be in the range [1,#].", ctx);
spicelib::ERRINT(b"#", LOC, ctx);
spicelib::ERRINT(b"#", NUMBER, ctx);
spicelib::SIGERR(b"SPICE(BADPODLOCATION)", ctx)?;
spicelib::CHKOUT(b"PODREI", ctx)?;
return Ok(());
}
END = (OFFSET + NUMBER);
spicelib::REMLAI(N, (OFFSET + LOC), POD.subarray_mut(1), &mut END, ctx)?;
spicelib::SCARDI(END, POD.as_slice_mut(), ctx)?;
spicelib::CHKOUT(b"PODREI", ctx)?;
Ok(())
}