Bind native format jobs to their validated pdfTeX revision

This commit is contained in:
gloamxun committed 2026-11-21 06:43:26 +08:00
1 parent d02777a1fc
commit 75d3667397
4 files changed
+33 -10

No files matched your search

@@ -603,6 +603,16 @@ mod ordered_map {
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
enum PdftexRevision {
// A format created before revision identity was stored bootstrapped with 22.
#[default]
#[serde(rename = "22")]
R22,
#[serde(rename = "24")]
R24,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct State {
#[serde(with = "ordered_map")]
@@ -613,6 +623,8 @@ pub struct State {
#[serde(with = "ordered_map")]
pub(super) token_parameters: BTreeMap<TokenParameter, std::sync::Arc<[Token]>>,
profile: Profile,
#[serde(default)]
pdftex_revision: PdftexRevision,
initex: bool,
#[serde(default)]
input_profile: super::InputProfile,
@@ -734,6 +746,7 @@ impl Default for State {
toks: BTreeMap::new(),
token_parameters: BTreeMap::new(),
profile: Profile::Bootstrap,
pdftex_revision: PdftexRevision::R24,
initex: false,
input_profile: super::InputProfile::default(),
endlinechar: 13,
@@ -1389,6 +1402,12 @@ impl State {
pub fn profile(&self) -> Profile {
self.profile
}
pub(super) fn pdftex_revision(&self) -> &'static str {
match self.pdftex_revision {
PdftexRevision::R22 => "22",
PdftexRevision::R24 => "24",
}
}
pub fn tokens(&self, index: u16) -> Vec<Token> {
self.toks.get(&index).cloned().unwrap_or_default()
}