From: fred Date: Wed, 30 Jul 1997 09:55:28 +0000 (+0000) Subject: lilypond-0.0.78 X-Git-Tag: release/1.5.59~6107 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f26cebbe5cecb5ad8aacbd4ffa14f52958f31a73;p=lilypond.git lilypond-0.0.78 --- diff --git a/bin/convert-mudela.in b/bin/convert-mudela.in new file mode 100644 index 0000000000..f1b640c0ae --- /dev/null +++ b/bin/convert-mudela.in @@ -0,0 +1,293 @@ +#!@PERL@ -w + +=head1 TODO + + detect \lyrics and \melodic, and do substitution accordingly. + count <> and {} ? + +Ugh . Perl sux. Anybody for Python? + +=cut + + + +# +# version of "supporting" engine, not mudela conversions. +# + + + + +$convert_mudela_version = "0.1.1"; + +use Getopt::Long; + + +sub version_compare +{ + local ($a,$b)=@_; + return &cmpver; +} + + +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; +} + +sub version_string_conv +{ + my ($from_version, $to_version) = @_; + s/\version \"$from_version\"/\version \"$to_version\"/g; +} + +################################################################ + +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 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 + ); + + +sub versions +{ + return (sort keys %minor_conversions); +} + + +sub show_rules +{ + print "Rules: ", join(", ", sort keys %minor_conversions), "\n"; + +} + +sub do_conversion +{ + my ($from,$to) = @_; + + my @applicable_conversion; + my @mudela_levels; + +# die "This is too old to convert " if $from < 50; + 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 () { + 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 () { + 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/genheader.in b/bin/genheader.in new file mode 100644 index 0000000000..9b6bb4d6cb --- /dev/null +++ b/bin/genheader.in @@ -0,0 +1,60 @@ +#!@PERL@ -w + +# generate the standard header of a LilyPond source file. +my $fn; + +sub + do_init +{ + $MAILADRESS=$ENV{MAILADRESS}; + @pw=(getpwuid($<)); + $username=$pw[6]; + + die "arg needed\n" if (!($#ARGV+1)); + $fn = $ARGV[0]; + + $hh_b = ($fn =~ /hh$/ ); + $inc_b= ($hh_b || $fn =~ /[ti]cc$/); +} + +sub + do_head +{ + + my $what="implement "; + $what = "declare " if ($hh_b); + my ($PROJECT, $cwd); + $PROJECT = "the GNU LilyPond music typesetter"; + chop($cwd = `pwd`); + + $PROJECT= "the Flower Library" if ($cwd =~ /flower/); + + my $headstr ="/* + $fn -- $what + + source file of $PROJECT + + (c) 1997 $username <$MAILADRESS> +*/\n"; + print $headstr; +} +sub do_inc +{ + my $headstr=""; + my $startdef= $fn; + $startdef =~ s/[\.-]/_/g; + $startdef =~ tr/a-z/A-Z/; + my $terminatestr="\n"; + + if ($inc_b) { + $headstr = "\n\n#ifndef $startdef\n#define $startdef\n"; + $terminatestr .= "#endif // $startdef\n" + } + + print $headstr, $terminatestr; +} +do_init; +do_head; +do_inc; + + diff --git a/bin/make-website.in b/bin/make-website.in new file mode 100644 index 0000000000..218b94dc32 --- /dev/null +++ b/bin/make-website.in @@ -0,0 +1,292 @@ +#!@PERL@ -w +# stupid script to generate WWW site. + +use FileHandle; +use Getopt::Long; +my $lily_version; +my $footstr; +my $mw_id = ""; +my $id_str = "make-website 0.3"; + +my $TAR="tar"; +my $MAKE="make"; + +sub get_version +{ + my ($vstr)=(""); + open V, "$depth/VERSION"; + while () { + s/#.*$//g; + next if (/^ *$/); + s/^/\$/; + s/= *(.*)$/=\"$1\";/; + $vstr .= $_; + } + eval ($vstr); + + $lily_version= "$TOPLEVEL_MAJOR_VERSION.$TOPLEVEL_MINOR_VERSION.$TOPLEVEL_PATCH_LEVEL$TOPLEVEL_MY_PATCH_LEVEL"; + + # stupid checks. + $lily_version= "$TOPLEVEL_MAJOR_VERSION.$TOPLEVEL_MINOR_VERSION.$TOPLEVEL_PATCH_LEVEL$TOPLEVEL_MY_PATCH_LEVEL"; + + + close V; +} + +sub set_html_footer +{ + my $MAILADRESS=$ENV{MAILADRESS}; + my @pw=(getpwuid($<)); + my $username=$pw[6]; + + $footstr = + "\n
Please take me back to the index\n
+ +This page was generated by " . $id_str . " from lilypond-$lily_version by +

