/usr/bin/faust2mathviewer is in faust 0.9.46-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #!/bin/bash
# faust2mathviewer.sh
#
# Generate a full Faust documentation, in a '*-mdoc' top directory
# and open the resulting pdf file
#
# Karim Barkati
# November 2009
#
# Warning : this script requires several things to be installed :
# - svg2pdf, from the Cairo 2D graphics library;
# - pdflatex, to compile the tex file;
# - breqn, a latex package to break equations;
# - faust ;-)
# Usage.
print_usage()
{
echo Usage : args of faust2mathviewer should be a \'.dsp\' file, or a list of \'.dsp\' files.
}
# Visit each directory transmited as argument,
# in order to convert .svg files into pdf.
# This function uses the svg2pdf command,
# from the Cairo 2D graphics library.
convert_svgdirs2pdf()
{
for DIR in $@ ; do
if [ -d $DIR ] ; then
echo "cd " $DIR
cd $DIR
FILES=`ls | grep -E "\.svg"`
for SRC in $FILES ; do
echo ' --> '$SRC
PDF=${SRC%.svg}'.pdf'
svg2pdf "$SRC" "$PDF"
echo ' <-- '$PDF
done
cd -
else
echo error : \'$DIR\' is not a directory.
fi
done
}
# Main loop of this script :
# 1. Compile `faust -mdoc` to generate the TeX file and SVG block-diagrams.
# 2. Move to the "${FILEPATH%.dsp}-mdoc" directory created by faust.
# 3. Convert SVG files into PDF files recursively (with svg2pdf).
# 4. Compile pdflatex twice (including the top-level block-diagram).
# 5. Copy some important files where needed.
if [[ $(uname) == Darwin ]]; then
OPEN=open
export PATH="/usr/texbin:$PATH"
else
OPEN=xdg-open
fi
for FILEPATH in $@ ; do
if [ -f $FILEPATH ] ; then
FILENAME=`basename $FILEPATH` &&
case $FILENAME in
*.dsp )
faust -o ${FILEPATH%.dsp}.cpp --mathdoc $FILEPATH &&
cd ${FILEPATH%.dsp}-mdoc/ &&
cd svg && convert_svgdirs2pdf svg-* && cd .. &&
cd tex && pdflatex ${FILENAME%.dsp}.tex && pdflatex ${FILENAME%.dsp}.tex && cd .. &&
mkdir -p pdf && cp tex/${FILENAME%.dsp}.pdf pdf &&
mkdir -p cpp && mv ../${FILENAME%.dsp}.cpp cpp &&
${OPEN} tex/${FILENAME%.dsp}.pdf &&
cd ..
;;
* )
echo error : \'$FILENAME\' does not have a \'.dsp\' extension.
exit 2
;;
esac
else
print_usage
exit 1
fi
done
exit 0
|