Apply Web2C TCX tables to native byte streams

This commit is contained in:
gloamxun committed 2026-11-28 09:55:09 +08:00
1 parent 3bb2330676
commit 509f229a52
13 files changed
+393 -38

No files matched your search

@@ -1,6 +1,8 @@
//! Route-D-owned TeX execution. No semantic renderer, source rewriting or VM
//! adapter participates in this path. Unsupported commands are errors.
mod boxes;
mod byte_translation;
pub use byte_translation::ByteTranslation;
mod cancellation;
mod case;
mod context;
@@ -347,6 +349,9 @@ pub trait SourceProvider {
fn observe_message(&mut self, _text: &str) -> Result<(), String> {
Ok(())
}
fn observe_message_bytes(&mut self, text: &[u8]) -> Result<(), String> {
self.observe_message(&byte_translation::diagnostic_text(text))
}
/// Optional live observer for retained engine diagnostics. Unlike an
/// explicit write, a pure library consumer can inspect the typed event.
fn observe_diagnostic(
@@ -422,12 +427,20 @@ pub trait SourceProvider {
fn write_out(&mut self, _stream: u8, _text: &str) -> Result<(), String> {
Err("host output streams unavailable".into())
}
/// Hosts that persist byte-mode TeX output must accept arbitrary bytes.
fn write_out_bytes(&mut self, stream: u8, bytes: &[u8]) -> Result<(), String> {
let text = std::str::from_utf8(bytes).map_err(|_| "host output stream requires UTF-8")?;
self.write_out(stream, text)
}
fn close_out(&mut self, _stream: u8) -> Result<(), String> {
Err("host output streams unavailable".into())
}
fn diagnostic(&mut self, _destination: WriteDestination, _text: &str) -> Result<(), String> {
Err("host diagnostic sink unavailable".into())
}
fn diagnostic_bytes(&mut self, destination: WriteDestination, bytes: &[u8]) -> Result<(), String> {
self.diagnostic(destination, &byte_translation::diagnostic_text(bytes))
}
}
pub struct NoFiles;