Core APIs for bridging the C and Rust portions of Tectonic’s processing backends.
This crate is used by the Tectonic “engines”, which are predominantly C/C++ code derived from the original TeX codebase. It provides a framework so that the C/C++ code can invoke the support services provided by Tectonic, such as its pluggable I/O backends. The interfaces exposed to the C/C++ layers are created by cbindgen.
In order to provide access to a C/C++ engine in Rust, you should create some
kind of interface that expects to be given a reference to a
CoreBridgeLauncher struct. You should use that struct’s
with_global_lock method to obtain a
CoreBridgeState reference, and
then pass that reference across the FFI layer. On the other side of the FFI
divide, your code must call the functions
ttbc_global_engine_exit() according to the pattern described in
tectonic_bridge_core.h. If an abort is detected, the callback function
Unfortunately, this is the cleanest and most reliable API that we can
provide because our abort handling uses
longjmp and those can’t
cross FFI boundaries.
In order to use a C/C++ engine, you need to provide something that
DriverHooks trait. The
MinimalDriver struct provides
a minimal implementation that only requires you to provide an
A mechanism for launching bridged FFI code.
The CoreBridgeState structure is a handle to Rust state that can be used by C/C++ engine code to perform basic I/O functions.
A buffer for diagnostic messages. Rust code does not need to use this type.
An error type indicating the the FFI code aborted.
A type for storing settings about potentially insecure engine features.
Different types of files that can be opened by TeX engines
Different high-level security stances that can be adopted when creating
Possible failures for “system request” calls to the driver.
The DriverHooks trait allows engines to interact with the higher-level code that is driving the TeX processing.
Create a new diagnostic that will be reported as an error.
Create a new diagnostic that will be reported as a warning.
“Finish” a diagnostic: report it to the driver and free the diagnostic object.
Close a Tectonic input file.
Get the modification time of a Tectonic input file.
Get the size of a Tectonic input file.
Get a single character from a Tectonic input file.
Open the “primary input” file.
Put back a character that was obtained from a
Close a Tectonic output file.
Flush pending writes to a Tectonic output file.
Open the general user output stream as a Tectonic output file.
Write a single character to a Tectonic output file.