use super::*;
use f2rust_std::*;
const MAXL: i32 = 36;
const MAXP: i32 = 150;
const NPERM: i32 = 692;
const MAXE: i32 = 853;
const NROOM: i32 = 14983;
const LBPOOL: i32 = -5;
pub fn ZZBODINI(
NAMES: CharArray,
NORNAM: CharArray,
CODES: &[i32],
NVALS: i32,
MAXVAL: i32,
BNMLST: &mut [i32],
BNMPOL: &mut [i32],
BNMNMS: CharArrayMut,
BNMIDX: &mut [i32],
BIDLST: &mut [i32],
BIDPOL: &mut [i32],
BIDIDS: &mut [i32],
BIDIDX: &mut [i32],
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let NORNAM = DummyCharArray::new(NORNAM, Some(MAXL), 1..);
let CODES = DummyArray::new(CODES, 1..);
let mut BNMLST = DummyArrayMut::new(BNMLST, 1..);
let mut BNMPOL = DummyArrayMut::new(BNMPOL, LBPOOL..);
let mut BNMNMS = DummyCharArrayMut::new(BNMNMS, Some(MAXL), 1..);
let mut BNMIDX = DummyArrayMut::new(BNMIDX, 1..);
let mut BIDLST = DummyArrayMut::new(BIDLST, 1..);
let mut BIDPOL = DummyArrayMut::new(BIDPOL, LBPOOL..);
let mut BIDIDS = DummyArrayMut::new(BIDIDS, 1..);
let mut BIDIDX = DummyArrayMut::new(BIDIDX, 1..);
let mut ITEM: i32 = 0;
let mut NEW: bool = false;
if (MAXVAL < NVALS) {
CHKIN(b"ZZBODINI", ctx)?;
SETMSG(b"There is an inconsistency between the number of input bodies and the size of the output hashes. The number of input bodies was #. The size of the output hashes was #.", ctx);
ERRINT(b"#", NVALS, ctx);
ERRINT(b"#", MAXVAL, ctx);
SIGERR(b"SPICE(BUG1)", ctx)?;
CHKOUT(b"ZZBODINI", ctx)?;
return Ok(());
}
ZZHSIINI(MAXVAL, BIDLST.as_slice_mut(), BIDPOL.as_slice_mut(), ctx)?;
ZZHSCINI(MAXVAL, BNMLST.as_slice_mut(), BNMPOL.as_slice_mut(), ctx)?;
for I in intrinsics::range(NVALS, 1, -1) {
ZZHSCADD(
BNMLST.as_slice_mut(),
BNMPOL.as_slice_mut(),
BNMNMS.as_arg_mut(),
&NORNAM[I],
&mut ITEM,
&mut NEW,
ctx,
)?;
if NEW {
if (ITEM != 0) {
BNMIDX[ITEM] = I;
} else {
CHKIN(b"ZZBODINI", ctx)?;
SETMSG(b"Could not add name # to the hash.", ctx);
ERRCH(b"#", &NORNAM[I], ctx);
SIGERR(b"SPICE(BUG3)", ctx)?;
CHKOUT(b"ZZBODINI", ctx)?;
}
}
if NEW {
ZZHSIADD(
BIDLST.as_slice_mut(),
BIDPOL.as_slice_mut(),
BIDIDS.as_slice_mut(),
CODES[I],
&mut ITEM,
&mut NEW,
ctx,
)?;
if NEW {
if (ITEM != 0) {
BIDIDX[ITEM] = I;
} else {
CHKIN(b"ZZBODINI", ctx)?;
SETMSG(b"Could not add ID # to the hash.", ctx);
ERRINT(b"#", CODES[I], ctx);
SIGERR(b"SPICE(BUG2)", ctx)?;
CHKOUT(b"ZZBODINI", ctx)?;
return Ok(());
}
}
}
}
Ok(())
}