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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//
// GENERATED FILE
//
use super::*;
use crate::SpiceContext;
use f2rust_std::*;
pub const MAXREC: i32 = 129;
/// Read SPK record from segment, type 12
///
/// Read a single data record from a type 12 SPK segment.
///
/// # Required Reading
///
/// * [SPK](crate::required_reading::spk)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// HANDLE I Handle of the open SPK file.
/// DESCR I Descriptor of the segment with the desired record.
/// ET I Epoch used to identify the desired record.
/// RECORD O The desired type 12 SPK record.
/// ```
///
/// # Detailed Input
///
/// ```text
/// HANDLE is the handle of the open SPK file which contains
/// the segment of interest.
///
/// DESCR is the descriptor for a type 12 SPK segment that
/// contains the record of interest.
///
/// ET is the target epoch used to determine the
/// particular record to be obtained from the SPK
/// segment.
/// ```
///
/// # Detailed Output
///
/// ```text
/// RECORD is the record from the specified segment which,
/// when evaluated at epoch ET, will give the state
/// (position and velocity) of some body, relative
/// to some center, in some inertial reference frame.
///
/// The structure of the record is as follows:
///
/// +----------------------+
/// | number of states (n) |
/// +----------------------+
/// | start epoch |
/// +----------------------+
/// | step size |
/// +----------------------+
/// | state 1 (6 elts.) |
/// +----------------------+
/// | state 2 (6 elts.) |
/// +----------------------+
/// .
/// .
/// .
/// +----------------------+
/// | state n (6 elts.) |
/// +----------------------+
/// ```
///
/// # Exceptions
///
/// ```text
/// 1) If an error occurs while looking up SPK data, the error is
/// signaled by a routine in the call tree of this routine.
/// ```
///
/// # Files
///
/// ```text
/// See argument HANDLE.
/// ```
///
/// # Particulars
///
/// ```text
/// This subroutine will read a single record from a type 12 SPK
/// segment. The record read will provide the data necessary to
/// compute the state for the body designated by DESCR at epoch
/// ET.
///
/// The exact format and structure of a type 12 SPK segment is
/// described in the SPK Required Reading.
/// ```
///
/// # Examples
///
/// ```text
/// The data returned by the SPKRnn routine is in a raw form, taken
/// directly from the segment. As such, it will be not be directly
/// useful to a user unless they have a complete understanding of the
/// structure of the data type. Given that understanding, however,
/// the SPKRnn routines could be used to "dump" and check segment data
/// for a particular epoch, as in the example which follows.
///
///
/// C
/// C Get a segment applicable to a specified body and epoch.
/// C
/// CALL SPKSFS ( BODY, ET, HANDLE, DESCR, IDENT, FOUND )
///
/// C
/// C Look at parts of the descriptor.
/// C
/// CALL DAFUS ( DESCR, 2, 6, DCD, ICD )
/// CENTER = ICD( 2 )
/// REF = ICD( 3 )
/// TYPE = ICD( 4 )
///
/// IF ( TYPE .EQ. 12 ) THEN
/// CALL SPKR12 ( HANDLE, DESCR, ET, RECORD )
/// .
/// . Look at the RECORD data.
/// .
/// END IF
/// ```
///
/// # Restrictions
///
/// ```text
/// 1) This subroutine should not be called directly by a casual
/// user. It is intended for use by the subroutine SPKPVN, and
/// certain tests for error conditions are not performed here, as
/// SPKPVN will have already performed them.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 1.0.1, 14-APR-2021 (JDR)
///
/// Edited the header to comply with NAIF standard. Updated
/// $Exceptions section. Moved SPK required reading from
/// $Literature_References to $Required_Reading section.
///
/// - SPICELIB Version 1.0.0, 25-FEB-2000 (NJB)
/// ```
pub fn spkr12(
ctx: &mut SpiceContext,
handle: i32,
descr: &[f64],
et: f64,
record: &mut [f64],
) -> crate::Result<()> {
SPKR12(handle, descr, et, record, ctx.raw_context())?;
ctx.handle_errors()?;
Ok(())
}
//$Procedure SPKR12 ( Read SPK record from segment, type 12 )
pub fn SPKR12(
HANDLE: i32,
DESCR: &[f64],
ET: f64,
RECORD: &mut [f64],
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let DESCR = DummyArray::new(DESCR, 1..);
let mut RECORD = DummyArrayMut::new(RECORD, 1..);
//
// SPICELIB functions
//
//
// Standard SPICE error handling.
//
if RETURN(ctx) {
return Ok(());
}
CHKIN(b"SPKR12", ctx)?;
//
// The type 8 reader knows how to obtain a type 12 record.
//
SPKR08(HANDLE, DESCR.as_slice(), ET, RECORD.as_slice_mut(), ctx)?;
CHKOUT(b"SPKR12", ctx)?;
Ok(())
}