Expand description
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.
If you change the interfaces here, rerun cbindgen as described in the README!
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_enter()
and
ttbc_global_engine_exit()
according to the pattern described in
tectonic_bridge_core.h
. If an abort is detected, the callback function
must return Err(EngineAbortedError::new_abort_indicator().into())
.
Unfortunately, this is the cleanest and most reliable API that we can
provide because our abort handling uses setjmp
/longjmp
and those can’t
cross FFI boundaries.
In order to use a C/C++ engine, you need to provide something that
implements the DriverHooks
trait. The MinimalDriver
struct provides
a minimal implementation that only requires you to provide an IoProvider
implementation.
Structs§
- Core
Bridge Launcher - A mechanism for launching bridged FFI code.
- Core
Bridge State - The CoreBridgeState structure is a handle to Rust state that can be used by C/C++ engine code to perform basic I/O functions.
- Diagnostic
- A buffer for diagnostic messages. Rust code does not need to use this type.
- Engine
Aborted Error - An error type indicating the the FFI code aborted.
- Minimal
Driver - This type provides a minimal
DriverHooks
implementation. - Security
Settings - A type for storing settings about potentially insecure engine features.
Enums§
- File
Format - Different types of files that can be opened by TeX engines
- Security
Stance - Different high-level security stances that can be adopted when creating
SecuritySettings
. - System
Request Error - Possible failures for “system request” calls to the driver.
Traits§
- Driver
Hooks - The DriverHooks trait allows engines to interact with the higher-level code that is driving the TeX processing.
Functions§
- ttbc_
diag_ ⚠append - Append text to a diagnostic.
- ttbc_
diag_ begin_ error - Create a new diagnostic that will be reported as an error.
- ttbc_
diag_ begin_ warning - Create a new diagnostic that will be reported as a warning.
- ttbc_
diag_ ⚠finish - “Finish” a diagnostic: report it to the driver and free the diagnostic object.
- ttbc_
get_ ⚠data_ md5 - Calculate the MD5 digest of a block of binary data.
- ttbc_
get_ ⚠file_ md5 - Calculate the MD5 digest of a Tectonic file.
- ttbc_
get_ ⚠last_ input_ abspath - Get the filesystem path of the most-recently-opened input file.
- ttbc_
input_ close - Close a Tectonic input file.
- ttbc_
input_ get_ mtime - Get the modification time of a Tectonic input file.
- ttbc_
input_ get_ size - Get the size of a Tectonic input file.
- ttbc_
input_ getc - Get a single character from a Tectonic input file.
- ttbc_
input_ ⚠open - Open a Tectonic file for input.
- ttbc_
input_ open_ primary - Open the “primary input” file.
- ttbc_
input_ ⚠read - Read data from a Tectonic input handle
- ttbc_
input_ ⚠seek - Seek in a Tectonic input stream.
- ttbc_
input_ ungetc - Put back a character that was obtained from a
getc
call. - ttbc_
issue_ ⚠error - Issue an error.
- ttbc_
issue_ ⚠warning - Issue a warning.
- ttbc_
output_ close - Close a Tectonic output file.
- ttbc_
output_ flush - Flush pending writes to a Tectonic output file.
- ttbc_
output_ ⚠open - Open a Tectonic file for output.
- ttbc_
output_ open_ stdout - Open the general user output stream as a Tectonic output file.
- ttbc_
output_ putc - Write a single character to a Tectonic output file.
- ttbc_
output_ ⚠write - Write data to a Tectonic output file.
- ttbc_
shell_ ⚠escape - Run a shell command