-10/Oct/97 LilyPond 0.1.23 1
+10/Oct/97 LilyPond 0.1.24 1
with libc-5.3 and libc-5.4 platforms, so you might try upgrading to
6.0, ie. GNU libc-2.
+[Linux Intel]
+
+A problem resembling the previous: usage of libg++.2.8.x with the
+wrong version of libc results in a coredump from the scanner while
+reading the init files. Stacktrace:
+
+ ios::eof (this=0x0)
+
+ yyFlexLexer::LexerInput (this=0x8294848, buf=0x82955f0 "", max_size=8192)
+ yyFlexLexer::yy_get_next_buffer (this=0x8294848)
+ My_lily_lexer::yylex (this=0x8294848)
+Fix: follow the install instructions of libg++: match the right
+library versions.
=item --enable-mf-dir
-Set the directory mf input is in (idem) [obsolete]
+Set the directory mf input is in (idem)
=item --enable-out-dir
interchanging music
-=back
-
-and possibly for
-
-=over 4
-
=item *
arranging
Neil Jerram <nj104@cus.cam.ac.uk>) and in January '93 Robert Strandh
<Robert.Strandh@labri.u-bordeaux.fr> joined.
-After serious disputes with Robert Strandh
-<Robert.Strandh@labri.u-bordeaux.fr> and the FSF staff in '94, the
-project core team got divided. The development efforts of GMP stopped.
+After serious disputes with Robert Strandh and the FSF staff in '94,
+the project core team got divided. The development efforts of GMP
+stopped.
Independently, I (HWN) started LilyPond. When I showed it to
RMS, he was very enthousiastic about having LilyPond in the GNU
gets me wrong or is angry at me because I stole a project or a
project's name, I wrote this note.
-In summary, LilyPond is now the only substantial embodiment of the GNU Music
-Project, and it is part of the GNU project.
+In summary, LilyPond is now the only substantial embodiment of the GNU
+Music Project, and it is part of the GNU project.
For completeness' sake, I will mention the other efforts here:
=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp
An alpha version notation editor for X in Scheme. Source available on
-request.
+request from Robert Strandh.
=item GNU music,
The documentation system for C++ sources, which the LilyPond sources use.
+=item http://www.iat.unc.edu/technology/music/music.html
+
+An enormous collection of music related URLs
=back
=item http://www.redhat.com/
-develops and markets a GNU/Linux distribution (of
+RedHat Software Inc. develops and markets a GNU/Linux distribution (of
which we are avid users)
Ted Ross. ``Teach yourself the art of music engraving and processing''
(3rd edition). Hansen House, Miami Beach, FLorida.
-[This is about I<engraving> i.e. professional music typesetting, and
-includes some good spacing tables MB]
+[This is about engraving, i.e. the real thing with metal plates, but
+it also contains directions on good typesetting. It includes some good
+spacing tables HWN]
Gardner Read. ``Modern Rhythmic Notation.'' Indiana University Press,
1978.
+[Sound (boring) review of the various hairy rhythmic notations used by
+avant-garde composers HWN]
+
Gardner Read. ``Music Notation'' (2nd edition). Taplinger Publishing,
New York.
When LilyPond starts working it will produce various ``operator
pacification'' messages, which you can safely ignore for now. The run
should have left a file called \file{lelie.tex} in your working
-directory. You can process that file with TeX, and it will look like
+directory. You can process that file with \TeX, and it will look like
this:
\begin{mudela}
=item Ikarus,
-The music-engraving system described by [Wanske]
+URW's music-engraving system described by [Wanske]
+
+=item Logic,
+
+=item Personal Composer
=item Finale
A project at Ohio State university, which was discontinued in 1987.
-=item Berlioz, http://www.bsi.fr/~montel/
+=item Berlioz, http://www.?.fr/
+
+Dominique Montel (a professional music typesetter) is now working together with
+computer scientists on his own software for music publishing, called "Berlioz".
-8/Oct/97 LilyPond 0.1.23 1
+20/Oct/97 LilyPond 0.1.24 1
-8/Oct/97 LilyPond 0.1.23 2
+20/Oct/97 LilyPond 0.1.24 2
--enable-mf-dir
Set the directory mf input is in (idem)
- [obsolete]
-8/Oct/97 LilyPond 0.1.23 3
+
+20/Oct/97 LilyPond 0.1.24 3
-8/Oct/97 LilyPond 0.1.23 4
+20/Oct/97 LilyPond 0.1.24 4
-8/Oct/97 LilyPond 0.1.23 5
+20/Oct/97 LilyPond 0.1.24 5
-8/Oct/97 LilyPond 0.1.23 6
+20/Oct/97 LilyPond 0.1.24 6
+pl 24
+ - internationalization preps (FP)
+ - rewrote make-patch in python
+ - BUGS: added another flex/libio crash explanation
+ - feta: flags
+
+
+********
pl 23
- feta changes: 1/4 rest, flat, bf 8-128 rest
- bf: cadenza
- bf: rest-collision
- bf: meter placement
- junked cpgento.sh
+
*********
pl 22
* standchen: warning: Excentric column (Meter dims?)
-
* optimal pagebreaking.
* put errorlevel in Input class
- examples to go with it.
* Spring_spacer:
- - write a faster Spring_spacer ( without matrices if possible )
+ - write a faster Spring_spacer (without matrices if possible)
- use straight QP to find minimal "fitting force"
- relate energybound to linelen unitspace fontsize etc.
- used fixed point fp
TOPLEVEL_MAJOR_VERSION = 0
TOPLEVEL_MINOR_VERSION = 1
-TOPLEVEL_PATCH_LEVEL = 23
+TOPLEVEL_PATCH_LEVEL = 24
TOPLEVEL_MY_PATCH_LEVEL =
# use the above to send patches, always empty for released version:
+++ /dev/null
-#!@PYTHON@
-
-#
-# lily-python.py -- implement general LilyPond-wide python stuff
-#
-# 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
-
-
-
-
-
-make_assign_re = regex.compile('^\([A-Z_]*\) *= *\(.*\)$')
-
-def version_str_tuple(file):
- lines = file.readlines()
-
- mi = pa = mp = mj = ''
-
- for l in lines:
- if make_assign_re.search(l) <> -1:
- nm = make_assign_re.group(1)
- val = make_assign_re.group(2)
- if nm == 'TOPLEVEL_MAJOR_VERSION':
- mj = val
- elif nm == 'TOPLEVEL_MINOR_VERSION':
- mi = val
- elif nm == 'TOPLEVEL_PATCH_LEVEL':
- pa = val
- elif nm == 'TOPLEVEL_MY_PATCH_LEVEL':
- mp = val
- return (mj,mi,pa,mp)
-
-class Lilydirs:
- def __init__(self):
- try:
- self.topdir = os.environ['LILYPOND_SOURCEDIR'] + '/'
- except IndexError:
- self.topdir = os.environ['HOME'] + 'musix/current'
-
- self.release_dir = self.topdir + '../releases/'
- self.patch_dir = self.topdir + '../patches/'
-
- def version_str_tuple(self):
- f = open (self.topdir + 'VERSION')
- v = version_str_tuple(f)
- f.close ()
- return v
-
-lilydirs = Lilydirs()
-
-print lilydirs.version_str_tuple()
--- /dev/null
+#!@PYTHON@
+
+#
+# lily-python.py -- implement general LilyPond-wide python stuff
+#
+# source file of the GNU LilyPond music typesetter
+#
+# (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+#
+
+import posix
+import pwd
+import regex
+import regsub
+from string import *
+import sys
+import os
+import getopt
+
+
+
+
+version_re = regex.compile('\\version *\"\(.*\)\"')
+make_assign_re = regex.compile('^\([A-Z_]*\) *= *\(.*\)$')
+
+def version_tuple(file):
+ lines = file.readlines()
+
+ mi = pa = mj = 0
+ mp = ''
+
+ for l in lines:
+ if make_assign_re.search(l) <> -1:
+ nm = make_assign_re.group(1)
+ val = make_assign_re.group(2)
+ if nm == 'TOPLEVEL_MAJOR_VERSION':
+ mj = atoi(val)
+ elif nm == 'TOPLEVEL_MINOR_VERSION':
+ mi = atoi(val)
+ elif nm == 'TOPLEVEL_PATCH_LEVEL':
+ pa = atoi(val)
+ elif nm == 'TOPLEVEL_MY_PATCH_LEVEL':
+ mp = val
+ return (mj,mi,pa,mp)
+
+def next_version(tup):
+ return (tup[0], tup[1], tup[2] + 1, tup[3]);
+
+def prev_version(tup):
+ t = tup
+ if t[3]:
+ return (tup[0], tup[1], tup[2], '');
+ elif t[2] == 0 :
+ return (tup[0], tup[1] -1, tup[2], '');
+ else:
+ return (tup[0], tup[1], tup[2] - 1, '');
+
+
+def tuple_to_list(tup):
+ l=[]
+ for x in tup:
+ l.append[x]
+ return l
+
+def version_str_to_tuple(str):
+ t = split(str, '.')
+ try:
+ mypatch = t[3]
+ except IndexError:
+ mypatch = ''
+
+ return (atoi(t[0]), atoi(t[1]), atoi(t[2]), mypatch)
+
+
+
+def guess_mudela_version(filename):
+ f = open (filename)
+ lines = f.readlines()
+ f.close()
+ for l in lines:
+ if version_re.search(l) <> -1:
+ return version_re.group(1)
+
+ return ''
+
+def version_tuple_to_str(tup):
+ return '%d.%d.%d%s' % tup
+
+class Lilydirs:
+ def __init__(self):
+ try:
+ self.topdir = os.environ['LILYPOND_SOURCEDIR'] + '/'
+ except IndexError:
+ self.topdir = os.environ['HOME'] + 'musix/current'
+
+ self.release_dir = self.topdir + '../releases/'
+ self.patch_dir = self.topdir + '../patches/'
+
+ def version_tuple(self):
+ f = open (self.topdir + 'VERSION')
+ v = version_tuple(f)
+ f.close ()
+ return v
+
+
+lilydirs = Lilydirs()
+
+if __name__ == '__main__':
+ v= lilydirs.version_tuple()
+ print v, prev_version(v), next_version(v)
+
+ mv = guess_mudela_version(lilydirs.topdir + 'init/symbol.ly')
+
+ print version_str_to_tuple(mv)
--- /dev/null
+#!@PYTHON@
+from lilypython import *
+import getopt
+import pipes
+
+
+mp_version = '2'
+
+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 dirname(v):
+ return 'lilypond-' + version_tuple_to_str(v)
+
+def tarball(v):
+ return lilydirs.release_dir + dirname(v) + '.tar.gz'
+
+def untar(fn):
+ sys.stderr.write('untarring ' + fn)
+ os.system ('tar xzf ' + fn)
+ sys.stderr.write('\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 < patch-$new\n\
+\n\
+Patches do not contain automatically generated files, \n\
+i.e. you should rerun configure\n\n'
+
+import fnmatch
+import os
+
+_debug = 0
+
+_prune = ['(*)']
+
+
+def my_find(patterns, dir = os.curdir):
+ list = []
+ names = os.listdir(dir)
+ names.sort()
+ for name in names:
+ if name in (os.curdir, os.pardir):
+ continue
+ fullname = os.path.join(dir, name)
+ for pat in patterns:
+ if fnmatch.fnmatch(name, pat):
+ list.append(fullname)
+ if os.path.isdir(fullname) and not os.path.islink(fullname):
+ for p in _prune:
+ if fnmatch.fnmatch(name, p):
+ if _debug: print "skip", `fullname`
+ break
+ else:
+ if _debug: print "descend into", `fullname`
+ found = my_find(patterns, fullname)
+ if found:
+ list = list + found
+ return list
+
+def multiple_find(pats, dirnames):
+ from find import find
+ l = []
+ for d in dirnames:
+ l = l + my_find(pats, d)
+ return l
+
+pats = ['*.lsm', 'configure', '*.text', '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
+ os.chdir ('/tmp')
+ untar(tarball(fv))
+ untar(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)))
+ f.close()
+
+ sys.stderr.write('diffing ... ')
+ os.system('diff -urN ../%s . >> %s' % (dirname(fv), patfile_nm))
+ #os.system('gzip -9f %s' % patfile_nm)
+ os.chdir('/tmp')
+
+ sys.stderr.write('cleaning ... ')
+ os.system('rm -fr %s %s' % (dirname(tv), dirname(fv)))
+ sys.stderr.write('\n')
+
+def main():
+ 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()
+ 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)
+
+main()
+++ /dev/null
-#!/bin/sh
-
-case $# in
-0) echo make_patch old new name
- exit 1;;
-esac
-
-old=$1
-new=$2
-nm=$3-
-
-newarc=../releases/$nm$new.tar.gz
-oldarc=../releases/$nm$old.tar.gz
-
-
-if [ ! -x $nm$new ]
-then
- echo untarring ..
- if [ ! -f $newarc ]
- then
- echo "can't find $newarc"
- exit
- fi
- tar zfx $newarc
-fi
-if [ ! -x $nm$old ]
-then
- echo untarring
-
- if [ ! -f $oldarc ]
- then
- echo "can't find $oldarc"
- exit
- fi
- tar zfx $oldarc
-fi
-
-# not interested in auto generated files.
-for a in lilypond.lsm INSTALL.text AUTHORS.text lilypond.spec configure; do
- rm `find $nm$old $nm$new -name $a`
-done
-
-cat <<EOF > patch-$new
-Generated with
-
- make_patch $1 $2 $3
-
-usage
-
- cd lilypond-source-dir; patch -E -p0 < patch-$new
-
-Patches do not contain automatically generated files,
-i.e. you should rerun configure
-EOF
-
-(cd $nm$new; diff -urN ../$nm$old . >> ../patch-$new)
-rm -rf $nm$old $nm$new
--- /dev/null
+
+from lilypython import *
+
+
+os.system('make dist')
mv $tarball $releasedir/
cd ../test
-sh $heredir/bin/make-patch.sh $LASTVER $NEWVER lilypond
+python $heredir/bin/make-patch.py
gzip -f9 patch-$NEWVER
mv $patch $patchdir//
+/*
+ data-file.cc -- implement Data_file
+
+ source file of the Flower Library
+
+ (c) '95, '96, '97 Han-Wen Nienhuys <hanwen@stack.nl>
+
+ */
#include <fstream.h>
#include <ctype.h>
+#include "international.hh"
#include "data-file.hh"
-void
+void
Data_file::gobble_white()
{
char c;
-
+
while ((c=data_get()) == ' ' ||c == '\t')
- if (eof())
- break;
+ if (eof())
+ break;
data_unget (c);
}
String
-Data_file::get_word()
+Data_file::get_word()
{// should handle escape seq's
String s;
- while (1)
+ while (1)
+ {
+ char c = data_get();
+
+ if (isspace (c) || eof())
{
- char c = data_get();
-
- if (isspace (c) || eof())
- {
- data_unget (c);
- break;
- }
-
-
- if (c == '\"')
- {
- rawmode= true;
-
- while ((c = data_get()) != '\"')
- if (eof())
- error ("EOF in a string");
- else
- s += c;
-
-
- rawmode= false;
- }
- else
- s += c;
- }
-
- return s;
+ data_unget (c);
+ break;
+ }
+
+
+ if (c == '\"')
+ {
+ rawmode= true;
+
+ while ((c = data_get()) != '\"')
+ if (eof())
+ error (_("EOF in a string"));
+ else
+ s += c;
+
+
+ rawmode= false;
+ }
+ else
+ s += c;
+ }
+
+ return s;
}
-/** get a char
+/** get a char
Only class member who uses text_file::get
*/
char
Data_file::data_get() {
- char c = get();
+ char c = get();
if (!rawmode && c == '#') // gobble comment
- {
- while ((c = get()) != '\n' && !eof ())
- ;
- return '\n';
- }
+ {
+ while ((c = get()) != '\n' && !eof ())
+ ;
+ return '\n';
+ }
return c;
}
-/// read line, gobble '\n'
-String Data_file::get_line()
+/// read line, gobble '\n'
+String Data_file::get_line()
{
- char c;
+ char c;
String s;
while ((c = data_get()) != '\n' && !eof ())
- s += c;
- return s;
+ s += c;
+ return s;
}
-/// gobble stuff before first entry on a line.
+/// gobble stuff before first entry on a line.
void
-Data_file::gobble_leading_white()
+Data_file::gobble_leading_white()
{
// eat blank lines.
- while (!eof())
+ while (!eof())
{
- char c = data_get();
- if (!isspace (c))
- {
- data_unget (c);
- break;
- }
+ char c = data_get();
+ if (!isspace (c))
+ {
+ data_unget (c);
+ break;
+ }
}
}
-
-
#include "string-convert.hh"
#include "assoc-iter.hh"
-/// indent of each level
+/// indent of each level
const INDTAB = 2;
/*
int i = pretty_str.index_i ('(');
if (i>=0)
pretty_str = pretty_str.left_str (i);
-
+
int l = pretty_str.index_last_i (' '); // strip until last ' '
if (l>=0)
pretty_str = pretty_str.nomid_str (0,l+1);
{
if (!os_l_)
return *this;
-
+
String mem (strip_pretty (name));
String cl (strip_member (mem));
String idx = cl;
-
+
if (silent_assoc_p_->elt_b (mem))
idx = mem;
else if (silent_assoc_p_->elt_b (cl))
idx = cl;
- else
+ else
{
(*silent_assoc_p_)[idx] = false;
}
local_silence_b_ = (*silent_assoc_p_)[idx];
- if (current_classname_str_ != idx && !local_silence_b_)
+ if (current_classname_str_ != idx && !local_silence_b_)
{
current_classname_str_=idx;
if (!(*silent_assoc_p_)["Dstream"])
{
if (local_silence_b_|| !os_l_)
return ;
-
+
for (char const *cp = s.ch_C (); *cp; cp++)
- switch (*cp)
+ switch (*cp)
{
case '{':
case '[':
case '(': indent_level_i_ += INDTAB;
- *os_l_ << *cp;
+ *os_l_ << *cp;
break;
-
+
case ')':
case ']':
case '}':
indent_level_i_ -= INDTAB;
*os_l_ << *cp ;
-
+
assert (indent_level_i_>=0) ;
break;
-
+
case '\n':
*os_l_ << '\n' << String (' ', indent_level_i_) << flush;
- break;
+ break;
default:
*os_l_ << *cp;
break;
}
- return ;
+ return ;
}
indent_level_i_ = 0;
if (!os_l_)
return;
-
+
char const * fn =cfg_nm ? cfg_nm : ".dstreamrc";
{
ifstream ifs (fn); // can't open
}
Text_db cfg (fn);
- while (! cfg.eof()){
+ while (! cfg.eof()){
Text_record r (cfg++);
- if (r.size() != 2)
+ if (r.size() != 2)
{
- r.message ("not enough fields in Dstream init.");
+ r.message (_("not enough fields in Dstream init."));
continue;
}
(*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
Dstream::~Dstream()
-{
+{
delete silent_assoc_p_;
assert (!indent_level_i_) ;
}
void
-Dstream::clear_silence()
+Dstream::clear_silence()
{
- for (Assoc_iter<String, bool> i (*silent_assoc_p_); i.ok(); i++)
+ for (Assoc_iter<String, bool> i (*silent_assoc_p_); i.ok(); i++)
{
i.val() = false;
}
{
#ifdef NPRINT
if (b)
- cout << "Debug printout disabled, see the installation guide." << endl;
+ cout << _("Debug printout disabled, see the installation guide.") << endl;
#endif
-
+
flower_check_debug = b;
flower_dstream = &ds;
}
-
--- /dev/null
+/*
+ international.hh -- declare stuff for internationalization
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+
+ */
+
+#ifndef INTERNATIONAL_HH
+#define INTERNATIONAL_HH
+
+#define _(str) str
+
+#endif /* INTERNATIONAL_HH */
+
#include "string-handle.hh"
+/**
+ technically incorrect, but lets keep it here: this is a
+ catch all place for this stuff.
+ */
+
+#include "international.hh"
+
/**
Intuitive string class. provides
this is (Copyleft) 1996, Han-Wen Nienhuys, <hanwen@stack.nl>
*/
+
#include <stdio.h>
#include <iostream.h>
#include <assert.h>
#include "lgetopt.hh"
+#include "international.hh"
long
Getopt_long::argument_to_i()
{
long l;
- if (!optional_argument_ch_C_
+ if (!optional_argument_ch_C_
|| sscanf (optional_argument_ch_C_, "%ld", &l) != 1)
report (E_ILLEGALARG);
-
+
return l;
}
{
char const *optnm = arg_value_ch_a_a_[array_index_i_] + 2 ;
assert (*optnm);
-
+
char const *endopt = strchr (optnm, '=');
int searchlen = (endopt) ? endopt - optnm : strlen (optnm);
-
+
found_option_l_=0;
- for (int i=0; i< table_len_i_; i++)
+ for (int i=0; i< table_len_i_; i++)
{
char const *ln = option_a_[i].longname;
- if (ln && !strncmp (ln, optnm, searchlen))
+ if (ln && !strncmp (ln, optnm, searchlen))
{
found_option_l_ = option_a_+i;
break;
}
- }
+ }
- if (!found_option_l_)
+ if (!found_option_l_)
{
report (E_UNKNOWNOPTION);
return 0;
array_index_i_++;
argument_index_i_ = 0;
-
- if (found_option_l_->take_arg)
+
+ if (found_option_l_->take_arg)
{
if (endopt)
optional_argument_ch_C_ = endopt +1; // a '='
- else
+ else
{
optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
array_index_i_++;
report (E_ARGEXPECT);
}
- else
+ else
{
optional_argument_ch_C_ = 0;
if (endopt)
report (E_NOARGEXPECT);
}
-
+
return found_option_l_;
}
void
Long_option_init::printon (ostream &errorout) const
{
- if (shortname)
+ if (shortname)
errorout <<"-" << shortname;
if (shortname && longname)
errorout << ", ";
- if (longname)
+ if (longname)
errorout << "`--" << longname << "'";
}
return;
*error_ostream_l_ << arg_value_ch_a_a_[0] << ": ";
- switch (c)
+ switch (c)
{
case E_ARGEXPECT:
- *error_ostream_l_<< "option ";
+ *error_ostream_l_<< _("option ");
found_option_l_->printon (*error_ostream_l_);
- *error_ostream_l_ << "requires an argument"<<endl;
+ *error_ostream_l_ << _("requires an argument")<<endl;
break;
case E_NOARGEXPECT:
- *error_ostream_l_ << "option `--" <<
- found_option_l_->longname << "' does not allow an argument"<<endl;
+ *error_ostream_l_ << _("option `--") <<
+ found_option_l_->longname << _("' does not allow an argument")<<endl;
break;
-
+
case E_UNKNOWNOPTION:
- *error_ostream_l_ << "unrecognized option ";
+ *error_ostream_l_ << _("unrecognized option ");
if (argument_index_i_)
*error_ostream_l_ << "-" << arg_value_ch_a_a_[array_index_i_][argument_index_i_] << endl;
else
break;
case E_ILLEGALARG:
- *error_ostream_l_ << "illegal argument `" << optional_argument_ch_C_ << "\'to option ";
+ *error_ostream_l_ << _("illegal argument `") << optional_argument_ch_C_ << _("\'to option ");
found_option_l_->printon (*error_ostream_l_);
*error_ostream_l_ << '\n';
default:
assert (false);
}
- exit (2);
+ exit (2);
}
-
+
const Long_option_init *
Getopt_long::parseshort()
{
char c=arg_value_ch_a_a_[array_index_i_][argument_index_i_];
found_option_l_=0;
assert (c);
-
+
for (int i=0; i < table_len_i_; i++)
- if (option_a_[i].shortname == c)
+ if (option_a_[i].shortname == c)
{
found_option_l_ = option_a_+i;
break;
array_index_i_ ++;
argument_index_i_ = 0;
-
- if (!optional_argument_ch_C_[0])
+
+ if (!optional_argument_ch_C_[0])
{
optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
array_index_i_ ++;
}
- if (!optional_argument_ch_C_)
+ if (!optional_argument_ch_C_)
{
report (E_ARGEXPECT);
}
-
+
return found_option_l_;
}
const Long_option_init *
-Getopt_long::operator()()
+Getopt_long::operator()()
{
if (!ok())
return 0;
-
+
next();
if (!ok ())
return 0;
-
+
if (argument_index_i_)
return parseshort();
-
+
const char * argument_C = arg_value_ch_a_a_[array_index_i_];
-
+
if (argument_C[0] != '-')
return 0;
else
return 0;
}
- else
+ else
{
- if (argument_C[ 1 ])
+ if (argument_C[ 1 ])
{
argument_index_i_ = 1;
return parseshort();
}
- else
+ else
{
return 0;
}
{
error_ = E_NOERROR;
while (array_index_i_ < argument_count_i_
- && !arg_value_ch_a_a_[array_index_i_][argument_index_i_])
+ && !arg_value_ch_a_a_[array_index_i_][argument_index_i_])
{
array_index_i_++;
argument_index_i_ = 0;
}
}
-
+
char const *
Getopt_long::current_arg()
{
Getopt_long::get_next_arg()
{
char const * a = current_arg();
- if (a)
+ if (a)
{
array_index_i_ ++;
argument_index_i_= 0;
@return 4 components of the path. They can be empty
*/
void
-split_path (String path,
+split_path (String path,
String &drive, String &dirs, String &filebase, String &extension)
{
// peel off components, one by one.
int di = path.index_i (':');
- if (di >= 0)
+ if (di >= 0)
{
drive = path.left_str (di + 1);
path = path.right_str (path.len() - di -1);
}
else
drive = "";
-
+
di = path.index_last_i (PATHSEP);
- if (di >=0)
+ if (di >=0)
{
dirs = path.left_str (di + 1);
path = path.right_str (path.len()-di -1);
}
else
dirs = "";
-
+
di = path.index_last_i ('.');
- if (di >= 0)
+ if (di >= 0)
{
filebase = path.left_str (di);
- extension =path.right_str (path.len()-di);
+ extension =path.right_str (path.len()-di);
}
- else
+ else
{
- extension = "";
+ extension = "";
filebase = path;
}
}
-/** find a file.
+/** find a file.
It will search in the current dir, in the construction-arg, and
in any other added path, in this order.
*/
File_path::find (String nm) const
{
- fdebug << "looking for " << nm << ": ";
+ fdebug << _("looking for ") << nm << ": ";
if (!nm.length_i() || (nm == "-") )
return nm;
- for (int i=0; i < size(); i++)
+ for (int i=0; i < size(); i++)
{
String path = elem(i);
if (path.length_i() )
path += "/";
-
+
path += nm;
fdebug << path << "? ";
FILE *f = fopen (path.ch_C(), "r"); // ugh!
- if (f)
+ if (f)
{
- fdebug << "found\n";
+ fdebug << _("found\n");
fclose (f);
return path;
}
Text_stream::Text_stream (String fn)
{
ios::sync_with_stdio();
- if (fn == "")
+ if (fn == "")
{
- name = "<STDIN>";
+ name = _("<STDIN>");
f = stdin;
}
-
- else
+
+ else
{
- name = fn;
+ name = fn;
f = fopen (fn.ch_C (), "r");
}
-
- if (!f)
+
+ if (!f)
{
- cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
+ cerr <<__FUNCTION__<< _(": can't open `") << fn << "'\n";
exit (1);
}
{
cerr << "\n"<<get_name() << ": " << line ()<<": "<<s<<endl;
}
-
% generated automatically by mf-to-table.py version 0.4
-% on Tue Oct 14 23:56:57 1997
+% on Mon Oct 20 01:50:48 1997
% Do not edit
% input from out/font-en-tja16.log
% name=\symboltables {
"pedaltoe" "\\pedaltoe" -2.00\pt 2.00\pt -0.00\pt 6.00\pt
}
"floogbars" = \table {
- "3u" "\\eighthflag" -0.20\pt 4.18\pt -12.77\pt 0.20\pt
- "3d" "\\deighthflag" -0.20\pt 4.18\pt -0.20\pt 12.77\pt
+ "3u" "\\eighthflag" -0.20\pt 4.16\pt -12.83\pt 0.20\pt
+ "3d" "\\deighthflag" -0.20\pt 4.60\pt -0.20\pt 12.83\pt
+ "4u" "\\sixteenthflag" -0.20\pt 4.16\pt -13.00\pt 0.20\pt
+ "4d" "\\dsixteenthflag" -0.20\pt 4.60\pt -0.20\pt 12.00\pt
}
% } % $name
% generated automatically by mf-to-table.py version 0.4
-% on Tue Oct 14 23:57:04 1997
+% on Mon Oct 20 01:50:55 1997
% Do not edit
% input from out/font-en-tja20.log
% name=\symboltables {
"pedaltoe" "\\pedaltoe" -2.50\pt 2.50\pt -0.00\pt 7.50\pt
}
"floogbars" = \table {
- "3u" "\\eighthflag" -0.25\pt 5.23\pt -15.91\pt 0.25\pt
- "3d" "\\deighthflag" -0.25\pt 5.23\pt -0.25\pt 15.91\pt
+ "3u" "\\eighthflag" -0.25\pt 5.20\pt -16.04\pt 0.25\pt
+ "3d" "\\deighthflag" -0.25\pt 5.75\pt -0.25\pt 16.04\pt
+ "4u" "\\sixteenthflag" -0.25\pt 5.20\pt -16.25\pt 0.25\pt
+ "4d" "\\dsixteenthflag" -0.25\pt 5.75\pt -0.25\pt 15.00\pt
}
% } % $name
\multi 2 < { \stemup c1 } {\stemdown r1}>
\stemboth
- c8_. c''8-> c16^^ c16_^
- c32 _| c32^| g''32-\ltoe g''32-\lheel
+ e8_. g'8-> e16^^ g'16_^
+ e32 _| g'32^| g''32-\ltoe g''32-\lheel
}
\paper{
gourlay_maxmeasures =5.;
\output "lelie20.tex";
}
% oeps
- \midi{ }
+% \midi{ }
}
Includable_lexer::new_input(String s, Sources * global_sources)
{
Source_file * sl = global_sources->get_file_l(s);
- if (!sl)
+ if (!sl)
{
- String msg ="Can't find file `" + s+ "'";
+ String msg =_("Can't find file `") + s+ "'";
LexerError(msg.ch_C ());
- return;
+ return;
}
-
+
char_count_stack_.push(0);
- if (yy_current_buffer)
+ if (yy_current_buffer)
state_stack_.push(yy_current_buffer);
cout << "[" << s<<flush;
- include_stack_.push(sl);
-
+ include_stack_.push(sl);
+
/*
ugh. We'd want to create a buffer from the bytes directly.
Whoops. The size argument to yy_create_buffer is not the
filelength but a BUFFERSIZE. Maybe this is why reading stdin fucks up.
-
+
*/
- yy_switch_to_buffer(yy_create_buffer(sl->istream_l(), YY_BUF_SIZE));
+ yy_switch_to_buffer(yy_create_buffer(sl->istream_l(), YY_BUF_SIZE));
}
/** pop the inputstack. conceptually this is a destructor, but it
cout << "]"<<flush;
yy_delete_buffer(yy_current_buffer);
yy_current_buffer = 0;
- if (state_stack_.empty())
+ if (state_stack_.empty())
{
return false;
}
- else
+ else
{
yy_switch_to_buffer(state_stack_.pop());
return true;
Includable_lexer::~Includable_lexer()
{
- while (!include_stack_.empty())
+ while (!include_stack_.empty())
{
close_input();
}
}
-/**
+/**
Since we don't create the buffer state from the bytes directly, we
don't know about the location of the lexer. Add this as a
YY_USER_ACTION */
Input::message(String message_str) const
{
String str = "";
-
- if (source_file_l_)
+
+ if (source_file_l_)
{
str += location_str() + String(": ");
}
-
+
str += message_str;
- if (source_file_l_)
+ if (source_file_l_)
{
str += ":\n";
str += source_file_l_->error_str(defined_ch_C_);
void
Input::warning(String message_str) const
{
- message("warning: " + message_str);
+ message(_("warning: ") + message_str);
}
void
Input::error(String s) const
{
- message("error: "+ s);
+ message(_("error: ")+ s);
}
String
Input::location_str() const
{
- if (source_file_l_)
+ if (source_file_l_)
return source_file_l_->file_line_no_str(defined_ch_C_);
else
- return "(location unknown)";
+ return _("(location unknown)");
}
#include <sys/stat.h> // open
#include <sys/mman.h> // mmap
#include <limits.h> // INT_MAX
-#include <fcntl.h> // open
+#include <fcntl.h> // open
#include <unistd.h> // close, stat
#include <stdio.h> // fdopen
#include <string.h> // strerror
data_caddr_ = (caddr_t)mmap((void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0);
if ((int)data_caddr_ == -1)
- warning(String("can't map: error no: ") + strerror(errno));
+ warning(String(_("can't map: error no: ")) + strerror(errno));
}
void
Mapped_file_storage::open(String name_str)
{
- fildes_i_ = ::open(name_str.ch_C (), O_RDONLY);
-
- if (fildes_i_ == -1)
+ fildes_i_ = ::open(name_str.ch_C (), O_RDONLY);
+
+ if (fildes_i_ == -1)
{
- warning(String("can't open: ") + name_str + String(": ") + strerror(errno));
+ warning(String(_("can't open: ")) + name_str + String(": ") + strerror(errno));
return;
}
void
Mapped_file_storage::unmap()
{
- if (data_caddr_)
+ if (data_caddr_)
{
munmap(data_caddr_, size_off_);
data_caddr_ = 0;
Mapped_file_storage::close()
{
unmap();
- if (fildes_i_)
+ if (fildes_i_)
{
::close(fildes_i_);
fildes_i_ = 0;
/**
Stupid but foolproof way of opening files.
- TODO
+ TODO
Should check IO status
This is of course a build it yourself version of mmap, so we should
have been using that... (see Mapped_file_storage) But we noticed
some problems with this (unexplained lexer crashes)
-
+
[Some versions later] The crashes aren't caused by the mmap
code. But no reason to take it out, is there? */
data_p_ =0;
/*
- let's hope that "b" opens anything binary, and does not apply
+ let's hope that "b" opens anything binary, and does not apply
CR/LF translation
*/
FILE * f = (s.length_i ()) ? fopen (s.ch_C(), "rb") : stdin;
-
- if (!f)
+
+ if (!f)
{
- warning("can't open file `" + s + "'");
+ warning(_("can't open file `") + s + "'");
return ;
}
data_p_[len_i_] = 0;
ret = fread(data_p_, sizeof(char), len_i_, f);
-
+
if (ret!=len_i_)
- warning ("Huh? got " + String(ret) + ", expected "
- + String(len_i_) + " characters");
+ warning (_("Huh? got ") + String(ret) + _(", expected ")
+ + String(len_i_) + _(" characters"));
if (f != stdin)
fclose(f);
{
return len_i_;
}
-
+
Simple_file_storage::~Simple_file_storage()
{
source file of the GNU LilyPond music typesetter
- (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
& Han-Wen Nienhuys <hanwen@stack.nl>
*/
if (!name_str_.length_i())
return &cin;
*/
-
- if (!istream_p_)
+
+ if (!istream_p_)
{
if (length_i()) // can-t this be done without such a hack?
istream_p_ = new istrstream(ch_C(), length_i());
- else
+ else
{
istream_p_ = new istrstream("", 0);
istream_p_->set(ios::eofbit);
Source_file::file_line_no_str(char const *context_ch_C) const
{
if (!ch_C())
- return "(unknown)";
+ return _("(unknown)");
else
return name_str() + ": "
+ String(line_i(context_ch_C));
char const* data_ch_C = ch_C();
char const * eof_C_ = data_ch_C + length_i();
if (!in_b(pos_ch_C))
- return "(position unknown)";
+ return _("(position unknown)");
+
-
if (pos_ch_C == eof_C_)
pos_ch_C --;
char const* begin_ch_C = pos_ch_C;
while (begin_ch_C > data_ch_C)
- if (*--begin_ch_C == '\n')
+ if (*--begin_ch_C == '\n')
{
begin_ch_C++;
break;
char const* end_ch_C = pos_ch_C;
while (end_ch_C < eof_C_)
- if (*end_ch_C++ == '\n')
+ if (*end_ch_C++ == '\n')
{
end_ch_C--;
break;
}
-
+
// String(char const* p, int length) is missing!?
String line_str((Byte const*)begin_ch_C, end_ch_C - begin_ch_C);
else
error_col_i++;
- String str = line_str.left_str(pos_ch_C - begin_ch_C)
+ String str = line_str.left_str(pos_ch_C - begin_ch_C)
+ String('\n')
- + String(' ', error_col_i)
+ + String(' ', error_col_i)
+ line_str.mid_str(pos_ch_C - begin_ch_C, INT_MAX); // String::mid should take 0 arg..
return str;
}
char const* scan_ch_C = ch_C();
if (!scan_ch_C)
return 0;
-
+
while (scan_ch_C < pos_ch_C)
if (*scan_ch_C++ == '\n')
i++;
void
error(String s)
{
- cerr << "error: " << s << "\n";
-
+ cerr << _("error: ") << s << "\n";
+
exit(1);
}
void
warning(String m)
{
- cerr << "warning: " <<m <<endl;
+ cerr << _("warning: ") <<m <<endl;
}
MAJOR_VERSION = 0
MINOR_VERSION = 1
-PATCH_LEVEL = 23
+PATCH_LEVEL = 24
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
Musical_req* mus_l = r->musical ();
if (!mus_l)
return false;
-
+
Abbreviation_beam_req * b = mus_l->abbrev_beam ();
if (!b)
return false;
-
+
if (bool (abeam_p_) == bool (b->spantype == Span_req::START))
return false;
-
+
Direction d = (!abeam_p_) ? LEFT : RIGHT;
if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l))
return false;
-
+
span_reqs_drul_[d] = b;
return true;
}
void
Abbreviation_beam_engraver::do_removal_processing ()
{
- if (abeam_p_)
+ if (abeam_p_)
{
- span_reqs_drul_[LEFT]->warning ("unterminated beam");
+ span_reqs_drul_[LEFT]->warning (_("unterminated beam"));
typeset_element (abeam_p_);
abeam_p_ = 0;
}
return;
Stem* s = (Stem*)i.elem_l_->item ();
-
+
int type_i = span_reqs_drul_[LEFT]->type_i_;
s->flag_i_ = intlog2 (type_i) - 2;
if (span_reqs_drul_[RIGHT])
if (s->type_i () != 1) // no abbrev gaps on half note
s->beam_gap_i_ = s->flag_i_ - ((s->type_i () >? 2) - 2);
-
+
abeam_p_->add (s);
-}
+}
Atom::print() const
{
#ifndef NPRINT
- DOUT << "texstring: " <<tex_<<"\n";
-
+ DOUT << "texstring: " <<tex_<<"\n";
+
DOUT << "dim:";
for (Axis i=X_AXIS; i < NO_AXES; incr(i))
DOUT << axis_name_str(i) << " = " << dim_[i].str();
String
-Atom::str() const
+Atom::str() const
{
- return "Atom (\'"+tex_+"\', (" + dim_.x().str () + ", "
+ return "Atom (\'"+tex_+"\', (" + dim_.x().str () + ", "
+ dim_.y ().str () + "))";
}
Axis ax = (Axis)a;
if (abs (off[ax]) >= 100 CM)
{
- warning ("ridiculous dimension " + axis_name_str (ax) + ", "
+ warning (_("ridiculous dimension ") + axis_name_str (ax) + ", "
+print_dimen(off[ax]));
off[ax] = 0.0;
- tex_str += "\errormark";
+ tex_str += "\errormark";
}
}
// whugh.. Hard coded...
void
Atom::translate_axis (Real r, Axis a)
{
- off_[a] += r;
+ off_[a] += r;
}
void
Musical_req* mus_l = r->musical();
if (!mus_l)
return false;
-
+
Beam_req * b = mus_l->beam();
if (!b)
return false;
-
+
if (bool (beam_p_) == bool (b->spantype == Span_req::START))
return false;
-
+
Direction d = (!beam_p_) ? LEFT : RIGHT;
if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l))
return false;
-
+
span_reqs_drul_[d] = b;
return true;
}
if ( !beam_p_ && span_reqs_drul_[LEFT]) {
current_grouping_p_ = new Rhythmic_grouping;
beam_p_ = new Beam;
- if (span_reqs_drul_[LEFT]->nplet)
+ if (span_reqs_drul_[LEFT]->nplet)
{
Text_spanner* t = new Text_spanner();
Text_def *defp = new Text_def;
void
Beam_engraver::do_removal_processing()
{
- if (beam_p_)
+ if (beam_p_)
{
- span_reqs_drul_[LEFT]->warning ("unterminated beam");
+ span_reqs_drul_[LEFT]->warning (_("unterminated beam"));
typeset_element (beam_p_);
beam_p_ =0;
}
Stem* s = (Stem*)i.elem_l_->item();
Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic ();
- if (rhythmic_req->duration_.durlog_i_<= 2)
+ if (rhythmic_req->duration_.durlog_i_<= 2)
{
- rhythmic_req->warning ("Stem doesn't fit in Beam");
+ rhythmic_req->warning (_("Stem doesn't fit in Beam"));
return;
}
-
+
/*
TODO: do something sensible if it doesn't fit in the beam.
*/
rhythmic_req->duration ());
s->flag_i_ = rhythmic_req->duration_.durlog_i_;
beam_p_->add (s);
-}
-
+}
+
IMPLEMENT_IS_TYPE_B1(Beam_engraver, Engraver);
ADD_THIS_TRANSLATOR(Beam_engraver);
TODO
Less hairy code. knee: ([\stem 1; c8 \stem -1; c8]
-
+
*/
#include <math.h>
}
Molecule*
-Beam::brew_molecule_p() const
+Beam::brew_molecule_p() const
{
Molecule *mol_p = new Molecule;
// huh? inter-what
// Real inter_f = paper()->interbeam_f ();
Real inter_f = paper()->internote_f ();
Real x0 = stems[0]->hpos_f();
- for (int j=0; j <stems.size(); j++)
+ for (int j=0; j <stems.size(); j++)
{
Stem *i = stems[j];
Stem * prev = (j > 0)? stems[j-1] : 0;
void
Beam::do_post_processing()
{
- if (stems.size() < 2)
+ if (stems.size() < 2)
{
- warning ("Beam with less than 2 stems");
+ warning (_("Beam with less than 2 stems"));
transparent_b_ = true;
return ;
}
- solve_slope();
+ solve_slope();
set_stemlens();
}
void
Beam::do_substitute_dependent (Score_elem*o,Score_elem*n)
{
- if (o->is_type_b (Stem::static_name()))
+ if (o->is_type_b (Stem::static_name()))
stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0);
}
int up = 0, down = 0;
int up_count = 0, down_count = 0;
- for (int i=0; i <stems.size(); i++)
+ for (int i=0; i <stems.size(); i++)
{
Stem *sl = stems[i];
int cur_down = sl->get_center_distance_from_top();
int cur_up = sl->get_center_distance_from_bottom();
- if (cur_down)
+ if (cur_down)
{
down += cur_down;
down_count++;
}
- if (cur_up)
+ if (cur_up)
{
up += cur_up;
up_count++;
// up / up_count > down / down_count
dir_ = (up * down_count > down * up_count) ? UP : DOWN;
- for (int i=0; i <stems.size(); i++)
+ for (int i=0; i <stems.size(); i++)
{
Stem *sl = stems[i];
sl->dir_ = dir_;
Beam::solve_slope()
{
Array<Stem_info> sinfo;
- for (int j=0; j <stems.size(); j++)
+ for (int j=0; j <stems.size(); j++)
{
Stem *i = stems[j];
i->set_default_extents();
if (i->invisible_b())
continue;
-
+
Stem_info info (i);
sinfo.push (info);
}
if (! sinfo.size())
slope = left_pos = 0;
- else if (sinfo.size() == 1)
+ else if (sinfo.size() == 1)
{
slope = 0;
left_pos = sinfo[0].idealy_f_;
}
- else
+ else
{
-
+
Real leftx = sinfo[0].x;
Least_squares l;
- for (int i=0; i < sinfo.size(); i++)
+ for (int i=0; i < sinfo.size(); i++)
{
sinfo[i].x -= leftx;
l.input.push (Offset (sinfo[i].x, sinfo[i].idealy_f_));
l.minimise (slope, left_pos);
}
-
+
Real dy = 0.0;
- for (int i=0; i < sinfo.size(); i++)
+ for (int i=0; i < sinfo.size(); i++)
{
Real y = sinfo[i].x * slope + left_pos;
Real my = sinfo[i].miny_f_;
if (my - y > dy)
- dy = my -y;
+ dy = my -y;
}
left_pos += dy;
- left_pos *= dir_;
+ left_pos *= dir_;
slope *= dir_;
This neat trick is by Werner Lemberg, damped = tanh (slope) corresponds
with some tables in [Wanske]
*/
- slope = 0.6 * tanh (slope);
+ slope = 0.6 * tanh (slope);
// ugh
Real sl = slope*paper()->internote_f ();
void
Beam::set_stemlens()
{
- Real x0 = stems[0]->hpos_f();
- for (int j=0; j <stems.size(); j++)
+ Real x0 = stems[0]->hpos_f();
+ for (int j=0; j <stems.size(); j++)
{
Stem *s = stems[j];
Real x = s->hpos_f()-x0;
- s->set_stemend (left_pos + slope * x);
+ s->set_stemend (left_pos + slope * x);
}
}
def.OK();
cur.OK();
assert (cur.children.size() == stems.size ());
-
+
cur.split (def);
Array<int> b;
{
Array<int> flags;
- for (int j=0; j <stems.size(); j++)
+ for (int j=0; j <stems.size(); j++)
{
Stem *s = stems[j];
assert (stems.size() == b.size ()/2);
}
- for (int j=0, i=0; i < b.size() && j <stems.size (); i+= 2, j++)
+ for (int j=0, i=0; i < b.size() && j <stems.size (); i+= 2, j++)
{
Stem *s = stems[j];
s->beams_left_i_ = b[i];
Molecule rightbeams;
/* half beams extending to the left. */
- if (prev)
+ if (prev)
{
int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ;
int lwholebeams= here->beams_left_i_ <? prev->beams_right_i_ ;
if (lhalfs) // generates warnings if not
a = paper()->lookup_l ()->beam (sl, w);
a.translate (Offset (-w, -w * sl));
- for (int j = 0; j < lhalfs; j++)
+ for (int j = 0; j < lhalfs; j++)
{
Atom b (a);
b.translate_axis (-dir_ * dy * (lwholebeams+j), Y_AXIS);
leftbeams.add (b);
}
}
-
+
if (next)
{
int rhalfs = here->beams_right_i_ - next->beams_left_i_;
- int rwholebeams = here->beams_right_i_ <? next->beams_left_i_;
+ int rwholebeams = here->beams_right_i_ <? next->beams_left_i_;
Real w = next->hpos_f() - here->hpos_f ();
Atom a = paper()->lookup_l ()->beam (sl, w + stemdx);
if (here->beam_gap_i_)
{
int nogap = rwholebeams - here->beam_gap_i_;
- for (; j < nogap; j++)
+ for (; j < nogap; j++)
{
Atom b (a);
b.translate_axis (-dir_ * dy * j, Y_AXIS);
- rightbeams.add (b);
+ rightbeams.add (b);
}
// TODO: notehead widths differ for different types
gap_f = paper()->note_width () / 2;
a = paper()->lookup_l ()->beam (sl, w + stemdx);
}
- for (; j < rwholebeams; j++)
+ for (; j < rwholebeams; j++)
{
Atom b (a);
b.translate (Offset (gap_f, -dir_ * dy * j));
- rightbeams.add (b);
+ rightbeams.add (b);
}
w /= 4;
if (rhalfs)
a = paper()->lookup_l ()->beam (sl, w);
-
- for (; j < rwholebeams + rhalfs; j++)
+
+ for (; j < rwholebeams + rhalfs; j++)
{
Atom b (a);
b.translate_axis (-dir_ * dy * j, Y_AXIS);
- rightbeams.add (b);
+ rightbeams.add (b);
}
-
+
}
leftbeams.add (rightbeams);
return leftbeams;
#include "cpu-timer.hh"
String
-Col_stats::str() const {
+Col_stats::str() const {
String s (count_i_);
- s += " lines";
+ s += _(" lines");
if (count_i_)
- s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)");
-
+ s += String (Real (cols_i_)/count_i_, _(", (with an average of %.1f columns)"));
+
return s;
}
Break_algorithm::all_cols() const
{
Line_of_cols retval;
- for (PCursor<Paper_column*> c (pscore_l_->col_p_list_.top());
- c.ok(); c++)
+ for (PCursor<Paper_column*> c (pscore_l_->col_p_list_.top());
+ c.ok(); c++)
{
-
+
retval.push (c);
}
return retval;
}
-Array<int>
+Array<int>
Break_algorithm::find_break_indices() const
{
Line_of_cols all (all_cols());
Array<int> retval;
-
+
for (int i=0; i < all.size(); i++)
if (all[i]->breakable_b_)
retval.push (i);
-
+
if (linelength <=0)
while (retval.size() >2)
retval.del (1);
{
Line_of_cols all (all_cols());
Line_of_cols retval;
-
+
for (int i=0; i < all.size(); i++)
if (all[i]->breakable_b_)
retval.push (all[i]);
-
+
Line_spacer*
Break_algorithm::generate_spacing_problem (Line_of_cols curline) const
{
if (linelength <= 0)
return true;
-
+
Real l =0;
for (int i=0; i < curline.size(); i++)
l +=curline[i]->width().length ();
- return l < linelength;
+ return l < linelength;
}
void
Break_algorithm::problem_OK() const
{
if (!pscore_l_->col_p_list_.size())
- error ("Score does not have any columns");
+ error (_("Score does not have any columns"));
OK();
}
#ifndef NDEBUG
iter_top (pscore_l_->col_p_list_,start);
PCursor<Paper_column *> end (pscore_l_->col_p_list_.bottom());
-
- assert (start->breakable_b_);
+
+ assert (start->breakable_b_);
assert (end->breakable_b_);
#endif
}
Cpu_timer timer;
Array<Col_hpositions> h= do_solve();
-
+
if (approx_stats_.count_i_)
- *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
+ *mlog << _("\nApproximated: ") << approx_stats_.str() << "\n";
if (exact_stats_.count_i_)
- *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
- *mlog << "Time: " << String(timer.read (), "%.2f") << " seconds\n";
-
+ *mlog << _("Calculated exactly: ") << exact_stats_.str() << "\n";
+ *mlog << _("Time: ") << String(timer.read (), "%.2f") << _(" seconds\n");
+
return h;
}
void
Break_algorithm::do_set_pscore()
{
-
-}
+}
Clef_engraver::set_type (String s)
{
clef_type_str_ = s;
- if (clef_type_str_ == "violin")
+ if (clef_type_str_ == "violin")
{
c0_position_i_= -6;
}
- else if (clef_type_str_ == "alto")
+ else if (clef_type_str_ == "alto")
{
c0_position_i_= 0;
}
- else if (clef_type_str_ == "tenor")
+ else if (clef_type_str_ == "tenor")
{
c0_position_i_= 2;
}
- else if (clef_type_str_ == "bass")
+ else if (clef_type_str_ == "bass")
{
c0_position_i_= 6;
}
- else
+ else
return false;
-
+
return true;
}
i.c0_position_i_l_ = &c0_position_i_;
}
-void
+void
Clef_engraver::read_req (Clef_change_req*c_l)
{
if (!set_type (c_l->clef_str_))
- c_l->error ("unknown clef type ");
+ c_l->error (_("unknown clef type "));
}
void
Clef_engraver::acknowledge_element (Score_elem_info info)
{
- if (info.elem_l_->name() == Bar::static_name () && clef_type_str_.length_i())
+ if (info.elem_l_->name() == Bar::static_name () && clef_type_str_.length_i())
{
create_clef();
if (!clef_req_l_)
if (!creq_l || !creq_l->clefchange())
return false;
- clef_req_l_ = creq_l->clefchange();
- read_req (clef_req_l_);
+ clef_req_l_ = creq_l->clefchange();
+ read_req (clef_req_l_);
return true;
}
-void
+void
Clef_engraver::create_clef()
{
- if (!clef_p_)
+ if (!clef_p_)
{
clef_p_ = new Clef_item;
announce_element (Score_elem_info (clef_p_,clef_req_l_));
void
Clef_engraver::do_process_requests()
{
- if (clef_req_l_)
+ if (clef_req_l_)
{
create_clef();
clef_p_->default_b_ = false;
/**
should derive of Array.
*/
-static
+static
int idx (int dir, bool h_shift_b)
{
assert (abs (dir) == 1);
int j = dir > 0 ? 0 : 3;
- if (h_shift_b)
+ if (h_shift_b)
j += dir;
return j;
}
/** This complicated routine moves note columns around horizontally
- (and rests vertically) to ensure that notes don't clash.
+ (and rests vertically) to ensure that notes don't clash.
- This should be done better, probably.
+ This should be done better, probably.
This routine is dedicated to Stine Randmael :-)
{
if (clash_l_arr_.size() <= 1)
return;
-
+
/*
[stem up, stem up shifted, stem down shifted, stem down]
*/
Array<Note_column*> clash_group_arr_a[4];
-
- for (int i=0; i < clash_l_arr_.size(); i++)
+
+ for (int i=0; i < clash_l_arr_.size(); i++)
{
Note_column* c_l = clash_l_arr_[i];
- if (! c_l->dir_)
+ if (! c_l->dir_)
{
- warning ("No stem direction set. Ignoring column in clash. ");
+ warning (_("No stem direction set. Ignoring column in clash. "));
continue;
}
int d = (c_l->dir_);
-
+
clash_group_arr_a[idx (d, c_l->h_shift_b_)].push (c_l);
}
-
-
- for (int j=0; j < 4; j++)
+
+
+ for (int j=0; j < 4; j++)
{
- if (clash_group_arr_a[j].size() > 1)
+ if (clash_group_arr_a[j].size() > 1)
{
- warning ("Too many clashing notecolumns. Ignoring them.");
+ warning (_("Too many clashing notecolumns. Ignoring them."));
return;
}
}
int d = 1;
- do
+ do
{
if (!clash_group_arr_a[idx (d, false)].size())
{
}
}
while ((d *= -1) != 1);
-
+
Interval_t<int> y_extent[4];
Note_column * col_l_a[4];
Real x_off [4];
int y_off[4];
-
- for (int j =0 ; j < 4; j++)
+
+ for (int j =0 ; j < 4; j++)
{
- if (clash_group_arr_a[j].size())
+ if (clash_group_arr_a[j].size())
col_l_a[j] = clash_group_arr_a[j][0];
else
col_l_a[j] = 0;
-
- if (col_l_a[j])
+
+ if (col_l_a[j])
{
y_extent[j] = col_l_a[j]->head_positions_interval();
}
x_off [j] = 0.0;
y_off[j] = 0;
}
-
- do
+
+ do
{
x_off[idx (d, true)] = d*0.5;
}
while ((d *= -1) != 1);
-
+
// y_extent: smallest y-pos noteball interval containing all balls
- // 4 (0..3) groups: stem up/down; shift on/off;
+ // 4 (0..3) groups: stem up/down; shift on/off;
Interval_t<int> middle (y_extent[idx (-1,0)].max(),
y_extent[idx (1,0)].min());
Interval_t<int> open_middle (y_extent[idx (-1,0)].max()+1, y_extent[idx (1,0)].min ()-1);
if (!open_middle.contains_b (y_extent[idx (d,true)]))
x_off[idx (d, true)] = d *1.0 ;
} while ((d *= -1) != 1);
-
- if (!middle.empty_b()
- && middle.length() < 2 && col_l_a[idx (1,0)] && col_l_a[idx (-1,0)]) {
+
+ if (!middle.empty_b()
+ && middle.length() < 2 && col_l_a[idx (1,0)] && col_l_a[idx (-1,0)]) {
// reproduction of bugfix at 3am ?
Note_head * nu_l= col_l_a[idx (1,0)]->head_l_arr_[0];
Note_head * nd_l = col_l_a[idx (-1,0)]->head_l_arr_.top();
- if (! (nu_l->balltype_i_ == nd_l->balltype_i_
- && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0))
+ if (! (nu_l->balltype_i_ == nd_l->balltype_i_
+ && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0))
{
x_off[idx (1,0)] -= 0.5;
x_off[idx (1,1)] -= 0.5;
x_off[idx (-1,1)] += 0.5;
x_off[idx (-1,0)] += 0.5;
}
-
+
}
Real inter_f = paper()->internote_f ();
Real wid_f = paper()->note_width ();
- for (int j=0; j < 4; j++)
+ for (int j=0; j < 4; j++)
{
- if (col_l_a[j])
+ if (col_l_a[j])
{
- /* collision.cc:138: request for method `translate' is ambiguous
-
+ /* collision.cc:138: request for method `translate' is ambiguous
+
(shaddup)
*/
Offset o (x_off[j] * wid_f, y_off[j] * inter_f);
void
Collision::do_substitute_dependency (Score_elem*o_l,Score_elem*n_l)
{
- clash_l_arr_.substitute ((Note_column*)o_l->item(),
+ clash_l_arr_.substitute ((Note_column*)o_l->item(),
(Note_column*)(n_l?n_l->item():0));
}
Cadenza_req::do_equal_b (Request*r) const
{
Cadenza_req*cad = r->command()->timing ()->cadenza ();
-
+
return cad->on_b_ == on_b_;
}
Meter_change_req::do_equal_b (Request * r) const
{
Meter_change_req * m = r->command()->timing ()->meterchange ();
-
- return m->beats_i_ == beats_i_
+
+ return m->beats_i_ == beats_i_
&& one_beat_i_ == m->one_beat_i_;
}
Tempo_req::do_equal_b (Request *r) const
{
Tempo_req *t = r->command()->timing ()->tempo ();
-
+
return t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
}
void
Measure_grouping_req::do_print() const
{
- for (int i=0; i < elt_length_arr_.size(); i++)
+ for (int i=0; i < elt_length_arr_.size(); i++)
{
DOUT << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
}
}
-bool
+bool
Measure_grouping_req::do_equal_b (Request*) const
{
return false; // todo
void
Key_change_req::transpose (Melodic_req const & d) const
{
- WARN << "don't know how to transpose a key. \n";
- for (int i=0; i < melodic_p_arr_.size(); i++)
+ WARN << _("don't know how to transpose a key. \n");
+ for (int i=0; i < melodic_p_arr_.size(); i++)
{
melodic_p_arr_[i]->transpose (d);
}
void
Key_change_req::squash_octaves()
{
- for (int i=0; i < melodic_p_arr_.size(); i++)
+ for (int i=0; i < melodic_p_arr_.size(); i++)
{
melodic_p_arr_[i]->octave_i_ = 0;
}
Key_change_req::do_print() const
{
#ifndef NPRINT
- for (int i=0; i < melodic_p_arr_.size(); i++)
+ for (int i=0; i < melodic_p_arr_.size(); i++)
{
melodic_p_arr_[i]->print();
}
Key_change_req::Key_change_req (Key_change_req const&c)
{
- for (int i=0; i < c.melodic_p_arr_.size(); i++)
+ for (int i=0; i < c.melodic_p_arr_.size(); i++)
melodic_p_arr_.push (c.melodic_p_arr_[i]->clone()->musical ()->melodic ());
minor_b_ = c.minor_b_;
multi_octave_b_ = c.multi_octave_b_;
Key_change_req::flats_i()
{
int flats_i = 0;
- for (int i = 0; i < melodic_p_arr_.size(); i++)
+ for (int i = 0; i < melodic_p_arr_.size(); i++)
{
Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
assert (mel_l);
int
Key_change_req::minor_b()
{
- return minor_b_;
+ return minor_b_;
}
int
Key_change_req::sharps_i()
{
int sharps_i = 0;
- for (int i = 0; i < melodic_p_arr_.size(); i++)
+ for (int i = 0; i < melodic_p_arr_.size(); i++)
{
Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
assert (mel_l);
}
return sharps_i;
}
-
Atom
Crescendo::get_symbol() const
-{
+{
Real w_dim = width().length ();
- if (dyn_b_drul_[LEFT])
+ if (dyn_b_drul_[LEFT])
{
w_dim -= absdyn_dim;
}
- if (dyn_b_drul_[RIGHT])
+ if (dyn_b_drul_[RIGHT])
{
w_dim -= absdyn_dim;
}
-
- if (w_dim < 0)
+
+ if (w_dim < 0)
{
- warning ("Crescendo too small");
+ warning (_("Crescendo too small"));
w_dim = 0;
}
Real x_off_dim=0.0;
if (dyn_b_drul_[LEFT])
x_off_dim += absdyn_dim;
-
+
m_p = new Molecule;
Atom s (get_symbol());
m_p->add (Atom (s));
// ugh
struct _Dinit {
- _Dinit()
+ _Dinit()
{
nulldev = new ofstream ("/dev/null");
monitor = new Dstream (&cout,".dstreamrc");
}
- ~_Dinit()
+ ~_Dinit()
{
delete nulldev;
delete monitor;
void
float_handler (int)
{
- cerr << "Floating point exception .. \n"<< flush;
+ cerr << _("Floating point exception .. \n")<< flush;
assert (false);
}
void
debug_init()
{
- rat_printer = print_rat;
+ rat_printer = print_rat;
#ifndef NDEBUG
set_new_handler (&mynewhandler);
#endif
set_flower_debug (*monitor, check_debug);
-
+
signal (SIGFPE, float_handler);
-}
+}
bool check_debug=false;
check_debug =b;
set_flower_debug (*monitor, check_debug);
}
-
-
i--;
}
String unit (s + i+1);
- return convert_dimen (dim.value_f(), unit);
+ return convert_dimen (dim.value_f(), unit);
}
return quant*CM_TO_PT/10;
if (unit == "in")
return quant * INCH_TO_PT;
- error ("unknown length unit: `" + unit+"'");
+ error (_("unknown length unit: `") + unit+"'");
}
String
dynamic_req_l_arr_.clear();
}
-bool
+bool
Dynamic_engraver::do_try_request (Request * r)
{
Musical_req * m = r->musical();
void
Dynamic_engraver::do_process_requests()
{
- Crescendo* new_cresc_p=0;
- for (int i=0; i < dynamic_req_l_arr_.size(); i++)
+ Crescendo* new_cresc_p=0;
+ for (int i=0; i < dynamic_req_l_arr_.size(); i++)
{
Dynamic_req *dreq_l = dynamic_req_l_arr_[i];
- if (dreq_l->absdynamic())
+ if (dreq_l->absdynamic())
{
Text_def * td_p = new Text_def;
td_p->align_i_ = 0;
- String loud = dreq_l->absdynamic()->loudness_str ();
+ String loud = dreq_l->absdynamic()->loudness_str ();
td_p->text_str_ = paper()->lookup_l ()->dynamic (loud).tex_;
td_p->style_str_ = "dynamic";
assert (!dynamic_p_) ; // TODO
-
+
dynamic_p_ = new Text_item (td_p);
announce_element (Score_elem_info (dynamic_p_, dreq_l));
}
- else if (dreq_l->span_dynamic())
+ else if (dreq_l->span_dynamic())
{
Span_dynamic_req* span_l = dreq_l->span_dynamic();
- if (span_l->spantype == Span_req::STOP)
+ if (span_l->spantype == Span_req::STOP)
{
- if (!cresc_p_)
+ if (!cresc_p_)
{
- span_l->warning ("Can't find cresc to end ");
+ span_l->warning (_("Can't find cresc to end "));
}
- else
+ else
{
assert (!to_end_cresc_p_);
to_end_cresc_p_ =cresc_p_;
cresc_p_ = 0;
}
}
- else if (span_l->spantype == Span_req::START)
+ else if (span_l->spantype == Span_req::START)
{
cresc_req_l_ = span_l;
assert (!new_cresc_p);
}
}
- if (new_cresc_p)
+ if (new_cresc_p)
{
cresc_p_ = new_cresc_p;
cresc_p_->set_bounds(LEFT,get_staff_info().musical_l ());
- if (dynamic_p_)
+ if (dynamic_p_)
{
cresc_p_->dyn_b_drul_[LEFT] = true;
}
Dynamic_engraver::do_pre_move_processing()
{
Staff_symbol* s_l = get_staff_info().staff_sym_l_;
- if (dynamic_p_)
+ if (dynamic_p_)
{
dynamic_p_->set_staffsym (s_l);
typeset_element (dynamic_p_);
dynamic_p_ = 0;
}
- if (to_end_cresc_p_)
+ if (to_end_cresc_p_)
{
if (dynamic_p_)
to_end_cresc_p_->dyn_b_drul_[RIGHT]=true;
-
+
to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ());
to_end_cresc_p_->set_staffsym (s_l);
typeset_element (to_end_cresc_p_);
if (to_end_cresc_p_)
{
typeset_element (to_end_cresc_p_);
- cresc_req_l_->warning ("unended crescendo");
+ cresc_req_l_->warning (_("unended crescendo"));
to_end_cresc_p_ =0;
}
if (dynamic_p_)
void
Dynamic_engraver::acknowledge_element (Score_elem_info i)
{
- if (i.elem_l_->name() == Note_column::static_name ())
+ if (i.elem_l_->name() == Note_column::static_name ())
{
if (dynamic_p_) dynamic_p_->add_support (i.elem_l_);
if (to_end_cresc_p_)
to_end_cresc_p_->add_support (i.elem_l_);
- if (cresc_p_)
+ if (cresc_p_)
cresc_p_->add_support (i.elem_l_);
}
}
Identifier::~Identifier()
{
if (!accessed_b_ && !init_b_)
- warning ("Variable not used");
+ warning (_("Variable not used"));
}
void
Identifier::error (String expect)
{
- String e ("Wrong identifier type: ");
- e += String (name()) + "(expected " + expect + ")";
+ String e (_("Wrong identifier type: "));
+ e += String (name()) + _("(expected ") + expect + ")";
::error (e);
}
Identifier::Identifier (int code)
{
- token_code_i_ = code;
+ token_code_i_ = code;
accessed_b_ = 0;
init_b_ = 0;
}
row.del (idx);
lin +=row ;
- for (int i=0; i < cons.size(); i++)
+ for (int i=0; i < cons.size(); i++)
{
consrhs[i] -= cons[i](idx) *value;
cons[i].del (idx);
assert (cons.size() == consrhs.size ());
Matrix Qdif= quad - quad.transposed();
assert (Qdif.norm()/quad.norm () < EPS);
-#endif
+#endif
}
-
+
Real
Ineq_constrained_qp::eval (Vector v)
int
min_elt_index (Vector v)
{
- Real m=infinity_f;
+ Real m=infinity_f;
int idx=-1;
for (int i = 0; i < v.dim(); i++)
{
- if (v (i) < m)
+ if (v (i) < m)
{
idx = i;
m = v (i);
*/
Vector
-Ineq_constrained_qp::constraint_solve (Vector start) const
-{
+Ineq_constrained_qp::constraint_solve (Vector start) const
+{
if (!dim())
return Vector (0);
-
+
// experimental
if (quad.dim() > 10)
quad.try_set_band();
-
+
Active_constraints act (this);
- act.OK();
+ act.OK();
+
-
Vector x (start);
Vector gradient=quad*x+lin;
// Real fvalue = x*quad*x/2 + lin*x + const_term;
Vector last_gradient (gradient);
int iterations=0;
-
- while (iterations++ < MAXITER)
+
+ while (iterations++ < MAXITER)
{
Vector direction= - act.find_active_optimum (gradient);
-
+
DOUT << "gradient "<< gradient<< "\ndirection " << direction<<"\n";
-
- if (direction.norm() > EPS)
+
+ if (direction.norm() > EPS)
{
DOUT << act.status() << '\n';
-
+
Real minalf = infinity_f;
Inactive_iter minidx (act);
we know the optimum on this "hyperplane". Check if we
bump into the edges of the simplex
*/
-
- for (Inactive_iter ia (act); ia.ok(); ia++)
+
+ for (Inactive_iter ia (act); ia.ok(); ia++)
{
if (ia.vec() * direction >= 0)
continue;
Real alfa= - (ia.vec()*x - ia.rhs ())/
(ia.vec()*direction);
-
- if (minalf > alfa)
+
+ if (minalf > alfa)
{
minidx = ia;
minalf = alfa;
Real optimal_step = min (minalf, unbounded_alfa);
Vector deltax=direction * optimal_step;
- x += deltax;
+ x += deltax;
gradient += optimal_step * (quad * deltax);
-
+
DOUT << "step = " << optimal_step<< " (|dx| = " <<
- deltax.norm() << ")\n";
-
- if (minalf < unbounded_alfa)
+ deltax.norm() << ")\n";
+
+ if (minalf < unbounded_alfa)
{
/* bumped into an edge. try again, in smaller space. */
act.add (minidx.idx());
continue;
}
/*ASSERT: we are at optimal solution for this "plane"*/
-
-
+
+
}
-
- Vector lagrange_mult=act.get_lagrange (gradient);
+
+ Vector lagrange_mult=act.get_lagrange (gradient);
int m= min_elt_index (lagrange_mult);
-
- if (m>=0 && lagrange_mult (m) > 0)
+
+ if (m>=0 && lagrange_mult (m) > 0)
{
break; // optimal sol.
}
- else if (m<0)
+ else if (m<0)
{
assert (gradient.norm() < EPS) ;
-
+
break;
}
-
+
DOUT << "dropping cons " << m<<'\n';
act.drop (m);
}
if (iterations >= MAXITER)
- WARN<<"didn't converge!\n";
-
+ WARN<<_("didn't converge!\n");
+
DOUT << ": found " << x<<" in " << iterations <<" iterations\n";
assert_solution (x);
return x;
-}
+}
+
-
Vector
Ineq_constrained_qp::solve (Vector start) const
-{
+{
/* no hassle if no constraints*/
- if (! cons.size())
+ if (! cons.size())
{
Choleski_decomposition chol (quad);
return - chol.solve (lin);
}
- else
+ else
{
return constraint_solve (start);
}
TODO
This doth suck. We should have PS output, and read spacing info from TFMs
-
+
Glissando, bracket
-
+
*/
#include "lookup.hh"
Lookup::text (String style, String text, int dir) const
{
Array<String> a;
-
+
a.push (text);
Atom tsym = (*symtables_)("style")->lookup (style);
a[0] = substitute_args (tsym.tex_,a);
{
return (*symtables_)("clefs")->lookup (s);
}
-
+
Atom
Lookup::dots () const
{
Lookup::streepjes (int type, int i) const
{
assert (i);
-
+
int arg;
String idx;
-
- if (i < 0)
+
+ if (i < 0)
{
idx = "botlines";
arg = -i;
}
- else
+ else
{
arg = i;
idx = "toplines";
Real w = ball (type).dim_[X_AXIS].length ();
Atom ret = (*symtables_)("streepjes")->lookup (idx);
-
+
Array<String> a;
a.push (String (w) + "pt");
a.push (arg);
wid = idx*6 PT;
String idxstr = (decresc)? "decrescendosym" : "crescendosym";
Atom ret=(*symtables_)("param")->lookup (idxstr);
-
+
Array<String> a;
a.push (idx);
ret.tex_ = substitute_args (ret.tex_, a);
{
Atom s((*symtables_)("param")->lookup ("meter"));
s.tex_ = substitute_args (s.tex_,a);
- return s;
+ return s;
}
Atom
Lookup::stem (Real y1,Real y2) const
{
- if (y1 > y2)
+ if (y1 > y2)
{
Real t = y1;
y1 = y2;
y2 = t;
}
Atom s;
-
+
s.dim_.x() = Interval (0,0);
s.dim_.y() = Interval (y1,y2);
-
+
Array<String> a;
a.push (print_dimen (y1));
a.push (print_dimen (y2));
-
+
String src = (*symtables_)("param")->lookup ("stem").tex_;
s.tex_ = substitute_args (src,a);
return s;
Atom
Lookup::vbrace (Real &y) const
{
- if (y < 2* 20 PT)
+ if (y < 2* 20 PT)
{
- warning ("piano brace too small (" + print_dimen (y)+ ")");
+ warning (_("piano brace too small (") + print_dimen (y)+ ")");
y = 2*20 PT;
}
- if (y > 67 * 2 PT)
+ if (y > 67 * 2 PT)
{
- warning ("piano brace too big (" + print_dimen (y)+ ")");
+ warning (_("piano brace too big (") + print_dimen (y)+ ")");
y = 67 *2 PT;
}
-
+
int idx = int (rint ((y/2.0 - 20) + 148));
-
+
Atom s = (*symtables_)("param")->lookup ("brace");
{
Array<String> a;
s.tex_ = substitute_args ("\\placebox{%}{%}{%}", a);
}
-
+
return s;
}
usage()
{
cout <<
- "Usage: lilypond [options] [mudela-file]\n"
+ _("Usage: lilypond [options] [mudela-file]\n"
"Typeset and or produce midi output from mudela-file or stdin\n"
"\n"
"Options:\n"
" -M, --midi produce midi output only\n"
" -V, --ignore-version ignore mudela version\n"
"\n"
- "GNU LilyPond was compiled with the following settings:\n"
+ "GNU LilyPond was compiled with the following settings:\n")
#ifdef NDEBUG
- "NDEBUG "
+ "NDEBUG "
#endif
#ifdef NPRINT
"NPRINT "
#ifdef STRING_UTILS_INLINED
"STRING_UTILS_INLINED "
#endif
- "datadir= " DIR_DATADIR
+ "datadir= " DIR_DATADIR
"\n";
-
+
;
-
-
+
+
}
-void
+void
notice()
{
cout <<
- "\n"
+ _("\n"
"GNU LilyPond -- The GNU Project music typesetter.\n"
"Copyright 1996,97 by\n"
" Han-Wen Nienhuys <hanwen@stack.nl>\n"
" You should have received a copy (refer to the file COPYING) of the\n"
"GNU General Public License along with this program; if not, write to\n"
"the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
- "USA.\n";
+ "USA.\n");
}
void
do_one_file (String init_str, String file_str)
{
- if (init_str.length_i () && path.find (init_str).empty_b ())
+ if (init_str.length_i () && path.find (init_str).empty_b ())
{
- error ("Can not find `" + init_str +"\'");
+ error (_("Can not find `") + init_str +"\'");
return ;
}
if (file_str.length_i () && path.find (file_str).empty_b ())
{
- error ("Can not find `" + file_str + "'");
+ error (_("Can not find `") + file_str + "'");
return ;
}
-
+
Sources sources;
- source_l_g = &sources;
+ source_l_g = &sources;
source_l_g->set_path (&path);
{
My_lily_parser parser (source_l_g);
int
main (int argc, char **argv)
-{
+{
debug_init(); // should be first
// must override (come before) "/usr/local/share/lilypond"!
char const * env_l=getenv ("LILYINCLUDE");
- if (env_l)
+ if (env_l)
{
path.add (env_l);
}
path.add ("");
path.add (String (DIR_DATADIR) + "/init/");
-
+
path.push (DIR_DATADIR);
Getopt_long oparser (argc, argv,theopts);
cout << get_version_str() << endl;
String init_str ("symbol.ly");
-
- while (Long_option_init const * opt = oparser())
+
+ while (Long_option_init const * opt = oparser())
{
switch (opt->shortname)
{
int p=0;
const char *arg ;
- while ((arg= oparser.get_next_arg()))
+ while ((arg= oparser.get_next_arg()))
{
String f (arg);
destill_inname (f);
do_one_file (init_str,f);
p++;
}
- if (!p)
+ if (!p)
{
- do_one_file (init_str, "");
+ do_one_file (init_str, "");
}
return exit_status_i_;
{
if (name_str_r.length_i())
{
- if (name_str_r[ 0 ] != '-')
+ if (name_str_r[ 0 ] != '-')
{
String a,b,c,d;
split_path (name_str_r,a,b,c,d);
// add extension if not present.
- if (d.empty_b ())
+ if (d.empty_b ())
d = ".ly";
name_str_r = a+b+c+d;
}
}
- else name_str_r = "";
+ else name_str_r = "";
}
-
*os_p_ << flush; // ugh. Share with tex_stream.
if (!*os_p_)
{
- warning("error syncing file (disk full?)");
+ warning(_("error syncing file (disk full?)"));
exit_status_i_ = 1;
- }
+ }
delete os_p_;
}
{
if (check_debug && !monitor->silence("Midistrings"))
str = String_convert::bin2hex_str (str);
-
+
*os_p_ << str;
if (check_debug && !monitor->silence("Midistrings"))
{
os_p_ = new ofstream (filename_str_.ch_C ());
if (!*os_p_)
- error ("can't open `" + filename_str_ + "\'");
+ error (_("can't open `") + filename_str_ + "\'");
}
/* *************** */
-
+
IMPLEMENT_IS_TYPE_B1(Span_req,Musical_req);
void
-Span_req::do_print() const
+Span_req::do_print() const
{
#ifndef NPRINT
DOUT << spantype ;
int delta_pitch = delta.pitch();
octave_i_ += delta.octave_i_;
notename_i_ += delta.notename_i_;
- while (notename_i_ >= 7)
+ while (notename_i_ >= 7)
{
notename_i_ -= 7;
octave_i_ ++;
int new_pitch = pitch();
int delta_acc = new_pitch - old_pitch - delta_pitch;
-
+
accidental_i_ -= delta_acc;
- if (abs (accidental_i_) > 2)
+ if (abs (accidental_i_) > 2)
{
- delta.warning ("transposition makes accidental larger than 2");
+ delta.warning (_("transposition makes accidental larger than 2"));
}
}
int o= m1.octave_i_ - m2.octave_i_;
int n = m1.notename_i_ - m2.notename_i_;
int a = m1.accidental_i_ - m2.accidental_i_;
-
+
if (o)
return o;
if (n)
Melodic_req::do_print() const
{
#ifndef NPRINT
- DOUT << "notename: " << notename_i_
+ DOUT << "notename: " << notename_i_
<< " acc: " <<accidental_i_<<" oct: "<< octave_i_;
#endif
}
/*
should be settable from input to allow "viola"-mode
*/
-static Byte pitch_byte_a[ ] = { 0, 2, 4, 5, 7, 9, 11 };
+static Byte pitch_byte_a[ ] = { 0, 2, 4, 5, 7, 9, 11 };
int
Melodic_req::pitch() const
Moment
-Rhythmic_req::duration() const {
+Rhythmic_req::duration() const {
return duration_.length();
}
/* *************** */
void
Lyric_req::do_print() const
-{
+{
Rhythmic_req::do_print();
Text_req::do_print();
}
{
#ifndef NPRINT
Melodic_req::do_print();
- if (forceacc_b_)
+ if (forceacc_b_)
{
DOUT << " force accidental\n";
}
/*
don't check dirs?
-
+
(d1.dir_ == d2.dir_)
*/
bool
Script_req::do_equal_b (Request*r) const
{
Script_req * s = r->script();
-
+
return scriptdef_p_->equal_b (*s->scriptdef_p_);
}
dir_ = src.dir_;
}
-Text_req::Text_req (int dir_i, Text_def* tdef_p)
+Text_req::Text_req (int dir_i, Text_def* tdef_p)
{
dir_ = Direction(dir_i);
tdef_p_ = tdef_p;
}
String
-Dynamic_req::loudness_static_str (Loudness l)
+Dynamic_req::loudness_static_str (Loudness l)
{
- switch (l)
+ switch (l)
{
case FFF: return "fff";
case FF: return "ff";
if (s.empty_b ())
{
s = "mf";
- warning (String ("Never heard of dynamic scale ")
- + loudness_ + " assuming mf");
+ warning (String (_("Never heard of dynamic scale "))
+ + loudness_ + _(" assuming mf"));
}
return s;
}
IMPLEMENT_IS_TYPE_B1(Tie_req,Musical_req);
-
-
{"skip", SKIP},
{"staff", STAFF},
{"table", TABLE},
- {"spandynamic", SPANDYNAMIC},
+ {"spandynamic", SPANDYNAMIC},
{"symboltables", SYMBOLTABLES},
{"tempo", TEMPO},
{"texid", TEXID},
{
if (!identifier_p_dict_p_->elt_b (s))
return 0;
-
+
return (*identifier_p_dict_p_)[s];
}
My_lily_lexer::set_identifier (String name_str, Identifier*i)
{
Identifier *old = lookup_identifier (name_str);
- if (old)
+ if (old)
{
- old->warning("redeclaration of \\" + name_str);
+ old->warning(_("redeclaration of \\") + name_str);
delete old;
}
(*identifier_p_dict_p_)[name_str] = i;
delete keytable_p_;
for (Assoc_iter<String,Identifier*>
- ai (*identifier_p_dict_p_); ai.ok(); ai++)
+ ai (*identifier_p_dict_p_); ai.ok(); ai++)
{
DOUT << "deleting: " << ai.key()<<'\n';
delete ai.val();
My_lily_lexer::print_declarations (bool init_b) const
{
for (Assoc_iter<String,Identifier*> ai (*identifier_p_dict_p_);
- ai.ok(); ai++)
+ ai.ok(); ai++)
{
- if (ai.val()->init_b_ == init_b)
+ if (ai.val()->init_b_ == init_b)
{
DOUT << ai.key() << '=';
ai.val()->print ();
void
My_lily_lexer::LexerError (char const *s)
{
- if (include_stack_.empty())
+ if (include_stack_.empty())
{
- *mlog << "error at EOF" << s << '\n';
+ *mlog << _("error at EOF") << s << '\n';
}
- else
+ else
{
errorlevel_i_ |= 1;
Input spot (source_file_l(),here_ch_C());
return '\n';
case 't':
return '\t';
-
+
case '\'':
case '\"':
case '\\':
delete lexer_p_;
delete default_header_p_;
}
-
+
void
My_lily_parser::clear_notenames()
{
#ifndef NPRINT
String s = "";
- if (init_parse_b_)
+ if (init_parse_b_)
s = "Init";
set_yydebug (!monitor->silence (s+"Parser") && check_debug);
lexer_p_->set_debug (!monitor->silence (s+"Lexer") && check_debug);
{
#ifndef NPRINT
String s = "";
-
- if (init_parse_b_)
+
+ if (init_parse_b_)
s = "Init";
- if (!monitor->silence (s+"Declarations") && check_debug)
+ if (!monitor->silence (s+"Declarations") && check_debug)
{
lexer_p_->print_declarations (init_parse_b_);
}
-#endif
+#endif
}
void
{
lexer_p_ = new My_lily_lexer;
init_str_ = init;
-
- *mlog << "Parsing ... ";
-
+
+ *mlog << _("Parsing ... ");
+
init_parse_b_ = true;
set_debug();
lexer_p_->new_input (init, source_l_);
if (error_level_i_)
{
- error ("Found errors in init files");
+ error (_("Found errors in init files"));
}
print_declarations();
do_yyparse();
print_declarations();
-
+
if (!define_spot_array_.empty())
{
- warning ("Braces don't match.");
+ warning (_("Braces don't match."));
error_level_i_ = 1;
}
}
define_spot_array_.push (here_input());
}
-char const *
+char const *
My_lily_parser::here_ch_C() const
{
return lexer_p_->here_ch_C();
My_lily_parser::get_word_element (Text_def* tdef_p, Duration * duration_p)
{
Chord* velt_p = new Request_chord;
-
+
Lyric_req* lreq_p = new Lyric_req (tdef_p);
lreq_p->duration_ = *duration_p;
Chord *
My_lily_parser::get_rest_element (String s, Duration * duration_p)
-{
+{
Chord* velt_p = new Request_chord;
velt_p->set_spot (here_input());
skip_p->set_spot (here_input());
velt_p->add (skip_p);
}
- else
+ else
{
Rest_req * rest_req_p = new Rest_req;
rest_req_p->duration_ = *duration_p;
rest_req_p->set_spot (here_input());
-
+
velt_p->add (rest_req_p);
}
v->set_spot (here_input ());
v->add (rq);
-
+
// too bad parser reads (default) duration via member access,
// this hack will do for now..
if (abbrev_beam_type_i_)
My_lily_parser::get_parens_request (char c)
{
Request* req_p=0;
- switch (c)
+ switch (c)
{
case '~':
case '<':
req_p = new Span_dynamic_req;
break;
-
+
case ')':
case '(':
req_p = new Slur_req;
assert (false);
break;
}
-
- switch (c)
+
+ switch (c)
{
case '<':
case '>':
case ']':
req_p->span()->spantype = Span_req::STOP;
break;
-
+
default:
break;
}
- if (req_p->musical()->span_dynamic ())
+ if (req_p->musical()->span_dynamic ())
{
Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ;
s_l->dynamic_dir_ = (c == '<') ? UP:DOWN;
void
My_lily_parser::add_requests (Chord*v)
{
- for (int i = 0; i < pre_reqs.size(); i++)
+ for (int i = 0; i < pre_reqs.size(); i++)
{
v->add (pre_reqs[i]);
}
pre_reqs.clear();
- for (int i = 0; i <post_reqs.size(); i++)
+ for (int i = 0; i <post_reqs.size(); i++)
{
v->add (post_reqs[i]);
}
void
Paper_score::print () const
-{
+{
#ifndef NPRINT
if (!check_debug)
return ;
DOUT << "Paper_score { ";
DOUT << "\n elements: ";
- for (iter_top (elem_p_list_,cc); cc.ok (); cc++)
+ for (iter_top (elem_p_list_,cc); cc.ok (); cc++)
cc->print ();
DOUT << "\n unbroken spanners: ";
for (iter (span_p_list_.top (), i); i.ok (); i++)
i->print ();
-
+
DOUT << "}\n";
-#endif
+#endif
}
PCursor<Paper_column *>
Paper_score::find_col (Paper_column const *c) const
{
Paper_column const *what = c;
-
+
return col_p_list_.find ((Paper_column*)what);
}
super_elem_l_->break_processing ();
- for (iter (span_p_list_.top (),i); i.ok ();)
+ for (iter (span_p_list_.top (),i); i.ok ();)
{
Spanner *span_p = i.remove_p ();
- if (span_p->broken_b ())
+ if (span_p->broken_b ())
{
span_p->unlink ();
delete span_p;
typeset_broken_spanner (span_p);
}
}
- for (iter (elem_p_list_.top (),i); i.ok () ;)
+ for (iter (elem_p_list_.top (),i); i.ok () ;)
{
Item *i_l =i->item ();
- if (i_l && !i_l->line_l ())
+ if (i_l && !i_l->line_l ())
{
i_l->unlink ();
delete i.remove_p ();
Array<Col_hpositions> sol;
bool try_wrap = ! paper_l_->get_var ("castingalgorithm");
- if (!try_wrap)
+ if (!try_wrap)
{
algorithm_p = new Gourlay_breaking ;
algorithm_p->set_pscore (this);
sol = algorithm_p->solve ();
delete algorithm_p;
- if (! sol.size ())
+ if (! sol.size ())
{
- warning ("Can not solve this casting problem exactly; revert to Word_wrap");
+ warning (_("Can not solve this casting problem exactly; revert to Word_wrap"));
try_wrap = true;
}
}
- if (try_wrap)
+ if (try_wrap)
{
- algorithm_p = new Word_wrap;
+ algorithm_p = new Word_wrap;
algorithm_p->set_pscore (this);
sol = algorithm_p->solve ();
delete algorithm_p;
{
clean_cols ();
print ();
- *mlog << "Preprocessing elements... " <<flush;
+ *mlog << _("Preprocessing elements... ") <<flush;
super_elem_l_->breakable_col_processing ();
super_elem_l_->pre_processing ();
- *mlog << "\nCalculating column positions ... " <<flush;
+ *mlog << _("\nCalculating column positions ... ") <<flush;
calc_breaking ();
- *mlog << "\nPostprocessing elements..." << endl;
+ *mlog << _("\nPostprocessing elements...") << endl;
super_elem_l_->post_processing ();
tex_output ();
}
String outname = paper_l_->outfile_str_ ;
if (outname.empty_b ())
outname = default_out_str_+ ".tex";
-
- *mlog << "TeX output to " << outname << " ...\n";
-
+
+ *mlog << _("TeX output to ") << outname << " ...\n";
+
Tex_stream tex_out (outname);
Tex_outputter interfees (&tex_out);
outputter_l_ = &interfees;
-
- tex_out << "% outputting Score, defined at: " << origin_str_ << "\n";
- if (header_l_)
+
+ tex_out << _("% outputting Score, defined at: ") << origin_str_ << "\n";
+ if (header_l_)
{
tex_out << header_l_->TeX_string();
}
-
+
tex_out << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n";
super_elem_l_->output_all ();
tex_out << "\n\\EndLilyPondOutput";
/*
ugh! windows-suck-suck-suck.
*/
- while (PCursor<Paper_column*>::compare (start,stop) < 0)
+ while (PCursor<Paper_column*>::compare (start,stop) < 0)
{
if (start->breakable_b_)
ret.push (start);
Paper_score::col_range (Paper_column*l, Paper_column*r) const
{
Link_array<Paper_column> ret;
-
+
PCursor<Paper_column*> start (l ? find_col (l)+1 : col_p_list_.top ());
PCursor<Paper_column*> stop (r ? find_col (r) : col_p_list_.bottom ());
ret.push (l);
-
+
/*
ugh! windows-suck-suck-suck.
*/
Link_array<Item> ret;
Item const*l=l_item_l;
Item const*r=r_item_l;
-
- while (! l->is_type_b(Paper_column::static_name ()))
+
+ while (! l->is_type_b(Paper_column::static_name ()))
l = l->axis_group_l_a_[X_AXIS]->item ();
-
- while (! r->is_type_b(Paper_column::static_name ()))
+
+ while (! r->is_type_b(Paper_column::static_name ()))
r = r->axis_group_l_a_[X_AXIS]->item ();
-
+
PCursor<Paper_column*> start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ());
PCursor<Paper_column*> stop (r ? find_col ((Paper_column*)r) : col_p_list_.bottom ());
-
+
/*
ugh! windows-suck-suck-suck.
*/
- while (PCursor<Paper_column*>::compare (start,stop) < 0)
+ while (PCursor<Paper_column*>::compare (start,stop) < 0)
{
if (start->breakable_b_ && !start->line_l_)
ret.push (start);
{
real_vars_p_->elem (s) = r;
}
-
+
Real
Paper_def::get_var (String s) const
{
if (! real_vars_p_->elt_b (s))
- error ("unknown paper variable `" + s+"'");
+ error (_("unknown paper variable `") + s+"'");
return real_vars_p_->elem (s);
}
/**
Get the measure wide constant for arithmetic.
- @see
+ @see
John S. Gourlay. ``Spacing a Line of Music,'' Technical Report
OSU-CISRC-10/87-TR35, Department of Computer and Information Science,
The Ohio State University, 1987.
Real
Paper_def::internote_f() const
{
- return interline_f() / 2;
+ return interline_f() / 2;
}
Real
DOUT << "Paper {";
DOUT << "out: " <<outfile_str_;
lookup_p_->print();
- for (Assoc_iter<String,Real> i (*real_vars_p_); i.ok(); i++)
+ for (Assoc_iter<String,Real> i (*real_vars_p_); i.ok(); i++)
{
DOUT << i.key() << "= " << i.val () << "\n";
}
Performance::output_header_track (Midi_stream& midi_stream_r)
{
Midi_track midi_track;
-
+
time_t t = time (0);
// perhaps multiple text events?
- String str = String ("Creator: ") + get_version_str() + "\n";
+ String str = String (_("Creator: ")) + get_version_str() + "\n";
Midi_text creator (Midi_text::TEXT, str);
midi_track.add (Moment (0), &creator);
- str = "Automatically generated at ";
+ str = _("Automatically generated at ");
str += ctime (&t);
str = str.left_str (str.length_i() - 1);
str += "\n";
Midi_text generate (Midi_text::TEXT, str);
midi_track.add (Moment (0), &generate);
- str = "from musical definition: ";
+ str = _("from musical definition: ");
str += origin_str_;
Midi_text from (Midi_text::TEXT, str);
midi_track.add (Moment (0), &from);
- Midi_text track_name (Midi_text::TRACK_NAME, "Track "
+ Midi_text track_name (Midi_text::TRACK_NAME, "Track "
+ String_convert::i2dec_str (0, 0, '0'));
midi_track.add (Moment (0), &track_name);
void
Performance::print() const
-{
+{
#ifndef NPRINT
DOUT << "Performance { ";
DOUT << "Items: ";
for (PCursor<Audio_element*> i (audio_elem_p_list_.top ()); i.ok (); i++)
i->print ();
-
+
DOUT << "\ncolumns: ";
for (PCursor<Audio_column*> i (audio_column_p_list_); i.ok(); i++)
i->print();
DOUT << "}\n";
-#endif
+#endif
}
void
Performance::process()
{
print ();
-
+
String out=midi_l_->outfile_str_;
if (out.empty_b ())
out = default_out_str_ + ".midi";
Midi_stream midi_stream (out);
- *mlog << "MIDI output to " << out<< " ..." << endl;
+ *mlog << _("MIDI output to ") << out<< " ..." << endl;
output (midi_stream);
*mlog << endl;
Active_constraints::status() const
{
String s ("Active|Inactive [");
- for (int i=0; i< active.size(); i++)
+ for (int i=0; i< active.size(); i++)
{
s += String (active[i]) + " ";
}
s+="| ";
- for (int i=0; i< inactive.size(); i++)
+ for (int i=0; i< inactive.size(); i++)
{
s += String (inactive[i]) + " ";
}
for (int i=0; i < opt->cons.size(); i++)
allcons.push (0);
- for (int i=0; i < active.size(); i++)
+ for (int i=0; i < active.size(); i++)
{
int j = active[i];
allcons[j]++;
}
- for (int i=0; i < inactive.size(); i++)
+ for (int i=0; i < inactive.size(); i++)
{
int j = inactive[i];
allcons[j]++;
Vector Ha = H*a;
Real aHa = a*Ha;
Vector addrow (Ha.dim());
- if (abs (aHa) > EPS)
+ if (abs (aHa) > EPS)
{
/*
a != 0, so if Ha = O(EPS), then
if H*a == 0, the constraints are dependent.
*/
H -= Matrix (Ha/aHa , Ha);
-
+
/*
sorry, don't know how to justify this. ..
A -= Matrix (A*a, addrow);
A.insert_row (addrow,A.rows());
}else
- WARN << "degenerate constraints";
+ WARN << _("degenerate constraints");
}
void
active.pop();
Vector a (A.row (q));
- if (a.norm() > EPS)
+ if (a.norm() > EPS)
{
/*
-
+
*/
Real q = a*opt->quad*a;
Matrix aaq (a,a/q);
H += aaq;
A -= A*opt->quad*aaq;
}else
- WARN << "degenerate constraints";
+ WARN << _("degenerate constraints");
#ifndef NDEBUG
Vector rem_row (A.row (q));
assert (rem_row.norm() < EPS);
#endif
-
+
A.delete_row (q);
}
}
/** Find the optimum which is in the planes generated by the active
- constraints.
+ constraints.
*/
Vector
Active_constraints::find_active_optimum (Vector g)
{
return H*g;
}
-
{
elt_l_ = el_l;
MInterval elt_dur =el_l->time_int();
- elt_duration_ = elt_dur.length ();
+ elt_duration_ = elt_dur.length ();
last_b_ = false;
}
bool
Request_chord_iterator::ok() const
{
- return (elt_duration_ && !last_b_) || first_b_;
+ return (elt_duration_ && !last_b_) || first_b_;
}
Request_chord_iterator::next_moment() const
{
Moment m (0);
- if (!first_b_)
+ if (!first_b_)
m = elt_duration_;
return m;
}
void
Request_chord_iterator::process_and_next (Moment mom)
{
- if (first_b_)
+ if (first_b_)
{
- for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++)
+ for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++)
{
assert (i->is_type_b (Request::static_name()));
Request * req_l = (Request*)i.ptr();
bool gotcha = report_to_l()->try_request (req_l);
if (!gotcha)
- req_l->warning ("Junking request: " + String (req_l->name()));
+ req_l->warning (_("Junking request: ") + String (req_l->name()));
}
first_b_ = false;
}
if (mom >= elt_duration_)
- last_b_ = true;
+ last_b_ = true;
}
Global_translator * trans_p = odef_l->get_global_translator_p();
if (!trans_p)
return ;
-
- *mlog << "\nInterpreting music ...";
+
+ *mlog << _("\nInterpreting music ...");
trans_p->last_mom_ = music_p_->time_int().max ();
- Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
+ Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
trans_p);
iter->construct_children();
- if (! iter->ok())
+ if (! iter->ok())
{
delete iter;
- warning ("Need music in a score");
+ warning (_("Need music in a score"));
errorlevel_i_ =1;
return ;
}
-
+
trans_p->start();
-
- while (iter->ok() || trans_p->moments_left_i ())
+
+ while (iter->ok() || trans_p->moments_left_i ())
{
Moment w = infinity_mom;
- if (iter->ok())
+ if (iter->ok())
{
w = iter->next_moment();
DOUT << "proccing: " << w <<"\n";
delete iter;
trans_p->finish();
-
- if (errorlevel_i_)
+
+ if (errorlevel_i_)
{
- // should we? hampers debugging.
- warning ("Errors found, /*not processing score*/");
+ // should we? hampers debugging.
+ warning (_("Errors found, /*not processing score*/"));
}
-
+
Music_output * output = trans_p->get_output_p();
delete trans_p;
- *mlog << " (time: " << String(timer.read (), "%.2f") << " seconds)";
+ *mlog << _(" (time: ") << String(timer.read (), "%.2f") << _(" seconds)");
+
-
output->header_l_ = header_p_;
output->default_out_str_ = default_out_fn;
output->origin_str_ = location_str();
-
+
*mlog << endl;
output->process();
delete output ;
Score::print() const
{
#ifndef NPRINT
- DOUT << "score {\n";
+ DOUT << "score {\n";
music_p_ -> print ();
for (int i=0; i < def_p_arr_.size (); i++)
def_p_arr_[i]->print();
{
def_p_arr_.push(pap_p);
}
-
-
-
void
do_scores()
{
- for (int i=0; i < global_score_array.size(); i++)
+ for (int i=0; i < global_score_array.size(); i++)
{
Score *&is_p = global_score_array[i];
if (is_p->header_p_)
- is_p->header_p_->lily_id_str_ = "Lily was here, " +
+ is_p->header_p_->lily_id_str_ = "Lily was here, " +
get_version_number_str();
- if (is_p->errorlevel_i_)
+ if (is_p->errorlevel_i_)
{
- is_p->warning ("Score contains errors. Will not process it. ");
+ is_p->warning (_("Score contains errors. Will not process it. "));
exit_status_i_ |= 1;
}
- else
+ else
{
is_p->process();
}
{
default_out_fn = s;
}
-
Script::do_substitute_dependency (Score_elem*o,Score_elem*n)
{
Staff_side::do_substitute_dependency (o,n);
- if (o == stem_l_)
+ if (o == stem_l_)
{
stem_l_ = n ? (Stem*)n->item() : 0;
}
Script::Script()
-{
+{
specs_l_ = 0;
inside_staff_b_ = false;
stem_l_ = 0;
Script::set_default_dir()
{
int s_i=specs_l_->rel_stem_dir();
- if (s_i)
+ if (s_i)
{
if (stem_l_)
dir_ = stem_l_->dir_ * s_i;
else
{
- specs_l_->warning ("Script needs stem direction");
+ specs_l_->warning (_("Script needs stem direction"));
dir_ = DOWN;
}
}
- else
+ else
{
dir_ =specs_l_->staff_dir();
}
void
Script::do_pre_processing()
{
- if (breakable_b_ && break_status_i() != 1)
+ if (breakable_b_ && break_status_i() != 1)
{
transparent_b_ = true;
set_empty (true);
}
-
+
if (!dir_)
set_default_dir();
inside_staff_b_ = specs_l_->inside_b();
{
Real dy = paper()->internote_f ();
Real dx = paper()->note_width()/2;
-
+
Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_));
out->translate_axis (dy * pos_i_, Y_AXIS);
out->translate_axis (dx, X_AXIS); // FIXME! ugh
IMPLEMENT_IS_TYPE_B2(Script,Item,Staff_side);
-int
-Script::compare (Script *const&l1, Script *const&l2)
+int
+Script::compare (Script *const&l1, Script *const&l2)
{
return l1->specs_l_->priority_i() - l2->specs_l_->priority_i ();
}
-
void
Slur_engraver::acknowledge_element (Score_elem_info info)
{
- if (info.elem_l_->name() == Note_column::static_name ())
+ if (info.elem_l_->name() == Note_column::static_name ())
{
Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh
for (int i = 0; i < slur_l_stack_.size(); i++)
Slur_engraver::do_process_requests()
{
Array<Slur*> start_slur_l_arr_;
- for (int i=0; i< new_slur_req_l_arr_.size(); i++)
+ for (int i=0; i< new_slur_req_l_arr_.size(); i++)
{
Slur_req* slur_req_l = new_slur_req_l_arr_[i];
// end slur: move the slur to other array
- if (slur_req_l->spantype == Span_req::STOP)
+ if (slur_req_l->spantype == Span_req::STOP)
{
if (slur_l_stack_.empty())
-
- slur_req_l->warning ("can't find slur to end");
- else
+
+ slur_req_l->warning (_("can't find slur to end"));
+ else
{
end_slur_l_arr_.push (slur_l_stack_.pop());
requests_arr_.pop();
}
}
- else if (slur_req_l->spantype == Span_req::START)
+ else if (slur_req_l->spantype == Span_req::START)
{
// push a new slur onto stack.
//(use temp. array to wait for all slur STOPs)
Slur_engraver::do_pre_move_processing()
{
dir_ = (Direction) int(get_property ("ydirection"));
- for (int i = 0; i < end_slur_l_arr_.size(); i++)
+ for (int i = 0; i < end_slur_l_arr_.size(); i++)
{
if (dir_)
end_slur_l_arr_[i]->dir_ = dir_;
}
Slur_engraver::~Slur_engraver()
{
- for (int i=0; i < requests_arr_.size(); i++)
+ for (int i=0; i < requests_arr_.size(); i++)
{
- requests_arr_[i]->warning ("unterminated slur");
+ requests_arr_[i]->warning (_("unterminated slur"));
}
}
Vector
Spring_spacer::default_solution() const
{
- return try_initial_solution() ;
+ return try_initial_solution() ;
}
Score_column*
-Spring_spacer::scol_l (int i)
+Spring_spacer::scol_l (int i)
{
return (Score_column*)cols[i].pcol_l_;
}
assert (cols[i].rank_i_ > cols[i-1].rank_i_);
for (int i = 1; i < loose_col_arr_.size(); i++)
assert (loose_col_arr_[i].rank_i_ > loose_col_arr_[i-1].rank_i_);
-#endif
+#endif
}
/**
- Make sure no unconnected columns happen.
+ Make sure no unconnected columns happen.
*/
void
-Spring_spacer::handle_loose_cols()
+Spring_spacer::handle_loose_cols()
{
Union_find connected (cols.size());
Array<int> fixed;
for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
{
- connected.connect (i->left_i_,i->right_i_);
+ connected.connect (i->left_i_,i->right_i_);
}
for (int i = 0; i < cols.size(); i++)
if (cols[i].fixed())
for (int i=1; i < fixed.size(); i++)
connected.connect (fixed[i-1], fixed[i]);
- for (int i = cols.size(); i--;)
+ for (int i = cols.size(); i--;)
{
- if (! connected.equiv (fixed[0], i))
+ if (! connected.equiv (fixed[0], i))
{
- warning ("unconnected column: " + String (i));
+ warning (_("unconnected column: ") + String (i));
loosen_column (i);
}
}
/**
Guess a stupid position for loose columns. Put loose columns at
- regular distances from enclosing calced columns
+ regular distances from enclosing calced columns
*/
void
Spring_spacer::position_loose_cols (Vector &sol_vec) const
{
if (!loose_col_arr_.size())
- return ;
+ return ;
assert (sol_vec.dim());
Array<bool> fix_b_arr;
fix_b_arr.set_size (cols.size() + loose_col_arr_.size ());
Real utter_right_f=-infinity_f;
Real utter_left_f =infinity_f;
- for (int i=0; i < loose_col_arr_.size(); i++)
+ for (int i=0; i < loose_col_arr_.size(); i++)
{
fix_b_arr[loose_col_arr_[i].rank_i_] = false;
}
- for (int i=0; i < cols.size(); i++)
+ for (int i=0; i < cols.size(); i++)
{
int r= cols[i].rank_i_;
fix_b_arr[r] = true;
Vector v (fix_b_arr.size());
int j =0;
int k =0;
- for (int i=0; i < v.dim(); i++)
+ for (int i=0; i < v.dim(); i++)
{
- if (fix_b_arr[i])
+ if (fix_b_arr[i])
{
assert (cols[j].rank_i_ == i);
v (i) = sol_vec (j++);
}
- else
+ else
{
- Real left_pos_f =
+ Real left_pos_f =
(j>0) ?sol_vec (j-1) : utter_left_f;
- Real right_pos_f =
+ Real right_pos_f =
(j < sol_vec.dim()) ? sol_vec (j) : utter_right_f;
int left_rank = (j>0) ? cols[j-1].rank_i_ : 0;
int right_rank = (j<sol_vec.dim()) ? cols[j].rank_i_ : sol_vec.dim ();
int r = loose.rank_i_ ;
assert (r > left_rank && r < right_rank);
- v (i) = (r - left_rank)*left_pos_f/ d_r +
+ v (i) = (r - left_rank)*left_pos_f/ d_r +
(right_rank - r) *right_pos_f /d_r;
}
}
sol_vec = v;
}
-
+
bool
-Spring_spacer::check_constraints (Vector v) const
+Spring_spacer::check_constraints (Vector v) const
{
int dim=v.dim();
assert (dim == cols.size());
-
- for (int i=0; i < dim; i++)
+
+ for (int i=0; i < dim; i++)
{
if (cols[i].fixed()&&
- abs (cols[i].fixed_position() - v (i)) > COLFUDGE)
+ abs (cols[i].fixed_position() - v (i)) > COLFUDGE)
return false;
-
- if (!i)
+
+ if (!i)
continue;
-
+
Real mindist=cols[i-1].width_[RIGHT]
-cols[i].width_[LEFT];
// ugh... compares
Real dif =v (i) - v (i-1)- mindist;
bool b = (dif > - COLFUDGE);
-
+
if (!b)
return false;
Spring_spacer::check_feasible() const
{
Vector sol (try_initial_solution());
- return check_constraints (sol);
+ return check_constraints (sol);
}
/// generate a solution which obeys the min distances and fixed positions
{
int dim=cols.size();
Vector initsol (dim);
- for (int i=0; i < dim; i++)
+ for (int i=0; i < dim; i++)
{
- if (cols[i].fixed())
+ if (cols[i].fixed())
{
- initsol (i)=cols[i].fixed_position();
+ initsol (i)=cols[i].fixed_position();
- if (i > 0)
+ if (i > 0)
{
Real r =initsol (i-1) + cols[i-1].width_[RIGHT];
- if (initsol (i) < r)
+ if (initsol (i) < r)
{
- warning ("overriding fixed position");
+ warning (_("overriding fixed position"));
initsol (i) =r;
}
}
-
+
}
- else
+ else
{
Real mindist=cols[i-1].width_[RIGHT]
- cols[i].width_[LEFT];
if (mindist < 0.0)
- warning ("Excentric column");
+ warning (_("Excentric column"));
initsol (i)=initsol (i-1)+mindist;
- }
+ }
}
return initsol;
Vector
Spring_spacer::find_initial_solution() const
{
- Vector v (try_initial_solution());
+ Vector v (try_initial_solution());
assert (check_constraints (v));
return v;
}
quad.fill (0);
lin.fill (0);
c = 0;
-
- for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
+
+ for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
{
int l = i->left_i_;
int r = i->right_i_;
void
Spring_spacer::set_fixed_cols (Mixed_qp &qp) const
{
- for (int j=0; j < cols.size(); j++)
- if (cols[j].fixed())
- qp.add_fixed_var (j,cols[j].fixed_position());
-
-
+ for (int j=0; j < cols.size(); j++)
+ if (cols[j].fixed())
+ qp.add_fixed_var (j,cols[j].fixed_position());
+
+
}
// put the constraints into the LP problem
void
Spring_spacer::make_constraints (Mixed_qp& lp) const
-{
+{
int dim=cols.size();
- for (int j=0; j < dim; j++)
+ for (int j=0; j < dim; j++)
{
Colinfo c=cols[j];
if (j > 0)
{
Vector c1(dim);
-
+
c1(j)=1.0 ;
c1(j-1)=-1.0 ;
- lp.add_inequality_cons (c1,
+ lp.add_inequality_cons (c1,
cols[j-1].width_[RIGHT] - cols[j].width_[LEFT]);
}
}
Spring_spacer::calculate_energy_f (Vector solution) const
{
Real e = 0.0;
- for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok(); i++)
+ for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok(); i++)
{
e += i->energy_f(solution(i->right_i_) - solution(i->left_i_));
}
-
+
return e;
}
void
Mixed_qp lp (cols.size());
make_matrices (lp.quad,lp.lin, lp.const_term);
- make_constraints (lp);
+ make_constraints (lp);
set_fixed_cols (lp);
- Vector start=find_initial_solution();
+ Vector start=find_initial_solution();
Vector solution_vec (lp.solve (start));
positions->satisfies_constraints_b_ = check_constraints (solution_vec);
- if (!positions->satisfies_constraints_b_)
+ if (!positions->satisfies_constraints_b_)
{
- WARN << "solution doesn't satisfy constraints.\n" ;
+ WARN << _("solution doesn't satisfy constraints.\n") ;
}
- position_loose_cols (solution_vec);
+ position_loose_cols (solution_vec);
positions->energy_f_ = calculate_energy_f (solution_vec);
positions->config = solution_vec;
positions->error_col_l_arr_ = error_pcol_l_arr();
-
+
}
/**
add one column to the problem.
-*/
+*/
void
Spring_spacer::add_column (Paper_column *col, bool fixed, Real fixpos)
{
for (int i=0; i< cols.size(); i++)
if (cols[i].ugh_b_)
retval.push (cols[i].pcol_l_);
- for (int i=0; i < loose_col_arr_.size(); i++)
+ for (int i=0; i < loose_col_arr_.size(); i++)
{
retval.push (loose_col_arr_[i].pcol_l_);
}
j++;
}
c.ugh_b_ = true;
-
+
int j=0;
- for (; j < loose_col_arr_.size(); j++)
+ for (; j < loose_col_arr_.size(); j++)
{
if (loose_col_arr_[j].rank_i_ > c.rank_i_)
break;
Spring_spacer::print() const
{
#ifndef NPRINT
- for (int i=0; i < cols.size(); i++)
+ for (int i=0; i < cols.size(); i++)
{
DOUT << "col " << i<<' ';
cols[i].print();
{
assert(d >= 0 && d <= 100 CM);
assert(h >=0);
-
+
Idealspacing * s = new Idealspacing;
s->left_i_ = i;
s->right_i_ = j;
s->space_f_ = d;
s->hooke_f_ = h;
-
+
ideal_p_list_.bottom().add (s);
}
}
Line_spacer*
-Spring_spacer::constructor()
+Spring_spacer::constructor()
{
return new Spring_spacer;
}
-
+
/**
Spring_spacer::get_ruling_durations(Array<Moment> &shortest_playing_arr,
Array<Moment> &context_shortest_arr)
{
- for (int i=0; i < cols.size(); i++)
+ for (int i=0; i < cols.size(); i++)
scol_l (i)->preprocess();
int start_context_i=0;
if (scol_l (i)->breakable_b_)
{
- for (int ji=i; ji >= start_context_i; ji--)
+ for (int ji=i; ji >= start_context_i; ji--)
context_shortest_arr[ji] = context_shortest;
start_context_i = i;
context_shortest = infinity_mom;
if (scol_l(ji)->durations.size() &&
now - scol_l(ji)->when() >= shortest_playing)
break;
-
- for (int k = scol_l (ji)->durations.size();
- k-- && scol_l(ji)->durations[k] + scol_l(ji)->when() > now;
- )
+
+ for (int k = scol_l (ji)->durations.size();
+ k-- && scol_l(ji)->durations[k] + scol_l(ji)->when() > now;
+ )
{
shortest_playing = shortest_playing <? scol_l(ji)->durations[k];
}
}
shortest_playing_arr.push(shortest_playing);
}
-
+
#ifndef NPRINT
DOUT << "shortest_playing/:[ ";
for (int i=0; i < shortest_playing_arr.size(); i++)
{
- DOUT << shortest_playing_arr[i] << " ";
+ DOUT << shortest_playing_arr[i] << " ";
DOUT << context_shortest_arr[i] << ", ";
}
DOUT << "]\n";
generate springs between columns.
UNDER DESTRUCTION
-
+
TODO: This needs rethinking. Spacing should take optical
effects into account, and should be local (measure wide)
- The algorithm is taken from :
+ The algorithm is taken from :
John S. Gourlay. ``Spacing a Line of Music,'' Technical Report
OSU-CISRC-10/87-TR35, Department of Computer and Information
Science, The Ohio State University, 1987.
-
+
*/
void
Spring_spacer::calc_idealspacing()
Array<Moment> context_shortest_arr;
get_ruling_durations(shortest_playing_arr, context_shortest_arr);
-
+
Array<Real> ideal_arr_;
- Array<Real> hooke_arr_;
+ Array<Real> hooke_arr_;
for (int i=0; i < cols.size(); i++){
ideal_arr_.push (-1.0);
hooke_arr_.push (1.0);
}
-
+
for (int i=0; i < cols.size(); i++)
{
if (!scol_l (i)->musical_b())
durational_distance = paper_l()->duration_to_dist (delta_t,k);
symbol_distance += -cols[i+1].width_[LEFT];
}
-
+
ideal_arr_[i] = symbol_distance >? durational_distance;
hooke_arr_[i] = 2.0;
}
Moment context_shortest = context_shortest_arr[i];
if (! shortest_playing_len)
{
- warning ("Can't find a ruling note at "
+ warning (_("Can't find a ruling note at ")
+String (scol_l (i)->when()));
shortest_playing_len = 1;
}
if (! context_shortest)
{
- warning("No minimum in measure at "
+ warning(_("No minimum in measure at ")
+ String (scol_l (i)->when()));
context_shortest = 1;
}
Real k= paper_l()->arithmetic_constant(context_shortest);
Real dist = paper_l()->duration_to_dist (shortest_playing_len, k);
dist *= delta_t / shortest_playing_len;
-
+
/* all sorts of ugliness to avoid running into bars/clefs, but not taking
extra space if this is not needed */
if (!scol_l (i+1)->musical_b())
Staff_side::support_height() const
{
Interval r;
-
+
for (int i=0; i < support_l_arr_.size(); i++)
r.unite (support_l_arr_[i]->height());
- if (r.empty_b())
+ if (r.empty_b())
{
r = Interval (0,0);
}
int
Staff_side::get_position_i() const
{
- if (!dir_)
+ if (!dir_)
{
- warning ("Staff_side::get_position_i(): "
- "somebody forgot to set my vertical direction, returning -20");
+ warning (_("Staff_side::get_position_i(): "
+ "somebody forgot to set my vertical direction, returning -20"));
return -20;
}
-
+
Real y=0;
Real inter_f = paper()-> internote_f ();
- if (!inside_staff_b_)
+ if (!inside_staff_b_)
{
- y = (staff_sym_l_) ? dir_ * (staff_sym_l_->steps_i()/2 + 2) : -2;
+ y = (staff_sym_l_) ? dir_ * (staff_sym_l_->steps_i()/2 + 2) : -2;
y *=inter_f;
-
+
Interval v= support_height();
- if (dir_ > 0)
+ if (dir_ > 0)
{
y = y >? (v.max() + 2*inter_f);
}
- else if (dir_ < 0)
+ else if (dir_ < 0)
{
y = y <? (v.min() - 2*inter_f);
}
}
- else
+ else
{
Interval v= support_height();
y = v[dir_] + 2*dir_*inter_f; // ugh
void
Staff_side::do_substitute_dependency (Score_elem*o, Score_elem*n)
-{
+{
support_l_arr_.unordered_substitute (o,n);
if (staff_sym_l_ == o)
staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0;
*/
#include "stem.hh"
-#include "dimen.hh"
+#include "dimen.hh"
#include "debug.hh"
#include "paper-def.hh"
#include "note-head.hh"
IMPLEMENT_IS_TYPE_B1 (Stem,Item);
-Stem::Stem ()
+Stem::Stem ()
{
/*
TODO: staff-size
for (int i =0; i < head_l_arr_.size (); i++)
m = m >? head_l_arr_[i]->position_i_;
return m;
-
+
}
void
#endif
}
-Real
+Real
Stem::stem_length_f () const
{
return yextent_drul_[UP]-yextent_drul_[DOWN] ;
Stem::set_stemend (Real se)
{
// todo: margins
- if (! ((dir_ > 0 && se >= max_head_i ()) ||
- (se <= min_head_i () && dir_ <0)))
- warning ("Weird stem size; check for narrow beams");
+ if (! ((dir_ > 0 && se >= max_head_i ()) ||
+ (se <= min_head_i () && dir_ <0)))
+ warning (_("Weird stem size; check for narrow beams"));
yextent_drul_[UP] = (dir_ < 0) ? max_head_i () : se;
yextent_drul_[DOWN] = (dir_ < 0) ? se : min_head_i ();
else if (n->is_type_b (Rest::static_name ()))
{
rest_l_arr_.push ((Rest*)n);
- }
+ }
}
bool
Stem::invisible_b () const
{
-
- return (!head_l_arr_.size () ||
+
+ return (!head_l_arr_.size () ||
head_l_arr_[0]->balltype_i_ <= 0);
}
if (dir_)
return dir_;
return (get_center_distance_from_top () >=
- get_center_distance_from_bottom ()) ?
+ get_center_distance_from_bottom ()) ?
(Direction)-1 : (Direction)1;
}
if (!dir_)
set_default_dir ();
-
+
Real dy = paper ()->interbeam_f ();
Real len = STEMLEN;
// ugh, should get nice *rule* for this
len += (abbrev_flag_i_ - 1)* dy / 2;
set_stemend ((dir_ > 0) ? max_head_i () + len :
min_head_i () - len);
-
+
if (dir_ * stem_end_f () < 0)
{
set_stemend (0);
}
-
-
+
+
}
void
if (!stem_length_f ())
set_default_stemlen ();
- set_stemend ((dir_< 0) ?
+ set_stemend ((dir_< 0) ?
max_head_i ()-stem_length_f (): min_head_i () + stem_length_f ());
-
+
if (dir_ == UP)
stem_xdir_ = RIGHT;
if (invisible_b ())
/*
TODO
-
+
move into note_column.cc
*/
if (!head_l_arr_.size ())
return;
head_l_arr_.sort (Note_head::compare);
- if (dir_ < 0)
+ if (dir_ < 0)
head_l_arr_.reverse ();
-
+
head_l_arr_[0]->extremal_i_ = -1;
head_l_arr_.top ()->extremal_i_ = 1;
int parity=1;
int lastpos = head_l_arr_[0]->position_i_;
- for (int i=1; i < head_l_arr_.size (); i ++)
+ for (int i=1; i < head_l_arr_.size (); i ++)
{
int dy =abs (lastpos- head_l_arr_[i]->position_i_);
-
- if (dy <= 1)
+
+ if (dy <= 1)
{
if (parity)
head_l_arr_[i]->x_dir_ = (stem_xdir_ == LEFT) ? LEFT : RIGHT;
}
-
+
Molecule
Stem::abbrev_mol () const
{
Real dy = paper ()->interbeam_f ();
Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim_.x ().length ();
Real beamdy = paper ()->interline_f () / 2;
-
+
int beams_i = 0;
Real slope = paper ()->internote_f () / 4;
-
+
if (beam_l_) {
// huh?
slope = 2 * beam_l_->slope;
// ugh, rather calc from Abbreviation_req
- beams_i = beams_right_i_ >? beams_left_i_;
+ beams_i = beams_right_i_ >? beams_left_i_;
}
paper ()->lookup_l ()->beam (slope, 20 PT);
-
+
Molecule beams;
Atom a (paper ()->lookup_l ()->beam (slope, w));
a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope)));
a.translate_axis (dy + beamdy - dir_ * dy, Y_AXIS);
else
a.translate_axis (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS);
-
- for (int i = 0; i < abbrev_flag_i_; i++)
+
+ for (int i = 0; i < abbrev_flag_i_; i++)
{
Atom b (a);
b.translate_axis (-dir_ * dy * (beams_i + i), Y_AXIS);
beams.add (b);
}
-
+
return beams;
}
Molecule*
-Stem::brew_molecule_p () const
+Stem::brew_molecule_p () const
{
Molecule *mol_p =new Molecule;
-
+
Real bot = yextent_drul_[DOWN];
Real top = yextent_drul_[UP];
-
+
assert (bot!=top);
-
+
Paper_def *p =paper ();
-
+
Real dy = p->internote_f ();
if (!invisible_b ())
{
Atom ss =p->lookup_l ()->stem (bot*dy,top*dy);
mol_p->add (Atom (ss));
}
-
+
if (!beam_l_ &&abs (flag_i_) > 2)
{
Atom fl = p->lookup_l ()->flag (flag_i_, dir_);
mol_p->add_at_edge (Y_AXIS, dir_, Molecule (Atom (fl)));
assert (!abbrev_flag_i_);
}
-
+
if (abbrev_flag_i_)
mol_p->add (abbrev_mol ());
return mol_p;
}
-Real
+Real
Stem::note_delta_f () const
{
Real r=0;
Symtables::Symtables (Symtables const &s)
{
- for (Assoc_iter<String, Symtable*> i (s); i.ok(); i++)
+ for (Assoc_iter<String, Symtable*> i (s); i.ok(); i++)
{
add (i.key(), new Symtable (*i.val ()));
}
Symtables::~Symtables()
{
- for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
+ for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
{
delete i.val();
}
}
-Atom
+Atom
Symtable::lookup (String s) const
{
if (elt_b (s))
return (*this)[s];
- else
+ else
{
- warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
- Atom sy;
+ warning ("Symtable `" + id_str+ _("\': unknown symbol `") +s+"'\n");
+ Atom sy;
return sy;
}
}
-Symtable*
-Symtables::operator()(String s)
+Symtable*
+Symtables::operator()(String s)
{
if (!elt_b (s))
{
- warning ("Symtables `" + s + "\' unknown");
+ warning ("Symtables `" + s + _("\' unknown"));
return 0;
}
else
return Dictionary<Symtable*>::operator[](s);
-}
+}
void
Symtables::print() const
{
- for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
+ for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
{
DOUT << "table \'" << i.key() << "\' {\n";
i.val()->print ();
void
Symtable::print() const
{
- for (Assoc_iter<String, Atom> i (*this); i.ok(); i++)
+ for (Assoc_iter<String, Atom> i (*this); i.ok(); i++)
{
DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
}
}
-
+
void
Symtables::add (String s, Symtable*p)
{
{
String name = String("slope");
Atom bs=(*symtables_)("beamslopes")->lookup (name);
-
+
Array<String> args;
args.push (sidx);
args.push (widx);
Atom
Lookup::rule_symbol (Real height, Real width) const
{
- Atom bs=(*symtables_)("beamslopes")->lookup ("horizontal");
+ Atom bs=(*symtables_)("beamslopes")->lookup ("horizontal");
Array<String> args;
args.push (print_dimen (height));
args.push (print_dimen (width));
Atom
Lookup::beam (Real &slope, Real width) const
-{
+{
int sidx = 0;
if (abs (slope) > 1.0)
{
- WARN << "beam steeper than 1.0 (" << slope << ")\n";
+ WARN << _("beam steeper than 1.0 (") << slope << ")\n";
slope = sign (slope);
}
sidx = int (rint (slope * 20.0));
slope = sidx / 20.0;
-
+
Interval xdims = (*symtables_)("beamslopes")->lookup ("slope").dim_[X_AXIS];
Real min_wid = xdims[LEFT];
Real max_wid = xdims[RIGHT];
assert(max_wid > 0);
int widths = intlog2 (int (max_wid/min_wid)) + 1;
-
- if (width < min_wid)
+
+ if (width < min_wid)
{
- WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n";
+ WARN<<_("Beam too narrow. (") << print_dimen (width) <<")\n";
width = min_wid;
}
-
+
Real elemwidth = max_wid;
-
+
int widx =widths - 1;
Molecule m;
- while (elemwidth > width)
+ while (elemwidth > width)
{
widx --;
elemwidth /= 2.0;
Real x = overlap;
Atom elem (beam_element (sidx * widths, widx, slope));
m.add (elem);
- while (x < last_x)
+ while (x < last_x)
{
Atom a(elem);
a.translate (Offset (x-overlap, (x-overlap)*slope));
Atom a(elem);
a.translate (Offset (last_x, (last_x) * slope));
m.add (a);
-
+
Atom ret;
ret.tex_ = m.TeX_string();
ret.dim_.y() = Interval (0,width*slope);
ret.dim_.x() = Interval (0,width);
-
+
return ret;
}
-
-
// todo
if (dx >= 400 PT)
{
- WARN<<"halfslur too large" <<print_dimen (dx)<< "shrinking (ugh)\n";
+ WARN<<_("halfslur too large") <<print_dimen (dx)<< _("shrinking (ugh)\n");
dx = 400 PT;
}
int widx = int (floor (dx / 4.0));
dx = widx * 4.0;
if (widx) widx --;
- else
+ else
{
- WARN << "slur too narrow\n";
+ WARN << _("slur too narrow\n");
}
Atom s;
-
+
s.dim_[Y_AXIS] = Interval (min (0, 0), max (0, 0)); // todo
s.dim_[X_AXIS] = Interval (-dx/2, dx/2);
}
/*
- The halfslurs have their center at the end pointing away from the notehead.
+ The halfslurs have their center at the end pointing away from the notehead.
This lookup translates so that width() == [0, w]
*/
return half_slur_middlepart (dx, dir);
int widx;
-
- if (dx >= 96 PT)
+
+ if (dx >= 96 PT)
{
- WARN << "Slur half too wide." << print_dimen (orig_dx) << " shrinking (ugh)\n";
+ WARN << _("Slur half too wide.") << print_dimen (orig_dx) << _(" shrinking (ugh)\n");
dx = 96 PT;
}
dx = widx*12.0;
if (widx)
widx --;
- else
+ else
{
- WARN << "slur too narrow " << print_dimen (orig_dx)<<"\n";
+ WARN << _("slur too narrow ") << print_dimen (orig_dx)<<"\n";
}
-
+
Atom s;
s.dim_[X_AXIS] = Interval (0, dx);
s.dim_[Y_AXIS] = Interval (min (0, dy), max (0, dy));
idx = widx * 16 + hidx;
if (xpart < 0)
idx += 128;
-
+
assert (idx < 256);
f+=String ("{") + String (idx) + "}";
-
+
s.tex_ = f;
-
+
return s;
}
Atom
Lookup::slur (int dy , Real &dx, Direction dir) const
{
-
+
assert (abs (dir) <= 1);
if (dx < 0)
{
- warning ("Negative slur/tie length: " + print_dimen (dx));
+ warning (_("Negative slur/tie length: ") + print_dimen (dx));
dx = 4.0 PT;
}
Direction y_sign = (Direction) sign (dy);
bool large = abs (dy) > 8;
- if (y_sign)
+ if (y_sign)
{
large |= dx>= 4*16 PT;
}
else
large |= dx>= 4*54 PT;
-
- if (large)
+
+ if (large)
{
return big_slur (dy, dx, dir);
}
dx = 4.0 * widx;
if (widx)
widx --;
- else
+ else
{
- WARN << "slur too narrow: " << print_dimen (orig_dx) << "\n";
+ WARN << _("slur too narrow: ") << print_dimen (orig_dx) << "\n";
}
int hidx = dy;
if (hidx <0)
hidx = -hidx;
- hidx --;
- if (hidx > 8)
+ hidx --;
+ if (hidx > 8)
{
- WARN<<"slur to steep: " << dy << " shrinking (ugh)\n";
+ WARN<<_("slur to steep: ") << dy << _(" shrinking (ugh)\n");
}
-
+
Atom s;
s.dim_[X_AXIS] = Interval (0, dx);
s.dim_[Y_AXIS] = Interval (min (0, dy), max (0, dy));
String f = String ("\\slurchar") + String (direction_char (y_sign));
int idx=-1;
- if (y_sign)
- {
+ if (y_sign)
+ {
idx = hidx * 16 + widx;
if (dir < 0)
idx += 128;
}
- else
+ else
{
- if (dx >= 4*54 PT)
+ if (dx >= 4*54 PT)
{
- WARN << "slur too wide: " << print_dimen (dx) <<
- " shrinking (ugh)\n";
+ WARN << _("slur too wide: ") << print_dimen (dx) <<
+ _(" shrinking (ugh)\n");
dx = 4*54 PT;
}
idx = widx;
if (dir < 0)
- idx += 54;
+ idx += 54;
}
-
+
assert (idx < 256);
f+=String ("{") + String (idx) + "}";
s.tex_ = f;
s.translate_axis (dx/2, X_AXIS);
- return s;
+ return s;
}
Atom
Lookup::big_slur (int dy , Real &dx, Direction dir) const
{
- if (dx < 24 PT)
+ if (dx < 24 PT)
{
- warning ("big_slur too small " + print_dimen (dx) + " (stretching)");
+ warning (_("big_slur too small ") + print_dimen (dx) + _(" (stretching)"));
dx = 24 PT;
}
-
- Real slur_extra =abs (dy) /2.0 + 2;
+
+ Real slur_extra =abs (dy) /2.0 + 2;
int l_dy = int (Real (dy)/2 + slur_extra*dir);
int r_dy = dy - l_dy;
Real right_wid = left_wid;
Atom l = half_slur (l_dy, left_wid, dir, -1);
-
-
+
+
Atom r = half_slur (r_dy, right_wid, dir, 1);
Real mid_wid = dx - left_wid - right_wid;
s.dim_ = mol.extent();
return s;
}
-
-
source file of the GNU LilyPond music typesetter
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-
+
*/
#include <fstream.h>
const int MAXLINELEN = 200;
-Tex_stream::Tex_stream (String filename)
+Tex_stream::Tex_stream (String filename)
{
os = new ofstream (filename.ch_C ());
if (!*os)
- error ("can't open `" + filename+"\'");
+ error (_("can't open `") + filename+"\'");
nest_level = 0;
line_len_i_ = 0;
outputting_comment=false;
void
Tex_stream::header()
{
- *os << "% Creator: " << get_version_str() << "\n";
- *os << "% Automatically generated, at ";
+ *os << _("% Creator: ") << get_version_str() << "\n";
+ *os << _("% Automatically generated, at ");
time_t t (time (0));
*os << ctime (&t)<<"\n";
}
*os << flush;
if (!*os)
{
- warning("error syncing file (disk full?)");
+ warning(_("error syncing file (disk full?)"));
exit_status_i_ = 1;
}
delete os;
Tex_stream &
Tex_stream::operator<<(String s)
{
-
- for (char const *cp = s.ch_C (); *cp; cp++)
+
+ for (char const *cp = s.ch_C (); *cp; cp++)
{
- if (outputting_comment)
+ if (outputting_comment)
{
*os << *cp;
- if (*cp == '\n')
+ if (*cp == '\n')
{
outputting_comment=false;
continue;
}
line_len_i_ ++;
- switch (*cp)
+ switch (*cp)
{
case '%':
outputting_comment = true;
break;
case '{':
nest_level++;
- *os << *cp;
+ *os << *cp;
break;
case '}':
- nest_level--;
+ nest_level--;
*os << *cp;
-
- if (nest_level < 0)
+
+ if (nest_level < 0)
{
delete os; // we want to see the remains.
assert (nest_level>=0);
}
/* FALLTHROUGH */
-
+
case '\n':
break_line();
- break;
+ break;
case ' ':
*os << ' ';
- if (line_len_i_ > MAXLINELEN)
- break_line();
-
+ if (line_len_i_ > MAXLINELEN)
+ break_line();
+
break;
default:
*os << *cp;
*os << String (' ', nest_level);
line_len_i_ = 0;
}
-
void
Tie_engraver::do_post_move_processing()
{
- if (tie_p_ && now_moment () == end_mom_)
+ if (tie_p_ && now_moment () == end_mom_)
{
end_tie_p_ = tie_p_;
end_req_l_ = req_l_;
{
if (!acceptable_request_b (r))
return false;
- if (req_l_)
+ if (req_l_)
{
return false;
}
Tie_engraver::do_process_requests()
{
dir_ = (Direction) int (get_property ("ydirection"));
- if (req_l_ && ! tie_p_)
+ if (req_l_ && ! tie_p_)
{
tie_p_ = new Tie;
}
void
Tie_engraver::acknowledge_element (Score_elem_info i)
{
- if (i.elem_l_->name() == Note_head::static_name ())
+ if (i.elem_l_->name() == Note_head::static_name ())
{
- if (tie_p_)
+ if (tie_p_)
{
tie_p_->set_head (LEFT, (Note_head*)i.elem_l_->item());
melodic_req_l_ = i.req_l_->musical()->melodic ();
}
- if (end_tie_p_)
+ if (end_tie_p_)
{
end_tie_p_->set_head (RIGHT, (Note_head*)i.elem_l_->item());
if (!Melodic_req::compare (*end_melodic_req_l_, *melodic_req_l_))
void
Tie_engraver::do_pre_move_processing()
{
- if (end_tie_p_)
+ if (end_tie_p_)
{
if (dir_)
end_tie_p_->dir_ = dir_;
-
+
typeset_element (end_tie_p_);
end_tie_p_ =0;
end_req_l_ =0;
Tie_engraver::do_removal_processing ()
{
do_pre_move_processing ();
- if (tie_p_)
+ if (tie_p_)
{
- req_l_->warning ("unended Tie");
+ req_l_->warning (_("unended Tie"));
tie_p_->unlink ();
delete tie_p_;
}
Tie::do_add_processing()
{
if (!(head_l_drul_[LEFT] && head_l_drul_[RIGHT]))
- warning ("Lonely tie.. ");
-
+ warning (_("Lonely tie.. "));
+
set_bounds(LEFT,head_l_drul_[LEFT]);
set_bounds(RIGHT,head_l_drul_[RIGHT]);
}
assert (head_l_drul_[LEFT] || head_l_drul_[RIGHT]);
Direction d = LEFT;
- do
+ do
{
- pos_i_drul_[d] = (head_l_drul_[d])?
+ pos_i_drul_[d] = (head_l_drul_[d])?
head_l_drul_[d]->position_i_ : head_l_drul_[(Direction)-d]->position_i_;
}
while ((d *= -1) != LEFT);
- do
+ do
{
- if (head_l_drul_[d] && head_l_drul_[d]->extremal_i_)
+ if (head_l_drul_[d] && head_l_drul_[d]->extremal_i_)
{
pos_i_drul_[d] += 2*dir_;
dx_f_drul_[d] += d * 0.25;
else
{
pos_i_drul_[d] = pos_i_drul_[(Direction) -d];
- dx_f_drul_[d] = -d
+ dx_f_drul_[d] = -d
*(spanned_drul_[d]->width ().length ()/nw_f -0.5);
}
}
void
Time_description::set_cadenza (bool b)
{
- if (cadenza_b_ && !b)
+ if (cadenza_b_ && !b)
{
- if (whole_in_measure_)
+ if (whole_in_measure_)
{
bars_i_ ++; // should do?
whole_in_measure_ = 0;
assert (dt >= Rational (0));
when_ += dt;
whole_in_measure_ += dt;
-
- while (!cadenza_b_ && whole_in_measure_ >= whole_per_measure_)
+
+ while (!cadenza_b_ && whole_in_measure_ >= whole_per_measure_)
{
whole_in_measure_ -= whole_per_measure_;
bars_i_ ++;
/**
retrieve error messages.
- @return
+ @return
error messages if not possible, "" if possible
*/
String
Time_description::try_set_partial_str (Moment p) const
{
if (p<Rational (0))
- return ("Partial must be non-negative");
+ return (_("Partial must be non-negative"));
if (p > whole_per_measure_)
- return ("Partial measure too large");
+ return (_("Partial measure too large"));
return "";
}
{
int i = sign (t1.when_-t2.when_);
- if (!i)
+ if (!i)
{
assert (t1.bars_i_==t2.bars_i_);
assert (t1.one_beat_ == t2.one_beat_);
{
return when_ + barleft();
}
-
Command_req * c = r->command();
if (!(c && c->timing()))
return false;
- for (int i=0; i < timing_req_l_arr_.size (); i++)
+ for (int i=0; i < timing_req_l_arr_.size (); i++)
{
if (timing_req_l_arr_[i]->equal_b(r))
return true;
- if (timing_req_l_arr_[i]->name() == r->name())
+ if (timing_req_l_arr_[i]->name() == r->name())
{
- r->warning ("conflicting timing request");
+ r->warning (_("conflicting timing request"));
return false;
}
}
-
+
timing_req_l_arr_.push(c->timing());
return true;
}
Timing_translator::meter_req_l() const
{
Meter_change_req *m_l=0;
- for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++)
+ for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++)
{
m_l=timing_req_l_arr_[i]->meterchange();
}
- return m_l;
+ return m_l;
}
void
Timing_translator::do_process_requests()
{
- for (int i=0; i < timing_req_l_arr_.size (); i++)
+ for (int i=0; i < timing_req_l_arr_.size (); i++)
{
Timing_req * tr_l = timing_req_l_arr_[i];
Meter_change_req *m_l = tr_l->meterchange();
- if (m_l)
+ if (m_l)
{
int b_i= m_l->beats_i_;
int o_i = m_l->one_beat_i_;
if (! time_.allow_meter_change_b())
- tr_l->warning ("Meter change not allowed here");
+ tr_l->warning (_("Meter change not allowed here"));
else
{
time_.set_meter (b_i, o_i);
- default_grouping_ =
+ default_grouping_ =
Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
}
}
- else if (tr_l->partial())
+ else if (tr_l->partial())
{
Moment m = tr_l->partial()->duration_;
String error = time_.try_set_partial_str (m);
- if (error.length_i ())
+ if (error.length_i ())
{
tr_l->warning (error);
}
- else
+ else
time_.setpartial (m);
}
- else if (tr_l->barcheck())
+ else if (tr_l->barcheck())
{
- if (time_.whole_in_measure_)
+ if (time_.whole_in_measure_)
{
- tr_l ->warning ("Barcheck failed");
-
+ tr_l ->warning (_("Barcheck failed"));
+
time_.whole_in_measure_ = 0; // resync
time_.error_b_ = true;
}
}
- else if (tr_l->cadenza())
+ else if (tr_l->cadenza())
{
time_.set_cadenza (tr_l->cadenza()->on_b_);
}
- else if (tr_l->measuregrouping())
+ else if (tr_l->measuregrouping())
{
- default_grouping_ =
+ default_grouping_ =
parse_grouping (tr_l->measuregrouping()->beat_i_arr_,
tr_l->measuregrouping()->elt_length_arr_);
Timing_translator::do_pre_move_processing()
{
timing_req_l_arr_.set_size (0);
- Global_translator *global_l =
+ Global_translator *global_l =
daddy_trans_l_->ancestor_l (100)->global_l (); // ugh 100.
-
+
if (!time_.cadenza_b_)
global_l->add_moment_to_process (time_.next_bar_moment ());
}
{
time_.add (now_moment () - time_.when_);
}
-
{
if (!global_translator_dict_p)
global_translator_dict_p = new Dictionary<Translator*>;
-
+
global_translator_dict_p->elem (t->name ()) = t;
}
return (*global_translator_dict_p)[s];
}
- error ("Unknown translator `" + s +"\'");
+ error (_("Unknown translator `") + s +"\'");
return 0;
}
void
Translator_group::check_removal()
{
- for (int i =0; i < group_l_arr ().size();)
+ for (int i =0; i < group_l_arr ().size();)
{
group_l_arr ()[i]->check_removal();
if (group_l_arr ()[i]->removable_b())
terminate_translator (group_l_arr ()[i]);
- else
+ else
i++;
}
}
return !(iterator_count_ || group_l_arr ().size());
}
-Translator_group *
+Translator_group *
Translator_group::find_existing_translator_l (String n, String id)
{
- if (is_alias_b (n) && (id_str_ == id || id.empty_b ()))
+ if (is_alias_b (n) && (id_str_ == id || id.empty_b ()))
return this;
Translator_group* r = 0;
- for (int i =0; !r && i < group_l_arr ().size(); i++)
+ for (int i =0; !r && i < group_l_arr ().size(); i++)
{
r = group_l_arr ()[i]->find_existing_translator_l (n,id);
}
-
+
return r;
}
accepted_arr.push (t->group_l());
}
-
+
for (int i=0; i < accepted_arr.size (); i++)
if (accepted_arr[i]->type_str_ == type)
{
- Link_array<Translator_group> retval;
+ Link_array<Translator_group> retval;
retval.push (accepted_arr[i]);
return retval;
}
-
- Link_array<Translator_group> best_result;
+
+ Link_array<Translator_group> best_result;
int best_depth= INT_MAX;
for (int i=0; i < accepted_arr.size (); i++)
{
Translator_group * g = accepted_arr[i];
-
+
Link_array<Translator_group> result
= g->path_to_acceptable_translator (type);
if (result.size () && result.size () < best_depth)
Translator_group * existing = find_existing_translator_l (n,id);
if (existing)
return existing;
-
+
Link_array<Translator_group> path = path_to_acceptable_translator (n);
-
+
if (path.size ())
{
Translator_group * current = this;
// start at 1. The first one (index 0) will be us.
- for (int i=0; i < path.size (); i++)
+ for (int i=0; i < path.size (); i++)
{
Translator_group * new_group = path[i]->clone ()->group_l ();
current->add (new_group);
current->id_str_ = id;
return current;
}
-
+
Translator_group *ret = 0;
if (daddy_trans_l_)
ret = daddy_trans_l_->find_create_translator_l (n,id);
- else
+ else
{
- warning ("Can't find or create `" + n + "' called `" + id + "'\n");
+ warning (_("Can't find or create `") + n + _("' called `") + id + "'\n");
ret =0;
}
return ret;
{
if (!level || !daddy_trans_l_)
return this;
-
+
return daddy_trans_l_->ancestor_l (level-1);
}
DOUT << "Removing " << r_l->name() << " at " << now_moment () << "\n";
r_l->removal_processing();
Translator * trans_p =remove_translator_p (r_l);
-
+
delete trans_p;
}
Translator * t = trans_cur.remove_p();
/*
For elegant design, we would do this too. Alas, it does not work yet..
-
+
t-> removal_processing ();
*/
t-> daddy_trans_l_ = 0;
Translator*
Translator_group::get_simple_translator (char const *type) const
{
- for (int i=0; i < nongroup_l_arr ().size(); i++)
+ for (int i=0; i < nongroup_l_arr ().size(); i++)
{
if (nongroup_l_arr ()[i]->name() == type)
return nongroup_l_arr ()[i];
Translator*t = output_def_l ()->find_translator_l (accepts_str_arr_[0]);
Translator_group * g= t->clone ()->group_l ();
add (g);
-
+
if (!g->is_bottom_translator_b ())
return g->get_default_interpreter ();
else
Translator_group::each (Method_pointer method)
{
for (PCursor<Translator*> i (trans_p_list_.top ()); i.ok (); i++)
- (i.ptr()->*method) ();
+ (i.ptr()->*method) ();
}
void
Translator_group::each (Const_method_pointer method) const
{
for (PCursor<Translator*> i (trans_p_list_.top ()); i.ok (); i++)
- (i.ptr()->*method) ();
+ (i.ptr()->*method) ();
}
void
void
Translator_group::do_add_processing ()
{
- for (int i=0; i < consists_str_arr_.size(); i++)
+ for (int i=0; i < consists_str_arr_.size(); i++)
{
Translator * t = output_def_l ()->find_translator_l (consists_str_arr_[i]);
if (!t)
- warning ("Could not find `" +consists_str_arr_[i]+ "'");
+ warning (_("Could not find `") +consists_str_arr_[i]+ "'");
else
add (t->clone ());
}
#include "spring-spacer.hh"
-/** el stupido.
-
-
+/** el stupido.
+
+
A Dynamic Programming type of algorithm
similar to TeX's is in Gourlay_breaking
Word_wrap::do_solve() const
{
problem_OK();
-
+
PCursor<Paper_column*> curcol (pscore_l_->col_p_list_.top());
Array<Col_hpositions> breaking;
Line_of_cols breakpoints (find_breaks());
assert (breakpoints.size()>=2);
- int break_idx_i=0;
- while (break_idx_i < breakpoints.size() -1)
+ int break_idx_i=0;
+ while (break_idx_i < breakpoints.size() -1)
{
Col_hpositions minimum;
Col_hpositions current;
curcol++; // skip the breakable.
break_idx_i++;
- while (break_idx_i < breakpoints.size())
+ while (break_idx_i < breakpoints.size())
{
-
+
// add another measure.
while (breakpoints[break_idx_i] != curcol.ptr())
{
current.spacer_l_ = generate_spacing_problem (current.cols);
// try to solve
- if (!feasible (current.cols))
+ if (!feasible (current.cols))
{
- if (!minimum.cols.size())
+ if (!minimum.cols.size())
{
- warning ("Ugh, this measure is too long, breakpoint: "
+ warning (_("Ugh, this measure is too long, breakpoint: ")
+ String (break_idx_i) +
- " (generating stupido solution)");
+ _(" (generating stupido solution)"));
current.stupid_solution();
current.energy_f_ = - 1; // make sure we break out.
}
else
current.energy_f_ = infinity_f; // make sure we go back
}
- else
+ else
{
-
+
current.solve_line();
current.print();
}
current.spacer_l_ =0;
// update minimum, or backup.
- if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0)
+ if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0)
{
minimum = current;
}
Begin3
Titel: LilyPond
-Versie: 0.1.23
-Inschrijf datum: 15OCT97
+Versie: 0.1.24
+Inschrijf datum: 20OCT97
Beschrijving: LilyPond is de muziek typesetter van het GNU Project.
Het programma genereert muziek in zichtbare of
hoorbare vorm uit uit een muzikale definitie file:
jan@digicash.com (Jan Nieuwenhuizen)
Onderhouden door: hanwen@stack.nl (Han-Wen Nienhuys)
Voornaamste plek: sunsite.unc.edu /pub/Linux/apps
- 395k lilypond-0.1.23.tar.gz
+ 395k lilypond-0.1.24.tar.gz
Oorspronkelijke plek: pcnov095.win.tue.nl /pub/lilypond/
- 395k lilypond-0.1.23.tar.gz
+ 395k lilypond-0.1.24.tar.gz
Copi"eer politie: GPL
End
Begin3
Title: LilyPond
-Version: 0.1.23
-Entered-date: 15OCT97
+Version: 0.1.24
+Entered-date: 20OCT97
Description: LilyPond is the GNU Project music typesetter. The program
generates visual or auditive output from a music
definition file: it can typeset formatted sheet music
MIDI file. Features include multiple staffs, meters,
clefs, keys, lyrics, versatile input-language,
cadenzas, beams, slurs, triplets.
-Keywords: music typesetting midi notation
+Keywords: music notation typesetting midi
Author: hanwen@stack.nl (Han-Wen Nienhuys)
jan@digicash.com (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps
- 395k lilypond-0.1.23.tar.gz
+ 430k lilypond-0.1.24.tar.gz
Original-site: pcnov095.win.tue.nl /pub/lilypond/
- 395k lilypond-0.1.23.tar.gz
+ 430k lilypond-0.1.24.tar.gz
Copying-policy: GPL
End
MIDI file. Features include multiple staffs, meters,
clefs, keys, lyrics, versatile input-language,
cadenzas, beams, slurs, triplets.
-Keywords: music typesetting midi notation
+Keywords: music notation typesetting midi
Author: hanwen@stack.nl (Han-Wen Nienhuys)
jan@digicash.com (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps
- 395k lilypond-@TOPLEVEL_VERSION@.tar.gz
+ 430k lilypond-@TOPLEVEL_VERSION@.tar.gz
Original-site: pcnov095.win.tue.nl /pub/lilypond/
- 395k lilypond-@TOPLEVEL_VERSION@.tar.gz
+ 430k lilypond-@TOPLEVEL_VERSION@.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 0.1.23
+Version: 0.1.24
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.23.tar.gz
+Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.24.tar.gz
Summary: A preprocessor to make TeX typeset music.
URL: http://www.stack.nl/~hanwen/lilypond
Packager: Han-Wen Nienhuys <hanwen@stack.nl>
% flags
%
-
fet_begingroup("floogbars")
-save flag_angle, flare;
-save hip_thickness, hip_depth, hip_width;
-save foot_thickness, foot_depth, foot_width;
-
-flag_angle = 32;
-
-hip_thickness# = 1.2 stafflinethickness#;
-foot_thickness# = blot_diameter#;
-flare# = 1.0 interline#;
-
-hip_depth# = 15/7 interline#;
-hip_width# = 7/8 interline# + hip_thickness# /2 + stemthickness#/2;
+% Flags pointing down overlap with the notehead (in x-direction), so
+% the down-flag can be bigger
+upflag_width# = .750 black_notehead_width#;
+downflag_width# = .833 black_notehead_width#;
-foot_depth# = flare# + 15/7 interline#;
-foot_width# = .8 hip_width#;
-
-
-define_pixels(flare,
- hip_depth, hip_width, hip_thickness,
- foot_depth, foot_width, foot_thickness
-);
+%
+% Flags pointing down cannot overlap with the notehead in y-direction,
+% so they have less slant.
-%treq;
+%
+% Because of optical illusion, the utmost flag
+% (bottom for down-pointing, top
+% for up-pointing) should be smaller than the other flags
+%
+save hip_thickness, foot_thickness;
+hip_thickness# = 1.3 stemthickness#;
+foot_thickness# = hip_thickness#;
%
-% Inspired by Adobe Sonata,
+% Inspired by Adobe Sonata and [Wanske]
% for example, see POSTSCRIPT Language -- program design,
-% page 119
+% page 119, and [Wanske], p 41,42
%
-def draw_eight_flag =
- penpos0(stemthickness, 0);
+def draw_flag(expr center, flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness, flagcut) =
+ clearxy;
+
penpos1(flare, 90);
- penpos2(hip_thickness, 0);
+ penpos2(whatever, 40);
+ x2r - x2l = hip_thickness;
penpos3(foot_thickness, 0) ;
- penpos4(stemthickness, 0);
- z0r = z1r;
- z0 = (0,0);
- z2 = (hip_width, -hip_depth);
- z3 = (foot_width, -foot_depth);
- z4r = z1l;
+ z1r = center;
+ z2 = center + (hip_width, -flare - hip_depth);
+ z3orig = center + (foot_width, -flare - foot_depth);
+ z3 = (1-flagcut) [z2, z3orig];
+
save bot_dir, bot_path;
pair bot_dir;
bot_path := z2{down} .. z3;
bot_dir := direction 1 of bot_path;
- fill z1l{dir -flag_angle} .. z2l{down} ..
+ fill z1l{curl 0}
+ ..tension 1.1 .. z2l ..
z3l{bot_dir} .. z3r{-bot_dir} ..
- {up}z2r .. {up}z1r ..
- z0l{down} -- z4l -- cycle;
-
- ;
-
+ z2r .. {up}z1r & z1r -- cycle;
enddef;
+
+% godbewaarme, wat een kutsymbolen
fet_beginchar("8th Flag (up)", "3u", "eighthflag")
- set_char_box(stemthickness# /2, hip_width# + hip_thickness#/2,
- foot_depth# + foot_thickness#/2, stemthickness#/2)
- draw_eight_flag;
- penlabels(0, 1, 2, 3, 4);
+ save flare,
+ hip_depth, hip_width,
+ foot_depth, foot_width;
+
+ flare# = 1.0 interline#;
+ hip_depth# = 8/15 foot_depth#;
+ hip_width# = upflag_width# - hip_thickness#/2;
+
+ foot_depth# = 15/7 interline#;
+ foot_width# = .8 hip_width#;
+
+ set_char_box(stemthickness# /2, hip_width# + hip_thickness#/2
+ + stemthickness#/2,
+ flare# + foot_depth# + foot_thickness#/2, stemthickness#/2)
+
+ define_pixels(flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness);
+ draw_flag((stemthickness/2,0), flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness, 0)
+ ;
+ penlabels(1, 2, 3);
+ pickup pencircle scaled stemthickness;
+ draw (0, 0) .. (0,-2 interline);
fet_endchar;
fet_beginchar("8th Flag (down)", "3d", "deighthflag")
- set_char_box(stemthickness# /2, hip_width# + hip_thickness#/2,
- foot_depth# + foot_thickness#/2, stemthickness#/2)
+ save flare,
+ hip_depth, hip_width,
+ foot_depth, foot_width;
+
+ flare# = 1.0 interline#;
+
+ hip_depth# = 8/15 foot_depth#;
+ hip_width# = downflag_width# - hip_thickness#/2;
+ foot_depth# = 15/7 interline#;
+ foot_width# = .8 hip_width#;
+
+ set_char_box(stemthickness# /2, hip_width# + hip_thickness#/2
+ + stemthickness#/2,
+ flare# + foot_depth# + foot_thickness#/2, stemthickness#/2)
+
+ define_pixels(flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness);
+
+ draw_flag((stemthickness/2,0),flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness, 0);
+ pickup pencircle scaled stemthickness;
+ draw (0, 0) .. (0,-2 interline);
+
+ y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar("16th Flag (up)", "4u", "sixteenthflag")
+ save flare, flagspace,
+ hip_depth, hip_width,
+ foot_depth, foot_width;
+
+ flare# = 0.85 interline#;
+ flagspace# = .85 interline#;
+ hip_depth# = 8/15 foot_depth#;
+
+ flagspace# + flare# + foot_depth# = 3.25 interline#;
+
+ hip_width# = upflag_width# - hip_thickness#/2;
+ foot_width# = .8 hip_width#;
+
+ set_char_box(stemthickness# /2, hip_width# + hip_thickness#/2
+ + stemthickness#/2,
+ 3.25 interline#, stemthickness#/2)
+
+ define_pixels(flagspace);
+ define_pixels(flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness);
+
+ draw_flag((stemthickness/2, 0),flare,
+ 1.2 hip_depth, .97 hip_width, hip_thickness,
+ foot_depth, .9 foot_width, foot_thickness, 0.37);
+ draw_flag((stemthickness/2, -flagspace),flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness, 0);
+
+ pickup pencircle scaled stemthickness;
+ draw (0, 0) .. (0,-2 interline);
+
+fet_endchar;
+
+
+fet_beginchar("16th Flag (up)", "4d", "dsixteenthflag")
+ save flare, flagspace,
+ hip_depth, hip_width,
+ foot_depth, foot_width;
+
+ flare# = 0.87 interline#;
+ flagspace# = .9 interline#;
+ hip_depth# = .7 foot_depth#;
+
+ flagspace# + flare# + foot_depth# = 3 interline#;
+
+ hip_width# = downflag_width# - hip_thickness#/2;
+
+ foot_width# = 1.00 hip_width#;
+
+ set_char_box(stemthickness# /2, hip_width# + hip_thickness#/2
+ + stemthickness#/2,
+ 3 interline#, stemthickness#/2)
+
+ define_pixels(flagspace);
+ define_pixels(flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness);
+
+ draw_flag((stemthickness/2, 0),flare,
+ hip_depth, .97 hip_width, hip_thickness,
+ 1.2 foot_depth, .95 foot_width, foot_thickness, 0.0);
+
+ draw_flag((stemthickness/2, -flagspace),flare,
+ hip_depth, hip_width, hip_thickness,
+ foot_depth, foot_width, foot_thickness, 0);
+
+ pickup pencircle scaled stemthickness;
+ draw (0, 0) .. (0,-2 interline);
- draw_eight_flag;
y_mirror_char;
fet_endchar;
-fet_endgroup("floogbars")
+fet_endgroup("floogbars");
% These examples are inspired by [Wanske], see literature list
+save black_notehead_width;
+numeric black_notehead_width;
+
fet_begingroup("balls");
noteheight#:=interline#+ (1 + overdone_heads) *stafflinethickness#;
-
define_pixels(noteheight);
-
-
def draw_brevis =
save beamheight, head_width;
save holeheight, stem_width;
a_w:=1.09;
notehead_calc;
+ black_notehead_width# := wd#;
notehead_draw;
fet_endchar;
fet_endgroup("balls");
+define_pixels(black_notehead_width);
-test:=0;
-
if test = -1:
mode := smoke;
fi
input feta-schrift;
input feta-banier;
else:
-
- input feta-schrift;
+ input feta-bolletjes;
+ input feta-banier;
fi
fet_beginchar("Trill (`tr')","trill","trill")
- save start_angle, ascender_extra, ex, hair_thick, fatness,
+ save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
uitschieter, bulb_size;
;
ascender# = ascender_extra# + ex#;
ex# = 1.5 interline#;
kerning# = .75 ex#;
+ start_nib_angle = 20;
define_pixels(ex, ascender_extra, ascender, kerning);
y1 = ascender;
x1l = 0;
x1r = t_fatness;
- penpos1(start_nib_wid, 25);
+ penpos1(start_nib_wid, start_nib_angle);
z2 = (x1, 7/18 ex);
- penpos2(start_nib_wid, 25);
+ penpos2(start_nib_wid, start_nib_angle);
z3l = (11/10 t_fatness, - t_overshoot);
--- /dev/null
+% feta-test16
+% part of LilyPond's pretty-but-neat music font
+
+% font_identifier:="font-en-tja16";
+% font_size 16pt#;
+
+input autometric;
+fet_beginfont("feta-test", 16);
+staffsize#:=16pt#;
+test:=1;
+
+% smoked cheese
+%test := -1;
+
+input feta-generic;
+
+fet_endfont("font-en-tja");
+
+end.
+
input autometric;
fet_beginfont("font-en-tja", 16);
staffsize#:=16pt#;
+test:=0;
+
input feta-generic;
input autometric;
fet_beginfont("font-en-tja", 20);
+test := 0;
input feta-generic;
+++ /dev/null
-
-def simple_serif(expr p,q, a)=
- p{dir(angle(q-p) -a)} .. q{ - dir(angle(p -q) + a)}
-enddef;
-%
-% Accidentals from various sources, notably
-%
-% Baerenreiter edition of Schuberts `Auf dem Strom' (sharp, natural, flat)
-% F Hofmeister edition of Muellers `Etueden fuer Horn' (double sharp)
-%
-
-
-%tracingall;
-%proofing := 2;
-%\tracingequations:= tracingonline := 1;
-
-fet_begingroup("accidentals");
-
-
-
-fet_endgroup("accidentals");
-
usage()
{
LOGOUT(NORMAL_ver) <<
- "Usage: mi2mu [options] midi-file\n"
+ _("Usage: mi2mu [options] midi-file\n"
"Translate midi-file to mudela\n"
"\n"
"Options:\n"
" -s, --smallest=N assume no shorter (reciprocal) durations than N\n"
" -v, --verbose be verbose\n"
" -w, --warranty show warranty and copyright\n"
- " -x, --no-double-dots assume no double dotted notes\n"
+ " -x, --no-double-dots assume no double dotted notes\n")
;
}
{
LOGOUT(NORMAL_ver) << mi2mu_version_str() << endl;
}
-
-void
+
+void
notice()
{
LOGOUT(NORMAL_ver) <<
- "\n"
+ _("\n"
"Mi2mu, translate midi to mudela.\n"
"Copyright (C) 1997 by\n"
" Jan Nieuwenhuizen <jan@digicash.com>\n"
" You should have received a copy (refer to the file COPYING) of the\n"
"GNU General Public License along with this program; if not, write to\n"
"the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
- "USA.\n";
+ "USA.\n");
}
int
main (int argc_i, char* argv_sz_a[])
{
Mudela_key key (0, 0);
- rat_printer = print_rat;
+ rat_printer = print_rat;
- Long_option_init long_option_init_a[] =
+ Long_option_init long_option_init_a[] =
{
{0, "no-quantify", 'b'},
{0, "debug", 'd'},
String output_str;
while (Long_option_init const* long_option_init_p = getopt_long())
- switch (long_option_init_p->shortname)
+ switch (long_option_init_p->shortname)
{
case 'b':
Duration_convert::no_quantify_b_s = true;
// path->push (getopt_long.optional_argument_ch_C_);
// break;
case 'k':
- {
+ {
String str = getopt_long.optional_argument_ch_C_;
int i = str.index_i (':');
i = (i >=0 ? i : str.length_i ());
case 'q':
level_ver = QUIET_ver;
break;
- case 's':
+ case 's':
{
int i = String_convert::dec2_i (getopt_long.optional_argument_ch_C_);
- if (!i)
+ if (!i)
{
identify();
usage();
exit (2); //usage
}
- Duration_convert::no_smaller_than_i_s =
+ Duration_convert::no_smaller_than_i_s =
Duration_convert::i2_type(i);
}
break;
assert (0);
break;
}
-
+
// flag -q must be checked first
identify();
source.set_path (&path);
char const* arg_sz = 0;
- while ( (arg_sz = getopt_long.get_next_arg ()))
+ while ( (arg_sz = getopt_long.get_next_arg ()))
{
filename_str_g = arg_sz;
Midi_score_parser midi_parser;
mudela_score_l_g = score_p;
score_p->process();
- if (!output_str.length_i ())
+ if (!output_str.length_i ())
{
String d, dir, base, ext;
split_path (arg_sz, d, dir, base, ext);
Midi_parser::get_str (int n)
{
assert (n >= 0);
- if (!n)
- warning ("Zero length string encountered");
-
+ if (!n)
+ warning (_("Zero length string encountered"));
+
Byte const* p = forward_byte_L (n);
return String (p, n);
}
String
Midi_parser::message (String str)
{
- return String ("mi2mu: ")
+ return String ("mi2mu: ")
+ info_l_->source_l_->name_str () + ": "
+ String_convert::i2dec_str (info_l_->source_l_->line_i ((char const*)info_l_->byte_L_), 0, 0) + ": "
+ str + "\n"
void
Midi_parser::warning (String str)
{
- ::message (message (String ("warning: ") + str));
+ ::message (message (String (_("warning: ")) + str));
}
/*
- midi-score-parser.cc -- implement
+ midi-score-parser.cc -- implement
source file of the GNU LilyPond music typesetter
{
info_l_->source_l_ = sources_l->get_file_l (filename_str);
if (!info_l_->source_l_)
- ::error ("can't find: `" + filename_str + "'");
+ ::error (_("can't find: `") + filename_str + "'");
info_l_->byte_L_ = (Byte const*)info_l_->source_l_->ch_C ();
// info_l_->end_byte_L_ = info_l_->byte_L_ + info_l_->source_l_->length_i ();
info_l_->end_byte_L_ = info_l_->byte_L_ + info_l_->source_l_->length_i () + 1;
{
String str = get_str (4);
if ( str != "MThd" )
- exit ("MIDI header expected");
+ exit (_("MIDI header expected"));
int length_i = get_i (4);
// is this signed?
if (length_i < 6)
- exit ("Invalid header length");
+ exit (_("Invalid header length"));
info_l_->format_i_ = get_i (2);
if (info_l_->format_i_ != 0 && info_l_->format_i_ != 1)
- exit ("Invalid midi format");
+ exit (_("Invalid midi format"));
info_l_->tracks_i_ = get_i (2);
if (info_l_->tracks_i_ < 0 || info_l_->tracks_i_ > 32 )
- exit ("Invalid number of tracks");
+ exit (_("Invalid number of tracks"));
info_l_->division_1_i_ = get_i (2) * 4;
if (info_l_->division_1_i_ < 0)
- exit ("Cannot handle non-metrical time");
+ exit (_("Cannot handle non-metrical time"));
// ugh
Duration::division_1_i_s = info_l_->division_1_i_;
forward_byte_L (length_i - 6);
}
return earliest_i;
}
-
+
Mudela_score*
Midi_score_parser::parse_score ()
{
for (int i = 0; i < info_l_->tracks_i_; i++)
tracks.push (new Midi_track_parser (info_l_, i));
- LOGOUT (NORMAL_ver) << "Parsing...\n";
+ LOGOUT (NORMAL_ver) << _("Parsing...\n");
while (tracks.size ())
{
int i = find_earliest_i (tracks);
Moment at_mom = tracks [i]->at_mom ();
Mudela_column* column_l = score_p->get_column_l (at_mom);
Mudela_staff* staff_p = tracks [i]->parse (column_l);
- if ( staff_p )
+ if ( staff_p )
{
score_p->add_staff (staff_p);
delete tracks [i];
// brr, musta have some progress
for (int ii = 0; !info_l_->bar_mom_ && ii < tracks.size (); ii++)
info_l_->bar_mom_ = tracks [ii]->info_l_->bar_mom_;
-
- int bar_i = (int) (at_mom
+
+ int bar_i = (int) (at_mom
/ (info_l_->bar_mom_ ? info_l_->bar_mom_ : bar4_mom)) + 1;
- if (bar_i > current_bar_i)
+ if (bar_i > current_bar_i)
{
- LOGOUT (NORMAL_ver) << '[' << bar_i << ']' << flush;
+ LOGOUT (NORMAL_ver) << '[' << bar_i << ']' << flush;
current_bar_i = bar_i;
}
}
return score_p;
}
-
/*
- midi-track-parser.cc -- implement
+ midi-track-parser.cc -- implement
source file of the GNU LilyPond music typesetter
assert (col_l);
- for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
+ for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
{
- if ((i->pitch_i_ == pitch_i) && (i->channel_i_ == channel_i))
+ if ((i->pitch_i_ == pitch_i) && (i->channel_i_ == channel_i))
{
i->end_column_l_ = col_l;
// LOGOUT(DEBUG_ver) << "Note: " << pitch_i;
else
i++;
}
- warning (String ("junking note-end event: ")
- + " channel = " + String_convert::i2dec_str (channel_i, 0, ' ')
- + ", pitch = " + String_convert::i2dec_str (pitch_i, 0, ' '));
+ warning (String (_("junking note-end event: "))
+ + _(" channel = ") + String_convert::i2dec_str (channel_i, 0, ' ')
+ + _(", pitch = ") + String_convert::i2dec_str (pitch_i, 0, ' '));
}
void
-Midi_track_parser::note_end_all (Mudela_column* col_l)
+Midi_track_parser::note_end_all (Mudela_column* col_l)
{
- // find
+ // find
assert (col_l);
- for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
+ for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
{
i->end_column_l_ = col_l;
i.remove_p ();
if (eot ())
return;
int delta_i = get_var_i ();
- at_mom_ += Moment (delta_i, info_l_->division_1_i_);
+ at_mom_ += Moment (delta_i, info_l_->division_1_i_);
}
Mudela_item*
Midi_track_parser::parse_event (Mudela_column* col_l)
-{
+{
Byte byte = peek_byte ();
// RUNNING_STATUS [\x00-\x5f]
- if (byte <= 0x5f)
+ if (byte <= 0x5f)
{
- if (running_byte_ <= 0x5f)
- exit ("Invalid running status");
+ if (running_byte_ <= 0x5f)
+ exit (_("Invalid running status"));
/*
'running status' rather means 'missing status'.
we'll just pretend we read the running status byte.
int pitch_i = (int)next_byte ();
int dyn_i = (int)next_byte ();
/*
- sss: some broken devices encode NOTE_OFF as
+ sss: some broken devices encode NOTE_OFF as
NOTE_ON with zero volume
*/
if (dyn_i)
next_byte ();
get_i (2);
}
- // YYTEXT [\x01]
+ // YYTEXT [\x01]
// YYCOPYRIGHT [\x02]
// YYTRACK_NAME [\x03]
// YYINSTRUMENT_NAME [\x04]
Mudela_text::Type t = (Mudela_text::Type)byte;
Mudela_text* p = new Mudela_text (t, str);
item_p = p;
- if (t == Mudela_text::COPYRIGHT)
+ if (t == Mudela_text::COPYRIGHT)
mudela_staff_p_->copyright_str_ = p->text_str_;
else if (t == Mudela_text::TRACK_NAME)
mudela_staff_p_->name_str_ = p->text_str_;
{
next_byte ();
next_byte ();
- warning ("Unimplemented MIDI meta-event");
+ warning (_("Unimplemented MIDI meta-event"));
}
}
}
else
- exit ("Invalid MIDI event");
+ exit (_("Invalid MIDI event"));
if (item_p)
item_p->mudela_column_l_ = col_l;
void
Midi_track_parser::parse_header ()
-{
+{
String str = get_str (4);
if ( str != "MTrk" )
- exit ("MIDI track expected");
+ exit (_("MIDI track expected"));
int length_i = get_i (4);
// is this signed?
if (length_i < 0)
- exit ("Invalid track length");
+ exit (_("Invalid track length"));
assert (!track_info_p_);
track_info_p_ = new Midi_parser_info (*info_l_);
track_info_p_->end_byte_L_ = track_info_p_->byte_L_ + length_i;
// forward_byte_L (length_i-1);
info_l_ = track_info_p_;
}
-
else
key_i = ((-accidentals_i_ % 7)[ "cfbeadg" ] - 'a' - 2) % 7;
String str = "\\key ";
- if (!minor_i_)
+ if (!minor_i_)
str += String ((char) ((key_i + 2) % 7 + 'A'));
else // heu, -2: should be - 1 1/2: A -> fis
str += String ((char) ((key_i + 2 - 2) % 7 + 'a'));
str = String ("% \"") + str
- + String ('"') + "; % not supported yet\n";
+ + String ('"') + _("; % not supported yet\n");
return str;
}
// minor scale: la-la (= + 5)
static int notename_i_a[ 12 ] = { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6 };
int notename_i = notename_i_a[ (minor_i_ * 5 + pitch_i) % 12 ];
-
+
static int accidentals_i_a[ 12 ] = { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 };
int accidental_i = accidentals_i_a[ (minor_i_ * 5 + pitch_i) % 12 ];
- if (accidental_i && (accidentals_i_ < 0))
+ if (accidental_i && (accidentals_i_ < 0))
{
accidental_i = - accidental_i;
notename_i = (notename_i + 1) % 7;
sync_dur_.durlog_i_ = 3;
sync_f_ = 1.0;
if (count_32_i != 8)
- warning (String ("#32 in quarter: ") + String (count_32_i));
+ warning (String (_("#32 in quarter: ")) + String (count_32_i));
num_i_ = num_i;
den_i_ = den_i;
- clocks_1_i_ = clocks_4_i * 4;
+ clocks_1_i_ = clocks_4_i * 4;
}
Moment
Mudela_meter::str ()
{
String str = "\\meter "
- + String (num_i_) + "/" + String (1 << den_i_)
+ + String (num_i_) + "/" + String (1 << den_i_)
+ ";\n";
return str;
}
// statics Mudela_note
/*
- this switch can be used to write simple plets like
- c4*2/3
- as
+ this switch can be used to write simple plets like
+ c4*2/3
+ as
\plet 2/3; c4 \plet 1/1;
*/
bool const Mudela_note::simple_plet_b_s = true;
// junk dynamics
(void)dyn_i;
channel_i_ = channel_i;
- pitch_i_ = pitch_i;
+ pitch_i_ = pitch_i;
end_column_l_ = 0;
}
if (dur.durlog_i_ < -10)
return "";
- String name_str
+ String name_str
= mudela_column_l_->mudela_score_l_->mudela_key_l_->notename_str (pitch_i_);
if (simple_plet_b_s)
return str;
}
-int
+int
Mudela_tempo::useconds_per_4_i ()
{
return useconds_per_4_i_;
String
Mudela_text::str ()
{
- if (!text_str_.length_i ()
+ if (!text_str_.length_i ()
|| (text_str_.length_i () != (int)strlen (text_str_.ch_C ())))
return "";
return "% " + text_str_ + "\n";
}
-
{
}
-void
+void
Mudela_score::add_item (Mudela_item* mudela_item_p)
{
mudela_staff_p_list_.bottom()->add_item (mudela_item_p);
int upper_i = max (0, column_l_array_.size () - 1);
int lower_i = 0;
int i = 0; //upper_i;
- while (1)
+ while (1)
{
Moment i_mom = column_l_array_ [i]->at_mom ();
if (i_mom == mom)
upper_i = i;
else
lower_i = i;
- if ((upper_i == lower_i) || (i == column_l_array_.size () - 1))
+ if ((upper_i == lower_i) || (i == column_l_array_.size () - 1))
{
// we don't do inserts
assert (0);
{
if ( column_l_array_ [column_l_array_.size() - 1]->at_mom () > mom )
{
- error ("ugh");
+ error (_("ugh"));
exit (1);
}
if ( column_l_array_[column_l_array_.size() - 1]->at_mom () < mom )
void
Mudela_score::output (String filename_str)
{
- LOGOUT(NORMAL_ver) << "Lily output to " << filename_str << " ..." << endl;
-
+ LOGOUT(NORMAL_ver) << _("Lily output to ") << filename_str << " ..." << endl;
+
// ugh, ugly midi type 1 fix
if ( (mudela_staff_p_list_.size() == 1) && !mudela_staff_p_list_.top()->number_i_)
mudela_staff_p_list_.top()->number_i_ = 1;
int track_i = 0;
Mudela_stream mudela_stream (filename_str);
- for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
+ for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
{
- LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
+ LOGOUT(NORMAL_ver) << _("track ") << track_i++ << ": " << flush;
i->output (mudela_stream);
mudela_stream << "\n";
LOGOUT(NORMAL_ver) << endl;
mudela_stream << "\\score{\n";
if (mudela_staff_p_list_.size() > 1)
mudela_stream << "\\multi 3 < \\type Staff\n";
- for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
+ for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
{
- if ( (mudela_staff_p_list_.size() != 1)
+ if ( (mudela_staff_p_list_.size() != 1)
&& (i == mudela_staff_p_list_.top()))
continue;
mudela_stream << "< \\melodic{ ";
void
Mudela_score::process()
{
- LOGOUT(NORMAL_ver) << "\nProcessing..." << endl;
-
+ LOGOUT(NORMAL_ver) << _("\nProcessing...") << endl;
+
LOGOUT(DEBUG_ver) << "columns\n";
// for (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
// LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "\n";
quantify_columns();
quantify_durations();
- LOGOUT(NORMAL_ver) << "\nCreating voices..." << endl;
+ LOGOUT(NORMAL_ver) << _("\nCreating voices...") << endl;
int track_i = 0;
- for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
+ for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
{
- LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
+ LOGOUT(NORMAL_ver) << _("track ") << track_i++ << ": " << flush;
i->process();
LOGOUT(NORMAL_ver) << endl;
}
void
Mudela_score::filter_tempo()
{
- LOGOUT(NORMAL_ver) << "\nNOT Filtering tempo..." << endl;
+ LOGOUT(NORMAL_ver) << _("\nNOT Filtering tempo...") << endl;
}
void
Mudela_score::quantify_columns()
{
// ugh
- if (Duration_convert::no_quantify_b_s)
+ if (Duration_convert::no_quantify_b_s)
{
- LOGOUT(NORMAL_ver) << "\nNOT Quantifying columns..." << endl;
+ LOGOUT(NORMAL_ver) << _("\nNOT Quantifying columns...") << endl;
return;
}
- LOGOUT(NORMAL_ver) << "\nQuantifying columns..." << endl;
+ LOGOUT(NORMAL_ver) << _("\nQuantifying columns...") << endl;
int current_bar_i = 0;
Moment bar_mom = mudela_meter_l_->bar_mom();
n = Duration_convert::type2_i (n);
Moment s = Moment (1, n);
Moment sh = Moment (1, 2 * n);
- for (int i = 0; i < column_l_array_.size(); i++)
+ for (int i = 0; i < column_l_array_.size(); i++)
{
column_l_array_ [i]->at_mom_ =
s * Moment( (int) ( (column_l_array_ [i]->at_mom()) / s));
int bar_i = (int) (column_l_array_ [i]->at_mom () / bar_mom) + 1;
- if (bar_i > current_bar_i)
+ if (bar_i > current_bar_i)
{
- LOGOUT (NORMAL_ver) << '[' << bar_i << ']' << flush;
+ LOGOUT (NORMAL_ver) << '[' << bar_i << ']' << flush;
current_bar_i = bar_i;
}
}
{
// LOGOUT(NORMAL_ver) << "\nNOT Settling columns..." << endl;
// return;
- LOGOUT(NORMAL_ver) << "\nSettling columns..." << endl;
+ LOGOUT(NORMAL_ver) << _("\nSettling columns...") << endl;
#if 0
assert (!column_l_array_.size());
smallest_dur.durlog_i_ = 6;
Moment const noise_mom = Duration_convert::dur2_mom (smallest_dur)
/ Moment (2);
- for (int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
- if (!start_i)
+ if (!start_i)
{
start_i = end_i = i;
start_mom = column_l_array_ [i]->at_mom();
start_i = end_i = 0;
}
}
-
// Moment mom = items.top()->at_mom();
Moment mom = 0;
- for (PCursor<Mudela_item*> i (items); i.ok();)
+ for (PCursor<Mudela_item*> i (items); i.ok();)
{
LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "; ";
LOGOUT(DEBUG_ver) << "dur: " << i->duration_mom() << "; ";
LOGOUT(DEBUG_ver) << "mom: " << mom << " -> ";
- if (i->at_mom() > mom)
+ if (i->at_mom() > mom)
{
Moment dur = i->at_mom() - mom;
// ugh, need score
voice_p->add_item (new Mudela_skip (start, dur));
mom = i->at_mom();
}
- if (i->at_mom() == mom)
+ if (i->at_mom() == mom)
{
mom = i->at_mom() + i->duration_mom();
voice_p->add_item (i.remove_p());
mudela_stream_r << "$" << id_str() << " = \\melodic";
mudela_stream_r << (mudela_voice_p_list_.size() > 1 ? "<" : "{");
mudela_stream_r << "\n";
- mudela_stream_r << "% midi copyright:" << copyright_str_ << "\n";
- mudela_stream_r << "% instrument:" << instrument_str_ << "\n";
+ mudela_stream_r << _("% midi copyright:") << copyright_str_ << "\n";
+ mudela_stream_r << _("% instrument:") << instrument_str_ << "\n";
if (mudela_voice_p_list_.size() == 1)
mudela_voice_p_list_.top()->output (mudela_stream_r);
else
- for (PCursor<Mudela_voice*> i (mudela_voice_p_list_); i.ok(); i++)
+ for (PCursor<Mudela_voice*> i (mudela_voice_p_list_); i.ok(); i++)
{
mudela_stream_r << "{ ";
i->output (mudela_stream_r);
{
Moment bar_mom = mudela_meter_l_->bar_mom();
Moment into_bar_mom = now_mom - Moment (bar_i - 1) * bar_mom;
- if (bar_i > 1)
+ if (bar_i > 1)
{
if (!into_bar_mom)
mudela_stream_r << "|\n";
#if 0 // not used for now
-void
+void
Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_mom, Moment end_mom)
{
Moment bar_mom = mudela_meter_l_->bar_mom();
Moment now_mom = begin_mom;
- int begin_bar_i = (int) (now_mom / bar_mom) + 1;
+ int begin_bar_i = (int) (now_mom / bar_mom) + 1;
int end_bar_i = (int) (end_mom / bar_mom) + 1;
- if (end_bar_i == begin_bar_i)
+ if (end_bar_i == begin_bar_i)
{
output_mudela_rest_remain (mudela_stream_r, end_mom - begin_mom);
return;
//fill current bar
Moment begin_bar_mom = Moment (begin_bar_i - 1) * bar_mom;
- if (now_mom > begin_bar_mom)
+ if (now_mom > begin_bar_mom)
{
- int next_bar_i = (int) (now_mom / bar_mom) + 2;
+ int next_bar_i = (int) (now_mom / bar_mom) + 2;
Moment next_bar_mom = Moment (next_bar_i - 1) * bar_mom;
assert (next_bar_mom <= end_mom);
Moment remain_mom = next_bar_mom - now_mom;
- if (remain_mom > Moment (0))
+ if (remain_mom > Moment (0))
{
output_mudela_rest_remain (mudela_stream_r, remain_mom);
now_mom += remain_mom;
// fill whole bars
int count_i = end_bar_i - bar_i;
- for (int i = 0; i < count_i; i++)
+ for (int i = 0; i < count_i; i++)
{
int begin_bar_i = check_begin_bar_i (now_mom, bar_i);
if (begin_bar_i)
mudela_stream_r << "r1 ";
// *mudela_stream_r.os_p_ << flush;
if (begin_bar_i)
- LOGOUT(NORMAL_ver) << begin_bar_i << flush;
+ LOGOUT(NORMAL_ver) << begin_bar_i << flush;
bar_i = check_end_bar_i (now_mom, bar_i);
now_mom += bar_mom;
}
// bar_i = check_end_bar_i (now_mom, bar_i);
Moment remain_mom = end_mom - Moment (end_bar_i - 1) * bar_mom;
- if (remain_mom > Moment (0))
+ if (remain_mom > Moment (0))
{
output_mudela_rest_remain (mudela_stream_r, remain_mom);
now_mom += remain_mom;
void
Mudela_staff::output_mudela_rest_remain (Mudela_stream& mudela_stream_r, Moment mom)
{
- if (Duration_convert::no_quantify_b_s)
+ if (Duration_convert::no_quantify_b_s)
{
Duration dur = Duration_convert::mom2_dur (mom);
mudela_stream_r << "r" << dur.str() << " ";
assert (mom == dur.length());
return;
}
-
+
Duration dur = Duration_convert::mom2standardised_dur (mom);
if (dur.type_i_>-10)
mudela_stream_r << "r" << dur.str() << " ";
void
Mudela_staff::process()
{
- /*
+ /*
group items into voices
*/
Link_list<Mudela_item*> items;
for (PCursor<Mudela_item*> i (mudela_item_p_list_); i.ok(); i++)
items.bottom().add (*i);
-
+
while (items.size())
eat_voice (items);
}
-
{
delete os_p_;
if (indent_i_)
- warning ("lily indent level: " + String (indent_i_));
+ warning (_("lily indent level: ") + String (indent_i_));
}
Mudela_stream&
Mudela_stream::operator << (String str)
{
static String word_sep_str = "{} \t\n";
- while (str.length_i())
+ while (str.length_i())
{
int i = str.index_any_i (word_sep_str) + 1;
if (!i)
void
Mudela_stream::header()
{
- *os_p_ << "% Creator: " << mi2mu_version_str() << "\n";
- *os_p_ << "% Automatically generated, at ";
+ *os_p_ << _("% Creator: ") << mi2mu_version_str() << "\n";
+ *os_p_ << _("% Automatically generated, at ");
time_t t (time (0));
*os_p_ << ctime (&t);
- *os_p_ << "% from input file: ";
+ *os_p_ << _("% from input file: ");
// *os_p_ << midi_parser_l_g->filename_str_;
// ugh
*os_p_ << filename_str_g;
- *os_p_ << "\n\n";
+ *os_p_ << "\n\n";
// ugh
*os_p_ << "\\version \"0.1.6\";\n";
}
{
os_p_ = new ofstream (filename_str_.ch_C ());
if (!*os_p_)
- error ("can't open: `" + filename_str_ + "\'");
+ error (_("can't open: `") + filename_str_ + "\'");
}
void
Mudela_stream::output (String str)
{
- for (int i = 0; i < str.length_i(); i++)
+ for (int i = 0; i < str.length_i(); i++)
{
char c = str[ i ];
- switch (c)
+ switch (c)
{
case '{' :
case '<' :
*os_p_ << c;
column_i_++;
break;
- }
+ }
}
}
Mudela_stream::output_wrapped (String str)
{
// enough room left -> doit
- if (column_i_ + str.length_i() <= wrap_column_i_)
+ if (column_i_ + str.length_i() <= wrap_column_i_)
{
output (str);
return;
}
// we're at BOL already; this will never fit -> doit
- if (column_i_ == indent_i_ * INDENT_i)
+ if (column_i_ == indent_i_ * INDENT_i)
{
output (str);
return;
}
-
+
// ok, let's wrap
// preserve comment mode
if (comment_mode_b_)
output (String ("\n%"));
- else
+ else
output (String ("\n"));
-
+
output (str);
}
-
-
% generated automatically by mf-to-table.py version 0.4
-% on Tue Oct 14 23:56:57 1997
+% on Mon Oct 20 01:50:48 1997
% Do not edit
% input from out/font-en-tja16.log
% name
% floogbars
\fetdef\eighthflag{38}
\fetdef\deighthflag{39}
+\fetdef\sixteenthflag{40}
+\fetdef\dsixteenthflag{41}
% generated automatically by mf-to-table.py version 0.4
-% on Tue Oct 14 23:57:04 1997
+% on Mon Oct 20 01:50:55 1997
% Do not edit
% input from out/font-en-tja20.log
% name
% floogbars
\fetdef\eighthflag{38}
\fetdef\deighthflag{39}
+\fetdef\sixteenthflag{40}
+\fetdef\dsixteenthflag{41}