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
//
// GENERATED FILE
//
use super::*;
use crate::SpiceContext;
use f2rust_std::*;
/// S/P Kernel, subset, type 13
///
/// Extract a subset of the data in an SPK segment of type 13
/// into a new segment.
///
/// # Required Reading
///
/// * [SPK](crate::required_reading::spk)
/// * [DAF](crate::required_reading::daf)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// HANDLE I Handle of file containing source segment.
/// BADDR I Beginning address in file of source segment.
/// EADDR I Ending address in file of source segment.
/// BEGIN I Beginning (initial epoch) of subset.
/// END I End (final epoch) of subset.
/// ```
///
/// # Detailed Input
///
/// ```text
/// HANDLE,
/// BADDR,
/// EADDR are the file handle assigned to an SPK file, and the
/// beginning and ending addresses of a segment within
/// that file. Together they determine a complete set of
/// ephemeris data, from which a subset is to be
/// extracted.
///
/// BEGIN,
/// END are the initial and final epochs (ephemeris time)
/// of the subset.
///
/// The output segment will be padded to the left of
/// BEGIN and the right of END with sufficient states to
/// ensure that the segment yields an ephemeris identical
/// to that given by the source segment.
/// ```
///
/// # Detailed Output
///
/// ```text
/// See $Files section.
/// ```
///
/// # Exceptions
///
/// ```text
/// 1) This routine relies on the caller to ensure that the
/// interval [BEGIN, END] is contained in the coverage
/// interval of the segment.
///
/// 2) If BEGIN > END, no data is written to the target file.
/// ```
///
/// # Files
///
/// ```text
/// Data is extracted from the file connected to the input
/// handle, and written to the current DAF open for writing.
///
/// The segment descriptor and summary must already have been written
/// prior to calling this routine. The segment must be ended
/// external to this routine.
/// ```
///
/// # Particulars
///
/// ```text
/// This routine is intended solely for use as a utility by the
/// routine SPKSUB.
///
/// It transfers a subset of a type 13 SPK data segment to
/// a properly initialized segment of a second SPK file.
///
/// The exact structure of a segment of data type 13 is described
/// in the section on type 13 in the SPK Required Reading.
/// ```
///
/// # Examples
///
/// ```text
/// This routine is intended only for use as a utility by SPKSUB.
/// To use this routine successfully, you must:
///
/// Open the SPK file from which to extract data.
/// Locate the segment from which data should be extracted.
///
/// Open the SPK file to which this data should be written.
/// Begin a new segment (array).
/// Write the summary information for the array.
///
/// Call this routine to extract the appropriate data from the
/// SPK open for read.
///
/// End the array to which this routine writes data.
///
/// Much of this procedure is carried out by the routine SPKSUB. The
/// examples of that routine illustrate more fully the process
/// described above.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 1.0.1, 03-JUN-2021 (JDR)
///
/// Edited the header to comply with NAIF standard.
///
/// - SPICELIB Version 1.0.0, 25-FEB-2000 (NJB)
/// ```
pub fn spks13(
ctx: &mut SpiceContext,
handle: i32,
baddr: i32,
eaddr: i32,
begin: f64,
end: f64,
) -> crate::Result<()> {
SPKS13(handle, baddr, eaddr, begin, end, ctx.raw_context())?;
ctx.handle_errors()?;
Ok(())
}
//$Procedure SPKS13 ( S/P Kernel, subset, type 13 )
pub fn SPKS13(
HANDLE: i32,
BADDR: i32,
EADDR: i32,
BEGIN: f64,
END: f64,
ctx: &mut Context,
) -> f2rust_std::Result<()> {
//
// SPICELIB functions
//
//
// Standard SPICE error handling.
//
if RETURN(ctx) {
return Ok(());
} else {
CHKIN(b"SPKS13", ctx)?;
}
//
// The type 9 subsetter knows how to do this job.
//
SPKS09(HANDLE, BADDR, EADDR, BEGIN, END, ctx)?;
CHKOUT(b"SPKS13", ctx)?;
Ok(())
}