String entry point for Invocation (Perl: Invocation($token,@args) with a string
first argument). The string is tokenized via TokenizeInternal; if it yields a single
token, this reduces to build_invocation on that token. Otherwise the tokens are
treated as an “anonymous macro” containing parameter markers like #1, and the
arguments are substituted in.
Convert a LaTeX-style argument spec to our Package form.
Ie. given $nargs and $optional, being the two optional arguments to
something like \newcommand, convert it to the form we use
Two-optional variant of convert_latex_args — mirrors Perl’s
convert2optArgs helper in twoopt.sty.ltxml. \newcommandtwoopt{\cs}[n][d1][d2]{…}
builds a signature of [Default d1][Default d2]{…}… where the remaining
n - 2 args are plain required.
Strip version/arxiv suffixes from package names to find existing bindings.
Returns the fallback filename (with extension) and which kind of fallback fired.
Perl Package.pm L2141-2210: FindFile_fallback
Pure-check variant of find_file_fallback: strips the same
suffix/prefix patterns and reports whether the fallback name has a
registered binding, but DOES NOT eagerly invoke the binding’s
load_definitions. Use this from pre-flight existence checks (e.g.
class_cls_via_fallback in tex_job.rs) where firing the binding’s
body has side effects (\LoadClass, \RequirePackage) that contaminate
the subsequent real load. Witness: astro-ph0002213 — the \psfig
cluster fix (mn1 → mn fallback was eagerly running mn.cls’s
\LoadClass{article} before the \documentstyle[epsfig]{mn1}
option-pass-through machinery had a chance to enqueue epsfig into
opt@article.cls).
Decode a codepoint using the fontmap for a given font and/or encoding (Perl: FontDecode).
Returns the decoded glyph (if any) and the possibly-adjusted font.
Decode a string using the fontmap for a given encoding (Perl: FontDecodeString).
If implicit is true, codepoints missing from the map decode to themselves.
loads a binding from the main binding dispatcher, if available+found.
Ok(Some(source)) on load — source is the on-disk path for a runtime
.rhai file binding, None for a compiled-in one; Ok(None) = not loaded.
Perl: LoadClass($name, withoptions => 1) — load a class passing the
caller’s class options through to the child. Reads class_options from
state (populated by the outer \documentclass invocation) and forwards
those as the child’s options list, matching Perl Package.pm LoadClass’s
withoptions branch.
Pass the sequence of @options to the package $name (if $ext is ‘sty’),
or class $name (if $ext is ‘cls’).
Perl Package.pm: PassOptions($name, $ext, @options)
Stores options to be processed when the package/class is loaded.
Perl: RequirePackage($name, withoptions => 1) — forward the current
package/class’s options to the required child package. Reads
\@currname / \@currext to identify the caller, looks up its
opt@<name>.<ext> options, and passes them explicitly as the child’s
options list. Mirrors load_class_with_options for the package path.