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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
//
// GENERATED FILE
//
use super::*;
use crate::SpiceContext;
use f2rust_std::*;
pub const FILEN: i32 = 255;
struct SaveVars {
SVSHRT: bool,
SVEXPL: bool,
SVLONG: bool,
SVTRAC: bool,
SVDFLT: bool,
}
impl SaveInit for SaveVars {
fn new() -> Self {
let mut SVSHRT: bool = false;
let mut SVEXPL: bool = false;
let mut SVLONG: bool = false;
let mut SVTRAC: bool = false;
let mut SVDFLT: bool = false;
SVSHRT = true;
SVEXPL = true;
SVLONG = true;
SVTRAC = true;
SVDFLT = true;
Self {
SVSHRT,
SVEXPL,
SVLONG,
SVTRAC,
SVDFLT,
}
}
}
/// Declare Arguments for Error Message Routines
///
/// Declare the arguments for the error message selection entry
/// points. DO NOT CALL THIS ROUTINE.
///
/// # Required Reading
///
/// * [ERROR](crate::required_reading::error)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O ENTRY POINTS
/// -------- --- --------------------------------------------------
/// SHORT I SETPRT
/// EXPL I SETPRT
/// LONG I SETPRT
/// TRACE I SETPRT
/// DFAULT I SETPRT
/// TYPE I MSGSEL
/// FILEN P MSGSEL
/// ```
///
/// # Detailed Input
///
/// ```text
/// See the ENTRY points for discussions of their arguments.
/// ```
///
/// # Detailed Output
///
/// ```text
/// See the ENTRY points for discussions of their arguments.
/// ```
///
/// # Parameters
///
/// ```text
/// See the ENTRY points for discussions of their parameters.
/// ```
///
/// # Exceptions
///
/// ```text
/// 1) If PRTPKG is called directly, the error SPICE(BOGUSENTRY) is
/// signaled.
/// ```
///
/// # Particulars
///
/// ```text
/// DO NOT CALL THIS ROUTINE.
///
/// The entry points declared in this routine are:
///
/// SETPRT
/// MSGSEL
///
/// There is no reason to call this subroutine. The purpose of this
/// subroutine is to make the declarations required by the various
/// entry points. This routine has no run-time function.
/// ```
///
/// # Examples
///
/// ```text
/// None. DO NOT CALL THIS ROUTINE.
/// ```
///
/// # Restrictions
///
/// ```text
/// 1) DO NOT CALL THIS ROUTINE.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// H.A. Neilan (JPL)
/// B.V. Semenov (JPL)
/// W.L. Taber (JPL)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 3.27.0, 28-NOV-2021 (BVS)
///
/// Updated for MAC-OSX-M1-64BIT-CLANG_C.
///
/// - SPICELIB Version 3.26.0, 17-JUN-2021 (JDR)
///
/// Added IMPLICIT NONE statement.
///
/// Edited the header of the PRTPKG umbrella routine and all its
/// entry entry points to comply with NAIF standard.
///
/// - SPICELIB Version 3.25.0, 10-MAR-2014 (BVS)
///
/// Updated for SUN-SOLARIS-64BIT-INTEL.
///
/// - SPICELIB Version 3.24.0, 10-MAR-2014 (BVS)
///
/// Updated for PC-LINUX-64BIT-IFORT.
///
/// - SPICELIB Version 3.23.0, 10-MAR-2014 (BVS)
///
/// Updated for PC-CYGWIN-GFORTRAN.
///
/// - SPICELIB Version 3.22.0, 10-MAR-2014 (BVS)
///
/// Updated for PC-CYGWIN-64BIT-GFORTRAN.
///
/// - SPICELIB Version 3.21.0, 10-MAR-2014 (BVS)
///
/// Updated for PC-CYGWIN-64BIT-GCC_C.
///
/// - SPICELIB Version 3.20.0, 13-MAY-2010 (BVS)
///
/// Updated for SUN-SOLARIS-INTEL.
///
/// - SPICELIB Version 3.19.0, 13-MAY-2010 (BVS)
///
/// Updated for SUN-SOLARIS-INTEL-CC_C.
///
/// - SPICELIB Version 3.18.0, 13-MAY-2010 (BVS)
///
/// Updated for SUN-SOLARIS-INTEL-64BIT-CC_C.
///
/// - SPICELIB Version 3.17.0, 13-MAY-2010 (BVS)
///
/// Updated for SUN-SOLARIS-64BIT-NATIVE_C.
///
/// - SPICELIB Version 3.16.0, 13-MAY-2010 (BVS)
///
/// Updated for PC-WINDOWS-64BIT-IFORT.
///
/// - SPICELIB Version 3.15.0, 13-MAY-2010 (BVS)
///
/// Updated for PC-LINUX-64BIT-GFORTRAN.
///
/// - SPICELIB Version 3.14.0, 13-MAY-2010 (BVS)
///
/// Updated for PC-64BIT-MS_C.
///
/// - SPICELIB Version 3.13.0, 13-MAY-2010 (BVS)
///
/// Updated for MAC-OSX-64BIT-INTEL_C.
///
/// - SPICELIB Version 3.12.0, 13-MAY-2010 (BVS)
///
/// Updated for MAC-OSX-64BIT-IFORT.
///
/// - SPICELIB Version 3.11.0, 13-MAY-2010 (BVS)
///
/// Updated for MAC-OSX-64BIT-GFORTRAN.
///
/// - SPICELIB Version 3.10.0, 18-MAR-2009 (BVS)
///
/// Updated for PC-LINUX-GFORTRAN.
///
/// - SPICELIB Version 3.9.0, 18-MAR-2009 (BVS)
///
/// Updated for MAC-OSX-GFORTRAN.
///
/// - SPICELIB Version 3.8.0, 19-FEB-2008 (BVS)
///
/// Updated for PC-LINUX-IFORT.
///
/// - SPICELIB Version 3.7.0, 14-NOV-2006 (BVS)
///
/// Updated for PC-LINUX-64BIT-GCC_C.
///
/// - SPICELIB Version 3.6.0, 14-NOV-2006 (BVS)
///
/// Updated for MAC-OSX-INTEL_C.
///
/// - SPICELIB Version 3.5.0, 14-NOV-2006 (BVS)
///
/// Updated for MAC-OSX-IFORT.
///
/// - SPICELIB Version 3.4.0, 14-NOV-2006 (BVS)
///
/// Updated for PC-WINDOWS-IFORT.
///
/// - SPICELIB Version 3.3.0, 26-OCT-2005 (BVS)
///
/// Updated for SUN-SOLARIS-64BIT-GCC_C.
///
/// - SPICELIB Version 3.2.0, 03-JAN-2005 (BVS)
///
/// Updated for PC-CYGWIN_C.
///
/// - SPICELIB Version 3.1.0, 03-JAN-2005 (BVS)
///
/// Updated for PC-CYGWIN.
///
/// - SPICELIB Version 3.0.5, 17-JUL-2002 (BVS)
///
/// Added MAC-OSX environments.
///
/// - SPICELIB Version 3.0.4, 08-OCT-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. New
/// environments are WIN-NT
///
/// - SPICELIB Version 3.0.3, 24-SEP-1999 (NJB)
///
/// CSPICE environments were added. Some typos were corrected.
///
/// - SPICELIB Version 3.0.2, 28-JUL-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. New
/// environments are PC-DIGITAL, SGI-O32 and SGI-N32.
///
/// - SPICELIB Version 3.0.1, 18-MAR-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. Previously,
/// environments such as SUN-SUNOS and SUN-SOLARIS were implied
/// by the environment label SUN.
///
/// - SPICELIB Version 3.0.0, 07-APR-1998 (NJB)
///
/// Module was updated for the PC-LINUX platform.
///
/// - SPICELIB Version 2.0.0, 09-NOV-1993 (HAN)
///
/// Module was updated to include the value for FILEN
/// for the Silicon Graphics, DEC Alpha-OSF/1, and
/// NeXT platforms. Also, the previous value of 256 for
/// Unix platforms was changed to 255.
///
/// - SPICELIB Version 1.1.0, 12-OCT-1992 (HAN)
///
/// Updated module for multiple environments.
///
/// The code was also reformatted so that a utility program can
/// create the source file for a specific environment given a
/// master source file.
///
/// - 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 3.0.0, 07-APR-1998 (NJB)
///
/// Module was updated for the PC-LINUX platform.
///
/// - SPICELIB Version 2.0.0, 9-NOV-1993 (HAN)
///
/// Module was updated to include the value for FILEN
/// for the Silicon Graphics, DEC Alpha-OSF/1, and
/// NeXT platforms. Also, the previous value of 256 for
/// Unix platforms was changed to 255.
///
/// - SPICELIB Version 1.1.0, 12-OCT-1992 (HAN)
///
/// Updated module for multiple environments.
///
/// The code was also reformatted so that a utility program can
/// create the source file for a specific environment given a
/// master source file.
///
/// - Beta Version 1.1.0, 13-DEC-1989 (NJB)
///
/// PRTPKG, though it performs no run-time function, must
/// still return a value, in order to comply with the Fortran
/// standard. So, now it does.
///
/// - Beta Version 1.0.1, 08-FEB-1989 (NJB)
///
/// Warnings added to discourage use of this routine.
/// Parameter declarations moved to "Declarations" section.
/// Two local declarations moved to the correct location.
/// ```
pub fn prtpkg(
ctx: &mut SpiceContext,
short: bool,
long: bool,
expl: bool,
trace: bool,
dfault: bool,
type_: &str,
) -> crate::Result<bool> {
let ret = PRTPKG(
short,
long,
expl,
trace,
dfault,
type_.as_bytes(),
ctx.raw_context(),
)?;
ctx.handle_errors()?;
Ok(ret)
}
//$Procedure PRTPKG ( Declare Arguments for Error Message Routines )
pub fn PRTPKG(
SHORT: bool,
LONG: bool,
EXPL: bool,
TRACE: bool,
DFAULT: bool,
TYPE: &[u8],
ctx: &mut Context,
) -> f2rust_std::Result<bool> {
let mut PRTPKG: bool = false;
let mut DEVICE = [b' '; FILEN as usize];
//
// SPICELIB functions
//
//
// Local variables:
//
//
// Saved variables:
//
//
// Initial values:
//
//
// Executable Code:
//
GETDEV(&mut DEVICE, ctx);
WRLINE(&DEVICE, b"PRTPKG: You have called an entry point which has no run-time function; this may indicate a program bug. Please check the PRTPKG documentation. ", ctx)?;
WRLINE(&DEVICE, b"SPICE(BOGUSENTRY)", ctx)?;
PRTPKG = false;
Ok(PRTPKG)
}
/// Store Error Message Types to be Output
///
/// Store (a representation of) the selection of types of error
/// messages to be output. DO NOT CALL THIS ROUTINE.
///
/// # Required Reading
///
/// * [ERROR](crate::required_reading::error)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// SHORT I Select output of short error message?
/// EXPL I Select output of explanation of short message?
/// LONG I Select output of long error message?
/// TRACE I Select output of traceback?
/// DFAULT I Select output of default message?
/// ```
///
/// # Detailed Input
///
/// ```text
/// SHORT indicates whether the short error message is selected
/// as one of the error messages to be output when an error
/// is detected. A value of .TRUE. indicates that the
/// short error message IS selected.
///
/// EXPL indicates whether the explanatory text for the short
/// error message is selected as one of the error messages
/// to be output when an error is detected. A value of
/// .TRUE. indicates that the explanatory text for the
/// short error message IS selected.
///
/// LONG indicates whether the long error message is selected
/// as one of the error messages to be output when an error
/// is detected. A value of .TRUE. indicates that the
/// long error message IS selected.
///
/// TRACE indicates whether the traceback is selected
/// as one of the error messages to be output when an error
/// is detected. A value of .TRUE. indicates that the
/// traceback IS selected.
///
/// DFAULT indicates whether the default message is selected
/// as one of the error messages to be output when an error
/// is detected. A value of .TRUE. indicates that the
/// default message IS selected.
/// ```
///
/// # Particulars
///
/// ```text
/// DO NOT CALL THIS ROUTINE.
///
/// The effect of this routine is an ENVIRONMENTAL one. This
/// routine performs no output; it stores the error message
/// selection provided as input.
///
/// Note that the actual output of error messages depends not
/// only on the selection made using this routine, but also
/// on the selection of the error output device (see ERRDEV)
/// and the choice of error response action (see ERRACT). If
/// the action is not 'IGNORE' (possible choices are
/// 'IGNORE', 'ABORT', 'DEFAULT', 'REPORT', and 'RETURN'),
/// the selected error messages will be written to the chosen
/// output device when an error is detected.
/// ```
///
/// # Examples
///
/// ```text
/// 1. In this example, the short and long messages are selected.
///
/// C
/// C Select short and long error messages for output
/// C (We don't examine the status returned because no
/// C errors are detected by SETPRT):
/// C
///
/// STATUS = SETPRT ( .TRUE., .FALSE., .TRUE., .FALSE.,
/// . .FALSE. )
/// ```
///
/// # Restrictions
///
/// ```text
/// 1) DO NOT CALL THIS ROUTINE.
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// B.V. Semenov (JPL)
/// W.L. Taber (JPL)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 3.1.0, 17-JUN-2021 (JDR)
///
/// Added IMPLICIT NONE statement.
///
/// Edited the header to comply with NAIF standard.
///
/// - SPICELIB Version 3.0.5, 17-JUL-2002 (BVS)
///
/// Added MAC-OSX environments.
///
/// - SPICELIB Version 3.0.4, 08-OCT-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. New
/// environments are WIN-NT
///
/// - SPICELIB Version 3.0.2, 28-JUL-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. New
/// environments are PC-DIGITAL, SGI-O32 and SGI-N32.
///
/// - SPICELIB Version 3.0.1, 18-MAR-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. Previously,
/// environments such as SUN-SUNOS and SUN-SOLARIS were implied
/// by the environment label SUN.
///
/// - 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
/// - Beta Version 1.0.1, 08-FEB-1989 (NJB)
///
/// Warnings added to discourage use of this routine in
/// non-error-handling code. $Parameters section added.
/// ```
pub fn setprt(
ctx: &mut SpiceContext,
short: bool,
expl: bool,
long: bool,
trace: bool,
dfault: bool,
) -> bool {
let ret = SETPRT(short, expl, long, trace, dfault, ctx.raw_context());
ret
}
//$Procedure SETPRT ( Store Error Message Types to be Output )
pub fn SETPRT(
SHORT: bool,
EXPL: bool,
LONG: bool,
TRACE: bool,
DFAULT: bool,
ctx: &mut Context,
) -> bool {
let save = ctx.get_vars::<SaveVars>();
let save = &mut *save.borrow_mut();
let mut SETPRT: bool = false;
//
// Executable Code:
//
if SHORT {
save.SVSHRT = true;
} else {
save.SVSHRT = false;
}
if EXPL {
save.SVEXPL = true;
} else {
save.SVEXPL = false;
}
if LONG {
save.SVLONG = true;
} else {
save.SVLONG = false;
}
if TRACE {
save.SVTRAC = true;
} else {
save.SVTRAC = false;
}
if DFAULT {
save.SVDFLT = true;
} else {
save.SVDFLT = false;
}
//
// We assign a value to SETPRT, but this value is
// not meaningful...
//
SETPRT = true;
SETPRT
}
/// Is This Message Type Selected for Output?
///
/// Indicate whether the specified message type has been selected
/// for output.
///
/// # Required Reading
///
/// * [ERROR](crate::required_reading::error)
///
/// # Brief I/O
///
/// ```text
/// VARIABLE I/O DESCRIPTION
/// -------- --- --------------------------------------------------
/// TYPE I Type of message whose selection status is queried.
/// FILEN P Maximum length of a file name.
///
/// The function returns the value .TRUE. if the message type
/// indicated by TYPE has been selected for output to the error output
/// device.
/// ```
///
/// # Detailed Input
///
/// ```text
/// TYPE is the type of error message.
///
/// Possible values of TYPE are 'SHORT', 'EXPLAIN', 'LONG',
/// 'DEFAULT', and 'TRACEBACK'.
/// ```
///
/// # Detailed Output
///
/// ```text
/// The function returns the value .TRUE. if the message type
/// indicated by TYPE has been selected for output to the error
/// output device.
/// ```
///
/// # Parameters
///
/// ```text
/// FILEN is the maximum length of a file name.
/// ```
///
/// # Exceptions
///
/// ```text
/// 1) If an invalid value of TYPE is detected, the error
/// SPICE(INVALIDMSGTYPE) is signaled. The handling of this error
/// is a special case; to avoid recursion problems, SIGERR is not
/// called when the error is detected. Instead, the short and long
/// error messages are output directly.
/// ```
///
/// # Particulars
///
/// ```text
/// This routine is part of the SPICELIB error handling mechanism.
///
/// Note that even though a given type of message may have been
/// selected for output, the output device and error response
/// action must also have been selected appropriately.
/// Use ERRDEV to choose the output device for error messages.
/// Use ERRACT to choose the error response action. Any action
/// other than 'IGNORE' will result in error messages being
/// written to the error output device when errors are detected.
/// See ERRACT for details.
/// ```
///
/// # Examples
///
/// ```text
/// 1. We want to know if the short message has been selected
/// for output:
///
/// C
/// C Test whether the short message has been selected:
/// C
///
/// SELECT = MSGSEL ( 'SHORT' )
/// ```
///
/// # Author and Institution
///
/// ```text
/// N.J. Bachman (JPL)
/// J. Diaz del Rio (ODC Space)
/// B.V. Semenov (JPL)
/// W.L. Taber (JPL)
/// ```
///
/// # Version
///
/// ```text
/// - SPICELIB Version 3.1.0, 17-JUN-2021 (JDR)
///
/// Added IMPLICIT NONE statement.
///
/// Edited the header to comply with NAIF standard. Corrected
/// type declaration in $Declarations section.
///
/// - SPICELIB Version 3.0.5, 17-JUL-2002 (BVS)
///
/// Added MAC-OSX environments.
///
/// - SPICELIB Version 3.0.4, 08-OCT-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. New
/// environments are WIN-NT
///
/// - SPICELIB Version 3.0.2, 28-JUL-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. New
/// environments are PC-DIGITAL, SGI-O32 and SGI-N32.
///
/// - SPICELIB Version 3.0.1, 18-MAR-1999 (WLT)
///
/// The environment lines were expanded so that the supported
/// environments are now explicitly given. Previously,
/// environments such as SUN-SUNOS and SUN-SOLARIS were implied
/// by the environment label SUN.
///
/// - 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
/// - Beta Version 1.0.1, 08-FEB-1989 (NJB)
///
/// $Parameters section added; parameter declaration added
/// to brief I/O section as well.
/// ```
pub fn msgsel(ctx: &mut SpiceContext, type_: &str) -> crate::Result<bool> {
let ret = MSGSEL(type_.as_bytes(), ctx.raw_context())?;
ctx.handle_errors()?;
Ok(ret)
}
//$Procedure MSGSEL ( Is This Message Type Selected for Output? )
pub fn MSGSEL(TYPE: &[u8], ctx: &mut Context) -> f2rust_std::Result<bool> {
let save = ctx.get_vars::<SaveVars>();
let save = &mut *save.borrow_mut();
let mut MSGSEL: bool = false;
let mut DEVICE = [b' '; FILEN as usize];
let mut LTYPE = [b' '; 10 as usize];
let mut LOCTYP = [b' '; 10 as usize];
//
// Executable Code:
//
LJUST(TYPE, &mut LTYPE);
UCASE(<YPE.clone(), &mut LTYPE, ctx);
if fstr::eq(<YPE, b"SHORT") {
MSGSEL = save.SVSHRT;
} else if fstr::eq(<YPE, b"EXPLAIN") {
MSGSEL = save.SVEXPL;
} else if fstr::eq(<YPE, b"LONG") {
MSGSEL = save.SVLONG;
} else if fstr::eq(<YPE, b"TRACEBACK") {
MSGSEL = save.SVTRAC;
} else if fstr::eq(<YPE, b"DEFAULT") {
MSGSEL = save.SVDFLT;
} else {
//
// Bad value of type! We have a special case here; to
// avoid recursion, we output the messages directly,
// rather than call SIGERR.
//
GETDEV(&mut DEVICE, ctx);
WRLINE(&DEVICE, b"SPICE(INVALIDMSGTYPE)", ctx)?;
WRLINE(&DEVICE, b" ", ctx)?;
fstr::assign(&mut LOCTYP, TYPE);
//
// Note: What looks like a typo below isn't; there's
// a line break after the substring 'specified' of
// the "word" 'specifiedwas'.
//
WRLINE(&DEVICE, &fstr::concat(b"MSGSEL: An invalid error message type was supplied as input; the type specifiedwas: ", &LOCTYP), ctx)?;
}
Ok(MSGSEL)
}