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
201
202
203
204
205
//
// GENERATED FILE
//
use super::*;
use crate::SpiceContext;
use f2rust_std::*;
const LONGLN: i32 = 320;
/// Report an excess of elements in a cell
///
/// Set the long error message so as to indicate the number of excess
/// elements encountered by a routine operating on cells or on data
/// structures based on cells.
///
/// # Required Reading
///
/// * [CELLS](crate::required_reading::cells)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// NUMBER I Number of excess elements.
/// STRUCT I Name of the data structure.
/// ```
///
/// # Detailed Input
///
/// ```text
/// NUMBER is the number of excess elements encountered.
/// This may be zero or negative, which indicates
/// no excess.
///
/// STRUCT is the name of the data structure being manipulated.
/// Typically, this is one of the strings: 'cell', 'set',
/// or 'symbol table'. However, it may be any character
/// string. STRUCT should NOT end in a period.
/// The period at the end of the message is supplied
/// automatically.
/// ```
///
/// # Exceptions
///
/// ```text
/// 1) This routine does not detect any errors.
/// ```
///
/// # Particulars
///
/// ```text
/// This routine is part of the SPICELIB error handling mechanism.
///
/// EXCESS sets the long error message. The message has the form:
///
/// An excess of <NUMBER> element(s) could
/// not be accommodated in the output <STRUCT>.
///
/// Leading and trailing blanks in STRUCT are removed. If there is
/// no excess (NUMBER is zero or negative), then is blank.
/// ```
///
/// # Examples
///
/// ```text
/// The response of EXCESS to a variety of inputs is illustrated
/// below.
///
/// NUMBER = 1
/// STRUCT = 'set'
/// ERROR = 'An excess of 1 element could not
/// be accommodated in the output set.'
///
/// NUMBER = 5
/// STRUCT = 'stack'
/// ERROR = An excess of 5 elements could not
/// be accommodated in the output stack.'
///
/// NUMBER = 0
/// STRUCT =
/// ERROR = ' '
///
/// NUMBER = -6
/// STRUCT =
/// ERROR = ' '
///
/// In particular, note that EXCESS does not set the long error
/// message when the number of excess elements is not positive. Also,
/// the singular 'element' is used for an excess of one, while
/// the plural 'elements' is used for all other positive excesses.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// C.A. Curzon (JPL)
/// J. Diaz del Rio (ODC Space)
/// W.L. Taber (JPL)
/// I.M. Underwood (JPL)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 1.1.0, 13-AUG-2021 (JDR)
///
/// Added IMPLICIT NONE statement.
///
/// Edited the header to comply with NAIF standard.
///
/// - 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, 31-JAN-1990 (CAC) (WLT) (IMU) (NJB)
/// ```
///
/// # Revisions
///
/// ```text
/// - Beta Version 2.0.0, 11-JAN-1989 (NJB)
///
/// Sets the long error message directly. No longer returns
/// an error message. Message no longer contains name of
/// routine which detected the error.
/// ```
pub fn excess(ctx: &mut SpiceContext, number: i32, struct_: &str) -> crate::Result<()> {
EXCESS(number, struct_.as_bytes(), ctx.raw_context())?;
ctx.handle_errors()?;
Ok(())
}
//$Procedure EXCESS ( Report an excess of elements in a cell )
pub fn EXCESS(NUMBER: i32, STRUCT: &[u8], ctx: &mut Context) -> f2rust_std::Result<()> {
let mut ERROR = [b' '; LONGLN as usize];
//
// SPICELIB functions
//
//
// Local variables
//
//
// Set up the error processing.
//
if RETURN(ctx) {
return Ok(());
}
CHKIN(b"EXCESS", ctx)?;
//
// If there is no excess, don't report one.
//
if (NUMBER > 0) {
//
// Begin with the number. We will build the rest of the
// message around it.
//
INTSTR(NUMBER, &mut ERROR, ctx);
//
// A short blurb goes in front of the number.
//
PREFIX(b"An excess of", 1, &mut ERROR);
//
// Singular or plural?
//
if (NUMBER == 1) {
SUFFIX(b"element", 1, &mut ERROR);
} else {
SUFFIX(b"elements", 1, &mut ERROR);
}
//
// Another short blurb.
//
SUFFIX(b"could not be accommodated in the output", 1, &mut ERROR);
//
// And the name of the structure.
//
SUFFIX(STRUCT, 1, &mut ERROR);
//
// And a period at the end, to complete the sentence.
//
SUFFIX(b".", 0, &mut ERROR);
//
// Set the long error message:
//
SETMSG(&ERROR, ctx);
} else {
fstr::assign(&mut ERROR, b" ");
}
CHKOUT(b"EXCESS", ctx)?;
Ok(())
}