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
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
const LNSIZE: i32 = 80;
//$Procedure ZZGFDSPS ( GF, display string )
pub fn ZZGFDSPS(
NLEAD: i32,
STRING: &[u8],
FMT: &[u8],
NTRAIL: i32,
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let mut TMPSTR = [b' '; LNSIZE as usize];
let mut IOSTAT: i32 = 0;
let mut L: i32 = 0;
//
// SPICELIB Functions
//
//
// Local parameters
//
//
// Local Variables
//
//
// Use discovery check-in.
//
//
// Get a local copy of the input string.
//
fstr::assign(&mut TMPSTR, STRING);
L = RTRIM(&TMPSTR);
//
// Write leading blank lines, if any. We use cursor control
// here so as to avoid overwriting the last status line.
//
for I in 1..=NLEAD {
{
use f2rust_std::{
data::Val,
io::{self, Writer},
};
let mut writer = io::FormattedWriter::new(ctx.default_write_unit()?, None, b"(A)")?;
writer.start()?;
writer.write_str(&fstr::concat(&intrinsics::CHAR(27), b"[B"))?;
writer.finish()?;
}
}
//
// Write the status line, then move the cursor up one line.
// This places the cursor at the start of the line that
// was just written.
//
SUFFIX(&fstr::concat(&intrinsics::CHAR(27), b"[A"), 0, &mut TMPSTR);
{
use f2rust_std::{
data::Val,
io::{self, Writer},
};
let mut writer = io::FormattedWriter::new(ctx.default_write_unit()?, None, b"(A)")?;
IOSTAT = io::capture_iostat(|| {
writer.start()?;
writer.write_str(fstr::substr(&TMPSTR, 1..=RTRIM(&TMPSTR)))?;
writer.finish()?;
Ok(())
})?;
}
if (IOSTAT != 0) {
CHKIN(b"ZZGFDSPS", ctx)?;
SETMSG(b"Error writing to standard output: IOSTAT = #.", ctx);
ERRINT(b"#", IOSTAT, ctx);
SIGERR(b"SPICE(WRITEFAILED)", ctx)?;
CHKOUT(b"ZZGFDSPS", ctx)?;
return Ok(());
}
//
// Write trailing blank lines, if any. We use cursor control
// here so as to avoid overwriting the last status line.
//
for I in 1..=NTRAIL {
{
use f2rust_std::{
data::Val,
io::{self, Writer},
};
let mut writer = io::FormattedWriter::new(ctx.default_write_unit()?, None, b"(A)")?;
writer.start()?;
writer.write_str(&fstr::concat(&intrinsics::CHAR(27), b"[B"))?;
writer.finish()?;
}
}
Ok(())
}