]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/ly2dvi.sh
patch::: 1.0.16.mb1: Re: LilyPond 1.0.16
[lilypond.git] / scripts / ly2dvi.sh
index 07226c8932ced9c5b80e1a20af19025815e9b4f2..b2e0330aaa078425ca1ced5d0c1ee1d36dc9afea 100644 (file)
@@ -10,7 +10,7 @@
 #  Original LaTeX file made by Mats Bengtsson, 17/8 1997
 #
 
-VERSION="0.12"
+VERSION="0.12.jcn1"
 NAME=ly2dvi.sh
 IDENTIFICATION="$NAME $VERSION" 
 NOW=`date`
@@ -21,9 +21,11 @@ echo "$IDENTIFICATION" 1>&2
 
 # NEWS
 
+# 0.12.jcn1
+#  - mudelaDefs really fixed (sorry, PC)
+
 # 0.12
 #  - -S/--sourcedir switch
-#
 
 #
 #0.11.jcn3
@@ -612,13 +614,11 @@ shift `expr $OPTIND - 1`
 if [ "$SOURCEDIR" != "" ]; then
 # apparently MakeTeXTFM can't handle relative dirs
        SOURCEDIR=`cd $SOURCEDIR; pwd`
-       export LILYINCLUDE="$SOURCEDIR/init:$SOURCEDIR/mf/out:$LILYINCLUDE"
-       export TEXINPUTS="$SOURCEDIR/tex:$TEXINPUTS:"
-       export MFINPUTS="$SOURCEDIR/mf:$MFINPUTS:"
-       export LILYPOND_EXECUTABLE="$SOURCEDIR/lily/out/lilypond"
-
-       set|grep MF
-       set|grep TEXIN
+       LILYINCLUDE="$SOURCEDIR/init:$SOURCEDIR/mf/out:$LILYINCLUDE"
+       TEXINPUTS="$SOURCEDIR/tex:$TEXINPUTS:"
+       MFINPUTS="$SOURCEDIR/mf:$MFINPUTS:"
+       LILYPOND_EXECUTABLE="$SOURCEDIR/lily/out/lilypond"
+       export MFINPUTS LILYPOND_EXECUTABLE TEXINPUTS SOURCEDIR 
 fi
 
 #
@@ -638,20 +638,28 @@ regexp_quote(){
 #
 mudelaDefs(){
 # Include \def\mudela-definitions
+# The aim here is to pick up the definition for the 
+# current file, then any other file.
 #
+mudelatmp=$TMP/mudelaDefs$$
+# Use `cat' to prevent filenames being prepended
+# 
+cat "$File" $OF | fgrep "$MU_DEF" > $mudelatmp
 for L in $MU_DEF
 do
-  for F in "$File" "$OF"
-  do
-    LL=`sed -n 's/\\\\def\\\\'"$L"'{\([^}]*\)}.*$/\1/p' "$F"`
-    [ "$LL" ] && {
-         Echo "$1\\"$L'{'"$LL"'}%'                                >> $LatF
-         break
-    }
-  done
+    # This converts \def\mudelatitle{fred}
+    # to \mudelatitle{fred} or to
+    # \def\mudelatitle{fred}
+    # and stops after the first one found.
+    sed -n '/\\def\\'"$L"'{\([^}]*\)}.*$/{
+       s//'"`regexp_quote \"$1\"`"'\\'"$L"'{\1}%/p
+       q
+    }'  $mudelatmp  >> $LatF
 done
+rm -f $mudelatmp
 }
 #
+#
 startFile(){
 #
 # LaTeX file name