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
//
// GENERATED FILE
//
use super::*;
use crate::SpiceContext;
use f2rust_std::*;
const CTRSIZ: i32 = 2;
/// SCLK type
///
/// Return the spacecraft clock type for a specified spacecraft.
///
/// # Required Reading
///
/// * [SCLK](crate::required_reading::sclk)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// SC I NAIF spacecraft ID code.
///
/// The function returns the spacecraft clock type associated with
/// the spacecraft specified by SC.
/// ```
///
/// # Detailed Input
///
/// ```text
/// SC is a NAIF ID code for a spacecraft, whose
/// spacecraft clock `type' is desired.
/// ```
///
/// # Detailed Output
///
/// ```text
/// The function returns the spacecraft clock type associated with
/// the spacecraft specified by SC.
/// ```
///
/// # Exceptions
///
/// ```text
/// 1) If the kernel variable that assigns a SCLK type to the
/// spacecraft specified by SC is not found in the kernel pool, an
/// error is signaled by a routine in the call tree of this
/// routine. SCTYPE returns the value 0 in this case.
/// ```
///
/// # Particulars
///
/// ```text
/// The raison d'etre of this routine is that it consolidates the code
/// that maps spacecraft ID's to clock types. While any routine may
/// call SCTYPE, it is unlikely that there will be a need for
/// non-SPICELIB routines to call this routine directly.
/// ```
///
/// # Examples
///
/// ```text
/// 1) Find the SCLK type for Galileo.
///
/// During program initialization, we load a SCLK kernel file
/// into the kernel pool. We will pretend that the name of
/// this file is GLLSCLK.KER. You must use the actual name of
/// an SCLK kernel that is accessible by your program to try
/// this example.
///
/// C
/// C Load the SCLK kernel.
/// C
/// CALL FURNSH ( 'GLLSCLK.KER' )
/// .
/// .
/// .
/// C
/// C Print out the clock type for Galileo.
/// C
/// TYPE = SCTYPE ( -77 )
///
/// PRINT *, 'Galileo clock type is ', TYPE
///
///
/// 2) Find the SCLK type for Mars Observer.
///
///
/// C
/// C Load the SCLK kernel.
/// C
/// CALL FURNSH ( 'MOSCLK.KER' )
/// .
/// .
/// .
/// C
/// C Print out the clock type for Mars Observer.
/// C
/// TYPE = SCTYPE ( -94 )
///
/// PRINT *, 'Mars Observer clock type is ', TYPE
/// ```
///
/// # Restrictions
///
/// ```text
/// 1) This routine assumes that an SCLK kernel appropriate to the
/// spacecraft specified by SC has been loaded into the kernel
/// pool.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// J.M. Lynch (JPL)
/// B.V. Semenov (JPL)
/// W.L. Taber (JPL)
/// E.D. Wright (JPL)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 1.4.0, 12-AUG-2021 (NJB) (JDR)
///
/// Re-implemented using the type 1 SCLK database in order to
/// improve performance. The routine still works as before for
/// clock types other than 1.
///
/// Edited the header to comply with NAIF standard.
///
/// - SPICELIB Version 1.3.0, 09-SEP-2013 (BVS)
///
/// Updated to keep track of the POOL counter and call ZZCVPOOL.
///
/// - SPICELIB Version 1.2.0, 05-MAR-2009 (NJB)
///
/// Bug fix: this routine now keeps track of whether its
/// kernel pool look-up succeeded. If not, a kernel pool
/// lookup is attempted on the next call to this routine.
///
/// - SPICELIB Version 1.1.1, 22-AUG-2006 (EDW)
///
/// Replaced references to LDPOOL with references
/// to FURNSH.
///
/// - SPICELIB Version 1.1.0, 22-MAR-1993 (JML)
///
/// 1) The routine now uses the kernel pool watch capability.
///
/// 2) The routine now returns a value of zero if RETURN is
/// .TRUE. on entry.
///
/// - SPICELIB Version 1.0.1, 10-MAR-1992 (WLT)
///
/// Comment section for permuted index source lines was added
/// following the header.
///
/// - SPICELIB Version 1.0.0, 04-SEP-1990 (NJB)
/// ```
pub fn sctype(ctx: &mut SpiceContext, sc: i32) -> crate::Result<i32> {
let ret = SCTYPE(sc, ctx.raw_context())?;
ctx.handle_errors()?;
Ok(ret)
}
//$Procedure SCTYPE ( SCLK type )
pub fn SCTYPE(SC: i32, ctx: &mut Context) -> f2rust_std::Result<i32> {
let mut SCTYPE: i32 = 0;
//
// SPICELIB functions
//
//
// Standard SPICE error handling.
//
if RETURN(ctx) {
SCTYPE = 0;
return Ok(SCTYPE);
}
CHKIN(b"SCTYPE", ctx)?;
//
// Get the type from the type 1 subsystem.
//
SCTY01(SC, &mut SCTYPE, ctx)?;
CHKOUT(b"SCTYPE", ctx)?;
Ok(SCTYPE)
}