+\bo Werner Lemberg <xlwy01@uxp1.hrz.uni-dortmund.de>, misc
bugfixes, some Beam and Stem code.
+ +\bo Donald Ervin Knuth, mf/ital-*.mf (these were taken
+ from the CM fonts)
+
+\bo Alexandre Oliva <oliva@dcc.unicamp.br>, testing
+\bo Anthony Fok <foka@gpu.srv.ualberta.ca>, debian
-
-
-
-11/Sep/97 LilyPond 0.1.13 1
+11/Sep/97 LilyPond 0.1.14 1
=item *
+Donald Ervin Knuth, mf/ital-*.mf (these were taken from the CM fonts)
+
+=item *
+
Alexandre Oliva <oliva@dcc.unicamp.br>, testing
=item *
This is not a Fanmail/Hype page. These pages were entirely created from
the LilyPond package-sources.
-B<These pages are created from the latest development
-snapshots of LilyPond>. You can look at the bottom if you want to
-know which version this was.
+Note: These pages are created from the latest B<development snapshots>
+of LilyPond. You can look at the bottom if you want to know which
+version this was.
=head2 Examples
\score{
\melodic
{ \octave c'; c4 c4
- < \multi 1; { c2 c2 } { c'2 c'2 } >
- < \multi 2; { \stem -1; c2 c2 } { \stem 1; c'2 c'2 } >
- < \multi 3;
+ \multi 1 < { c2 c2 } { c'2 c'2 } >
+ \multi 2 < { \stemdown c2 c2 } { \stemup c'2 c'2 } >
+ \multi 3 <
{ \clef "bass"; c2 c2 }
{ \meter 2/4;\bar "||";
\key fis cis gis; c'2 c'2 } >
c2 c1
c1 c1
- < \multi 1; < \multi 3;
- { \meter 2/4; \clef "violin"; c2 c2 }
+ \multi 1< \multi 3 <
+ { \meter 2/4; \clef "violin"; c2 c2 }
{ \meter 2/4; \clef "bass"; c2 c2 }
>
- < \multi 3;
+ \multi 3 <
{ \meter 2/4; \clef "violin"; c2 c2 }
{ \meter 2/4; \clef "bass"; c2 c2 }
>
voices collide, they are moved horizontally. Rests are moved
vertically.
-\begin[verbatim]{mudela}
+[FIXME]
+\def\bla{
+\begin[verbatim]{mudelaXX}
two_voice = \melodic
- < \multi 2;
- { \octave c'; \stem -1;
+ \multi 2 <
+ { \octave c'; \stemdown
c4 d e f g2~ g4 a [c8 d e f] c2| }
- { \stem 1;
+ { \stemup
g4 f e g ~ g2 g2 c4 g4 g2 }
>
two_voice_steminvert = \melodic
- < \multi 2;
- { \octave c'; \stem 1;
+ \multi 2 <
+ { \octave c'; \stemup
% the f and g on 4th beat are exceptionally ugh.
c4 d e f g2 g4 a | }
- { \stem -1;
+ { \stemdown
g4 f e g g2 g2 }
>
three_voice = \melodic
- < \multi 2;
- { \stem 1;
+ \multi 2 <
+ { \stemup
g4 f e f g a g2 }
- { \hshift 1; \stem 1;
+ { \property Voice.hshift = 1 \stemup
e2 e2 e2 e2 }
- { \stem -1;
+ { \stemdown
c4 d e d c d es }
>
restsII = \melodic {
\octave c';
- < \multi2;
- { \stem 1; g'8 f' e' d' c' b a g f e d c }
- { \stem -1; r r r r r r r r r r r r }
+ \multi2 <
+ { \stemup g'8 f' e' d' c' b a g f e d c }
+ { \stemdown r r r r r r r r r r r r }
>
r8 r4
- < \multi2; r8 r8 >
- < \multi2; r8 r8 r8 >
- < \multi2; r8 r8 r8 r8 >
- < \multi2; r r >
- < \multi2; r r r >
- \stem 1;
+ \multi 2 < r8 r8 >
+ \multi 2 < r8 r8 r8 >
+ \multi 2 < r8 r8 r8 r8 >
+ \multi 2 < r r >
+ \multi 2 < r r r >
+ \stemup
[c''8 r8 c''8 c''8]
[c8 r8 c8 c8]
}
\$three_voice \restsII }
}
-\end{mudela}
-
+}
\end{document}
-8/Aug/97 LilyPond 0.1.13 1
+8/Aug/97 LilyPond 0.1.14 1
-8/Aug/97 LilyPond 0.1.13 2
+8/Aug/97 LilyPond 0.1.14 2
-8/Aug/97 LilyPond 0.1.13 3
+8/Aug/97 LilyPond 0.1.14 3
-8/Aug/97 LilyPond 0.1.13 4
+8/Aug/97 LilyPond 0.1.14 4
-8/Aug/97 LilyPond 0.1.13 5
+8/Aug/97 LilyPond 0.1.14 5
-8/Aug/97 LilyPond 0.1.13 6
+8/Aug/97 LilyPond 0.1.14 6
-pl 13.jcn2
+pl 14
+ - Simple but nifty mudela-mode.el for Emacs
+ - slightly better syntax for single-note-repeat, now default kept in
+Stem_engraver
+ - bf: Abbrev_beams are not the only beams (see: jcn4, stem-info, thanks, Jan)
+ - a CPU timer for Interpreting and Breaking
+ - Separate Score_elem:
+ * invoke-once stuff in Super_elem (using function pointers; much cleaner now)
+ * geometrical stuff into Graphical_element
+ * Axis_group_* accept Graphical_elements iso. Score_elems
+ * A dimension cache, hopefully this makes lily a bit faster
+ * TeX output moved out of Score_elem, separate interface Outputter
+
+ - < \multi 2; bla > -> \multi 2 < bla > (mudela 0.1.6)
+ - bf: don't do \multi if \type specified
+ - Translator switching: Change_translator, Change_iterator
+
+
+pl 12.jcn4
+ - fixed dynamic f, magstep bug
- gaps on abbrev-beams
- bf: stem-info
- bf: last abbrev
- bf: stem: do_width
- bf: removed rest-column.hh
+*******
+sep 11
+
pl 13
- big Rest/notehead rewrite:
* separated Rest, Note_head and Dots
- Molecule::add_XXXX -> Molecule::add_at_edge ()
- doco updeet: why no midi FAQ, index, CodingStyle hungarian
-pl 12.jcn4
- - fixed dynamic f, magstep bug
pl 12.jcn3
- try at better dynamic font, copied from cmbxti10: mf/*
to obtain and install them.
-3. INSTALLATINON
+3. INSTALLATION
For your convenience, a formatted copy of the INSTALL instructions are
in the toplevel directory, as INSTALL.text
Most of the items are marked in the code as well, with full explanation.
grep for TODO and ugh/ugr
+ - bf: abbrevs over whole note
+
* use properties for:
- Text_style
- default_octave
* \header
- revise lexer mode
- write perl script for handling it into databases
-
- * emacs-mode for mudela
+ - write TeX macros to generate titles
* Makefile stuff:
- have make dist produce tarball in out/ directory.
******************
\score { <
- \melodic { \id "Staff" ""; c'4 g'4 }
+ \melodic \type Staff { c'4 g'4 }
\lyric { \id "Lyric" ""; hello4 bye4 < a chord > }
\lyric { \id "Lyric" ""; bye4 hello4 }
\melodic { \id "Staff" ""; c'4 g'4 }
IDEAS
- * scoping in Lexer: do general id- assignments in mudela.
-
- ID '=' EXPR;
* create libmudela, or liblily_frontend
* lyrics in chords still fuck up.
- *
- rewire acknowledge_element() logic with a process_acknowledged()
* pushgroup/popgroup
* multi threading?
- 1 thread per element/ 1 thread per line
- 1 thread per Translator
+
+ * Use hooks/dependency graphs for properties
+
+ * Make general "spanning"-elements and "placer"-elements
TOPLEVEL_MAJOR_VERSION = 0
TOPLEVEL_MINOR_VERSION = 1
-TOPLEVEL_PATCH_LEVEL = 13
+TOPLEVEL_PATCH_LEVEL = 14
# use to send patches, always empty for released version:
-TOPLEVEL_MY_PATCH_LEVEL = .jcn2
+TOPLEVEL_MY_PATCH_LEVEL =
s/([<{]) *\\id (.+) (.+);/\\type $2 = $3 $1/;
}
+
+sub convert_0_1_5_to_0_1_6
+{
+ s/< *\\multi (.*);/\\multi $1 </;
+}
+
###############################################################
sub last_conversion
"0.1.2" => \&no_conv,
"0.1.3" => \&convert_0_1_2_to_0_1_3,
"0.1.4" => \&no_conv,
- "0.1.5" => \&convert_0_1_4_to_0_1_5
+ "0.1.5" => \&convert_0_1_4_to_0_1_5,
+ "0.1.6" => \&convert_0_1_5_to_0_1_6
);
"toccata-fuga-E",
"scsii-menuetto",
"cadenza", "scales",
- #"rhythm",
+ "rhythm",
"gallina");
$name=$a; print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
open IF, "$depth/input/$a.ly";
- input_record_separator IF "%}";
+ input_record_separator IF "\n}";
$desc = <IF>;
close IF;
+pl 30
+ - Cpu_timer
pl 29
- Dictionary_iter, Dictionary
MAJOR_VERSION = 1
MINOR_VERSION = 1
-PATCH_LEVEL = 28
+PATCH_LEVEL = 30
# use to send patches, always empty for released version:
MY_PATCH_LEVEL = # include separator: "-1" or ".a"
#
--- /dev/null
+/*
+ cpu-timer.cc -- implement Cpu_timer
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "cpu-timer.hh"
+
+Cpu_timer::Cpu_timer ()
+{
+ restart ();
+}
+void
+Cpu_timer::restart ()
+{
+ start_clock_ = clock ();
+}
+
+Real
+Cpu_timer::read ()
+{
+ clock_t stop = clock ();
+ return (stop-start_clock_)/Real(CLOCKS_PER_SEC);
+}
--- /dev/null
+/*
+ cpu-timer.hh -- declare Cpu_timer
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CPU_TIMER_HH
+#define CPU_TIMER_HH
+
+#include <time.h>
+#include "real.hh"
+
+class Cpu_timer {
+ clock_t start_clock_;
+public:
+ Cpu_timer ();
+ void restart ();
+ Real read ();
+};
+
+#endif // CPU_TIMER_HH
{
long l;
if (!optional_argument_ch_C_
- || sscanf (optional_argument_ch_C_, "%ld", &l) != 1)
- report (E_ILLEGALARG);
+ || sscanf (optional_argument_ch_C_, "%ld", &l) != 1)
+ report (E_ILLEGALARG);
return l;
}
found_option_l_=0;
for (int i=0; i< table_len_i_; i++)
{
- char const *ln = option_a_[i].longname;
+ char const *ln = option_a_[i].longname;
- if (ln && !strncmp (ln, optnm, searchlen))
- {
- found_option_l_ = option_a_+i;
- break;
- }
- }
+ if (ln && !strncmp (ln, optnm, searchlen))
+ {
+ found_option_l_ = option_a_+i;
+ break;
+ }
+ }
if (!found_option_l_)
{
- report (E_UNKNOWNOPTION);
- return 0;
+ report (E_UNKNOWNOPTION);
+ return 0;
}
array_index_i_++;
argument_index_i_ = 0;
if (found_option_l_->take_arg)
{
- if (endopt)
- optional_argument_ch_C_ = endopt +1; // a '='
- else
- {
- optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
- array_index_i_++;
- }
- if (!optional_argument_ch_C_)
- report (E_ARGEXPECT);
+ if (endopt)
+ optional_argument_ch_C_ = endopt +1; // a '='
+ else
+ {
+ optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
+ array_index_i_++;
+ }
+ if (!optional_argument_ch_C_)
+ report (E_ARGEXPECT);
}
else
{
- optional_argument_ch_C_ = 0;
- if (endopt)
- report (E_NOARGEXPECT);
+ optional_argument_ch_C_ = 0;
+ if (endopt)
+ report (E_NOARGEXPECT);
}
return found_option_l_;
Long_option_init::printon (ostream &errorout) const
{
if (shortname)
- errorout <<"-" << shortname;
+ errorout <<"-" << shortname;
if (shortname && longname)
- errorout << ", ";
+ errorout << ", ";
if (longname)
- errorout << "`--" << longname << "'";
+ errorout << "`--" << longname << "'";
}
// report an error, GNU style.
{
error_ = c;
if (!error_ostream_l_)
- return;
+ return;
*error_ostream_l_ << arg_value_ch_a_a_[0] << ": ";
switch (c)
{
- case E_ARGEXPECT:
- *error_ostream_l_<< "option ";
- found_option_l_->printon (*error_ostream_l_);
- *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;
- break;
+ case E_ARGEXPECT:
+ *error_ostream_l_<< "option ";
+ found_option_l_->printon (*error_ostream_l_);
+ *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;
+ break;
- case E_UNKNOWNOPTION:
- *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
- *error_ostream_l_ << arg_value_ch_a_a_[array_index_i_] << endl;
+ case E_UNKNOWNOPTION:
+ *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
+ *error_ostream_l_ << arg_value_ch_a_a_[array_index_i_] << endl;
- break;
- case E_ILLEGALARG:
- *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);
+ break;
+ case E_ILLEGALARG:
+ *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);
}
assert (c);
for (int i=0; i < table_len_i_; i++)
- if (option_a_[i].shortname == c)
- {
- found_option_l_ = option_a_+i;
- break;
- }
+ if (option_a_[i].shortname == c)
+ {
+ found_option_l_ = option_a_+i;
+ break;
+ }
if (!found_option_l_)
{
- report (E_UNKNOWNOPTION);
- return 0;
+ report (E_UNKNOWNOPTION);
+ return 0;
}
argument_index_i_++;
if (!found_option_l_->take_arg)
{
- optional_argument_ch_C_ = 0;
- return found_option_l_;
+ optional_argument_ch_C_ = 0;
+ return found_option_l_;
}
optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_] + argument_index_i_;
if (!optional_argument_ch_C_[0])
{
- optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
- array_index_i_ ++;
+ optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
+ array_index_i_ ++;
}
if (!optional_argument_ch_C_)
{
- report (E_ARGEXPECT);
+ report (E_ARGEXPECT);
}
return found_option_l_;
Getopt_long::operator()()
{
if (!ok())
- return 0;
+ return 0;
next();
+ if (!ok ())
+ return 0;
if (argument_index_i_)
- return parseshort();
+ return parseshort();
const char * argument_C = arg_value_ch_a_a_[array_index_i_];
if (argument_C[0] != '-')
- return 0;
+ return 0;
if (argument_C[1] == '-') {// what to do with "command -- bla"
- if (argument_C[2])
- return parselong();
- else
- return 0;
- }
+ if (argument_C[2])
+ return parselong();
+ else
+ return 0;
+ }
else
{
- if (argument_C[ 1 ])
- {
- argument_index_i_ = 1;
- return parseshort();
- }
- else
- {
- return 0;
- }
+ if (argument_C[ 1 ])
+ {
+ argument_index_i_ = 1;
+ return parseshort();
+ }
+ else
+ {
+ return 0;
+ }
}
}
// reached end of option table?
table_len_i_ =0;
for (int i = 0; option_a_[i].longname ||option_a_[i].shortname; i++)
- table_len_i_ ++;
+ table_len_i_ ++;
}
bool
{
error_ = E_NOERROR;
while (array_index_i_ < argument_count_i_
- && !arg_value_ch_a_a_[array_index_i_][argument_index_i_])
- {
- array_index_i_++;
- argument_index_i_ = 0;
+ && !arg_value_ch_a_a_[array_index_i_][argument_index_i_])
+ {
+ array_index_i_++;
+ argument_index_i_ = 0;
}
}
Getopt_long::current_arg()
{
if (array_index_i_ >= argument_count_i_)
- return 0;
+ return 0;
char const * a = arg_value_ch_a_a_[array_index_i_];
return a + argument_index_i_;
}
char const * a = current_arg();
if (a)
{
- array_index_i_ ++;
- argument_index_i_= 0;
+ array_index_i_ ++;
+ argument_index_i_= 0;
}
return a;
}
\consists "Meter_performer";
}
-
Thread =\translator
{
\type "Performer_group_performer";
\consists "Meter_performer";
}
+Staff_group = \translator
+{
+ \type Performer_group_performer;
+ \accepts Staff;
+}
+
Score = \translator {
\type "Score_performer";
instrument = piano;
\accepts Staff;
\accepts Grandstaff;
\accepts Lyrics;
+ \accepts Staff_group;
\consists "Swallow_performer";
}
% symbol.ly
-\version "0.1.5";
+\version "0.1.6";
breve = \duration { -1 0 }
longa = \duration { -2 0 }
table_sixteen=
\symboltables {
-
\texid "\input lilyponddefs \musixsixteendefs"
-
% index TeXstring, xmin xmax ymin ymax
"scripts" = \table {
}
"flags" = \table {
- "8" "\eighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "16" "\sixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "32" "\thirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "64" "\sixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "128" "\hundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "-8" "\deighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "-16" "\dsixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "-32" "\dthirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "-64" "\dsixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
- "-128" "\dhundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "u3" "\eighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "u4" "\sixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "u5" "\thirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "u6" "\sixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "u7" "\hundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "d3" "\deighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "d4" "\dsixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "d5" "\dthirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "d6" "\dsixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
+ "d7" "\dhundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt
}
"beamslopes" = \table {
-%{MudelaHeader
-
- filename: abbrev.ly
- title:
- description:
- composer(s):
- entered-by: jcn
- copyright: PD
-
- Tested Features: simple abbreviations
-EndMudelaHeader
-%}
+\header{
+enteredby jcn
+copyright PD
+TestedFeatures simple abbreviations
+}
-\version "0.1.5";
+\version "0.1.6";
\score{
\melodic{
\octave c'';
\meter 4/4;
+ % default abbreviations
+ c4 c4: c4:32 c4: c4 c2.
'a1
'a1:32
'c4:8 c' 'c4:16 c'
Tested Features: beams and beamflags
EndMudelaHeader
%}
-\version "0.1.5"
+\version "0.1.6"
\score{
- \melodic <\multi 3;
+ \melodic \multi 3 <
{ \octave c';
\meter 8/4;
\duration8;
Tested Features: cadenza mode
%}
-\version "0.1.5";
+\version "0.1.6";
cad = \melodic {
Tested Features:test the Collision resolution
EndMudelaHeader
%}
-\version "0.1.5";
+\version "0.1.6";
two_voice = \melodic
- < \multi 2;
+ \multi 2 <
{ \stemdown \octave c';
c4 d e f g2~ g4 a [c8 d e f] c2| }
{ \stemup
>
two_voice_steminvert = \melodic
- < \multi 2;
+ \multi 2 <
{
\octave c'; \stemup
% the f and g on 4th beat are exceptionally ugh.
>
three_voice = \melodic
- < \multi 2;
+ \multi 2 <
{ \stemup
g4 f e f g a g2 }
{ \stemup \property Voice.hshift = 1
rests = \melodic
- < \multi 2;
+ \multi 2 <
{ \stemup
| r8 r r r r r r r
[c' b a g] [f e d c]
restsII = \melodic {
\octave c';
- < \multi2;
+ \multi 2 <
{ \stemup g' f' e' d' c' b a g f e d c }
{ \stemdown r r r r r r r r r r r r }
>
- < \multi2;
+ \multi 2 <
{ \stemup r r r r r r r r r r r r }
{ \stemdown c d e f g a b c' d' e' f' g' }
>
r8 r4
- < \multi2; r8 r8 >
- < \multi2; r8 r8 r8 >
- < \multi2; r8 r8 r8 r8 >
- < \multi2; r r >
- < \multi2; r r r >
+ \multi 2 < r8 r8 >
+ \multi 2 < r8 r8 r8 >
+ \multi 2 < r8 r8 r8 r8 >
+ \multi 2 < r r >
+ \multi 2 < r r r >
\stemup
[c''8 r8 c''8 c''8]
[c8 r8 c8 c8]
% (maybe even sooner :-)
%
-\version "0.1.5";
+\version "0.1.6";
alto = \melodic{
%}
-\version "0.1.5";
+\version "0.1.6";
vi1=\melodic{
\meter 4/4;
}
\score{
- < \multi 3;
+ \type Staff_group <
\vi1
\vi2
\bc
Tested Features: local key, key, forced accidentals
EndMudelaHeader
%}
-\version "0.1.5";
+\version "0.1.6";
blah = \melodic{
Tested Features: example file with comments
%}
-\version "0.1.5";
+\version "0.1.6";
% the % is a comment.
%}
-\version "0.1.5";
+\version "0.1.6";
\score{
\melodic
{ \octave c'; c4 c4
- < \multi 1; { c2 c2 } { c'2 c'2 } >
- < \multi 2; { \stemdown c2 c2 } { \stemup c'2 c'2 } >
- < \multi 3; { \clef "bass"; c2 c2 } { \meter 2/4;\bar "||"; \key fis cis gis; c'2 c'2 } >
+ \multi 1 < { c2 c2 } { c'2 c'2 } >
+ \multi 2 < { \stemdown c2 c2 } { \stemup c'2 c'2 } >
+ \multi 3 < { \clef "bass"; c2 c2 }
+ { \meter 2/4;\bar "||";
+ \key fis cis gis; c'2 c'2 }
+>
c2 c1
c1 c1
- < \multi 1; < \multi 3;
+ \multi 1 < \multi 3 <
{ \meter 2/4; \clef "violin"; c2 c2 }
{ \meter 2/4; \clef "bass"; c2 c2 }
>
- < \multi 3;
+ \multi 3 <
{ \meter 2/4; \clef "violin"; c2 c2 }
{ \meter 2/4; \clef "bass"; c2 c2 }
>
% \lbheel \lbheel \lfheel \lftoe
% \rbheel \rbtoe \rfheel \rftoe
-\version "0.1.5";
+\version "0.1.6";
\score{
\melodic {
-\version "0.1.5";
+\version "0.1.6";
ritme = \melodic{ %\octave ;
\partial 8;
\score{
- < \multi 3;
+ \type Staff_group <
\ritme
\another
\yanother
%% add Timing_engraver to the staff
Staff = \translator {
\type "Engraver_group_engraver";
+ defaultclef= violin;
\consists "Timing_engraver";
\consists "Bar_engraver";
% scales with accents.
%
-\version "0.1.5";
+\version "0.1.6";
blah = \melodic {
\meter 6/8;
\octave 'c ;
Tested Features: scripts, text.
EndMudelaHeader
%}
-\version "0.1.5";
+\version "0.1.6";
blah = \melodic {
Tested Features:breaking algorithm, chords, multivoice, accents
%}
-\version "0.1.5";
+\version "0.1.6";
%% Stuff from MPP version
% \lefttitle{Menuetto}
%%10
< [ e'8 g8 > d' cis'_"2" e' a~ g8 ] |
%%11
- < \multi 2;
+ \multi 2 <
{\stemup a4~ d'4 cis'4-. }
{ \stemdown f2 e4 } > |
%%12
< [ g'8^"4" d8 > f' e' f' d'^"3"~ c' ] |
%%13
\clef "alto";
- < \multi 2;
+ \multi 2 <
{ \stemup bes2 c'4 }
{ \stemdown g4~ f4 e4 }% ugh
> |
%%20
< { [ c'8 ( bes8 a8 )bes g~ bes8 ] } d8 g8 > |
%%21
- < \multi 2;
- {\stemup d'4 (\stemup ) cis'4 d'4 }
- { \stemdown g2 f4 }
+ \multi 2 <
+ {\stemup d'4( \stemup )cis'4 d'4 }
+ { \stemdown g2 f4 }
> |
%%22
< { [ g8 ~ f8 g8 e8 ] } cis8 > < f4 d4 > |
EndMudelaHeader
%}
-\version "0.1.5";
+\version "0.1.6";
\score{
\melodic{\octave c';
< { c ~ d }
{ e ~ f }
>
- < \multi 2;
+ \multi 2 <
{ \stemup c'8 ~g ~e( ~c~ [c'~ g' e' )c'] c'' ~ c'' c~c }
{ \stemdown c (e g )c'~( [b a g )d] r2 }
>
multiple \paper{}s in one \score
%}
-\version "0.1.5";
+\version "0.1.6";
commands = \melodic{
\skip 2.*4;
''a r4 |
%%5
\duration 8;
- < \multi 2; { \stemup
+ \multi 2 < { \stemup
[ 'f 'a d 'a d 'a ]
[ 'd 'e 'g 'e 'g 'e ]
[ 'cis 'e 'g 'e 'g 'e ]
%%10
[ 'd 'a d 'a d 'a ] |
%%11
- < \multi 2;
+ \multi 2 <
{ \stemup
[ 'f 'a d 'a d 'a ]
[ 'd 'e 'g 'e 'g 'e ]
[ 'c 'g 'bes 'g 'bes 'g ] |
%%16
[ ''f 'c 'f 'c 'f 'c ] |
- < \multi 2;
+ \multi 2 <
{ \stemup
[ ''a 'e 'g 'e 'g 'e ][ 'd 'a d 'a d 'a ]
[ ''bes 'f 'bes 'f 'bes 'f ][ ''f 'c 'f 'c 'f 'c ] }
< [ 'e 'c > 'g c 'g c 'g ] |
%%22
[ 'f 'a c 'a 'f 'c ] |
- < \multi 2; {
+ \multi 2 < {
\stemup
[ ''a 'e 'g 'e 'g 'e ]
[ 'd 'fis 'a 'fis 'a 'fis ]
%%44
< [ 'd ''b > 'fis 'b 'fis 'b 'fis ] |
%%45
- < \multi 2; { \stemup
+ \multi 2 < { \stemup
[ ''g 'd 'b 'd 'b 'd ]
[ 'd 'a d 'a d 'a ]
} {
\tekstII
>
\type Grandstaff <
- \multi 2;
\melodic < \melodie \commands >
\melodic < \begeleiding \commands >
>
\header{
-
filename toccata-fuga-E.ly
title toccata and fuga in E-major
opus BWV 566
%}
-\version "0.1.5";
+\version "0.1.6";
toccata_commands = \melodic{
\meter 4/4;
\$toccata_commands
% 13 -- how to type -- where to split -- this more neatly ?
\octave c';
- <\multi 2;
+ \multi 2 <
{ \stemup r4 dis'4 e'4.-. e'8( | \property Voice.hshift = 1 )e'4 [d'8 fis'8] \property Voice.hshift = 0 gis'4 [gis'8 fis'16 e'16] | fis'4~ [fis'8 e'16 dis'16] e'4 r8 e'8 }
{ \stemup \property Voice.hshift = 1 r4 bis4 cis'4-. cis'4 | \property Voice.hshift = 0 a'4~ [a'16 gis'16 a'16 b'16] \property Voice.hshift = 1 dis'4 cis'4~ [cis'8 dis'16 a16] bis4 cis'4 r8 b8 }
{ \stemdown r4 < gis4 fis4 dis4 > gis4-. gis4 | a4. cis'8 gis2 | fis4 gis4 gis4 r8 e8 }
\octave c;
\clef bass;
% 13
- <\multi 2;
+ \multi 2 <
{ \stemup bis2 cis'4-. cis'4~ [cis'8 a8 d'8 cis'8] [bis8 gis8] cis'4 | dis'2 cis'4 r8 cis'8 }
{ \stemup \property Voice.hshift = 1 r4 gis4. gis8~ gis4 | \stemdown \property Voice.hshift = 0 a4. fis8 gis4. a8~ a4 gis4-. gis4 r8 gis8 }
{ \stemdown r4 < dis4 fis4 > < cis4 e4 > }
\clef violin;
% 15
\octave c';
- <\multi 2;
+ \multi 2 <
{ \stemup [b8 fis8] b4 }
{ \stemdown fis2 }
>
|x
|
%}
- < \multi 2;
+ \multi 2 <
{ \stemup \property Voice.hshift = 0 e'4 }
{ \stemup \property Voice.hshift = 1 cis'4 }
{ \stemup \property Voice.hshift = 2 ais4 }
{ \stemdown fis4 }
> |
% 16
- <\multi 2;
+ \multi 2 <
{ \stemup dis'2 dis'4 | cis'2 cis'4 | b4~ [b8 cis'8 dis'8 e'8] }
{ \stemup \property Voice.hshift = 1 [b8 fis8] b2~ [b8 a16 g16] a2 | a4 gis2 }
{ \stemdown fis2.~ fis2.~ fis4 e2 }
\clef bass;
% 15
b2
- <\multi 2;
+ \multi 2 <
{ \stemup ais4 | bes2. }
{ \stemdown e4 | fis2 fis4 }
>
% these should be two separate scores...
\score{
- < \multi 1;
- \type Grandstaff = "" < \multi 3;
+ \multi 1 <
+ \type Grandstaff \multi 3 <
{\toccata_right \break \fuga2_right }
{ \toccata_left \break \fuga2_left }
>
Tested Features lyrics and chords
%}
-\version "0.1.5";
+\version "0.1.6";
melodie = \melodic {
\clef"violin";
Tested Features: lyrics
%}
-\version "0.1.5";
+\version "0.1.6";
melody = \melodic{
\clef violin;
\octave c';
+
c4 c | g g | a a | g g |
f f | e e | d d8.( e16 | )c2 | % :|
\score{
<
- \melodic <
- \type Grandstaff
- < \multi 2; \global
- \melody >
+ \type Grandstaff <
+ < \global
+ \melody >
< \global
- \accompany >
+ \accompany >
>
% ugh
%{
%}
-\version "0.1.5";
+\version "0.1.6";
global =
\score {
\melodic \type Grandstaff <
- \multi 1;
- < \multi 2;
+ \multi 2 <
\global
\soprane
\tenor
>
- < \multi 2;
+ \multi 2 <
\global
\alt
\bass
Tested Features: stem direction, multivoice, forced accidentals.
%}
-\version "0.1.5";
+\version "0.1.6";
% should add \need{dutch.ini} for
% correct parsing of note names
[F16 G] As4 [G16 F] Es4 r8 es |
[d c g G]
%% 30
- < \multi 2;
- { \stemup c2~ | c1~ | c1 }
- { \stemdown C2~ | C1~ | C1 }
+ \multi 2 <
+ { \stemup c2~ | c1~ | c1 }
+ { \stemdown C2~ | C1~ | C1 }
>
}
\score {
\melodic \type Grandstaff <
- \type Staff=treble < \multi 2;
+ \type Staff=treble <
\global
\dux
\comes
>
- \type Staff=bass < \multi 2;
+ \type Staff=bass <
\global
\bassdux
>
copyright Public Domain
}
-\version "0.1.5";
+\version "0.1.6";
global =
\melodic {
\clef "violin";
\octave c';
- <\multi 2;
+ \multi 2 <
% Real soprane
{\stemup
r8 [g16 c'] [e' g c' e'] r8 [g16 c'] [e' g c' e'] |
b b |
a a |
%% 10
- <\multi 2;
+ \multi 2 <
% Alt
{\stemup
r16 a8. ~ a4 r16 a8. ~ a4 |
\score {
\melodic \type Grandstaff <
- \multi 1;
- < \multi 2;
+ <
\global
\soprane
>
- < \multi 2;
+ <
\global
\bass
>
# kept in dist bo stripping stable stuff, still to copy...
# a bit of a hack to keep exec size under control.
-stablecc=atom.cc bar.cc boxes.cc \
+stablecc=atom.cc offset.cc meter.cc boxes.cc \
keyword.cc leastsquares.cc \
lookup.cc meter.cc\
parser.cc notename-table.cc lexer.cc\
MAJOR_VERSION = 0
MINOR_VERSION = 1
-PATCH_LEVEL = 13
+PATCH_LEVEL = 14
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
--- /dev/null
+/*
+ axis-group.cc -- implement Axis_group_administration
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "interval.hh"
+#include "axis-group-administration.hh"
+#include "graphical-element.hh"
+#include "debug.hh"
+
+/** don't copy anything: an element can only be in one
+ Axis_group_element at one time. */
+Axis_group_administration::Axis_group_administration (Axis_group_administration const&)
+{
+}
+
+bool
+Axis_group_administration::contains_b (Graphical_element const *e) const
+{
+ return elem_l_arr_.find_l (e);
+}
+
+Interval
+Axis_group_administration::extent (Axis axis) const
+{
+ Interval r;
+ for (int i=0; i < elem_l_arr_.size(); i++)
+ r.unite (elem_l_arr_[i]->extent (axis));
+ return r;
+}
+
+void
+Axis_group_administration::add_element (Graphical_element*e,
+ Axis_group_element*g, Axis a1, Axis a2)
+{
+ Axis_group_element *& g1 = e->axis_group_l_a_[a1];
+ Axis_group_element *& g2 = e->axis_group_l_a_[a2];
+
+ assert (!g1 || g1 == g);
+ assert (!g2 || g2 == g);
+ g1 = g;
+ g2 = g;
+ elem_l_arr_.push (e);
+}
+
+
+
+void
+Axis_group_administration::remove_element (Graphical_element*e, Axis a1, Axis a2)
+{
+ assert (contains_b (e));
+ elem_l_arr_.unordered_substitute (e,0);
+
+ e->axis_group_l_a_[a1] = 0;
+ e->axis_group_l_a_[a2] = 0;
+}
+
+void
+Axis_group_administration::remove_all (Axis a1, Axis a2)
+{
+ for (int i=0; i < elem_l_arr_.size(); i++)
+ {
+ Graphical_element*e=elem_l_arr_[i];
+ e->axis_group_l_a_[a1] = 0;
+ e->axis_group_l_a_[a2] = 0;
+ }
+ elem_l_arr_.clear ();
+}
+
+
+void
+Axis_group_administration::print() const
+{
+#ifndef NPRINT
+ for (int i=0; i < elem_l_arr_.size(); i++)
+ DOUT << elem_l_arr_[i]->name () << ' ';
+#endif
+}
--- /dev/null
+/*
+ axis-group-element.cc -- implement Axis_group_element
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "axis-group-element.hh"
+
+void
+Axis_group_element::do_unlink()
+{
+ remove_all();
+}
+
+void
+Axis_group_element::do_junk_links()
+{
+ axis_admin_.elem_l_arr_.set_size (0);
+}
+
+
+bool
+Axis_group_element::contains_b (Graphical_element const*e) const
+{
+ return axis_admin_.contains_b (e);
+}
+
+Link_array<Score_elem>
+Axis_group_element::get_extra_dependencies() const
+{
+ return elem_l_arr ();
+}
+
+Link_array<Score_elem>
+Axis_group_element::elem_l_arr () const
+{
+ /*
+ ugh. I know
+ */
+ Link_array<Score_elem> r;
+ for (int i=0; i < axis_admin_.elem_l_arr_.size (); i++)
+ r.push ((Score_elem*)axis_admin_.elem_l_arr_[i]);
+ return r;
+}
+
+void
+Axis_group_element::do_print() const
+{
+ axis_admin_.print();
+}
+
+
+Axis_group_element::Axis_group_element()
+{
+ transparent_b_ = true;
+}
+
void
Axis_group_item::OK() const
{
- Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
+ Link_array<Score_elem> elems = elem_l_arr ();
for (int i=0; i < elems.size(); i++)
{
Item * it_l = elems[i]->item();
copy_breakable_items();
- Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
+ Link_array<Score_elem> elems = elem_l_arr ();
for (int i=0; i < elems.size(); i++)
{
Item* it_l = elems[i]->item();
Axis_group_item::do_print() const
{
Axis_group_element::do_print();
+ Item::do_print ();
}
void
Axis_group_spanner::do_break_processing_if_unbroken()
{
- Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
+ Link_array<Score_elem> elems = elem_l_arr ();
Line_of_score *my_line = line_l();
for (int i=0; i < elems.size(); i++)
{
}
break_into_pieces ();
- Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_;
+ Link_array<Score_elem> loose_elems = elem_l_arr ();
remove_all();
for (int i=0; i < loose_elems.size(); i++)
+++ /dev/null
-/*
- axis-group.cc -- implement Axis_group_administration
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-#include "interval.hh"
-#include "axis-group-administration.hh"
-#include "score-elem.hh"
-#include "debug.hh"
-
-/** don't copy anything: an element can only be in one
- Axis_group_element at one time. */
-Axis_group_administration::Axis_group_administration (Axis_group_administration const&)
-{
-}
-
-bool
-Axis_group_administration::contains_b (Score_elem const *e) const
-{
- return elem_l_arr_.find_l (e);
-}
-
-Interval
-Axis_group_administration::extent (Axis axis) const
-{
- Interval r;
- for (int i=0; i < elem_l_arr_.size(); i++)
- r.unite (elem_l_arr_[i]->extent (axis));
- return r;
-}
-
-void
-Axis_group_administration::add_element (Score_elem*e,
- Axis_group_element*g, Axis a1, Axis a2)
-{
- Axis_group_element *& g1=e->axis_group_l_a_[a1];
- Axis_group_element *& g2 = e->axis_group_l_a_[a2];
-
- assert (!g1 || g1 == g);
- assert (!g2 || g2 == g);
- g1 = g;
- g2 = g;
- elem_l_arr_.push (e);
-}
-
-
-
-void
-Axis_group_administration::remove_element (Score_elem*e, Axis a1, Axis a2)
-{
- assert (contains_b (e));
- elem_l_arr_.unordered_substitute (e,0);
-
- e->axis_group_l_a_[a1] = 0;
- e->axis_group_l_a_[a2] = 0;
-}
-
-void
-Axis_group_administration::remove_all (Axis a1, Axis a2)
-{
- for (int i=0; i < elem_l_arr_.size(); i++)
- {
- Score_elem*e=elem_l_arr_[i];
- e->axis_group_l_a_[a1] = 0;
- e->axis_group_l_a_[a2] = 0;
- }
- elem_l_arr_.clear();
-}
-
-
-void
-Axis_group_administration::print() const
-{
-#ifndef NPRINT
- for (int i=0; i < elem_l_arr_.size(); i++)
- DOUT << elem_l_arr_[i]->name() << ' ';
-#endif
-}
{
Paper_def *p = paper();
Symbol s = p->lookup_l()->bar (type_str_,
- p->get_var ("bar_size"));
+ p->get_var ("bar_size"));
Molecule*output = new Molecule (Atom (s));
return output;
}
*/
current_grouping_p_->add_child (get_staff_info().time_C_->whole_in_measure_,
rhythmic_req->duration ());
- /*
- TODO
- should change repr. of flags too.
- */
- s->flag_i_ = Duration_convert::type2_i (rhythmic_req->duration_.durlog_i_);
+ s->flag_i_ = rhythmic_req->duration_.durlog_i_;
beam_p_->add (s);
}
{
Stem *s = stems[j];
- int f = intlog2(abs (s->flag_i_))-2;
+ int f = s->flag_i_ - 2;
assert (f>0);
flags.push (f);
}
+/*
+ boxes.cc -- implement Box
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "boxes.hh"
#include "varray.hh"
#include "scoreline.hh"
#include "p-score.hh"
#include "p-col.hh"
+#include "cpu-timer.hh"
String
Col_stats::str() const {
Array<Col_hpositions>
Break_algorithm::solve() const
{
- return do_solve();
+ Cpu_timer timer;
+
+ Array<Col_hpositions> h= do_solve();
+
+ if (approx_stats_.count_i_)
+ *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";
+
+ return h;
}
void
}
-void
-Break_algorithm::print_stats() const
-{
- if (approx_stats_.count_i_)
- *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
- if (exact_stats_.count_i_)
- *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
-}
--- /dev/null
+/*
+ change-iterator.cc -- implement
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "change-iterator.hh"
+#include "translator-group.hh"
+#include "change-translator.hh"
+
+Change_iterator::Change_iterator (Change_translator *change_l)
+{
+ change_l_ = change_l;
+}
+
+/*
+ move to construct_children ?
+ */
+void
+Change_iterator::process_and_next (Moment m)
+{
+ Translator_group * current = report_to_l ();
+ Translator_group * last = 0;
+ while (current && current->type_str_ != change_l_->change_to_type_str_)
+ {
+ last = current;
+ current = current->daddy_trans_l_;
+ }
+ if (current)
+ {
+ Translator_group * dest =
+ report_to_l ()->find_create_translator_l (change_l_->change_to_type_str_,
+ change_l_->change_to_id_str_);
+ current->remove_translator_p (last);
+ dest->add (last);
+ }
+
+ Music_iterator::process_and_next (m);
+}
+
+IMPLEMENT_IS_TYPE_B1 (Change_iterator, Music_iterator);
--- /dev/null
+/*
+ change-translator.cc -- implement Change_translator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "change-translator.hh"
+#include "debug.hh"
+
+IMPLEMENT_IS_TYPE_B1(Change_translator,Music);
+
+void
+Change_translator::do_print () const
+{
+ DOUT << "change " << change_to_type_str_ << " to " << change_to_id_str_ ;
+}
+
Chord_iterator::construct_children()
{
int j = 0;
- for (PCursor<Music*> i (chord_C_->music_p_list_.top()); //, int j = 0;
+ for (PCursor<Music*> i (chord_C_->music_p_list_.top());
i.ok(); j++, i++)
{
- Music_iterator * mi = get_iterator_p (i.ptr());
+ Music_iterator * mi = get_iterator_p (i.ptr());
if (mi->ok())
{
- set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_));
+ if (!chord_C_->translator_type_str_)
+ set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_));
children_p_list_.bottom().add (mi);
}
else
void
Clef_engraver::acknowledge_element (Score_elem_info info)
{
- if (info.elem_l_->name() == Bar::static_name ())
+ if (info.elem_l_->name() == Bar::static_name () && clef_type_str_)
{
create_clef();
if (!clef_req_l_)
void
Clef_engraver::do_creation_processing()
{
- Scalar def = get_property ("defaultclef");
+ Scalar def = get_property ("defaultclef");
if (def)
set_type (def);
- else
- set_type ("violin");
- create_clef();
+ if (clef_type_str_)
+ create_clef();
clef_p_->default_b_ = false;
}
if (!creq_l || !creq_l->clefchange())
return false;
- clef_req_l_ = creq_l->clefchange();
-
+ clef_req_l_ = creq_l->clefchange();
read_req (clef_req_l_);
return true;
}
void
Clef_engraver::do_pre_move_processing()
{
- if (!clef_p_)
- return;
- typeset_element (clef_p_);
- clef_p_ = 0;
+ if (clef_p_)
+ {
+ typeset_element (clef_p_);
+ clef_p_ = 0;
+ }
}
-
void
Clef_engraver::do_post_move_processing()
{
if (default_b_)
{
- empty_b_ = (break_status_i() != 1);
+ set_empty(break_status_i() != 1);
transparent_b_ = (break_status_i() != 1);
}
}
#include "item.hh"
#include "debug.hh"
-void
-Axis_group_element::do_unlink()
-{
- remove_all();
-}
-
-void
-Axis_group_element::do_junk_links()
-{
- axis_admin_.elem_l_arr_.set_size (0);
-}
-
-
-bool
-Axis_group_element::contains_b (Score_elem const*e) const
-{
- return axis_admin_.contains_b (e);
-}
-
-Link_array<Score_elem>
-Axis_group_element::get_extra_dependencies() const
-{
- return axis_admin_.elem_l_arr_;
-}
-
-void
-Axis_group_element::do_print() const
-{
- axis_admin_.print();
-}
-
-
-Axis_group_element::Axis_group_element()
-{
- transparent_b_ = true;
-}
-
-// ****************
-
void
-Vertical_group_element::add_element (Score_elem*e)
+Vertical_group_element::add_element (Graphical_element*e)
{
axis_admin_.add_element (e, this, Y_AXIS, Y_AXIS);
}
void
-Vertical_group_element::remove_element (Score_elem*e)
+Vertical_group_element::remove_element (Graphical_element*e)
{
axis_admin_.remove_element (e, Y_AXIS, Y_AXIS);
}
}
void
-Horizontal_group_element::add_element (Score_elem*e)
+Horizontal_group_element::add_element (Graphical_element*e)
{
axis_admin_.add_element (e,this, X_AXIS,X_AXIS);
}
void
-Horizontal_group_element::remove_element (Score_elem*e)
+Horizontal_group_element::remove_element (Graphical_element*e)
{
axis_admin_.remove_element (e,X_AXIS,X_AXIS);
}
axis_admin_.remove_all (X_AXIS,Y_AXIS);
}
void
-Horizontal_vertical_group_element::add_element (Score_elem *e)
+Horizontal_vertical_group_element::add_element (Graphical_element *e)
{
axis_admin_.add_element (e, this, X_AXIS, Y_AXIS);
}
void
-Horizontal_vertical_group_element::remove_element (Score_elem*e)
+Horizontal_vertical_group_element::remove_element (Graphical_element*e)
{
axis_admin_.remove_element (e, X_AXIS, Y_AXIS);
}
#include "p-score.hh"
#include "paper-def.hh"
-
const HAPPY_DOTS_I = 3;
/**
Array<Col_hpositions>
Gourlay_breaking::do_solve() const
{
-
Array<Break_node> optimal_paths;
Line_of_cols all = all_cols();
Array<int> breaks = find_break_indices();
i = optimal_paths[i].prev_break_i_;
}
- print_stats();
- /*
- TODO print variation in energy
- */
- if (max_energy_f)
- {
- ;
- }
-
-
for (int i= final_breaks.size(); i--;)
lines.push (optimal_paths[final_breaks[i]].line_config_);
-
return lines;
}
--- /dev/null
+/*
+ graphical-element.cc -- implement Graphical_element
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "graphical-element.hh"
+#include "axis-group-element.hh"
+#include "debug.hh"
+
+Graphical_element::Graphical_element ()
+{
+ init ();
+}
+
+Graphical_element::Graphical_element (Graphical_element const &s)
+{
+ init ();
+ empty_b_ = s.empty_b_;
+ axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+ offset_ = Offset (0,0);
+}
+
+Graphical_element::~Graphical_element ()
+{
+
+}
+
+void
+Graphical_element::init ()
+{
+ empty_b_ = false;
+ axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
+ offset_ = Offset (0,0);
+ cached_valid_b_a_ [X_AXIS] = cached_valid_b_a_[Y_AXIS] = false;
+}
+
+void
+Graphical_element::invalidate_cache (Axis a)
+{
+ Graphical_element * g = this;
+ while (g && g->cached_valid_b_a_[a])
+ {
+ g->cached_valid_b_a_ [a] = false;
+ g = g->axis_group_l_a_[a];
+ }
+}
+
+Real
+Graphical_element::absolute_coordinate (Axis a) const
+{
+ Real r = offset_[a];
+ for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+ axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
+
+ r += axis_group_l->offset_[a];
+ return r;
+}
+
+
+Offset
+Graphical_element::absolute_offset() const
+{
+ return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
+}
+
+void
+Graphical_element::translate (Real y, Axis a)
+{
+ if (axis_group_l_a_[a])
+ axis_group_l_a_[a]->invalidate_cache (a);
+ offset_[a] += y;
+}
+
+Real
+Graphical_element::relative_coordinate (Axis_group_element*e, Axis a) const
+{
+ Real r =0.0;
+ for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+ axis_group_l != e;
+ axis_group_l = axis_group_l->axis_group_l_a_[a])
+ r += axis_group_l->offset_[a];
+
+ return r;
+}
+
+Axis_group_element*
+Graphical_element::common_group (Graphical_element const* s, Axis a) const
+{
+ Link_array<Axis_group_element> my_groups;
+ for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+ axis_group_l;
+ axis_group_l = axis_group_l->axis_group_l_a_[a])
+ my_groups.push (axis_group_l);
+
+ Axis_group_element* common_l=0;
+ for (Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
+ !common_l && axis_group_l;
+ axis_group_l = axis_group_l->axis_group_l_a_[a])
+ common_l = my_groups.find_l (axis_group_l);
+
+ return common_l;
+}
+
+
+
+void
+Graphical_element::translate (Offset offset)
+{
+ translate (offset[Y_AXIS], Y_AXIS);
+ translate (offset[X_AXIS], X_AXIS);
+}
+
+Interval
+Graphical_element::width() const
+{
+ return extent (X_AXIS);
+}
+
+void
+Graphical_element::set_empty (bool b)
+{
+ if (empty_b_ != b)
+ {
+ empty_b_ = b;
+ if (!empty_b_)
+ {
+ invalidate_cache (X_AXIS);
+ invalidate_cache (Y_AXIS);
+ }
+ }
+
+}
+
+Interval
+Graphical_element::extent (Axis a) const
+{
+ if (empty_b_)
+ return Interval ();
+
+ if (!cached_valid_b_a_[a])
+ {
+ Graphical_element *self = (Graphical_element*)this;
+ self->cached_dimension_a_[a] = (a == X_AXIS)? do_width(): do_height ();
+ self->cached_valid_b_a_[a] = true;
+ }
+
+ Interval r(cached_dimension_a_[a]);
+ if (!r.empty_b()) // float exception on DEC Alpha
+ r+=offset_[a];
+
+ return r;
+}
+
+Interval
+Graphical_element::height() const
+{
+ return extent (Y_AXIS);
+}
+
+void
+Graphical_element::unlink ()
+{
+ for (int j=0; j < 2; j++)
+ if (axis_group_l_a_[j])
+ axis_group_l_a_[j]->remove_element (this);
+}
+
+void
+Graphical_element::junk_links ()
+{
+ axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
+}
+
+void
+Graphical_element::print () const
+{
+#ifndef NPRINT
+ if (offset_.x() || offset_.y ())
+ DOUT << "offset: " << offset_.str() ;
+ DOUT << "\n";
+#endif
+}
+
+IMPLEMENT_IS_TYPE_B(Graphical_element);
+
*/
#include "horizontal-align-item.hh"
-
+#include "debug.hh"
IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item);
void
Horizontal_align_item::do_print() const
{
+#ifndef NPRINT
+ Item::do_print ();
+ DOUT << "contains: ";
+ for (int i=0 ; i < item_l_arr_.size(); i++)
+ DOUT << item_l_arr_[i]->name () << ", ";
+#endif
}
Horizontal_align_item::Horizontal_align_item()
{
center_l_ = 0;
align_i_ = 0;
- empty_b_ = true;
+ set_empty (true);
transparent_b_ = true;
}
Do the dirty work for Axis_group_element.
*/
struct Axis_group_administration {
- Link_array<Score_elem> elem_l_arr_;
+ Link_array<Graphical_element> elem_l_arr_;
Interval extent (Axis) const;
void print() const ;
Axis_group_administration(){}
void remove_all (Axis a1, Axis a2);
- bool contains_b (Score_elem const *) const;
- void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2);
- void remove_element (Score_elem*, Axis a1, Axis a2);
+ bool contains_b (Graphical_element const *) const;
+ void add_element (Graphical_element*, Axis_group_element*, Axis a1, Axis a2);
+ void remove_element (Graphical_element*, Axis a1, Axis a2);
};
#endif // AXIS_GROUP_ADMINISTRATION_HH
virtual void do_junk_links();
public:
+ virtual Link_array<Score_elem> elem_l_arr() const;
Axis_group_element();
virtual void remove_all()=0;
- virtual void add_element (Score_elem*)=0;
- virtual void remove_element (Score_elem*)=0;
- virtual bool contains_b (Score_elem const *) const;
+ virtual void add_element (Graphical_element*)=0;
+ virtual void remove_element (Graphical_element*)=0;
+ virtual bool contains_b (Graphical_element const *) const;
DECLARE_MY_RUNTIME_TYPEINFO;
};
+++ /dev/null
-/*
-axis-group-element.hh -- declare Axis_group_administration, Axis_group_element
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#error
-#ifndef Axis_group_administration_HH
-#define Axis_group_administration_HH#endif // Axis_group_administration_HH
*/
struct Col_stats
{
- int count_i_;
- int cols_i_;
+ int count_i_;
+ int cols_i_;
- Col_stats();
- void add (Line_of_cols const&l);
- String str() const;
+ Col_stats();
+ void add (Line_of_cols const&l);
+ String str() const;
};
/** Class representation of an algorithm which decides where to put
class Break_algorithm {
protected:
- Paper_score *pscore_l_;
- Real linelength;
+ Paper_score *pscore_l_;
+ Real linelength;
- /// search all pcols which are breakable.
- Line_of_cols find_breaks() const;
+ /// search all pcols which are breakable.
+ Line_of_cols find_breaks() const;
- Line_of_cols all_cols() const;
- Array<int> find_break_indices() const;
+ Line_of_cols all_cols() const;
+ Array<int> find_break_indices() const;
- /// helper: solve for the columns in #curline#.
- void solve_line (Col_hpositions*) const;
+ /// helper: solve for the columns in #curline#.
+ void solve_line (Col_hpositions*) const;
- /// helper: approximate the energyv
- void approximate_solve_line (Col_hpositions*) const;
+ /// helper: approximate the energyv
+ void approximate_solve_line (Col_hpositions*) const;
- /// does curline fit on the paper?
- bool feasible (Line_of_cols) const;
+ /// does curline fit on the paper?
+ bool feasible (Line_of_cols) const;
- Line_spacer* generate_spacing_problem (Line_of_cols) const;
+ Line_spacer* generate_spacing_problem (Line_of_cols) const;
- virtual Array<Col_hpositions> do_solve() const=0;
- void print_stats() const;
-
- virtual void do_set_pscore();
+ virtual Array<Col_hpositions> do_solve() const=0;
+ virtual void do_set_pscore();
public:
- Col_stats approx_stats_;
- Col_stats exact_stats_;
-
- Line_spacer* (*get_line_spacer)();
+ Col_stats approx_stats_;
+ Col_stats exact_stats_;
+
+ Line_spacer* (*get_line_spacer)();
- Break_algorithm();
- void set_pscore (Paper_score*);
+ Break_algorithm();
+ void set_pscore (Paper_score*);
- /// check if the spacing/breaking problem is well-stated
- void problem_OK() const;
- void OK() const;
- Array<Col_hpositions> solve() const;
+ /// check if the spacing/breaking problem is well-stated
+ void problem_OK() const;
+ void OK() const;
+ Array<Col_hpositions> solve() const;
};
#endif // BREAK_HH
--- /dev/null
+/*
+ change-iterator.hh -- declare
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CHANGE_ITERATOR_HH
+#define CHANGE_ITERATOR_HH
+
+#include "music-iterator.hh"
+
+
+class Change_iterator : public Music_iterator
+{
+ Change_translator *change_l_;
+
+public:
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Change_iterator (Change_translator* prop_l);
+protected:
+ virtual void process_and_next (Moment);
+};
+
+#endif
--- /dev/null
+/*
+ change-translator.hh -- declare Change_translator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CHANGE_TRANSLATOR_HH
+#define CHANGE_TRANSLATOR_HH
+
+#include "music.hh"
+
+class Change_translator : public Music
+{
+public:
+ String change_to_type_str_;
+ String change_to_id_str_;
+ DECLARE_MY_RUNTIME_TYPEINFO;
+protected:
+ VIRTUAL_COPY_CONS(Change_translator, Music);
+ void do_print () const;
+};
+
+
+#endif // CHANGE_TRANSLATOR_HH
virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); }
SCORE_ELEM_CLONE(Horizontal_vertical_group_item);
public:
- virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); }
- virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); }
+ virtual void add_element (Graphical_element*e) { Horizontal_vertical_group_element::add_element (e); }
+ virtual void remove_element (Graphical_element*e) { Horizontal_vertical_group_element::remove_element (e); }
DECLARE_MY_RUNTIME_TYPEINFO;
};
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual void add_element (Score_elem*);
- virtual void remove_element (Score_elem*);
+ virtual void add_element (Graphical_element*);
+ virtual void remove_element (Graphical_element*);
};
/**
virtual void remove_all();
public:
- virtual void add_element (Score_elem*);
- virtual void remove_element (Score_elem*);
+ virtual void add_element (Graphical_element*);
+ virtual void remove_element (Graphical_element*);
DECLARE_MY_RUNTIME_TYPEINFO;
};
protected:
virtual void remove_all();
public:
- virtual void add_element (Score_elem*);
- virtual void remove_element (Score_elem*);
+ virtual void add_element (Graphical_element*);
+ virtual void remove_element (Graphical_element*);
DECLARE_MY_RUNTIME_TYPEINFO;
};
--- /dev/null
+/*
+ graphical-element.hh -- declare Graphical_element
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef GRAPHICAL_ELEMENT_HH
+#define GRAPHICAL_ELEMENT_HH
+
+#include "offset.hh"
+#include "lily-proto.hh"
+#include "interval.hh"
+#include "virtual-methods.hh"
+
+/** The 2d geometric aspects of a score-element. It was put in a
+ separate class, because Score_elem got quite big.
+
+ */
+class Graphical_element
+{
+ void init ();
+ /** Is this element dimensionless?.
+ This is private to guarantee correctness of the cache
+ */
+ bool empty_b_;
+
+public:
+ void set_empty (bool);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ /**
+ This is needed, because #output# may still be
+ NULL.
+ */
+ Offset offset_;
+
+ Axis_group_element * axis_group_l_a_[NO_AXES];
+ Interval cached_dimension_a_[NO_AXES];
+ bool cached_valid_b_a_[NO_AXES];
+
+ Graphical_element ();
+ Graphical_element (Graphical_element const&);
+ virtual ~Graphical_element ();
+
+ void invalidate_cache (Axis);
+ Interval extent (Axis) const;
+ Interval width() const;
+ Interval height() const;
+
+ /**
+ translate the symbol. The symbol does not have to be created yet.
+ */
+ void translate (Offset);
+ /**
+ translate in one direction
+ */
+
+ void translate (Real, Axis);
+
+ Real relative_coordinate (Axis_group_element*group, Axis) const;
+ Offset absolute_offset() const;
+ Real absolute_coordinate (Axis) const;
+ /**
+ Find the group-element which has both #this# and #s#
+ */
+ Axis_group_element*common_group (Graphical_element const* s, Axis a) const;
+ void unlink ();
+ void junk_links ();
+ void print () const;
+protected:
+ virtual Interval do_height () const=0;
+ virtual Interval do_width () const=0;
+};
+
+#endif // GRAPHICAL_ELEMENT_HH
+
}
virtual void do_print() const;
public:
- virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); }
- virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); }
+ virtual void add_element (Graphical_element*e) { Horizontal_group_element::add_element (e); }
+ virtual void remove_element (Graphical_element*e) { Horizontal_group_element::remove_element (e); }
DECLARE_MY_RUNTIME_TYPEINFO;
SCORE_ELEM_CLONE(Horizontal_group_item);
};
+++ /dev/null
-/*
- input-translator.hh -- declare Input_translator
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef INPUT_TRANSLATOR_HH
-#define INPUT_TRANSLATOR_HH
-
-#include "plist.hh"
-#include "string.hh"
-#include "lily-proto.hh"
-#include "input.hh"
-#include "string.hh"
-#error
-#include "varray.hh"
-
-struct Input_translator_list : public Pointer_list<Input_translator*>
-{
- Input_translator_list (Input_translator_list const &);
- Input_translator_list(){}
- ~Input_translator_list(){}
-};
-
-/** Define a intereter for music. This is an runtime interface to the
- typesystem */
-class Input_translator : public Input {
-public:
- Input_translator_list contains_itrans_p_list_;
- Array<String> consists_str_arr_;
- Array<String> alias_str_arr_;
- String base_str_;
- String type_str_;
- String default_id_str_;
-
- void add (Input_translator *);
- bool is_name_b (String);
- bool accept_req_b();
- bool accepts_b (String);
- void print() const;
- Translator_group * get_group_translator_p();
- Input_translator * get_default_itrans_l();
- Input_translator * recursive_find (String nm);
- Input_translator * find_itrans_l (String nm);
-};
-
-#endif // Input_translator_HH
struct Bracket_req;
struct Cadenza_req;
struct Change_iterator;
-struct Change_reg;
+struct Change_translator;
struct Chord;
struct Clef_change_req;
struct Clef_item;
struct Element_group;
struct Element_group_item;
struct General_script_def;
+struct Graphical_element;
struct Music_output;
struct Music_output_def;
struct Global_translator;
struct Note_head_engraver;
struct Notename_table;
struct Offset;
-struct Output;
+struct Outputter;
struct Performer;
struct Paper_column;
struct Paper_score;
Symbol rule_symbol (Real height, Real width) const;
Symbol accidental (int) const;
Symbol ball (int) const;
- Symbol flag (int) const;
+ Symbol flag (int, Direction) const;
Symbol rest (int, bool outside) const;
Symbol clef (String) const;
Symbol bar (String, Real height) const;
void set_last_duration (Duration const *);
void set_default_duration (Duration const *);
- void set_last_abbrev (int type_i);
void set_abbrev_beam (int type_i);
void set_duration_mode (String s);
friend int yyparse (void*);
public:
int abbrev_beam_type_i_;
- int default_abbrev_type_i_;
int default_octave_i_;
Duration default_duration_;
Plet plet_;
Real operator[](Axis i) const{
return coordinate_a_[i];
}
+ String str () const;
Offset operator+=(Offset o) {
x()+=o.x ();
--- /dev/null
+/*
+ outputter.hh -- declare Outputter
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef OUTPUTTER_HH
+#define OUTPUTTER_HH
+
+#include "lily-proto.hh"
+
+/**
+ Abstract interface for a Score_elem to output itself.
+ */
+struct Outputter
+{
+ virtual ~Outputter(){}
+ virtual void start_line ()=0;
+ virtual void output_molecule (Molecule const *, Offset)=0;
+ virtual void stop_line ()=0;
+};
+
+/**
+ Output a line of score using TeX strings
+ */
+struct Tex_outputter : Outputter
+{
+ Tex_outputter (Tex_stream *);
+ Tex_stream * outstream_l_;
+ virtual void output_molecule (Molecule const*, Offset);
+ virtual void start_line ();
+ virtual void stop_line ();
+};
+
+#endif // OUTPUTTER_HH
*/
class Paper_score : public Music_output {
+ void tex_output ();
public:
Paper_def *paper_l_;
/// other elements
Pointer_list<Score_elem*> elem_p_list_;
-
+
+ Outputter *outputter_l_;
Super_elem *super_elem_l_;
Paper_score ();
/* STANDARD ROUTINES */
- void OK() const;
void print() const;
void typeset_element (Score_elem*);
#define STAFFELEM_HH
#include "parray.hh"
-#include "lily-proto.hh"
-#include "offset.hh"
#include "virtual-methods.hh"
#include "directed-graph.hh"
+#include "graphical-element.hh"
#define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem)
+typedef void (Score_elem::*Score_elem_method_pointer)(void);
/** Both Spanner and Item are Score_elem's. Most Score_elem's depend
on other Score_elem's, eg, Beam needs to know and set direction of
form an acyclic graph.
(elem) */
-class Score_elem : private Directed_graph_node {
-
- /// member: the symbols
- Molecule *output; // should scrap, and use temp var?
-
-
-
- /**
- for administration of what was done already
- */
- enum Status {
- ORPHAN, // not yet added to pstaff
- VIRGIN, // added to pstaff
- PREBREAKING,
- PREBROKEN,
- PRECALCING,
- PRECALCED, // calcs before spacing done
- BREAKING,
- BROKEN,
- POSTCALCING, // busy calculating. This is used to trap cyclic deps.
- POSTCALCED, // after spacing calcs done
- BREWED,
- TEXOUTPUT, // molecule has been output
- DELETED, // to catch malloc mistakes.
- };
-
- Status status_;
-
- Score_elem* dependency (int) const;
- Score_elem* dependent (int) const;
- int dependent_size() const;
- int dependency_size() const;
+class Score_elem : private Directed_graph_node, public Graphical_element {
public:
- /**
- This is needed, because #output# may still be
- NULL.
- */
- Offset offset_;
-
-
-
-
Paper_score *pscore_l_;
- Axis_group_element * axis_group_l_a_[NO_AXES];
+ Score_elem();
Score_elem (Score_elem const&);
- virtual String TeX_output_str () const ;
- virtual void print() const;
+ virtual void print() const;
Paper_def *paper() const;
virtual ~Score_elem();
- Score_elem();
DECLARE_MY_RUNTIME_TYPEINFO;
-
- Interval extent (Axis) const;
- Interval width() const;
- Interval height() const;
- Status status() const;
-
- /**
- translate the symbol. The symbol does not have to be created yet.
- */
- void translate (Offset);
- /**
- translate in one direction
- */
-
- void translate (Real, Axis);
- Real relative_coordinate (Axis_group_element*, Axis) const;
- Offset absolute_offset() const;
- Real absolute_coordinate (Axis) const;
- Axis_group_element*common_group (Score_elem const* s, Axis a) const;
void add_processing();
- void OK() const;
- void pre_processing();
- void breakable_col_processing();
- void break_processing();
-
- void post_processing();
- void molecule_processing();
/**
Remove all links (dependencies, dependents, Axis_group_elements.
*/
void unlink();
- void unlink_all();
void substitute_dependency (Score_elem*,Score_elem*);
void remove_dependency (Score_elem*);
/**
virtual bool linked_b() const;
SCORE_ELEM_CLONE(Score_elem);
- /// no dimension, translation is noop
- bool empty_b_;
/// do not print anything black
bool transparent_b_;
+
+ // ugh: no protection. Denk na, Vrij Veilig
+ void calcalute_dependencies (int final, int busy, Score_elem_method_pointer funcptr);
+
protected:
+ /**
+ Administration: Where are we?. This is mainly used by Super_elem and
+ Score_elem::calcalute_dependencies ()
+
+ 0 means ORPHAN,
+ -1 means deleted
+
+ */
+ int status_i_;
+ Score_elem* dependency (int) const;
+ Score_elem* dependent (int) const;
+ int dependent_size() const;
+ int dependency_size() const;
+
+ virtual void do_brew_molecule ();
+ void junk_links();
virtual Interval do_height() const;
virtual Interval do_width() const;
virtual void do_breakable_col_processing();
/// do calculations after determining horizontal spacing
virtual void do_post_processing();
- virtual String do_TeX_output_str () const;
virtual void do_substitute_dependency (Score_elem * , Score_elem *);
virtual void do_substitute_dependent (Score_elem *, Score_elem *);
virtual Link_array<Score_elem> get_extra_dependencies() const;
virtual void do_unlink();
virtual void do_junk_links();
- String make_TeX_string (Offset) const;
};
virtual void do_announces();
virtual void typeset_element (Score_elem*elem_p);
virtual void do_pre_move_processing();
- virtual void add_processing ();
+ virtual void do_add_processing ();
};
#endif // SCORE_GRAV_HH
virtual void prepare (Moment mom);
virtual void process();
virtual void start();
- virtual void add_processing ();
+ virtual void do_add_processing ();
virtual int get_tempo_i() const;
virtual void play (Audio_element* p);
virtual Music_output *get_output_p ();
public:
Link_array<Paper_column> cols;
bool error_mark_b_;
- virtual String TeX_output_str () const;
-
+
DECLARE_MY_RUNTIME_TYPEINFO;
Line_of_score();
void set_breaking (Array<Col_hpositions> const&);
protected:
- virtual void do_breakable_col_processing ();
+ virtual Link_array<Score_elem> get_extra_dependencies () const;
+
+ virtual void do_unlink ();
+ virtual void do_junk_links ();
virtual void break_into_pieces (bool);
virtual Interval do_width() const;
virtual void do_print() const;
virtual void do_unlink();
virtual void do_junk_links();
- virtual String do_TeX_output_str () const;
+ virtual void do_brew_molecule ();
virtual void do_break_processing();
virtual Interval do_width() const;
virtual void do_print() const;
class Stem_engraver : public Engraver
{
Direction dir_;
+ int default_abbrev_i_;
Stem *stem_p_;
Rhythmic_req *rhythmic_req_l_;
Abbreviation_req* abbrev_req_l_;
protected:
+ virtual void do_creation_processing ();
virtual void acknowledge_element (Score_elem_info);
virtual void do_pre_move_processing ();
virtual bool do_try_request (Request*);
/// how many abbrev beam don't reach stem?
int beam_gap_i_;
- /// flagtype? 4 none, 8 8th flag, 0 = beam.
+ /// log of the duration. Eg. 4 -> 16th note -> 2 flags
int flag_i_;
/**
*/
class Super_elem : public Score_elem {
public:
- Link_array<Line_of_score> lines_arr_;
- Line_of_score * line_of_score_l_;
+ Link_array<Line_of_score> lines_arr_;
+ Line_of_score * line_of_score_l_;
void add_broken_line (Line_of_score*);
- Super_elem();
- virtual String TeX_output_str() const;
+ Super_elem();
+
+ void pre_processing();
+ void breakable_col_processing();
+ void break_processing();
+ void post_processing();
+ void output_all ();
+ void unlink_all ();
+
protected:
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
- virtual void handle_broken_dependencies();
+ virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void handle_broken_dependencies();
- virtual void do_add_processing();
- DECLARE_MY_RUNTIME_TYPEINFO;
+ virtual void do_add_processing();
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // SUPER_ELEM_HH
Melodic_req * melodic_req_l_;
protected:
- virtual ~Tie_engraver();
+ virtual void do_removal_processing ();
virtual void acknowledge_element (Score_elem_info);
virtual bool do_try_request (Request*);
virtual bool acceptable_request_b (Request*);
virtual Translator_group * group_l () { return this; }
virtual void do_print () const;
virtual void do_process_requests ();
- virtual void add_processing ();
+ virtual void do_add_processing ();
virtual bool do_try_request (Request* req_l);
virtual void do_pre_move_processing();
virtual void do_post_move_processing();
Translator_group * daddy_trans_l_ ;
- virtual void add_processing ();
void print () const;
/**
*/
bool try_request (Request*);
void pre_move_processing();
+ void add_processing ();
void creation_processing ();
void process_requests();
void post_move_processing();
@see{try_request}
Default: always return false
*/
+ virtual void do_add_processing ();
virtual bool do_try_request (Request *req_l);
virtual void do_print () const;
virtual void do_pre_move_processing(){}
virtual void do_unlink () { Axis_group_spanner::do_unlink (); }
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual void add_element (Score_elem*e) { Vertical_group_element::add_element (e); }
- virtual void remove_element (Score_elem*e) { Vertical_group_element::remove_element (e); }
+ virtual void add_element (Graphical_element*e) { Vertical_group_element::add_element (e); }
+ virtual void remove_element (Graphical_element*e) { Vertical_group_element::remove_element (e); }
};
#endif // SPAN_VERTICAL_GROUP_HH
Item::do_print() const
{
#ifndef NPRINT
- DOUT << "breakable_b_: " << breakable_b_;
- DOUT << "break_status_i_: " <<break_status_i_;
+ DOUT << "breakable_b_: " << breakable_b_ <<
+ " break_status_i_: " <<break_status_i_;
#endif
}
{
if (default_b_)
{
- empty_b_ = transparent_b_ = (break_status_i() != 1);
+ transparent_b_ = (break_status_i() != 1);
+ set_empty (transparent_b_);
}
}
}
Symbol
-Lookup::flag (int j) const
+Lookup::flag (int j, Direction d) const
{
- return (*symtables_)("flags")->lookup (j);
+ char c = (d == UP) ? 'u' : 'd';
+ return (*symtables_)("flags")->lookup (c + String (j));
}
Symbol
#include "request-iterator.hh"
#include "translator-group.hh"
#include "translation-property.hh"
+#include "change-iterator.hh"
+#include "change-translator.hh"
IMPLEMENT_IS_TYPE_B(Music_iterator);
p = new Voice_iterator ((Voice*) m);
else if (m->is_type_b (Translation_property::static_name ()))
p = new Property_iterator((Translation_property *) m);
-
+ else if (m->is_type_b (Change_translator::static_name ()))
+ p = new Change_iterator((Change_translator*) m);
+
if (m -> translator_type_str_)
{
Translator_group* a =report_l->
p->set_translator (a);
}
-
if (! p->report_to_l())
p ->set_translator (report_l);
source_l_ = source_l;
lexer_p_ = 0;
abbrev_beam_type_i_ = 0;
- default_abbrev_type_i_ = 0;
default_duration_.durlog_i_ = 2;
default_octave_i_ = 0;
textstyle_str_="roman"; // in lexer?
abbrev_beam_type_i_ = type_i;
}
-void
-My_lily_parser::set_last_abbrev (int type_i)
-{
- default_abbrev_type_i_ = type_i;
-}
-
void
My_lily_parser::set_default_duration (Duration const *d)
{
last_duration_mode_b_ = false;
default_duration_ = *d;
- set_last_abbrev (0);
}
{
if (last_duration_mode_b_)
default_duration_ = *d;
- set_last_abbrev (0);
}
if (s=="s")
{ /* Space */
- Skip_req * skip_p = new Skip_req;
- skip_p->duration_ = *duration_p;
+ Skip_req * skip_p = new Skip_req;
+ skip_p->duration_ = *duration_p;
- skip_p->set_spot (here_input());
- velt_p->add (skip_p);
+ skip_p->set_spot (here_input());
+ velt_p->add (skip_p);
}
else
{
assert (!duration_p->plet_b ());
duration_p->set_plet (1, 2);
}
- if (default_abbrev_type_i_)
- {
- Abbreviation_req* a = new Abbreviation_req;
- a->type_i_ = default_abbrev_type_i_;
- v->add (a);
- }
rq->set_duration (*duration_p);
rq->set_spot (here_input ());
delete duration_p ;
stem_l_ = stem_l;
/*
don't add stem to support; mostly invisible for rest-columns (and possibly taken . .)
-
*/
Score_elem::add_dependency (stem_l);
for (int i=0; i < script_l_arr_.size(); i++)
script_l_arr_[i]->set_stem (stem_l);
-
}
void
void
Note_column::translate_rests (int dy_i)
{
+ invalidate_cache (Y_AXIS);
for (int i=0; i < rest_l_arr_.size(); i++)
rest_l_arr_[i]->position_i_ += dy_i;
}
--- /dev/null
+/*
+ offset.cc -- implement Offset
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "string.hh"
+#include "offset.hh"
+
+String
+Offset::str () const
+{
+ String s;
+ s = String("(") + coordinate_a_[X_AXIS] + ", " + coordinate_a_[Y_AXIS] + ")";
+ return s;
+}
--- /dev/null
+
+/*
+ outputter.cc -- implement Tex_outputter
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "outputter.hh"
+#include "tex-stream.hh"
+#include "molecule.hh"
+#include "varray.hh"
+#include "dimen.hh"
+#include "tex.hh"
+
+Tex_outputter::Tex_outputter (Tex_stream *s)
+{
+ outstream_l_ = s;
+}
+
+void
+Tex_outputter::output_molecule (Molecule const*m, Offset o)
+{
+ String t = m->TeX_string();
+ if (!t)
+ return ;
+
+ String s ("\\placebox{%}{%}{%}");
+ Array<String> a;
+ a.push (print_dimen (o.y()));
+ a.push (print_dimen (o.x()));
+ a.push (t);
+ String r;
+ /*
+ if (check_debug)
+ r = String ("\n%start: ") + name() + "\n";
+ */
+
+ r += substitute_args (s, a);
+
+ *outstream_l_ << r;
+}
+
+
+void
+Tex_outputter::start_line ()
+{
+ *outstream_l_ << "\\hbox{%<- line of score\n";
+}
+
+void
+Tex_outputter::stop_line ()
+{
+ *outstream_l_ << "}";
+ *outstream_l_ << "\\interscoreline";
+}
DOUT <<'\n' << ((break_status_i_ == -1)? "prebreak" : "postbreak");
DOUT << '\n';
}
- DOUT << "extent: " << width().str () << "\n";
+ // DOUT << "extent: " << width().str () << "\n";
#endif
}
#include "header.hh"
#include "word-wrap.hh"
#include "gourlay-breaking.hh"
+#include "outputter.hh"
Paper_score::Paper_score ()
{
+ outputter_l_ =0;
super_elem_l_ = new Super_elem;
typeset_element (super_elem_l_);
}
span_p_list_.bottom ().add (span_p);
span_p->pscore_l_=this;
-
// do not init start/stop fields. These are for broken spans only.
span_p->add_processing ();
}
-void
-Paper_score::OK () const
-{
-#ifndef NDEBUG
- for (PCursor<Score_elem*> i (elem_p_list_.top ()); i.ok (); i++)
- i->OK ();
-#endif
-}
-
void
Paper_score::print () const
{
#endif
}
-void
-Paper_score::preprocess ()
-{
- super_elem_l_->breakable_col_processing ();
- super_elem_l_->pre_processing ();
-}
-
-void
-Paper_score::postprocess ()
-{
- super_elem_l_->post_processing ();
- super_elem_l_->molecule_processing ();
-}
-
PCursor<Paper_column *>
Paper_score::find_col (Paper_column const *c) const
{
clean_cols ();
print ();
*mlog << "Preprocessing elements... " <<flush;
- preprocess ();
+ super_elem_l_->breakable_col_processing ();
+ super_elem_l_->pre_processing ();
*mlog << "\nCalculating column positions ... " <<flush;
calc_breaking ();
*mlog << "\nPostprocessing elements..." << endl;
- postprocess ();
+ super_elem_l_->post_processing ();
+ tex_output ();
+}
+
+void
+Paper_score::tex_output ()
+{
// output
String outname = paper_l_->outfile_str_ ;
if (!outname)
*mlog << "TeX output to " << outname << " ...\n";
- Tex_stream the_output (outname);
+ Tex_stream tex_out (outname);
+ Tex_outputter interfees (&tex_out);
+
+ outputter_l_ = &interfees;
- the_output << "% outputting Score, defined at: " << origin_str_ << "\n";
+ tex_out << "% outputting Score, defined at: " << origin_str_ << "\n";
if (header_l_)
{
- the_output << header_l_->TeX_string();
+ tex_out << header_l_->TeX_string();
}
- the_output << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n";
- the_output<< super_elem_l_->TeX_output_str ();
- the_output << "\n\\EndLilyPondOutput";
+ tex_out << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n";
+ super_elem_l_->output_all ();
+ tex_out << "\n\\EndLilyPondOutput";
+ outputter_l_ = 0;
}
/** Get all breakable columns between l and r, (not counting l and r). */
#include <iostream.h>
// mmm
-#define MUDELA_VERSION "0.1.5"
+#define MUDELA_VERSION "0.1.6"
#include "scalar.hh"
#include "translation-property.hh"
#include "music-list.hh"
#include "header.hh"
#include "duration-convert.hh"
+#include "change-translator.hh"
#ifndef NDEBUG
#define YYDEBUG 1
%type <scalar> scalar
%type <music> Music transposed_music
-%type <music> propertydef
+%type <music> property_def translator_change
%type <musiclist> Voice Voice_body
%type <chord> Chord Chord_body
%type <paper> paper_block paper_body
paper_body:
/* empty */ {
- $$ = THIS->default_paper (); // paper / video / engrave
+ $$ = THIS->default_paper ();
}
| PAPER_IDENTIFIER {
$$ = $1->paperdef ();
{ THIS->lexer_p_->push_lyric_state (); }
Music
{ $$ = $3; THIS->lexer_p_->pop_state (); }
- | propertydef
+ | property_def
+ | translator_change
;
-propertydef:
+translator_change:
TRANSLATOR STRING '=' STRING {
- /* kluge. Could use Music just as well */
- Translation_property * t = new Translation_property;
- t-> translator_type_str_ = *$2;
- t-> translator_id_str_ = *$4;
+ Change_translator * t = new Change_translator;
+ t-> change_to_type_str_ = *$2;
+ t-> change_to_id_str_ = *$4;
+
$$ = t;
delete $2;
delete $4;
}
- | PROPERTY STRING '.' STRING '=' scalar {
+ ;
+
+property_def:
+ PROPERTY STRING '.' STRING '=' scalar {
Translation_property *t = new Translation_property;
t-> translator_type_str_ = *$2;
t-> var_str_ = *$4;
Chord:
'<' Chord_body '>' { $$ = $2; }
+ | MULTI INT Chord {
+ $$ = $3;
+ $$->multi_level_i_=$2;
+ }
;
Chord_body:
$$ = new Chord;
$$-> multi_level_i_ = 1;
}
- | Chord_body MULTI INT ';' {
- $$->multi_level_i_=$3;
- }
| Chord_body Music {
$$->add ($2);
}
c' -> default_octave_i_ == 1
*/
- /* why can't we have \oct{0} iso \oct{c'}*/
+ /* why can't we have \oct 0 iso \oct{c'}*/
THIS->default_octave_i_ = 1; }
/* cont */
steno_melodic_req {
abbrev_type:
- ':' int {
+ ':' {
+ $$ =0;
+ }
+ | ':' int {
if (!Duration::duration_type_b ($2))
THIS->parser_error ("Not a duration");
else if ($2 < 8)
THIS->parser_error ("Can't abbreviate");
- else
- THIS->set_last_abbrev ($2);
- $$ = THIS->default_abbrev_type_i_;
+ $$ = $2;
}
+
;
music_elt:
Rest_collision::Rest_collision()
{
transparent_b_ = true;
- empty_b_ = true;
+ set_empty (true);
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-/*
- too big. Should split.
- */
+#include "outputter.hh"
#include "p-score.hh"
#include "paper-def.hh"
#include "lookup.hh"
Score_elem::Score_elem()
{
- transparent_b_ = empty_b_ = false;
- axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+ transparent_b_ = false;
pscore_l_=0;
- offset_ = Offset (0,0);
- output = 0;
- status_ = ORPHAN;
+ status_i_ = 0;
}
Score_elem::Score_elem (Score_elem const&s)
+ : Graphical_element (s)
{
/* called from derived ctor, so most info points to the same deps
as (Directed_graph_node&)s. Nobody points to us, so don't copy
*/
copy_edges_out (s);
transparent_b_ = s.transparent_b_;
- empty_b_ = s.empty_b_;
- axis_group_l_a_[0] = axis_group_l_a_[1] =0;
- status_ = s.status_;
- assert (!s.output);
- output = 0;
+ status_i_ = s.status_i_;
pscore_l_ = s.pscore_l_;
- offset_ = Offset (0,0);
}
Score_elem::~Score_elem()
{
- // some paranoia to prevent weird segv's
- assert (status_ < DELETED);
- delete output;
- status_ = DELETED;
- output = 0;
+ assert (status_i_ >=0);
+ status_i_ = -1;
}
Score_elem*
return get_in_edge_arr().size ();
}
-String
-Score_elem::make_TeX_string (Offset o)const
-{
- String s ("\\placebox{%}{%}{%}");
- Array<String> a;
- a.push (print_dimen (o.y()));
- a.push (print_dimen (o.x()));
- String t = output->TeX_string();
- if (!t)
- return t;
-
- a.push (t);
- String r;
- if (check_debug)
- r = String ("\n%start: ") + name() + "\n";
- r += substitute_args (s, a);
- return r;
-}
-String
-Score_elem::do_TeX_output_str () const
-{
- return make_TeX_string(absolute_offset());
-}
-
-/*
- GEOMETRY
- */
-Real
-Score_elem::absolute_coordinate (Axis a) const
-{
- Real r = offset_[a];
- for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
- axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
-
- r += axis_group_l->offset_[a];
- return r;
-}
-
-Offset
-Score_elem::absolute_offset() const
-{
- return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
-}
-
-void
-Score_elem::translate (Real y, Axis a)
-{
- offset_[a] += y;
-}
-
-Real
-Score_elem::relative_coordinate (Axis_group_element*e, Axis a) const
-{
- Real r =0.0;
- for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
- axis_group_l != e;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- r += axis_group_l->offset_[a];
-
- return r;
-}
-
-Axis_group_element*
-Score_elem::common_group (Score_elem const* s, Axis a) const
-{
- Link_array<Axis_group_element> my_groups;
- for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
- axis_group_l;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- my_groups.push (axis_group_l);
-
- Axis_group_element* common_l=0;
- for (Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
- !common_l && axis_group_l;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- common_l = my_groups.find_l (axis_group_l);
-
- return common_l;
-}
-
-
-
-void
-Score_elem::translate (Offset O)
-{
- offset_ += O;
-}
Interval
Score_elem::do_width() const
{
Interval r;
- if (!output)
- {
- Molecule*m = brew_molecule_p();
- r = m->extent().x ();
- delete m;
- }
- else
- r = output->extent().x ();
- return r;
-}
-
-Interval
-Score_elem::width() const
-{
- return extent (X_AXIS);
-}
-
-Interval
-Score_elem::extent (Axis a) const
-{
- Interval r;
- if (!empty_b_)
- {
-
- r = (a == X_AXIS)? do_width(): do_height ();
- }
+ Molecule*m = brew_molecule_p();
+ r = m->extent().x ();
+ delete m;
- if (!r.empty_b()) // float exception on DEC Alpha
- r+=offset_[a];
-
return r;
}
Score_elem::do_height() const
{
Interval r;
- if (!output)
- {
- Molecule*m = brew_molecule_p();
- r = m->extent().y ();
- delete m;
- }
- else
- r = output->extent().y ();
+ Molecule*m = brew_molecule_p();
+ r = m->extent().y ();
+ delete m;
return r;
}
-Interval
-Score_elem::height() const
-{
- return extent (Y_AXIS);
-}
/*
STANDARD METHS
DOUT << name() << "{\n";
DOUT << "dets: " << dependent_size() << "dependencies: " <<
dependency_size();
- if (offset_.x() || offset_.y ())
- DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")";
- DOUT << "\n";
-
+
+ Graphical_element::print ();
do_print();
- if (output)
- output->print();
DOUT << "}\n";
#endif
return pscore_l_->paper_l_;
}
+
void
Score_elem::add_processing()
{
- if (status_ >= VIRGIN)
+ if (status_i_)
return;
- status_ = VIRGIN;
+ status_i_ ++;
do_add_processing();
}
-void
-Score_elem::pre_processing()
-{
- if (status_ >= PRECALCED)
- return;
-
- assert (status_ != PRECALCING); // cyclic dependency
- status_ = PRECALCING;
-
- for (int i=0; i < dependency_size(); i++)
- dependency (i)->pre_processing();
-
- Link_array<Score_elem> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- extra[i]->pre_processing();
-
- do_pre_processing();
- status_ = PRECALCED;
-}
void
-Score_elem::breakable_col_processing()
+Score_elem::calcalute_dependencies (int final, int busy,
+ Score_elem_method_pointer funcptr)
{
- if (status_ >= PREBROKEN)
+ if (status_i_ >= final)
return;
- if (status_== PREBREAKING)
- {
- status_ = PREBROKEN;
- return ;
- }
- status_ = PREBREAKING;
+ assert (status_i_!= busy);
+ status_i_= busy;
for (int i=0; i < dependency_size(); i++)
- dependency (i)->breakable_col_processing();
+ dependency (i)->calcalute_dependencies (final, busy, funcptr);
Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->breakable_col_processing();
+ extra[i]->calcalute_dependencies (final, busy, funcptr);
-
- do_breakable_col_processing();
- status_ = PREBROKEN;
+ invalidate_cache (X_AXIS);
+ invalidate_cache (Y_AXIS);
+ (this->*funcptr)();
+ status_i_= final;
}
void
-Score_elem::break_processing()
+Score_elem::do_brew_molecule ()
{
- if (status_ >= BROKEN)
- return;
-
- if (status_ == BREAKING)
- {
- status_ = BROKEN;
- return;
- }
- status_ = BREAKING;
-
- for (int i=0; i < dependency_size(); i++)
- dependency (i)->break_processing();
-
- Link_array<Score_elem> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- extra[i]->break_processing();
-
+ if (transparent_b_)
+ return ;
+ Molecule *output= brew_molecule_p ();
+ pscore_l_->outputter_l_->output_molecule (output, absolute_offset ());
+}
+/*
- do_break_processing();
- status_ = BROKEN;
+ VIRTUAL STUBS
-}
+ */
void
Score_elem::do_break_processing()
handle_broken_dependencies();
}
-
-void
-Score_elem::post_processing()
-{
- if (status_ >= POSTCALCED)
- return;
- assert (status_ != POSTCALCING);// cyclic dependency
- status_=POSTCALCING;
-
-
- for (int i=0; i < dependency_size(); i++)
- dependency (i)->post_processing();
-
- Link_array<Score_elem> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- extra[i]->post_processing();
-
-
- do_post_processing();
- status_=POSTCALCED;
-}
-
-Score_elem::Status
-Score_elem::status() const
-{
- return status_;
-}
-
-void
-Score_elem::molecule_processing()
-{
- if (status_ >= BREWED)
- return;
- status_ = BREWED; // do it only once.
-
- for (int i=0; i < dependency_size(); i++)
- dependency (i)->molecule_processing();
-
- Link_array<Score_elem> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- extra[i]->molecule_processing();
-
-
- if (transparent_b_)
- return ;
- output= brew_molecule_p();
-}
-
-String
-Score_elem::TeX_output_str() const
-{
- String s;
- if (status_ >= TEXOUTPUT)
- return "";
-
- ((Score_elem*)this)->status_ = TEXOUTPUT;
-
- for (int i=0; i < dependency_size(); i++)
- s += dependency (i)->TeX_output_str();
-
- Link_array<Score_elem> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- s += extra[i]->TeX_output_str ();
-
- if (!transparent_b_)
- s+= do_TeX_output_str();
-
- return s;
-}
-
-/*
-
- VIRTUAL STUBS
-
- */
void
Score_elem::do_post_processing()
{
{
}
-IMPLEMENT_IS_TYPE_B(Score_elem);
+IMPLEMENT_IS_TYPE_B1(Score_elem, Graphical_element);
Molecule*
Score_elem::brew_molecule_p() const
for (int i=0; i <remove_us_arr.size(); i++)
remove_dependency (remove_us_arr[i]);
- status_ = BROKEN;
+ // status_i_= BROKEN;
}
/*
substitute_dependency (old_arr[i], new_arr[i]);
- status_ = PREBROKEN;
+ // status_i_= PREBROKEN;
}
-
void
-Score_elem::unlink_all()
+Score_elem::junk_links ()
{
- for (int i=0; i < dependency_size(); i++)
- dependency (i)->unlink_all();
- Link_array<Score_elem> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- extra[i]->unlink_all();
-
- junk_links();
- axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
- do_unlink();
+ Directed_graph_node::junk_links();
+ Graphical_element::junk_links ();
+ do_junk_links();
}
void
for (int j=0; j < 2; j++)
if (axis_group_l_a_[j])
axis_group_l_a_[j]->remove_element (this);
-
}
-void
-Score_elem::OK() const
-{
-#ifndef NDEBUG
- for (int i=0; i < dependency_size(); i++)
- {
- dependency (i)->OK();
- }
-#endif
-}
Link_array<Score_elem>
Score_elem::get_extra_dependencies() const
return get_extra_dependencies().size() ||
dependency_size();
}
+
+
ADD_THIS_TRANSLATOR(Score_engraver);
void
-Score_engraver::add_processing ()
+Score_engraver::do_add_processing ()
{
- Translator_group::add_processing ();
+ Translator_group::do_add_processing ();
assert (output_def_l_->is_type_b (Paper_def::static_name ()));
assert (!daddy_trans_l_);
pscore_p_ = new Paper_score;
}
void
-Score_performer::add_processing ()
+Score_performer::do_add_processing ()
{
- Translator_group::add_processing ();
+ Translator_group::do_add_processing ();
assert (output_def_l_->is_type_b (Midi_def::static_name ()));
performance_p_ = new Performance;
performance_p_->midi_l_ = (Midi_def*) output_def_l_;
#include "music.hh"
#include "global-translator.hh"
#include "header.hh"
+#include "cpu-timer.hh"
extern String default_out_fn;
void
Score::run_translator (Music_output_def *odef_l)
{
+ Cpu_timer timer;
Global_translator * trans_p = odef_l->get_global_translator_p();
if (!trans_p)
return ;
Music_output * output = trans_p->get_output_p();
delete trans_p;
+ *mlog << " (time: " << String(timer.read (), "%.2f") << " seconds)";
+
output->header_l_ = header_p_;
output->default_out_str_ = default_out_fn;
output->origin_str_ = location_str();
#include "p-score.hh"
-/* To do:
-
- take out hard coded TeX stuff.
- */
-String
-Line_of_score::TeX_output_str () const
-{
- String s ("\\hbox{%<- line of score\n");
- if (error_mark_b_)
- s+= "\\scorelineerrormark";
-
- s+= Score_elem::TeX_output_str();
- s += "}";
- return s;
-}
-
-
Line_of_score::Line_of_score()
{
error_mark_b_ = 0;
return Spanner::do_width();
}
+Link_array<Score_elem>
+Line_of_score::get_extra_dependencies () const
+{
+ Link_array<Score_elem> r;
+ for (int i=0; i < cols.size (); i++)
+ r.push (cols[i]);
+ return r;
+}
+
void
-Line_of_score::do_breakable_col_processing()
+Line_of_score::do_unlink ()
{
for (int i=0; i < cols.size (); i++)
- cols[i]->breakable_col_processing();
- Spanner::do_breakable_col_processing();
+ cols[i]->line_l_ =0;
+ cols.set_size (0);
+}
+
+
+void
+Line_of_score::do_junk_links ()
+{
+ cols.set_size (0);
}
{
if (r_l->equal_b (script_req_l_arr_[i]))
return true;
-
}
script_req_l_arr_.push (r_l->script());
void
Script_engraver::do_process_requests()
{
+ if (script_p_arr_.size ())
+ return ;
+
for (int i=0; i < script_req_l_arr_.size(); i++)
{
Script_req* l=script_req_l_arr_[i];
{
if (breakable_b_ && break_status_i() != 1)
{
- transparent_b_ = empty_b_ = true;
+ transparent_b_ = true;
+ set_empty (true);
}
if (!dir_)
Direction d=LEFT;
Real nw_f = paper()->note_width ();
- while ((d *= -1) != LEFT);
do
{
if (extrema[d] != spanned_drul_[d])
if (spanning_l_arr_.size() < 1)
{
transparent_b_ = true;
- empty_b_ =true;
+ set_empty (true);
}
else
{
if (!type_str_)
{
transparent_b_=true;
- empty_b_ = true;
+ set_empty (true);
}
else if (type_str_ == "|:")
{
if (break_status_i() != 1)
{
- empty_b_ = transparent_b_ = true;
+ set_empty (true);
+ transparent_b_ = true;
}
}
#include "spanner.hh"
#include "p-col.hh"
#include "p-score.hh"
-
+#include "outputter.hh"
IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem);
spanned_drul_[RIGHT]=0;
}
-String
-Spanner::do_TeX_output_str () const
+void
+Spanner::do_brew_molecule ()
{
+ if (transparent_b_)
+ return ;
+ Molecule *output= brew_molecule_p ();
Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0);
- return make_TeX_string (absolute_offset() + left_off);
+ Offset o = absolute_offset() + left_off;
+ pscore_l_->outputter_l_->output_molecule (output, o);
}
Interval
{
abbrev_req_l_ = 0;
stem_p_ = 0;
+ default_abbrev_i_ = 16;
dir_ = CENTER;
}
+void
+Stem_engraver::do_creation_processing ()
+{
+ Scalar prop = get_property ("abbrev");
+ if (prop && prop.isnum ())
+ {
+ default_abbrev_i_ = prop;
+ }
+}
+
void
Stem_engraver::acknowledge_element(Score_elem_info i)
{
Rhythmic_req * r = i.req_l_->musical()->rhythmic();
stem_p_ = new Stem;
int durlog_i = r->duration_.durlog_i_;
- stem_p_->flag_i_ = Duration_convert::type2_i(durlog_i);
+ stem_p_->flag_i_ = durlog_i;
+
+
if (abbrev_req_l_)
- stem_p_->abbrev_flag_i_ = intlog2 (abbrev_req_l_->type_i_)
- - (durlog_i>? 2);
+ {
+ int t = abbrev_req_l_->type_i_;
+ if (!t)
+ t = default_abbrev_i_;
+ else
+ default_abbrev_i_ = t;
+ stem_p_->abbrev_flag_i_ = intlog2 (t) - (durlog_i>? 2);
+ }
announce_element (Score_elem_info (stem_p_, r));
}
stem_p_->add (h);
source file of the GNU LilyPond music typesetter
(c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+
+ TODO: This is way too hairy
*/
#include "stem.hh"
beams_right_i_ = 0;
stem_bottom_f_ = stem_top_f_ = 0;
- flag_i_ = 4;
- dir_ =CENTER;
+ flag_i_ = 2;
+ dir_ = CENTER;
staff_size_i_ = 8;
stem_xoffset_f_ =0;
Stem::do_print () const
{
#ifndef NPRINT
- DOUT << "flag "<< flag_i_ << " print_flag? " << !(bool)beam_l_ << "abbrev_flag_i_" << abbrev_flag_i_;
+ DOUT << "flag "<< flag_i_ << "abbrev_flag_i_" << abbrev_flag_i_;
+ if (beam_l_)
+ DOUT << "beamed";
#endif
}
Stem::add (Note_head *n)
{
n->add_dependency (this);
- head_l_arr_.push (n);
+ head_l_arr_.push (n);
}
void
Stem::invisible_b () const
{
- return !head_l_arr_.size () ||
- head_l_arr_[0]->balltype_i_ <= 0;
+ return (!head_l_arr_.size () ||
+ head_l_arr_[0]->balltype_i_ <= 0);
}
// if dir_ is set we return fake values.
-
int
Stem::get_center_distance_from_top ()
{
if (dir_)
return dir_;
return (get_center_distance_from_top () >=
- get_center_distance_from_bottom ()) ?
+ get_center_distance_from_bottom ()) ?
(Direction)-1 : (Direction)1;
}
// ugh... how about non 5-line staffs?
bool on_ledger_line_b = ((max_head_i () < -2 && dir_ == 1)
-// || (min_head_i () > staff_size_i_ && dir_ == -1));
- || (min_head_i () > staff_size_i_ + 3 && dir_ == -1));
+ // || (min_head_i () > staff_size_i_ && dir_ == -1));
+ || (min_head_i () > staff_size_i_ + 3 && dir_ == -1));
if (on_ledger_line_b)
{
set_stemend (staff_size_i_ / 2 - 1);
if (stem_bottom_f_== stem_top_f_)
set_default_extents ();
set_noteheads ();
- flag_i_ = dir_ * abs (flag_i_);
+ flag_i_ = flag_i_;
transparent_b_ = invisible_b ();
- empty_b_ = invisible_b ();
-
+ set_empty (invisible_b ());
}
{
r = abbrev_mol ().extent ().x ();
}
- else if (beam_l_ || abs (flag_i_) <= 4)
+ else if (beam_l_ || abs (flag_i_) <= 2)
; // TODO!
else
{
Paper_def*p= paper ();
- r = p->lookup_l ()->flag (flag_i_).dim.x ();
+ r = p->lookup_l ()->flag (flag_i_, dir_).dim.x ();
r+= stem_xoffset_f_;
}
return r;
}
-
+
Molecule
-Stem::abbrev_mol () const
+ 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;
+ 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)));
// ugh
- if (!beams_i)
- a.translate (dy + beamdy - dir_ * dy, Y_AXIS);
- else
- a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS);
-
+ if (!beams_i)
+ a.translate (dy + beamdy - dir_ * dy, Y_AXIS);
+ else
+ a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS);
+
for (int i = 0; i < abbrev_flag_i_; i++)
{
Atom b (a);
b.translate (-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 = stem_bottom_f_;
Real top = stem_top_f_;
assert (bot!=top);
-
+
Paper_def *p =paper ();
-
+
Real dy = p->internote_f ();
if (!invisible_b ())
{
mol_p->add (Atom (ss));
}
- if (!beam_l_ &&abs (flag_i_) > 4)
+ if (!beam_l_ &&abs (flag_i_) > 2)
{
- Symbol fl = p->lookup_l ()->flag (flag_i_);
- Molecule m (fl);
- if (flag_i_ < -4)
- {
- mol_p->add_at_edge (Y_AXIS, DOWN, m);
- }
- else if (flag_i_ > 4)
- {
- mol_p->add_at_edge (Y_AXIS, UP, m);
- }
- else
- assert (false);
- assert (!abbrev_flag_i_);
- }
-
+ Symbol 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 ());
}
Real
-Stem::hpos_f () const
+ Stem::hpos_f () const
{
return Item::hpos_f () + stem_xoffset_f_;
}
void
-Stem::do_substitute_dependency (Score_elem*o,Score_elem*n)
+ Stem::do_substitute_dependency (Score_elem*o,Score_elem*n)
{
Item * o_l = o->item ();
Item * n_l = n? n->item () : 0;
#include "scoreline.hh"
#include "p-score.hh"
#include "string.hh"
-
-String
-Super_elem::TeX_output_str() const
-{
- String s;
- for (int i=0; i < lines_arr_.size(); i++)
- {
- s += lines_arr_[i]->TeX_output_str();
- if (i + 1<lines_arr_.size())
- s += "\\interscoreline"; // TODO
- }
- return s;
-}
+#include "outputter.hh"
void
Super_elem::handle_broken_dependencies()
}
IMPLEMENT_IS_TYPE_B1(Super_elem,Score_elem);
+
+
+/**
+ for administration of what was done already
+ */
+enum Score_elem_status {
+ ORPHAN=0, // not yet added to pstaff
+ VIRGIN, // added to pstaff
+ PREBROKEN,
+ PRECALCING,
+ PRECALCED, // calcs before spacing done
+ BROKEN,
+ POSTCALCING, // busy calculating. This is used to trap cyclic deps.
+ POSTCALCED, // after spacing calcs done
+ BREWING,
+ BREWED,
+ UNLINKING,
+ UNLINKED,
+};
+
+void
+Super_elem::pre_processing ()
+{
+ calcalute_dependencies (PRECALCING, PRECALCED, &Score_elem::do_pre_processing);
+}
+
+/* for break processing, use only one status, because copies have to
+ have correct status. (Previously,
+ Score_elem::handle_[pre]broken_dependencies assigned to status_i_
+ */
+void
+Super_elem::breakable_col_processing ()
+{
+ calcalute_dependencies (PREBROKEN, PREBROKEN, &Score_elem::do_breakable_col_processing);
+}
+
+void
+Super_elem::break_processing ()
+{
+ calcalute_dependencies (BROKEN, BROKEN, &Score_elem::do_break_processing);
+}
+void
+Super_elem::post_processing ()
+{
+ calcalute_dependencies (POSTCALCING, POSTCALCED, &Score_elem::do_post_processing);
+}
+
+void
+Super_elem::output_all ()
+{
+ for (int i=0; i < lines_arr_.size(); i++)
+ {
+ pscore_l_->outputter_l_->start_line ();
+ lines_arr_[i]->calcalute_dependencies (BREWING, BREWED, &Score_elem::do_brew_molecule);
+ pscore_l_->outputter_l_->stop_line ();
+ }
+}
+
+
+
+void
+Super_elem::unlink_all ()
+{
+ calcalute_dependencies (UNLINKING, UNLINKED, &Score_elem::junk_links);
+}
+
}
}
-Tie_engraver::~Tie_engraver()
+void
+Tie_engraver::do_removal_processing ()
{
+ do_pre_move_processing ();
if (tie_p_)
{
req_l_->warning ("unended Tie");
+ tie_p_->unlink ();
delete tie_p_;
}
}
return existing;
Link_array<Translator_group> path = path_to_acceptable_translator (n);
-
- if (path.size ())
+
+ /*
+ if path.size () == 1, then
+ type_str_ == n, but not id == id_str_
+ */
+ if (path.size () > 1)
{
+ assert (path.size () > 1);
Translator_group * current = this;
- // start at 1. The first one will be us.
+ // start at 1. The first one (index 0) will be us.
for (int i=1; i < path.size (); i++)
{
Translator_group * new_group = path[i]->clone ()->group_l ();
current->id_str_ = id;
return current;
}
-
- Translator_group * ret =0;
+ Translator_group *ret = 0;
if (daddy_trans_l_)
ret = daddy_trans_l_->find_create_translator_l (n,id);
else
Translator_group::remove_translator_p (Translator*trans_l)
{
PCursor<Translator*> trans_cur (trans_p_list_.find (trans_l));
- return trans_cur.remove_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;
+ return t;
}
}
void
-Translator_group::add_processing ()
+Translator_group::do_add_processing ()
{
- Translator::add_processing ();
for (int i=0; i < consists_str_arr_.size(); i++)
{
Translator * t = output_def_l ()->find_translator_l (consists_str_arr_[i]);
}
Translator::Translator (Translator const &s)
+ : Input (s)
{
status = ORPHAN;
daddy_trans_l_ =0;
void
Translator::add_processing ()
{
- if (status == ORPHAN)
- status = VIRGIN;
+ if (status > ORPHAN)
+ return;
+
+ do_add_processing ();
+ status = VIRGIN;
+}
+
+void
+Translator::do_add_processing ()
+{
}
void
#ifndef NPRINT
DOUT << name () << " {";
if (name () != type_str_)
- DOUT << "type= " << type_str_;
+ DOUT << "type = " << type_str_;
for (Dictionary_iter<Scalar> i (properties_dict_); i.ok (); i++)
{
DOUT << i.key () << "=" << i.val () <<"\n";
void
Translator::removal_processing()
{
+ if (status == ORPHAN)
+ return;
creation_processing();
do_removal_processing();
+ // elegancy ...
+ // status = ORPHAN;
}
Vertical_align_element::Vertical_align_element()
{
transparent_b_ = true;
- empty_b_ =true;
+ set_empty (true);
}
*mlog << "[" <<break_idx_i<<"]"<<flush;
breaking.push (minimum);
}
- print_stats();
return breaking;
}
Begin3
Title: LilyPond
-Version: 0.1.13
-Entered-date: 11SEP97
+Version: 0.1.14
+Entered-date: 14SEP97
Description: LilyPond is the GNU Project music typesetter. This
program converts music definition files into
visual or auditive output: it can typeset formatted
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.13.tar.gz
+ 395k lilypond-0.1.14.tar.gz
Original-site: pcnov095.win.tue.nl /pub/lilypond/
- 395k lilypond-0.1.13.tar.gz
+ 395k lilypond-0.1.14.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 0.1.13
+Version: 0.1.14
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.13.tar.gz
+Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.14.tar.gz
Summary: A preprocessor to make TeX typeset music.
URL: http://www.stack.nl/~hanwen/lilypond
Packager: Han-Wen Nienhuys <hanwen@stack.nl>
% A tex file to help determine dims.
%
-\font\musicfont=musix16
+\font\musicfont=opus20 %musix16
\font\slurfont=xslu16
\font\specfont=musixspx
\def\thefont{\musicfont}
\repeat%
}
\def\twhrul{\hbox to 0pt{\hbox{\hruler{20}%
- \vrule width0.1pt height 2pt depth 2pt}}}
+ \vrule width0.1pt height 2pt depth 2pt}}}
\def\twvrul{\vbox to0pt{\vss\hbox to0pt{\hss\vruler{12}}\vss}%
- \kern-1pt\vrule width4pt height 0.1pt}%
-
+ \kern-1pt\vrule width4pt height 0.1pt}%
+
\def\doitem#1{
#1%
\vbox to12pt{\vfill\hbox to0pt{\qquad\kern-1pt\twvrul\hss}}%
\hbox to50pt{\qquad\twhrul\mb{#1}\hss}%
- \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0}
+ \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0}
\newcount\n
\def\charn{\n=-1
--- /dev/null
+;;; mudela-mode.el --- Major mode for editing Mudela programs
+
+
+;; Copyright (C) 1992,1993,1994 Tim Peters
+
+;; Author: 1997: Han-Wen Nienhuys
+;; Author: 1995-1996 Barry A. Warsaw
+;; 1992-1994 Tim Peters
+;; Created: Feb 1992
+;; Version: 0.0
+;; Last Modified: 12SEP97
+;; Keywords: mudela languages music
+
+;; This software is provided as-is, without express or implied
+;; warranty. Permission to use, copy, modify, distribute or sell this
+;; software, without fee, for any purpose and by any individual or
+;; organization, is hereby granted, provided that the above copyright
+;; notice and this paragraph appear in all copies.
+
+
+
+;; Kyrie Eleison; it is my first real Elisp file
+;; This is a cannabalised version of python-mode.el (HWN)
+;;
+;; TODO:
+;; * should handle block comments too.
+;; * handle lexer modes (\header, \melodic, \lyric) etc.
+;; * indentation
+;; * notenames?
+;; * fontlock: \melodic \melodic
+
+(defconst mudela-font-lock-keywords
+ (let* ((keywords '(
+ "accepts" "bar" "cadenza" "clear" "clef" "cm" "consists" "contains"
+ "duration" "absdynamic" "in" "translator" "type" "lyric" "key"
+ "melodic" "melodic_request" "meter" "midi" "mm" "multi" "header"
+ "notenames" "octave" "output" "partial" "paper" "plet" "property" "pt"
+ "include"
+ "score" "script" "skip" "staff" "table" "spandynamic" "symboltables"
+ "tempo" "texid" "textstyle" "transpose" "version" "grouping"
+ ))
+ (kwregex (mapconcat (lambda (x) (concat "\\\\" x)) keywords "\\|")))
+
+ (list
+ (cons (concat ".\\(" kwregex "\\)[^a-zA-Z]") 1)
+ (cons (concat "^\\(" kwregex "\\)[^a-zA-Z]") 1)
+ '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
+ '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)
+ ))
+ "Additional expressions to highlight in Mudela mode.")
+
+;; define a mode-specific abbrev table for those who use such things
+(defvar mudela-mode-abbrev-table nil
+ "Abbrev table in use in `mudela-mode' buffers.")
+
+(define-abbrev-table 'mudela-mode-abbrev-table nil)
+
+(defvar mudela-mode-hook nil
+ "*Hook called by `mudela-mode'.")
+
+(defvar mu-mode-map ()
+ "Keymap used in `mudela-mode' buffers.")
+
+(defun mu-newline-and-indent ()
+ (interactive)
+ (newline)
+ (indent-relative-maybe)
+ "Newline and copy previous indentation")
+
+(if mu-mode-map
+ ()
+ (setq mu-mode-map (make-sparse-keymap))
+
+ (mapcar (function (lambda (key)
+ (define-key
+ mu-mode-map key 'mu-newline-and-indent)))
+ (where-is-internal 'newline-and-indent))
+
+ (mapcar (function
+ (lambda (x)
+ (define-key mu-mode-map (car x) (cdr x))))
+ '(("\C-c\C-c" . mu-foo-bar)
+ ))
+ ;; should do all keybindings this way
+ (define-key mu-mode-map [RET] 'mu-newline-and-indent)
+ )
+
+(defvar mu-mode-syntax-table nil
+ "Syntax table used in `mudela-mode' buffers.")
+
+;;
+(if mu-mode-syntax-table
+ ()
+ (setq mu-mode-syntax-table (make-syntax-table))
+ (mapcar (function
+ (lambda (x) (modify-syntax-entry
+ (car x) (cdr x) mu-mode-syntax-table)))
+ '(( ?\( . "()" ) ( ?\) . ")(" )
+ ( ?\[ . "(]" ) ( ?\] . ")[" )
+ ( ?\{ . "(}" ) ( ?\} . "){" )
+ ( ?\< . "(>" )( ?\> . ")>")
+ ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." )
+ ( ?\* . "." ) ( ?\+ . "." ) ( ?\- . "." )
+ ( ?\/ . "." ) ( ?\= . "." )
+ ( ?\| . "." ) (?\\ . "\\" )
+ ( ?\_ . "." )
+ ( ?\' . "w")
+ ( ?\" . "\"" )
+ ( ?\% . "<")
+ ( ?\n . ">")
+
+ )))
+
+(defconst mu-stringlit-re
+ "\"\\([^\"\n\\]\\|\\\\.\\)*\"" ; double-quoted
+ "Regexp matching a Mudela string literal.")
+
+
+(defconst mu-blank-or-comment-re "[ \t]*\\($\\|%\\)"
+ "Regexp matching blank or comment lines.")
+
+(defconst mu-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
+ "Regexp matching Identifier definitions.")
+
+;; Sadly we need this for a macro in Emacs 19.
+(eval-when-compile
+ ;; Imenu isn't used in XEmacs, so just ignore load errors.
+ (condition-case ()
+ (require 'imenu)
+ (error nil)))
+
+(defvar mu-imenu-generic-expression
+ (list (list nil mu-imenu-generic-re 1))
+ "Expression for imenu")
+
+(defun mudela-mode ()
+ "Major mode for editing Mudela files."
+
+ (interactive)
+ ;; set up local variables
+ (kill-all-local-variables)
+ (make-local-variable 'font-lock-defaults)
+ (make-local-variable 'paragraph-separate)
+ (make-local-variable 'paragraph-start)
+ (make-local-variable 'require-final-newline)
+ (make-local-variable 'comment-start)
+ (setq comment-start "% ")
+ (setq comment-end "")
+ (make-local-variable 'comment-end)
+ (make-local-variable 'comment-start-skip)
+ (setf comment-start-skip "%{")
+ (make-local-variable 'comment-column)
+ (make-local-variable 'imenu-generic-expression)
+ (setq imenu-generic-expression mu-imenu-generic-expression)
+ (make-local-variable 'indent-line-function)
+
+ ;;
+ (set-syntax-table mu-mode-syntax-table)
+ (setq major-mode 'mudela-mode
+ mode-name "Mudela"
+ local-abbrev-table mudela-mode-abbrev-table
+ font-lock-defaults '(mudela-font-lock-keywords)
+ paragraph-separate "^[ \t]*$"
+ paragraph-start "^[ \t]*$"
+ require-final-newline t
+ comment-start "% "
+ comment-start-skip "% *"
+ comment-column 40
+ indent-line-function 'indent-relative-maybe
+ )
+ (use-local-map mu-mode-map)
+
+ ;; run the mode hook. mu-mode-hook use is deprecated
+ (if mudela-mode-hook
+ (run-hooks 'mudela-mode-hook)
+ (run-hooks 'mu-mode-hook)))
+
+(defun mu-keep-region-active ()
+ ;; do whatever is necessary to keep the region active in XEmacs.
+ ;; Ignore byte-compiler warnings you might see. Also note that
+ ;; FSF's Emacs 19 does it differently and doesn't its policy doesn't
+ ;; require us to take explicit action.
+ (and (boundp 'zmacs-region-stays)
+ (setq zmacs-region-stays t)))
+
+
+(defun mu-comment-region (beg end &optional arg)
+ "Like `comment-region' but uses double hash (`#') comment starter."
+ (interactive "r\nP")
+ (let ((comment-start mu-block-comment-prefix))
+ (comment-region beg end arg)))
+\f
+(defconst mu-version "0.0"
+ "`mudela-mode' version number.")
+(defconst mu-help-address "hanwen@stack.nl"
+ "Address accepting submission of bug reports.")
+
+(defun mu-version ()
+ "Echo the current version of `mudela-mode' in the minibuffer."
+ (interactive)
+ (message "Using `mudela-mode' version %s" mu-version)
+ (mu-keep-region-active))
+
+(provide 'mu-mode)
+;;; mudela-mode.el ends here
\def\kdynf{\dynnf}
\def\kdynp{\dynp\kern-.1ex}
-\def\dynf{\dynaf}
-\def\dynpp{\kdynp\dynp}
-\def\dynppp{\kdynp\kdynp\dynp}
-\def\dynmp{\dynm\kern -.2ex\dynp}
-\def\dynmf{\dynfont\raise.08ex\hbox{\dynm}\kern-.3ex\dynnf}
-\def\dynff{\kdynf\dynnf}
-\def\dynfff{\kdynf\kdynf\dynnf}
+\def\dynf{{\dynaf}}
+\def\dynpp{{\kdynp\dynp}}
+\def\dynppp{{\kdynp\kdynp\dynp}}
+\def\dynmp{{\dynm\kern -.2ex\dynp}}
+\def\dynmf{{\dynfont\raise.08ex\hbox{\dynm}\kern-.3ex\dynnf}}
+\def\dynff{{\kdynf\dynnf}}
+\def\dynfff{{\kdynf\kdynf\dynnf}}
-\def\dynfp{\kdynf\dynp}
-\def\dynsf{\dyns\kern-.3ex\dynnf}
-\def\dynsfz{\dynsf\dynz}
+\def\dynfp{{\kdynf\dynp}}
+\def\dynsf{{\dyns\kern-.3ex\dynnf}}
+\def\dynsfz{{\dynsf\dynz}}
}
\def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
-\def\textflat{\raise.4ex\hbox{\textmusic\char"5B}}
-\def\flt{\raise.2ex\hbox{\mus\char"5B}}
+\def\textflat{\raise.2ex\hbox{\mus\char"5B}}
+
\font\musicfnt=musix20
\font\musicdraw=musixsps
\font\italicfont=cmti10
- \font\dynfont=dyn10% scaled \magstep2
+ \font\dynfont=dyn10 scaled \magstep2
\font\musicmathfont=cmsy10
}
\font\hslurdfont=xslhd16
\font\hslurhfont=xslhz20
\font\musicfnt=musix16
- \font\dynfont=dyn10% scaled \magstep1
+ \font\dynfont=dyn10 scaled \magstep1
\font\musicdraw=musixsps
\font\musicmathfont=cmsy8
}