Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6f447dd59 | ||
|
|
d98d7b44c1 | ||
|
|
64adf51b20 |
No files matched your search
@@ -10,8 +10,6 @@ where their state, file effects, and cancellation can be verified.
|
|||||||
The [product goal](docs/NATIVE_PRODUCT_GOAL.md) defines compatibility and live
|
The [product goal](docs/NATIVE_PRODUCT_GOAL.md) defines compatibility and live
|
||||||
preview acceptance. The [publisher matrix](docs/PUBLISHER_TEMPLATE_MATRIX.md)
|
preview acceptance. The [publisher matrix](docs/PUBLISHER_TEMPLATE_MATRIX.md)
|
||||||
covers original journals, two-column journals, conferences, and arXiv.
|
covers original journals, two-column journals, conferences, and arXiv.
|
||||||
The [local beta guide](docs/NATIVE_BETA.md) explains how to prepare a bundle,
|
|
||||||
open a project in the native editor, and export a PDF.
|
|
||||||
|
|
||||||
## Native execution bootstrap
|
## Native execution bootstrap
|
||||||
|
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ impl Default for VerticalBuilder {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
nodes: Vec::new(),
|
nodes: Vec::new(),
|
||||||
prev_depth: super::parameters::IGNORE_DEPTH,
|
prev_depth: -1000 * 65536,
|
||||||
previous_lines: 0,
|
previous_lines: 0,
|
||||||
tail_path: Vec::new(),
|
tail_path: Vec::new(),
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ impl VerticalBuilder {
|
|||||||
|
|
||||||
pub fn append_box(&mut self, node: NativeVerticalNode, state: &State) -> Result<(), String> {
|
pub fn append_box(&mut self, node: NativeVerticalNode, state: &State) -> Result<(), String> {
|
||||||
let (_, height, depth) = node.dimensions().expect("box or line");
|
let (_, height, depth) = node.dimensions().expect("box or line");
|
||||||
if self.prev_depth > state.ignored_depth() {
|
if self.prev_depth > -1000 * 65536 {
|
||||||
let mut label = Parameter::Baselineskip;
|
let mut label = Parameter::Baselineskip;
|
||||||
let mut g = state.parameter(label).glue();
|
let mut g = state.parameter(label).glue();
|
||||||
let gap = g.width as i64 - self.prev_depth as i64 - height;
|
let gap = g.width as i64 - self.prev_depth as i64 - height;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::collections::{BTreeSet, VecDeque};
|
use std::collections::{BTreeSet, VecDeque};
|
||||||
use std::hash::{BuildHasher, RandomState};
|
use std::hash::{BuildHasher, RandomState};
|
||||||
use std::sync::Arc;
|
use std::sync::{Arc, OnceLock};
|
||||||
|
|
||||||
use hashbrown::{HashMap, hash_map::RawEntryMut};
|
use hashbrown::{HashMap, hash_map::RawEntryMut};
|
||||||
|
|
||||||
@@ -249,6 +249,7 @@ pub struct Executor {
|
|||||||
reads_event_history: bool,
|
reads_event_history: bool,
|
||||||
// Capacity recounts and tracing use the resource accounting traversal.
|
// Capacity recounts and tracing use the resource accounting traversal.
|
||||||
accounts_event_history: bool,
|
accounts_event_history: bool,
|
||||||
|
deferred_accounting: Option<Arc<DeferredAccounting>>,
|
||||||
steps: usize,
|
steps: usize,
|
||||||
ligature_carry: super::ligature::Carry,
|
ligature_carry: super::ligature::Carry,
|
||||||
current: Span,
|
current: Span,
|
||||||
@@ -330,10 +331,35 @@ pub struct CheckpointSource<'a> {
|
|||||||
/// validated and replayed the previous suffix into this revision's draft.
|
/// validated and replayed the previous suffix into this revision's draft.
|
||||||
pub enum CheckpointDecision {
|
pub enum CheckpointDecision {
|
||||||
Continue,
|
Continue,
|
||||||
|
/// Move to a validated later command boundary and select captures there.
|
||||||
|
Advance(Box<EntryCheckpoint>),
|
||||||
Reuse(Box<Execution>),
|
Reuse(Box<Execution>),
|
||||||
ReplayFailed(String),
|
ReplayFailed(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum CheckpointReplayError {
|
||||||
|
Host(String),
|
||||||
|
Accounting { steps: usize },
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DeferredAccounting {
|
||||||
|
current: Arc<EntryCheckpoint>,
|
||||||
|
basis: Arc<EntryCheckpoint>,
|
||||||
|
child: usize,
|
||||||
|
verified: OnceLock<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeferredAccounting {
|
||||||
|
fn verify(&self) -> bool {
|
||||||
|
*self.verified.get_or_init(|| {
|
||||||
|
self.current.executor.equivalent_accounting_history(
|
||||||
|
&self.basis.executor, Some(self.child),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A live, in-memory kernel continuation at an entry-file command boundary.
|
/// A live, in-memory kernel continuation at an entry-file command boundary.
|
||||||
/// The host must validate dependencies and replay all prefix effects before
|
/// The host must validate dependencies and replay all prefix effects before
|
||||||
/// resumption. The checkpoint itself validates the entry bytes already loaded.
|
/// resumption. The checkpoint itself validates the entry bytes already loaded.
|
||||||
@@ -372,6 +398,12 @@ impl EntryCheckpoint {
|
|||||||
== earlier.executor.sources[earlier.entry].data.len()))
|
== earlier.executor.sources[earlier.entry].data.len()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn can_resume_accounting(&self, allow_deferred: bool) -> bool {
|
||||||
|
self.executor.deferred_accounting.as_ref().is_none_or(|proof| {
|
||||||
|
proof.verified.get().copied().unwrap_or(allow_deferred)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn accepts_entry(&self, source: &SourceFile) -> bool {
|
pub fn accepts_entry(&self, source: &SourceFile) -> bool {
|
||||||
self.accepts_entry_bytes(&source.name, &source.data)
|
self.accepts_entry_bytes(&source.name, &source.data)
|
||||||
}
|
}
|
||||||
@@ -421,6 +453,9 @@ impl EntryCheckpoint {
|
|||||||
files: &mut impl SourceProvider,
|
files: &mut impl SourceProvider,
|
||||||
cancellation: Cancellation,
|
cancellation: Cancellation,
|
||||||
) -> Option<Result<Execution, ExecutionFailure>> {
|
) -> Option<Result<Execution, ExecutionFailure>> {
|
||||||
|
if !self.can_resume_accounting(false) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
self.resume_observed(source, None, files, cancellation, None, None,
|
self.resume_observed(source, None, files, cancellation, None, None,
|
||||||
|_, _, _, _| CheckpointDecision::Continue)
|
|_, _, _, _| CheckpointDecision::Continue)
|
||||||
.expect("ordinary resume cannot reject a cached suffix")
|
.expect("ordinary resume cannot reject a cached suffix")
|
||||||
@@ -437,6 +472,9 @@ impl EntryCheckpoint {
|
|||||||
select: impl FnMut(CheckpointSource<'_>, usize) -> Option<S>,
|
select: impl FnMut(CheckpointSource<'_>, usize) -> Option<S>,
|
||||||
mut capture: impl FnMut(S, EntryCheckpoint, &mut F),
|
mut capture: impl FnMut(S, EntryCheckpoint, &mut F),
|
||||||
) -> Option<Result<Execution, ExecutionFailure>> {
|
) -> Option<Result<Execution, ExecutionFailure>> {
|
||||||
|
if !self.can_resume_accounting(false) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
self.resume_observed(
|
self.resume_observed(
|
||||||
source,
|
source,
|
||||||
nested,
|
nested,
|
||||||
@@ -462,7 +500,7 @@ impl EntryCheckpoint {
|
|||||||
previous: Option<&Execution>,
|
previous: Option<&Execution>,
|
||||||
select: impl FnMut(CheckpointSource<'_>, usize) -> Option<S>,
|
select: impl FnMut(CheckpointSource<'_>, usize) -> Option<S>,
|
||||||
capture: impl FnMut(S, EntryCheckpoint, &mut F) -> CheckpointDecision,
|
capture: impl FnMut(S, EntryCheckpoint, &mut F) -> CheckpointDecision,
|
||||||
) -> Result<Option<Result<Execution, ExecutionFailure>>, String> {
|
) -> Result<Option<Result<Execution, ExecutionFailure>>, CheckpointReplayError> {
|
||||||
self.resume_observed(source, nested, files, cancellation, Some(line_break_cache), previous,
|
self.resume_observed(source, nested, files, cancellation, Some(line_break_cache), previous,
|
||||||
Executor::entry_observer(self.incoming_state, select, capture))
|
Executor::entry_observer(self.incoming_state, select, capture))
|
||||||
}
|
}
|
||||||
@@ -476,7 +514,7 @@ impl EntryCheckpoint {
|
|||||||
line_break_cache: Option<std::sync::Arc<super::LineBreakCache>>,
|
line_break_cache: Option<std::sync::Arc<super::LineBreakCache>>,
|
||||||
previous: Option<&Execution>,
|
previous: Option<&Execution>,
|
||||||
capture_boundary: impl FnMut(&mut Executor, usize, bool, &mut F) -> CheckpointDecision,
|
capture_boundary: impl FnMut(&mut Executor, usize, bool, &mut F) -> CheckpointDecision,
|
||||||
) -> Result<Option<Result<Execution, ExecutionFailure>>, String> {
|
) -> Result<Option<Result<Execution, ExecutionFailure>>, CheckpointReplayError> {
|
||||||
if !self.accepts_entry(&source)
|
if !self.accepts_entry(&source)
|
||||||
|| match &nested {
|
|| match &nested {
|
||||||
Some(nested) => !self.accepts_nested_source(&nested.name, &nested.data),
|
Some(nested) => !self.accepts_nested_source(&nested.name, &nested.data),
|
||||||
@@ -491,6 +529,7 @@ impl EntryCheckpoint {
|
|||||||
if let Some(nested) = nested {
|
if let Some(nested) = nested {
|
||||||
executor.rebind_checkpoint_source(self.active_source, nested);
|
executor.rebind_checkpoint_source(self.active_source, nested);
|
||||||
}
|
}
|
||||||
|
executor.check_accounting_replay()?;
|
||||||
let result = executor
|
let result = executor
|
||||||
.check_cancellation()
|
.check_cancellation()
|
||||||
.and_then(|_| {
|
.and_then(|_| {
|
||||||
@@ -505,23 +544,29 @@ impl EntryCheckpoint {
|
|||||||
Ok(CheckpointDecision::Reuse(execution)) => {
|
Ok(CheckpointDecision::Reuse(execution)) => {
|
||||||
return Ok(Some(Ok(*execution)));
|
return Ok(Some(Ok(*execution)));
|
||||||
}
|
}
|
||||||
Ok(CheckpointDecision::ReplayFailed(error)) => return Err(error),
|
Ok(CheckpointDecision::ReplayFailed(error)) => return Err(CheckpointReplayError::Host(error)),
|
||||||
Ok(CheckpointDecision::Continue) => Ok(()),
|
Ok(CheckpointDecision::Continue) => Ok(()),
|
||||||
|
Ok(CheckpointDecision::Advance(_)) => unreachable!("entry observer applies advances"),
|
||||||
Err(error) => Err(error),
|
Err(error) => Err(error),
|
||||||
};
|
};
|
||||||
|
executor.check_accounting_replay()?;
|
||||||
let result = executor.finish_observed_input(result, files);
|
let result = executor.finish_observed_input(result, files);
|
||||||
|
executor.check_accounting_replay()?;
|
||||||
Ok(Some(executor.finish_execution(result, self.incoming_state, previous)))
|
Ok(Some(executor.finish_execution(result, self.incoming_state, previous)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Executor {
|
impl Executor {
|
||||||
fn rebind_checkpoint_source(&mut self, id: usize, file: SourceFile) {
|
fn source_mouth_mut(&mut self, id: usize) -> &mut Mouth {
|
||||||
let mouth = self.inputs.iter_mut().rev().find_map(|frame| match frame {
|
self.inputs.iter_mut().rev().find_map(|frame| match frame {
|
||||||
InputFrame::Source { source, mouth, .. } if *source == id => Some(mouth),
|
InputFrame::Source { source, mouth, .. } if *source == id => Some(mouth),
|
||||||
_ => None,
|
_ => None,
|
||||||
}).expect("checkpoint retains the active scanner");
|
}).expect("checkpoint retains the source scanner")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rebind_checkpoint_source(&mut self, id: usize, file: SourceFile) {
|
||||||
if self.sources[id].as_ref() != &file {
|
if self.sources[id].as_ref() != &file {
|
||||||
mouth.rebind_loaded_prefix(file.data.clone());
|
self.source_mouth_mut(id).rebind_loaded_prefix(file.data.clone());
|
||||||
self.sources[id] = Arc::new(file);
|
self.sources[id] = Arc::new(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -542,8 +587,6 @@ impl Executor {
|
|||||||
const XETEX_REVISION: &'static str = ".999998";
|
const XETEX_REVISION: &'static str = ".999998";
|
||||||
|
|
||||||
pub fn new(state: State, limits: Limits) -> Self {
|
pub fn new(state: State, limits: Limits) -> Self {
|
||||||
let mut vertical = super::boxes::VerticalBuilder::default();
|
|
||||||
vertical.prev_depth = state.ignored_depth();
|
|
||||||
Self {
|
Self {
|
||||||
state,
|
state,
|
||||||
limits,
|
limits,
|
||||||
@@ -563,6 +606,7 @@ impl Executor {
|
|||||||
events: ExecutionEvents::default(),
|
events: ExecutionEvents::default(),
|
||||||
reads_event_history: false,
|
reads_event_history: false,
|
||||||
accounts_event_history: false,
|
accounts_event_history: false,
|
||||||
|
deferred_accounting: None,
|
||||||
steps: 0,
|
steps: 0,
|
||||||
ligature_carry: super::ligature::Carry::default(),
|
ligature_carry: super::ligature::Carry::default(),
|
||||||
current: Span::default(),
|
current: Span::default(),
|
||||||
@@ -596,7 +640,7 @@ impl Executor {
|
|||||||
pdf_force_pagebox_warned: false,
|
pdf_force_pagebox_warned: false,
|
||||||
input_position: None,
|
input_position: None,
|
||||||
paragraph: None,
|
paragraph: None,
|
||||||
vertical,
|
vertical: super::boxes::VerticalBuilder::default(),
|
||||||
box_frames: Vec::new(),
|
box_frames: Vec::new(),
|
||||||
box_nodes_created: 0,
|
box_nodes_created: 0,
|
||||||
material_charge: 0,
|
material_charge: 0,
|
||||||
@@ -3935,7 +3979,7 @@ impl Executor {
|
|||||||
mut select: impl FnMut(CheckpointSource<'_>, usize) -> Option<S>,
|
mut select: impl FnMut(CheckpointSource<'_>, usize) -> Option<S>,
|
||||||
mut capture: impl FnMut(S, EntryCheckpoint, &mut F) -> CheckpointDecision,
|
mut capture: impl FnMut(S, EntryCheckpoint, &mut F) -> CheckpointDecision,
|
||||||
) -> impl FnMut(&mut Self, usize, bool, &mut F) -> CheckpointDecision {
|
) -> impl FnMut(&mut Self, usize, bool, &mut F) -> CheckpointDecision {
|
||||||
move |engine, initial_depth, pages_processed, files| {
|
move |engine, initial_depth, pages_processed, files| loop {
|
||||||
if engine.job_ended {
|
if engine.job_ended {
|
||||||
return CheckpointDecision::Continue;
|
return CheckpointDecision::Continue;
|
||||||
}
|
}
|
||||||
@@ -3988,7 +4032,16 @@ impl Executor {
|
|||||||
frontier,
|
frontier,
|
||||||
pages_processed,
|
pages_processed,
|
||||||
};
|
};
|
||||||
capture(slot, checkpoint, files)
|
match capture(slot, checkpoint, files) {
|
||||||
|
CheckpointDecision::Advance(checkpoint) => {
|
||||||
|
debug_assert!(checkpoint.completed_steps() > engine.steps);
|
||||||
|
let mut advanced = checkpoint.executor;
|
||||||
|
advanced.cancellation = engine.cancellation.take();
|
||||||
|
advanced.line_break_cache = engine.line_break_cache.take();
|
||||||
|
*engine = advanced;
|
||||||
|
}
|
||||||
|
decision => return decision,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn finish_execution(
|
fn finish_execution(
|
||||||
|
|||||||
@@ -440,7 +440,6 @@ impl Executor {
|
|||||||
if horizontal {
|
if horizontal {
|
||||||
self.start_alignment_hlist(span);
|
self.start_alignment_hlist(span);
|
||||||
} else {
|
} else {
|
||||||
self.vertical.prev_depth = self.read_ignored_depth();
|
|
||||||
self.normal_paragraph(files)?;
|
self.normal_paragraph(files)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -609,8 +608,6 @@ impl Executor {
|
|||||||
.insert(Dependency::Parameter(Parameter::Lineskip));
|
.insert(Dependency::Parameter(Parameter::Lineskip));
|
||||||
self.reads
|
self.reads
|
||||||
.insert(Dependency::Parameter(Parameter::Lineskiplimit));
|
.insert(Dependency::Parameter(Parameter::Lineskiplimit));
|
||||||
self.reads
|
|
||||||
.insert(Dependency::Parameter(Parameter::Pdfignoreddimen));
|
|
||||||
let f = self.alignments.last_mut().unwrap();
|
let f = self.alignments.last_mut().unwrap();
|
||||||
self.vertical.append(&mut f.adjustments.pre);
|
self.vertical.append(&mut f.adjustments.pre);
|
||||||
self.vertical
|
self.vertical
|
||||||
|
|||||||
@@ -717,7 +717,6 @@ impl Executor {
|
|||||||
b.restricted = true;
|
b.restricted = true;
|
||||||
self.paragraph = Some(b);
|
self.paragraph = Some(b);
|
||||||
} else {
|
} else {
|
||||||
self.vertical.prev_depth = self.read_ignored_depth();
|
|
||||||
self.normal_paragraph(files)?;
|
self.normal_paragraph(files)?;
|
||||||
}
|
}
|
||||||
if group == GroupKind::Insertion {
|
if group == GroupKind::Insertion {
|
||||||
@@ -978,18 +977,12 @@ impl Executor {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub(super) fn read_ignored_depth(&mut self) -> i32 {
|
|
||||||
self.reads.insert(Dependency::Parameter(Parameter::Pdfignoreddimen));
|
|
||||||
self.state.ignored_depth()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn append_vertical_box(&mut self, node: NativeVerticalNode) -> Result<(), Error> {
|
pub(super) fn append_vertical_box(&mut self, node: NativeVerticalNode) -> Result<(), Error> {
|
||||||
self.reads.insert(Dependency::VerticalState);
|
self.reads.insert(Dependency::VerticalState);
|
||||||
for p in [
|
for p in [
|
||||||
Parameter::Baselineskip,
|
Parameter::Baselineskip,
|
||||||
Parameter::Lineskip,
|
Parameter::Lineskip,
|
||||||
Parameter::Lineskiplimit,
|
Parameter::Lineskiplimit,
|
||||||
Parameter::Pdfignoreddimen,
|
|
||||||
] {
|
] {
|
||||||
self.reads.insert(Dependency::Parameter(p));
|
self.reads.insert(Dependency::Parameter(p));
|
||||||
}
|
}
|
||||||
@@ -1023,7 +1016,7 @@ impl Executor {
|
|||||||
return self
|
return self
|
||||||
.fail("outer running rule requires native page packaging; specify width");
|
.fail("outer running rule requires native page packaging; specify width");
|
||||||
}
|
}
|
||||||
self.vertical.prev_depth = self.read_ignored_depth();
|
self.vertical.prev_depth = -1000 * 65536;
|
||||||
NativeVerticalNode::Rule(r)
|
NativeVerticalNode::Rule(r)
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
impl InputFrame {
|
impl InputFrame {
|
||||||
fn same_at_shipout(&self, other: &Self) -> bool {
|
fn same_continuation(&self, other: &Self, changed_child: Option<usize>) -> bool {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(
|
(
|
||||||
Self::Source {
|
Self::Source {
|
||||||
@@ -20,7 +20,10 @@ impl InputFrame {
|
|||||||
group_boundary: bg,
|
group_boundary: bg,
|
||||||
conditional_boundary: bc,
|
conditional_boundary: bc,
|
||||||
},
|
},
|
||||||
) => (a, ae, at, ag, ac) == (b, be, bt, bg, bc) && am.same_unread_input(bm),
|
) => {
|
||||||
|
(a, ae, at, ag, ac) == (b, be, bt, bg, bc)
|
||||||
|
&& am.same_unread_input(bm, changed_child != Some(*a))
|
||||||
|
}
|
||||||
(
|
(
|
||||||
Self::Tokens {
|
Self::Tokens {
|
||||||
tokens: a,
|
tokens: a,
|
||||||
@@ -80,6 +83,82 @@ impl InputFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl EntryCheckpoint {
|
impl EntryCheckpoint {
|
||||||
|
/// Move through commands already executed on unchanged loaded child bytes.
|
||||||
|
/// The host must prove that the earlier host states agree and that the
|
||||||
|
/// skipped interval contains no host calls. The current source stays bound.
|
||||||
|
pub fn advance_within_child(self: &Arc<Self>, prior: &Arc<Self>, later: &Self) -> Option<Self> {
|
||||||
|
let child = self.nested_source_id()?;
|
||||||
|
let scope = |checkpoint: &Self| {
|
||||||
|
(checkpoint.entry, checkpoint.active_source, checkpoint.initial_depth,
|
||||||
|
checkpoint.incoming_state, checkpoint.pages_processed)
|
||||||
|
};
|
||||||
|
if scope(self) != scope(prior)
|
||||||
|
|| scope(prior) != scope(later)
|
||||||
|
|| self.pages_processed
|
||||||
|
|| self.frontier != prior.frontier
|
||||||
|
|| later.frontier <= prior.frontier
|
||||||
|
|| later.completed_steps() <= prior.completed_steps()
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let current = &self.executor;
|
||||||
|
let old = &prior.executor;
|
||||||
|
let source = ¤t.sources[child];
|
||||||
|
if current.deferred_accounting.is_some() || old.deferred_accounting.is_some()
|
||||||
|
|| later.executor.accounts_event_history
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let basis = match &later.executor.deferred_accounting {
|
||||||
|
None => Arc::clone(prior),
|
||||||
|
Some(proof) if proof.verified.get() == Some(&true) => Arc::clone(prior),
|
||||||
|
// Reusing the child again retains the original accounting basis.
|
||||||
|
// The two early snapshots held by a proof never hold other proofs.
|
||||||
|
Some(proof) if proof.verified.get().is_none() && Arc::ptr_eq(&proof.current, prior) => {
|
||||||
|
Arc::clone(&proof.basis)
|
||||||
|
}
|
||||||
|
_ => return None,
|
||||||
|
};
|
||||||
|
let input_macros = current.inputs.iter().zip(&old.inputs).filter_map(|(current, old)| {
|
||||||
|
match (current, old) {
|
||||||
|
(InputFrame::Macro { definition: current, .. }, InputFrame::Macro { definition: old, .. }) => {
|
||||||
|
Some((current, old))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if later.executor.sources != old.sources
|
||||||
|
|| later.executor.shipped_pages != old.shipped_pages
|
||||||
|
|| current.sources.len() != old.sources.len()
|
||||||
|
|| current.sources.iter().zip(&old.sources).enumerate()
|
||||||
|
.any(|(id, (a, b))| id != child && a != b)
|
||||||
|
|| !later.accepts_nested_source(&source.name, &source.data)
|
||||||
|
|| !same_kernel_continuation(current, old, Some(child))
|
||||||
|
|| !current.state.same_macro_aliases(&old.state, input_macros)
|
||||||
|
|| !current.events.iter().eq(old.events.iter())
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let mut executor = later.executor.clone();
|
||||||
|
executor.source_mouth_mut(child).share_loaded_source(self.source_mouth(child));
|
||||||
|
executor.sources[child] = Arc::clone(source);
|
||||||
|
executor.deferred_accounting = Some(Arc::new(DeferredAccounting {
|
||||||
|
current: Arc::clone(self),
|
||||||
|
basis,
|
||||||
|
child,
|
||||||
|
verified: OnceLock::new(),
|
||||||
|
}));
|
||||||
|
Some(Self {
|
||||||
|
executor,
|
||||||
|
entry: later.entry,
|
||||||
|
active_source: child,
|
||||||
|
initial_depth: later.initial_depth,
|
||||||
|
incoming_state: later.incoming_state,
|
||||||
|
frontier: later.frontier,
|
||||||
|
pages_processed: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Construct an execution with the current prefix and a previously
|
/// Construct an execution with the current prefix and a previously
|
||||||
/// completed suffix. The host must still validate and replay that suffix.
|
/// completed suffix. The host must still validate and replay that suffix.
|
||||||
pub fn splice_settled_suffix(&self, prior: &Self, completed: &Execution) -> Option<Execution> {
|
pub fn splice_settled_suffix(&self, prior: &Self, completed: &Execution) -> Option<Execution> {
|
||||||
@@ -99,7 +178,7 @@ impl EntryCheckpoint {
|
|||||||
}
|
}
|
||||||
let current = &self.executor;
|
let current = &self.executor;
|
||||||
let old = &prior.executor;
|
let old = &prior.executor;
|
||||||
if !same_kernel_continuation(current, old) {
|
if !same_kernel_continuation(current, old, None) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if current.sources.len() != old.sources.len()
|
if current.sources.len() != old.sources.len()
|
||||||
@@ -122,7 +201,10 @@ impl EntryCheckpoint {
|
|||||||
let mut sources = completed.sources.clone();
|
let mut sources = completed.sources.clone();
|
||||||
sources[self.entry] = current.sources[self.entry].clone();
|
sources[self.entry] = current.sources[self.entry].clone();
|
||||||
let tail = completed.events.get(old.events.len()..)?;
|
let tail = completed.events.get(old.events.len()..)?;
|
||||||
if completed.accounts_event_history && !current.equivalent_accounting_history(old) {
|
if completed.accounts_event_history
|
||||||
|
&& (!self.can_resume_accounting(false)
|
||||||
|
|| !current.equivalent_accounting_history(old, None))
|
||||||
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
// The joined events are published results. Resumption always starts
|
// The joined events are published results. Resumption always starts
|
||||||
@@ -155,7 +237,7 @@ impl EntryCheckpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn same_kernel_continuation(current: &Executor, prior: &Executor) -> bool {
|
fn same_kernel_continuation(current: &Executor, prior: &Executor, changed_child: Option<usize>) -> bool {
|
||||||
// Every field belongs to one of these checks. Adding kernel state requires
|
// Every field belongs to one of these checks. Adding kernel state requires
|
||||||
// an explicit decision here before a later execution may be skipped.
|
// an explicit decision here before a later execution may be skipped.
|
||||||
macro_rules! same_values {
|
macro_rules! same_values {
|
||||||
@@ -247,13 +329,12 @@ fn same_kernel_continuation(current: &Executor, prior: &Executor) -> bool {
|
|||||||
output_frame,
|
output_frame,
|
||||||
alignments,
|
alignments,
|
||||||
],
|
],
|
||||||
[cancellation, line_break_cache]
|
[cancellation, line_break_cache, deferred_accounting]
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let idle = |e: &Executor| {
|
let idle = |e: &Executor| {
|
||||||
e.output_frame.is_none()
|
e.output_frame.is_none()
|
||||||
&& e.paragraph.is_none()
|
|
||||||
&& e.box_frames.is_empty()
|
&& e.box_frames.is_empty()
|
||||||
&& e.math.is_empty()
|
&& e.math.is_empty()
|
||||||
&& e.display.is_none()
|
&& e.display.is_none()
|
||||||
@@ -264,7 +345,12 @@ fn same_kernel_continuation(current: &Executor, prior: &Executor) -> bool {
|
|||||||
&& e.pdf_images.is_empty()
|
&& e.pdf_images.is_empty()
|
||||||
&& !e.reads_event_history
|
&& !e.reads_event_history
|
||||||
};
|
};
|
||||||
if !idle(current) || !idle(prior) {
|
if !idle(current) || !idle(prior)
|
||||||
|
|| match changed_child {
|
||||||
|
Some(_) => current.paragraph != prior.paragraph,
|
||||||
|
None => current.paragraph.is_some() || prior.paragraph.is_some(),
|
||||||
|
}
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||||
@@ -289,5 +375,5 @@ fn same_kernel_continuation(current: &Executor, prior: &Executor) -> bool {
|
|||||||
.inputs
|
.inputs
|
||||||
.iter()
|
.iter()
|
||||||
.zip(&prior.inputs)
|
.zip(&prior.inputs)
|
||||||
.all(|(a, b)| a.same_at_shipout(b))
|
.all(|(a, b)| a.same_continuation(b, changed_child))
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,6 @@ impl Executor {
|
|||||||
let mut reads = BTreeSet::from([
|
let mut reads = BTreeSet::from([
|
||||||
Dependency::ParagraphMode,
|
Dependency::ParagraphMode,
|
||||||
Dependency::VerticalState,
|
Dependency::VerticalState,
|
||||||
Dependency::Parameter(Parameter::Pdfignoreddimen),
|
|
||||||
Dependency::PageState,
|
Dependency::PageState,
|
||||||
Dependency::FontResources,
|
Dependency::FontResources,
|
||||||
Dependency::EscapeChar,
|
Dependency::EscapeChar,
|
||||||
@@ -324,7 +323,7 @@ impl Executor {
|
|||||||
render(&mut text, &mut reads, &vertical_nodes(&vertical.nodes))?;
|
render(&mut text, &mut reads, &vertical_nodes(&vertical.nodes))?;
|
||||||
text.push_str(auxiliary_break);
|
text.push_str(auxiliary_break);
|
||||||
text.push_str("prevdepth ");
|
text.push_str("prevdepth ");
|
||||||
if vertical.prev_depth <= self.state.ignored_depth() {
|
if vertical.prev_depth <= -1000 * 65536 {
|
||||||
text.push_str("ignored");
|
text.push_str("ignored");
|
||||||
} else {
|
} else {
|
||||||
text.push_str(®isters::print_scaled(vertical.prev_depth));
|
text.push_str(®isters::print_scaled(vertical.prev_depth));
|
||||||
|
|||||||
@@ -240,7 +240,6 @@ impl Executor {
|
|||||||
math: std::mem::take(&mut self.math),
|
math: std::mem::take(&mut self.math),
|
||||||
display: self.display.take(),
|
display: self.display.take(),
|
||||||
});
|
});
|
||||||
self.vertical.prev_depth = self.read_ignored_depth();
|
|
||||||
self.inputs.push(InputFrame::Tokens {
|
self.inputs.push(InputFrame::Tokens {
|
||||||
tokens: InputTokens::Many(tokens.iter().cloned().map(InputToken::from).collect()),
|
tokens: InputTokens::Many(tokens.iter().cloned().map(InputToken::from).collect()),
|
||||||
cursor: 0,
|
cursor: 0,
|
||||||
@@ -304,7 +303,6 @@ impl Executor {
|
|||||||
self.display = frame.display;
|
self.display = frame.display;
|
||||||
let page = self.native_page.as_mut().unwrap();
|
let page = self.native_page.as_mut().unwrap();
|
||||||
page.output_active = false;
|
page.output_active = false;
|
||||||
page.insertions.penalties = 0;
|
|
||||||
page.resume_contributions(nodes);
|
page.resume_contributions(nodes);
|
||||||
page.requested = true;
|
page.requested = true;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
|||||||
@@ -19,10 +19,28 @@ impl Executor {
|
|||||||
self.stack_peaks.include(&self.stack_usage());
|
self.stack_peaks.include(&self.stack_usage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn verify_accounting(&mut self) -> Result<(), Error> {
|
||||||
|
if let Some(proof) = &self.deferred_accounting {
|
||||||
|
if !proof.verify() {
|
||||||
|
return self.fail("child continuation accounting differs");
|
||||||
|
}
|
||||||
|
self.deferred_accounting = None;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn check_accounting_replay(&self) -> Result<(), CheckpointReplayError> {
|
||||||
|
if self.deferred_accounting.as_ref().is_some_and(|proof| proof.verified.get() == Some(&false)) {
|
||||||
|
return Err(CheckpointReplayError::Accounting { steps: self.steps });
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn check_box_capacity(&mut self, shipping: Option<&NativeBox>) -> Result<(), Error> {
|
pub(super) fn check_box_capacity(&mut self, shipping: Option<&NativeBox>) -> Result<(), Error> {
|
||||||
if self.material_charge <= self.limits.tokens {
|
if self.material_charge <= self.limits.tokens {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
self.verify_accounting()?;
|
||||||
// Packing can move existing lists or replace an old register. Recount
|
// Packing can move existing lists or replace an old register. Recount
|
||||||
// actual storage here, counting each shared list allocation once.
|
// actual storage here, counting each shared list allocation once.
|
||||||
self.accounts_event_history = true;
|
self.accounts_event_history = true;
|
||||||
@@ -181,7 +199,7 @@ impl Executor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn equivalent_accounting_history(&self, old: &Self) -> bool {
|
pub(super) fn equivalent_accounting_history(&self, old: &Self, rebound: Option<usize>) -> bool {
|
||||||
// These containers may reintroduce previously retained allocations
|
// These containers may reintroduce previously retained allocations
|
||||||
// that are outside the accounting walk at this boundary.
|
// that are outside the accounting walk at this boundary.
|
||||||
let fully_visited = |engine: &Self| {
|
let fully_visited = |engine: &Self| {
|
||||||
@@ -192,13 +210,33 @@ impl Executor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Collector::for_capacity, Collector::default].into_iter().all(|collector| {
|
[Collector::for_capacity, Collector::default].into_iter().all(|new_collector| {
|
||||||
|
let collector = || {
|
||||||
|
let c = new_collector();
|
||||||
|
if rebound.is_some() {
|
||||||
|
// Child convergence already proved the live and saved
|
||||||
|
// macro identity relation, including active input frames.
|
||||||
|
c.with_verified_macro_aliases()
|
||||||
|
} else {
|
||||||
|
c
|
||||||
|
}
|
||||||
|
};
|
||||||
let mut history = collector();
|
let mut history = collector();
|
||||||
let mut old_history = collector();
|
let mut old_history = collector();
|
||||||
Self::collect_event_usage(self.events.iter(), &mut history);
|
Self::collect_event_usage(self.events.iter(), &mut history);
|
||||||
Self::collect_event_usage(old.events.iter(), &mut old_history);
|
Self::collect_event_usage(old.events.iter(), &mut old_history);
|
||||||
let live = self.collect_live_usage(None, None, collector().tracking_aliases());
|
let live = self.collect_live_usage(None, None, collector().tracking_aliases());
|
||||||
let old_live = old.collect_live_usage(None, None, collector().tracking_aliases());
|
let mut old_live = old.collect_live_usage(None, None, collector().tracking_aliases());
|
||||||
|
if let Some(child) = rebound {
|
||||||
|
// This live scanner and source slot are about to hold the
|
||||||
|
// new bytes. Compare the rest of the ownership and history.
|
||||||
|
let earlier = old.sources[child].data.len();
|
||||||
|
let current = self.sources[child].data.len();
|
||||||
|
old_live.usage.source_payload_bytes =
|
||||||
|
old_live.usage.source_payload_bytes - earlier + current;
|
||||||
|
old_live.usage.mouth_payload_bytes =
|
||||||
|
old_live.usage.mouth_payload_bytes - earlier + current;
|
||||||
|
}
|
||||||
live.has_equivalent_history(&old_live, &history, &old_history)
|
live.has_equivalent_history(&old_live, &history, &old_history)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -211,6 +249,7 @@ impl Executor {
|
|||||||
if self.read_parameter(Parameter::Tracingstats).width() <= 1 {
|
if self.read_parameter(Parameter::Tracingstats).width() <= 1 {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
self.verify_accounting()?;
|
||||||
self.reads.insert(Dependency::ResourceStatistics);
|
self.reads.insert(Dependency::ResourceStatistics);
|
||||||
let host = files
|
let host = files
|
||||||
.resource_usage()
|
.resource_usage()
|
||||||
@@ -225,6 +264,7 @@ impl Executor {
|
|||||||
let Some(before) = before else {
|
let Some(before) = before else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
self.verify_accounting()?;
|
||||||
let host = files
|
let host = files
|
||||||
.resource_usage()
|
.resource_usage()
|
||||||
.map_err(|e| self.error(e, self.current))?;
|
.map_err(|e| self.error(e, self.current))?;
|
||||||
@@ -254,6 +294,7 @@ impl Executor {
|
|||||||
if self.read_parameter(Parameter::Tracingstats).width() <= 0 {
|
if self.read_parameter(Parameter::Tracingstats).width() <= 0 {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
self.verify_accounting()?;
|
||||||
self.reads.insert(Dependency::ResourceStatistics);
|
self.reads.insert(Dependency::ResourceStatistics);
|
||||||
let host = files
|
let host = files
|
||||||
.resource_usage()
|
.resource_usage()
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ use std::{
|
|||||||
sync::{Arc, Mutex, OnceLock, Weak},
|
sync::{Arc, Mutex, OnceLock, Weak},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SCHEMA: u32 = 112;
|
const SCHEMA: u32 = 111;
|
||||||
const COMPATIBLE_SCHEMAS: [u32; 78] = [
|
const COMPATIBLE_SCHEMAS: [u32; 77] = [
|
||||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 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, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, SCHEMA,
|
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 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, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, SCHEMA,
|
||||||
];
|
];
|
||||||
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
@@ -247,9 +247,6 @@ impl FormatImage {
|
|||||||
if image.schema < 111 {
|
if image.schema < 111 {
|
||||||
image.state.install_pdf_font_tag_commands();
|
image.state.install_pdf_font_tag_commands();
|
||||||
}
|
}
|
||||||
if image.schema < 112 {
|
|
||||||
image.state.restore_legacy_pdf_parameters(&Parameter::PDF_LINE_DIMENSIONS);
|
|
||||||
}
|
|
||||||
let pdf_objects = image.state.pdf_objects.as_deref();
|
let pdf_objects = image.state.pdf_objects.as_deref();
|
||||||
let mut numbered_images = 0;
|
let mut numbered_images = 0;
|
||||||
for (index, saved) in image.pdf_images.iter().enumerate() {
|
for (index, saved) in image.pdf_images.iter().enumerate() {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pub(super) struct Component {
|
|||||||
pub origin: Span,
|
pub origin: Span,
|
||||||
pub source: PaintSource,
|
pub source: PaintSource,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub(super) struct Glyph {
|
pub(super) struct Glyph {
|
||||||
pub slot: u8,
|
pub slot: u8,
|
||||||
pub components: Vec<Component>,
|
pub components: Vec<Component>,
|
||||||
@@ -38,7 +38,7 @@ pub(super) struct Carry {
|
|||||||
left: bool,
|
left: bool,
|
||||||
right: bool,
|
right: bool,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
struct Right {
|
struct Right {
|
||||||
glyph: Glyph,
|
glyph: Glyph,
|
||||||
raw: bool,
|
raw: bool,
|
||||||
@@ -79,7 +79,7 @@ impl Right {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
pub(super) struct Machine {
|
pub(super) struct Machine {
|
||||||
started: bool,
|
started: bool,
|
||||||
left: Option<Glyph>,
|
left: Option<Glyph>,
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ pub use case::CaseCode;
|
|||||||
pub use context::{ContextFrame, ContextKind, InputContext};
|
pub use context::{ContextFrame, ContextKind, InputContext};
|
||||||
pub use device::{NativeShipout, ShipoutDevice, ShipoutSpecial};
|
pub use device::{NativeShipout, ShipoutDevice, ShipoutSpecial};
|
||||||
pub use diagnostics::{DiagnosticBox, DiagnosticNode, ShowBoxReport};
|
pub use diagnostics::{DiagnosticBox, DiagnosticNode, ShowBoxReport};
|
||||||
pub use engine::{CheckpointDecision, CheckpointSource, EntryCheckpoint, Executor, Limits};
|
pub use engine::{CheckpointDecision, CheckpointReplayError, CheckpointSource, EntryCheckpoint, Executor, Limits};
|
||||||
pub use font_catalog::{
|
pub use font_catalog::{
|
||||||
FontCatalog, FontCharacter, FontId, FontInstance, FontLimits, FontResource,
|
FontCatalog, FontCharacter, FontId, FontInstance, FontLimits, FontResource,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ pub(super) struct Mouth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Mouth {
|
impl Mouth {
|
||||||
pub(super) fn same_unread_input(&self, other: &Self) -> bool {
|
pub(super) fn same_unread_input(&self, other: &Self, compare_unread: bool) -> bool {
|
||||||
self.source == other.source
|
self.source == other.source
|
||||||
&& self.profile == other.profile
|
&& self.profile == other.profile
|
||||||
&& self.offset == other.offset
|
&& self.offset == other.offset
|
||||||
@@ -309,7 +309,7 @@ impl Mouth {
|
|||||||
&& self.line_number == other.line_number
|
&& self.line_number == other.line_number
|
||||||
&& self.xe == other.xe
|
&& self.xe == other.xe
|
||||||
&& self.invalid_utf8 == other.invalid_utf8
|
&& self.invalid_utf8 == other.invalid_utf8
|
||||||
&& self.data[self.offset..] == other.data[other.offset..]
|
&& (!compare_unread || self.data[self.offset..] == other.data[other.offset..])
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn physical_frontier(&self) -> Option<usize> {
|
pub(super) fn physical_frontier(&self) -> Option<usize> {
|
||||||
@@ -350,6 +350,11 @@ impl Mouth {
|
|||||||
debug_assert!(self.matches_loaded_prefix(&data));
|
debug_assert!(self.matches_loaded_prefix(&data));
|
||||||
self.data = Arc::new(data);
|
self.data = Arc::new(data);
|
||||||
}
|
}
|
||||||
|
pub(super) fn share_loaded_source(&mut self, current: &Self) {
|
||||||
|
debug_assert!(self.matches_loaded_prefix(¤t.data));
|
||||||
|
self.data = Arc::clone(¤t.data);
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn payload_bytes(&self) -> usize {
|
pub(super) fn payload_bytes(&self) -> usize {
|
||||||
self.data.len()
|
self.data.len()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ impl NativePageState {
|
|||||||
self.max_depth = state.parameter(Parameter::Maxdepth).width();
|
self.max_depth = state.parameter(Parameter::Maxdepth).width();
|
||||||
self.least = AWFUL;
|
self.least = AWFUL;
|
||||||
self.best = None;
|
self.best = None;
|
||||||
|
self.insertions.penalties = 0;
|
||||||
if state.parameter(Parameter::Tracingpages).width() > 0 {
|
if state.parameter(Parameter::Tracingpages).width() > 0 {
|
||||||
observations.push(PageObservation::Trace(PageTrace::Freeze {
|
observations.push(PageObservation::Trace(PageTrace::Freeze {
|
||||||
goal: self.dimensions[0],
|
goal: self.dimensions[0],
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ pub struct NativeParagraph {
|
|||||||
pub hyphen_min: (usize, usize),
|
pub hyphen_min: (usize, usize),
|
||||||
pub missing_glyphs: Vec<(FontId, u8, Span)>,
|
pub missing_glyphs: Vec<(FontId, u8, Span)>,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub(super) struct XeCharRun {
|
pub(super) struct XeCharRun {
|
||||||
pub previous: u16,
|
pub previous: u16,
|
||||||
pub last_ignored: bool,
|
pub last_ignored: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
pub(super) struct Builder {
|
pub(super) struct Builder {
|
||||||
pub initial_language: HyphenationLanguage,
|
pub initial_language: HyphenationLanguage,
|
||||||
pub current_language: HyphenationLanguage,
|
pub current_language: HyphenationLanguage,
|
||||||
@@ -149,13 +149,13 @@ pub(super) struct Builder {
|
|||||||
pub vertical_start: usize,
|
pub vertical_start: usize,
|
||||||
pub previous_lines: usize,
|
pub previous_lines: usize,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
struct FontRun {
|
struct FontRun {
|
||||||
font: std::sync::Arc<crate::native_font::NativeFont>,
|
font: std::sync::Arc<crate::native_font::NativeFont>,
|
||||||
machine: super::ligature::Machine,
|
machine: super::ligature::Machine,
|
||||||
hyphen_char: Option<char>,
|
hyphen_char: Option<char>,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
struct PendingOpenType {
|
struct PendingOpenType {
|
||||||
font: Arc<OpenTypeFont>,
|
font: Arc<OpenTypeFont>,
|
||||||
text: String,
|
text: String,
|
||||||
@@ -1535,16 +1535,6 @@ pub(super) fn finish(
|
|||||||
let directions = super::direction::has_directions(&b.nodes);
|
let directions = super::direction::has_directions(&b.nodes);
|
||||||
let mut direction_stack = Vec::new();
|
let mut direction_stack = Vec::new();
|
||||||
let widow_kind = LinePenaltyKind::for_widow_parameter(final_widow);
|
let widow_kind = LinePenaltyKind::for_widow_parameter(final_widow);
|
||||||
let ignored_depth = state.ignored_depth();
|
|
||||||
let pdftex = state.input_profile() != super::InputProfile::XeTeX;
|
|
||||||
let line_dimension = |p| {
|
|
||||||
let value = parameters[&p].width();
|
|
||||||
(pdftex && value != ignored_depth).then_some(i64::from(value))
|
|
||||||
};
|
|
||||||
let each_height = line_dimension(Parameter::Pdfeachlineheight);
|
|
||||||
let each_depth = line_dimension(Parameter::Pdfeachlinedepth);
|
|
||||||
let first_height = line_dimension(Parameter::Pdffirstlineheight).or(each_height);
|
|
||||||
let last_depth = line_dimension(Parameter::Pdflastlinedepth).or(each_depth);
|
|
||||||
for (i, (point, bad)) in path.iter().enumerate() {
|
for (i, (point, bad)) in path.iter().enumerate() {
|
||||||
let mut material = line_material(
|
let mut material = line_material(
|
||||||
&b.nodes,
|
&b.nodes,
|
||||||
@@ -1568,7 +1558,7 @@ pub(super) fn finish(
|
|||||||
// Keep a real breakpoint marker before the synthetic line closers.
|
// Keep a real breakpoint marker before the synthetic line closers.
|
||||||
super::direction::line(&mut material, &mut direction_stack);
|
super::direction::line(&mut material, &mut direction_stack);
|
||||||
}
|
}
|
||||||
let (line, mut line_box, adjustments, shrinking) = pack(
|
let (line, line_box, adjustments, shrinking) = pack(
|
||||||
&material,
|
&material,
|
||||||
¶meters,
|
¶meters,
|
||||||
dimensions,
|
dimensions,
|
||||||
@@ -1593,10 +1583,6 @@ pub(super) fn finish(
|
|||||||
pre_display_size =
|
pre_display_size =
|
||||||
pre_display_line_size(material, line_box.setting, line_box.shift, quad);
|
pre_display_line_size(material, line_box.setting, line_box.shift, quad);
|
||||||
}
|
}
|
||||||
let height = if i == 0 { first_height } else { each_height };
|
|
||||||
let depth = if i + 1 == path.len() { last_depth } else { each_depth };
|
|
||||||
line_box.height = height.unwrap_or(line_box.height);
|
|
||||||
line_box.depth = depth.unwrap_or(line_box.depth);
|
|
||||||
diagnostic_lines.push(super::diagnostics::box_view(&line_box));
|
diagnostic_lines.push(super::diagnostics::box_view(&line_box));
|
||||||
line_boxes.push(line_box);
|
line_boxes.push(line_box);
|
||||||
line_pre_adjustments.push(adjustments.pre);
|
line_pre_adjustments.push(adjustments.pre);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
//! Owned paragraph parameter meanings and TeX INITEX defaults.
|
//! Owned paragraph parameter meanings and TeX INITEX defaults.
|
||||||
use super::{Flex, Glue, RegisterKind, RegisterValue};
|
use super::{Flex, Glue, RegisterKind, RegisterValue};
|
||||||
|
|
||||||
pub(super) const IGNORE_DEPTH: i32 = -1000 * 65536;
|
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
|
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
|
||||||
)]
|
)]
|
||||||
@@ -150,11 +148,6 @@ pub enum Parameter {
|
|||||||
Ignoreprimitiveerror,
|
Ignoreprimitiveerror,
|
||||||
Lastlinefit,
|
Lastlinefit,
|
||||||
Savinghyphcodes,
|
Savinghyphcodes,
|
||||||
Pdfignoreddimen,
|
|
||||||
Pdfeachlineheight,
|
|
||||||
Pdfeachlinedepth,
|
|
||||||
Pdffirstlineheight,
|
|
||||||
Pdflastlinedepth,
|
|
||||||
}
|
}
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum ParameterValue {
|
pub enum ParameterValue {
|
||||||
@@ -162,13 +155,6 @@ pub enum ParameterValue {
|
|||||||
Quantity(RegisterValue),
|
Quantity(RegisterValue),
|
||||||
}
|
}
|
||||||
impl Parameter {
|
impl Parameter {
|
||||||
pub(super) const PDF_LINE_DIMENSIONS: [Self; 5] = [
|
|
||||||
Self::Pdfignoreddimen,
|
|
||||||
Self::Pdfeachlineheight,
|
|
||||||
Self::Pdfeachlinedepth,
|
|
||||||
Self::Pdffirstlineheight,
|
|
||||||
Self::Pdflastlinedepth,
|
|
||||||
];
|
|
||||||
pub(super) fn pdftex_only(self) -> bool {
|
pub(super) fn pdftex_only(self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
self,
|
self,
|
||||||
@@ -205,11 +191,6 @@ impl Parameter {
|
|||||||
| Self::Pdfprependkern
|
| Self::Pdfprependkern
|
||||||
| Self::Pdfappendkern
|
| Self::Pdfappendkern
|
||||||
| Self::Pdfadjustspacing
|
| Self::Pdfadjustspacing
|
||||||
| Self::Pdfignoreddimen
|
|
||||||
| Self::Pdfeachlineheight
|
|
||||||
| Self::Pdfeachlinedepth
|
|
||||||
| Self::Pdffirstlineheight
|
|
||||||
| Self::Pdflastlinedepth
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,11 +352,6 @@ impl Parameter {
|
|||||||
Self::XeTeXinputnormalization,
|
Self::XeTeXinputnormalization,
|
||||||
Self::Lastlinefit,
|
Self::Lastlinefit,
|
||||||
Self::Savinghyphcodes,
|
Self::Savinghyphcodes,
|
||||||
Self::Pdfignoreddimen,
|
|
||||||
Self::Pdfeachlineheight,
|
|
||||||
Self::Pdfeachlinedepth,
|
|
||||||
Self::Pdffirstlineheight,
|
|
||||||
Self::Pdflastlinedepth,
|
|
||||||
];
|
];
|
||||||
pub fn name(self) -> String {
|
pub fn name(self) -> String {
|
||||||
match self {
|
match self {
|
||||||
@@ -405,11 +381,6 @@ impl Parameter {
|
|||||||
| Self::Pdflinkmargin
|
| Self::Pdflinkmargin
|
||||||
| Self::Pdfdestmargin
|
| Self::Pdfdestmargin
|
||||||
| Self::Pdfthreadmargin
|
| Self::Pdfthreadmargin
|
||||||
| Self::Pdfignoreddimen
|
|
||||||
| Self::Pdfeachlineheight
|
|
||||||
| Self::Pdfeachlinedepth
|
|
||||||
| Self::Pdffirstlineheight
|
|
||||||
| Self::Pdflastlinedepth
|
|
||||||
| Self::Delimitershortfall
|
| Self::Delimitershortfall
|
||||||
| Self::Predisplaysize
|
| Self::Predisplaysize
|
||||||
| Self::Displaywidth
|
| Self::Displaywidth
|
||||||
@@ -451,10 +422,10 @@ impl Parameter {
|
|||||||
pub fn initial(self) -> ParameterValue {
|
pub fn initial(self) -> ParameterValue {
|
||||||
if let Some(kind) = self.kind() {
|
if let Some(kind) = self.kind() {
|
||||||
ParameterValue::Quantity(if kind == RegisterKind::Dimen {
|
ParameterValue::Quantity(if kind == RegisterKind::Dimen {
|
||||||
RegisterValue::Dimension(match self {
|
RegisterValue::Dimension(if matches!(self, Self::Pdfhorigin | Self::Pdfvorigin) {
|
||||||
Self::Pdfhorigin | Self::Pdfvorigin => 4_736_287,
|
4_736_287
|
||||||
p if Self::PDF_LINE_DIMENSIONS.contains(&p) => IGNORE_DEPTH,
|
} else {
|
||||||
_ => 0,
|
0
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
RegisterValue::Glue(Glue::default())
|
RegisterValue::Glue(Glue::default())
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ impl RevisionJob {
|
|||||||
line_break_cache: Arc<LineBreakCache>,
|
line_break_cache: Arc<LineBreakCache>,
|
||||||
select: impl FnMut(super::CheckpointSource<'_>, usize) -> Option<S>,
|
select: impl FnMut(super::CheckpointSource<'_>, usize) -> Option<S>,
|
||||||
capture: impl FnMut(S, EntryCheckpoint, &mut F) -> super::CheckpointDecision,
|
capture: impl FnMut(S, EntryCheckpoint, &mut F) -> super::CheckpointDecision,
|
||||||
) -> Result<Option<Result<Arc<RevisionExecution>, RevisionFailure>>, String> {
|
) -> Result<Option<Result<Arc<RevisionExecution>, RevisionFailure>>, super::CheckpointReplayError> {
|
||||||
let previous = self.session.latest();
|
let previous = self.session.latest();
|
||||||
let executed = checkpoint.resume_deciding_suffix(
|
let executed = checkpoint.resume_deciding_suffix(
|
||||||
source, nested, files, self.cancellation.clone(), line_break_cache,
|
source, nested, files, self.cancellation.clone(), line_break_cache,
|
||||||
|
|||||||
@@ -1536,6 +1536,65 @@ impl Default for State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
|
// Called after value equality. e-TeX can also observe whether two live
|
||||||
|
// or restorable bindings share one macro, even with tracingstats disabled.
|
||||||
|
pub(super) fn same_macro_aliases<'a>(
|
||||||
|
&self,
|
||||||
|
other: &Self,
|
||||||
|
input_macros: impl Iterator<Item = (&'a Arc<Macro>, &'a Arc<Macro>)>,
|
||||||
|
) -> bool {
|
||||||
|
let mut forward = std::collections::HashMap::new();
|
||||||
|
let mut reverse = std::collections::HashMap::new();
|
||||||
|
let mut fixed = Vec::new();
|
||||||
|
let mut match_alias = |current: &Arc<Macro>, old: &Arc<Macro>| {
|
||||||
|
let current = Arc::as_ptr(current);
|
||||||
|
let old = Arc::as_ptr(old);
|
||||||
|
if current == old {
|
||||||
|
fixed.push(current);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
*forward.entry(current).or_insert(old) == old
|
||||||
|
&& *reverse.entry(old).or_insert(current) == current
|
||||||
|
};
|
||||||
|
for (current, old) in self.commands.shards.iter().zip(&other.commands.shards) {
|
||||||
|
if Arc::ptr_eq(current, old) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (name, meaning) in current.iter() {
|
||||||
|
let Meaning::Macro(current) = meaning else { continue; };
|
||||||
|
let Some(Meaning::Macro(old)) = old.get(name) else { return false; };
|
||||||
|
if !match_alias(current, old) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (current, old) in self.groups.iter().zip(&other.groups) {
|
||||||
|
for (current, old) in current.saved.values().zip(old.saved.values()) {
|
||||||
|
if let (Saved::Command(Some(Meaning::Macro(current))),
|
||||||
|
Saved::Command(Some(Meaning::Macro(old)))) = (current, old)
|
||||||
|
&& !match_alias(current, old)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !input_macros.into_iter().all(|(current, old)| match_alias(current, old)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if forward.is_empty() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let is_fixed = |p| !forward.contains_key(&p) && !reverse.contains_key(&p);
|
||||||
|
fixed.into_iter().all(is_fixed)
|
||||||
|
&& self.commands.shards.iter().zip(&other.commands.shards)
|
||||||
|
.filter(|(current, old)| Arc::ptr_eq(current, old))
|
||||||
|
.flat_map(|(shard, _)| shard.values())
|
||||||
|
.all(|meaning| match meaning {
|
||||||
|
Meaning::Macro(body) => is_fixed(Arc::as_ptr(body)),
|
||||||
|
_ => true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn collect_statistics(&self, c: &mut super::statistics::Collector) {
|
pub(super) fn collect_statistics(&self, c: &mut super::statistics::Collector) {
|
||||||
use super::statistics::Ownership::Active;
|
use super::statistics::Ownership::Active;
|
||||||
for b in self.boxes.values() {
|
for b in self.boxes.values() {
|
||||||
@@ -1549,6 +1608,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if !c.macro_aliases_verified() {
|
||||||
c.usage.state.command_entries = self.commands.len();
|
c.usage.state.command_entries = self.commands.len();
|
||||||
let track_aliases = c.tracks_aliases();
|
let track_aliases = c.tracks_aliases();
|
||||||
let mut visit_command = |name: &CommandName, meaning: &Meaning| {
|
let mut visit_command = |name: &CommandName, meaning: &Meaning| {
|
||||||
@@ -1569,6 +1629,7 @@ impl State {
|
|||||||
visit_command(name, meaning);
|
visit_command(name, meaning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
c.usage.state.token_registers = self.toks.len() + self.xe_inter_char_tokens.len();
|
c.usage.state.token_registers = self.toks.len() + self.xe_inter_char_tokens.len();
|
||||||
c.usage.state.parameter_entries =
|
c.usage.state.parameter_entries =
|
||||||
self.parameters.len() + self.token_parameters.len() + self.job_parameters.len();
|
self.parameters.len() + self.token_parameters.len() + self.job_parameters.len();
|
||||||
@@ -1645,14 +1706,6 @@ impl State {
|
|||||||
self.assign_parameter(Parameter::Pdfoutput, ParameterValue::Integer(1), true);
|
self.assign_parameter(Parameter::Pdfoutput, ParameterValue::Integer(1), true);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub(super) fn ignored_depth(&self) -> i32 {
|
|
||||||
if self.input_profile() == super::InputProfile::XeTeX {
|
|
||||||
super::parameters::IGNORE_DEPTH
|
|
||||||
} else {
|
|
||||||
self.parameter(Parameter::Pdfignoreddimen).width()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parameter(&self, parameter: Parameter) -> ParameterValue {
|
pub fn parameter(&self, parameter: Parameter) -> ParameterValue {
|
||||||
self.parameters
|
self.parameters
|
||||||
.get(¶meter)
|
.get(¶meter)
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ pub(super) struct Collector {
|
|||||||
token_lists: BTreeSet<(usize, usize)>,
|
token_lists: BTreeSet<(usize, usize)>,
|
||||||
shared_lists: Option<BTreeSet<usize>>,
|
shared_lists: Option<BTreeSet<usize>>,
|
||||||
aliases: Option<AliasVisits>,
|
aliases: Option<AliasVisits>,
|
||||||
|
verified_macro_aliases: bool,
|
||||||
}
|
}
|
||||||
impl Collector {
|
impl Collector {
|
||||||
pub fn for_capacity() -> Self {
|
pub fn for_capacity() -> Self {
|
||||||
@@ -192,6 +193,15 @@ impl Collector {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn with_verified_macro_aliases(mut self) -> Self {
|
||||||
|
self.verified_macro_aliases = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn macro_aliases_verified(&self) -> bool {
|
||||||
|
self.verified_macro_aliases
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn tracks_aliases(&self) -> bool {
|
pub(super) fn tracks_aliases(&self) -> bool {
|
||||||
self.aliases.is_some()
|
self.aliases.is_some()
|
||||||
}
|
}
|
||||||
@@ -239,6 +249,9 @@ impl Collector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn macro_body(&mut self, m: &Arc<Macro>) {
|
pub fn macro_body(&mut self, m: &Arc<Macro>) {
|
||||||
|
if self.verified_macro_aliases {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let address = Arc::as_ptr(m) as usize;
|
let address = Arc::as_ptr(m) as usize;
|
||||||
self.tracks_allocation(Allocation::Macro(address));
|
self.tracks_allocation(Allocation::Macro(address));
|
||||||
if self.macros.insert(address) {
|
if self.macros.insert(address) {
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ impl DisplayList {
|
|||||||
write!(
|
write!(
|
||||||
out,
|
out,
|
||||||
"<g data-font=\"{}\" data-glyph=\"{}\" data-slot=\"{slot}\" aria-label=\"{}\"><path d=\"{}\" transform=\"",
|
"<g data-font=\"{}\" data-glyph=\"{}\" data-slot=\"{slot}\" aria-label=\"{}\"><path d=\"{}\" transform=\"",
|
||||||
escape_attribute(font), escape_attribute(glyph), escape_attribute(&label), path,
|
escape(font), escape(glyph), escape(&label), path,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
if let Some([vx2, vy]) = vertical_origin {
|
if let Some([vx2, vy]) = vertical_origin {
|
||||||
let vx = f64::from(vx2) / 2.0;
|
let vx = f64::from(vx2) / 2.0;
|
||||||
@@ -680,7 +680,7 @@ impl DisplayList {
|
|||||||
write!(
|
write!(
|
||||||
out,
|
out,
|
||||||
"<g data-font=\"{}\" data-glyph=\"{glyph}\" aria-label=\"{}\"><path d=\"{path}\" transform=\"translate({x:.5} {y:.5})",
|
"<g data-font=\"{}\" data-glyph=\"{glyph}\" aria-label=\"{}\"><path d=\"{path}\" transform=\"translate({x:.5} {y:.5})",
|
||||||
escape_attribute(&font.name), escape_attribute(text),
|
escape(&font.name), escape(text),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
if transform.is_none() {
|
if transform.is_none() {
|
||||||
if let Some([a, b, c, d, e, f]) = vertical {
|
if let Some([a, b, c, d, e, f]) = vertical {
|
||||||
@@ -733,7 +733,7 @@ impl DisplayList {
|
|||||||
let scale = *size as f64 / 65_536_000.0;
|
let scale = *size as f64 / 65_536_000.0;
|
||||||
out.push_str(&format!(
|
out.push_str(&format!(
|
||||||
"<g data-font=\"{}\" data-slot=\"{slot}\" aria-label=\"{}\"><use href=\"#math-{}-{slot}\" transform=\"translate({x:.5} {y:.5}) scale({scale:.8} -{scale:.8})\" fill=\"#{:02x}{:02x}{:02x}\"{fill_opacity}/><text x=\"{x:.5}\" y=\"{y:.5}\" opacity=\"0\" aria-hidden=\"true\">{}</text></g>\n",
|
"<g data-font=\"{}\" data-slot=\"{slot}\" aria-label=\"{}\"><use href=\"#math-{}-{slot}\" transform=\"translate({x:.5} {y:.5}) scale({scale:.8} -{scale:.8})\" fill=\"#{:02x}{:02x}{:02x}\"{fill_opacity}/><text x=\"{x:.5}\" y=\"{y:.5}\" opacity=\"0\" aria-hidden=\"true\">{}</text></g>\n",
|
||||||
escape_attribute(face.name()), escape_attribute(&character.to_string()), face.0,
|
face.name(), escape(&character.to_string()), face.0,
|
||||||
fill[0], fill[1], fill[2], escape(&character.to_string())
|
fill[0], fill[1], fill[2], escape(&character.to_string())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -1083,15 +1083,6 @@ fn base64(data: &[u8]) -> String {
|
|||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
fn escape_attribute(text: &str) -> String {
|
|
||||||
let escaped = escape(text);
|
|
||||||
if text.contains('"') {
|
|
||||||
escaped.replace('"', """)
|
|
||||||
} else {
|
|
||||||
escaped
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn escape(text: &str) -> String {
|
fn escape(text: &str) -> String {
|
||||||
text.replace('&', "&")
|
text.replace('&', "&")
|
||||||
.replace('<', "<")
|
.replace('<', "<")
|
||||||
|
|||||||
@@ -332,45 +332,6 @@ fn output_groups_can_wrap_drop_and_reinsert_real_box255_material() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn insertion_penalties_survive_page_freeze_and_clear_before_aftergroup() {
|
|
||||||
let output = r"\showbox255\shipout\box255\insertpenalties=19\aftergroup\AfterOutput";
|
|
||||||
let body = format!(
|
|
||||||
r"\def\AfterOutput{{{}}}
|
|
||||||
\count32=1000 \dimen32=20pt \skip32=0pt \insertpenalties=7
|
|
||||||
\hbox{{A}}{}
|
|
||||||
\insert32{{\hbox{{Note}}}}\penalty-10000
|
|
||||||
\hbox{{B}}\penalty-10000",
|
|
||||||
observe(r"return=\the\insertpenalties"),
|
|
||||||
observe(r"frozen=\the\insertpenalties"),
|
|
||||||
);
|
|
||||||
compare(&body, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn pdftex_line_box_dimensions_drive_vertical_glue_and_page_geometry() {
|
|
||||||
let body = format!(
|
|
||||||
r"\vsize=55pt\hsize=45pt\baselineskip=14pt\lineskiplimit=0pt\lineskip=2pt
|
|
||||||
\pdfignoreddimen=-21pt
|
|
||||||
\pdfeachlineheight=8pt\pdfeachlinedepth=2pt
|
|
||||||
\pdffirstlineheight=13pt\pdflastlinedepth=6pt
|
|
||||||
\setbox0=\vbox{{{}
|
|
||||||
\noindent First\hfil\penalty-10000 Middle\hfil\penalty-10000 Last\par
|
|
||||||
}}
|
|
||||||
\unvbox0\penalty-10000
|
|
||||||
\pdffirstlineheight=\pdfignoreddimen\pdflastlinedepth=\pdfignoreddimen
|
|
||||||
\hrule height1pt {}
|
|
||||||
\noindent Additional line\par
|
|
||||||
\penalty-10000",
|
|
||||||
observe(r"nested=\the\prevdepth"),
|
|
||||||
observe(r"after-rule=\the\prevdepth"),
|
|
||||||
);
|
|
||||||
compare(
|
|
||||||
&body,
|
|
||||||
&format!(r"{}\showbox255\shipout\box255", observe(r"output=\the\prevdepth")),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn actual_page_marks_carry_by_output_attempt_and_remain_separate_from_split_marks() {
|
fn actual_page_marks_carry_by_output_attempt_and_remain_separate_from_split_marks() {
|
||||||
let mut jobs = 0;
|
let mut jobs = 0;
|
||||||
|
|||||||
@@ -6,31 +6,11 @@ use texrra_tex_core::math::{MathAtom, parse_math};
|
|||||||
use texrra_tex_core::math_font::MathFontId;
|
use texrra_tex_core::math_font::MathFontId;
|
||||||
use texrra_tex_core::paragraph::{HorizontalItem, InlineSegment, ParagraphFont, ParagraphStyle};
|
use texrra_tex_core::paragraph::{HorizontalItem, InlineSegment, ParagraphFont, ParagraphStyle};
|
||||||
use texrra_tex_core::pdf::{PageOrigin, display_lists_to_pdf_with_cm_type1};
|
use texrra_tex_core::pdf::{PageOrigin, display_lists_to_pdf_with_cm_type1};
|
||||||
use texrra_tex_core::render::{DisplayItem, DisplayList};
|
use texrra_tex_core::render::DisplayItem;
|
||||||
use texrra_tex_core::{Document, Engine, Unit, VerticalItem};
|
use texrra_tex_core::{Document, Engine, Unit, VerticalItem};
|
||||||
|
|
||||||
const PT: i64 = 65_536;
|
const PT: i64 = 65_536;
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn svg_glyph_labels_escape_attribute_quotes() {
|
|
||||||
let display = DisplayList {
|
|
||||||
width: 12 * PT,
|
|
||||||
height: 12 * PT,
|
|
||||||
items: vec![DisplayItem::MathGlyph {
|
|
||||||
x: 0,
|
|
||||||
y: 6 * PT,
|
|
||||||
size: 10 * PT,
|
|
||||||
character: '"',
|
|
||||||
face: MathFontId(0),
|
|
||||||
slot: b'"',
|
|
||||||
}],
|
|
||||||
..DisplayList::default()
|
|
||||||
};
|
|
||||||
let svg = display.try_to_svg().unwrap();
|
|
||||||
assert!(svg.contains(r#"aria-label="""><use"#));
|
|
||||||
assert!(svg.contains(r#"aria-hidden="true">"</text>"#));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn structural_display_edits_replay_the_preceding_paragraph_dependency() {
|
fn structural_display_edits_replay_the_preceding_paragraph_dependency() {
|
||||||
let style = ParagraphStyle {
|
let style = ParagraphStyle {
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
# Route-D 本地 Beta
|
|
||||||
|
|
||||||
本地编辑器和命令行使用同一原生编译内核。准备时使用机器上已有的
|
|
||||||
TeX Live、字体和宏包。生成的目录包含两个程序、原生格式、资源记录
|
|
||||||
和 A4 多文件样例。格式沿用本机实际资源路径。
|
|
||||||
|
|
||||||
## 准备与启动
|
|
||||||
|
|
||||||
在安装了 Rust、Python 3.11 或更高版本与 TeX Live 的环境中,从仓库根目录运行。
|
|
||||||
目前这套流程已在 Fedora WSL 验证。
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo build --locked --release --bin texrra --example native_editor
|
|
||||||
python3 scripts/native-beta.py prepare target/local-beta
|
|
||||||
python3 target/local-beta/native-beta.py open
|
|
||||||
```
|
|
||||||
|
|
||||||
脚本调用 Route-D 执行 TeX Live 的原样 pdflatex.ini。首次准备会执行格式初始化。
|
|
||||||
编辑器启动后会在终端显示本地网址。打开该网址即可切换样例的主文件和子文件,
|
|
||||||
查看页面并下载 PDF。
|
|
||||||
|
|
||||||
准备 XeLaTeX 格式时加 `--input-profile xetex`。用 `--texmf-root` 指定额外
|
|
||||||
宏包或字体所在的 TeX 树时,按查找顺序列出本机使用的全部树。也可以成对给出
|
|
||||||
`--format-image` 和 `--format-resources`,使用在相同环境生成的格式与资源清单。
|
|
||||||
准备过程把实际资源搜索配置写进 `bundle.json`,供编辑器与命令行共用。
|
|
||||||
|
|
||||||
## 打开自己的项目
|
|
||||||
|
|
||||||
```sh
|
|
||||||
python3 target/local-beta/native-beta.py open /path/to/main.tex \
|
|
||||||
--file chapter.tex --file figures/plot.pdf
|
|
||||||
python3 target/local-beta/native-beta.py compile /path/to/main.tex /path/to/output.pdf
|
|
||||||
```
|
|
||||||
|
|
||||||
`--file` 接收相对于主文件目录的路径,可列出子文件及实际使用的图像等资源。
|
|
||||||
编辑器在试用目录中创建工作副本。命令行按项目实际读写作业文件。
|
|
||||||
需要 BibTeX 的项目可在辅助文件生成后运行 BibTeX,再继续 LaTeX 编译到引用收敛。
|
|
||||||
|
|
||||||
## 使用项目的 Web 界面
|
|
||||||
|
|
||||||
将 texrra-web 放在引擎仓库旁边。启动或重开时指定 Web 目录。
|
|
||||||
|
|
||||||
~~~sh
|
|
||||||
python3 target/local-beta/native-beta.py open --web-dir ../texrra-web
|
|
||||||
python3 target/local-beta/native-beta.py resume /path/to/saved-project --web-dir ../texrra-web
|
|
||||||
~~~
|
|
||||||
|
|
||||||
该入口显示 Web 工作台的文件栏、编辑区和预览区。编辑、局部预览、
|
|
||||||
源码保存及下载 PDF 都使用原生 Beta 会话。每次启动打开一个由命令行
|
|
||||||
指定的项目。现有 Web 的项目列表和 ZIP 导入仍在原 serve 入口。
|
|
||||||
启动指令中的其他参数和保存目录格式与上文相同。
|
|
||||||
|
|
||||||
## 保存和重新打开
|
|
||||||
|
|
||||||
点击「保存源文件」将当前编辑与已声明的项目资源一起写入一个新目录。
|
|
||||||
目录路径显示在编辑器中。里面的 sources 子目录包含可单独使用的项目文件,
|
|
||||||
预览的 PDF 可通过「下载 PDF」另行取得。使用原 Beta 包打开保存目录。
|
|
||||||
|
|
||||||
~~~sh
|
|
||||||
python3 target/local-beta/native-beta.py resume /path/to/texrra-sources-directory
|
|
||||||
~~~
|
|
||||||
|
|
||||||
有编译错误的草稿也可以保存。重开目前需要通过首次编译,若草稿仍有错误,
|
|
||||||
可先在保存目录的 sources 中修正源文件。每次保存都会得到独立的一份。
|
|
||||||
|
|
||||||
## 已对照的项目
|
|
||||||
|
|
||||||
| 原样项目 | 编译模式 | 收敛页数 |
|
|
||||||
| --- | --- | ---: |
|
|
||||||
| 仓库 arXiv 样例 | pdfLaTeX | 3 |
|
|
||||||
| PLOS ONE | pdfLaTeX | 5 |
|
|
||||||
| Elsevier CAS 双栏 | pdfLaTeX | 6 |
|
|
||||||
| IEEE 会议 | pdfLaTeX | 1 |
|
|
||||||
| NeurIPS 2025 | XeLaTeX | 12 |
|
|
||||||
|
|
||||||
同一内核构建的实际参考对照见 [阶段记录](P2_M1_PROGRESS.md)。
|
|
||||||
样例的上游来源和资源版本见 [出版模板矩阵](PUBLISHER_TEMPLATE_MATRIX.md)。
|
|
||||||
更广的兼容性与正式实时性能按 [产品总目标](NATIVE_PRODUCT_GOAL.md) 继续验收。
|
|
||||||
@@ -2,26 +2,6 @@
|
|||||||
|
|
||||||
本文件记录用户重申的最终目标,是短期 goal、实现优先级和验收标准的上位约束。
|
本文件记录用户重申的最终目标,是短期 goal、实现优先级和验收标准的上位约束。
|
||||||
|
|
||||||
## Beta 优先交付
|
|
||||||
|
|
||||||
先交付可试用的 Route-D 本地编辑器和原生 CLI。试用范围列明已实际对照的
|
|
||||||
文档类型、编译模式和资源配置。共享库、CLI 与编辑器使用同一编译结果。
|
|
||||||
选择一个构建和一组固定资源,提供启动方式、样例项目及已知差异。
|
|
||||||
|
|
||||||
- 首批项目采用既有原样 arXiv、PLOS ONE、Elsevier CAS 双栏、IEEE 会议和
|
|
||||||
NeurIPS 2025。复用已有参考产物,在发布候选上核对能打开和导出、关键页布局
|
|
||||||
及引用或文献流程。Beta 范围按实际通过的项目公布。
|
|
||||||
- 用原样多文件项目在编辑器核对首次预览、正文和子文件改动、连续输入、错误
|
|
||||||
诊断、恢复及 PDF 下载。保留上次完整发布并核对关键编辑与独立全量一致。
|
|
||||||
多页样例检查受影响的页面确实更新。
|
|
||||||
- 记录该构建在实际试用机器上的首次预览与典型编辑到页面可见的耗时,随 Beta
|
|
||||||
公布测试范围及已知限制。100 ms、分规模项目的正式采样、完整出版模板矩阵
|
|
||||||
与 W0–W7 全量验收属于正式版的退出条件。
|
|
||||||
|
|
||||||
首项工作是把现有原生编辑器、匹配的格式与资源和代表样例整理成可重复运行的
|
|
||||||
本地试用入口。按试用项目遇到的实际编译阻塞和可见时延排定后续功能。Beta 之后
|
|
||||||
继续扩大兼容性和性能覆盖,并按 P0–P5 完成正式版验收及产品切换。
|
|
||||||
|
|
||||||
## 2026-11-29 按真实项目推进功能批次
|
## 2026-11-29 按真实项目推进功能批次
|
||||||
|
|
||||||
每批解决一个能影响现有项目迁移或实时编辑的共用问题,并提交可运行的结果。
|
每批解决一个能影响现有项目迁移或实时编辑的共用问题,并提交可运行的结果。
|
||||||
|
|||||||
@@ -18,195 +18,6 @@
|
|||||||
| W6 会话 | 实施中 | 共享库/CLI 与当前原生文字/数学/规则来源进入公共结果;真实 A4 副本九类/27 revision 与独立干净作业页面/PDF/aux/映射一致,新增数学场景独立参考通过;详细失败/捕获重放及宿主/离线/CLI观察已通过;原子项目版本/已知生成初态及TeX流记录已接通;原样 12 页 NeurIPS 的中部编辑与恢复已验证前后缀复用、仅更新一页,且与独立全量一致。全部副作用/交叉编辑、旧来源与正式性能门禁仍待闭合 |
|
| W6 会话 | 实施中 | 共享库/CLI 与当前原生文字/数学/规则来源进入公共结果;真实 A4 副本九类/27 revision 与独立干净作业页面/PDF/aux/映射一致,新增数学场景独立参考通过;详细失败/捕获重放及宿主/离线/CLI观察已通过;原子项目版本/已知生成初态及TeX流记录已接通;原样 12 页 NeurIPS 的中部编辑与恢复已验证前后缀复用、仅更新一页,且与独立全量一致。全部副作用/交叉编辑、旧来源与正式性能门禁仍待闭合 |
|
||||||
| W7 总验收 | 未满足 | 原有和新增测试、原样项目、格式与会话门禁全部通过才能结项 |
|
| W7 总验收 | 未满足 | 原有和新增测试、原样项目、格式与会话门禁全部通过才能结项 |
|
||||||
|
|
||||||
## 2026-11-29 原生 Beta 接入 texrra-web 工作台
|
|
||||||
|
|
||||||
本地启动器的 --web-dir 接入现有 texrra-web 的 HTML、样式和图标。
|
|
||||||
原生会话脚本连接同一工作台的文件栏、编辑、报错、局部页面和 PDF
|
|
||||||
下载,支持保存源码副本及快捷键。该入口一次打开一个指定项目。
|
|
||||||
既有项目列表与 ZIP 导入的迁移属于后续集成。
|
|
||||||
|
|
||||||
固定 Web 仓库 e14b7aa 及 A4 原样多文件输入。在 Edge 验证工作台
|
|
||||||
打开、子文件切换、修改、保存、错误和恢复。修改后只更新第一页,
|
|
||||||
来源表记录本轮子文件字节。错版继续提供上次 PDF,恢复相同文本
|
|
||||||
沿用已显示页。下载 PDF 及辅助文件与保存副本的独立 CLI 两轮收敛
|
|
||||||
结果逐字节一致。保留真实浏览器截图及 HTML、样式和图标身份。
|
|
||||||
|
|
||||||
本机试用包位于 target/native-beta-web/beta-pdftex/。证据目录
|
|
||||||
target/native-beta-web/ 的 SHA256SUMS 指纹为
|
|
||||||
023b5d857af62da963b7d9b2e51157534c4f14f0c256dbf81d207923bc7d4bfe。
|
|
||||||
[Web 启动方式](NATIVE_BETA.md#使用项目的-web-界面)
|
|
||||||
|
|
||||||
## 2026-11-29 Beta 源码保存和恢复
|
|
||||||
|
|
||||||
编辑器保存时将当前浏览器缓冲与已声明的输入资源一并写入一个
|
|
||||||
源码副本。先完成全部文件和恢复清单,再发布新目录。保存与编译
|
|
||||||
各自处理,已有输出继续按编译版本发布。resume 读取保存目录的
|
|
||||||
入口和实际相对路径,建立新的编译工作目录。
|
|
||||||
|
|
||||||
用原样 A4 主文件和子文件在 Edge 验证。在同一次操作中修改两个
|
|
||||||
文件并保存,随后收到更新的预览。额外声明的嵌套 PDF 资源按实际
|
|
||||||
字节保存。引入未知命令的草稿可另存,错误期间仍可下载上次 PDF。
|
|
||||||
两次源码副本保持独立。已验证旧版本、未知文件和非 JSON 请求均被
|
|
||||||
拒绝,未创建额外副本。
|
|
||||||
|
|
||||||
重新启动有效副本后,浏览器缓冲、PDF 及辅助文件与独立 CLI 两轮
|
|
||||||
收敛作业一致。测试输入文件指纹保持。错误草稿当前重开仍受首次
|
|
||||||
编译限制,失败和保存下来的源文件均保留。下一批从错误草稿可打开
|
|
||||||
的资源准备路径及原样多页项目的启动耗时继续推进。
|
|
||||||
|
|
||||||
本机包在 target/native-beta-save/beta-pdftex/。证据目录
|
|
||||||
target/native-beta-save/ 的 SHA256SUMS 指纹为
|
|
||||||
46d0ba4d0fd0afe15a3dad8f19915a7ef3048c3964cae240611fc60b05053c4c。
|
|
||||||
[Beta 使用指南](NATIVE_BETA.md#保存和重新打开)
|
|
||||||
|
|
||||||
## 2026-11-29 本地 Beta 启动与五份原样模板
|
|
||||||
|
|
||||||
本地启动脚本准备同一构建的原生 CLI、编辑器、实际格式与资源配置。
|
|
||||||
Fedora WSL 上实际执行原样 pdflatex.ini 生成格式,并用该格式打开
|
|
||||||
A4 多文件。编辑器 PDF 与独立命令行从空 aux 收敛的 PDF 逐字节相同。
|
|
||||||
两个 profile 的本地包都走通启动。[使用指南](NATIVE_BETA.md)
|
|
||||||
|
|
||||||
原样 arXiv、PLOS ONE、Elsevier CAS 双栏、IEEE 会议和 XeLaTeX
|
|
||||||
NeurIPS 2025 合计 27 页、10,843 个词框。词序、词框和 144 DPI
|
|
||||||
灰度光栅逐页与冻结参考一致。各轮 aux 及实际流程生成的 bbl 或 out
|
|
||||||
逐字节一致。arXiv 首轮对照的首页含不同的编译日期。保持源文件与
|
|
||||||
格式,明确使用冻结参考的 2026-11-20 日期复验后首页一致。
|
|
||||||
保留初次差异。发布构建再次运行各项目的收敛作业,源输入和已核对的
|
|
||||||
PDF、aux、bbl、out 指纹全部保持。
|
|
||||||
|
|
||||||
12 页 NeurIPS 在编辑器首次预览遇到两个问题,均保留失败材料。种子
|
|
||||||
作业从一个显式字体路径找不到字形字体后,继续在 TeX 树解析成功。
|
|
||||||
快照现在保留实际存在的显式资源搜索目录及读到的字节。四页原生 SVG
|
|
||||||
随后暴露了字形属性中的未转义双引号。共享 SVG 输出修复了属性转义,
|
|
||||||
并增加定向回归。最终在 Edge 实际绘制全部 12 页。编辑和故障恢复
|
|
||||||
各只替换第 12 页,前 11 页保留 DOM 页面。错误请求保留可下载 PDF。
|
|
||||||
编辑版 PDF、aux 和 out 与同一构建的独立命令行收敛作业逐字节一致,
|
|
||||||
恢复 PDF 与原样导出逐字节一致。单次记录为首屏 20.54 秒、编辑后
|
|
||||||
可见 2.60 秒、恢复 0.83 秒。该次执行期间同机在复验出版样例。
|
|
||||||
|
|
||||||
本地 Beta 现在提供试用入口。当前编辑内容保存在会话,下一批优先
|
|
||||||
推进工作副本的源文件保存,并用原样多页项目定位首次预览与编辑耗时。
|
|
||||||
正式完整迁移和实时门槛按产品总目标验收。
|
|
||||||
|
|
||||||
证据在 target/native-beta-validation/。SHA256SUMS 指纹为
|
|
||||||
dd3d8a4d2dff519ad634eca6e75b04b6bff4ee2a87ca46ab2df9dfccd4cce439。
|
|
||||||
|
|
||||||
## 2026-11-29 行盒尺寸、分页返回与本地 Beta 验证
|
|
||||||
|
|
||||||
pdfTeX 的每行、首行和末行高度深度参数进入实际段落行盒。首行高度
|
|
||||||
和末行深度优先于一般值。当前 \pdfignoreddimen 决定何时插入基线胶,
|
|
||||||
并用于竖盒、对齐单元、竖向标尺和输出例程的 prevdepth 语义。
|
|
||||||
XeTeX 沿用自己的固定阈值。schema112 实际保存参数,旧格式继续加载,
|
|
||||||
已经存在的同名绑定保留。用户输出例程返回时清零 \insertpenalties,
|
|
||||||
页面首次冻结尺寸时保留该整数。原版 INITEX 见证在返回钩子中显示
|
|
||||||
0,原生旧版显示 19,候选的两页文字与原版一致。
|
|
||||||
[pdfTeX 行盒尺寸规则](https://github.com/TeX-Live/texlive-source/blob/e49735c7ed1aa2ed9c2e68e6632d27f20d42eca7/texk/web2c/pdftexdir/pdftex.web#L25927-L25955)
|
|
||||||
· [输出例程返回](https://github.com/TeX-Live/texlive-source/blob/e49735c7ed1aa2ed9c2e68e6632d27f20d42eca7/texk/web2c/pdftexdir/pdftex.web#L28570-L28591)
|
|
||||||
|
|
||||||
七项定向检查通过。双栏浮动、跨页长表、启用五个行距参数的双栏
|
|
||||||
浮动三个小项目使用实际 LaTeX 类和包,从空辅助文件各编译两轮。
|
|
||||||
两端共七页、1,276 个词框、144 DPI 灰度图和各轮 aux 均一致。
|
|
||||||
保留旧版在新样例首个参数处的真实编译失败。
|
|
||||||
|
|
||||||
本地 Beta 路线以 [产品总目标](NATIVE_PRODUCT_GOAL.md#beta-优先交付)
|
|
||||||
为准。本轮用同一发布构建启动原样 A4 多文件样例。Edge 实际绘制
|
|
||||||
首轮页面,共同修改主文件和子文件后更新这一页,编辑后来源表
|
|
||||||
包含当前子文件的实际版本。输入未定义命令时保留上次可下载 PDF,
|
|
||||||
恢复后导出与此前字节相同。独立 CLI 从空辅助文件编译两轮,收敛
|
|
||||||
后的 PDF 和 aux 均与编辑器逐字节一致。第一次拷入现成 aux 被
|
|
||||||
输出所有权检查拒绝,保留该失败。浏览器本次首屏为 4.56 秒,
|
|
||||||
两文件改动到页面可见为 0.96 秒,均为单次记录。Beta 还需整理
|
|
||||||
可重复的启动资源并在同一候选上走完首批原样项目。
|
|
||||||
|
|
||||||
证据在 target/p3-float-page-lists/。SHA256SUMS 指纹为
|
|
||||||
7ca1f8577db0f738144d36f5ac40d8a41c27a9b8e167e525696ed9e2aaba3d70。
|
|
||||||
|
|
||||||
## 2026-11-29 子文件检查点的所有权与分配
|
|
||||||
|
|
||||||
子文件推进后的执行器直接接回运行中的作业,在实际落点由统一调度保留
|
|
||||||
一次检查点。已校验的后段检查点沿用当前已读的源文件与字节缓冲。
|
|
||||||
五项定向回归通过。原样 A4 七次编辑均只更新第一页,原生执行、PDF、
|
|
||||||
绘制列表、SVG、来源映射、资源与文件流、aux 和日志与独立全量一致。
|
|
||||||
变长和恢复分别由 78,606 降至 71,089 步、78,576 降至 71,059 步。
|
|
||||||
|
|
||||||
相对于上一实验 d98d7b4,执行阶段的分配统计中,变长和恢复分别少
|
|
||||||
16,088 和 16,073 次分配,新增分配字节分别少 1,130,277 和 1,130,402。
|
|
||||||
两个版本各测一次。另与主线执行代码做同机同核两对未插桩计时,
|
|
||||||
两个场景的均值分别为 80.4 → 80.8 ms 和 78.9 → 94.8 ms。
|
|
||||||
峰值 RSS 范围为 539,284–540,804 → 542,748–542,824 KiB。
|
|
||||||
单次硬件计数显示两个场景的主线程用户态指令数均增加约 8.3%,
|
|
||||||
主线程 CPU 时间分别为 67.8 → 70.6 ms 和 84.3 → 82.8 ms。
|
|
||||||
候选 f6f447d 保留在 experiment/p4-child-segment-convergence。
|
|
||||||
正式编辑到可见页面性能仍待验收。
|
|
||||||
|
|
||||||
下一功能批优先处理原样项目共用的分页、跨栏浮动和多轮作业阻塞。
|
|
||||||
子文件推进随下一项跨项目执行复用功能一并验证,下一次性能定位
|
|
||||||
结合命令读取表复制及主线程指令数。定向检查只覆盖本批改动,
|
|
||||||
全回归、出版模板矩阵和正式可见性能在功能接齐后的同一版本集中验收。
|
|
||||||
|
|
||||||
证据在 target/p4-child-advance-ownership/。SHA256SUMS 指纹为
|
|
||||||
58cf8881845780bc1d7e12719b72567d0be6bc27c26789e5a6be219ea3c12d0a。
|
|
||||||
|
|
||||||
## 2026-11-29 按需校验子文件复用的资源记录
|
|
||||||
|
|
||||||
子文件收敛时先校验 e-TeX 可观察的宏共享关系,涵盖当前绑定、
|
|
||||||
分组保存的绑定及活动展开帧。其余资源共享关系在实际统计输出
|
|
||||||
或容量复核时校验。检查点保留证明,后续编辑可使用同一证明。
|
|
||||||
校验失败时,关闭本次复用并从已验证的前缀重新执行。试验记录
|
|
||||||
了后续编辑启用统计及实际触发容量复核两条重跑路径,退回的草稿
|
|
||||||
在执行阶段结束前保持已发布辅助文件字节。统计通过、拒绝重跑
|
|
||||||
及容量重跑均和独立全量一致。7 项定向检查及 3 个宏共享小用例通过。
|
|
||||||
|
|
||||||
原样 A4 的 LaTeX 格式在作业结束时主动输出统计。资源校验使用
|
|
||||||
已经证明的宏关系,统计报告仍按当前真实状态完整生成。七次原样
|
|
||||||
编辑分别核对执行、PDF、绘制列表、SVG、来源映射、读取轨迹、
|
|
||||||
aux 和日志。每次仅更新受影响的一页。变长和恢复分别保留
|
|
||||||
7,517 和 7,526 步的复用。
|
|
||||||
|
|
||||||
同机同核两对串行测量中,变长编辑的执行阶段均值为
|
|
||||||
93.1 → 101.8 ms,恢复为 99.0 → 109.8 ms。峰值 RSS 范围为
|
|
||||||
538,564–539,092 → 542,716–542,920 KiB。上一候选的对应均值
|
|
||||||
记录为 194.8 和 150.7 ms。此次仍高于同轮主线,代码保留在
|
|
||||||
experiment/p4-child-segment-convergence 的 d98d7b4。
|
|
||||||
54 个候选实际热编辑 CPU 样本中,命令表和含义读取表复制各占
|
|
||||||
9 和 4 个。下一批先核查推进检查点时的执行器复制及随后的重复
|
|
||||||
捕获,量出实际减少的复制和端到端时延。正式实时验收仍待完成。
|
|
||||||
|
|
||||||
证据在 target/p4-deferred-child-accounting-final/。SHA256SUMS 指纹为
|
|
||||||
12580934bbb2e4dceda4c69cc87ec89aca290311074a7c21cbbdfcfa90a19a3e。
|
|
||||||
|
|
||||||
## 2026-11-29 子文件局部收敛及验证成本
|
|
||||||
|
|
||||||
在独立诊断副本中追踪真实 LaTeX 输入定位。两个输入各有 4,240 行
|
|
||||||
宏展开及分组记录,其中 44 行随真实文件字节数变化,最后 2,054 行
|
|
||||||
相同。LaTeX 实际比较带扩展名和省略扩展名时查到的大小。原样 A4
|
|
||||||
另行执行,保留原始输入和正常诊断设置。
|
|
||||||
|
|
||||||
实验在重新执行文件大小查询及打开子文件之后校验两侧的内核状态、
|
|
||||||
已读物理字节、宿主状态及区段内宿主调用。满足条件时复用后续
|
|
||||||
子文件检查点之间的执行。保留实际新版查询及资源版本。正例和
|
|
||||||
三个拒绝场景已核对,分别覆盖了状态仍受大小影响、已读取前缀
|
|
||||||
发生变化和区段包含宿主操作。文件中点移动的先前失败已修正。
|
|
||||||
6 项定向检查通过。
|
|
||||||
|
|
||||||
原样 A4 的七次编辑或恢复各只更新受影响的一页。原始执行结果、
|
|
||||||
PDF、页面绘制、SVG、来源映射、读取轨迹、aux 和日志与独立全量
|
|
||||||
一致。子文件异长编辑实际执行 78,606 → 71,089 步,恢复执行
|
|
||||||
78,576 → 71,050 步。
|
|
||||||
|
|
||||||
同机同核的两对串行样本中,异长编辑的执行阶段时间均值从 95.1
|
|
||||||
增至 194.8 ms,恢复从 90.9 增至 150.7 ms。对候选两个实际编辑
|
|
||||||
执行阶段单独采样,在 82 个 CPU 样本中,命令排序、状态统计和
|
|
||||||
宏体遍历合计命中 22 次。将候选保留在实验分支
|
|
||||||
experiment/p4-child-segment-convergence,提交为 64adf51。
|
|
||||||
下一批优先降低资源占用关系的校验成本。延迟校验前须保持草稿
|
|
||||||
隔离,并在能够观察资源统计或触发容量复核时重新验证或回到
|
|
||||||
已安全验证的恢复点。正式页面可见时延门禁继续执行。
|
|
||||||
|
|
||||||
证据在 target/p4-a4-input-convergence/。包含原样作业、诊断副本、
|
|
||||||
两次修正前的失败证据、配对数据和 CPU 样本。SHA256SUMS 指纹为
|
|
||||||
b0479d1d21fc10af9ecd6064c1e597f5414bf5f57fcfa18414975835856103b5。
|
|
||||||
|
|
||||||
## 2026-11-29 推进已读取物理行的恢复点
|
## 2026-11-29 推进已读取物理行的恢复点
|
||||||
|
|
||||||
自动会话在普通入口检查点对应的物理行执行完毕后,可保留该行上更晚
|
自动会话在普通入口检查点对应的物理行执行完毕后,可保留该行上更晚
|
||||||
|
|||||||
+13
-101
@@ -1,17 +1,10 @@
|
|||||||
const workspace = document.querySelector("#workspace");
|
|
||||||
if (workspace) attachWebControls();
|
|
||||||
|
|
||||||
const source = document.querySelector("#source");
|
const source = document.querySelector("#source");
|
||||||
const pages = document.querySelector("#pages");
|
const pages = document.querySelector("#pages");
|
||||||
const status = document.querySelector("#status, #preview-status");
|
const status = document.querySelector("#status");
|
||||||
const error = document.querySelector("#error, #preview-error-text");
|
const error = document.querySelector("#error");
|
||||||
const errorPanel = document.querySelector("#error, #preview-error");
|
|
||||||
const pdf = document.querySelector("#pdf");
|
const pdf = document.querySelector("#pdf");
|
||||||
const save = document.querySelector("#save");
|
|
||||||
const saved = document.querySelector("#saved, #file-panel-foot");
|
|
||||||
const selector = document.querySelector("#project-files");
|
const selector = document.querySelector("#project-files");
|
||||||
const name = document.querySelector("#name, #open-file-path");
|
const name = document.querySelector("#name");
|
||||||
const fileTree = document.querySelector("#file-tree");
|
|
||||||
const edits = new Map();
|
const edits = new Map();
|
||||||
let files;
|
let files;
|
||||||
let activeFile;
|
let activeFile;
|
||||||
@@ -21,60 +14,16 @@ let draft = null;
|
|||||||
let frame;
|
let frame;
|
||||||
const previewDraft = new URLSearchParams(location.hash.slice(1)).get("preview") !== "published";
|
const previewDraft = new URLSearchParams(location.hash.slice(1)).get("preview") !== "published";
|
||||||
|
|
||||||
function attachWebControls() {
|
|
||||||
const button = document.createElement("button");
|
|
||||||
button.type = "button";
|
|
||||||
button.id = "save";
|
|
||||||
button.className = "btn";
|
|
||||||
button.disabled = true;
|
|
||||||
button.textContent = "保存源文件";
|
|
||||||
document.querySelector(".file-tools").replaceChildren(button);
|
|
||||||
|
|
||||||
const download = document.createElement("a");
|
|
||||||
download.id = "pdf";
|
|
||||||
download.className = "btn small";
|
|
||||||
download.download = "";
|
|
||||||
download.hidden = true;
|
|
||||||
download.textContent = "下载 PDF";
|
|
||||||
document.querySelector("#export-pdf").replaceWith(download);
|
|
||||||
|
|
||||||
document.querySelector("#back-button").hidden = true;
|
|
||||||
document.querySelector("#toggle-engine").hidden = true;
|
|
||||||
document.querySelector("#header-actions").textContent = "原生 Beta";
|
|
||||||
document.querySelector("footer").textContent = "Ctrl/Cmd+S 保存源码副本";
|
|
||||||
document.querySelector("#source").disabled = true;
|
|
||||||
document.querySelector("#file-panel-foot").setAttribute("role", "status");
|
|
||||||
document.querySelector("#file-panel-foot").style.overflowWrap = "anywhere";
|
|
||||||
workspace.hidden = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectFile(filename) {
|
|
||||||
activeFile = filename;
|
|
||||||
name.textContent = filename;
|
|
||||||
source.value = edits.get(filename) ?? files.get(filename);
|
|
||||||
if (fileTree) {
|
|
||||||
for (const row of fileTree.children) {
|
|
||||||
const selected = row.dataset.path === activeFile;
|
|
||||||
row.classList.toggle("active", selected);
|
|
||||||
row.setAttribute("aria-pressed", selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showError(message) {
|
function showError(message) {
|
||||||
status.textContent = "编译失败";
|
status.textContent = "编译失败";
|
||||||
error.textContent = message;
|
error.textContent = message;
|
||||||
errorPanel.hidden = false;
|
error.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageImage(page) {
|
function pageImage(page) {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.alt = `第 ${page.index + 1} 页`;
|
img.alt = `第 ${page.index + 1} 页`;
|
||||||
img.dataset.index = page.index;
|
img.dataset.index = page.index;
|
||||||
if (workspace) {
|
|
||||||
img.className = "page";
|
|
||||||
img.style.aspectRatio = "auto";
|
|
||||||
}
|
|
||||||
img.src = URL.createObjectURL(new Blob([page.svg], { type: "image/svg+xml" }));
|
img.src = URL.createObjectURL(new Blob([page.svg], { type: "image/svg+xml" }));
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
@@ -165,7 +114,7 @@ async function compile(edit, submitted, changes) {
|
|||||||
} else {
|
} else {
|
||||||
acceptPublication(update.revision, previous);
|
acceptPublication(update.revision, previous);
|
||||||
}
|
}
|
||||||
errorPanel.hidden = true;
|
error.hidden = true;
|
||||||
await new Promise(requestAnimationFrame);
|
await new Promise(requestAnimationFrame);
|
||||||
await new Promise(requestAnimationFrame);
|
await new Promise(requestAnimationFrame);
|
||||||
if (edit !== sequence) return;
|
if (edit !== sequence) return;
|
||||||
@@ -222,63 +171,26 @@ function queueCompile() {
|
|||||||
frame = requestAnimationFrame(() => compile(edit, submitted, changes));
|
frame = requestAnimationFrame(() => compile(edit, submitted, changes));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveSources() {
|
|
||||||
save.disabled = true;
|
|
||||||
saved.hidden = false;
|
|
||||||
saved.textContent = "正在保存源文件";
|
|
||||||
try {
|
|
||||||
const response = await fetch("/save", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ sequence, files: Object.fromEntries(edits) }),
|
|
||||||
});
|
|
||||||
const result = await response.json();
|
|
||||||
if (!response.ok) throw new Error(result.error);
|
|
||||||
saved.textContent = "已保存源文件至 " + result.directory;
|
|
||||||
} catch (failure) {
|
|
||||||
saved.textContent = "保存失败:" + failure.message;
|
|
||||||
} finally {
|
|
||||||
save.disabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function openProject() {
|
async function openProject() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/project");
|
const response = await fetch("/project");
|
||||||
if (!response.ok) throw new Error("无法打开源文件");
|
if (!response.ok) throw new Error("无法打开源文件");
|
||||||
const project = await response.json();
|
const project = await response.json();
|
||||||
files = new Map(Object.entries(project.files));
|
files = new Map(Object.entries(project.files));
|
||||||
if (fileTree) {
|
activeFile = project.name;
|
||||||
document.querySelector("#project-title").textContent = project.name;
|
name.textContent = activeFile;
|
||||||
for (const filename of files.keys()) {
|
source.value = files.get(activeFile);
|
||||||
const row = document.createElement("button");
|
|
||||||
row.type = "button";
|
|
||||||
row.className = "btn tree-row file-row";
|
|
||||||
row.style.width = "100%";
|
|
||||||
row.dataset.path = filename;
|
|
||||||
row.textContent = filename;
|
|
||||||
row.title = filename;
|
|
||||||
row.addEventListener("click", () => selectFile(filename));
|
|
||||||
fileTree.append(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectFile(project.name);
|
|
||||||
source.disabled = false;
|
source.disabled = false;
|
||||||
sequence = project.sequence;
|
sequence = project.sequence;
|
||||||
save.disabled = false;
|
if (files.size > 1) {
|
||||||
save.addEventListener("click", saveSources);
|
|
||||||
document.addEventListener("keydown", (event) => {
|
|
||||||
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "s") {
|
|
||||||
event.preventDefault();
|
|
||||||
if (!save.disabled) saveSources();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (selector && files.size > 1) {
|
|
||||||
for (const filename of files.keys()) selector.add(new Option(filename, filename));
|
for (const filename of files.keys()) selector.add(new Option(filename, filename));
|
||||||
selector.value = activeFile;
|
selector.value = activeFile;
|
||||||
selector.hidden = false;
|
selector.hidden = false;
|
||||||
name.hidden = true;
|
name.hidden = true;
|
||||||
selector.addEventListener("change", () => selectFile(selector.value));
|
selector.addEventListener("change", () => {
|
||||||
|
activeFile = selector.value;
|
||||||
|
source.value = edits.get(activeFile) ?? files.get(activeFile);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
source.addEventListener("input", () => {
|
source.addEventListener("input", () => {
|
||||||
edits.set(activeFile, source.value);
|
edits.set(activeFile, source.value);
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
}
|
}
|
||||||
header strong { letter-spacing: .02em; }
|
header strong { letter-spacing: .02em; }
|
||||||
header a { color: #bde5ff; }
|
header a { color: #bde5ff; }
|
||||||
.actions { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
|
|
||||||
.actions span { overflow-wrap: anywhere; }
|
|
||||||
main { display: grid; grid-template-columns: minmax(270px, 5fr) minmax(300px, 7fr); min-height: 0; }
|
main { display: grid; grid-template-columns: minmax(270px, 5fr) minmax(300px, 7fr); min-height: 0; }
|
||||||
.edit { min-height: 0; display: grid; grid-template-rows: auto 1fr; background: white; }
|
.edit { min-height: 0; display: grid; grid-template-rows: auto 1fr; background: white; }
|
||||||
.file { padding: .6rem 1rem; border-bottom: 1px solid #d9e0e6; font: 14px/1.5 ui-monospace, monospace; }
|
.file { padding: .6rem 1rem; border-bottom: 1px solid #d9e0e6; font: 14px/1.5 ui-monospace, monospace; }
|
||||||
@@ -40,11 +38,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<strong>Texrra 原生预览</strong>
|
<strong>Texrra 原生预览</strong>
|
||||||
<span id="status" role="status">正在打开文档</span>
|
<span id="status" role="status">正在打开文档</span>
|
||||||
<div class="actions">
|
|
||||||
<button id="save" type="button" disabled>保存源文件</button>
|
|
||||||
<span id="saved" role="status" hidden></span>
|
|
||||||
<a id="pdf" download hidden>下载 PDF</a>
|
<a id="pdf" download hidden>下载 PDF</a>
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<section class="edit" aria-label="源文件">
|
<section class="edit" aria-label="源文件">
|
||||||
|
|||||||
@@ -19,12 +19,10 @@ use texrra_engine::native::{
|
|||||||
};
|
};
|
||||||
use texrra_tex_core::{
|
use texrra_tex_core::{
|
||||||
execution::InputProfile,
|
execution::InputProfile,
|
||||||
resources::{InputPolicy, SearchPath, WorldConfig},
|
resources::{InputPolicy, WorldConfig},
|
||||||
};
|
};
|
||||||
use tiny_http::{Header, Method, Request, Response, Server};
|
use tiny_http::{Header, Method, Request, Response, Server};
|
||||||
|
|
||||||
mod saved_project;
|
|
||||||
|
|
||||||
const MAX_EDIT_BODY: u64 = 2 * 1024 * 1024;
|
const MAX_EDIT_BODY: u64 = 2 * 1024 * 1024;
|
||||||
const PAGE: &str = include_str!("index.html");
|
const PAGE: &str = include_str!("index.html");
|
||||||
const SCRIPT: &str = include_str!("app.js");
|
const SCRIPT: &str = include_str!("app.js");
|
||||||
@@ -40,12 +38,6 @@ struct Edit {
|
|||||||
preview_draft: bool,
|
preview_draft: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
struct Save {
|
|
||||||
sequence: u64,
|
|
||||||
files: BTreeMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Work {
|
struct Work {
|
||||||
request: Request,
|
request: Request,
|
||||||
job: CompileJob,
|
job: CompileJob,
|
||||||
@@ -188,7 +180,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
std::process::exit(status);
|
std::process::exit(status);
|
||||||
}
|
}
|
||||||
let mut args = std::env::args_os().skip(1).peekable();
|
let mut args = std::env::args_os().skip(1).peekable();
|
||||||
let usage = "native_editor [--input-profile tex8bit|unicode|xetex] [--web-dir DIR] SOURCE FORMAT FORMAT_RESOURCES NEW_RUN_DIR [PORT] [FILE ...]";
|
let usage = "native_editor [--input-profile tex8bit|unicode|xetex] SOURCE FORMAT FORMAT_RESOURCES NEW_RUN_DIR [PORT] [FILE ...]";
|
||||||
let input_profile = if args.next_if(|arg| arg == "--input-profile").is_some() {
|
let input_profile = if args.next_if(|arg| arg == "--input-profile").is_some() {
|
||||||
match args.next().as_deref().and_then(std::ffi::OsStr::to_str) {
|
match args.next().as_deref().and_then(std::ffi::OsStr::to_str) {
|
||||||
Some("tex8bit") => InputProfile::TeX8Bit,
|
Some("tex8bit") => InputProfile::TeX8Bit,
|
||||||
@@ -199,12 +191,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
} else {
|
} else {
|
||||||
InputProfile::TeX8Bit
|
InputProfile::TeX8Bit
|
||||||
};
|
};
|
||||||
let web = if args.next_if(|arg| arg == "--web-dir").is_some() {
|
|
||||||
let path = PathBuf::from(args.next().ok_or(usage)?);
|
|
||||||
Some(WebAssets::load(&path)?)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
let mut args = args.map(PathBuf::from);
|
let mut args = args.map(PathBuf::from);
|
||||||
let source = args.next().ok_or(usage)?.canonicalize()?;
|
let source = args.next().ok_or(usage)?.canonicalize()?;
|
||||||
let format = args.next().ok_or(usage)?.canonicalize()?;
|
let format = args.next().ok_or(usage)?.canonicalize()?;
|
||||||
@@ -222,7 +208,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
mut project,
|
mut project,
|
||||||
entry,
|
entry,
|
||||||
editable,
|
editable,
|
||||||
declared,
|
|
||||||
options,
|
options,
|
||||||
} = prepare(&source, &format, &manifest, &run, &additional, input_profile)?;
|
} = prepare(&source, &format, &manifest, &run, &additional, input_profile)?;
|
||||||
let compiler = NativeCompiler::default().with_automatic_entry_checkpoints();
|
let compiler = NativeCompiler::default().with_automatic_entry_checkpoints();
|
||||||
@@ -235,28 +220,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let queue = queue.clone();
|
let queue = queue.clone();
|
||||||
move || worker(&queue)
|
move || worker(&queue)
|
||||||
});
|
});
|
||||||
let mut save_number = 0;
|
|
||||||
println!("Native editor http://{}", server.server_addr());
|
println!("Native editor http://{}", server.server_addr());
|
||||||
for request in server.incoming_requests() {
|
for request in server.incoming_requests() {
|
||||||
let path = request.url().to_owned();
|
let path = request.url().to_owned();
|
||||||
match (request.method(), path.as_str()) {
|
match (request.method(), path.as_str()) {
|
||||||
(&Method::Get, "/") => respond(
|
(&Method::Get, "/") => respond(request, 200, "text/html; charset=utf-8", PAGE.into()),
|
||||||
request,
|
|
||||||
200,
|
|
||||||
"text/html; charset=utf-8",
|
|
||||||
web.as_ref().map_or_else(|| PAGE.into(), |assets| assets.index.clone()),
|
|
||||||
),
|
|
||||||
(&Method::Get, "/styles.css") if web.is_some() => respond(
|
|
||||||
request, 200, "text/css; charset=utf-8", web.as_ref().unwrap().styles.clone(),
|
|
||||||
),
|
|
||||||
(&Method::Get, "/favicon.svg") if web.is_some() => respond(
|
|
||||||
request, 200, "image/svg+xml", web.as_ref().unwrap().favicon.clone(),
|
|
||||||
),
|
|
||||||
// The shared Web shell requests this stylesheet. Native preview
|
|
||||||
// pages carry their glyph outlines in their SVG output.
|
|
||||||
(&Method::Get, "/fonts.css") if web.is_some() => {
|
|
||||||
respond(request, 200, "text/css; charset=utf-8", Vec::new())
|
|
||||||
}
|
|
||||||
(&Method::Get, "/app.js") => respond(
|
(&Method::Get, "/app.js") => respond(
|
||||||
request,
|
request,
|
||||||
200,
|
200,
|
||||||
@@ -284,7 +252,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
(&Method::Post, "/preview") => {
|
(&Method::Post, "/preview") => {
|
||||||
let received = Instant::now();
|
let received = Instant::now();
|
||||||
let mut request = request;
|
let mut request = request;
|
||||||
let edit: Edit = match read_json(&mut request) {
|
let edit = match read_edit(&mut request) {
|
||||||
Ok(edit) => edit,
|
Ok(edit) => edit,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
reply(request, 400, json!({ "error": error }));
|
reply(request, 400, json!({ "error": error }));
|
||||||
@@ -350,38 +318,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(&Method::Post, "/save") => {
|
|
||||||
let mut request = request;
|
|
||||||
if !request.headers().iter().any(|header| {
|
|
||||||
header.field.equiv("Content-Type")
|
|
||||||
&& header.value.as_str().split(';').next() == Some("application/json")
|
|
||||||
}) {
|
|
||||||
reply(request, 415, json!({"error": "Expected JSON source edits"}));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let save: Save = match read_json(&mut request) {
|
|
||||||
Ok(save) => save,
|
|
||||||
Err(error) => {
|
|
||||||
reply(request, 400, json!({ "error": error }));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if save.sequence < queue.current.load(Ordering::Acquire) {
|
|
||||||
reply(request, 409, json!({"error": "A newer edit is already queued"}));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let changes: Option<BTreeMap<_, _>> = save.files.iter()
|
|
||||||
.map(|(name, data)| editable.get(name).map(|path| (path.as_path(), data.as_bytes())))
|
|
||||||
.collect();
|
|
||||||
let Some(changes) = changes else {
|
|
||||||
reply(request, 422, json!({"error": "The save refers to an unknown source file"}));
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
match saved_project::save(&run, &entry, &declared, &project, changes, &mut save_number) {
|
|
||||||
Ok(path) => reply(request, 200, json!({"directory": path})),
|
|
||||||
Err(error) => reply(request, 500, json!({"error": error.to_string()})),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(&Method::Get, path) if path.starts_with("/publication?revision=") => {
|
(&Method::Get, path) if path.starts_with("/publication?revision=") => {
|
||||||
let revision = path["/publication?revision=".len()..].parse::<u64>().ok();
|
let revision = path["/publication?revision=".len()..].parse::<u64>().ok();
|
||||||
let result = queue
|
let result = queue
|
||||||
@@ -441,23 +377,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WebAssets {
|
fn read_edit(request: &mut Request) -> Result<Edit, String> {
|
||||||
index: Vec<u8>,
|
|
||||||
styles: Vec<u8>,
|
|
||||||
favicon: Vec<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WebAssets {
|
|
||||||
fn load(path: &Path) -> std::io::Result<Self> {
|
|
||||||
Ok(Self {
|
|
||||||
index: fs::read(path.join("index.html"))?,
|
|
||||||
styles: fs::read(path.join("styles.css"))?,
|
|
||||||
favicon: fs::read(path.join("favicon.svg"))?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_json<T: serde::de::DeserializeOwned>(request: &mut Request) -> Result<T, String> {
|
|
||||||
let mut body = Vec::new();
|
let mut body = Vec::new();
|
||||||
request
|
request
|
||||||
.as_reader()
|
.as_reader()
|
||||||
@@ -474,7 +394,6 @@ struct EditorProject {
|
|||||||
project: Arc<ProjectSnapshot>,
|
project: Arc<ProjectSnapshot>,
|
||||||
entry: PathBuf,
|
entry: PathBuf,
|
||||||
editable: BTreeMap<String, PathBuf>,
|
editable: BTreeMap<String, PathBuf>,
|
||||||
declared: BTreeSet<PathBuf>,
|
|
||||||
options: CompileRequest,
|
options: CompileRequest,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +407,7 @@ fn prepare(
|
|||||||
) -> Result<EditorProject, Box<dyn std::error::Error>> {
|
) -> Result<EditorProject, Box<dyn std::error::Error>> {
|
||||||
let format_resources: Value = serde_json::from_slice(&fs::read(manifest)?)?;
|
let format_resources: Value = serde_json::from_slice(&fs::read(manifest)?)?;
|
||||||
let roots: Vec<PathBuf> = serde_json::from_value(format_resources["texmf_roots"].clone())?;
|
let roots: Vec<PathBuf> = serde_json::from_value(format_resources["texmf_roots"].clone())?;
|
||||||
let mut world = WorldConfig::from_environment(run, roots)?;
|
let mut world = WorldConfig::from_environment(run, roots.clone())?;
|
||||||
world.input_policy = InputPolicy::Tex;
|
world.input_policy = InputPolicy::Tex;
|
||||||
let name = source
|
let name = source
|
||||||
.file_name()
|
.file_name()
|
||||||
@@ -588,18 +507,8 @@ fn prepare(
|
|||||||
files.insert(path.clone(), Arc::from(fs::read(path)?));
|
files.insert(path.clone(), Arc::from(fs::read(path)?));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut coverage = BTreeSet::from_iter(world.texmf_roots.iter().cloned());
|
let mut coverage = BTreeSet::from_iter(roots);
|
||||||
coverage.insert(run.to_owned());
|
coverage.insert(run.to_owned());
|
||||||
// A successful lookup can follow a miss in an explicit search directory.
|
|
||||||
// Keep those directories in the snapshot along with the resolved bytes.
|
|
||||||
for search in world.paths.values().flatten() {
|
|
||||||
if let SearchPath::Directory { path, .. } = search {
|
|
||||||
let path = run.join(path);
|
|
||||||
if path.is_dir() {
|
|
||||||
coverage.insert(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for path in files.keys() {
|
for path in files.keys() {
|
||||||
if !coverage.iter().any(|root| path.starts_with(root)) {
|
if !coverage.iter().any(|root| path.starts_with(root)) {
|
||||||
coverage.insert(path.parent().ok_or("A resource needs a parent")?.to_owned());
|
coverage.insert(path.parent().ok_or("A resource needs a parent")?.to_owned());
|
||||||
@@ -626,7 +535,6 @@ fn prepare(
|
|||||||
project,
|
project,
|
||||||
entry,
|
entry,
|
||||||
editable,
|
editable,
|
||||||
declared,
|
|
||||||
options: request,
|
options: request,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
use std::{
|
|
||||||
collections::{BTreeMap, BTreeSet},
|
|
||||||
fs, io,
|
|
||||||
path::{Path, PathBuf},
|
|
||||||
};
|
|
||||||
use texrra_engine::native::ProjectSnapshot;
|
|
||||||
|
|
||||||
pub(super) fn save(
|
|
||||||
run: &Path,
|
|
||||||
entry: &Path,
|
|
||||||
declared: &BTreeSet<PathBuf>,
|
|
||||||
project: &ProjectSnapshot,
|
|
||||||
edits: BTreeMap<&Path, &[u8]>,
|
|
||||||
next_number: &mut u64,
|
|
||||||
) -> io::Result<PathBuf> {
|
|
||||||
let parent = run.parent().expect("the working directory has a parent");
|
|
||||||
let (staging, destination) = loop {
|
|
||||||
*next_number += 1;
|
|
||||||
let name = format!("texrra-sources-{}-{next_number}", std::process::id());
|
|
||||||
let destination = parent.join(&name);
|
|
||||||
if destination.symlink_metadata().is_ok() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let staging = parent.join(format!(".{name}.pending"));
|
|
||||||
match fs::create_dir(&staging) {
|
|
||||||
Ok(()) => break (staging, destination),
|
|
||||||
Err(error) if error.kind() == io::ErrorKind::AlreadyExists => continue,
|
|
||||||
Err(error) => return Err(error),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let result = (|| {
|
|
||||||
let sources = staging.join("sources");
|
|
||||||
fs::create_dir(&sources)?;
|
|
||||||
let mut files = Vec::new();
|
|
||||||
for path in declared {
|
|
||||||
let relative = path.strip_prefix(run).expect("declared sources stay in the working copy");
|
|
||||||
let name = relative.to_str().ok_or_else(|| {
|
|
||||||
io::Error::new(io::ErrorKind::InvalidData, "A project file needs a UTF-8 name")
|
|
||||||
})?;
|
|
||||||
let saved = sources.join(relative);
|
|
||||||
fs::create_dir_all(saved.parent().expect("a source file has a parent"))?;
|
|
||||||
if let Some(data) = edits
|
|
||||||
.get(path.as_path())
|
|
||||||
.copied()
|
|
||||||
.or_else(|| project.file(path).map(|file| file.data.as_ref()))
|
|
||||||
{
|
|
||||||
fs::write(&saved, data)?;
|
|
||||||
}
|
|
||||||
if path != entry {
|
|
||||||
files.push(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let entry_name = entry.file_name().expect("the entry has a name").to_str().unwrap();
|
|
||||||
let manifest = fs::File::create(staging.join("project.json"))?;
|
|
||||||
serde_json::to_writer_pretty(manifest, &serde_json::json!({
|
|
||||||
"entry": entry_name, "files": files,
|
|
||||||
}))?;
|
|
||||||
// Publish the metadata and every source at once.
|
|
||||||
fs::rename(&staging, &destination)
|
|
||||||
})();
|
|
||||||
if let Err(error) = result {
|
|
||||||
let _ = fs::remove_dir_all(&staging);
|
|
||||||
return Err(error);
|
|
||||||
}
|
|
||||||
Ok(destination)
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Prepare and run a local Route-D editor and CLI with one TeX configuration."""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
|
||||||
import shlex
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
|
|
||||||
RESOURCE_ENV = (
|
|
||||||
"TEXINPUTS", "TFMFONTS", "VFFONTS", "T1FONTS", "OPENTYPEFONTS", "TTFONTS",
|
|
||||||
"PKFONTS", "ENCFONTS", "TEXFONTMAPS", "TEXFORMATS", "TEXMFCNF", "MISCFONTS",
|
|
||||||
"SFDFONTS", "CMAPFONTS", "texmf_casefold_search",
|
|
||||||
"FONTCONFIG_FILE", "FONTCONFIG_PATH", "TZ", "SOURCE_DATE_EPOCH", "FORCE_SOURCE_DATE",
|
|
||||||
)
|
|
||||||
FORMAT_ENTRIES = {"tex8bit": "pdflatex.ini", "xetex": "xelatex.ini"}
|
|
||||||
MANIFEST = "bundle.json"
|
|
||||||
FORMAT = "latex.tfx"
|
|
||||||
RESOURCES = "format-resources.json"
|
|
||||||
|
|
||||||
|
|
||||||
def digest(path):
|
|
||||||
with path.open("rb") as stream:
|
|
||||||
return hashlib.file_digest(stream, "sha256").hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
def installed_path(argument):
|
|
||||||
output = subprocess.check_output(["kpsewhich", argument], text=True).strip()
|
|
||||||
if not output:
|
|
||||||
raise ValueError(f"TeX Live did not provide a path for {argument}")
|
|
||||||
return Path(output).resolve(strict=True)
|
|
||||||
|
|
||||||
|
|
||||||
def binary_name(name):
|
|
||||||
return name + (".exe" if os.name == "nt" else "")
|
|
||||||
|
|
||||||
|
|
||||||
def native_command(binary, profile, roots):
|
|
||||||
command = [binary, "native", "--job", "--etex", "--input-profile", profile,
|
|
||||||
"--input-policy", "tex", "--step-limit", "600000000"]
|
|
||||||
for root in roots:
|
|
||||||
command.extend(["--texmf-root", root])
|
|
||||||
return command
|
|
||||||
|
|
||||||
|
|
||||||
def roots_from_manifest(path):
|
|
||||||
roots = json.loads(path.read_text(encoding="utf-8"))["texmf_roots"]
|
|
||||||
for root in map(Path, roots):
|
|
||||||
if not root.is_absolute() or not root.is_dir():
|
|
||||||
raise ValueError(f"The TeX resource directory is unavailable: {root}")
|
|
||||||
return roots
|
|
||||||
|
|
||||||
|
|
||||||
def prepare(args):
|
|
||||||
repo = Path(__file__).resolve().parent.parent
|
|
||||||
target = repo / os.environ.get("CARGO_TARGET_DIR", "target") / "release"
|
|
||||||
texrra = (args.texrra or target / binary_name("texrra")).resolve(strict=True)
|
|
||||||
editor = (args.editor or target / "examples" / binary_name("native_editor")).resolve(strict=True)
|
|
||||||
saved_format = args.format_image.resolve(strict=True) if args.format_image else None
|
|
||||||
saved_resources = args.format_resources.resolve(strict=True) if args.format_resources else None
|
|
||||||
if saved_format:
|
|
||||||
roots_from_manifest(saved_resources)
|
|
||||||
else:
|
|
||||||
ini = (args.ini or installed_path(FORMAT_ENTRIES[args.input_profile])).resolve(strict=True)
|
|
||||||
roots = args.texmf_root or [
|
|
||||||
installed_path("-var-value=TEXMFDIST"),
|
|
||||||
installed_path("-var-value=TEXMFSYSVAR"),
|
|
||||||
]
|
|
||||||
roots = [root.resolve(strict=True) for root in roots]
|
|
||||||
|
|
||||||
bundle = args.bundle.resolve()
|
|
||||||
bundle.mkdir(parents=True)
|
|
||||||
format_path = bundle / FORMAT
|
|
||||||
resources = bundle / RESOURCES
|
|
||||||
if saved_format:
|
|
||||||
shutil.copyfile(saved_format, format_path)
|
|
||||||
shutil.copyfile(saved_resources, resources)
|
|
||||||
else:
|
|
||||||
env = {**os.environ, "TEXRRA_STATE_DIR": str(bundle / "state")}
|
|
||||||
command = native_command(texrra, args.input_profile, roots)
|
|
||||||
with (bundle / "format.log").open("wb") as log:
|
|
||||||
subprocess.run(
|
|
||||||
[*command, "--initex", "--dump-format", "--resource-manifest", resources,
|
|
||||||
ini, format_path],
|
|
||||||
env=env, cwd=bundle, stdout=log, stderr=subprocess.STDOUT, check=True,
|
|
||||||
)
|
|
||||||
roots = roots_from_manifest(resources)
|
|
||||||
|
|
||||||
binary_dir = bundle / "bin"
|
|
||||||
binary_dir.mkdir()
|
|
||||||
texrra_path = binary_dir / binary_name("texrra")
|
|
||||||
editor_path = binary_dir / binary_name("native_editor")
|
|
||||||
shutil.copy2(texrra, texrra_path)
|
|
||||||
shutil.copy2(editor, editor_path)
|
|
||||||
shutil.copy2(Path(__file__), bundle / "native-beta.py")
|
|
||||||
example = bundle / "a4-project"
|
|
||||||
shutil.copytree(repo / "examples/native-format-stage/a4-project", example)
|
|
||||||
files = [texrra_path, editor_path, format_path, resources, example / "main.tex",
|
|
||||||
example / "chapter.tex"]
|
|
||||||
receipt = {
|
|
||||||
"input_profile": args.input_profile,
|
|
||||||
"texmf_roots": roots,
|
|
||||||
"environment": {name: os.environ[name] for name in RESOURCE_ENV if name in os.environ},
|
|
||||||
"sha256": {path.relative_to(bundle).as_posix(): digest(path) for path in files},
|
|
||||||
}
|
|
||||||
(bundle / MANIFEST).write_text(json.dumps(receipt, indent=2) + "\n", encoding="utf-8")
|
|
||||||
print(f"Beta bundle ready at {bundle}")
|
|
||||||
print(f"Start the sample with python3 {shlex.quote(str(bundle / 'native-beta.py'))} open")
|
|
||||||
|
|
||||||
|
|
||||||
def launch(args):
|
|
||||||
bundle = Path(__file__).resolve().parent
|
|
||||||
manifest = json.loads((bundle / MANIFEST).read_text(encoding="utf-8"))
|
|
||||||
roots = roots_from_manifest(bundle / RESOURCES)
|
|
||||||
if roots != manifest["texmf_roots"]:
|
|
||||||
raise ValueError("The format resource roots differ from the prepared bundle")
|
|
||||||
env = os.environ.copy()
|
|
||||||
for name in (*RESOURCE_ENV, "TEXRRA_TEXMF"):
|
|
||||||
env.pop(name, None)
|
|
||||||
env.update(manifest["environment"])
|
|
||||||
env["TEXRRA_STATE_DIR"] = str(bundle / "state")
|
|
||||||
profile = manifest["input_profile"]
|
|
||||||
if args.action in ("open", "resume"):
|
|
||||||
if args.action == "resume":
|
|
||||||
saved = args.snapshot.resolve(strict=True)
|
|
||||||
project = json.loads((saved / "project.json").read_text(encoding="utf-8"))
|
|
||||||
entry = Path(project["entry"])
|
|
||||||
if len(entry.parts) != 1 or entry.name in ("", ".."):
|
|
||||||
raise ValueError("The saved project entry must be a filename")
|
|
||||||
source = (saved / "sources" / entry).resolve(strict=True)
|
|
||||||
assets = project["files"]
|
|
||||||
else:
|
|
||||||
source = args.entry.resolve(strict=True) if args.entry else bundle / "a4-project/main.tex"
|
|
||||||
assets = args.file if args.entry else ["chapter.tex", *args.file]
|
|
||||||
runs = bundle / "runs"
|
|
||||||
if args.run_dir:
|
|
||||||
run = args.run_dir.resolve()
|
|
||||||
else:
|
|
||||||
runs.mkdir(exist_ok=True)
|
|
||||||
run = Path(tempfile.mkdtemp(prefix="editor-", dir=runs)) / "project"
|
|
||||||
command = [bundle / "bin" / binary_name("native_editor"), "--input-profile", profile]
|
|
||||||
if args.web_dir:
|
|
||||||
command.extend(["--web-dir", args.web_dir.resolve(strict=True)])
|
|
||||||
command.extend([source, bundle / FORMAT, bundle / RESOURCES, run, str(args.port), *assets])
|
|
||||||
else:
|
|
||||||
command = native_command(bundle / "bin" / binary_name("texrra"), profile, roots)
|
|
||||||
command.extend(["--load-format", bundle / FORMAT, args.entry.resolve(strict=True),
|
|
||||||
args.output.resolve()])
|
|
||||||
os.execve(command[0], command, env)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
|
||||||
commands = parser.add_subparsers(dest="action", required=True)
|
|
||||||
|
|
||||||
setup = commands.add_parser("prepare", help="create a new local Beta directory")
|
|
||||||
setup.add_argument("bundle", type=Path)
|
|
||||||
setup.add_argument("--texrra", type=Path)
|
|
||||||
setup.add_argument("--editor", type=Path)
|
|
||||||
setup.add_argument("--input-profile", choices=FORMAT_ENTRIES, default="tex8bit")
|
|
||||||
setup.add_argument("--texmf-root", action="append", type=Path)
|
|
||||||
setup.add_argument("--ini", type=Path)
|
|
||||||
setup.add_argument("--format-image", type=Path)
|
|
||||||
setup.add_argument("--format-resources", type=Path)
|
|
||||||
|
|
||||||
editor = commands.add_parser("open", help="open a project or the bundled A4 sample")
|
|
||||||
editor.add_argument("entry", type=Path, nargs="?")
|
|
||||||
editor.add_argument("--file", action="append", default=[], help="path relative to the entry")
|
|
||||||
resume = commands.add_parser("resume", help="reopen a saved source snapshot")
|
|
||||||
resume.add_argument("snapshot", type=Path)
|
|
||||||
for command in (editor, resume):
|
|
||||||
command.add_argument("--web-dir", type=Path, help="use the texrra-web checkout")
|
|
||||||
command.add_argument("--run-dir", type=Path)
|
|
||||||
command.add_argument("--port", type=int, default=0)
|
|
||||||
|
|
||||||
compiler = commands.add_parser("compile", help="produce a PDF with the bundle's native CLI")
|
|
||||||
compiler.add_argument("entry", type=Path)
|
|
||||||
compiler.add_argument("output", type=Path)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
if args.action == "prepare":
|
|
||||||
if bool(args.format_image) != bool(args.format_resources):
|
|
||||||
setup.error("--format-image and --format-resources must be supplied together")
|
|
||||||
if args.format_image and (args.ini or args.texmf_root):
|
|
||||||
setup.error("--ini and --texmf-root apply when creating a format")
|
|
||||||
try:
|
|
||||||
if args.action == "prepare":
|
|
||||||
prepare(args)
|
|
||||||
else:
|
|
||||||
launch(args)
|
|
||||||
except subprocess.CalledProcessError as error:
|
|
||||||
log = args.bundle.resolve() / "format.log"
|
|
||||||
context = f". See {log}" if log.is_file() else ""
|
|
||||||
parser.exit(1, f"Beta preparation failed (exit {error.returncode}){context}\n")
|
|
||||||
except (OSError, ValueError, KeyError) as error:
|
|
||||||
parser.exit(1, f"{error}\n")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
+1
-1
@@ -1041,7 +1041,7 @@ impl CompileJob {
|
|||||||
}
|
}
|
||||||
let (active_checkpoint, prepared) =
|
let (active_checkpoint, prepared) =
|
||||||
if let Some(available) = checkpoints.and_then(CheckpointCache::current) {
|
if let Some(available) = checkpoints.and_then(CheckpointCache::current) {
|
||||||
match available.prepare(&request, format_cache, &cancellation, evidence) {
|
match available.prepare(&request, format_cache, &cancellation, evidence, allow_suffix) {
|
||||||
Ok((selected, prepared)) => (Some(selected), Some(prepared)),
|
Ok((selected, prepared)) => (Some(selected), Some(prepared)),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
check(&cancellation)?;
|
check(&cancellation)?;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use std::{
|
|||||||
path::Path,
|
path::Path,
|
||||||
};
|
};
|
||||||
use texrra_tex_core::{
|
use texrra_tex_core::{
|
||||||
execution::{CheckpointDecision, CheckpointSource, EntryCheckpoint},
|
execution::{CheckpointDecision, CheckpointReplayError, CheckpointSource, EntryCheckpoint},
|
||||||
resources::{ResourceKind, ResourceLookup, ResourceReadRange},
|
resources::{ResourceKind, ResourceLookup, ResourceReadRange},
|
||||||
};
|
};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -51,7 +51,7 @@ struct CachedCheckpoint {
|
|||||||
guard: PrefixInputGuard,
|
guard: PrefixInputGuard,
|
||||||
replay_count: usize,
|
replay_count: usize,
|
||||||
slots: Capture,
|
slots: Capture,
|
||||||
|
child_boundary: Option<crate::native_job::ReplayBoundary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CompletedExecution {
|
struct CompletedExecution {
|
||||||
@@ -374,6 +374,12 @@ impl<'a> CapturedEntries<'a> {
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let child_boundary = match slots {
|
||||||
|
Capture::Nested { interval: 0, .. } => guard.nested_source.as_ref()
|
||||||
|
.filter(|source| source.observed_size.is_some())
|
||||||
|
.map(|source| host.files().replay_boundary_with_child(Some(&source.path))),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
self.retain(
|
self.retain(
|
||||||
slots,
|
slots,
|
||||||
Arc::new(CachedCheckpoint {
|
Arc::new(CachedCheckpoint {
|
||||||
@@ -381,6 +387,7 @@ impl<'a> CapturedEntries<'a> {
|
|||||||
guard,
|
guard,
|
||||||
replay_count: calls.len(),
|
replay_count: calls.len(),
|
||||||
slots,
|
slots,
|
||||||
|
child_boundary,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
self.changed = true;
|
self.changed = true;
|
||||||
@@ -575,6 +582,7 @@ impl PublishedCheckpoints {
|
|||||||
cache: &FormatCache,
|
cache: &FormatCache,
|
||||||
cancellation: &Cancellation,
|
cancellation: &Cancellation,
|
||||||
evidence: &mut AttemptEvidence,
|
evidence: &mut AttemptEvidence,
|
||||||
|
allow_deferred: bool,
|
||||||
) -> Result<(SelectedCheckpoint, PreparedJob), CompileError> {
|
) -> Result<(SelectedCheckpoint, PreparedJob), CompileError> {
|
||||||
let project = request
|
let project = request
|
||||||
.project
|
.project
|
||||||
@@ -590,6 +598,7 @@ impl PublishedCheckpoints {
|
|||||||
candidate: ExecutionCandidate::Completed(result.clone()),
|
candidate: ExecutionCandidate::Completed(result.clone()),
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
.filter(|candidate| candidate.can_resume_accounting(allow_deferred))
|
||||||
.collect();
|
.collect();
|
||||||
candidates.sort_by_key(|candidate| std::cmp::Reverse(candidate.completed_steps()));
|
candidates.sort_by_key(|candidate| std::cmp::Reverse(candidate.completed_steps()));
|
||||||
let mut candidates = VecDeque::from(candidates);
|
let mut candidates = VecDeque::from(candidates);
|
||||||
@@ -678,6 +687,29 @@ impl PublishedCheckpoints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CheckpointSet {
|
impl CheckpointSet {
|
||||||
|
fn advance_child(&self, current: &CachedCheckpoint) -> Option<EntryCheckpoint> {
|
||||||
|
let boundary = current.child_boundary.as_ref()?;
|
||||||
|
let child = current.guard.nested_source.as_ref()?;
|
||||||
|
let previous = self.entries.iter().find(|candidate| {
|
||||||
|
matches!(candidate.slots, Capture::Nested { interval: 0, .. })
|
||||||
|
&& candidate.entry.frontier() == current.entry.frontier()
|
||||||
|
&& candidate.replay_count == current.replay_count
|
||||||
|
&& candidate.child_boundary.as_ref() == Some(boundary)
|
||||||
|
&& candidate.guard.nested_source.as_ref().is_some_and(|old| {
|
||||||
|
old.path == child.path && old.observed_size != child.observed_size
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
self.entries.iter().rev().find_map(|later| {
|
||||||
|
if !matches!(later.slots, Capture::Nested { interval: 1, .. })
|
||||||
|
|| later.replay_count != previous.replay_count
|
||||||
|
|| !later.guard.nested_source.as_ref().is_some_and(|old| old.path == child.path)
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
current.entry.advance_within_child(&previous.entry, &later.entry)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn reserve_body(&self) -> Option<Arc<Self>> {
|
fn reserve_body(&self) -> Option<Arc<Self>> {
|
||||||
// The reserve holds only recent shipped checkpoints and the host
|
// The reserve holds only recent shipped checkpoints and the host
|
||||||
// call prefix they independently require.
|
// call prefix they independently require.
|
||||||
@@ -739,6 +771,14 @@ impl CachedCheckpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SelectedCheckpoint {
|
impl SelectedCheckpoint {
|
||||||
|
fn can_resume_accounting(&self, allow_deferred: bool) -> bool {
|
||||||
|
match &self.candidate {
|
||||||
|
ExecutionCandidate::Boundary(index) =>
|
||||||
|
self.set.entries[*index].entry.can_resume_accounting(allow_deferred),
|
||||||
|
ExecutionCandidate::Completed(_) => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn completed_steps(&self) -> usize {
|
fn completed_steps(&self) -> usize {
|
||||||
match &self.candidate {
|
match &self.candidate {
|
||||||
ExecutionCandidate::Boundary(index) => self.set.entries[*index].entry.completed_steps(),
|
ExecutionCandidate::Boundary(index) => self.set.entries[*index].entry.completed_steps(),
|
||||||
@@ -886,6 +926,16 @@ impl SelectedCheckpoint {
|
|||||||
|slots, entry, host| {
|
|slots, entry, host| {
|
||||||
let entry = Arc::new(entry);
|
let entry = Arc::new(entry);
|
||||||
captures.capture(slots, entry.clone(), host);
|
captures.capture(slots, entry.clone(), host);
|
||||||
|
if allow_suffix && let Capture::Nested { file, interval: 0 } = slots
|
||||||
|
&& let Some(current) = captures.nested[file][0].as_ref()
|
||||||
|
&& Arc::ptr_eq(¤t.entry, &entry)
|
||||||
|
&& let Some(advanced) = self.set.advance_child(current)
|
||||||
|
{
|
||||||
|
let reused = advanced.completed_steps() - entry.completed_steps();
|
||||||
|
work.reused_steps += reused;
|
||||||
|
work.reused_suffix_steps += reused;
|
||||||
|
return CheckpointDecision::Advance(Box::new(advanced));
|
||||||
|
}
|
||||||
let Capture::Settled { page, .. } = slots else {
|
let Capture::Settled { page, .. } = slots else {
|
||||||
return CheckpointDecision::Continue;
|
return CheckpointDecision::Continue;
|
||||||
};
|
};
|
||||||
@@ -916,13 +966,21 @@ impl SelectedCheckpoint {
|
|||||||
*suffix_failure = Some((error.clone(), discarded));
|
*suffix_failure = Some((error.clone(), discarded));
|
||||||
return CheckpointDecision::ReplayFailed(error);
|
return CheckpointDecision::ReplayFailed(error);
|
||||||
}
|
}
|
||||||
work.reused_suffix_steps = execution.steps - entry.completed_steps();
|
let reused = execution.steps - entry.completed_steps();
|
||||||
work.reused_steps += work.reused_suffix_steps;
|
work.reused_suffix_steps += reused;
|
||||||
|
work.reused_steps += reused;
|
||||||
work.replayed_calls += calls.len();
|
work.replayed_calls += calls.len();
|
||||||
CheckpointDecision::Reuse(Box::new(execution))
|
CheckpointDecision::Reuse(Box::new(execution))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.map_err(CompileError::Host)?
|
.map_err(|error| match error {
|
||||||
|
CheckpointReplayError::Host(error) => CompileError::Host(error),
|
||||||
|
CheckpointReplayError::Accounting { steps } => {
|
||||||
|
let message = "child continuation accounting differs".to_owned();
|
||||||
|
*suffix_failure = Some((message.clone(), steps.saturating_sub(work.reused_steps)));
|
||||||
|
CompileError::Host(message)
|
||||||
|
}
|
||||||
|
})?
|
||||||
.ok_or_else(changed_prefix)?;
|
.ok_or_else(changed_prefix)?;
|
||||||
let next = result.as_ref().ok().and_then(|result| {
|
let next = result.as_ref().ok().and_then(|result| {
|
||||||
captures.finish(recording, true, result)
|
captures.finish(recording, true, result)
|
||||||
|
|||||||
@@ -669,6 +669,10 @@ impl Files {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn replay_boundary(&self) -> ReplayBoundary {
|
pub(super) fn replay_boundary(&self) -> ReplayBoundary {
|
||||||
|
self.replay_boundary_with_child(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn replay_boundary_with_child(&self, rebound: Option<&Path>) -> ReplayBoundary {
|
||||||
let mut trace = self.resource_trace().clone();
|
let mut trace = self.resource_trace().clone();
|
||||||
trace.project_version = None;
|
trace.project_version = None;
|
||||||
// The caller compared the live scanner bytes and validates later
|
// The caller compared the live scanner bytes and validates later
|
||||||
@@ -676,6 +680,14 @@ impl Files {
|
|||||||
if let Some(entry) = trace.reads.first_mut() {
|
if let Some(entry) = trace.reads.first_mut() {
|
||||||
entry.sha256.clear();
|
entry.sha256.clear();
|
||||||
}
|
}
|
||||||
|
if let Some(path) = rebound {
|
||||||
|
// The host actually ran the size queries and opened the rebound
|
||||||
|
// source. Their old versions are history, not live stream state.
|
||||||
|
for read in trace.reads.iter_mut().filter(|read| read.path == path) {
|
||||||
|
read.sha256.clear();
|
||||||
|
read.bytes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
let mut stream_events = self.stream_io.events().to_vec();
|
let mut stream_events = self.stream_io.events().to_vec();
|
||||||
for event in &mut stream_events {
|
for event in &mut stream_events {
|
||||||
if let crate::native_stream::StreamEffect::OutputOpened {
|
if let crate::native_stream::StreamEffect::OutputOpened {
|
||||||
|
|||||||
@@ -2861,6 +2861,226 @@ fn finished_entry_line_is_reused_after_a_child_size_change() {
|
|||||||
fs::remove_dir_all(cwd).unwrap();
|
fs::remove_dir_all(cwd).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn child_segments_reuse_only_after_live_state_and_inputs_converge() {
|
||||||
|
for (label, retain_size, host_call, change_prefix) in [
|
||||||
|
("converged", false, false, false),
|
||||||
|
("different-state", true, false, false),
|
||||||
|
("different-prefix", false, false, true),
|
||||||
|
("host-effect", false, true, false),
|
||||||
|
] {
|
||||||
|
let root = directory(label).canonicalize().unwrap();
|
||||||
|
let entry = root.join("main.tex");
|
||||||
|
let child = root.join("child.tex");
|
||||||
|
let mut world = WorldConfig::new(&root);
|
||||||
|
world.input_policy = texrra_tex_core::resources::InputPolicy::Tex;
|
||||||
|
let retain = if retain_size { r"\global\count7=\measured\relax" } else { "" };
|
||||||
|
let main = format!(
|
||||||
|
"\\catcode123=1 \\catcode125=2\n\\begingroup\\edef\\measured{{\\pdffilesize{{child.tex}}}}{retain}\n\
|
||||||
|
\\ifnum\\measured>0 \\relax\\else\\errmessage{{empty child}}\\fi\\endgroup\n\
|
||||||
|
\\input child.tex\n\
|
||||||
|
\\shipout\\hbox{{\\vrule width\\the\\numexpr\\count0+\\count7\\relax pt height2pt}}\\end\n"
|
||||||
|
);
|
||||||
|
let effect = if host_call { "\\message{child effect}\n" } else { "" };
|
||||||
|
let middle = "\\advance\\count0 by 1\\relax\n".repeat(160);
|
||||||
|
let prefix = format!("\\relax{{}}\n{effect}{middle}");
|
||||||
|
let original = format!("{prefix}\\relax\n");
|
||||||
|
let prefix = if change_prefix {
|
||||||
|
prefix.replacen(r"\advance\count0 by 1", r"\advance\count0 by 2", 1)
|
||||||
|
} else {
|
||||||
|
prefix
|
||||||
|
};
|
||||||
|
let revised = format!("{prefix}\\relax\\advance\\count0 by 2\\relax\n");
|
||||||
|
let project = ProjectSnapshot::new(ProjectDefinition {
|
||||||
|
configuration: world.clone(),
|
||||||
|
revision: 1,
|
||||||
|
roots: [root.clone()].into(),
|
||||||
|
files: [
|
||||||
|
(entry, Arc::from(main.into_bytes())),
|
||||||
|
(child.clone(), Arc::from(original.into_bytes())),
|
||||||
|
]
|
||||||
|
.into(),
|
||||||
|
directories: Default::default(),
|
||||||
|
aliases: Default::default(),
|
||||||
|
generated_roots: [root.clone()].into(),
|
||||||
|
generated: Default::default(),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let mut request = CompileRequest::new(
|
||||||
|
world,
|
||||||
|
"main.tex",
|
||||||
|
"job.pdf",
|
||||||
|
JobTime::new(2026, 11, 29, 0)
|
||||||
|
.unwrap()
|
||||||
|
.with_pdf_clock(0, 0)
|
||||||
|
.unwrap(),
|
||||||
|
)
|
||||||
|
.observe_generated_initial();
|
||||||
|
request.entry = Entry::Initex;
|
||||||
|
request.etex = true;
|
||||||
|
let session = NativeCompiler::default().with_automatic_entry_checkpoints();
|
||||||
|
let original = session
|
||||||
|
.compile(request.clone().with_project(project.clone()))
|
||||||
|
.unwrap();
|
||||||
|
let project = project
|
||||||
|
.with_file_edits(2, [(child, Arc::from(revised.into_bytes()))].into())
|
||||||
|
.unwrap();
|
||||||
|
let request = request.with_project(project);
|
||||||
|
let edited = session.compile(request.clone()).unwrap();
|
||||||
|
let full = NativeCompiler::default().compile(request).unwrap();
|
||||||
|
let work = &edited.entry_checkpoint_work;
|
||||||
|
if label == "converged" {
|
||||||
|
assert!(work.reused_suffix_steps > 500, "{work:?}");
|
||||||
|
} else {
|
||||||
|
assert_eq!(work.reused_suffix_steps, 0, "{label}: {work:?}");
|
||||||
|
}
|
||||||
|
assert_ne!(edited.pdf, original.pdf, "{label}");
|
||||||
|
assert_eq!(edited.pdf, full.pdf, "{label}");
|
||||||
|
assert_eq!(edited.execution.execution, full.execution.execution, "{label}");
|
||||||
|
assert_eq!(edited.source_map.pages, full.source_map.pages, "{label}");
|
||||||
|
assert_eq!(edited.source_map.sources, full.source_map.sources, "{label}");
|
||||||
|
assert_eq!(edited.resources.trace, full.resources.trace, "{label}");
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn deferred_child_accounting_revalidates_before_statistics_or_capacity() {
|
||||||
|
struct PublishedAux {
|
||||||
|
path: PathBuf,
|
||||||
|
bytes: Vec<u8>,
|
||||||
|
checks: AtomicU64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CompileObserver for PublishedAux {
|
||||||
|
fn stage(&self, _revision: u64, stage: CompileStage) -> Result<(), String> {
|
||||||
|
if matches!(stage, CompileStage::Prepared | CompileStage::Executed) {
|
||||||
|
assert_eq!(fs::read(&self.path).unwrap(), self.bytes);
|
||||||
|
self.checks.fetch_add(1, Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (label, form, capacity) in [
|
||||||
|
("verified-statistics", false, false),
|
||||||
|
("retried-statistics", true, false),
|
||||||
|
("retried-capacity", true, true),
|
||||||
|
] {
|
||||||
|
let root = directory(label).canonicalize().unwrap();
|
||||||
|
let entry = root.join("main.tex");
|
||||||
|
let child = root.join("child.tex");
|
||||||
|
let aux = root.join("child.aux");
|
||||||
|
let mut world = WorldConfig::new(&root);
|
||||||
|
world.input_policy = texrra_tex_core::resources::InputPolicy::Tex;
|
||||||
|
let register_form = if form { r"\setbox0=\hbox{\vrule width2pt height1pt}\pdfxform0\relax" } else { "" };
|
||||||
|
let form_ref = if form { r"\pdfrefxform\pdflastxform" } else { "" };
|
||||||
|
let main = format!(
|
||||||
|
r"\catcode123=1 \catcode125=2
|
||||||
|
\pdfoutput=1 {register_form}
|
||||||
|
\def\material{{\setbox1=\hbox{{\vrule width1pt height1pt}}}}
|
||||||
|
\def\repeatmaterial{{\material\ifnum\count1<300
|
||||||
|
\advance\count1 by 1\relax\expandafter\repeatmaterial\fi}}
|
||||||
|
\begingroup\edef\measured{{\pdffilesize{{child.tex}}}}
|
||||||
|
\ifnum\measured>0 \relax\else\errmessage{{empty child}}\fi\endgroup
|
||||||
|
\input child.tex
|
||||||
|
\immediate\openout3=child.aux
|
||||||
|
\immediate\write3{{\the\count0}}\immediate\closeout3
|
||||||
|
\shipout\hbox{{{form_ref}\vrule width\count0 pt height2pt}}\end
|
||||||
|
"
|
||||||
|
);
|
||||||
|
let middle = "\\advance\\count0 by 1\\relax\n".repeat(160);
|
||||||
|
let prefix = format!("\\relax{{}}\n{middle}");
|
||||||
|
let tail = "\\tracingstats=0\\relax\\ifnum0=1 \\repeatmaterial\\fi\n";
|
||||||
|
let original = format!("{prefix}{tail}");
|
||||||
|
let grown = format!("{prefix}{tail}\\advance\\count0 by 2\\relax\n");
|
||||||
|
let observed = if capacity {
|
||||||
|
grown.replace("\\ifnum0=1", "\\ifnum1=1")
|
||||||
|
} else {
|
||||||
|
grown.replace("\\tracingstats=0", "\\tracingstats=1")
|
||||||
|
}
|
||||||
|
.replace("\\count0 by 2", "\\count0 by 3");
|
||||||
|
assert_eq!(grown.len(), observed.len());
|
||||||
|
let mut project = ProjectSnapshot::new(ProjectDefinition {
|
||||||
|
configuration: world.clone(),
|
||||||
|
revision: 1,
|
||||||
|
roots: [root.clone()].into(),
|
||||||
|
files: [
|
||||||
|
(entry, Arc::from(main.into_bytes())),
|
||||||
|
(child.clone(), Arc::from(original.into_bytes())),
|
||||||
|
]
|
||||||
|
.into(),
|
||||||
|
directories: Default::default(),
|
||||||
|
aliases: Default::default(),
|
||||||
|
generated_roots: [root.clone()].into(),
|
||||||
|
generated: [aux.clone()].into(),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let mut request = CompileRequest::new(
|
||||||
|
world,
|
||||||
|
"main.tex",
|
||||||
|
"job.pdf",
|
||||||
|
JobTime::new(2026, 11, 29, 0)
|
||||||
|
.unwrap()
|
||||||
|
.with_pdf_clock(0, 0)
|
||||||
|
.unwrap(),
|
||||||
|
)
|
||||||
|
.observe_generated_initial();
|
||||||
|
request.entry = Entry::Initex;
|
||||||
|
request.etex = true;
|
||||||
|
if capacity {
|
||||||
|
request.limits.tokens = 250;
|
||||||
|
}
|
||||||
|
let seed = request.clone().with_project(project.clone());
|
||||||
|
NativeCompiler::default().compile(seed.clone()).unwrap();
|
||||||
|
let session = NativeCompiler::default().with_automatic_entry_checkpoints();
|
||||||
|
session.compile(seed).unwrap();
|
||||||
|
project = project
|
||||||
|
.with_file_edits(2, [(child.clone(), Arc::from(grown.into_bytes()))].into())
|
||||||
|
.unwrap();
|
||||||
|
let grown = session.compile(request.clone().with_project(project.clone())).unwrap();
|
||||||
|
assert!(grown.entry_checkpoint_work.reused_suffix_steps > 500, "{label}: {:?}", grown.entry_checkpoint_work);
|
||||||
|
let initial_aux = fs::read(&aux).unwrap();
|
||||||
|
assert_eq!(initial_aux, b"162\n");
|
||||||
|
let observer = Arc::new(PublishedAux {
|
||||||
|
path: aux.clone(),
|
||||||
|
bytes: initial_aux.clone(),
|
||||||
|
checks: AtomicU64::new(0),
|
||||||
|
});
|
||||||
|
|
||||||
|
project = project
|
||||||
|
.with_file_edits(3, [(child.clone(), Arc::from(observed.into_bytes()))].into())
|
||||||
|
.unwrap();
|
||||||
|
let request = request.with_project(project);
|
||||||
|
let mut watched = request.clone();
|
||||||
|
watched.observer = Some(observer.clone());
|
||||||
|
let edited = session.compile(watched).unwrap();
|
||||||
|
let work = &edited.entry_checkpoint_work;
|
||||||
|
assert_eq!(observer.checks.load(Ordering::Relaxed), 2, "{label}: {work:?}");
|
||||||
|
if form {
|
||||||
|
assert_eq!(work.rejection.as_deref(), Some("child continuation accounting differs"), "{work:?}");
|
||||||
|
assert!(work.discarded_suffix_attempt_steps > 0, "{work:?}");
|
||||||
|
} else {
|
||||||
|
assert!(work.rejection.is_none(), "{work:?}");
|
||||||
|
assert_eq!(work.reused_source.as_deref(), Some(child.as_path()));
|
||||||
|
assert!(work.reused_frontier.unwrap() > 1000, "{work:?}");
|
||||||
|
}
|
||||||
|
|
||||||
|
let out_aux = fs::read(&aux).unwrap();
|
||||||
|
assert_eq!(out_aux, b"163\n");
|
||||||
|
fs::write(&aux, initial_aux).unwrap();
|
||||||
|
let full = NativeCompiler::default().compile(request).unwrap();
|
||||||
|
assert_eq!(fs::read(&aux).unwrap(), out_aux);
|
||||||
|
assert_eq!(edited.pdf, full.pdf, "{label}");
|
||||||
|
assert_eq!(edited.execution.execution, full.execution.execution, "{label}");
|
||||||
|
assert_eq!(edited.source_map.pages, full.source_map.pages, "{label}");
|
||||||
|
assert_eq!(edited.source_map.sources, full.source_map.sources, "{label}");
|
||||||
|
assert_eq!(edited.resources.trace.reads, full.resources.trace.reads, "{label}");
|
||||||
|
assert_eq!(edited.resources.trace.lookups, full.resources.trace.lookups, "{label}");
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn replay_rejection_resumes_earlier_without_publishing_rejected_effects() {
|
fn replay_rejection_resumes_earlier_without_publishing_rejected_effects() {
|
||||||
struct PublishedBeforeExecution(Vec<(PathBuf, Vec<u8>)>);
|
struct PublishedBeforeExecution(Vec<(PathBuf, Vec<u8>)>);
|
||||||
|
|||||||
Reference in new issue
Block a user