Run cancellable pdfTeX matching in native frontends
This commit is contained in:
1 parent
091458d329
commit
6e573dc1ce
21 files changed
+665
-9
No files matched your search
@@ -151,6 +151,8 @@ struct DraftLedger {
|
||||
|
||||
pub struct Files {
|
||||
world: FileWorld,
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
regex_worker: Option<crate::native_regex::Worker>,
|
||||
cwd: PathBuf,
|
||||
inputs: BTreeMap<u8, Input>,
|
||||
outputs: BTreeMap<u8, Output>,
|
||||
@@ -547,6 +549,8 @@ impl Files {
|
||||
preparation.phase = HostPreparationPhase::Ready;
|
||||
Ok(Self {
|
||||
world: stored_world.take().unwrap(),
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
regex_worker: None,
|
||||
cwd,
|
||||
inputs: BTreeMap::new(),
|
||||
outputs: BTreeMap::new(),
|
||||
@@ -1404,6 +1408,25 @@ pub(crate) fn absolute_output(cwd: &Path, path: &Path) -> Result<PathBuf, String
|
||||
}
|
||||
|
||||
impl SourceProvider for Files {
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
fn match_pdf_regex(
|
||||
&mut self,
|
||||
request: &texrra_tex_core::execution::RegexRequest,
|
||||
cancellation: Option<&Cancellation>,
|
||||
) -> Result<texrra_tex_core::execution::RegexOutcome, String> {
|
||||
use crate::native_regex::{self, Worker};
|
||||
if !native_regex::enabled() {
|
||||
return texrra_tex_core::execution::match_pdf_regex(request);
|
||||
}
|
||||
if self.regex_worker.is_none() {
|
||||
self.regex_worker = Some(Worker::start()?);
|
||||
}
|
||||
self.regex_worker
|
||||
.as_mut()
|
||||
.expect("native matcher was started")
|
||||
.request(request, cancellation)
|
||||
}
|
||||
|
||||
fn execution_resource_trace(&self) -> Option<&texrra_tex_core::resources::ResourceTrace> {
|
||||
Some(self.world.trace())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user