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
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
//$Procedure SGCTDF ( Generic Segments Create Test DAF )
pub fn SGCTDF(
FILE: &[u8],
ND: i32,
NI: i32,
VALUE: f64,
CASES: &[i32],
NCASE: i32,
HANDLE: &mut i32,
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let CASES = DummyArray::new(CASES, 1..);
let mut DESCR = StackArray::<f64, 125>::new(1..=125);
//
// SPICELIB Functions
//
//
// Local Variables
//
//
// Standard SPICE error handling.
//
if spicelib::RETURN(ctx) {
return Ok(());
} else {
spicelib::CHKIN(b"SGCTDF", ctx)?;
}
//
// Initialize DESCR to 0.
//
for I in 1..=125 {
DESCR[I] = 0.0;
}
//
// Create the new DAF. First check to make certain no file of name
// FILE exists. If it does remove it.
//
testutil::KILFIL(FILE, ctx)?;
spicelib::DAFONW(
FILE,
b"DAF/TST",
ND,
NI,
b"Test DAF F_SGMETA",
0,
HANDLE,
ctx,
)?;
//
// Create each of the segments. Note this is terribly inefficient,
// but will work just fine for test cases.
//
for I in 1..=NCASE {
//
// Start a new segment. Note the contents of the descriptor are
// irrelevant, since we are only trying to test the functionality
// of SGMETA.
//
spicelib::DAFBNA(*HANDLE, DESCR.as_slice(), b"Test Segment", ctx)?;
//
// Now load up the array. This is where the serious inefficieny
// comes in.
//
for J in 1..=(CASES[I] - 1) {
spicelib::DAFADA(&[VALUE], 1, ctx)?;
}
//
// Place the number of elements into the last entry in the array
// before ending it's creation.
//
spicelib::DAFADA(&[(CASES[I] as f64)], 1, ctx)?;
spicelib::DAFENA(ctx)?;
}
spicelib::CHKOUT(b"SGCTDF", ctx)?;
Ok(())
}