Skip to main content

Module origin

Module origin 

Source
Expand description

Definition provenance — K1 of the generalized kernel-capability program (docs/perfect_kernel/KERNEL_CAPABILITIES.md).

Every definition records WHO made it: LaTeXML’s own layers (the format dumps, the Rust pools, a compiled binding, the raw format files) or the document’s world (a raw .sty/.cls/.def the document loaded, or the document itself). The origin is captured at construction from a thread-local set by the loader seams, the same moment a definition’s locator is, and travels with the object through \let.

Its first consumer is the l3/ltcmd “already defined” leniency (\lx@if@pooldefined): real LaTeX keeps \section, \thepage, {figure}… in article.cls, our pool pre-defines them for class-less robustness, so a standalone class redeclaring them is not an error — while a genuine double declaration between two raw files still is.

Structs§

CopyProvidesGuard
RAII form of enter_copy_provides/leave_copy_provides, for a Rust-bracketed scope (the copy’s read, a nested load’s suspension).
OriginGuard
RAII guard: definitions made while it lives carry origin; the previous origin is restored on drop (loaders nest: a binding raw-loading its .sty yields File for that file’s definitions and Binding for its own).
ProvideOnlyGuard
RAII guard: while it lives, a load only provides — a binding’s definition (the fallback class OmniBus, or any binding it requires) of a name defined before the guard began is dropped, as a \providecommand of it is (state::provide_only_declines); the previous mode is restored on drop.
StandInLoadGuard
RAII guard: while a binding that stands in for an author’s file loads (binding::content::input_definitions), every name assigned is recorded as that binding’s (state::State::stand_in_meanings), whatever made it — its DefMacro!s, its Let!s and RawTeX, the bindings it requires — so the paper’s copy read after it only provides them (state::note_copy_provides_assignment). The names its own code assigns, not a file it loads (StandInLoadGuard::suspend: OmniBus, natbib, a nested stand-in’s own), are also its command set (state::State::stand_in_last_load), which the copy must define to be the file the binding stands in for (binding::content copy_is_the_stood_in_file).

Enums§

DefinitionOrigin
Who made a definition.

Functions§

call_watch
What a macro’s call must be for one of the watches on to see it, read at every macro call: None when no watch is on, Some(true) when only watch_document_calls’ and watch_store_calls’ are, which see only a macro with parameters that LaTeXML or a raw class’s own file made. Those two stay on from a conversion’s start until its title page, or to its end in a document with none, so a package’s macro calls in the document’s text would otherwise all pay for the watch’s cold path.
copy_default_watch
Is watch_setter_calls’ watch on?
copy_provides
The stand-in copy whose read is in force — “a stand-in’s copy provides” (state::note_copy_provides_assignment): the 1-based number of the paper’s copy of an author file a stand-in binding answers (binding::content::read_stand_in_copy), while that copy is read, while a hook it registered runs, or 0.
current_origin
The origin a definition constructed now will carry.
document_call_watch
Is watch_document_calls’ watch on?
dropped_argument_watch
Is watch_dropped_arguments’ watch on?
enter_copy_provides
Enter copy id’s provides-mode (0: suspend it, for a file the copy loads), until the matching leave_copy_provides. A stack, not a guard: the scope markers \lx@copy@provides@begin{N} and \lx@copy@provides@end wrapped around a hook the copy registers bracket a token run, not a Rust call. Entering from no mode (or leaving to none) puts \AddToHook’s registration seam in place (or back out, state::swap_copy_provides_hook_seam).
leave_copy_provides
Leave the provides-mode enter_copy_provides entered: the interrupted one is in force again. An unmatched leave is ignored.
note_document_mouth
The gullet’s current mouth changed: does it read the document’s own text (Mouth::is_document_text)?
note_reading_own_file
A raw file starts being read as definitions: is it a class or a file of the document’s own directory (binding::content::load_tex_definitions)? What it says before the load is read, for its end. What a \def makes meanwhile is such a file’s (crate::definition::expandable::Expandable::made_in_own_file): definitions record no source file of their own (their locator is a stub, Expandable.pm’s is unported).
provide_only
Is a provide-only load in progress (ProvideOnlyGuard)?
reading_own_file
Is a raw class or a raw file of the document’s own directory being read (note_reading_own_file)?
reset_copy_provides
Forget every provides-mode: a new conversion starts with none (reset_thread_engine).
setter_watch
Is a setter watch on (watch_setter_calls, watch_document_calls, watch_dropped_arguments, watch_store_calls)? Read at every macro call, so a flag.
stand_in_base_class
Is the code running now a class a stand-in binding loads (StandInLoadGuard::suspend_for: its base class, the pool’s article, report or book, or the OmniBus guess built on them), not the binding’s own code nor a package? The text defaults such a class assigns (\refname, \bibname, \abstractname) are not the binding’s (state::State::stand_in_base_defaults).
stand_in_loader_own_code
Did a stand-in binding’s own code request the file now loading (StandInLoadGuard::suspend keeps the flag it suspended)? A stand-in binding that file is joins the loading binding’s command set only then (StandInLoadGuard::loaded_by).
stand_in_loading
Is a binding that stands in for an author’s file loading (StandInLoadGuard), itself or a file it loads?
stand_in_own_code
Is the code running now a stand-in binding’s own (StandInLoadGuard::new), not a file it loads (StandInLoadGuard::suspend)?
store_call_watch
Is watch_store_calls’ watch on, the gullet reading the document’s text?
watch_document_calls
Observe (true) or stop observing the calls of LaTeXML’s own macros the document’s text makes, their arguments read from it (state::note_document_call): the title-page check’s second source, what the document gave a binding’s frontmatter commands (latexml_engine base_utilities::frontmatter::title_page_check). On from a conversion’s start until its frontmatter is sealed; observed only while the gullet reads the document’s text (note_document_mouth).
watch_dropped_arguments
Observe (true) or stop observing the required arguments a binding’s macro drops (state::note_dropped_argument): while a frontmatter entry the document gave is digested (latexml_engine title_page_check); the watch it replaces.
watch_setter_calls
Observe the calls of the setters names from now on (state::note_setter_call): a stand-in’s copy stored a default of their field, which the document’s own call replaces whatever its value.
watch_store_calls
Observe (true) or stop observing the calls of the setters a raw class or a raw file of the document’s own directory made (state::note_store_call): the title-page check’s third source (latexml_engine base_utilities::frontmatter::title_page_check). On from a conversion’s start until the title page; observed only while the gullet reads the document’s text (note_document_mouth).
with_origin
Run f with origin as the current definition origin.