include $(depth)/make/Include.make
# list of distribution files:
-SCRIPTS = clearlily cpgento make-patch lily.efence \
- make-version release conflily clean-fonts
-PERL_SCRIPTS_IN = $(wildcard *.in)
-PERL_SCRIPTS = $(addprefix $(outdir)/, $(PERL_SCRIPTS_IN:.in=))
+PERL_SCRIPTS_IN = $(wildcard *.pl)
+PERL_SCRIPTS = $(addprefix $(outdir)/, $(PERL_SCRIPTS_IN:.pl=))
+SH_SCRIPTS_IN = $(wildcard *.sh)
+SH_SCRIPTS = $(addprefix $(outdir)/, $(SH_SCRIPTS_IN:.sh=))
PYTHON_SCRIPTS_IN = $(wildcard *.py)
PYTHON_SCRIPTS = $(addprefix $(outdir)/, $(PYTHON_SCRIPTS_IN:.py=))
-EXTRA_DISTFILES = $(SCRIPTS) $(PERL_SCRIPTS_IN) $(PYTHON_SCRIPTS_IN)
-#
+EXTRA_DISTFILES = $(SH_SCRIPTS_IN) $(PERL_SCRIPTS_IN) $(PYTHON_SCRIPTS_IN)
-all: $(PERL_SCRIPTS) $(PYTHON_SCRIPTS)
-$(outdir)/%: %.in
-# cd .. && CONFIG_FILES=bin/$(notdir $@) CONFIG_HEADERS= ./config.status
-# mv $(< :.in=) $@
-# this nukes make/out/Configure_variables.make.
+all: $(PERL_SCRIPTS) $(PYTHON_SCRIPTS) $(SH_SCRIPTS)
+
+$(outdir)/%: %.pl
sed 's!@PERL@!$(PERL)!' < $< > $@
chmod 755 $@
+#FIXME. Check for bash?
+$(outdir)/%: %.sh
+ sed 's!@SH@!$(SH)!' < $< > $@
+ chmod 755 $@
+
$(outdir)/%: %.py
sed 's!@PYTHON@!$(PYTHON)!' < $< > $@
chmod 755 $@
--- /dev/null
+#!@PERL@ -w
+# -*-Perl-*-
+
+
+# stupid script to generate WWW site. The WWW site is my
+# test-suite for LilyPond, I usually don't distribute versions that
+# fail to make the website
+
+use FileHandle;
+use Getopt::Long;
+
+my $lily_version;
+my $footstr;
+my $mw_id = "<!make_website!>";
+my $id_str = "make-website 0.4";
+my $TAR="tar";
+my $MAKE="make";
+
+sub get_version
+{
+ my ($vstr)=("");
+ open V, "$depth/VERSION";
+ while (<V>) {
+ 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= $lily_version;
+
+ close V;
+}
+
+sub set_html_footer
+{
+ my $MAILADDRESS=$ENV{MAILADDRESS};
+ my @pw=(getpwuid($<));
+ my $username=$pw[6];
+
+ $footstr =
+ "\n<hr>Please take me <a href=index.html>back to the index</a>\n
+of LilyPond -- The GNU Project Music typesetter
+<hr>
+<font size=-1>
+This page was built using <code>" . $id_str . "</code> from lilypond-"
+ . $lily_version .
+ " by<p>
+<address><br>$username <a href=mailto:"
+ . $MAILADDRESS . "><<!bla>" . $MAILADDRESS ."</a>></address>
+<p></font>";
+}
+
+
+# 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-pop",
+ "wtk1-fugue2",
+ "standchen-16",
+ "standchen-20",
+ "wtk1-prelude1",
+ "toccata-fuga-E",
+ "scsii-menuetto",
+ "cadenza",
+ "gallina",
+ "twinkle",
+ "collisions",
+ "font",
+ #"scales",
+ "rhythm",
+ "multi" );
+
+
+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 "<HTML><TITLE>PostScript Manuals</TITLE>\n" ;
+ print HTMLLIST "<BODY><h1>LilyPond manuals (in PostScript)</h1>";
+ print HTMLLIST "<ul>\n";
+ my @todo=();
+ foreach $a (@texstuff) {
+ push @todo , "out/$a.ps.gz";
+ print HTMLLIST "<li><a href=$a.ps.gz>$a.ps.gz</a>";
+ }
+ print HTMLLIST "</ul>";
+
+ print HTMLLIST "</BODY></HTML>";
+ close HTMLLIST;
+
+ my_system( "$MAKE -C .. " . join(' ', @todo));
+}
+
+sub gen_list
+{
+ print "generating HTML list\n";
+ open HTMLLIST, ">example_output.html";
+
+ print HTMLLIST "<html><body><TITLE>Rendered Examples</TITLE>\n
+These example files are taken from the LilyPond distribution.
+LilyPond currently only outputs TeX and MIDI. The pictures and
+PostScript files were generated using TeX, Ghostscript and some
+graphics tools. The papersize used for these examples is A4. The GIF
+files have been scaled to eliminate aliasing.";
+
+
+
+ foreach $a (@examples)
+ {
+ $name=$a; print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
+
+ open IF, "$depth/input/$a.ly";
+ input_record_separator IF "\n}";
+
+ $desc = <IF>;
+ close IF;
+
+ print HTMLLIST "$desc\n</XMP>";
+
+ $inputf="$a.ly.txt";
+ $giff="$a.gif";
+ $jpegf="$a.jpeg";
+ $pngf = "$a.png";
+ $psf="$a.ps.gz";
+ $midif="$a.midi";
+
+ print HTMLLIST "<ul>";
+
+ print HTMLLIST "<li><a href=$inputf> The input file</a>"
+ if ( -f $inputf );
+
+ print HTMLLIST "<li><a href=$giff>The output (picture)</a>"
+ if ( -f $giff );
+
+ print HTMLLIST "<li><a href=$psf>The output (PS)</a>\n"
+ if ( -f $psf );
+
+ print HTMLLIST "<li><a href=$midif>The output (MIDI)</a>\n"
+ if ( -f $midif );
+ print HTMLLIST "</ul>";
+ }
+ print HTMLLIST "</BODY></HTML>";
+ close HTMLLIST;
+}
+
+sub edit_html
+{
+ print STDERR "adding footer\n";
+
+ OUTER:
+ foreach $a (<*.html>) {
+ open H, "$a";
+ my $sep="</BODY>";
+ input_record_separator H $sep;
+ my $file="";
+
+ while (<H>) {
+ 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;
+ $file =~ s!<TITLE>(.*)</TITLE>!<TITLE>LilyPond WWW: $1</TITLE>!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, $d;
+}
+
+sub top_of_NEWS
+{
+ open NEWS, "NEWS.txt";
+ input_record_separator NEWS "****";
+ $desc = <NEWS>;
+ chop ($desc);
+ close NEWS;
+
+ return $desc;
+}
+
+sub edit_index
+{
+ $ton = top_of_NEWS();
+ $ton = "\n<XMP>\n$ton\n</XMP>\n";
+ open INDEX, "index.html";
+ input_record_separator NEWS undef;
+ $index = <INDEX>;
+ close INDEX;
+ $index =~ s/top_of_NEWS/$ton/;
+ open INDEX, ">index.html";
+ print INDEX $index;
+ close INDEX;
+}
+
+
+sub copy_files
+{
+ print "copying files\n";
+ my_system "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";
+ my_system "make -C .. gifs";
+
+}
+
+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
+{
+ open BANNER, ">/tmp/lilybanner.html";
+ my $ban = $footstr;
+ $ban =~ s!index.html!../index.html!g;
+ print BANNER $ban;
+ close BANNER;
+ my_system "BANNEROPT=\"-B /tmp/lilybanner.html\" $depth/bin/out/make-docxx";
+}
+
+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;
+ print "lily v. " . $lily_version . "\n";
+ 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;
+ edit_index;
+ docxx_update;
+ do_tar;
+}
+
+main;
--- /dev/null
+/*
+ notehead.cc -- implement Note_head
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "misc.hh"
+#include "dots.hh"
+#include "note-head.hh"
+#include "dimen.hh"
+#include "debug.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "molecule.hh"
+#include "musical-request.hh"
+
+
+Note_head::Note_head ()
+{
+ x_dir_ = CENTER;
+ staff_size_i_= 8; // UGH
+ position_i_ = 0;
+ extremal_i_ = 0;
+}
+
+void
+Note_head::do_pre_processing ()
+{
+ // 8 ball looks the same as 4 ball:
+ if (balltype_i_ > 2)
+ balltype_i_ = 2;
+ if (dots_l_) // move into Rhythmic_head?
+ dots_l_->position_i_ = position_i_;
+}
+
+IMPLEMENT_IS_TYPE_B1(Note_head,Rhythmic_head);
+
+
+int
+Note_head::compare (Note_head *const &a, Note_head * const &b)
+{
+ return a->position_i_ - b->position_i_;
+}
+
+Interval
+Note_head::do_width () const
+{
+ Atom a = paper ()->lookup_l()->ball (balltype_i_);
+ Interval i = a.dim_[X_AXIS];
+ i+= x_dir_ * i.length ();
+ return i;
+}
+
+Molecule*
+Note_head::brew_molecule_p() const
+{
+ Molecule*out = 0;
+ Paper_def *p = paper();
+ Real inter_f = p->internote_f ();
+
+ // ugh
+ int streepjes_i = abs(position_i_) < staff_size_i_/2
+ ? 0
+ : (abs(position_i_) - staff_size_i_/2) /2;
+
+ Atom s = p->lookup_l()->ball (balltype_i_);
+ out = new Molecule (Atom (s));
+ out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS);
+
+ if (streepjes_i)
+ {
+ int dir = sign (position_i_);
+
+ Atom streepje = p->lookup_l()->streepjes (balltype_i_, dir* streepjes_i);
+
+ Molecule sm;
+ sm.add (streepje);
+ if (position_i_ % 2)
+ sm.translate_axis (-inter_f* dir, Y_AXIS);
+ out->add (sm);
+ }
+
+ out->translate_axis (inter_f*position_i_, Y_AXIS);
+ return out;
+}