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
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
const PICLEN: i32 = 11;
//
// The utility routine T_ITHSYM creates the name of the ith
// symbol. The names created by this routine have the form
//
// XXX...XXXnnn
//
// where nnn is the input number N, printed with a sufficient
// number of leading zeros so that all numbers in the range
// 1:NMAX have the same width. The number is padded with
// leading 'X' characters up to the length of the string NAME.
//
pub fn T_ITHSYM(N: i32, NMAX: i32, NAME: &mut [u8], ctx: &mut Context) -> f2rust_std::Result<()> {
let mut PICTUR = [b' '; PICLEN as usize];
let mut NPAD: i32 = 0;
let mut NPICT: i32 = 0;
let mut SLEN: i32 = 0;
let mut NDIGIT: i32 = 0;
//
// SPICELIB functions
//
//
// Local parameters
//
//
// Local variables
//
//
// Get the length of the output name.
//
SLEN = intrinsics::LEN(NAME);
//
// Determine the number of digits required.
//
NDIGIT = ((f64::log10(((NMAX as f64) + 0.5)) as i32) + 1);
//
// Create the format picture for the names.
//
fstr::assign(&mut PICTUR, b"0");
NPICT = intrinsics::MIN0(&[SLEN, NDIGIT]);
for I in 2..=NPICT {
fstr::assign(fstr::substr_mut(&mut PICTUR, I..=I), b"X");
}
spicelib::DPFMT((N as f64), &PICTUR, NAME, ctx)?;
//
// Add non-blank leading padding to the name.
//
NPAD = (SLEN - NPICT);
if (NPAD > 0) {
spicelib::RJUST(&NAME.to_vec(), NAME);
for I in 1..=NPAD {
fstr::assign(fstr::substr_mut(NAME, I..=I), b"X");
}
}
Ok(())
}