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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
pub const LBCELL: i32 = -5;
const GRPOFF: i32 = -2;
//$Procedure PODCGC ( Pod, close group, character )
pub fn PODCGC(POD: CharArrayMut, ctx: &mut Context) -> f2rust_std::Result<()> {
let mut POD = DummyCharArrayMut::new(POD, None, LBCELL..);
let mut NUMBER: i32 = 0;
let mut OFFSET: i32 = 0;
//
// SPICELIB functions
//
//
// Local parameters
//
//
// Local variables
//
//
// Standard SPICE error handling.
//
if spicelib::RETURN(ctx) {
return Ok(());
} else {
spicelib::CHKIN(b"PODCGC", ctx)?;
}
//
// At any given time, the offset of the active group is stored
// in location GRPOFF of the control area, so POD(GRPOFF) tells
// us the location of the element preceding the active group.
//
// This element is a backward pointer, containing the offset of
// the previous group; and so on, with turtles all the way down.
// For example, consider a pod with three groups
//
// G. <10>
// 1. Bob
// 2. Carol
// 3. Ted
// 4. Alice
// 5. <0>
// 6. Fred
// 7. Wilma
// 8. Barney
// 9. Bettey
// 10. <5>
// 11. Ricky
// 12. Lucy
// 13. Fred
// 14. Ethel
//
// When the second group was created, the offset of the first
// group (zero) was appended to the pod; the location of this
// offset became the offset for the second group. When the
// third group was created, the offset of the second group (5)
// was appended; the location of this offset became the offset for
// the third group. The offset for the third group is located
// in element GRPOFF.
//
// To remove a group then, all that is necessary is to look at
// element GRPOFF to get the offset of the current group; go to
// that location to get the offset of the previous group; and
// move that offset into element GRPOFF. To append the original
// active group to the new one, just move all of the elements
// of that group by one space toward the front of the pod.
// The new cardinality, of course, should be one less than the
// original cardinality. (Only the marker has been removed.)
//
// If the pod contains only one group, we don't have to do
// anything.
//
PODONC(POD.as_arg(), &mut OFFSET, &mut NUMBER, ctx)?;
if (OFFSET != 0) {
let val = POD.get(OFFSET).to_vec();
fstr::assign(POD.get_mut(GRPOFF), &val);
for I in (OFFSET + 1)..=(OFFSET + NUMBER) {
let val = POD.get(I).to_vec();
fstr::assign(POD.get_mut((I - 1)), &val);
}
spicelib::SCARDC(((OFFSET + NUMBER) - 1), POD.as_arg_mut(), ctx)?;
}
spicelib::CHKOUT(b"PODCGC", ctx)?;
Ok(())
}