1
1
mirror of https://github.com/kanaka/mal.git synced 2024-10-27 14:52:16 +03:00
mal/impls/latex3/run
Nicolas Boulenguez 00d168fdca latex3: new implementation
Self hosting fails at step4 because of exceeded TeX capacity.
2024-08-08 15:40:26 -05:00

46 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -Cefu
# LaTeX creates temporary files in the current directory.
cd $(dirname $0)
# There is no way to directly provide command line arguments to LaTeX,
# use an intermediate file.
for arg; do
echo "$arg"
done >| argv
# max_print_line: prevent TeX from wrapping lines written to the
# terminal (the default is around 80 columns).
# Shell escapes are necessary for time-ms in core.sty.
# time-ms also requires to strip the output caused by accessing a subshell.
# Halt on error... should be the default.
# Remove the normal TeX initial and final output. The > characters
# confuse the test runner, especially in the *ARGV* test.
# There is no way in latex3 to check if the terminal receives an
# END_OF_FILE character, handle Emergency stop as a normal ending.
# When debugging, set DEBUG=1 to see the actual output.
max_print_line=1000 \
latex \
-shell-escape \
-halt-on-error \
${STEP:-stepA_mal}.tex \
| {
if [ -n "${DEBUG:-}" ]; then
cat
else
sed '
1,/^MAL_LATEX3_START_OF_OUTPUT$/ d
/^MAL_LATEX3_END_OF_OUTPUT$/,$ d
/^MAL_LATEX3_STRIP_ON/,/MAL_LATEX3_STRIP_OFF/ d
/^! Emergency stop[.]$/,$ d
'
fi
}