+


$username <$MAILADRESS>
+

" . `date` . " +

"; +} + + +# 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 "\nmake_website: failed on command \`$cmd\' (status $ret)\n"; + exit 2; + } + } + } +} + + +local $base="lilypond/"; +local @examples=("twinkle", "multi", "wohltemperirt" ,"standchen", "toccata-fuga-E", + "scsii-menuetto", "collisions", "cadenza", "scales"); + +# rhythm, scales, + + +sub gen_html +{ + print "generating HTML\n"; + my_system "$MAKE -kC .. html"; +} + +sub gen_examples +{ + print "generating examples: \n"; + my @todo=(); + foreach $a (@examples) { + push @todo, "out/$a.ps.gz", "out/$a.gif", "out/$a.ly.txt"; + } + + my_system ("$MAKE -C .. " . join(' ', @todo)); +} + +my @texstuff = ("mudela-man", "mudela-course"); + +sub gen_manuals +{ + print "generating TeX doco list\n"; + open HTMLLIST, ">tex_manuals.html"; + print HTMLLIST "LilyPond manuals in TeX\n" . + "

    \n"; + my @todo=(); + foreach $a (@texstuff) { + push @todo , "out/$a.ps.gz"; + print HTMLLIST "
  • $a.ps.gz"; + } + print HTMLLIST "
"; + close HTMLLIST; + + my_system( "$MAKE -C .. " . join(' ', @todo)); +} + +sub gen_list +{ + print "generating HTML list\n"; + open HTMLLIST, ">example_output.html"; + print HTMLLIST "LilyPond examples\n +These example files are taken from the LilyPond distribution.\n +LilyPond currently only outputs TeX and MIDI. The pictures and\n + PostScript files were generated using TeX, Ghostscript and some graphics tools. \n +The GIF files have been scaled to eliminate aliasing."; + foreach $a (@examples) { + $name=$a; + print HTMLLIST "

example file: $name

\n\n"; + + open IF, "$depth/input/$a.ly"; + input_record_separator IF "%}"; + + $desc = <IF>; + close IF; + + print HTMLLIST "$desc\n"; + + $inputf="$a.ly.txt"; + $giff="$a.gif"; + $jpegf="$a.jpeg"; + $pngf = "$a.png"; + $psf="$a.ps.gz"; + $midif="$a.midi"; + + print HTMLLIST ""; + } + print HTMLLIST ""; + close HTMLLIST; +} + +sub edit_html +{ + print STDERR "adding footer\n"; + + OUTER: + foreach $a (<*.html>) { + open H, "$a"; + my $sep=""; + input_record_separator H $sep; + my $file=""; + + while () { + if (/$mw_id/) { + close H; + next OUTER; + } + $file .= $_; + + } + close H; + + my $subst = $footstr; + $subst .= $back if (! $a =~ /index.html/ ); + $file =~ s/$sep/$subst$sep/g ; + $file =~ s/\.gif/\.$image/g; + open H, ">$a"; + print H $mw_id; + print H $file; + close H; + } +} + +sub copy_txt_file +{ + my ($f) = @_; + my $d = $f; + $d =~ s!^.*\/!!; + if (! $f =~ /.txt$/) { + $d = "$f.txt"; + } + print $f, $d; +} + +sub copy_files +{ + print "copying files\n"; + print `ln -s $depth/out ./docxx` if ( ! -x "docxx" ) ; + my_system "cp $depth/TODO ./TODO.txt", + "cp $depth/ANNOUNCE ./ANNOUNCE.txt", + "cp $depth/NEWS ./NEWS.txt", + "cp $depth/DEDICATION ./DEDICATION.txt", + "cp ../lelie*gif ."; +} + +sub set_images +{ + for $a (<*.gif>) { + if ($opt_png) { + my_system "gif2png -d $a"; + } + if ($opt_jpeg) { + my $b=$a; + $b =~ s/.gif/.jpeg/; + my_system "cjpeg -o $b $a"; + } + } +} + +sub docxx_update +{ + my_system "$MAKE -C $depth doc++"; +} + +sub do_tar +{ + print "tarring.\n"; + $files = join (' ', < *.html *.$image *.ps.gz *.txt *.midi docxx/*>); + my_system + "-$TAR zvhcf website.tar.gz $files;", +# "gzip -f9 website.tar;"; +} + +sub identify +{ + print STDERR "This is " . $id_str . "\n"; + +} +sub main +{ + identify; + GetOptions("jpeg", "gif", "png", "noexamples"); + + local $image="gif" ; + $image = "png" if ($opt_png); + $image = "jpeg" if ($opt_jpeg); + + $depth = "../"; + my $cwd; + chomp($cwd = `pwd`); + die "need to be in directory Documentation\n" if ( ! ($cwd =~ /Documentation$/)); + get_version; + set_html_footer; + + + $depth = "../../"; + + chdir ("out"); + $ENV{"TEXINPUTS"} .= ":$depth/input/:"; + $ENV{"LILYINCLUDE"} = "$depth/input/"; + + + gen_html; + copy_files; + if (! $opt_noexamples) { + gen_examples; + gen_list; + } + gen_manuals; + set_images; + + edit_html; + docxx_update; + do_tar; +} + +main; diff --git a/bin/mudela-book.in b/bin/mudela-book.in new file mode 100644 index 0000000000..2481b37f16 --- /dev/null +++ b/bin/mudela-book.in @@ -0,0 +1,120 @@ +#!@PERL@ -w +my $mudcount = 0; +my $mudela_b = 0; +my $outdir = ""; +my $outname = ""; +use Getopt::Long; + +sub gen_mufile +{ + return "$outdir/$outname$mudcount.ly"; +} + +sub gen_texfile +{ + return "$outdir/$outname$mudcount.tex"; +} + +sub close_mudela +{ + $mudela_b = 0; + if ($fragment_b) { + print MUDELA "}\n \\paper { linewidth = -1.0\\cm; } }\n"; + $fragment_b =0; + } + if ( $verbatim_b) { + print BOOK "\\end{verbatim}\n\\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) { + system "lilypond ". gen_mufile; + rename "lelie.tex", gen_texfile; + } + print BOOK "\\preexample\\input " . gen_texfile . "\n\\postexample\n"; + +} + +sub open_mudela +{ + $mudcount++; + $mudela_b = 1 ; + open MUDELA, ">$outdir/book-mudela.ly"; + if ($verbatim_b) { + print BOOK "\\begin{verbatim}\n"; + } + if ($fragment_b) { + print MUDELA "\\score { \\melodic {"; + } + +} + +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/ ); +} + +sub main +{ + GetOptions( 'outdir=s', 'outname=s'); + $outdir = $opt_outdir; + $outname = $opt_outname if (defined ($opt_outname) && $opt_outname); + open INFILE, $ARGV[0]; + + open BOOK, ">$outdir/$outname"; + while () { + 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/show-latest.in b/bin/show-latest.in new file mode 100644 index 0000000000..e87a6ad630 --- /dev/null +++ b/bin/show-latest.in @@ -0,0 +1,43 @@ +#!@PERL@ + + +$reldir="~/musix/releases"; + +use FileHandle; + +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|"; + + +while () { + + $_ =~ /lilypond-([^.]+\.[^.]+\.[^.]+).tar.gz/; + push @versions, $1; +} + + +@versions = sort cmpver @versions; +my $last= (pop @versions); + + +system "rm $reldir/zZ*"; +system "> $reldir/zZ_LATEST_IS_$last"; + +open NEWS, "tar --to-stdout -zxf $reldir/lilypond-$last.tar.gz lilypond-$last/NEWS |"; +input_record_separator NEWS "****"; +$desc = ; +chop ($desc); +close NEWS; + print $desc;