1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
pub const LBCELL: i32 = -5;
//$Procedure PODAED ( Pod, append elements, double precision )
pub fn PODAED(ELEMS: &[f64], N: i32, POD: &mut [f64], ctx: &mut Context) -> f2rust_std::Result<()> {
let ELEMS = DummyArray::new(ELEMS, 1..);
let mut POD = DummyArrayMut::new(POD, LBCELL..);
let mut END: i32 = 0;
//
// SPICELIB functions
//
//
// Local Variables
//
//
// Standard SPICE error handling.
//
if spicelib::RETURN(ctx) {
return Ok(());
} else {
spicelib::CHKIN(b"PODAED", ctx)?;
}
//
// We can't append a non-positive number of items.
//
if (N < 1) {
spicelib::CHKOUT(b"PODAED", ctx)?;
return Ok(());
}
//
// First see if there is room in the pod to append N elements.
// If not, bail out.
//
END = spicelib::CARDD(POD.as_slice(), ctx)?;
if (spicelib::SIZED(POD.as_slice(), ctx)? < (END + N)) {
spicelib::SETMSG(b"Cannot fit # elements into # spaces.", ctx);
spicelib::ERRINT(b"#", N, ctx);
spicelib::ERRINT(b"#", (spicelib::SIZED(POD.as_slice(), ctx)? - END), ctx);
spicelib::SIGERR(b"SPICE(TOOMANYPEAS)", ctx)?;
//
// There is ample room, so we find out where the end of the
// active group is and simply loop through the individual
// copies of ELEMS, adjusting the cardinality afterwards.
// (Just like in $Examples, above.)
//
} else {
for I in 1..=N {
POD[(END + I)] = ELEMS[I];
}
spicelib::SCARDD((END + N), POD.as_slice_mut(), ctx)?;
}
spicelib::CHKOUT(b"PODAED", ctx)?;
Ok(())
}