]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.49
authorfred <fred>
Sun, 24 Mar 2002 20:02:50 +0000 (20:02 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:02:50 +0000 (20:02 +0000)
20 files changed:
bin/add-URLs.in [new file with mode: 0644]
bin/clean-diaper.in [new file with mode: 0644]
bin/clean-embeds.in [new file with mode: 0644]
bin/clean-fonts.in [new file with mode: 0644]
bin/conflily.in [new file with mode: 0644]
bin/cvm.in [new file with mode: 0644]
bin/find-typenames.in [new file with mode: 0644]
bin/foo.in [new file with mode: 0755]
bin/genheader.in [new file with mode: 0644]
bin/ly2dvi.in [new file with mode: 0644]
bin/make-docxx.in [new file with mode: 0644]
bin/make-examples.in [new file with mode: 0644]
bin/make-patch.in [new file with mode: 0644]
bin/make-version.in [new file with mode: 0644]
bin/mf-deps.in [new file with mode: 0644]
bin/mf-to-table.in [new file with mode: 0644]
bin/mudela-book.in [new file with mode: 0644]
bin/ps-to-gifs.in [new file with mode: 0755]
bin/release.in [new file with mode: 0644]
bin/show-latest.in [new file with mode: 0644]

diff --git a/bin/add-URLs.in b/bin/add-URLs.in
new file mode 100644 (file)
index 0000000..a32e6f9
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# add URLs for broken perl 5.004
+
+perl -i~ -pe 's! ([a-z]+://[^ \t]+)! <a href=$1>$1</a>!g' $*
diff --git a/bin/clean-diaper.in b/bin/clean-diaper.in
new file mode 100644 (file)
index 0000000..06be904
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# unclobber current dir.
+rm -vf *.aux *.log *.orig *~
+rm -vf `grep -li "^% Creator: GNU LilyPond" *.out *.tex` 
+rm -vf `grep -li "Creator: mi2mu" *.midi.ly`
+rm -vf `grep -li "%Creator: dvipsk" *.ps`
+rm -vf `grep -li "Creator: GNU LilyPond" *.midi`
+rm -vf `grep -li "Creator: ly2dvi" *.tex`
+rm -vf `find -name 'core'`
+rm -vf `find -name '*.orig'`
+rm -vf `find -name '*.rej'`
+
+    
+# docxx mess
+rm -vf *dvi
+rm -vf *.class  HIER*.html dxxgifs.tex gifs.db icon?.gif logo.gif down.gif \
+    aindex.html index.html
diff --git a/bin/clean-embeds.in b/bin/clean-embeds.in
new file mode 100644 (file)
index 0000000..1b53f85
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+rm -f feta-sleur-[0-9x\-]*.mf
+rm -f feta-sleur-[0-9x\-]*.log
+rm -f feta-beum-[0-9x\-]*.mf
+rm -f feta-beum-[0-9x\-]*.log
+rm -f feta-embed.aux
+rm -f missfont.log
+clean-fonts sleur
+clean-fonts beum
diff --git a/bin/clean-fonts.in b/bin/clean-fonts.in
new file mode 100644 (file)
index 0000000..202a873
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+case  $# in
+0) 
+    WHAT="" ;;
+1)
+    WHAT=$1;;
+esac
+
+# should use kpsepath 
+
+if [ -d /var/lib/texmf ]; then
+    TEXDIR=/var/lib/texmf
+elif [ -d /var/texfonts ]; then
+    TEXDIR=/var/texfonts
+else
+    TEXDIR=/var/
+fi
+
+# remove possibly stale .pk/.tfm files 
+echo> /tmp/cleaning-font-dummy
+FILES=`find $TEXDIR -name "feta*$WHAT*tfm" -or -name "feta*$WHAT*pk"`
+
+echo removing $FILES
+rm  $FILES /tmp/cleaning-font-dummy
diff --git a/bin/conflily.in b/bin/conflily.in
new file mode 100644 (file)
index 0000000..a89f9e7
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# conflily
+# ugh: must be executed from lilypond-x.x.x (bin/conflily)
+
+# the lilypond root dir looks like this:
+# current -> ./lilypond-x.x.x  symlink to current source
+# lilypond-x.x.x               the lilypond source
+# patches                      gzipped patches
+# releases                     gzipped releases
+
+# the lily root dir
+#
+lelie=$HOME/music/lily
+#
+
+if [ ! -e $HOME/lelie ]; then
+       ln -s $lelie $HOME/lelie
+fi
+
+rm $lelie/current 2>&1 > /dev/null
+current=`basename \`pwd\``
+echo ln -s $lelie/$current $lelie/current
+ln -s $lelie/$current $lelie/current
+
+ln -sf $lelie/current/lily/out/lilypond bin/out/lilypond
+ln -sf $lelie/current/mi2mu/out/mi2mu bin/out/mi2mu
+
+if [ "x$LILYINCLUDE" = "x" ]; then
+       echo you should make add the following to your login script
+       echo "export LILYINCLUDE=$lelie/current/init:$lelie/current/input:$lelie/current/mutopia:$lelie/current/mutopia/out:$lelie/current/input:$lelie/current/mutopia/J.S.Bach:$lelie/current/mutopia/J.S.Bach/out"
+       echo "export PATH=$PATH:$lelie/current/bin/out/"
+       echo "export MFINPUTS=$MFINPUTS:$lelie/current/mf"
+fi
+
+configure --prefix=/usr --enable-debugging --enable-printing --enable-checking
+
diff --git a/bin/cvm.in b/bin/cvm.in
new file mode 100644 (file)
index 0000000..9654db9
--- /dev/null
@@ -0,0 +1,318 @@
+#!@PYTHON@ -w
+# -*-perl-*-
+
+version = "0.2";
+
+################################################################
+
+sub no_conv
+{
+}
+sub convert_0_0_52_to_0_0_53
+{
+
+    s/include \"/$1\\include \"/g;
+}
+
+  
+sub convert_0_0_54_to_0_0_55
+{
+    s/%{/% {/g;
+}
+
+  
+sub convert_0_0_53_to_0_0_54
+{
+    print STDERR "Not smart enough to convert \\transpose\n"    if (/\\transpose/) ;
+}
+
+# we-re not at 58 yet, but this is at least one of the rules
+sub convert_0_0_55_to_0_0_56
+{
+    s/\"\|\|\"/\"|.\"/g;
+}
+
+sub convert_0_0_56_to_0_0_57
+{
+    s/\(([ \]\[|\t-\.>]|\\[<!>a-z]+)*\)/\~ $1/g;
+}
+
+sub convert_0_0_57_to_0_0_58
+{
+    s/\[ *([^\[\]]*)\] *([1-9]*) *\/ *([1-9]*)/[$2\/$3 $1]1\/1/g;
+}
+
+sub convert_0_0_58_to_0_0_59
+{
+    die "Not smart enough to convert 0.0.58 to 0.0.59\n";
+}
+
+sub convert_0_0_59_to_0_0_60
+{
+    s/(\\unitspace [0-9.mcptin\\ ]+|\\geometric [0-9.]+|\\width [0-9.mcp\\tin]+)/$1;/g;
+    s/(\\output \"[^\"]+\")/$1;/;
+    s/(\\tempo  [0-9: ]+)/$1;/;
+}
+
+sub convert_0_0_60_to_0_0_61
+{
+    s/(\\unitspace|\\geometric|\\width)/$1=/g;
+   
+}
+
+sub convert_0_1_0_to_0_1_1
+{
+    s/\\tempo (.*):(.*);/\\tempo $1 = $2;/g
+}
+
+sub convert_0_1_2_to_0_1_3
+{
+    s/\\stem *(\\up|1) *;/\\stemup/g;
+    s/\\stem *(\\down|-1) *;/\\stemdown/g;
+    s/\\stem *0 *;/\\stemboth/g;
+    s/\\hshift ([^;]+) *;/\\property Voice.hshift = $1/g;
+}
+
+my $header_b = 0;
+
+sub generic_conversion_scan
+{
+    if (/\\header *\{/)
+    {
+       $header_b = 1;
+    }
+    if ($header_b && /^ *\}/)
+    {
+       $header_b = 0;
+    }
+}
+sub convert_0_1_4_to_0_1_5
+{
+    s/([<{]) *\\id "Piano" (.+);/\\type Grandstaff = $3 $1/;    
+    s/([<{]) *\\id (.+) (.+);/\\type $2 = $3 $1/;
+}
+
+       
+sub convert_0_1_5_to_0_1_6
+{
+    s/< *\\multi (.*);/\\multi $1 </;
+}
+
+sub convert_0_1_6_to_0_1_7
+{
+    if ($header_b) 
+    {
+       s/^([a-zA-z]+)[ \t]+(.*)$/$1 =\t \"$2\";/;
+       s/^([ \t])+(.*)$/$1 \"$2\";/;
+    }
+}  
+
+sub convert_0_1_7_to_0_1_8
+{
+    s/\\plet *1 *\/ *1 *;/\\]/;    
+    s/\\plet *([1-9][0-9]*) *\/ *([2-9][0-9]*) *;/\\[$1\/$2/;    
+}  
+
+sub convert_0_1_8_to_0_1_9
+{
+# sticky plet shorthand...
+#  print "introduced plet and finger shorthands...\n";
+}
+
+###############################################################
+
+sub    last_conversion
+{
+    my @v = &versions;
+    return pop @v;
+}
+sub identify
+{
+    
+    print STDERR "This is convert-mudela " . $convert_mudela_version . 
+       " (up to mudela version ", last_conversion,     ")\n";
+}
+  
+  
+ sub usage
+  {
+     print STDERR "Usage: convert-mudela [options] [mudela-file]...\n"
+     . "Convert old mudela source from mudela-file or stdin\n\n"
+     . "Options:\n"
+     . "  -e, --edit             perform in-place conversion\n"
+     . "  -f, --from=PATHLEVEL   use source version 0.0.PATCHLEVEL\n"
+     . "  -h, --help             print this help\n"
+     . "  -o, --output=FILE      name output file\n"
+     . "  -s, --show-rules       print all known conversion rules\n"
+     . "  -t, --to=VERSION       convert to version VERSION\n"
+  }
+      
+
+my %minor_conversions = ("0.0.50" => \&no_conv,
+                        "0.0.52" => \&convert_0_0_50_to_0_0_52,
+                        "0.0.53" => \&convert_0_0_52_to_0_0_53,
+                        "0.0.54" => \&convert_0_0_53_to_0_0_54,
+                        "0.0.55" => \&convert_0_0_54_to_0_0_55,
+                        "0.0.56" => \&convert_0_0_55_to_0_0_56,
+                        "0.0.57" => \&convert_0_0_56_to_0_0_57,
+                        "0.0.58" => \&convert_0_0_57_to_0_0_58,
+                        "0.0.59" => \&convert_0_0_58_to_0_0_59,
+                        "0.0.60" => \&convert_0_0_59_to_0_0_60,
+                        "0.0.61" => \&convert_0_0_60_to_0_0_61,
+                        "0.1.1" => \&convert_0_1_0_to_0_1_1,
+                        "0.1.2" => \&no_conv,
+                        "0.1.3" => \&convert_0_1_2_to_0_1_3,
+                        "0.1.4" => \&no_conv,
+                        "0.1.5" => \&convert_0_1_4_to_0_1_5,
+                        "0.1.6" => \&convert_0_1_5_to_0_1_6
+                        ,"0.1.7" => \&convert_0_1_6_to_0_1_7
+                        ,"0.1.8" => \&convert_0_1_7_to_0_1_8
+                        ,"0.1.9" => \&convert_0_1_8_to_0_1_9
+                        );
+
+
+sub versions 
+{
+    return (sort { cmpver; } (keys %minor_conversions));
+}
+
+
+sub show_rules
+{
+    my (@v) = versions;
+
+    print "Rules: ", join(", ", @v), "\n";
+    
+}
+
+sub do_conversion
+{
+    my ($from,$to) = @_;
+
+    my @applicable_conversion;
+    my @mudela_levels;
+    
+    my @v = versions;
+    foreach $ver (@v) {
+       if (version_compare($ver, $from) > 0 && version_compare($ver,$to) <= 0 ){ 
+           push @applicable_conversion, $minor_conversions{$ver};
+           push @mudela_levels, $ver;
+       }
+    }
+    
+    print STDERR "Applying following rules: ", join(", ", @mudela_levels) , "\n";
+
+    while (<INLY>) {
+       generic_conversion_scan;
+       foreach $subroutine (@applicable_conversion) {
+       
+           &$subroutine;
+           
+       }
+       version_string_conv $from, $to;
+       print OUTLY;
+    }
+}
+
+sub get_auto_from
+{
+    my ($fn)=@_;
+    my ($ver);
+    open INLY, $fn || die "Can't open";
+
+    while (<INLY>) {
+       s/^.*\\version \"([^\"]*)\".*$//;
+       if (defined ($1)) {
+           print STDERR "Guessing version: ", $1, ".. ";
+           $ver = $1;
+           last;
+       }
+    }
+    if (!defined($ver)){
+       print STDERR "can't determine mudela version in $fn.\n";
+       my $u;
+       return $u;
+    }
+    close INLY;
+    return $ver;
+}   
+
+sub  set_files 
+{
+    $infile = "-";
+    $outfile = "-";
+    $outfile = $opt_output if (defined($opt_output));
+
+    if ($ARGV [0])  {
+       $infile = $ARGV[0];
+    } 
+    if (!(-f $infile) && !($infile =~ /\.ly$/s)) {
+       $infile .= ".ly";
+    }
+    if ($opt_edit && $infile ne "-") {
+       $opt_edit = 1;
+       $outfile = "$infile.NEW";
+       $infile = "$infile";
+    }
+    print STDERR "Input ", (($infile eq "-") ?"STDIN" : $infile), " .. ";
+
+}
+
+sub do_one_arg
+{
+    set_files;
+
+    local ($from_version, $to_version);
+    $from_version = $opt_from;
+    $to_version = $opt_to;
+    
+    ($from_version = get_auto_from $infile) unless defined($opt_from);
+    return if (!defined($from_version));
+    
+    ($to_version =  last_conversion) unless (defined($opt_to));
+
+    die "can't open \`$infile\'" unless open INLY,$infile ;
+    die "can't open \`$outfile\'" unless open OUTLY, ">$outfile";
+    
+    do_conversion $from_version, $to_version;
+    close INLY;
+    close OUTLY;
+
+    if ($opt_edit) {
+       rename $infile, "$infile~";
+       rename $outfile, "$infile";
+    }
+}
+
+## "main"
+
+identify;
+
+
+GetOptions ("help", "output=s", "from=i", "to=i", "minor=i", "edit", "show-rules");
+
+if ($opt_help) {
+    usage();
+    $opt_help = 0;     # to extinguish typo check.
+    exit 0;
+}
+
+if ($opt_show_rules) { 
+    show_rules ;
+    $opt_show_rules = 0;       # to extinguish typo check.
+    exit 0;
+}
+
+local ( $infile,$outfile);
+my $processed_one=0;
+
+while (defined($ARGV[0])) {
+    do_one_arg;
+    shift @ARGV;
+    $processed_one = 1;
+}
+do_one_arg unless ($processed_one);
+
+    
diff --git a/bin/find-typenames.in b/bin/find-typenames.in
new file mode 100644 (file)
index 0000000..890f9ca
--- /dev/null
@@ -0,0 +1,20 @@
+#!@PERL@
+
+open GREP, "egrep -h '^struct|^class' *.hh *.cc|";
+open OUT, "|sort | uniq";
+while (<GREP>) {
+
+       s/^struct/class/;
+       if (! /; *$/) {
+               s/:[^{]+{.*$//;
+               s/ *{.*$/;/;
+       }
+       if (! /; *$/) {
+               chop;
+               $_ .= ";\n";
+               
+       }
+       print OUT;
+}
+close OUT;
+close GREP;
diff --git a/bin/foo.in b/bin/foo.in
new file mode 100755 (executable)
index 0000000..36ac368
--- /dev/null
@@ -0,0 +1 @@
+#! /bin/bash
diff --git a/bin/genheader.in b/bin/genheader.in
new file mode 100644 (file)
index 0000000..57f0e9f
--- /dev/null
@@ -0,0 +1,135 @@
+#!@PYTHON@
+
+# 
+# genheader.py -- do headers (like these) 
+# 
+# source file of the GNU LilyPond music typesetter
+# 
+# (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+# 
+
+
+
+import posix
+import pwd
+import regex
+import regsub
+import string
+import sys
+import os
+import getopt
+
+class My_options:
+    def __init__(self):
+       self.commentify = None
+       self.add_hdr_def = 0
+       self.classname = ''
+
+my_options = My_options()
+
+def mail():
+    return os.environ['MAILADDRESS']
+
+def name():
+    return pwd.getpwuid(posix.getuid())[4]
+
+def c_commentify(str):
+    return  '/* ' + regsub.gsub('^','  ', str) + '\n */';
+
+def sh_commentify(str):
+    return regsub.gsub('^', '# ', str)
+
+def tex_commentify(str):
+    return regsub.gsub('^', '% ', str)
+
+def project_str():
+    cwd = posix.getcwd()
+    if regex.search('flower', cwd) <> -1:
+       PROJECT = "the Flower Library"
+    elif regex.search('mf$', cwd) <> -1:
+       PROJECT = "the Feta (defintively not an abbreviation for Font-En-Tja) music font"
+    else:
+       PROJECT = "the GNU LilyPond music typesetter"
+    return PROJECT
+
+def head_str(filename):
+    if my_options.add_hdr_def:
+       what = "declare " 
+    else:
+       what=" implement "
+
+
+    headstr = '\n%s -- %s\n\nsource file of %s\n\n(c) 1997 %s <%s>\n' \
+             %(filename, what, project_str(), name(), mail())
+    return headstr
+
+
+def c_include(filename):
+    startdef= filename;
+    trans = string.maketrans( string.lowercase + '-.', string.uppercase + '__')
+    startdef = string.translate(filename, trans)
+
+   
+    headstr = "\n\n#ifndef %s\n#define %s\n" % (startdef, startdef)
+    terminatestr = "#endif /* %s */\n"  % (startdef);
+
+    return headstr+ '\n\n'+ terminatestr;
+
+
+
+
+
+(options, files) = getopt.getopt(sys.argv[1:], 'tcsh', ['class']) 
+
+for opt in options:
+    o = opt[0]
+    a = opt[1]
+    if o == '-c':
+       my_options.commentify = c_commentify
+    elif o == '-t':
+       my_options.commentify = tex_commentify
+    elif o == '-s':
+       my_options.commentify = sh_commentify
+    elif o == '-h':
+       my_options.add_hdr_def = 1
+    elif o == '--class':
+       my_options.classname = a
+
+
+
+#
+# FIXME:  should create xxx.cc and include/xxx.hh, with implement/declare Xxx
+# in  one run
+if my_options.classname:
+    pass
+       
+def do_file(nm):
+    s = my_options.commentify(head_str(nm)) 
+    if my_options.add_hdr_def:
+       s = s + c_include(nm)
+    return s
+
+
+def extension(ext,nm):
+    ext = '\\.' + ext
+    return regex.search(ext, nm) <> -1
+
+def c_extension(nm):
+    return extension('hh',nm) or extension('cc',nm) \
+          or extension('icc', nm) or extension('tcc',nm)
+def select_commentification(nm):
+    if c_extension (nm):
+       return c_commentify
+    elif extension('py',nm) or extension('pl',nm) or extension('sh',nm):
+       return  sh_commentify
+    elif extension('mf',nm) or extension('tex',nm) or extension('ly',nm):
+       return tex_commentify
+    else: 
+       raise 'help'
+
+for nm in files:
+    if extension('hh', nm) or extension('icc', nm) or  extension('tcc', nm): 
+       my_options.add_hdr_def = 1
+    if my_options.commentify == None:
+       my_options.commentify = select_commentification(nm)
+    print do_file(nm)
diff --git a/bin/ly2dvi.in b/bin/ly2dvi.in
new file mode 100644 (file)
index 0000000..e20f85a
--- /dev/null
@@ -0,0 +1,594 @@
+#!/bin/sh
+#
+# Script to make a LaTeX file for Lilypond
+#
+# Written by Jan Arne Fagertun <Jan.A.Fagertun@energy.sintef.no>
+#  Sat Nov 22 22:26:43 CET 1997
+#
+#  Original LaTeX file made by Mats Bengtsson, 17/8 1997
+#
+
+VERSION="0.7"
+NAME=ly2dvi.sh
+IDENTIFICATION="$NAME $VERSION" 
+NOW=`date`
+echo "$IDENTIFICATION" 1>&2
+
+# TODO
+
+# 0.7
+#      - Improved Lilypond error checking
+#      - Output orientation (landscape...). Overrides mudela file
+#        variable orientation="landscape";
+#      - Paper width and heigth put into variables (only A4!)
+#      - Adjusted top margin to default.....
+#
+#TODO
+#      - Include more papersizes.
+#      - Manual page.......
+#      - should detect crashing lilypond
+
+
+# NEWS
+    
+# 0.6.hwn1.jaf
+#      - LILYINCLUDE update
+#
+# 0.6.hwn1
+#      - handle LILYINCLUDE
+#       - --output
+#
+# 0.6
+#      - Source rc-files, if present. Files are:
+#        /usr/local/share/lilyrc /etc/lilyrc $HOME/.lilyrc ./.lilyrc
+#      - tee output from Lilypond
+#      - Handles margins for A4 paper (equal on both sides)
+#      - new option -s (--separate) for one LaTeX run per file,
+#        else all files are run together
+
+# 0.5
+#      - More useful ("two-level") debug.
+#      - The Q&D hack to find file names and not handling \include
+#        is replaced by grabbing output file names from Lilypond.
+#      = Detects multiple output files - adds them when running
+#        LaTeX.
+#      - Works with multiple input files - no matter if they are
+#        (a mix of) input to or output from Lilypond.
+#
+#TODO
+#      - Still no margins handling.
+#      - We have to discuss how to handle multiple output files
+#        from Lilypond - 'ly2dvi standchen' gives a rather odd
+#        result....
+
+# 0.4.1
+#      - Always exit after printing help info
+# 0.4
+#      - Changes to ensure for more strict grep'ing of parameters
+#        Thanks to from G.B.Stott@bolton.ac.uk
+#      - More efficient use of sed -e 's///' -e 's///'
+#        Thanks to Johan Vromans <jvromans@squirrel.nl> and GBS
+#      - Ask tex for location of titledefs.tex (Thanks to JV)
+#      - Accept only exact match of "\def\mudelacomposer{"
+#        (or whatever mudela* defined in titledefs.tex)
+#      - Even more efficient use of sed (Thanks to JV)
+#      - Default file name for single output file implemented.
+#      - Moved help into function - finally included from 0.1.jcn1
+#
+#TODO
+#      - Still doesn't handle \include
+#      - The Q&D for finding output file name from the sequence of
+#        \paper \output \midi \output really needs to be looked at.
+#        I have improved it a lot, but it's only capable of finding
+#        one (the last) file name.
+#        Well, I have to rewrite this entirely to handle \include,
+#        then I can fix it.
+#      - Still no margins handling.
+#
+#WARNING
+#      - Some lines of output from lilypond do NOT start
+#        at first character position, therefore I have removed "^"
+#        in sed'ing and grep'ing.
+
+# 0.3.hwn1
+#      - add "Creator: " line to output
+#
+# 0.3
+#      - multiple input files to make score from several files
+#        (extra files assumed to be Lilypond output)
+#      - cp dvi-file instead of mv, to allow for xdvi reload
+#      - check for illegal long options
+#      - put in pt in text width, if not given
+#      - put in \nonstopmode in LaTeX file
+#      - restored LaTeX exit value check
+# 0.2.1
+#      - temporarily omit LaTeX exit value check
+#      - remove ALL temporary files
+
+# 0.2
+#      - fix for solaris          - included from 0.1.jcn1
+#      - long option hack         - included from 0.1.jcn1 - modified
+#      - moved help into function - NOT included from 0.1.jcn1 yet
+#      - various improvements     - included from 0.1.jcn1
+#      - find mudela definitions from titledefs.tex
+#      - find papersize from lilypond output file (mudelapapersize),
+#        overridden by option '-p size' or '--papersize=size'
+#      - option -l lang or --language=lang overrides
+#        lilypond output file definition (mudelalanguage)
+#      - textwidth from lilypond output file (mudelapaperlinewidth)
+
+# 0.1.jcn1
+#      - fix for solaris
+#      - long option hack
+#      - moved help into function
+
+#
+# print usage
+#
+help() {
+  cat << EOF
+Generate dvi file from mudela or lilypond output
+Usage: $0 [options] file[s]
+
+Options:
+  -D, --debug           set debug mode
+  -O, --orientation=    set orientation (landscape or portrait (default))
+  -o, --output=         set output directory
+  -h, --help            this help text
+  -k, --keep            keep LaTeX file
+  -l, --language=       give LaTeX language (babel)
+  -p, --papersize=      give LaTeX papersize (eg. a4paper)
+  -s, --separate        run all files separately through LaTeX
+
+  files may be (a mix of) input to or output from lilypond(1)
+EOF
+}
+
+PWIDTH=600;                            # Width of A4 paper!
+PHEIGTH=830;                            # Heigth of A4 paper!
+#
+# RC-files ?
+#
+for D in /usr/local/share/ /etc/ $HOME/. ./.
+do
+  RCfile=$D"lilyrc"
+  [ -f $RCfile ] && . $RCfile
+done
+
+#
+# Keywords defined in titledefs.tex
+#
+TF=`kpsewhich -n tex tex titledefs.tex`
+if [ -n $TF ]
+then
+  TF=/usr/lib/texmf/tex/lilypond/titledefs.tex
+fi
+MU_DEF=""
+if [ -f $TF ]
+then
+  MU_DEF=`egrep "^.newcommand...mudela" $TF | \\
+    sed -e 's/^.newcommand...//' -e 's/\\}.*$//'`
+fi
+
+if [ -z "$MU_DEF" ]
+then
+  MU_DEF="mudelatitle mudelasubtitle mudelacomposer \
+          mudelaarranger mudelainstrument"
+fi
+
+#
+# debugging
+#
+debug_echo=true
+#
+# All files in one LaTeX run
+#
+SEPFILE=N
+#
+# Find command line options and switches
+#
+# "x:" x takes argument
+#
+switches="DO:hkl:o:p:s\?"
+options=""
+#
+# ugh, "\-" is a hack to support long options
+# while getopts \-:$options$switches O
+# must be in double quotes for bash-2.0
+while getopts "\-:$options$switches" O
+do
+  $debug_echo "O: \`$O'"
+  $debug_echo "arg: \`$OPTARG'"
+  case $O in
+    D  )
+      if [ $debug_echo = echo ]
+      then
+        set -x
+      fi
+      debug_echo=echo
+      ;;
+    O  )
+      ORI=$OPTARG
+      ;;
+    h  )
+      help;
+      exit 0
+      ;;
+    k  )
+      KEEP=Y
+      ;;
+    l  )
+      LNG=$OPTARG
+      ;;
+    o  )
+      OUTPUTDIR=$OPTARG
+      ;;
+    p  )
+      PSZ=$OPTARG
+      ;;
+    s  )
+      SEPFILE=Y
+      ;;
+    \? )
+      help;
+      exit -1
+      ;;
+    # a long option!
+    -)
+      $debug_echo "long option: \`$OPTARG'"
+      case "$OPTARG" in
+        D*|-D*)
+          if [ $debug_echo = echo ]
+          then
+            set -x
+          fi
+          debug_echo=echo
+          ;;
+        h*|-h*)
+          help;
+         exit 0
+          ;;
+        k*|-k*)
+          KEEP=Y
+          ;;
+        l*|-l*)
+          LNG=`echo $OPTARG | sed -e s/"^.*="//`
+          ;;
+        p*|-p*)
+          PSZ=`echo $OPTARG | sed -e s/"^.*="//`
+          ;;
+       or*|-or*)
+         ORI=`echo $OPTARG | sed -e s/"^.*="//`
+         ;;
+       ou*|-ou*)
+         OUTPUTDIR=`echo $OPTARG | sed -e s/"^.*="//`
+         ;;
+        s*|-s*)
+         SEPFILE=Y
+          ;;
+        *|-*)
+          echo $0": illegal option -- "$OPTARG;
+          help;
+          exit -1
+          ;;
+      esac
+  esac
+done
+shift `expr $OPTIND - 1`
+#
+# Input file name
+#
+if [ "$1" = "" ]
+then
+  help
+  $debug_echo $IDENTIFICATION": No input file name given"
+  exit 1
+fi
+#
+startFile(){
+#
+# LaTeX file name
+#
+if [ "$KEEP" != "Y" ]
+then
+  if [ "$TMP" = "" ]
+  then
+    TMP=/tmp
+  fi
+  if [ ! -d $TMP ]
+  then
+    $debug_echo $IDENTIFICATION": temporary directory "$TMP" not found, set to /tmp"
+    TMP=/tmp
+  fi
+#
+  BN=`basename $File .tex`
+  FN=$BN.$$
+  LF=$TMP/$FN.tex
+else
+  BN=`basename $File .tex`
+  FN=$BN.$$
+  LF=$FN.tex
+fi
+#
+# Find:
+#   paper size        (PSZ, overridden by command line option -p)
+#   paper orientation (ORI, overridden by command line option -o)
+#   language          (LNG, overridden by command line option -l)
+#   textwidth
+#
+eval `sed -n \\
+  -e 's/\\\\def\\\\mudelapapersize{\([^}]*\).*$/fPSZ=\1;/p' \\
+  -e 's/\\\\def\\\\mudelaorientation{\([^}]*\).*$/fORI=\1;/p' \\
+  -e 's/\\\\def\\\\mudelalanguage{\([^}]*\).*$/fLNG=\1;/p' \\
+  -e 's/\\\\def\\\\mudelapaperlinewidth{\([^}]*\).*$/TWN=\1;/p' \\
+    $File`
+if [ -z "$PSZ" ]
+then
+  PSZ=$fPSZ
+fi
+if [ ! -z "$PSZ" ]
+then
+  PAPEROPT=$PSZ
+fi
+#
+if [ -z "$ORI" ]
+then
+  ORI=$fORI
+fi
+if [ ! -z "$ORI" ]
+then
+  if [ -z "$PAPEROPT" ]
+  then
+    PAPEROPT=$ORI
+  else
+    PAPEROPT=$PAPEROPT,$ORI
+  fi
+fi
+#
+if [ ! -z "$PAPEROPT" ]
+then
+  PAPER="["$PAPEROPT"]"
+fi
+#
+if [ -z "$LNG" ]
+then
+  LNG=$fLNG
+fi
+if [ ! -z "$LNG" ]
+then
+  LLNG="\usepackage["$LNG"]{babel}"
+else
+  LLNG="%"
+fi
+
+#
+# Find textwidth
+#
+if [ ! -z "$TWN" ]
+then
+  TW=$TWN
+  case $TW in
+    *mm)
+      ;;
+    *cm)
+      ;;
+    *pt)
+      ;;
+    *)
+      TW=$TW"pt"
+      ;;
+  esac
+  $debug_echo "Text width = "$TW
+fi
+TWp=`echo $TW | sed -e 's/\..*$//'`
+PWp=$PWIDTH
+if [ "$ORI" = "landscape" ]
+then
+  PWp=$PHEIGTH
+fi
+MARG=`expr $PWp - $TWp`
+MARG=`expr $MARG / 2`"pt"
+#
+# Geometry: /var/lib/texmf/latex/geometry/geometry.dvi
+#
+#
+# Write LaTeX file
+#
+cat << EOF > $LF
+% Creator: $IDENTIFICATION
+% Automatically generated from  $IF, $NOW
+
+\documentclass$PAPER{article}
+\nonstopmode
+$LLNG
+\usepackage{geometry}
+\usepackage[T1]{fontenc}
+%\addtolength{\oddsidemargin}{-1cm}
+%\addtolength{\topmargin}{-1cm}
+\setlength{\textwidth}{$TW}
+%\geometry{width=$TW, left=$MARG, top=1cm}
+\geometry{width=$TW, left=$MARG}
+\input lilyponddefs
+\input titledefs
+\begin{document}
+EOF
+#
+# Include \def\mudela-definitions
+#
+for L in $MU_DEF
+do
+  LL=`egrep '^\\\\def.'$L'{' $OF`
+  if [ "$LL" != "" ]
+  then
+    LLL=`echo $LL | sed -e 's/}.*$//' -e 's/.*{//'`
+    if [ "$LLL" != "" ]
+    then
+      echo '\'$L'{'$LLL'}%'                                >> $LF
+    fi
+  fi
+done
+#
+cat << EOF >> $LF
+\makelilytitle
+EOF
+}
+#
+# Conclusion
+#
+endFile(){
+cat << EOF >> $LF
+\vfill\hfill{(\LilyIdString)}
+\end{document}
+EOF
+#
+# Run LaTeX
+#
+latex $LF || exit 5
+#
+# Rename dvi file
+#
+if [ -f $FN.dvi ]
+then
+    RESULT=$BN.dvi
+    if [ x$OUTPUTDIR != x ]; then
+       RESULT="$OUTPUTDIR/$RESULT"
+    fi
+    cp $FN.dvi $RESULT
+fi
+#
+# Clean up
+#
+if [ "$KEEP" != "Y" ]
+then
+  rm $LF $FN.*
+fi
+#
+# Output some info
+#
+cat << EOF
+
+$IDENTIFICATION: dvi file name is $RESULT
+
+EOF
+}
+
+# ugh. GF is side-effect.
+findInput() {
+# should check for LILYINCLUDE
+  for lypath in "." `echo $LILYINCLUDE| sed 's/:/ /g'`
+  do
+    if [ -f "$lypath/$1" ]
+    then
+      GF="$lypath/$1"
+      return       
+    fi
+
+    if [ -f "$lypath/$1.ly" ]
+    then
+      GF="$lypath/$1.ly"
+      return
+    fi
+  done
+  $debug_echo $IDENTIFICATION": Input file "$GF" not found"
+  echo $NAME": Input file "$GF" not found"                       1>&2
+  exit 2
+}
+#
+# Loop through all files
+#
+for GF in $*
+do
+    findInput $GF
+
+  #
+  # Check whether the file is input to or output from lilypond
+  #
+  L1=`head -1 $GF` 
+  OP=`echo $L1 | grep "^% Creator: GNU LilyPond"`
+  if [ -n "$OP" ]
+  then
+    #
+    # OK - it's the output from lilypond.
+    #
+    # Get lilypond source file name
+    #
+    OF=$GF
+    IFL=`grep mudelafilename $OF`
+    if [ "$IFL" != "" ]
+    then
+      IF=`echo $IFL | sed -e 's/.*{//' -e 's/}*.$//'`
+      #
+      # Check if source file exists
+      #
+      if [ ! -f $IF ]
+      then
+        $debug_echo $IDENTIFICATION": Mudela file not found."
+        TW=15.5cm
+      fi
+    else
+      $debug_echo $IDENTIFICATION": Mudela file name not found."
+      TW=15.5cm
+    fi
+  else
+    #
+    # I have to assume this is the lilypond input file
+    # Find output file name, if defined
+    #
+    IF=$GF
+    #
+    # Run lilypond
+    # Grab output file names
+    #
+    $debug_echo "lilypond "$IF
+
+    lilypond $IF 2>&1  | tee /tmp/lilylog.$$
+    OF=`egrep '^TeX output to ' /tmp/lilylog.$$ | \\
+        sed -e 's/TeX output to//' -e 's/\.\.\.//'`
+    $debug_echo "==> "$OF
+    STATUS=`grep -i error /tmp/lilylog.$$`
+    rm /tmp/lilylog.$$
+    if [ ! -z "$STATUS" ]
+    then
+      exit 10
+    fi
+  fi
+  #
+  # "Spin through" all the files
+  #
+  for File in $OF
+  do
+    $debug_echo "--- "$File
+    #
+    # Check if output file is generated
+    #
+    if [ ! -f $File ]
+    then
+      $debug_echo $IDENTIFICATION": hmm, I could not find the output file "$File
+      exit 4
+    fi
+    #
+    # Is this the first file?
+    #
+    if [ -z "$FFile" ]
+    then
+      FFile=$File
+      startFile
+    fi
+    cat << EOF >> $LF
+\input{$File}
+EOF
+    if [ $SEPFILE = Y ]
+    then
+      FFile=""
+      endFile
+    fi
+  done
+done
+if [ $SEPFILE = N ]
+then
+  endFile
+fi
+#
+# OK - finished
+#
diff --git a/bin/make-docxx.in b/bin/make-docxx.in
new file mode 100644 (file)
index 0000000..b274731
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+if [ x$LILYTOP = x ];
+then
+    LILYTOP = .
+fi
+p1=`find $LILYTOP -name '*.hh' |egrep -v out/` 
+p2=`find $LILYTOP -name '*.cc' |egrep -v out/`
+doc++ -f -d docxx/ -S -k -p $BANNEROPT $p1 $p2
diff --git a/bin/make-examples.in b/bin/make-examples.in
new file mode 100644 (file)
index 0000000..620a28a
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+# make-examples
+
+examples="twinkle-pop wtk1-fugue2 standchen-16 standchen-20 wtk1-prelude1 toccata-fuga-E scsii-menuetto cadenza gallina twinkle collisions font font20 scales rhythm multi spacing beams stem"
+pss=$(echo $examples | sed "s/[^ ][^ ]*/out\\/&.ps/g")
+
+# cd ~/lelie/current/Documentation/out
+cd ~/lelie/current/input
+make -C ../Documentation $pss
diff --git a/bin/make-patch.in b/bin/make-patch.in
new file mode 100644 (file)
index 0000000..0f5ee30
--- /dev/null
@@ -0,0 +1,136 @@
+#!@PYTHON@
+
+import sys
+import os
+
+lilypath =''
+try:
+    lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
+except KeyError:
+    print 'Please set LILYPOND_SOURCEDIR to the toplevel source, eg LILYPOND_SOURCEDIR=/home/foobar/lilypond-1.2.3/'
+    sys.exit(1)
+
+lilypath = lilypath + '/bin/'
+sys.path.append(lilypath)
+
+
+from lilypython import *
+import getopt
+import pipes
+
+
+mp_version = '0.3'
+
+class Options:
+    def __init__(self):
+       self.to_version = lilydirs.version_tuple()
+       self.from_version = prev_version(self.to_version)
+
+options = Options()
+       
+
+def help():
+    sys.stdout.write(
+       'Generate a patch to go to this version.\n'
+       '  --from=FROM, -f FROM    old is FROM\n'
+       '  --to=TO, -t TO          to version TO\n'  
+       
+       )
+
+
+
+def untar(fn):
+    # os.system('pwd');
+    sys.stderr.write('untarring ' + fn + '\n')
+# can't seem to fix errors:
+# gzip: stdout: Broken pipe
+# tar: Child returned status 1
+#   os.system ('tar xzf ' + fn)
+#   sys.stderr.write('\n')
+# ugh, even this does not work, but one error message less :-)
+    os.system ('gzip --quiet -dc ' + fn + '| tar xf - ')
+# so print soothing message:
+#    sys.stderr.write('make-patch:ugh: Please ignore error: gzip: stdout: Broken pipe\n');
+    sys.stderr.flush()
+
+
+header = 'Generated by make-patch, old = %s, new = %s\n\
+\n\
+usage \n\
+\n\
+       cd lilypond-source-dir; patch -E -p0 < %s\n\
+\n\
+Patches do not contain automatically generated files, \n\
+i.e. you should rerun configure\n\n'
+
+pats = ['*.lsm', 'configure', '*.txt', 'lilypond.spec']
+def remove_automatic(dirnames):
+    files = []
+    files = files + multiple_find(pats, dirnames)
+
+    for f in files:
+       os.remove(f)
+
+def makepatch(fv, tv, patfile_nm):
+    import tempfile
+    prev_cwd = os.getcwd();
+    try:
+       os.mkdir ('/tmp/make-patch');
+    except:
+       pass
+       
+    os.chdir ('/tmp/make-patch');
+    untar(released_tarball(fv))
+    untar(released_tarball(tv))
+    remove_automatic([dirname(fv), dirname(tv)])
+
+    os.chdir(dirname(tv))
+    
+    if not patfile_nm:
+       patfile_nm = '../patch-%s' % version_tuple_to_str(tv)
+
+    f = open(patfile_nm, 'w')
+    f.write(header %\
+           (version_tuple_to_str(fv), version_tuple_to_str(tv), \
+            os.path.basename(patfile_nm)))
+    f.close()
+           
+    sys.stderr.write('diffing to %s... ' % patfile_nm)
+    os.system('diff -urN ../%s . >> %s' % (dirname(fv), patfile_nm))
+    #os.system('gzip -9f %s' % patfile_nm)
+    os.chdir('/tmp/make-patch')
+
+    sys.stderr.write('cleaning ... ')
+    os.system('rm -fr %s %s' % (dirname(tv), dirname(fv)))
+    sys.stderr.write('\n')
+    os.chdir(prev_cwd)
+    
+def main():
+    os.environ['GZIP'] = '-q'
+    sys.stderr.write('This is make-patch version %s\n' % mp_version)
+    (cl_options, files) = getopt.getopt(sys.argv[1:], 
+                                       'hf:o:t:', ['output=', 'help', 'from=', 'to='])
+    outfn = ''
+    for opt in cl_options:
+       o = opt[0]
+       a = opt[1]
+       if o == '--from' or o == '-f':
+            options.from_version = version_str_to_tuple(a)
+       elif o == '--to' or o == '-t':
+           options.to_version = version_str_to_tuple(a)
+       elif o== '--help' or o == '-h':
+           help()
+           return 0;
+       elif o == '--output' or o == '-o':
+           outfn = os.path.join(os.getcwd(), a)
+       else:
+           raise getopt.error
+
+    if not outfn:
+       pn = 'patch-%s' % version_tuple_to_str(options.to_version)
+       outfn =  os.path.join(os.getcwd(), pn)
+
+    makepatch(options.from_version, options.to_version, outfn)
+
+if __name__ == '__main__':
+    main()
diff --git a/bin/make-version.in b/bin/make-version.in
new file mode 100644 (file)
index 0000000..3be1435
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#shift;
+if test "x$1" = x;
+then
+    versionfile="VERSION"
+else
+    versionfile=$1;
+fi
+
+cat $versionfile| sed 's/#.*$//g'|sed 's/\([^ ]*\)[\t ]*=[ \t]*\([^ ]*\)$/#define \1 \"\2\"/g' 
+echo
+    
diff --git a/bin/mf-deps.in b/bin/mf-deps.in
new file mode 100644 (file)
index 0000000..6d022ff
--- /dev/null
@@ -0,0 +1,88 @@
+#!@PYTHON@
+
+# 
+# mf-deps.py -- dependencies for metafont 
+# 
+# source file of the GNU LilyPond music typesetter
+# 
+# (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+# 
+
+
+"""look into metafont source for dependencies.
+
+ fixme: python path
+ fixme: error reporting
+ fixem: python sucks slightly: why doesn't it have closures?
+
+"""
+
+from regex import * ;
+from regsub import * ;
+import sys;
+import os;
+
+
+version = "0.2"
+input_re = compile('^[ \t]*input *\([^;]+\);')
+postfixes = ['log', 'dvi', '2602gf', 'tfm']
+
+def identify ():
+    return "mf-deps.py %s" % version
+
+
+
+def print_one(x):
+    print x
+
+def line_concat(x,y):
+    return x + '\n' +  y
+
+class Targetdeps:
+    """Dependencies for one toplevel sourcefile
+
+    """
+    
+    def __init__(self,nm):
+       split = os.path.splitext(nm)    
+       self.basename=split[0];
+       self.depfiles = []
+       self.checkdep(nm)
+       
+    def checkdep(self, name):
+       split = os.path.splitext(name)
+       name = split[0] + '.mf';
+
+       if name not in self.depfiles:
+           self.get_filedeps(name)
+
+    def get_filedeps(self,filename):
+#      print sys.stderr.write( 'checking ' + filename + '\n');
+       try:
+           file = open(filename)
+       except IOError:
+#          print sys.stderr.write( 'can\'t open ' + filename + '\n')
+           return
+
+       self.depfiles.append(filename)
+       lines = file.readlines()
+       file.close()
+       for line in lines:
+           if input_re.search (line) <> -1:
+               self.checkdep( input_re.group(1))
+
+    def target_string(self):
+       # ugh.  Closures, anyone?
+       targets =  map (lambda x,y = self.basename: 'out/' + y + '.' + x, postfixes)
+       depstring = reduce(lambda x,y: x + ' ' + y, self.depfiles) 
+       dependencies = map (lambda x, y=depstring: x + ': ' + y, targets)
+
+       return reduce(line_concat, dependencies)
+
+print "# Automatically generated by %s\n" % identify ()
+
+for file in sys.argv[1:]: # skip programname
+    t = Targetdeps(file)
+    print t.target_string()
+
+
diff --git a/bin/mf-to-table.in b/bin/mf-to-table.in
new file mode 100644 (file)
index 0000000..58c96c3
--- /dev/null
@@ -0,0 +1,222 @@
+#!@PYTHON@
+
+# 
+# mf-to-table.py -- convert spacing info in  MF logs .ly and .tex
+# 
+# source file of the GNU LilyPond music typesetter
+# 
+# (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+# 
+
+import getopt
+from string import *
+import regex
+import regsub
+import os
+import sys
+import time
+from flower import *
+
+begin_autometric_re = regex.compile('@{')
+end_autometric_re = regex.compile('@}')
+autometric_re = regex.compile('@{\(.*\)@}')
+version = '0.5'
+
+class Feta_file(File):
+    """Read Feta metrics from a metafont log-file."""
+    def read_autometricline(self):
+       line = ''
+       while end_autometric_re.search(line) == -1 and not self.eof():
+           suf = File.readline(self)
+           if begin_autometric_re.search(line) == -1:
+               line = ''
+           line = line + regsub.sub('\n','', suf)
+
+       if self.eof():
+          return ''
+
+       return line;
+    def readline(self):
+       """return what is enclosed in one @{ @} pair"""
+       line = '';
+       while autometric_re.search(line) == -1 and not self.eof():
+           line = self.read_autometricline()
+
+       if self.eof():
+           return '';
+
+       return autometric_re.group(1);
+    def __init__(self, nm):
+       File.__init__(self, nm)
+    def do_file(infile_nm):
+       infile = readline();
+
+#
+# FIXME: should parse output for {} to do indenting.
+#
+class Indentable_file(File):
+    """Output file with support for indentation"""
+    def __init__(self,nm, mode):
+       File.__init__(self,nm,mode)
+       self.current_indent_ = 0
+       self.delta_indent_ = 4
+    def writeline (self, str):
+       File.write(self, str)
+    def writeeol(self):
+       File.write(self, '\n')
+       File.write(self, ' '* self.current_indent_)
+
+    def indent(self):
+       self.current_indent_ = self.delta_indent_ + self.current_indent_;
+    def dedent(self):
+       self.current_indent_ = self.current_indent_ - self.delta_indent_;
+       if self.current_indent_ < 0:
+           raise 'Nesting!'
+
+    def write(self, str):
+       lines = split(str, '\n')
+       for l in lines[:-1]:
+           self.writeline(l)
+           self.writeeol()
+        self.writeline (lines[-1])
+
+class Ly_file(Indentable_file):
+    """extra provisions for mozarella quirks"""
+    def print_lit(self, str):
+       self.write('\"%s\"\t' % str)
+
+    def print_f_dimen(self, f):
+       dimstr = '%.2f' % f
+
+       # try to mask rounding errors
+       if (dimstr == '-0.00'):
+               dimstr = '0.00'
+       self.write( dimstr  +'\\pt\t');
+
+    def print_dimen(self, str):
+       self.print_f_dimen(atof(str))
+    
+    def neg_print_dimen(self, str):
+       self.print_f_dimen(-atof(str));
+       
+    def def_symbol(self, lily_id, tex_id, dims):
+       self.print_lit(lily_id)
+       self.print_lit('\\\\' + tex_id)
+
+       self.neg_print_dimen(dims [0])
+       self.print_dimen(dims [1])
+       self.neg_print_dimen(dims [2])
+       self.print_dimen(dims [3])
+       self.write('\n')
+       
+       
+class Log_reader:
+    """Read logs, destill info, and put into output files"""
+    def output_label(self, line):
+
+       if not line:
+           return;
+       tags = split(line, '@:')
+       label = tags[0]
+       name = tags[1]
+       ly = self.lyfile        
+       if tags[0] == 'font':
+           ly.indent()
+           ly.write("% name=\\symboltables {\n")
+           self.texfile.write("% name\n")
+       elif label == "group":
+           ly.indent()
+           ly.print_lit(name)
+           ly.write(' = \\table {\n')
+           self.texfile.write("% " + name + "\n")
+       elif label == "puorg":
+           ly.dedent()
+           ly.write("}\n")
+           self.texfile.write("\n")
+       elif label == "tnof":
+           ly.dedent()
+           ly.write("%  } % $name\n")
+       elif label == "char":
+           code = tags[2]
+           id = tags [7]
+           texstr = tags [8]
+           
+           ly.def_symbol(id, texstr, tags[3:7])
+           
+           self.texfile.write("\\fetdef\\%s{%s}\n" % (texstr, code))
+       else:
+           raise 'unknown label: ' + label
+
+
+    def do_file(self,filenm):
+       self.lyfile.write('\n% input from ' + filenm + '\n')
+       self.texfile.write('\n% input from ' + filenm + '\n')
+       feta = Feta_file(filenm)
+       while not feta.eof():
+           line = feta.readline()
+           self.output_label(line)
+       feta.close()
+
+    def __init__(self, lyfile_nm, texfile_nm):     
+       self.lyfile = Ly_file(lyfile_nm, 'w')
+       self.texfile = Indentable_file(texfile_nm, 'w')
+
+
+       headerstr = '%% Creator: %s\n%% Automatically generated on\n%% Do not edit' % \
+                  (program_id() )
+
+       self.lyfile.write(headerstr)
+       self.texfile.write(headerstr)
+
+    def close(self):
+       self.lyfile.close()
+       self.texfile.close()
+
+    def __del__(self):
+       self.close()
+
+def today_str():
+    return time.asctime(time.localtime(time.time()))
+       
+def program_id():
+    return 'mf-to-table.py version ' + version;
+
+def identify():
+    sys.stdout.write(program_id() + '\n')
+    
+def help():
+    sys.stdout.write("Usage: mf-to-table [options] LOGFILEs\n"
+                + "Generate mozarella metrics table from preparated feta log\n\n"
+                + "Options:\n"
+                + "  -h, --help             print this help\n"
+                + "  -l, --ly=FILE          name output table\n"
+                + "  -t, --tex=FILE         name output tex chardefs\n")
+
+
+def main():
+    identify()
+    (options, files) = getopt.getopt(
+       sys.argv[1:], 'hl:t:', ['ly=', 'tex=', 'debug', 'help'])
+
+    lyfile_nm = texfile_nm = '';
+    for opt in options:
+       o = opt[0]
+       a = opt[1]
+       if o == '--ly' or o == '-l':
+           lyfile_nm = a
+       elif o == '--tex' or o == '-t':
+           texfile_nm = a
+       elif o== '--help' or o == '-h':
+           help()
+       elif o == '--debug':
+           debug_b = 1
+       else:
+           raise getopt.error
+
+    log_reader = Log_reader(lyfile_nm, texfile_nm)
+    for filenm in files:
+       log_reader.do_file(filenm)
+    log_reader.close()
+
+
+main()
diff --git a/bin/mudela-book.in b/bin/mudela-book.in
new file mode 100644 (file)
index 0000000..f23b428
--- /dev/null
@@ -0,0 +1,208 @@
+#!@PERL@ -w
+# -*-Perl-*-
+my $mudcount = 0;
+my $mudela_b = 0;
+my $outname = "-";
+my $outdir;
+use Getopt::Long;
+
+
+# do something, check return status
+sub my_system
+{
+    my (@cmds) = @_;
+    foreach $cmd (@cmds) {
+       my ($ignoreret)=0;
+       if ( $cmd  =~ /^-/ ) {
+           $ignoreret = 1;
+           $cmd = substr ($cmd, 1);
+       }
+       
+       my $ret =  ( system ($cmd));
+       if ($ret) {
+           if ($ignoreret) {
+               print STDERR "ignoring failed command \`$cmd\' (status $ret)\n";
+           }else {
+               print STDERR "\nmudela-book: failed on command \`$cmd\' (status $ret)\n";
+               exit 2;
+           }
+       }
+    }
+}
+sub gen_mufile
+{
+    return "$outdir/$outname$mudcount.ly";
+}
+
+sub gen_texbase
+{
+    return "$outname$mudcount.tex";
+}
+sub gen_texfile
+{
+    return "$outdir/" . gen_texbase;
+}
+
+sub close_mudela
+{
+    $mudela_b = 0;
+    if ($fragment_b) {
+       print MUDELA "}\n \\paper { linewidth = -1.0\\cm;";
+       print MUDELA "castingalgorithm = \\Wordwrap; } }\n";
+       $fragment_b =0;
+    }
+    if ($verbatim_b)  {
+       print BOOK "\\end{verbatim}";
+    }
+    if ($center_b) {
+       print BOOK "\\end{minipage}";
+    }
+    if ($verbatim_b)  {
+       print BOOK "\\interexample";
+       $verbatim_b = 0;
+    }
+    close MUDELA;
+    my $status =0;
+    if ( -f gen_mufile ) {
+       $status = system "diff -q $outdir/book-mudela.ly " . gen_mufile;
+    } else {
+       $status = 1;
+       }
+    if ( $status ) {
+       rename "$outdir/book-mudela.ly", gen_mufile;
+       unlink gen_texfile;
+    }
+    
+    if ( ! -f gen_texfile) {
+       my_system "lilypond ". gen_mufile;
+       rename gen_texbase, gen_texfile;
+    }
+
+    if ($center_b) {
+       print BOOK "\\begin{minipage}[c]{.5\\textwidth}\n";
+    }
+    print BOOK "\\input " . gen_texfile . "%\n";
+    if ($center_b) {
+       print BOOK "\\end{minipage}";
+       $center_b = 0;
+    }
+    print BOOK "\\postexample%\n";
+}
+
+sub open_mudela
+{
+    $mudcount++;
+    $mudela_b = 1      ;
+    open MUDELA, ">$outdir/book-mudela.ly";
+    print BOOK "\\preexample%\n";
+    if ($center_b) {
+       print BOOK "\\begin{minipage}[c]{.5\\textwidth}\n";
+    }
+    if ($verbatim_b) {
+       print BOOK "\\begin{verbatim}\n";
+    }
+    if ($fragment_b) {
+       print MUDELA "\\score { \\melodic {\\octave c';";
+    } else {
+       print MUDELA "default_paper = \\paper { \\paper_sixteen ";
+       print MUDELA "linewidth = 7.\\cm;}";
+    }
+
+}
+
+sub begin_b
+{
+    my ($s) = @_;
+    return (/^\\begin{$s}/) ;    
+}
+
+sub end_b
+{
+    my ($s) = @_;
+    return (/^\\end{$s}/) ;    
+}
+sub parse_mudela_opts
+{
+   my ($s) = @_;
+   $s =~ s/[\[\]]//g;
+
+   $verbatim_b =1 if ($s =~ /verbatim/ );
+   $fragment_b = 1 if ($s =~ /fragment/ );
+   $center_b = 1 if ($s =~ /center/ );
+}   
+
+sub help
+{
+    print  "usage: convert-mudela [options] [file]
+options: 
+--help
+--outdir=DIRECTORY     write all files in directory DIRECTORY
+--outname=NAME         use NAME as base  for the output
+";
+    exit;
+}
+    
+sub main
+{
+    GetOptions( 'outdir=s', 'outname=s', 'help');
+    if ( $opt_help ) {
+       help();
+       $opt_help = 0;  # to extinguish typo check. brr, what a language
+    }
+
+    if  (defined ($opt_outdir)) {
+       $outdir = $opt_outdir .  "/";
+    } else {
+       $outdir = ".";
+    }
+   
+    if (defined ($ARGV[0])) {
+       $infile = $ARGV[0] ;
+    } else {
+       $infile = "-";
+    }
+    if (defined ($opt_outname)) {
+       $outname = $opt_outname ;
+    } else { 
+       die "Need to have an output name, use --outname" if ( $infile eq "-");
+       $outname = "$infile.tex";
+    }
+
+    my $openout ="$outdir$outname"; 
+    if  ( $infile eq $openout ) {
+       die "The input can't be the output\n";
+    }
+
+    open INFILE, "<$infile";
+    open BOOK, ">$openout";
+    while (<INFILE>) {
+       if ($mudela_b) {
+           if (end_b "mudela") {
+               close_mudela;
+               next;
+           }
+           print MUDELA;
+           if ( $verbatim_b ) {
+               my $s = $_;
+               $s =~ s/\t/    /g; #shit
+               print BOOK $s;
+           }
+           
+       } else {
+           if (/^\\begin(\[.*\])?{mudela}/ ) {
+               my $opts ="";
+               $opts = $1 if ( defined ($1));
+
+               parse_mudela_opts($opts);
+               open_mudela;
+               next;  
+           } 
+           print BOOK;
+       }
+    }
+    close INFILE;
+    close BOOK;
+}
+
+
+main;
diff --git a/bin/ps-to-gifs.in b/bin/ps-to-gifs.in
new file mode 100755 (executable)
index 0000000..dc51988
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+  
+usage()
+{
+    echo 'ps-to-gifs.sh FILE.ps'
+    exit 2;
+}
+
+case $# in
+1)
+    FILE=`basename $1 .ps`
+    ;;
+*)
+    usage
+    ;;
+esac
+
+# generate the pixmap at twice the size, then rescale (for antialiasing)
+cat $1 | gs  -q -sDEVICE=ppmraw \
+    -sOutputFile="|pnmscale 0.5|ppmtogif > $FILE-page%d.gif" \
+    -r200 -dNOPAUSE - -c quit
+
+
+
diff --git a/bin/release.in b/bin/release.in
new file mode 100644 (file)
index 0000000..1ba3c6c
--- /dev/null
@@ -0,0 +1,56 @@
+#!@PYTHON@
+
+import sys
+import os
+
+lilypath =''
+try:
+    lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
+except KeyError:
+    print 'Please set LILYPOND_SOURCEDIR to the toplevel source, eg LILYPOND_SOURCEDIR=/home/foobar/lilypond-1.2.3/'
+    sys.exit(1)
+
+lilypath = lilypath + '/bin/'
+sys.path.append(lilypath)
+
+from lilypython import *
+
+os.chdir(lilydirs.topdir)
+os.system('make dist')
+cur_ver = lilydirs.version_tuple()
+print tarball(cur_ver)
+try:
+    os.rename('out/' + tarball(cur_ver), released_tarball(cur_ver))
+except posix.error:
+    os.system('cp out/' + tarball(cur_ver)  + ' ' + released_tarball(cur_ver))
+    os.unlink('out/' + tarball (cur_ver))
+    
+os.chdir(lilydirs.groupdir + '/test')
+os.system('pwd')
+os.system('rm ../test/*gz')
+
+#huh?
+#os.symlink(released_tarball(cur_ver), tarball(cur_ver))
+
+try:
+    os.link(released_tarball(cur_ver), tarball(cur_ver))
+except posix.error:
+    os.system('cp ' + released_tarball(cur_ver) + ' '+  tarball(cur_ver))
+
+# not a module, but a script (JCN)
+# makepatch.main()
+
+# Module wherefore aren't thou Script
+# A Rose by any other name would be as blonde. --HWN
+
+os.system('python ' + lilydirs.topdir + '/bin/make-patch.py');
+
+pn = 'patch-%s' % version_tuple_to_str(cur_ver)
+os.system('gzip -9 ' + pn)
+pn = pn + '.gz'
+rel_pn = lilydirs.release_dir + '../patches/' + pn;
+
+os.rename(pn, rel_pn);
+os.link(rel_pn, pn);
+
+os.system('tar cf updeet *gz')
diff --git a/bin/show-latest.in b/bin/show-latest.in
new file mode 100644 (file)
index 0000000..1c3d14d
--- /dev/null
@@ -0,0 +1,53 @@
+#!@PERL@
+# -*-Perl-*-
+
+
+$reldir="/home/hanwen/musix/releases";
+
+use FileHandle;
+use Getopt::Long;
+
+sub cmpver 
+{      
+    my(@a)= split( /\./, $a);
+    my(@b)= split( /\./, $b);
+    
+    for $i (0,1,2) {
+       return $a[$i] <=> $b[$i] if ($a[$i] != $b[$i]);
+    }
+    return $a cmp $b;
+}
+
+my @versions;
+open LS, "ls -1 $reldir|";
+
+GetOptions( 'print', 'news', 'latest');
+
+
+while (<LS>) {
+    $_ =~ /lilypond-([^.]+\.[^.]+\.[^.]+).tar.gz/;
+    push @versions, $1;
+}
+
+
+@versions = sort cmpver @versions;
+my $last= (pop @versions);
+
+
+if (  $opt_print ) {
+    print $last;
+}
+
+if ( $opt_latest) {
+    system "rm $reldir/zZ*";
+    system  "> $reldir/zZ_LATEST_IS_$last";
+}
+if ( $opt_news ) {
+    open NEWS, "tar --to-stdout  -zxf $reldir/lilypond-$last.tar.gz lilypond-$last/NEWS |";
+    input_record_separator NEWS "****";
+    $desc = <NEWS>;
+    chop ($desc);
+    close NEWS;
+
+    print $desc;
+}