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
100
101
102
103
104
105
106
107
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
pub const LBCELL: i32 = -5;
pub const LBCBUF: i32 = 0;
//$Procedure LBPACK ( Line buffer, pack )
pub fn LBPACK_1(
PTRS: &mut [i32],
BUFFER: CharArrayMut,
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let mut PTRS = DummyArrayMut::new(PTRS, LBCELL..);
let mut BUFFER = DummyCharArrayMut::new(BUFFER, None, LBCBUF..);
let mut MAXLN: i32 = 0;
let mut NLINE: i32 = 0;
let mut NCOM: i32 = 0;
let mut PCARD: i32 = 0;
let mut OFFSET: i32 = 0;
let mut BEGIN: i32 = 0;
let mut END: i32 = 0;
let mut INTLEN: i32 = 0;
let mut J: i32 = 0;
//
// SPICELIB functions
//
//
// Local variables
//
//
// Standard error handling.
//
if spicelib::RETURN(ctx) {
return Ok(());
} else {
spicelib::CHKIN(b"LBPACK_1", ctx)?;
}
//
// Recover the essential control information.
//
LBDES_1(
PTRS.as_slice(),
&mut MAXLN,
&mut NLINE,
&mut NCOM,
&mut PCARD,
ctx,
)?;
//
// For each interval in the complement...
//
OFFSET = (NLINE * 2);
for I in intrinsics::range((OFFSET + 1), PCARD, 2) {
//
// Remove the contents of the interval from the CB, pulling
// the remaining contents forward.
//
BEGIN = PTRS[I];
END = PTRS[(I + 1)];
INTLEN = ((END - BEGIN) + 1);
if (BEGIN <= END) {
CBREM_1(BEGIN, END, BUFFER.as_arg_mut(), ctx)?;
//
// Adjust the pointers for both the lines and the complement
// intervals that followed the purged interval.
//
{
let m1__: i32 = 1;
let m2__: i32 = PCARD;
let m3__: i32 = 1;
J = m1__;
for _ in 0..((m2__ - m1__ + m3__) / m3__) as i32 {
if (PTRS[J] > END) {
PTRS[J] = (PTRS[J] - INTLEN);
}
J += m3__;
}
}
}
}
//
// There is only one interval in the complement now. It begins
// just after the last line, and runs to the end of the buffer.
//
spicelib::MAXAI(PTRS.subarray(1), OFFSET, &mut END, &mut J);
PTRS[(OFFSET + 1)] = (END + 1);
PTRS[(OFFSET + 2)] = SIZECB_1(BUFFER.as_arg(), ctx)?;
LBUPD_1(NLINE, 1, PTRS.as_slice_mut(), ctx)?;
spicelib::CHKOUT(b"LBPACK_1", ctx)?;
Ok(())
}