Small clean-up.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6425 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-03-10 16:21:31 +00:00
parent 7bda9a5db2
commit c663607f25
2 changed files with 11 additions and 13 deletions

View File

@ -4,6 +4,8 @@
'latex', 'dvips', 'gs' and 'pnmcrop' and move their definition to 'latex', 'dvips', 'gs' and 'pnmcrop' and move their definition to
the top of the script. the top of the script.
* scripts/lyxpreview2bitmap.sh: enable BAIL_OUT to print a message.
2003-03-10 Angus Leeming <leeming@lyx.org> 2003-03-10 Angus Leeming <leeming@lyx.org>
* images/graphics-insert.xpm: rename as * images/graphics-insert.xpm: rename as

View File

@ -72,6 +72,8 @@ FIND_IT ()
BAIL_OUT () BAIL_OUT ()
{ {
test $# -eq 1 && echo $1
# Remove everything except the original .tex file. # Remove everything except the original .tex file.
FILES=`ls ${BASE}* | sed -e "/${BASE}\.tex/d"` FILES=`ls ${BASE}* | sed -e "/${BASE}\.tex/d"`
rm -f ${FILES} texput.log rm -f ${FILES} texput.log
@ -105,9 +107,8 @@ elif [ "$3" = "png" ]; then
GSDEVICE=png16m GSDEVICE=png16m
GSSUFFIX=png GSSUFFIX=png
else else
echo "Unrecognised output format ${OUTPUTFORMAT}." BAIL_OUT "Unrecognised output format ${OUTPUTFORMAT}. \
echo "Expected either \"ppm\" or \"png\"." Expected either \"ppm\" or \"png\"."
BAIL_OUT
fi fi
# We use latex, dvips and gs, so check that they're all there. # We use latex, dvips and gs, so check that they're all there.
@ -127,8 +128,7 @@ readonly TEXFILE LOGFILE DVIFILE PSFILE METRICSFILE
cd ${DIR} cd ${DIR}
${LATEX} ${TEXFILE} || ${LATEX} ${TEXFILE} ||
{ {
echo "Failed: ${LATEX} ${TEXFILE}" BAIL_OUT "Failed: ${LATEX} ${TEXFILE}"
BAIL_OUT
} }
# Parse ${LOGFILE} to obtain bounding box info to output to # Parse ${LOGFILE} to obtain bounding box info to output to
@ -137,9 +137,8 @@ ${LATEX} ${TEXFILE} ||
# "Preview: Snippet". # "Preview: Snippet".
grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} || grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} ||
{ {
echo "Failed: grep -E 'Preview: [ST]' ${LOGFILE}"
REQUIRED_VERSION ${LOGFILE} REQUIRED_VERSION ${LOGFILE}
BAIL_OUT BAIL_OUT "Failed: grep -E 'Preview: [ST]' ${LOGFILE}"
} }
# Parse ${LOGFILE} to obtain ${RESOLUTION} for the gs process to follow. # Parse ${LOGFILE} to obtain ${RESOLUTION} for the gs process to follow.
@ -148,9 +147,8 @@ grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} ||
# not found. # not found.
LINE=`grep 'Preview: Fontsize' ${LOGFILE}` || LINE=`grep 'Preview: Fontsize' ${LOGFILE}` ||
{ {
echo "Failed: grep 'Preview: Fontsize' ${LOGFILE}"
REQUIRED_VERSION ${LOGFILE} REQUIRED_VERSION ${LOGFILE}
BAIL_OUT BAIL_OUT "Failed: grep 'Preview: Fontsize' ${LOGFILE}"
} }
# The sed script strips out everything that won't form a decimal number # The sed script strips out everything that won't form a decimal number
# from the line. It bails out after the first match has been made in # from the line. It bails out after the first match has been made in
@ -179,8 +177,7 @@ RESOLUTION=`echo "scale=2; \
# DVI -> PostScript # DVI -> PostScript
${DVIPS} -o ${PSFILE} ${DVIFILE} || ${DVIPS} -o ${PSFILE} ${DVIFILE} ||
{ {
echo "Failed: ${DVIPS} -o ${PSFILE} ${DVIFILE}" BAIL_OUT "Failed: ${DVIPS} -o ${PSFILE} ${DVIFILE}"
BAIL_OUT
} }
# PostScript -> Bitmap files # PostScript -> Bitmap files
@ -201,8 +198,7 @@ ${GS} -q -dNOPAUSE -dBATCH -dSAFER \
-dGraphicsAlphaBit=${ALPHA} -dTextAlphaBits=${ALPHA} \ -dGraphicsAlphaBit=${ALPHA} -dTextAlphaBits=${ALPHA} \
-r${RESOLUTION} ${PSFILE} || -r${RESOLUTION} ${PSFILE} ||
{ {
echo "Failed: ${GS} ${PSFILE}" BAIL_OUT "Failed: ${GS} ${PSFILE}"
BAIL_OUT
} }
# All has been successful, so remove everything except the bitmap files # All has been successful, so remove everything except the bitmap files