Skip to content

Commit

Permalink
rm
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Jan 13, 2021
1 parent 6960cb4 commit 3c196fd
Showing 1 changed file with 4 additions and 52 deletions.
56 changes: 4 additions & 52 deletions engine/src/xetex_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,34 +210,6 @@ pub(crate) unsafe fn print_ln() {

use std::io;

#[inline]
fn print_term_log_char(
stdout: &mut LogTermOutput,
lg: &mut LogTermOutput,
s: char,
nl: i32,
) -> io::Result<()> {
if (s as i32) == nl {
stdout.write_ln()?;
lg.write_ln()?;
} else {
if s.is_control() {
let (buf, len) = replace_control(s);
for &c in &buf[..len] {
let c = char::from(c);
stdout.write_chr(c)?;
lg.write_chr(c)?;
}
} else {
stdout.write_chr(s)?;
lg.write_chr(s)?;
}
stdout.tally += 1;
lg.tally += 1;
}
Ok(())
}

pub(crate) struct Pseudo {
pub(crate) tally: usize,
pub(crate) first_count: usize,
Expand Down Expand Up @@ -325,26 +297,8 @@ impl fmt::Write for Selector {
unsafe {
match self {
Selector::TermAndLog => {
use std::ops::DerefMut;
let stdout = rust_stdout.as_mut().unwrap();
let lg = log_file.as_mut().unwrap();
let nl = get_int_par(IntPar::new_line_char);
let bytelen = s.len();
if (lg.offset + bytelen < lg.max_line_width)
&& (stdout.offset + bytelen < stdout.max_line_width)
&& !s.contains(|c: char| (c as i32) == nl || c.is_control())
{
std::io::Write::write(lg.deref_mut(), s.as_bytes()).unwrap();
lg.offset += bytelen;
std::io::Write::write(stdout.deref_mut(), s.as_bytes()).unwrap();
stdout.offset += bytelen;
lg.tally += bytelen;
stdout.tally += bytelen;
} else {
for c in s.chars() {
print_term_log_char(stdout, lg, c, nl).unwrap();
}
}
rust_stdout.as_mut().unwrap().write_str(s).unwrap();
log_file.as_mut().unwrap().write_str(s).unwrap();
}
Selector::LogOnly => {
log_file.as_mut().unwrap().write_str(s).unwrap();
Expand All @@ -363,10 +317,8 @@ impl fmt::Write for Selector {
unsafe {
match selector {
Selector::TermAndLog => {
let stdout = rust_stdout.as_mut().unwrap();
let lg = log_file.as_mut().unwrap();
let nl = get_int_par(IntPar::new_line_char);
print_term_log_char(stdout, lg, s, nl).unwrap();
rust_stdout.as_mut().unwrap().write_char(s).unwrap();
log_file.as_mut().unwrap().write_char(s).unwrap();
}
Selector::LogOnly => {
log_file.as_mut().unwrap().write_char(s).unwrap();
Expand Down

0 comments on commit 3c196fd

Please sign in to comment.