Run native editor sessions with the XeTeX profile
This commit is contained in:
1 parent
74eb1e9fc4
commit
cb6525ffca
3 files changed
+63
-4
No files matched your search
@@ -17,7 +17,10 @@ use texrra_engine::native::{
|
||||
EntryCheckpointWork, NativeCompiler, PreviewUpdate, ProjectDefinition, ProjectSnapshot,
|
||||
job_time,
|
||||
};
|
||||
use texrra_tex_core::resources::{InputPolicy, WorldConfig};
|
||||
use texrra_tex_core::{
|
||||
execution::InputProfile,
|
||||
resources::{InputPolicy, WorldConfig},
|
||||
};
|
||||
use tiny_http::{Header, Method, Request, Response, Server};
|
||||
|
||||
const MAX_EDIT_BODY: u64 = 2 * 1024 * 1024;
|
||||
@@ -172,8 +175,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
if let Some(status) = texrra_engine::native::dispatch_pdf_regex_worker() {
|
||||
std::process::exit(status);
|
||||
}
|
||||
let mut args = std::env::args_os().skip(1).map(PathBuf::from);
|
||||
let usage = "native_editor SOURCE FORMAT FORMAT_RESOURCES NEW_RUN_DIR [PORT] [FILE ...]";
|
||||
let mut args = std::env::args_os().skip(1).peekable();
|
||||
let usage = "native_editor [--input-profile tex8bit|unicode|xetex] SOURCE FORMAT FORMAT_RESOURCES NEW_RUN_DIR [PORT] [FILE ...]";
|
||||
let input_profile = if args.next_if(|arg| arg == "--input-profile").is_some() {
|
||||
match args.next().as_deref().and_then(std::ffi::OsStr::to_str) {
|
||||
Some("tex8bit") => InputProfile::TeX8Bit,
|
||||
Some("unicode") => InputProfile::UnicodeScalar,
|
||||
Some("xetex") => InputProfile::XeTeX,
|
||||
_ => return Err("--input-profile requires tex8bit, unicode or xetex".into()),
|
||||
}
|
||||
} else {
|
||||
InputProfile::TeX8Bit
|
||||
};
|
||||
let mut args = args.map(PathBuf::from);
|
||||
let source = args.next().ok_or(usage)?.canonicalize()?;
|
||||
let format = args.next().ok_or(usage)?.canonicalize()?;
|
||||
let manifest = args.next().ok_or(usage)?;
|
||||
@@ -191,7 +205,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
entry,
|
||||
editable,
|
||||
options,
|
||||
} = prepare(&source, &format, &manifest, &run, &additional)?;
|
||||
} = prepare(&source, &format, &manifest, &run, &additional, input_profile)?;
|
||||
let compiler = NativeCompiler::default().with_automatic_entry_checkpoints();
|
||||
let server = Server::http(("127.0.0.1", port)).map_err(|e| e.to_string())?;
|
||||
let queue = Arc::new(Queue {
|
||||
@@ -385,6 +399,7 @@ fn prepare(
|
||||
manifest: &Path,
|
||||
run: &Path,
|
||||
additional: &[PathBuf],
|
||||
input_profile: InputProfile,
|
||||
) -> Result<EditorProject, Box<dyn std::error::Error>> {
|
||||
let format_resources: Value = serde_json::from_slice(&fs::read(manifest)?)?;
|
||||
let roots: Vec<PathBuf> = serde_json::from_value(format_resources["texmf_roots"].clone())?;
|
||||
@@ -469,6 +484,7 @@ fn prepare(
|
||||
);
|
||||
request.entry = Entry::Format(format.into());
|
||||
request.etex = true;
|
||||
request.input_profile = input_profile;
|
||||
request.limits.steps = 600_000_000;
|
||||
request = request.observe_generated_initial();
|
||||
// Provision the finite, immutable resource bundle used by this trial.
|
||||
|
||||
Reference in new issue
Block a user