# class name silence?
+Dstream 1
My_flex_lexer 1
yyFlexLexer 1
parse_duration 1
parse_pitchmod 1
Col_configuration 1
-Request 1
-Note_req 1
-Rhythmic_req 1
+Request 0
+Note_req 0
+Rhythmic_req 0
Rest_req 1
delete_identifiers 1
Command 1
Commands_at 1
Input_command 1
Time_description 1
-Melodic_req 1
+Melodic_req 0
Midi_walker 1
Stem_req 1
Group_change_req 1
+
=head1 NAME
language.pod -- state of the art mudela-vapourware.
We might be able to do without the staff{} construct, but I doubt if
it will make things easier.
+=head1 CONCRETE PROPOSAL
+
+Any optional request/modifier should follow the note/rest-name/lyric:
+
+ old new
+ ''!a a!''
+ [a()a]()a a[( a)]( a)
+
+the []() construct doesn't look nice. We might make an exception for
+spanning requests.
+
=head1 THOUGHTS
=head2 Typing
* caching of Register_group_register hierarchies.
- * midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
-
This is an assorted collection of stuff that will be done, might be
done, or is an idea that I want to think about
STUFF
+ * midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
+
* generate all (.hh) files into out dirs
* sort out headers, see m2m
* make install.
BUGS
-
- * barf if no score_wde_music
-
* plet bugs: scales.ly
* key at clef change.
* Group_feature at start of music.
+ * parser error handling (can you say Segfault?)
+
SEVERELY LACKING:
* grace notes
- * dynamics (hairpins)
-
INPUTLANGUAGE
* lose the $ and @ ?
* implement better breaking algorithm
- * Implement all requests
+ * Text_crescendo
+
+ * clean solution for staffsize in items.
* merge key{item} & localkey{item}?
% common dutch names for notes. "es" means flat, "is" means sharp
%
+ceses = melodic { 0 0 -2 0 }
+ces = melodic { 0 0 -1 0 }
+c = melodic { 0 0 0 0 }
+cis = melodic { 0 0 1 0 }
+cisis = melodic { 0 0 2 0 }
+deses = melodic { 0 1 -2 0 }
+des = melodic { 0 1 -1 0 }
+d = melodic { 0 1 0 0 }
+dis = melodic { 0 1 1 0 }
+disis = melodic { 0 1 2 0 }
+eses = melodic { 0 2 -2 0 }
+es = melodic { 0 2 -1 0 }
+e = melodic { 0 2 0 0 }
+eis = melodic { 0 2 1 0 }
+eisis = melodic { 0 2 2 0 }
+feses = melodic { 0 3 -2 0 }
+fes = melodic { 0 3 -1 0 }
+f = melodic { 0 3 0 0 }
+fis = melodic { 0 3 1 0 }
+fisis = melodic { 0 3 2 0 }
+geses = melodic { 0 4 -2 0 }
+ges = melodic { 0 4 -1 0 }
+g = melodic { 0 4 0 0 }
+gis = melodic { 0 4 1 0 }
+gisis = melodic { 0 4 2 0 }
+ases = melodic { 0 5 -2 0 }
+as = melodic { 0 5 -1 0 }
+a = melodic { 0 5 0 0 }
+ais = melodic { 0 5 1 0 }
+aisis = melodic { 0 5 2 0 }
+beses = melodic { 0 6 -2 0 }
+bes = melodic { 0 6 -1 0 }
+b = melodic { 0 6 0 0 }
+bis = melodic { 0 6 1 0 }
+bisis = melodic { 0 6 2 0 }
-dutch_names =
-notenames {
- "ceses" 0 -2 "ces" 0 -1 "c" 0 0 "cis" 0 1 "cisis" 0 2
- "deses" 1 -2 "des" 1 -1 "d" 1 0 "dis" 1 1 "disis" 1 2
- "eses" 2 -2 "es" 2 -1 "e" 2 0 "eis" 2 1 "eisis" 2 2
- "feses" 3 -2 "fes" 3 -1 "f" 3 0 "fis" 3 1 "fisis" 3 2
- "geses" 4 -2 "ges" 4 -1 "g" 4 0 "gis" 4 1 "gisis" 4 2
- "ases" 5 -2 "as" 5 -1 "a" 5 0 "ais" 5 1 "aisis" 5 2
- "beses" 6 -2 "bes" 6 -1 "b" 6 0 "bis" 6 1 "bisis" 6 2
-}
+
+%
+% upper case: 1 octave lower.
+%
+
+
+Ceses = melodic { -1 0 -2 0 }
+Ces = melodic { -1 0 -1 0 }
+C = melodic { -1 0 0 0 }
+Cis = melodic { -1 0 1 0 }
+Cisis = melodic { -1 0 2 0 }
+Deses = melodic { -1 1 -2 0 }
+Des = melodic { -1 1 -1 0 }
+D = melodic { -1 1 0 0 }
+Dis = melodic { -1 1 1 0 }
+Disis = melodic { -1 1 2 0 }
+Eses = melodic { -1 2 -2 0 }
+Es = melodic { -1 2 -1 0 }
+E = melodic { -1 2 0 0 }
+Eis = melodic { -1 2 1 0 }
+Eisis = melodic { -1 2 2 0 }
+Feses = melodic { -1 3 -2 0 }
+Fes = melodic { -1 3 -1 0 }
+F = melodic { -1 3 0 0 }
+Fis = melodic { -1 3 1 0 }
+Fisis = melodic { -1 3 2 0 }
+Geses = melodic { -1 4 -2 0 }
+Ges = melodic { -1 4 -1 0 }
+G = melodic { -1 4 0 0 }
+Gis = melodic { -1 4 1 0 }
+Gisis = melodic { -1 4 2 0 }
+Ases = melodic { -1 5 -2 0 }
+As = melodic { -1 5 -1 0 }
+A = melodic { -1 5 0 0 }
+Ais = melodic { -1 5 1 0 }
+Aisis = melodic { -1 5 2 0 }
+Beses = melodic { -1 6 -2 0 }
+Bes = melodic { -1 6 -1 0 }
+B = melodic { -1 6 0 0 }
+Bis = melodic { -1 6 1 0 }
+Bisis = melodic { -1 6 2 0 }
-notenames { dutch_names }
\ No newline at end of file
p = dynamic { 5 }
mp = dynamic { 4 }
mf = dynamic { 3 }
-f = dynamic { 2 }
+df = dynamic { 2 } % f is a notename too.
ff = dynamic { 1 }
fff = dynamic { 0 }
%
% by Mats Bengtsson.
-swedish_names =
-notenames {
- "cessess" 0 -2 "cess" 0 -1 "c" 0 0 "ciss" 0 1 "cississ" 0 2
- "dessess" 1 -2 "dess" 1 -1 "d" 1 0 "diss" 1 1 "dississ" 1 2
- "essess" 2 -2 "ess" 2 -1 "e" 2 0 "eiss" 2 1 "eississ" 2 2
- "fessess" 3 -2 "fess" 3 -1 "f" 3 0 "fiss" 3 1 "fississ" 3 2
- "gessess" 4 -2 "gess" 4 -1 "g" 4 0 "giss" 4 1 "gississ" 4 2
- "assess" 5 -2 "ass" 5 -1 "a" 5 0 "aiss" 5 1 "aississ" 5 2
- "hessess" 6 -2 "b" 6 -1 "h" 6 0 "hiss" 6 1 "hississ" 6 2
-}
-
-
-notenames { swedish_names }
+cessess = melodic { 0 0 -2 0 }
+cess = melodic { 0 0 -1 0 }
+c = melodic { 0 0 0 0 }
+ciss = melodic { 0 0 1 0 }
+cississ = melodic { 0 0 2 0 }
+dessess = melodic { 0 1 -2 0 }
+dess = melodic { 0 1 -1 0 }
+d = melodic { 0 1 0 0 }
+diss = melodic { 0 1 1 0 }
+dississ = melodic { 0 1 2 0 }
+essess = melodic { 0 2 -2 0 }
+ess = melodic { 0 2 -1 0 }
+e = melodic { 0 2 0 0 }
+eiss = melodic { 0 2 1 0 }
+eississ = melodic { 0 2 2 0 }
+fessess = melodic { 0 3 -2 0 }
+fess = melodic { 0 3 -1 0 }
+f = melodic { 0 3 0 0 }
+fiss = melodic { 0 3 1 0 }
+fississ = melodic { 0 3 2 0 }
+gessess = melodic { 0 4 -2 0 }
+gess = melodic { 0 4 -1 0 }
+g = melodic { 0 4 0 0 }
+giss = melodic { 0 4 1 0 }
+gississ = melodic { 0 4 2 0 }
+assess = melodic { 0 5 -2 0 }
+ass = melodic { 0 5 -1 0 }
+a = melodic { 0 5 0 0 }
+aiss = melodic { 0 5 1 0 }
+aississ = melodic { 0 5 2 0 }
+hessess = melodic { 0 6 -2 0 }
+b = melodic { 0 6 -1 0 }
+h = melodic { 0 6 0 0 }
+hiss = melodic { 0 6 1 0 }
+hississ = melodic { 0 6 2 0 }
%#% =f2. |
f2. |
%%23
- [ a8._\mf 'cis16 ] 'f4. 'e |
+ [ a8.\mf 'cis16 ] 'f4. 'e |
%%24
[ 'd8. a16 ] fis4. d |
%%25
%#% 'cis\grace\stemup
- [ b_\mf( ) ais b ]2/3 'd4. b |
+ [ b\mf( ) ais b ]2/3 'd4. b |
%%26
{ a2. fis2. } |
%#%\tighten\newline
%%27
- [ 'e_\f( )'dis 'e ]2/3 'g4. 'cis |
+ [ 'e\df( )'dis 'e ]2/3 'g4. 'cis |
%%28
{ 'd2. fis2. } |
%#%\volta1
%%29
- { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2_\mf [ bes8. bes16 ] } } |
+ { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2\mf [ bes8. bes16 ] } } |
%%30
{ \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ fis-.( fis-. )fis-. ] } } |
%%31
{ \music{ a4. [ a-. a-. a-. ] } \music{ g4. [ cis-.( e-. )g-. ] } } |
%%32
- { a2 fis2_\pp } { a4 fis4 } |
+ { a2 fis2\pp } { a4 fis4 } |
%%33
%#% { b2(^ g2 } [v { 'd8.( b8. } { b16 ) ) g16 } ] |
{ \music{ b2( [ 'd8.( ) )g16 ] } \music{ g2 [ b8. b16 ] } } |
'cis2 r4 |
%%41
%#% { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ] |
- { 'fis4. 'cis4.\f } 'e [ 'e( )'d 'cis ]2/3 |
+ { 'fis4. 'cis4.\df } 'e [ 'e( )'d 'cis ]2/3 |
%%42
[ b8. 'cis16 ] 'd4^> b r |
%%43
%#% [^ { b8._{ }_{ }_{ }_{ }_{ }_f g2. } 'cis16 ] 'd4^> b r |
- [ b8.\f 'cis16 ] 'd4^> b r |
+ [ b8.\df 'cis16 ] 'd4^> b r |
%%44
%#% [^ { > b8. fis2 } 'cis16 ] 'd4^> b >! r |
[ b8. 'cis16 ] 'd4^> b r |
%#% { =a2. fis2. } |
{ a2. fis2. } |
%%47
- [ 'e\f( )'dis 'e ]2/3 'g4.^> 'cis |
+ [ 'e\df( )'dis 'e ]2/3 'g4.^> 'cis |
%%48
%#% { fis2.(v ='d2.\stemup(^ }
% { fis2. 'd2. } |
%%51
{ a2. cis2. } |
%%52
- { fis2 d2 } { a4 fis4_\pp } |
+ { fis2 d2 } { a4 fis4\pp } |
%%53
%#% { bes2 g2 } [ { 'd8.^>( bes8. } { ) bes16 g16 } ] |
{ bes2 g2 } { [ 'd8.^> bes8. } { bes16 g16 ] } |
+
/*
proto.hh -- part of LilyPond
struct Note_req;
struct Notehead;
struct Notehead_register;
-struct Notename_tab;
struct Offset;
struct Output;
struct PCol;
struct Source_file;
struct Spacing_req ;
struct Span_req;
+struct Span_dynamic_req;
struct Spanner;
struct Subtle_req;
struct Staff;
#include "bar-reg.hh"
#include "bar.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
#include "score-column.hh"
#include "time-description.hh"
#include "clef-reg.hh"
#include "clef-item.hh"
#include "debug.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
#include "time-description.hh"
#include "staff-column.hh"
--- /dev/null
+/*
+ crescendo.cc -- implement Crescendo
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "crescendo.hh"
+#include "lookup.hh"
+#include "paper-def.hh"
+
+Crescendo::Crescendo(int s)
+{
+ staff_size_i_ = s;
+ grow_dir_i_ =0;
+ dir_i_ = -1 ;
+}
+
+Spanner*
+Crescendo::do_break_at(PCol*, PCol*)const
+{
+ return new Crescendo(*this);
+}
+
+
+Molecule*
+Crescendo::brew_molecule_p() const return m_p ;
+{
+ m_p = new Molecule;
+ Real w_f = width().length();
+ Symbol s( paper()->lookup_l()->hairpin(w_f, grow_dir_i_ < 0) );
+ m_p->add(Atom(s));
+ int pos = (dir_i_ >0) ? staff_size_i_ + 4 : - 4 ;
+ m_p->translate(Offset(0,pos * paper()->internote()));
+}
*/
#include "dynamic-reg.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "text-item.hh"
#include "lookup.hh"
#include "paper-def.hh"
#include "headreg.hh"
#include "paper-def.hh"
#include "complex-walker.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
Notehead_register::Notehead_register()
{
mtor << *((Real_id*)this)->real(false)<< "\n";
}
-void
-Notetab_id::do_print() const
-{
- mtor << "unknown" << "\n";
-}
-
--- /dev/null
+/*
+ command-request.hh -- declare Non musical requests
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef COMMANDREQUEST_HH
+#define COMMANDREQUEST_HH
+
+#include "request.hh"
+#include "varray.hh"
+
+/** Request which are assumed to be "happening" before the
+ musical requests. */
+struct Command_req : virtual Request {
+ REQUESTMETHODS(Command_req, command);
+
+ virtual Measure_grouping_req * measuregrouping() { return 0; }
+ virtual Clef_change_req * clefchange() { return 0; }
+ virtual Key_change_req * keychange() { return 0; }
+ virtual Partial_measure_req * partial() { return 0; }
+ virtual Meter_change_req * meterchange() { return 0; }
+ virtual Bar_req *bar() { return 0; }
+ virtual Cadenza_req *cadenza() { return 0; }
+ virtual Timing_req*timing() { return 0; }
+};
+
+
+/** Baseclass for meter/partial req. It has to be handled by
+ Staff_{walker,column} baseclass. */
+struct Timing_req : Command_req {
+ REQUESTMETHODS(Timing_req, timing);
+};
+
+
+struct Partial_measure_req : Timing_req {
+ Moment duration_;
+
+ Partial_measure_req(Moment);
+ REQUESTMETHODS(Partial_measure_req, partial);
+};
+
+/**
+ todo: allow C meter
+ */
+struct Meter_change_req : Timing_req {
+ int beats_i_, one_beat_i_;
+
+ Meter_change_req();
+ void set(int,int);
+ REQUESTMETHODS(Meter_change_req, meterchange);
+};
+
+/// toggle Cadenza mode
+struct Cadenza_req : Timing_req {
+ /// turn on?
+ bool on_b_;
+ Cadenza_req(bool);
+ REQUESTMETHODS(Cadenza_req,cadenza);
+};
+
+/// check if we're at start of a measure.
+struct Barcheck_req : Timing_req {
+
+ REQUESTMETHODS(Barcheck_req,barcheck);
+};
+
+struct Measure_grouping_req: Timing_req {
+ Array<int> beat_i_arr_;
+ Array<Moment> elt_length_arr_;
+
+ REQUESTMETHODS(Measure_grouping_req, measuregrouping);
+};
+
+struct Group_change_req : Command_req {
+ String newgroup_str_;
+ REQUESTMETHODS(Group_change_req, groupchange);
+};
+
+/** draw a (repeat)-bar. This something different than #Barcheck_req#,
+ the latter should only happen at the start of a measure. */
+struct Bar_req : Command_req {
+ String type_str_;
+ Bar_req(String);
+ int compare(const Bar_req&)const;
+ REQUESTMETHODS(Bar_req,bar);
+};
+struct Terminate_voice_req : Command_req {
+ REQUESTMETHODS(Terminate_voice_req,terminate);
+};
+
+struct Group_feature_req : Command_req {
+ int stemdir_i_;
+ Group_feature_req();
+ REQUESTMETHODS(Group_feature_req, groupfeature);
+};
+
+
+struct Key_change_req : Command_req {
+ Array<Melodic_req*> melodic_p_arr_;
+
+ Key_change_req();
+ Key_change_req(Key_change_req const&);
+ ~Key_change_req();
+ REQUESTMETHODS(Key_change_req, keychange);
+};
+
+struct Clef_change_req : Command_req {
+ String clef_str_;
+ Clef_change_req(String);
+ REQUESTMETHODS(Clef_change_req, clefchange);
+};
+
+#endif // COMMANDREQUEST_HH
-/*
- commandrequest.hh -- declare Non musical requests
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef COMMANDREQUEST_HH
-#define COMMANDREQUEST_HH
-
-#include "request.hh"
-#include "varray.hh"
-
-/** Request which are assumed to be "happening" before the
- musical requests. */
-struct Command_req : virtual Request {
- REQUESTMETHODS(Command_req, command);
-
- virtual Measure_grouping_req * measuregrouping() { return 0; }
- virtual Clef_change_req * clefchange() { return 0; }
- virtual Key_change_req * keychange() { return 0; }
- virtual Partial_measure_req * partial() { return 0; }
- virtual Meter_change_req * meterchange() { return 0; }
- virtual Bar_req *bar() { return 0; }
- virtual Cadenza_req *cadenza() { return 0; }
- virtual Timing_req*timing() { return 0; }
-};
-
-
-/** Baseclass for meter/partial req. It has to be handled by
- Staff_{walker,column} baseclass. */
-struct Timing_req : Command_req {
- REQUESTMETHODS(Timing_req, timing);
-};
-
-
-struct Partial_measure_req : Timing_req {
- Moment duration_;
-
- Partial_measure_req(Moment);
- REQUESTMETHODS(Partial_measure_req, partial);
-};
-
-/**
- todo: allow C meter
- */
-struct Meter_change_req : Timing_req {
- int beats_i_, one_beat_i_;
-
- Meter_change_req();
- void set(int,int);
- REQUESTMETHODS(Meter_change_req, meterchange);
-};
-
-/// toggle Cadenza mode
-struct Cadenza_req : Timing_req {
- /// turn on?
- bool on_b_;
- Cadenza_req(bool);
- REQUESTMETHODS(Cadenza_req,cadenza);
-};
-
-/// check if we're at start of a measure.
-struct Barcheck_req : Timing_req {
-
- REQUESTMETHODS(Barcheck_req,barcheck);
-};
-
-struct Measure_grouping_req: Timing_req {
- Array<int> beat_i_arr_;
- Array<Moment> elt_length_arr_;
-
- REQUESTMETHODS(Measure_grouping_req, measuregrouping);
-};
-
-struct Group_change_req : Command_req {
- String newgroup_str_;
- REQUESTMETHODS(Group_change_req, groupchange);
-};
-
-/** draw a (repeat)-bar. This something different than #Barcheck_req#,
- the latter should only happen at the start of a measure. */
-struct Bar_req : Command_req {
- String type_str_;
- Bar_req(String);
- int compare(const Bar_req&)const;
- REQUESTMETHODS(Bar_req,bar);
-};
-struct Terminate_voice_req : Command_req {
- REQUESTMETHODS(Terminate_voice_req,terminate);
-};
-
-struct Group_feature_req : Command_req {
- int stemdir_i_;
- Group_feature_req();
- REQUESTMETHODS(Group_feature_req, groupfeature);
-};
-
-
-struct Key_change_req : Command_req {
- Array<Melodic_req*> melodic_p_arr_;
-
- Key_change_req();
- Key_change_req(Key_change_req const&);
- ~Key_change_req();
- REQUESTMETHODS(Key_change_req, keychange);
-};
-
-struct Clef_change_req : Command_req {
- String clef_str_;
- Clef_change_req(String);
- REQUESTMETHODS(Clef_change_req, clefchange);
-};
-
-#endif // COMMANDREQUEST_HH
--- /dev/null
+/*
+ crescendo.hh -- declare Crescendo
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CRESCENDO_HH
+#define CRESCENDO_HH
+
+#include "spanner.hh"
+
+class Crescendo : public Spanner {
+ int staff_size_i_;
+public:
+ int grow_dir_i_;
+ int dir_i_;
+ Crescendo(int staff_size_i);
+private:
+ Spanner* do_break_at( PCol*, PCol*) const;
+ Molecule*brew_molecule_p()const;
+ NAME_MEMBERS(Crescendo);
+};
+
+#endif // CRESCENDO_HH
#include "symtable.hh"
#include "input-staff.hh"
#include "input-music.hh"
-#include "notename.hh"
#include "lookup.hh"
#include "script-def.hh"
#include "request.hh"
make_id_class(Staff_id, Input_staff, staff);
make_id_class(M_chord_id, Music_general_chord, mchord);
make_id_class(M_voice_id, Music_voice, mvoice);
-make_id_class(Notetab_id, Notename_tab, notename_tab);
make_id_class(Request_id, Request, request);
#endif // IDENTIFIER_HH
IDACCESSOR(Music_general_chord, mchord)
IDACCESSOR(Lookup,lookup)
IDACCESSOR(Real,real)
- IDACCESSOR(Notename_tab, notename_tab)
IDACCESSOR(Request, request)
protected:
virtual Input_music *clone() const {
return new Simple_music(*this);
}
-
};
/// Complex_music consists of multiple voices
void concatenate(Complex_music*);
virtual bool find_plet_start_bo(char c, Moment& moment_r);
virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
-
};
/// lexer with provisions for include files.
struct My_flex_lexer : yyFlexLexer {
- Array<Input_file*> include_stack;
- Assoc<String, Identifier*> *the_id_tab;
- Keyword_table * keytable;
- Notename_tab * defaulttab;
+ Array<Input_file*> include_stack_;
+ Assoc<String, Identifier*> *identifier_assoc_p_;
+ Keyword_table * keytable_p_;
int errorlevel_i_;
+
/* *************** */
- int ret_notename(int *p, String text, int octave_mod);
+
char const* here_ch_c_l();
- void set(Notename_tab *n);
int lookup_keyword(String);
void lookup_notename(int &large, int &small, String s);
void LexerError(const char *);
--- /dev/null
+/*
+ musical-request.hh -- declare Musical requests
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef MUSICALREQUESTS_HH
+#define MUSICALREQUESTS_HH
+
+#include "request.hh"
+
+
+/**
+ A request which is coupled to a #Voice_element# with nonzero duration.
+ Base class only
+ */
+struct Musical_req : virtual Request {
+
+ virtual Skip_req* skip() { return 0; }
+ virtual Dynamic_req* dynamic() { return 0; }
+ virtual Absolute_dynamic_req * absdynamic() { return 0; }
+ virtual Subtle_req * subtle() { return 0; }
+ virtual Span_dynamic_req * span_dynamic() { return 0; }
+ REQUESTMETHODS(Musical_req, musical);
+};
+
+
+struct Skip_req : Musical_req {
+ Moment duration_;
+
+ virtual Moment duration() const;
+ REQUESTMETHODS(Skip_req, skip);
+};
+/** a request with a duration.
+ This request is used only a base class.
+ */
+struct Rhythmic_req : virtual Musical_req {
+ int balltype;
+ int dots;
+ Moment plet_factor;
+ /* *************** */
+ static int compare(const Rhythmic_req &, const Rhythmic_req &);
+ virtual Moment duration() const;
+ Rhythmic_req();
+ Rhythmic_req(int,int);
+ REQUESTMETHODS(Rhythmic_req, rhythmic);
+};
+
+struct Spacing_req :virtual Request {
+ Moment next;
+ Real distance;
+ Real strength;
+ /* *************** */
+ Spacing_req();
+ REQUESTMETHODS(Spacing_req, spacing);
+};
+
+struct Blank_req : Spacing_req, Rhythmic_req {
+ REQUESTMETHODS(Spacing_req, spacing);
+
+};
+
+/// Put a text above or below (?) this staff.
+struct Text_req : virtual Musical_req {
+ /// preferred position (above/below)
+ int dir_i_;
+ /// the characteristics of the text
+ Text_def *tdef_p_;
+ /* *************** */
+ Text_req(int d, Text_def*);
+ ~Text_req();
+ Text_req(Text_req const&);
+ static int compare(const Text_req&,const Text_req&);
+ REQUESTMETHODS(Text_req,text);
+};
+
+/** Put a text in lyric_staff
+ @see Lyric_staff
+ */
+struct Lyric_req : public Rhythmic_req, Text_req {
+ Lyric_req(Text_def* t_p);
+ REQUESTMETHODS(Lyric_req, lreq_l);
+};
+
+/// request which has some kind of pitch
+struct Melodic_req :virtual Musical_req
+{
+ /// 0 is c, 6 is b
+ int notename_i_;
+ /// 0 is central c
+ int octave_i_;
+
+ /// 0 natural, 1 sharp, etc
+ int accidental_i_;
+
+ /// force/supress printing of accidental.
+ bool forceacc_b_;
+
+ /// return height from central c (in halflines)
+ int height()const;
+ /// return pitch from central c (in halfnotes)
+ int pitch()const;
+ Melodic_req();
+
+ REQUESTMETHODS(Melodic_req,melodic);
+};
+
+/// Put a note of specified type, height, and with accidental on the staff.
+struct Note_req : Rhythmic_req, virtual Melodic_req {
+
+
+ Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
+ REQUESTMETHODS(Note_req, note);
+ };
+
+/**
+Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
+*/
+class Rest_req : public Rhythmic_req {
+public:
+ REQUESTMETHODS(Rest_req,rest);
+};
+
+/**
+ attach a stem to the noteball.
+ Rhythmic_req parent needed to determine if it will fit inside a beam.
+ */
+struct Stem_req : Rhythmic_req {
+ /// preferred direction for the stem
+ int dir_i_;
+ Stem_req(int s, int dots);
+ REQUESTMETHODS(Stem_req,stem);
+};
+
+/**
+ Requests to start or stop something.
+ This type of request typically results in the creation of a #Spanner#
+*/
+struct Span_req : virtual Musical_req {
+ /// should the spanner start or stop, or is it unwanted?
+ enum {
+ NOSPAN, START, STOP
+ } spantype ;
+ static int compare(const Span_req &r1, const Span_req &r2);
+ REQUESTMETHODS(Span_req,span);
+
+ Span_req();
+
+};
+
+/**
+ request for backward plet generation.
+
+ ugr. Place in hierarchy?
+ */
+struct Plet_req : virtual Request {
+ char type_c_;
+ int dur_i_;
+ int type_i_;
+ Plet_req();
+
+ REQUESTMETHODS(Plet_req,plet);
+};
+
+/** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
+appropriate number over the beam
+ */
+struct Beam_req : Span_req {
+ int nplet;
+
+ /* *************** */
+ REQUESTMETHODS(Beam_req,beam);
+
+ Beam_req();
+};
+
+/// a slur
+struct Slur_req : Span_req {
+ REQUESTMETHODS(Slur_req,slur);
+
+};
+
+
+/** Put a script above or below this ``note''. eg upbow, downbow. Why
+ a request? These symbols may conflict with slurs and brackets, so
+ this also a request */
+struct Script_req : Musical_req {
+ int dir_i_;
+ Script_def *scriptdef_p_;
+
+ /* *************** */
+ static int compare(const Script_req &, const Script_req &);
+ Script_req(int d, Script_def*);
+ REQUESTMETHODS(Script_req,script);
+ ~Script_req();
+ Script_req(Script_req const&);
+};
+
+/** A helper in the hierarchy. Each dynamic is bound to one note ( a
+ crescendo spanning multiple notes is thought to be made of two
+ "dynamics": a start and a stop). Dynamic changes can occur in a
+ smaller time than the length of its note, therefore fore each
+ Dynamic request carries a time, measured from the start of its
+ note.
+ */
+struct Subtle_req : virtual Musical_req {
+ Moment subtime_;
+ REQUESTMETHODS(Subtle_req, subtle);
+};
+
+struct Dynamic_req : Subtle_req {
+ /// for absolute dynamics
+ enum Loudness {
+ FFF, FF, F, MF, MP, P, PP, PPP
+ };
+ static String loudness_str(Loudness);
+ REQUESTMETHODS(Dynamic_req, dynamic);
+};
+
+struct Absolute_dynamic_req : Dynamic_req {
+ Loudness loudness_;
+ Absolute_dynamic_req();
+ REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
+};
+
+struct Span_dynamic_req : Dynamic_req, Span_req {
+ /// Grow or shrink the volume: 1=cresc, -1 = decresc
+ int dynamic_dir_i_;
+ Span_dynamic_req();
+ REQUESTMETHODS(Span_dynamic_req, span_dynamic);
+};
+
+#endif // MUSICALREQUESTS_HH
void get_default_duration(int *);
void set_default_octave(String);
void set_plet(int,int);
-Voice_element * get_note_element(String,int * ,int *);
+Voice_element * get_note_element(Note_req * ,int *);
Voice_element* get_rest_element(String,int *);
Voice_element* get_word_element(Text_def*, int*);
void add_requests( Voice_element*v, Array<Request*>&req);
void add(Notehead*);
void set_default_dir();
- Spanner* do_break_at( PCol*, PCol*) const;
- void process();
+ Spanner* do_break_at( PCol*, PCol*) const;
private:
Molecule*brew_molecule_p()const;
NAME_MEMBERS(Slur);
#include "debug.hh"
#include "input-music.hh"
#include "voice.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "voice-element.hh"
void
#include "time-description.hh"
#include "key-reg.hh"
#include "key-item.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
#include "staff-column.hh"
#include "local-key-reg.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
Key_register::Key_register()
{
#include "string.hh"
#include "string-convert.hh"
-#include "notename.hh"
#include "lexer.hh"
#include "varray.hh"
#include "parser.hh"
#include "main.hh"
#include "identparent.hh"
+#define start_quote() \
+ yy_push_state(quote);\
+ yylval.string = new String
+
+
%}
%option c++
AA {A}|_
N [0-9]
AN {AA}|{N}
-PUNCT [?!,.:;]
-ACCENT [\\'"^]
+PUNCT [?!,.:;']
+ACCENT \\[`'"^]
NATIONAL [\241-\377]
TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
PITCHMOD ['`]*{OPTSIGN}
RESTNAME r|s|p
NOTECOMMAND \\{WORD}
-NOTENAME [a-z]+
-UNOTENAME [A-Z][a-z]*
DOTS \.+
LYRICS {TEX}+
COMMENT [%#].*\n
mtor << "rest:"<< yylval.string;
return RESTNAME;
}
-<notes>{UNOTENAME} {
- int *p=yylval.ii;
- return ret_notename(p, YYText(), -1);
-}
+<notes>{ALPHAWORD} {
+ String str = YYText();
+ mtor << "word: " << str<< eol;
+ Identifier * id = lookup_identifier(str);
+ if (id) {
+ yylval.id = id;
+ return id->token_code_i_;
+ }
-<notes>{NOTENAME} {
- int *p=yylval.ii;
- return ret_notename(p, YYText(), 0);
+ yylval.string=new String( str );
+ return STRING;
}
-
<notes>{NOTECOMMAND} {
String c = YYText() +1;
mtor << "\\word: " << YYText()+1<<eol;
return STRING;
}
-<notes>{PITCHMOD} {
- const char *s = YYText();
- mtor << "pitchmod:"<< YYText()<<eol;
- yylval.string = new String (s);
- return PITCHMOD;
-}
<notes>{DOTS} {
yylval.i = strlen(YYText());
return DOTS;
<notes>\$ {
yy_pop_state();
}
-<notes>\"[^"]*\" {
- String s (YYText()+1);
- s = s.left_str(s.length_i()-1);
- yylval.string = new String(s);
- return STRING;
+<notes>\" {
+ start_quote();
}
<notes>. {
return yylval.c = YYText()[0];
}
+
\" {
- yy_push_state(quote);
+ start_quote();
}
-<quote>[^"]* {
- yylval.string = new String (YYText());
+<quote>[^"]+ {
+ *yylval.string += YYText();
}
<quote>\" {
- mtor << "quoted string\n";
+ mtor << "quoted string: `" << *yylval.string << "'\n";
yy_pop_state();
return STRING;
}
+<lyrics>\" {
+ start_quote();
+}
<lyrics>{DOTS} {
yylval.i = strlen(YYText());
return DOTS;
return l;
/* let's try passing tex's typesetting macros like \ss \alpha \c */
- String* str_p = new String(YYText());//huh?
+ String* str_p = new String(YYText());
+ yylval.string=str_p;
+ mtor << "\\word: `" << *str_p << "'\n";
return STRING;
/* and skip identifiers...
String *sp = new String( c);
yylval.string=sp;
+
return STRING;
*/
}
-<lyrics>\"[^"]*\" {
- String s (YYText()+1);
- s = s.left_str(s.length_i()-1);
- yylval.string = new String(s);
- return STRING;
-}
<lyrics>{LYRICS} {
+ /* ugr. This sux. */
String s (YYText());
int i = 0;
while ((i=s.index_i("_")) != -1) // change word binding "_" to " "
s = s.left_str(i+2) + " " + s.right_str(s.length_i()-i-2);
}
yylval.string = new String(s);
+ mtor << "lyric : `" << s << "'\n";
return STRING;
}
<lyrics>\| {
#include "scalar.hh"
#include "lookup.hh"
#include "paper-def.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "notehead.hh"
#include "misc.hh"
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "musicalrequest.hh"
-#include "commandrequest.hh"
+#include "musical-request.hh"
+#include "command-request.hh"
#include "local-key-reg.hh"
#include "local-key-item.hh"
#include "complex-walker.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "paper-def.hh"
#include "lyric-item.hh"
#include "stem.hh"
#include "meter-reg.hh"
#include "meter.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
Meter_register::Meter_register()
String
Atom::TeXstring() const
{
+ /* infinity checks. */
+ assert( abs(off.x) < 100 CM);
+ assert( abs(off.y) < 100 CM);
+
// whugh.. Hard coded...
String s("\\placebox{%}{%}{%}");
Array<String> a;
--- /dev/null
+/*
+ request.cc -- implement all musical requests.
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musical-request.hh"
+#include "misc.hh"
+#include "debug.hh"
+#include "script-def.hh"
+#include "text-def.hh"
+#include "voice.hh"
+#include "voice-element.hh"
+
+void
+Stem_req::do_print() const
+{
+ Rhythmic_req::do_print();
+ mtor << "dir : " << dir_i_;
+}
+
+Stem_req::Stem_req(int s, int d)
+ : Rhythmic_req(s,d)
+{
+ dir_i_ = 0;
+}
+
+/* ************** */
+void Musical_req::do_print()const{}
+void Request::do_print() const{}
+
+/* *************** */
+
+void
+Request::print() const
+{
+ mtor << name() << " {";
+ do_print();
+ mtor << "}\n";
+}
+
+
+
+void
+Span_req::do_print() const
+{
+#ifndef NPRINT
+ mtor << spantype ;
+#endif
+}
+
+Request::Request()
+{
+ elt_l_ = 0;
+ defined_ch_c_l_ = 0;
+}
+Request::Request(Request const&src)
+{
+ elt_l_ = 0;
+ defined_ch_c_l_ = src.defined_ch_c_l_;
+}
+/* *************** */
+Spacing_req::Spacing_req()
+{
+ next = 0;
+ distance = 0;
+ strength = 0;
+}
+void
+Spacing_req::do_print()const
+{
+#ifndef NPRINT
+ mtor << "next " << next << "dist " << distance << "strength\n";
+#endif
+}
+
+void
+Blank_req::do_print()const
+{
+ Spacing_req::do_print();
+}
+/* *************** */
+Melodic_req::Melodic_req()
+{
+ notename_i_ = 0;
+ octave_i_ = 0;
+ accidental_i_ = 0;
+ forceacc_b_ = false;
+}
+
+void
+Melodic_req::do_print() const
+{
+ mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
+}
+
+int
+Melodic_req::height() const
+{
+ return notename_i_ + octave_i_*7;
+}
+
+/*
+ should be settable from input to allow "viola"-mode
+ */
+static Byte pitch_byte_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };
+
+int
+Melodic_req::pitch() const
+{
+ return pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
+}
+
+Plet_req::Plet_req()
+{
+ type_c_ = ']';
+ dur_i_ = 1;
+ type_i_ = 1;
+}
+
+void
+Plet_req::do_print() const
+{
+ mtor << "plet: " << type_c_ << ": " << dur_i_ << "/" << type_i_;
+}
+
+/* *************** */
+int
+Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
+{
+ return sign(r1.duration() - r2.duration());
+}
+Rhythmic_req::Rhythmic_req(int b, int d)
+{
+ plet_factor = 1;
+ balltype = b;
+ dots = d;
+}
+
+Rhythmic_req::Rhythmic_req()
+{
+ plet_factor = 1;
+ balltype = 1;
+ dots = 0;
+}
+
+void
+Rhythmic_req::do_print() const
+{
+ mtor << "ball: " << balltype ;
+ int d =dots;
+ while (d--)
+ mtor << '.';
+
+ mtor<<", plet factor"<<plet_factor<<"\n";
+}
+
+
+Moment
+Rhythmic_req::duration() const {
+ return wholes(balltype,dots)*plet_factor;
+}
+/* *************** */
+
+Lyric_req::Lyric_req(Text_def* def_p)
+ :Text_req(0, def_p)
+{
+ def_p->align_i_ = 0; // centre
+ dir_i_ = -1; // lyrics below (invisible) staff
+}
+
+void
+Lyric_req::do_print() const
+{
+ Rhythmic_req::do_print();
+ Text_req::do_print();
+}
+/* *************** */
+void
+Note_req::do_print() const
+{
+ Melodic_req::do_print();
+ Rhythmic_req::do_print();
+}
+/* *************** */
+void
+Rest_req::do_print() const
+{
+ Rhythmic_req::do_print();
+}
+
+/* *************** */
+Beam_req::Beam_req()
+{
+ nplet = 0;
+}
+
+void Beam_req::do_print()const{}
+/* *************** */
+void Slur_req::do_print()const{}
+/* *************** */
+int
+Span_req:: compare(const Span_req &r1, const Span_req &r2)
+{
+ return r1.spantype - r2.spantype;
+}
+
+Span_req::Span_req()
+{
+ spantype = NOSPAN;
+}
+
+/* *************** */
+Script_req::Script_req(int d , Script_def*def)
+{
+ dir_i_ = d;
+ scriptdef_p_ = def;
+}
+
+int
+Script_req::compare(const Script_req &d1, const Script_req &d2)
+{
+ return d1.dir_i_ == d2.dir_i_ &&
+ d1.scriptdef_p_->compare(*d2.scriptdef_p_);
+}
+
+Script_req::Script_req(Script_req const &s)
+ : Request( s )
+{
+ dir_i_ = s.dir_i_;
+ scriptdef_p_ = new Script_def(*s.scriptdef_p_);
+}
+
+void
+Script_req::do_print() const
+{
+ mtor << " dir " << dir_i_ ;
+ scriptdef_p_->print();
+}
+
+
+Script_req::~Script_req()
+{
+ delete scriptdef_p_;
+}
+/* *************** */
+int
+Text_req:: compare(const Text_req &r1, const Text_req &r2)
+{
+ bool b1 = (r1.dir_i_ == r2.dir_i_);
+ bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_));
+ return b1 && b2;
+}
+Text_req::~Text_req()
+{
+ delete tdef_p_;
+ tdef_p_ = 0;
+}
+
+Text_req::Text_req(Text_req const& src)
+{
+ tdef_p_ = new Text_def(*src.tdef_p_);
+ dir_i_ = src.dir_i_;
+}
+
+Text_req::Text_req(int dir_i, Text_def* tdef_p)
+{
+ dir_i_ = dir_i;
+ tdef_p_ = tdef_p;
+}
+
+void
+Text_req::do_print() const
+{
+ mtor << " dir " << dir_i_ ;
+ tdef_p_->print();
+}
+
+/* *************** */
+
+Moment
+Skip_req::duration() const
+{
+ return duration_;
+}
+
+void
+Skip_req::do_print() const
+{
+ mtor << "duration: " << duration();
+}
+
+Voice *
+Request::voice_l()
+{
+ if (!elt_l_)
+ return 0;
+ else
+ return (Voice*)elt_l_->voice_l_;
+}
+/* *************** */
+
+void
+Subtle_req::do_print() const
+{
+ mtor << " subtime " << subtime_;
+}
+
+void
+Dynamic_req::do_print() const
+{
+ Subtle_req::do_print();
+}
+
+void
+Absolute_dynamic_req::do_print() const
+{
+ Dynamic_req::do_print();
+ mtor << " loudness_" <<loudness_;
+}
+
+String
+Dynamic_req::loudness_str(Loudness l)
+{
+ switch (l) {
+ case FFF: return "fff";
+ case FF: return "ff";
+ case F: return "f";
+ case MF: return "mf";
+ case MP: return "mp";
+ case P: return "p";
+ case PP: return "pp";
+ case PPP: return "ppp";
+ }
+ assert(false);
+ return "";
+}
+
+Absolute_dynamic_req::Absolute_dynamic_req()
+{
+ loudness_ = MF;
+}
+
+
+Span_dynamic_req::Span_dynamic_req()
+{
+ dynamic_dir_i_ = 0;
+}
+
+void
+Span_dynamic_req::do_print()const
+{
+#ifndef NPRINT
+ Span_req::do_print();
+ mtor << "louder/louder: " <<dynamic_dir_i_;
+#endif
+}
#include "assoc.hh"
#include "lexer.hh"
#include "debug.hh"
-#include "notename.hh"
+
#include "source-file.hh"
#include "parseconstruct.hh"
"goto", GOTO,
"in", IN_T,
"key", KEY,
+ "melodic" , MELODIC,
"meter", METER,
"midi", MIDI,
"mm", MM_T,
"stem", STEM,
"table", TABLE,
"symboltables", SYMBOLTABLES,
- "notenames", NOTENAMES,
"tempo", TEMPO,
"texid", TEXID,
"textstyle", TEXTSTYLE,
0,0
};
-int
-My_flex_lexer::ret_notename(int *p, String text, int octave_mod)
-{
- text = text.lower_str();
- char const* ch_c_l = here_ch_c_l();
- if ( ch_c_l ) {
- ch_c_l--;
- while ( ( *ch_c_l == ' ' )
- || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) )
- ch_c_l--;
- ch_c_l++;
- }
-
- lookup_notename(p[0], p[1], text);
- p[2] = octave_mod;
- mtor << "notename: "<< text <<eol;
- if (p[0] < 0) {
-
- errorlevel_i_ |= 1;
- error( String( "notename does not exist: " ) + YYText(), ch_c_l );
- p[0] = p[1] = 0;
- }
- return NOTENAME;
-}
-
My_flex_lexer::My_flex_lexer()
{
- keytable = new Keyword_table(the_key_tab);
- the_id_tab = new Assoc<String, Identifier*>;
- defaulttab = 0;
+ keytable_p_ = new Keyword_table(the_key_tab);
+ identifier_assoc_p_ = new Assoc<String, Identifier*>;
errorlevel_i_ = 0;
}
int
My_flex_lexer::lookup_keyword(String s)
{
- return keytable->lookup(s);
+ return keytable_p_->lookup(s);
}
Identifier*
My_flex_lexer::lookup_identifier(String s)
{
- if (!the_id_tab->elt_query(s))
+ if (!identifier_assoc_p_->elt_query(s))
return 0;
- return (*the_id_tab)[s];
+ return (*identifier_assoc_p_)[s];
}
char const*
My_flex_lexer::here_ch_c_l()
{
- return include_stack.top()->sourcefile_l_->ch_c_l() + yyin->tellg();
+ return include_stack_.top()->sourcefile_l_->ch_c_l() + yyin->tellg();
}
void
My_flex_lexer::add_identifier(Identifier*i)
{
delete lookup_identifier(i->name);
- (*the_id_tab)[i->name] = i;
+ (*identifier_assoc_p_)[i->name] = i;
}
My_flex_lexer::~My_flex_lexer()
{
- delete keytable;
- delete defaulttab;
- for (Assoc_iter<String,Identifier*> ai(*the_id_tab); ai.ok(); ai++) {
+ delete keytable_p_;
+
+ for (Assoc_iter<String,Identifier*>
+ ai(*identifier_assoc_p_); ai.ok(); ai++) {
mtor << "deleting: " << ai.key()<<'\n';
delete ai.val();
}
- delete the_id_tab;
+ delete identifier_assoc_p_;
}
void
My_flex_lexer::print_declarations()const
{
- for (Assoc_iter<String,Identifier*> ai(*the_id_tab); ai.ok(); ai++) {
+ for (Assoc_iter<String,Identifier*> ai(*identifier_assoc_p_); ai.ok(); ai++) {
ai.val()->print();
}
}
String
My_flex_lexer::spot()const
{
- return include_stack.top()->name + ": " + String( lineno() );
+ return include_stack_.top()->name + ": " + String( lineno() );
}
void
My_flex_lexer::LexerError(const char *s)
{
- if (lexer->include_stack.empty()) {
+ if (lexer->include_stack_.empty()) {
*mlog << "error at EOF" << s << '\n';
} else {
char const* ch_c_l = here_ch_c_l();
void
My_flex_lexer::new_input(String s)
{
- if (!include_stack.empty()) {
- include_stack.top()->line = lineno();
+ if (!include_stack_.empty()) {
+ include_stack_.top()->line = lineno();
// should this be saved at all?
- include_stack.top()->defined_ch_c_l_ = defined_ch_c_l;
+ include_stack_.top()->defined_ch_c_l_ = defined_ch_c_l;
}
Input_file *newin = new Input_file(s);
- include_stack.push(newin);
+ include_stack_.push(newin);
switch_streams(newin->is);
yylineno = 1;
bool
My_flex_lexer::close_input()
{
- Input_file *old = include_stack.pop();
+ Input_file *old = include_stack_.pop();
bool ok = true;
- if (include_stack.empty()) {
+ if (include_stack_.empty()) {
ok = false;
} else {
- Input_file *i = include_stack.top();
+ Input_file *i = include_stack_.top();
switch_streams(i->is);
yylineno = i->line;
defined_ch_c_l = i->defined_ch_c_l_;
#include "string.hh"
#include "real.hh"
#include "debug.hh"
-#include "musicalrequest.hh"
-#include "commandrequest.hh"
+#include "musical-request.hh"
+#include "command-request.hh"
#include "voice.hh"
-#include "notename.hh"
+
#include "identparent.hh"
#include "varray.hh"
#include "text-def.hh"
}
}
-void
-parse_pitch( const char *a, Melodic_req* mel_l)
-{
- int j=0;
-
- // octave
- mel_l->octave_i_ = default_octave;
- parse_octave(a,j,mel_l->octave_i_);
-
- // accidental
- mel_l->forceacc_b_ = false;
-
- if (a[j] == '!'){
- mel_l->forceacc_b_ = true;
- j++;
- }
-}
-
Voice_element *
-get_note_element(String pitch, int * notename, int * duration )
+get_note_element(Note_req *rq, int * duration )
{
Voice_element*v = new Voice_element;
v->defined_ch_c_l_ = defined_ch_c_l;
-
int dur = duration[0];
int dots = duration[1];
if ( !defined_ch_c_l )
defined_ch_c_l = lexer->here_ch_c_l();
- Note_req * rq = new Note_req;
- rq->notename_i_ =notename[0];
- rq->accidental_i_ = notename[1];
- parse_pitch(pitch, rq);
- rq->octave_i_ += notename[2];
-
rq->balltype = dur;
rq->dots = dots;
rq->plet_factor = Moment(default_plet_dur, default_plet_type);
#include "paper-def.hh"
#include "lookup.hh"
#include "molecule.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "parseconstruct.hh"
#include "dimen.hh"
#include "identifier.hh"
-#include "commandrequest.hh"
-#include "musicalrequest.hh"
+#include "command-request.hh"
+#include "musical-request.hh"
#include "voice-element.hh"
#ifndef NDEBUG
%union {
- Request * request;
- Real real;
- Identifier *id;
- Voice *voice;
- Voice_element *el;
- String *string;
- const char *consstr;
- Paper_def *paper;
- Midi_def* midi;
- Input_music *music;
- Music_general_chord *chord;
- Music_voice *mvoice;
- int i;
- char c;
- int ii[10];
- Moment *moment;
-
+ Array<Melodic_req*> *melreqvec;
Array<String> * strvec;
Array<int> *intvec;
- Array<Melodic_req*> *melreqvec;
- Input_staff *staff;
+ Box *box;
+ Identifier *id;
+ Input_music *music;
Input_score *score;
- Symtables * symtables;
- Symtable * symtable;
- Symbol * symbol;
- Lookup*lookup;
+ Input_staff *staff;
Interval *interval;
- Box *box;
- Notename_tab *notename_tab;
+ Lookup*lookup;
+ Melodic_req * melreq;
+ Midi_def* midi;
+ Moment *moment;
+ Music_general_chord *chord;
+ Music_voice *mvoice;
+ Note_req *notereq;
+ Paper_def *paper;
+ Real real;
+ Request * request;
Script_def * script;
+ String *string;
+ Symbol * symbol;
+ Symtable * symtable;
+ Symtables * symtables;
Text_def * textdef;
+ Voice *voice;
+ Voice_element *el;
+ char c;
+ const char *consstr;
+ int i;
+ int ii[10];
}
-%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE DYNAMIC
-%token CM_T IN_T PT_T MM_T PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
-%token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
-%token KEY CLEF TABLE VOICES STEM
-%token PARTIAL MUSIC GROUPING CADENZA
-%token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET
-%token GOTO
-%token MIDI TEMPO
-
-%token <id> IDENTIFIER REAL_IDENTIFIER REQUEST_IDENTIFIER
-%token <string> PITCHMOD DURATION RESTNAME
-%token <ii> NOTENAME
-%token <real> REAL
-%token <string> STRING
-
-%token <i> DOTS INT
-%type <real> unit
-%type <melreqvec> pitch_list
-%type <c> open_request_parens close_request_parens close_plet_parens
-%type <id> declaration
-%type <string> declarable_identifier
-%type <paper> paper_block paper_body
-%type <midi> midi_block midi_body
-%type <real> dim real
-%type <ii> default_duration explicit_duration notemode_duration mudela_duration
-%type <ii> notename
-%type <moment> duration_length
-%type <el> voice_elt full_element lyrics_elt command_elt
-
-%type <score> score_block score_body
-%type <staff> staff_block staff_init staff_body
-%type <i> int
-%type <intvec> intastint_list
-%type <request> post_request pre_request command_req
-%type <string> pitchmod
-%type <music> music
-%type <chord> music_chord music_chord_body
-
-%type <mvoice> music_voice_body music_voice
-
-%type <interval> dinterval
-%type <box> box
-%type <symtable> symtable symtable_body
-%type <lookup> symtables symtables_body
-%type <symbol> symboldef
-%type <notename_tab> notename_tab notename_tab_body
-%type <i> script_dir
-%type <script> script_definition script_body mudela_script
-%type <request> script_req textscript_req dynamic_req basic_request
-%type <textdef> mudela_text
-
+%token BAR
+%token CADENZA
+%token CLEF
+%token CM_T
+%token COMMAND
+%token COMMANDS
+%token DURATIONCOMMAND
+%token DYNAMIC
+%token END
+%token GEOMETRIC
+%token GOTO
+%token GROUPING
+%token IN_T
+%token KEY
+%token MELODIC
+%token METER
+%token MIDI
+%token MM_T
+%token MULTIVOICE
+%token MUSIC
+%token OCTAVECOMMAND
+%token OUTPUT
+%token PAPER
+%token PARTIAL
+%token PLET
+%token PT_T
+%token SCORE
+%token SCRIPT
+%token SKIP
+%token STAFF
+%token START_T
+%token STEM
+%token SYMBOLTABLES
+%token TABLE
+%token TABLE
+%token TEMPO
+%token TEXID
+%token TEXTSTYLE
+%token TITLE
+%token UNITSPACE
+%token VOICE
+%token VOICES
+%token WIDTH
+
+%token <i> DOTS
+%token <i> INT
+%token <id> IDENTIFIER
+%token <id> MELODIC_REQUEST_IDENTIFIER
+%token <id> POST_REQUEST_IDENTIFIER
+%token <id> REAL_IDENTIFIER
+%token <id> REQUEST_IDENTIFIER
+%token <real> REAL
+%token <string> DURATION RESTNAME
+%token <string> STRING
+
+%type <box> box
+%type <c> open_request_parens close_request_parens close_plet_parens
+%type <chord> music_chord music_chord_body
+%type <el> voice_elt full_element lyrics_elt command_elt
+%type <i> int
+%type <i> octave_quotes octave_quote
+%type <i> script_dir
+%type <id> declaration
+%type <ii> default_duration explicit_duration notemode_duration
+%type <ii> mudela_duration
+%type <interval> dinterval
+%type <intvec> intastint_list
+%type <lookup> symtables symtables_body
+%type <melreq> melodic_request
+%type <notereq> steno_note_req
+%type <melreqvec> pitch_list
+%type <midi> midi_block midi_body
+%type <moment> duration_length
+%type <music> music
+%type <mvoice> music_voice_body music_voice
+
+%type <paper> paper_block paper_body
+%type <real> dim real
+%type <real> unit
+%type <request> post_request pre_request command_req pure_post_request
+%type <request> script_req textscript_req dynamic_req
+%type <score> score_block score_body
+%type <script> script_definition script_body mudela_script
+%type <staff> staff_block staff_init staff_body
+%type <string> declarable_identifier
+%type <symbol> symboldef
+%type <symtable> symtable symtable_body
+%type <textdef> mudela_text
%%
add_score($2);
}
| mudela add_declaration { }
- | mudela mudela_command {}
;
-mudela_command:
- notename_tab { lexer->set($1); }
- ;
/*
DECLARATIONS
;
declarable_identifier:
- STRING { $$ = $1; }
+ STRING { $$ = $1;
+ if (lexer->lookup_identifier(*$1))
+ warning("redeclaration of `" + *$1 + "'",
+ lexer->here_ch_c_l());
+ }
| IDENTIFIER { $$ = new String($1->name); }
;
$$ = new Lookup_id(*$1, $3, IDENTIFIER);
delete $1;
}
- | declarable_identifier '=' notename_tab {
- $$ = new Notetab_id(*$1, $3, IDENTIFIER);
- delete $1;
- }
| declarable_identifier '=' real {
$$ = new Real_id(*$1, new Real($3), REAL_IDENTIFIER);
delete $1;
| declarable_identifier error '}' {
}
- | declarable_identifier '=' basic_request {
- $$ = new Request_id(*$1, $3, REQUEST_IDENTIFIER);
+ | declarable_identifier '=' pure_post_request {
+ $$ = new Request_id(*$1, $3, POST_REQUEST_IDENTIFIER);
delete $1;
}
- ;
-
-notename_tab:
- NOTENAMES '{' notename_tab_body '}' { $$ = $3; }
- ;
-
-notename_tab_body: {
- $$ = new Notename_tab;
- }
- | IDENTIFIER {
- $$ = $1->notename_tab(true);
- }
- | notename_tab_body STRING int int {
- $$->set($3, $4, *$2);
- delete $2;
+ | declarable_identifier '=' melodic_request {
+ $$ = new Request_id(*$1, $3, MELODIC_REQUEST_IDENTIFIER);
+ delete $1;
}
;
+
/*
SCORE
*/
/* handle error levels. */
$$->errorlevel_i_ = lexer->errorlevel_i_;
lexer->errorlevel_i_ = 0;
+
+ /* unbarf score without global music. */
+ if (!$$-> score_wide_music_p_) {
+ $$-> score_wide_music_p_ = new Music_voice;
+ }
}
;
$$ = new Input_staff(*$1);
delete $1;
}
+ | MELODIC {
+ $$ = new Input_staff("melodic");
+ }
;
staff_body:
}
;
-basic_request:
- command_req
- | pre_request
- | post_request
- ;
-
/*
VOICE ELEMENTS
*/
| METER '{' int '*' int '}' {
Meter_change_req *m = new Meter_change_req;
m->set($3,$5);
+ // sorry hw, i need meter at output of track,
+ // but don-t know where to get it... statics should go.
+ Midi_def::num_i_s = $3;
+ Midi_def::den_i_s = $5;
$$ = m;
}
| SKIP '{' duration_length '}' {
;
post_request:
+ pure_post_request
+ | POST_REQUEST_IDENTIFIER {
+ $$ = $1->request(false)->clone();
+ }
+ ;
+
+pure_post_request:
close_request_parens {
$$ = get_request($1);
}
| script_req
| textscript_req
| dynamic_req
- | REQUEST_IDENTIFIER {
- $$ = $1->request(false)->clone();
+ ;
+
+
+octave_quote:
+ '\'' { $$ = 1; }
+ | '`' { $$ = -1; }
+ ;
+
+octave_quotes:
+ /**/ { $$ = 0; }
+ | octave_quotes octave_quote{ $$ += $2; }
+ ;
+
+/*
+ URG!!
+*/
+steno_note_req:
+ MELODIC_REQUEST_IDENTIFIER {
+ $$ = new Note_req;
+ * (Melodic_req *) $$ = *$1->request(false)->melodic();
+ }
+ | octave_quote steno_note_req {
+ $2-> octave_i_ += $1;
+ $$ = $2; //ugh!!
+ }
+ | '!' steno_note_req {
+ $$ = $2;
+ $2->forceacc_b_ = ! $2->forceacc_b_;
+ }
+ ;
+
+melodic_request:
+ MELODIC '{' int int int int '}' {/* ugh */
+ $$ = new Melodic_req;
+ $$->octave_i_ = $3;
+ $$->notename_i_ = $4;
+ $$->accidental_i_ = $5;
+ $$->forceacc_b_ = $6;
}
;
| DURATIONCOMMAND '{' notemode_duration '}' {
set_default_duration($3);
}
- | OCTAVECOMMAND '{' pitchmod '}' {
- set_default_octave(*$3);
- delete $3;
+ | OCTAVECOMMAND '{' octave_quotes '}' {
+ set_default_octave($3);
}
| TEXTSTYLE STRING {
set_text_style(*$2);
;
default_duration:
- {
+ /* empty */ {
get_default_duration($$);
}
;
-pitchmod: {
- defined_ch_c_l = lexer->here_ch_c_l();
- $$ = new String;
- }
- | PITCHMOD {
- defined_ch_c_l = lexer->here_ch_c_l();
- $$ = $1;
- }
- ;
-
-notename:
- NOTENAME
- ;
voice_elt:
- pitchmod notename notemode_duration {
- $$ = get_note_element(*$1, $2, $3);
- delete $1;
+ steno_note_req notemode_duration {
+ $$ = get_note_element($1, $2);
}
| RESTNAME notemode_duration {
$$ = get_rest_element(*$1, $2);
delete $1;
-
}
;
pitch_list: {
$$ = new Array<Melodic_req*>;
}
- | pitch_list NOTENAME {
- Melodic_req *m_p = new Melodic_req;
- m_p->notename_i_ = $2[0];
- m_p->accidental_i_ = $2[1];
- $$->push(m_p);
+ | pitch_list MELODIC_REQUEST_IDENTIFIER {
+ $$->push($2->request(false)->clone()->melodic());
}
;
*mlog << "Parsing ... ";
lexer = new My_flex_lexer;
-#ifdef YYDEBUG
+#ifndef NPRINT
yydebug = !monitor->silence("InitParser") && check_debug;
lexer->set_debug( !monitor->silence("InitLexer") && check_debug);
#endif
lexer->new_input(init);
yyparse();
-#ifdef YYDEBUG
+#ifndef NPRINT
+ if (!monitor->silence("InitDeclarations") && check_debug)
+ lexer->print_declarations();
+
yydebug = !monitor->silence("Parser") && check_debug;
lexer->set_debug( !monitor->silence("Lexer") && check_debug);
#endif
lexer->new_input(s);
yyparse();
+#ifdef NPRINT
+ if (!monitor->silence("Declarations") && check_debug)
+ lexer->print_declarations();
+#endif
delete lexer;
lexer = 0;
*/
#include "voice.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "register.hh"
#include "notehead.hh"
#include "complex-walker.hh"
#include "script-reg.hh"
#include "script.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "complex-walker.hh"
#include "stem.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "paper-def.hh"
#include "script.hh"
#include "stem.hh"
#include "proto.hh"
#include "plist.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "complex-walker.hh"
#include "slur-reg.hh"
#include "slur.hh"
#include "plist.hh"
#include "grouping.hh"
#include "staff.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "staff-walker.hh"
#include "staff-column.hh"
#include "score-column.hh"
#include "debug.hh"
#include "time-description.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
#include "grouping.hh"
#include "score-walker.hh"
#include "score-column.hh"
#include "voice-element.hh"
#include "debug.hh"
-#include "musicalrequest.hh"
-#include "commandrequest.hh" // todo
+#include "musical-request.hh"
+#include "command-request.hh" // todo
#include "midi-stream.hh"
#include "pqueue.hh"
void
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "stem-beam-reg.hh"
#include "beam.hh"
#include "stem.hh"
#include "symbol.hh"
#include "voice.hh"
#include "voice-element.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "staff.hh"
#include "score-column.hh"
#include "staff-column.hh"
*/
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "paper-def.hh"
#include "text-item.hh"
#include "stem.hh"
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "text-reg.hh"
#include "text-item.hh"
#include "debug.hh"
#include "voice.hh"
#include "voice-element.hh"
-#include "musicalrequest.hh"
-#include "commandrequest.hh"
+#include "musical-request.hh"
+#include "command-request.hh"
void
#include "proto.hh"
#include "plist.hh"
-#include "musicalrequest.hh"
+#include "musical-request.hh"
#include "voice-regs.hh"
#include "voice-group-regs.hh"
#include "register.hh"
#include "stem-beam-reg.hh"
#include "script-reg.hh"
#include "complex-walker.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
#include "debug.hh"
#include "dynamic-reg.hh"
*/
#include "proto.hh"
#include "plist.hh"
-#include "commandrequest.hh"
-#include "musicalrequest.hh"
+#include "command-request.hh"
+#include "musical-request.hh"
#include "voice-regs.hh"
#include "register.hh"
#include "slur-reg.hh"
#include "plist.hh"
#include "debug.hh"
#include "voice.hh"
-#include "musicalrequest.hh"
-#include "commandrequest.hh"
+#include "musical-request.hh"
+#include "command-request.hh"
#include "midi-item.hh"
#include "midi-stream.hh"
#include "voice-element.hh"
#include "staff-column.hh"
#include "voice-group-regs.hh"
#include "voice-regs.hh"
-#include "commandrequest.hh"
+#include "command-request.hh"
#include "score-walker.hh"
Walker_registers::Walker_registers(Complex_walker *w)