]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.22
authorfred <fred>
Sun, 24 Mar 2002 19:27:43 +0000 (19:27 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:27:43 +0000 (19:27 +0000)
Documentation/lilygut.pod
hdr/proto.hh
hdr/request.hh
hdr/timedescription.hh
src/parser.y
src/simplestaff.cc

index 295ed2844ce9b28fa3df1b709282f1c3a6f9696f..20d5f0364bc8a4db4678cc4d8b41fa21460c2755 100644 (file)
@@ -5,7 +5,8 @@ LilyGuts - doco to the internals of LilyPond
 =head1 DESCRIPTION
 
 This page documents some aspects of the internals of LilyPond. Some of
-this stuff comes from e-mail I wrote, some from e-mail others wrote, some are large comments taken away from the headers
+this stuff comes from e-mail I wrote, some from e-mail others wrote,
+some are large comments taken away from the headers
 
 =head1 OVERVIEW
 
@@ -67,48 +68,53 @@ Different staffs can produce different outputs; a melodious voice
 which is put into a percussion-Staff, will be typeset as the rythm of
 that voice.
 
-After C<Staff> made up her mind (Would C<Staff> be a smart
-name? How about C<struct Susan {}> :-), the resultant items and
+After C<Staff> made up her mind, the resultant items and
 spanners are put on the PScore, and pointers to these items are
 stored in the C<Voice_element>. This construction enables the
 beams/stems to look up the balls it has to connect to. 
 
 =over 5
 
-=item Note_req
+=item C<Barcheck_req>
+
+Checks during music processing if start of this voice element
+coincides with the start of a measure. Handy to check if you left out
+some voice elts.
+
+=item C<Note_req>
 
 Staff has to decide if the ball should be hanging left or right. This
 influences the horizontal dimensions of a column, and this  is why
 request processing should be done before horizontal spacing.
 
 Other voices' frivolities may cause the need for accidentals, so this
-is also for the Staff to decide. The Staff can decide on positioning
+is also for the  C<Staff> to decide. The  C<Staff> can decide on positioning
 based on ottava commands and the appropriate clef.
 
-=item Rest_req
+=item C<Rest_req>
 
 Why a request? It might be a good idea to not typeset the rest, if the
 paper is too crowded.
 
-=item Span_req
+=item C<Span_req>
 
 This type of request typically results in the creation of a C<Spanner>
 
-=item Beam_req
+=item C<Beam_req>
 
 Staff has to combine this request with the stem_request, since the
 number of flags that a stem wants to carry will determine the
 number of beams.
 
-=item  Dynamic
+=item  C<Dynamic>
 
-Each dynamic is bound to one note ( a crescendo spanning multiple
+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
+note, therefore fore each  C<Dynamic> request carries a time, measured
 from the start of its note.
 
-This subfield would come in handy, if mpp96 was adapted for midi
+This subfield would come in handy, if LilyPond  was adapted for midi
 support.
 
 =back
@@ -145,7 +151,7 @@ This table decribes the proper order for the different commands:
 
 =head1 BREAKING
 
-[Source files: command.hh, scommands.cc]
+[Source files: F<command.hh>, F<scommands.cc>]
 
 BREAKING, PREBREAK POSTBREAK, etc.
 
@@ -226,7 +232,7 @@ This is Columbus' egg: LilyPond attaches "springs" to each
 column-pair.  each spring has an equilibrium-position which is equal to
 the above mentioned distance, so
 
-        spring (col1, col2) and spring(col2,col3) try to push column 1
+spring (col1, col2) and spring (col2,col3) try to push column 1
 and 3 away (to a distance of 20pt) from each other, whereas the spring
 between col 1 and col 3 tries to pull those two together (to a
 distance of 14.1 pt). The net result of this pushing and pulling is an
@@ -283,7 +289,6 @@ signifies a "list of". (This is not complete)
 
 [partly by Mark Basinski <basinski@arizona.edu>]
 
-
 Herbert Chlapik, 
 
 W.A. Hegazy and J. S. Gourlay. Optimal line breaking in music. In
index b11ca6c59f87730ca2a8d4afd3dd7c3e5ae25630..ac215970feaaee45908b813bc0be418b8d815462 100644 (file)
@@ -15,6 +15,7 @@
 struct Absdynamic_req;
 struct Accidental;
 struct Atom;
+struct Barcheck_req;
 struct Beam;
 struct Beam_req;
 struct Box;
index 43b31d75cc98e23e20a374e50317f04a50a57a4c..a6ae0fbc88aa30b0066a06b8a912d91a5ced6350 100644 (file)
@@ -8,14 +8,20 @@
 
 /// a voice element wants something printed
 struct Request {
-    Voice_element*elt;         // indirection.
+    Voice_element*elt_l_;
     
     /****************/
 
     Request();
+    Request(Request const&);
     virtual ~Request(){}
 
     virtual void print()const ;
+    virtual Moment duration() const { return 0.0; }
+    virtual Request* clone() const =0;
+
+    /*  accessors for children */
+    virtual Barcheck_req *barcheck() { return 0; }
     virtual Note_req *note() {return 0;}
     virtual Script_req *script() {return 0;}
     virtual Stem_req *stem() {return 0;}
@@ -26,14 +32,17 @@ struct Request {
     virtual Slur_req *slur() { return 0 ; }
     virtual Rhythmic_req*rhythmic() { return 0; }
     virtual Melodic_req *melodic() { return 0; }
-    virtual Moment duration() const { return 0.0; }
-    virtual Request* clone() const =0;
 };
 
 /**
 see lilygut page
  */
        
+struct Barcheck_req : Request {
+    virtual Barcheck_req *barcheck() { return this; }
+    void print ()const;
+    Request*clone() const;
+};
 
 /// a request with a duration
 struct Rhythmic_req : virtual Request {
@@ -107,6 +116,7 @@ struct Span_req : Request {
        NOSPAN, START, STOP
     } spantype ;
 
+    virtual void print() const;
     Span_req*span() { return this; }
     Span_req();
     virtual Request*clone()const;
@@ -132,6 +142,7 @@ appropriate number over the beam
 
 /// a slur
 struct Slur_req : Span_req {
+
     virtual Request*clone()const;
     virtual Slur_req*slur() { return this; }
 };
@@ -148,6 +159,7 @@ struct Script_req : Request {
     Request *clone()const;
     Script_req(int d, Script_def*);
     ~Script_req();
+    Script_req(Script_req const&);
 };
 /** eg upbow, downbow. Why a request? These symbols may conflict with
 slurs and brackets, so this also a request */
@@ -162,7 +174,8 @@ struct Text_req : Request {
     virtual void print() const;
     Request *clone()const;
     Text_req(int d, Text_def*);
-    ~Text_req();  
+    ~Text_req();
+    Text_req(Text_req const&);
 };
 
 
index 2cdbc8de2380b21f48af7d08ac338bb51a4c1949..2194ee0a16641ac93be9864fe126c12fc9c8ba6a 100644 (file)
@@ -26,11 +26,18 @@ struct Time_description {
     /****************/
     void OK() const;
     Time_description(Rational, const Time_description*);
+    String str()const;
     void print() const;
     void setpartial(Rational p);
     Rational barleft();
     void set_meter(int,int);
+    static int compare (Time_description&, Time_description&);
 };
 
+#include "compare.hh"
+
+
+instantiate_compare(Time_description&,Time_description::compare);
+
 #endif // Time_description_HH
 
index 3ef8d182ff833bcc89f8fa854e8860f3392c971f..a2603284b3de3efecb140cc1e3290ef14ef357b0 100644 (file)
@@ -2,7 +2,6 @@
 #include <iostream.h>
 
 #include "lookup.hh"
-
 #include "misc.hh"
 #include "lexer.hh"
 #include "paper.hh"
@@ -19,7 +18,7 @@
 #define YYDEBUG 1
 #endif
 
-svec<Request*> pre_reqs, post_reqs;
+Array<Request*> pre_reqs, post_reqs;
 
 Paperdef*default_paper();
 %}
@@ -42,9 +41,9 @@ Paperdef*default_paper();
     char c;
     int ii[10];
 
-    svec<String> * strvec;
-    svec<Input_command*> *commandvec;
-    svec<int> *intvec;
+    Array<String> * strvec;
+    Array<Input_command*> *commandvec;
+    Array<int> *intvec;
 
     Input_staff *staff;    
     Input_score *score;
@@ -72,11 +71,11 @@ Paperdef*default_paper();
 %token <ii> NOTENAME 
 %token <real> REAL
 %token <string> STRING
-%token <c> OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS
+
 %token <i> DOTS INT
 %type <consstr> unit
 %type <intvec> pitch_list
-
+%type <c> open_request_parens close_request_parens
 %type <id> declaration
 %type <string> declarable_identifier
 %type <paper> paper_block paper_body
@@ -204,7 +203,7 @@ score_commands_block:
        COMMANDS '{' score_commands_body '}' { $$ =$3;}
        ;
 
-score_commands_body:                   { $$ = new svec<Input_command*>; }
+score_commands_body:                   { $$ = new Array<Input_command*>; }
        | score_commands_body score_command             {
                $$->add($2);
        }
@@ -215,7 +214,7 @@ staff_commands_block: COMMANDS '{' staff_commands_body '}'  {
        ;
 
 staff_commands_body:
-       /* empty */                     { $$ = new svec<Input_command*>; }
+       /* empty */                     { $$ = new Array<Input_command*>; }
        | staff_commands_body staff_command     {
                $$->add($2);
        }
@@ -246,6 +245,10 @@ skipcommand:
 
 score_command:
        skipcommand
+       | BAR STRING                    {
+               $$ = get_bar_command(*$2);
+               delete $2;
+       }
        | METER  int int                {
                $$ = get_meterchange_command($2, $3);
        }
@@ -377,10 +380,20 @@ post_requests:
        ;
 
 post_request:
-       CLOSE_REQUEST_PARENS            { $$ = get_request($1); }
+       close_request_parens            { $$ = get_request($1); }
        | script_req
        | textscript_req
        ;
+close_request_parens:
+       '('     { $$='('; }
+       |']'    { $$ = ']' }
+       ;
+
+open_request_parens:
+       '|'     {$$='|'}
+       |')'    {$$=')'}
+       |'['    {$$='['}
+       ;
 
 script_definition:
        SCRIPT '{' script_body '}'      { $$ = $3; }
@@ -434,7 +447,7 @@ pre_requests:
        ;
 
 pre_request: 
-       OPEN_REQUEST_PARENS             { $$ = get_request($1); }
+       open_request_parens             { $$ = get_request($1); }
        ;
 
 
@@ -489,7 +502,7 @@ voice_elt:
        UTILITIES
 */
 pitch_list:                    {
-               $$ = new svec<int>;
+               $$ = new Array<int>;
        }
        | pitch_list NOTENAME   {
                $$->add($2[0]);
@@ -508,7 +521,7 @@ int:
 
 int_list:
        /* */           {
-               $$ = new svec<int>;
+               $$ = new Array<int>;
        }
        | int_list int          {
                $$->add($2);
index 636b6691de7515aca6ca459b6e227abe78678bb4..f0087ebd3fda6c45786c881b3613c5507d7e3fd1 100644 (file)
@@ -39,9 +39,15 @@ Scalar
 void
 Simple_column::process_requests()
 {
-    for (int i = 0 ; i < v_elts.sz(); i ++)
+    for (int i = 0 ; i < v_elts.size(); i ++)
        for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
            Request *rq= j;
+           if (rq->barcheck()) {
+               if (tdescription_->whole_in_measure) {
+                   error("Barcheck failed, " + tdescription_->str());
+               }
+           }
+                                  
            if (rq->rhythmic()){
                notes.add(rq->rhythmic());
            }