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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
//
// GENERATED FILE
//
use super::*;
use crate::SpiceContext;
use f2rust_std::*;
/// Set Long Error Message
///
/// Set the value of the current long error message.
///
/// # Required Reading
///
/// * [ERROR](crate::required_reading::error)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// MSG I A long error message.
/// ```
///
/// # Detailed Input
///
/// ```text
/// MSG is a "long" error message.
///
/// MSG is a detailed description of the error.
/// MSG is supposed to start with the name of the
/// module which detected the error, followed by a
/// colon. Example:
///
/// 'RDTEXT: There are no more free logical units'
///
/// Only the first LMSGLN characters of MSG are stored;
/// any further characters are truncated.
///
/// Generally, MSG will be stored internally by the SPICELIB
/// error handling mechanism. The only exception
/// is the case in which the user has commanded the
/// toolkit to ``ignore'' the error indicated by MSG.
///
/// As a default, MSG will be output to the screen.
/// See the required reading file for a discussion of how
/// to customize toolkit error handling behavior, and
/// in particular, the disposition of MSG.
/// ```
///
/// # Parameters
///
/// ```text
/// LMSGLN is the maximum length of the long error message. See
/// the include file errhnd.inc for the value of LMSGLN.
/// ```
///
/// # Exceptions
///
/// ```text
/// Error free.
///
/// 1) This routine does not detect any errors.
///
/// However, this routine is part of the interface to the
/// SPICELIB error handling mechanism. For this reason,
/// this routine does not participate in the trace scheme,
/// even though it has external references.
/// ```
///
/// # Particulars
///
/// ```text
/// The SPICELIB routine SIGERR should always be called
/// AFTER this routine is called, when an error is detected.
///
/// The effects of this routine are:
///
/// 1. If acceptance of a new long error message is
/// allowed:
///
/// MSG will be stored internally. As a result,
/// The SPICELIB routine, GETMSG, will be able to
/// retrieve MSG, until MSG has been ``erased''
/// by a call to RESET, or overwritten by another
/// call to SETMSG.
///
///
/// 2. If acceptance of a new long error message is not allowed,
/// a call to this routine has no effect.
/// ```
///
/// # Examples
///
/// ```text
/// The numerical results shown for this example may differ across
/// platforms. The results depend on the SPICE kernels used as
/// input, the compiler and supporting libraries, and the machine
/// specific arithmetic implementation.
///
/// 1) Create a user-defined error message, including both the
/// short and long messages, providing the value of an integer
/// and a double precision variables within the long message,
/// and signal the error.
///
///
/// Example code begins here.
///
///
/// PROGRAM SETMSG_EX1
/// IMPLICIT NONE
///
/// C
/// C Set long error message, with two different MARKER
/// C strings where the value of the variables will go.
/// C Our markers are '#' and 'XX'.
/// C
/// CALL SETMSG ( 'LONG MESSAGE. Invalid operation value. '
/// . // ' The value was #. Left endpoint '
/// . // 'exceeded right endpoint. The left '
/// . // 'endpoint was: XX.' )
///
/// C
/// C Insert the integer number where the # is now.
/// C
/// CALL ERRINT ( '#', 5 )
///
/// C
/// C Insert a double precision number where the XX is now.
/// C
/// CALL ERRDP ( 'XX', 910.26111991D0 )
///
/// C
/// C Signal the error.
/// C
/// CALL SIGERR ( 'SPICE(USERDEFINED)' )
///
/// END
///
///
/// When this program was executed on a Mac/Intel/gfortran/64-bit
/// platform, the output was:
///
///
/// ============================================================***
///
/// Toolkit version: N0066
///
/// SPICE(USERDEFINED) --
///
/// LONG MESSAGE. Invalid operation value. The value was 5. Left***
/// exceeded right endpoint. The left endpoint was: 9.1026111991***
///
/// Oh, by the way: The SPICELIB error handling actions are USER-
/// TAILORABLE. You can choose whether the Toolkit aborts or co***
/// when errors occur, which error messages to output, and where***
/// the output. Please read the ERROR "Required Reading" file, ***
/// the routines ERRACT, ERRDEV, and ERRPRT.
///
/// ============================================================***
///
///
/// Warning: incomplete output. 7 lines extended past the right
/// margin of the header and have been truncated. These lines are
/// marked by "***" at the end of each line.
///
///
/// Note that the execution of this program produces the error
/// SPICE(USERDEFINED), which follows the NAIF standard as
/// described in the ERROR required reading.
/// ```
///
/// # Restrictions
///
/// ```text
/// 1) SIGERR must be called once after each call to this routine.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// W.L. Taber (JPL)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 1.1.0, 03-JUN-2021 (JDR)
///
/// Added IMPLICIT NONE statement.
///
/// Edited the header to comply with NAIF standard.
/// Added complete code example based on existing fragments.
///
/// - SPICELIB Version 1.0.2, 29-JUL-1997 (NJB)
///
/// Maximum length of the long error message is now represented
/// by the parameter LMSGLN. Miscellaneous header fixes were
/// made. Some indentation and vertical white space abnormalities
/// in the code were fixed. Some dubious comments were deleted
/// from the code.
///
/// - 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 (NJB)
/// ```
///
/// # Revisions
///
/// ```text
/// - SPICELIB Version 1.0.2, 29-JUL-1997 (NJB)
///
/// Maximum length of the long error message is now represented
/// by the parameter LMSGLN. Miscellaneous header fixes were
/// made. Some indentation and vertical white space abnormalities
/// in the code were fixed. Some dubious comments were deleted
/// from the code.
///
/// - Beta Version 1.1.0, 17-FEB-1989 (NJB)
///
/// Declarations of the unused variable STAT and unused function
/// ACCEPT removed.
/// ```
pub fn setmsg(ctx: &mut SpiceContext, msg: &str) {
SETMSG(msg.as_bytes(), ctx.raw_context());
}
//$Procedure SETMSG ( Set Long Error Message )
pub fn SETMSG(MSG: &[u8], ctx: &mut Context) {
//
// SPICELIB functions
//
//
// We store the long error message only when updates
// of the long message are allowed:
//
if ALLOWD(ctx) {
PUTLMS(MSG, ctx);
}
}