From 9f88b957750d767f2230004a4bf2d4eccca7decf Mon Sep 17 00:00:00 2001 From: Mats Bengtsson Date: Sat, 17 Oct 1998 23:32:40 +0200 Subject: [PATCH] patch::: 1.0.16.mb1: Re: LilyPond 1.0.16 pl 16.mb1 - bf: No unnecessary warnings about time signatures - \major and \minor affects how all subsequent key signatures are interpreted. - Parser support for cautionary accidentals, i.e. accidentals within parantheses. Syntax: cis? The main part of the implementation is still missing. --- Generated by (address unknown) using package-diff 0.62, >From = lilypond-1.0.16, To = lilypond-1.0.16.mb1 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.0.16.mb1.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure and possibly make outdirs. --state 1.0.16 1.0.16.mb1 ++state --- Documentation/tex/refman.yo | 22 +- Documentation/tex/tutorial.yo | 8 +- NEWS | 15 +- TODO | 1 - VERSION | 2 +- init/property.ly | 12 + input/test/keys.ly | 4 +- input/test/time.fly | 2 + lily/include/lookup.hh | 4 +- lily/include/musical-request.hh | 2 + lily/include/ps-lookup.hh | 2 +- lily/include/ps-lookup.hh.orig | 39 + lily/include/tex-lookup.hh | 2 +- lily/include/tex-lookup.hh.orig | 42 + lily/key-engraver.cc | 9 +- lily/local-key-engraver.cc | 6 + lily/lookup.cc | 8 +- lily/lookup.cc.orig | 422 +++++++++ lily/musical-request.cc | 7 +- lily/parser.yy | 4 + lily/parser.yy.orig | 1504 +++++++++++++++++++++++++++++++ lily/ps-lookup.cc | 4 +- lily/tex-lookup.cc | 4 +- make/STATE-VECTOR | 1 + mutopia/gallina.ly | 63 +- 25 files changed, 2137 insertions(+), 52 deletions(-) create mode 100644 lily/include/ps-lookup.hh.orig create mode 100644 lily/include/tex-lookup.hh.orig create mode 100644 lily/lookup.cc.orig create mode 100644 lily/parser.yy.orig diff --git a/Documentation/tex/refman.yo b/Documentation/tex/refman.yo index ae08ad2d24..5331fe1269 100644 --- a/Documentation/tex/refman.yo +++ b/Documentation/tex/refman.yo @@ -952,7 +952,10 @@ file(.ly) extension must be given, and the filename must be quoted. (An unquoted string will not work here.) dit(code(\key) var(pitch)code(;)) Change key signature to that of -var(pitch)-major. +var(pitch)-major. The predefined identifiers code(\major) and +code(\minor) decide if all subsequent code(\key) commands are given in +major or minor, respectively. + dit(code(\keysignature) var(pitchseq)code(;)) Specify an arbitrary key signature. The pitches from var(pitch) will @@ -1296,7 +1299,10 @@ dit(code(defaultBarType)) Sets the default type of bar line. See code(\bar) keyword. - +dit(code(keymodality)) The number of semitones that should be added to +the pitch given in the subsequent code(\key) commands to get the +corresponding major key, e.g. minor keys are specified by +code(keymodality=3). Is set by code(\major) and code(\minor). dit(code(keyoctaviation)) If set to 1, then keys are the same in all octaves. If set to 0 then the key signature for different octaves can @@ -1323,16 +1329,16 @@ default) if you do not want key signatures printed. dit(code(timeSignatureStyle)) Changes the default two-digit layout for time signatures. The following values are recognized: description( - dit(code(C)): 4/4 and 2/2 are typeset as C and struck C, + dit(code(C)) 4/4 and 2/2 are typeset as C and struck C, respectively. All other time signatures are written with two digits. - dit(code(old)): 2/2, 3/2, 3/4, 4/4, 6/4 and 9/4 are typeset with + dit(code(old)) 2/2, 3/2, 3/4, 4/4, 6/4 and 9/4 are typeset with old-style mensuration marks. All other time signatures are written with two digits. - dit(code(1)): All time signatures are typeset with a single + dit(code(1)) All time signatures are typeset with a single digit, e.g. 3/2 is written as 3. dit(code(C2/2), code(C4/4), code(old2/2), code(old3/2), code(old3/4), code(old4/4), code(old6/4) or - code(old9/4)): Tells Lilypond to use a specific symbol as time + code(old9/4)) Tells Lilypond to use a specific symbol as time signature. ) The different time signature characters are shown below with @@ -1439,6 +1445,10 @@ code(castingalgorithm). Is equal to 1.0. dit(code(\infinity)) Used for setting the Score.beamslopedamping property. Is actually equal to 10000. dit(code(\left)) Used for setting textalignment property. Is equal to -1. +dit(code(\major)) All subsequent code(\key) commands are interpreted +as major keys. +dit(code(\minor)) All subsequent code(\key) commands are interpreted +as minor keys. dit(code(\mf)) Print mezzoforte symbol on preceeding note. dit(code(\mp)) Print mezzopiano symbol on preceeding note. dit(code(\nobreak)) Prevent a line break in music by using a large diff --git a/Documentation/tex/tutorial.yo b/Documentation/tex/tutorial.yo index 02bdaaf9a3..2ab0846829 100644 --- a/Documentation/tex/tutorial.yo +++ b/Documentation/tex/tutorial.yo @@ -697,9 +697,11 @@ dit(code(\clef) var(clefname)) This command sets the current clef for notation, \clef "alto"; c'4 ) dit(code(\key) var(pitch)) This command changes the current key signature. The - key signature is printed at the start of every line. The argument - is the name of the corresponding major key. The key of C-minor can - thus be specified as `code(\key es)'. + key signature is printed at the start of every line. The identifiers + code(\major) and code(\minor) can be used to decide if all the + subsequent code(\key) commands are major or minor, respectively. + The default is major keys. The key of C-minor can + thus be specified as `code(\key es)' or `code(\minor \key c)'. dit(code(\keysignature) var(pitchlist)) diff --git a/NEWS b/NEWS index 2dd704fb08..53ffde5b77 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,17 @@ -pl 16.jcn1 +--- ../lilypond-1.0.16/NEWS Wed Oct 14 15:44:20 1998 +++ b/NEWS Sat Oct 17 22:49:37 1998 +@@ -1,3 +1,11 @@ +pl 16.mb1 + - bf: No unnecessary warnings about time signatures + - \major and \minor affects how all subsequent key signatures + are interpreted. + - Parser support for cautionary accidentals, i.e. accidentals + within parantheses. Syntax: cis? The main part of the + implementation is still missing. + + pl 16 + - read property ydirection and tieYDirection for tie direction. + - bf: slur over rest.pl 16.jcn1 - dashed-slur through scheme pl 15.jcn4 diff --git a/TODO b/TODO index 79b6623e1a..d6bef869f2 100644 --- a/TODO +++ b/TODO @@ -531,7 +531,6 @@ PROJECTS * Keys: - merge key{item} & localkey{item}? - - Major/Minor - spacing, national styles? * Support for TAB diff --git a/VERSION b/VERSION index b9c75efb2e..414f826013 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=0 PATCH_LEVEL=16 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=mb1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/init/property.ly b/init/property.ly index 4ab97b920f..5722c69cc0 100644 --- a/init/property.ly +++ b/init/property.ly @@ -48,6 +48,11 @@ beamquantisation 2 quantise avoide wedge2) \beampostraditional keyoctaviation 0 Key signature only for specified octave \specialkey keyoctaviation 1 Key signature for all octaves \normalkey +keymodality 0 Major key \major +keymodality 3 Minor key \minor +keymodality n modality n half tones from the major key + + timeSignatureStyle C Use C and stroked C for 4/4,2/2 timeSignatureStyle old Use old style mensuration marks timeSignatureStyle 1 Use single number @@ -271,3 +276,10 @@ specialkey = { \property Staff.keyoctaviation = 0 } +major = { + \property Staff.keymodality = 0 +} + +minor = { + \property Staff.keymodality = 3 +} diff --git a/input/test/keys.ly b/input/test/keys.ly index 211c7c1e20..e4bc5c9321 100644 --- a/input/test/keys.ly +++ b/input/test/keys.ly @@ -6,8 +6,8 @@ test key itemv breaking \score { \notes { - \key bes; c1 \key c; c1 + \key bes; c1 \minor \key c; c1 \break - \key bes; c1 \key d;\break c1 + \major \key bes; c1 \key d;\break c1 } } diff --git a/input/test/time.fly b/input/test/time.fly index 3908c4cf64..03076b7ef0 100644 --- a/input/test/time.fly +++ b/input/test/time.fly @@ -1,3 +1,5 @@ +\version "1.0.7"; + \property Staff.timeSignatureStyle = "C" \time 1/1; c''1^"timeSignatureStyle = \"C\"" | diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 493b1b735e..ab761ac955 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -31,8 +31,8 @@ public: Atom accidental (int) const; void add (String, Symtable*); - virtual Atom afm_find (String s) const = 0; - Atom afm_find (String, String) const; + virtual Atom afm_find (String s, bool warn=true) const = 0; + Atom afm_find (String, String, bool warn=true) const; virtual Atom* atom_p (String, int, Box) const = 0; Atom ball (int) const; Atom bar (String, Real height) const; diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 2f3c3f599c..e03a3e8646 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -129,6 +129,8 @@ public: /// force/supress printing of accidental. bool forceacc_b_; + /// Cautionary, i.e. parenthesized accidental. + bool cautionary_b_; Note_req(); bool do_equal_b (Request*) const; Rhythmic_req* access_Rhythmic_req () { return Rhythmic_req::access_Rhythmic_req (); } diff --git a/lily/include/ps-lookup.hh b/lily/include/ps-lookup.hh index 0b6481be6d..99a14a9fa0 100644 --- a/lily/include/ps-lookup.hh +++ b/lily/include/ps-lookup.hh @@ -19,7 +19,7 @@ public: Ps_lookup (Symtables const& s); virtual ~Ps_lookup (); - virtual Atom afm_find (String s) const; + virtual Atom afm_find (String s, bool warn=false) const; virtual Atom* atom_p (String, int, Box) const; virtual String character_str (int i) const; virtual Atom hairpin (Real width, bool decresc, bool continued) const; diff --git a/lily/include/ps-lookup.hh.orig b/lily/include/ps-lookup.hh.orig new file mode 100644 index 0000000000..0b6481be6d --- /dev/null +++ b/lily/include/ps-lookup.hh.orig @@ -0,0 +1,39 @@ +/* + tex-lookup.hh -- declare Tex_lookup + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Jan Nieuwenhuizen +*/ + +#ifndef PS_LOOKUP_HH +#define PS_LOOKUP_HH + +#include "lookup.hh" + +class Ps_lookup : public Lookup +{ +public: + Ps_lookup (); + Ps_lookup (Lookup const& s); + Ps_lookup (Symtables const& s); + virtual ~Ps_lookup (); + + virtual Atom afm_find (String s) const; + virtual Atom* atom_p (String, int, Box) const; + virtual String character_str (int i) const; + virtual Atom hairpin (Real width, bool decresc, bool continued) const; + virtual Lookup* lookup_p (Lookup const&) const; + virtual Lookup* lookup_p (Symtables const&) const; + virtual Paper_outputter* paper_outputter_p (Paper_stream*, Paper_def*, Scope*, String) const; + virtual Paper_stream* paper_stream_p () const; + virtual Atom plet (Real dy , Real dx, Direction dir) const; + virtual Atom ps_beam (Real slope, Real width, Real thick) const; + virtual Atom slur (Array controls) const; + virtual Atom stem (Real y1, Real y2) const; + virtual Atom text (String style, String text) const; + virtual String unknown_str () const; + virtual Atom vbracket (Real &y) const; +}; + +#endif // PS_LOOKUP_HH diff --git a/lily/include/tex-lookup.hh b/lily/include/tex-lookup.hh index 2341c4484c..5f812088af 100644 --- a/lily/include/tex-lookup.hh +++ b/lily/include/tex-lookup.hh @@ -20,7 +20,7 @@ public: Tex_lookup (Symtables const& s); virtual ~Tex_lookup(); - virtual Atom afm_find (String s) const; + virtual Atom afm_find (String s, bool warn=false) const; virtual String character_str (int i) const; virtual Atom* atom_p (String, int, Box) const; Atom embed (Atom a) const; diff --git a/lily/include/tex-lookup.hh.orig b/lily/include/tex-lookup.hh.orig new file mode 100644 index 0000000000..2341c4484c --- /dev/null +++ b/lily/include/tex-lookup.hh.orig @@ -0,0 +1,42 @@ +/* + tex-lookup.hh -- declare Tex_lookup + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Han-Wen Nienhuys + Jan Nieuwenhuizen +*/ + +#ifndef TEX_LOOKUP_HH +#define TEX_LOOKUP_HH + +#include "ps-lookup.hh" + +class Tex_lookup : public Ps_lookup +{ +public: + Tex_lookup (); + Tex_lookup (Lookup const& s); + Tex_lookup (Symtables const& s); + virtual ~Tex_lookup(); + + virtual Atom afm_find (String s) const; + virtual String character_str (int i) const; + virtual Atom* atom_p (String, int, Box) const; + Atom embed (Atom a) const; + virtual Atom hairpin (Real width, bool decresc, bool continued) const; + virtual Lookup* lookup_p (Lookup const&) const; + virtual Lookup* lookup_p (Symtables const&) const; + virtual Paper_outputter* paper_outputter_p (Paper_stream*, Paper_def*, Scope*, String) const; + virtual Paper_stream* paper_stream_p () const; + virtual Atom plet (Real dy , Real dx, Direction dir) const; + virtual String print_dimen (Real) const; + virtual Atom ps_beam (Real slope, Real width, Real thick) const; + virtual Atom slur (Array controls) const; + virtual Atom stem (Real y1, Real y2) const; + virtual Atom text (String style, String text) const; + virtual String unknown_str () const; + virtual Atom vbracket (Real &y) const; +}; + +#endif // TEX_LOOKUP_HH diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index be1cedace1..e06bb1d63d 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -95,6 +95,7 @@ Key_engraver::do_pre_move_processing () void Key_engraver::read_req (Key_change_req const * r) { + int modality=0; old_accidental_idx_arr_ = accidental_idx_arr_; key_.clear (); Scalar prop = get_property ("keyoctaviation"); @@ -102,6 +103,11 @@ Key_engraver::read_req (Key_change_req const * r) { key_.multi_octave_b_ = ! prop.to_bool (); } + prop = get_property ("keymodality"); + if (prop.isnum_b ()) + { + modality=(int)prop; + } accidental_idx_arr_.clear (); @@ -116,8 +122,7 @@ Key_engraver::read_req (Key_change_req const * r) else { p = r->pitch_arr_[0].semitone_pitch (); - if (r->minor_b ()) - p += 3; + p += modality; } /* Solve the equation 7*no_of_acc mod 12 = p, -6 <= no_of_acc <= 5 */ int no_of_acc = (7*p) % 12; diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index c6a3a07189..a74b27d79e 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -67,6 +67,12 @@ Local_key_engraver::process_acknowledged () key_item_p_ = new Local_key_item; announce_element (Score_element_info (key_item_p_, 0)); } + ///////// TODO: Handle cautionary accidentals + if (note_l->cautionary_b_) + { + warning (_("cautionary accidentals are not yet supported")); + } + key_item_p_->add (note_l->pitch_); key_item_p_->add_support (support_l); local_key_.set (note_l->pitch_); diff --git a/lily/lookup.cc b/lily/lookup.cc index 7f67472b14..07e7e63ca4 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -66,7 +66,7 @@ Lookup::add (String s, Symtable*p) } Atom -Lookup::afm_find (String s, String str) const +Lookup::afm_find (String s, String str, bool warn) const { if (!afm_p_) { @@ -75,7 +75,7 @@ Lookup::afm_find (String s, String str) const *mlog << "]" << flush ; DOUT << this->afm_p_->str (); } - Adobe_font_char_metric m = afm_p_->find_char (s); + Adobe_font_char_metric m = afm_p_->find_char (s, warn); Atom a; if (m.code () < 0) @@ -282,11 +282,11 @@ Atom Lookup::special_time_signature (String s, Array arr) const { String symbolname = "timesig-"+s+"%/%"; - Atom a (afm_find (substitute_args (symbolname, arr))); + Atom a (afm_find (substitute_args (symbolname, arr), false)); if (!a.empty ()) return a; // Try if the full name was given - a = afm_find ("timesig-"+s); + a = afm_find ("timesig-"+s, false); if (!a.empty ()) return a; // Resort to default layout with numbers diff --git a/lily/lookup.cc.orig b/lily/lookup.cc.orig new file mode 100644 index 0000000000..7f67472b14 --- /dev/null +++ b/lily/lookup.cc.orig @@ -0,0 +1,422 @@ +/* + lookup.cc -- implement simple Lookup methods. + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Han-Wen Nienhuys + + Jan Nieuwenhuizen + + TODO + Read spacing info from AFMs + Glissando +*/ + +#include "lookup.hh" +#include "debug.hh" +#include "dimensions.hh" +#include "symtable.hh" +#include "scalar.hh" +#include "paper-def.hh" +#include "string-convert.hh" +#include "main.hh" +#include "lily-guile.hh" + +Lookup::Lookup () +{ + paper_l_ = 0; + symtables_p_ = new Symtables; + afm_p_ =0; +} + +Lookup::Lookup (Lookup const& s) +{ + font_ = s.font_; + font_path_ = s.font_path_; + paper_l_ = s.paper_l_; + symtables_p_ = new Symtables (*s.symtables_p_); + afm_p_ = 0; +} + +Lookup::Lookup (Symtables const& s) +{ + font_ = s.font_; + font_path_ = s.font_path_; + paper_l_ = 0; + symtables_p_ = new Symtables (s); + afm_p_ = 0; +} + +Lookup::~Lookup () +{ + delete afm_p_; + delete symtables_p_; +} + +Atom +Lookup::accidental (int j) const +{ + return afm_find (String ("accidentals") + String ("-") + to_str (j)); +} + +void +Lookup::add (String s, Symtable*p) +{ + symtables_p_->add (s, p); +} + +Atom +Lookup::afm_find (String s, String str) const +{ + if (!afm_p_) + { + *mlog << "[" << font_path_; + ( (Lookup*)this)->afm_p_ = new Adobe_font_metric (read_afm (font_path_)); + *mlog << "]" << flush ; + DOUT << this->afm_p_->str (); + } + Adobe_font_char_metric m = afm_p_->find_char (s); + + Atom a; + if (m.code () < 0) + return a; + + a.dim_ = m.B_; + a.dim_[X_AXIS] *= 1 / 1000.0; + a.dim_[Y_AXIS] *= 1 / 1000.0; + a.str_ = String_convert::form_str (str.ch_C (), m.code ()); + a.font_ = font_; + return a; +} + +Atom +Lookup::ball (int j) const +{ + if (j > 2) + j = 2; + + return afm_find (String ("balls") + String ("-") + to_str (j)); +} + +Atom +Lookup::bar (String str, Real h) const +{ + Array a; + a.push (print_dimen (h)); + Atom s = (*symtables_p_) ("bars")->lookup (str); + s.str_ = substitute_args (s.str_, a); + s.dim_.y () = Interval (-h/2, h/2); + s.font_ = font_; + return s; +} + +String +Lookup::base_output_str () const +{ + assert (paper_l_); + String str = paper_l_->get_default_output (); + + if (str.empty_b ()) + { + str = default_outname_base_global; + int def = paper_l_->get_next_default_count (); + if (def) + str += "-" + to_str (def); + } + return str; +} + +Atom +Lookup::beam (Real slope, Real width, Real thick) const +{ + Atom a (ps_beam (slope, width, thick)); + Real height = slope * width; + Real min_y = (0 ? height) + thick/2; + + a.dim_[X_AXIS] = Interval (0, width); + a.dim_[Y_AXIS] = Interval (min_y, max_y); + return a; +} + +String +Lookup::character_str (int i) const +{ + return to_str (i); +} + +Atom +Lookup::clef (String st) const +{ + return afm_find (String ("clefs") + String ("-") + st); +} + +Atom +Lookup::dashed_slur (Array controls, Real thick, Real dash) const +{ + assert (controls.size () == 8); + + Real dx = controls[3].x () - controls[0].x (); + Real dy = controls[3].y () - controls[0].y (); + + Atom a; + a.font_ = font_; + a.dim_[X_AXIS] = Interval (0, dx); + a.dim_[Y_AXIS] = Interval (0 ? dy); + +#ifndef HAVE_LIBGUILE + + String ps; + for (int i = 1; i < 4; i++) + ps += String_convert::double_str (controls[i].x ()) + " " + + String_convert::double_str (controls[i].y ()) + " "; + + ps += String_convert::double_str (controls[0].x ()) + " " + + String_convert::double_str (controls[0].y ()) + " "; + + ps += String_convert::double_str (thick) + " "; + Real on = dash > 1? thick * dash - thick : 0; + Real off = 2 * thick; + ps += "[" + String_convert::double_str (on) + " "; + ps += String_convert::double_str (off) + "] "; + ps += String_convert::int_str (0) + " "; + ps += "draw_dashed_slur "; + + a.str_ = ps; + +#else // HAVE_LIBGUILE + + // (lambda (o) (dashed-slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2)))) + a.lambda_ = + gh_append (gh_lambda_o (), + gh_list1 (gh_append (gh_func_o ("dashed-slur"), + gh_cons (gh_double2scm (thick), gh_cons (gh_double2scm (dash), + gh_list1 (gh_list2 (gh_quote (), + gh_cons (gh_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), + gh_cons (gh_list2 (gh_double2scm (controls[1].x ()), gh_double2scm (controls[1].y ())), + gh_cons (gh_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), + gh_cons (gh_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), + SCM_EOL))))))))))); + +#endif // HAVE_LIBGUILE + + return a; +} + +Atom +Lookup::dots () const +{ + return afm_find (String ("dots") + String ("-") + String ("dot")); +} + +Atom +Lookup::dynamic (String st) const +{ + return (*symtables_p_) ("dynamics")->lookup (st); +} + +Atom +Lookup::fill (Box b) const +{ + Atom a; + a.dim_ = b; + return a; +} + +Atom +Lookup::flag (int j, Direction d) const +{ + char c = (d == UP) ? 'u' : 'd'; + return afm_find (String ("flags") + String ("-") + to_str (c) + to_str (j)); +} + +void +Lookup::print () const +{ +#ifndef NPRINT + DOUT << "Lookup {\n"; + symtables_p_->print (); + DOUT << "}\n"; +#endif +} + +String +Lookup::print_dimen (Real r) const +{ + String s = to_str (r, "%.3f"); + if (s.index_i ("NaN") != -1) + { + warning (_ ("NaN")); + s = "0.0"; + } + return s; +} + +Atom +Lookup::rest (int j, bool o) const +{ + return afm_find (String ("rests") + + String ("-") + to_str (j) + (o ? "o" : "")); +} + +Atom +Lookup::rule_symbol (Real height, Real width) const +{ + Atom bs= (*symtables_p_) ("param")->lookup ("rule"); + Array args; + args.push (print_dimen (height)); + args.push (print_dimen (width)); + bs.str_ = substitute_args (bs.str_, args); + bs.dim_.x () = Interval (0, width); + bs.dim_.y () = Interval (0, height); + return bs; +} + +Atom +Lookup::script (String str) const +{ + return afm_find (String ("scripts") + String ("-") + str); +} + +Atom +Lookup::special_time_signature (String s, Array arr) const +{ + String symbolname = "timesig-"+s+"%/%"; + Atom a (afm_find (substitute_args (symbolname, arr))); + if (!a.empty ()) + return a; + // Try if the full name was given + a = afm_find ("timesig-"+s); + if (!a.empty ()) + return a; + // Resort to default layout with numbers + return time_signature (arr); +} + +static void +substitute_arg (String& r, String arg) +{ + int p = r.index_i ('%'); + if (p < 0) + return ; + + r = r.left_str (p) + arg + r.right_str (r.length_i () - p - 1); +} + +String +Lookup::substitute_args (String source, Array args) const +{ + String str (source); + for (int i = 0 ; i < args.size (); i++) + substitute_arg (str, args[i]); + return str; +} + +String +Lookup::substitute_args (String source, Array args) const +{ + Array sv; + for (int i = 0 ; i < args.size (); i++) + sv.push (args[i]); + return substitute_args (source, sv); +} + +Atom +Lookup::stem (Real y1, Real y2, String str) const +{ + if (y1 > y2) + { + Real t = y1; + y1 = y2; + y2 = t; + } + Atom s; + + s.dim_.x () = Interval (0,0); + s.dim_.y () = Interval (y1,y2); + + Array a; + + Real stem_width = paper_l_->get_var ("stemthickness"); + a.push (print_dimen (-stem_width /2)); + a.push (print_dimen (stem_width)); + a.push (print_dimen (y2)); + a.push (print_dimen (-y1)); + + s.str_ = substitute_args (str, a); + s.font_ = font_; + return s; +} + +Atom +Lookup::streepje (int type) const +{ + if (type > 2) + type = 2; + + return afm_find ("balls" + String ("-") +to_str (type) + "l"); +} + +Atom +Lookup::text (String style, String text) const +{ + Array a; + + a.push (text); + Atom s = (*symtables_p_) ("style")->lookup (style); + s.str_ = substitute_args (s.str_,a); + s.font_ = font_; + + return s; +} + +Atom +Lookup::time_signature (Array a) const +{ + Atom s ((*symtables_p_) ("param")->lookup ("time_signature")); + s.str_ = substitute_args (s.str_, a); + + return s; +} + +/* + should be handled via Tex_ code and Lookup::bar () + */ +Atom +Lookup::vbrace (Real &y) const +{ + Atom brace = (*symtables_p_) ("param")->lookup ( "brace"); + Interval ydims = brace.dim_[Y_AXIS]; + Real min_y = ydims[LEFT]; + Real max_y = ydims[RIGHT]; + Real step = 1.0 PT; + + if (y < min_y) + { + warning (_ ("piano brace") + + " " + _ ("too small") + " (" + print_dimen (y) + ")"); + y = min_y; + } + if (y > max_y) + { + warning (_ ("piano brace") + + " " + _ ("too big") + " (" + print_dimen (y) + ")"); + y = max_y; + } + + + int idx = int (rint ( (y- min_y)/step)) + 1; + + { + Array a; + a.push (character_str (idx)); + brace.str_ = substitute_args (brace.str_,a); + brace.dim_[Y_AXIS] = Interval (-y/2,y/2); + } + + brace.font_ = font_; + + return brace; +} + + diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 3ee6004add..dd7da312df 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -184,6 +184,7 @@ Note_req::do_equal_b (Request*r) const Note_req::Note_req () { + cautionary_b_ = false; forceacc_b_ = false; } @@ -194,7 +195,11 @@ Note_req::do_print () const { #ifndef NPRINT Melodic_req::do_print (); - if (forceacc_b_) + if (cautionary_b_) + { + DOUT << " force cautionary accidental\n"; + } + else if (forceacc_b_) { DOUT << " force accidental\n"; } diff --git a/lily/parser.yy b/lily/parser.yy index c73b8b812b..1c254c8227 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1031,6 +1031,10 @@ steno_notepitch: | steno_notepitch '!' { $$->forceacc_b_ = ! $$->forceacc_b_; } + | steno_notepitch '?' { + $$->forceacc_b_ = ! $$->forceacc_b_; + $$->cautionary_b_ = ! $$->cautionary_b_; + } ; diff --git a/lily/parser.yy.orig b/lily/parser.yy.orig new file mode 100644 index 0000000000..c73b8b812b --- /dev/null +++ b/lily/parser.yy.orig @@ -0,0 +1,1504 @@ +%{ // -*-Fundamental-*- + +/* + parser.yy -- Bison/C++ parser for mudela + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys + Jan Nieuwenhuizen +*/ + +#include +#include "lily-guile.hh" +#include "notename-table.hh" +#include "scalar.hh" +#include "translation-property.hh" +#include "script-def.hh" +#include "symtable.hh" +#include "lookup.hh" +#include "ps-lookup.hh" +#include "tex-lookup.hh" +#include "misc.hh" +#include "my-lily-lexer.hh" +#include "paper-def.hh" +#include "midi-def.hh" +#include "main.hh" +#include "file-path.hh" +#include "keyword.hh" +#include "debug.hh" +#include "parseconstruct.hh" +#include "dimensions.hh" +#include "identifier.hh" +#include "command-request.hh" +#include "musical-request.hh" +#include "my-lily-parser.hh" +#include "text-def.hh" +#include "translator-group.hh" +#include "score.hh" +#include "music-list.hh" +#include "duration-convert.hh" +#include "change-translator.hh" +#include "file-results.hh" +#include "mudela-version.hh" +#include "scope.hh" +#include "relative-music.hh" +#include "transposed-music.hh" +#include "compressed-music.hh" + +// mmm +Mudela_version oldest_version ("1.0.7"); +Mudela_version version ("1.0.8"); + + +// needed for bison.simple's malloc() and free() +#include + +int const GUESS_PLET = 5; +int guess_plet_a[GUESS_PLET] = +{ + 1, + 3, + 2, + 3, + 4 +}; + +struct Assignment { + String *name_p_; + Identifier *id_p_; + ~Assignment () { + delete name_p_; + delete id_p_; + } + Assignment () { + name_p_ = 0; + id_p_ =0; + } + Assignment (Assignment const&s) + { + name_p_ = new String (*s.name_p_); + id_p_ = s.id_p_->clone (); + } +}; + +Paper_def* current_paper = 0; + +#ifndef NDEBUG +#define YYDEBUG 1 +#endif + +#define YYERROR_VERBOSE 1 + +#define YYPARSE_PARAM my_lily_parser_l +#define YYLEX_PARAM my_lily_parser_l +#define THIS ((My_lily_parser *) my_lily_parser_l) + +#define yyerror THIS->parser_error +#define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s)) + + +%} + + +%union { + Array* intarr; + Array *pitch_arr; + Array * strvec; + Array *intvec; + Box *box; + Simultaneous_music *chord; + Duration *duration; + Identifier *id; + Translator* trans; + Music *music; + Music_list *music_list; + Score *score; + Scope *scope; + Interval *interval; + Musical_req* musreq; + Music_output_def * outputdef; + Musical_pitch * pitch; + Midi_def* midi; + Moment *moment; + Note_req *notereq; + Notename_table *notenametab; + Paper_def *paper; + Real real; + Request * request; + General_script_def * script; + Scalar *scalar; + String *string; + Atom * symbol; + Symtable * symtable; + Symtables* symtables; + Text_def * textdef; + Tempo_req *tempo; + char c; + const char *consstr; + int i; + int pair[2]; + int ii[10]; +} +%{ + +int +yylex (YYSTYPE *s, void * v_l) +{ + My_lily_parser *pars_l = (My_lily_parser*) v_l; + My_lily_lexer * lex_l = pars_l->lexer_p_; + + lex_l->lexval_l = (void*) s; + return lex_l->yylex (); +} + + +%} + +%pure_parser + +/* tokens which are not keywords */ + +%token ABSDYNAMIC +%token ACCEPTS +%token BAR +%token BEAMPLET +%token CADENZA +%token CLEF +%token CM_T +%token CONSISTS +%token DURATION +%token END +%token FONT +%token GROUPING +%token HEADER +%token IN_T +%token KEY +%token KEYSIGNATURE +%token LYRICS +%token MAEBTELP +%token MARK +%token MEASURES +%token MIDI +%token MM_T +%token MUSIC +%token MUSICAL_PITCH +%token NAME +%token NOTENAMES +%token NOTES +%token OCTAVE +%token OUTPUT +%token PAPER +%token PARTIAL +%token PENALTY +%token PLET +%token PROPERTY +%token PT_T +%token RELATIVE +%token REMOVE +%token SCHEME /* token vs typedef; can't be named SCM */ +%token SCORE +%token SCRIPT +%token SHAPE +%token SKIP +%token SPANDYNAMIC +%token SYMBOLTABLES +%token TABLE +%token TELP +%token TEMPO +%token TIME_T +%token TIMES +%token TRANSLATOR +%token TRANSPOSE +%token TYPE +%token VERSION + +/* escaped */ +%token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR + +%type dots +%token DIGIT +%token NOTENAME_PITCH +%token DURATION_IDENTIFIER +%token IDENTIFIER +%token NOTENAME_TABLE_IDENTIFIER +%token MUSIC_IDENTIFIER +%token POST_REQUEST_IDENTIFIER +%token SCRIPT_IDENTIFIER +%token COMMAND_IDENTIFIER +%token REAL_IDENTIFIER +%token STRING_IDENTIFIER +%token TRANS_IDENTIFIER +%token INT_IDENTIFIER +%token SCORE_IDENTIFIER +%token MIDI_IDENTIFIER +%token PAPER_IDENTIFIER +%token REQUEST_IDENTIFIER +%token REAL +%token DURATION RESTNAME +%token STRING +%token UNSIGNED + + +%type output_def +%type mudela_header mudela_header_body +%type box +%type open_request_parens close_request_parens +%type open_abbrev_parens +%type open_plet_parens close_plet_parens +%type sub_quotes sup_quotes +%type simple_element request_chord command_element Simple_music Composite_music +%type abbrev_type +%type int unsigned +%type script_dir +%type identifier_init simple_identifier_init block_identifier +%type steno_duration notemode_duration +%type entered_notemode_duration explicit_duration +%type dinterval +%type intastint_list int_list +%type symtables symtables_body + +%type explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch +%type steno_notepitch +%type pitch_list +%type midi_block midi_body +%type duration_length + +%type scalar +%type Music relative_music Sequential_music Simultaneous_music +%type property_def translator_change +%type Music_list +%type paper_block paper_def_body +%type real_expression real dimension +%type abbrev_command_req +%type post_request structured_post_request +%type plet_fraction +%type command_req verbose_command_req +%type script_req dynamic_req +%type string +%type score_block score_body +%type shape_array +%type