]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.26
authorfred <fred>
Sun, 24 Mar 2002 19:29:03 +0000 (19:29 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:29:03 +0000 (19:29 +0000)
TODO
src/parser.y
src/texbeam.cc
src/voiceregs.cc [new file with mode: 0644]

diff --git a/TODO b/TODO
index 01f9c087c515a19fd7d8a5e0ad5dbd2c8a01fb13..9f422946dc6101707b386b645b6c908051bd5d19 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
 BUGS
-       * first clef
+       * first clef isn't printed
 
 SEVERELY LACKING:
 
@@ -7,9 +7,7 @@ SEVERELY LACKING:
 
 INPUTLANGUAGE
 
-       * lexer condition stack
-
-       * lose the $ and @?
+       * lose the $ and @ ?
 
        * figured bass?
 
@@ -23,7 +21,7 @@ SMALLISH PROJECTS
 
        * make spanner for staffsym
        
-       * Lyric_req : Text_req, Rhythmic_req
+       * Lyric_req: Text_req, Rhythmic_req
        
        * Lookup::tex_glissando, Lookup::tex_bracket,
        Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an
@@ -35,7 +33,7 @@ SMALLISH PROJECTS
        
        * C meter iso 4/4
 
-       * textspanner: dir of beam.
+       * textspanner: center position
 
        * script-spacing
 
@@ -43,13 +41,19 @@ SMALLISH PROJECTS
 
        * space rest.
 
-       * use (char *) iso. String for communication between lexer and parser.
+       * use (char *) iso. String for communication between lexer and
+       parser.
 
        * As vs. as  notename.
 
        * configure idealspacing: arithmetic spacing
 
-       * fix symbols in parser.o: `Warning: size of symbol'
+       * fix linking: `Warning: size of symbol'
+
+BIGGISH PROJECT
+
+       * merge musical & non-musical column. Scrap Commands in favour
+       of Requests, and do multiparralel meters
 
 DOC
 
@@ -58,11 +62,10 @@ DOC
        * all errors
 
 FUTURE
-       * Command_req
-       
-       * scrap stem_request?
 
-       * put requests on barcommands 
+       * syntax: grouping 2*4 3*8.
+
+       * put scripts on barcommands 
 
        * glissando
 
@@ -80,14 +83,18 @@ FUTURE
 
        * QLP for beams?
 
-       * stacked slurs.
-
        * revise calcideal
 
        * eentje/tweetje
 
 IDEAS
 
+       * voice terminate req.
+
+       * keep input in mem, store char* to define spots
+
+       * enter Requests directly
+
        * itemcolumns
 
        * check out PMX
index aa3b4f2f3792cbd560a1ed1d302f779972845955..f36d153113cfa3272f815382ab9c3c3fe1f34dc2 100644 (file)
@@ -20,8 +20,9 @@
 
 Array<Request*> pre_reqs, post_reqs;
 sstack<String> define_spots;
-
+extern bool want_beam;
 Paperdef*default_paper();
+
 %}
 
 
@@ -63,13 +64,12 @@ Paperdef*default_paper();
 %token VOICE STAFF SCORE TITLE  BAR NOTENAME OUTPUT
 %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
 %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
-o%token KEY CLEF MULTI TABLE CHORD VOICES
-%token PARTIAL RHYTHMIC MELODIC MUSIC LYRIC GROUPING CADENZA
+%token KEY CLEF MULTI TABLE CHORD VOICES
+%token PARTIAL MUSIC GROUPING CADENZA
 %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET
 %token MARK GOTO
 
 %token <id>  IDENTIFIER
-%token <string> NEWIDENTIFIER 
 %token <string> PITCHMOD DURATION RESTNAME
 %token <ii> NOTENAME 
 %token <real> REAL
@@ -135,7 +135,7 @@ add_declaration: declaration        {
        ;
 
 declarable_identifier:
-       NEWIDENTIFIER { $$ = $1; }
+       STRING { $$ = $1; }
        | IDENTIFIER { $$ = new String($1->name); }
        ;
 
@@ -212,10 +212,10 @@ score_commands_block:
 
 score_commands_body:                   { $$ = new Array<Input_command*>; }
        | score_commands_body score_command             {
-               $$->add($2);
+               $$->push($2);
        }
        | score_commands_body position_command          {
-               $$->add($2);
+               $$->push($2);
        }
        ;
 
@@ -226,10 +226,10 @@ staff_commands_block: COMMANDS '{' staff_commands_body '}'        {
 staff_commands_body:
        /* empty */                     { $$ = new Array<Input_command*>; }
        | staff_commands_body staff_command     {
-               $$->add($2);
+               $$->push($2);
        }
        | staff_commands_body position_command  {
-               $$->add($2);
+               $$->push($2);
        }
        ;
 
@@ -324,14 +324,9 @@ staff_block:
 
 staff_init:
        IDENTIFIER              { $$ = $1->staff(true); }
-       | RHYTHMIC              {
-               $$ = new Input_staff("rhythmic");
-       }
-       | MELODIC               {
-               $$ = new Input_staff( "melodic");
-       }
-       | LYRIC                 {
-               $$ = new Input_staff( "lyric");
+       | STRING                {
+               $$ = new Input_staff(*$1);
+               delete $1;
        }
        ;
 
@@ -415,7 +410,7 @@ post_requests:
                assert(post_reqs.empty());
        }
        | post_requests post_request {
-               post_reqs.add($2);
+               post_reqs.push($2);
        }
        ;
 
@@ -424,14 +419,15 @@ post_request:
        | script_req
        | textscript_req
        ;
+
 close_request_parens:
        '('     { $$='('; }
-       |']'    { $$ = ']' }
+       |']'    { $$=']'; }
        ;
 
 open_request_parens:
-       ')'     {$$=')'}
-       |'['    {$$='['}
+       ')'     { $$=')'; }
+       |'['    { $$='['; }
        ;
 
 script_definition:
@@ -481,7 +477,7 @@ script_dir:
 
 pre_requests:
        | pre_requests pre_request {
-               pre_reqs.add($2);
+               pre_reqs.push($2);
        }
        ;
 
@@ -554,8 +550,8 @@ pitch_list:                 {
                $$ = new Array<int>;
        }
        | pitch_list NOTENAME   {
-               $$->add($2[0]);
-               $$->add($2[1]);         
+               $$->push($2[0]);
+               $$->push($2[1]);                
        }
        ;
 
@@ -573,7 +569,7 @@ int_list:
                $$ = new Array<int>;
        }
        | int_list int          {
-               $$->add($2);
+               $$->push($2);
        }
        ;
 
@@ -657,22 +653,26 @@ void
 parse_file(String s)
 {
    *mlog << "Parsing ... ";
+   lexer = new My_flex_lexer;
 
 #ifdef YYDEBUG
    yydebug = !monitor.silence("InitParser") && check_debug;
+   lexer->set_debug( !monitor.silence("InitLexer") && check_debug);
 #endif
 
-   set_lexer();
    lexer->new_input("symbol.ini");
    yyparse();
 
 #ifdef YYDEBUG
    yydebug = !monitor.silence("Parser") && check_debug;
+   lexer->set_debug( !monitor.silence("Lexer") && check_debug);
 #endif
 
    lexer->new_input(s);
    yyparse();
-   kill_lexer();
+   delete lexer;
+   lexer = 0;
+
    assert(define_spots.empty());
 }
 
index bded0d7751661cce243332489b5783aeda5659b7..4c59ce3263aaa906373b9739449ffd91c8af18d3 100644 (file)
@@ -19,8 +19,8 @@ Lookup::beam_element(int sidx, int widx, Real slope)
     Symbol bs=(*symtables_)("beamslopes")->lookup("slope");
     
     Array<String> args;
-    args.add(sidx);
-    args.add(widx);
+    args.push(sidx);
+    args.push(widx);
     bs.tex = substitute_args(bs.tex,args);
     int w = 2 << widx;
     Real width = convert_dimen(w,"pt");
@@ -52,8 +52,8 @@ Lookup::rule_symbol(Real height, Real width)
 {
     Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal");    
     Array<String> args;
-    args.add(print_dimen(height));
-    args.add(print_dimen(width));
+    args.push(print_dimen(height));
+    args.push(print_dimen(width));
     bs.tex = substitute_args(bs.tex,args);
     bs.dim.x = Interval(0,width);
     bs.dim.y = Interval(0,height);
diff --git a/src/voiceregs.cc b/src/voiceregs.cc
new file mode 100644 (file)
index 0000000..b13fd01
--- /dev/null
@@ -0,0 +1,169 @@
+#include "rest.hh"
+#include "notehead.hh"
+#include "paper.hh"
+#include "debug.hh"
+#include "slur.hh"
+#include "request.hh"
+#include "complexwalker.hh"
+#include "complexstaff.hh"
+#include "voicegroup.hh"
+#include "register.hh"
+
+Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p)
+    : head_reg_(c_l), slur_reg_(c_l)
+{
+    voice_l_ = v_p;
+}
+
+bool
+Voice_registers::try_request(Request * r_l)
+{
+    bool b = head_reg_.try_request(r_l);
+    if (!b)
+       b = slur_reg_.try_request(r_l);
+    return b;
+}
+
+void
+Voice_registers::announce_element(Staff_elem_info i)
+{
+    if (i.voice_l_ != voice_l_)
+       return;
+    if (i.origin_reg_l_ != &slur_reg_)
+       slur_reg_.acknowledge_element(i);
+}
+
+void
+Voice_registers::pre_move_processing()
+{
+    head_reg_.pre_move_processing();
+    slur_reg_.pre_move_processing();
+}
+void
+Voice_registers::post_move_processing()
+{
+    head_reg_.post_move_processing();
+    slur_reg_.post_move_processing();
+}
+
+void
+Voice_registers::process_requests()
+{
+    head_reg_.process_request();
+    slur_reg_.process_request();
+}
+
+/****************/
+
+Notehead_register::Notehead_register(Complex_walker*w_l)
+    :Request_register(w_l)
+{
+    note_l_ = 0;
+}
+
+bool
+Notehead_register::try_request(Request *req_l) 
+{
+    if (req_l->note() || req_l->rest())
+       accepted_req_arr_.push(req_l);
+    else
+       return false;
+
+    return true;
+}
+
+void
+Notehead_register::process_request()
+{
+    Request* req_l = accepted_req_arr_.last();
+    if (req_l->note()) {
+       Notehead*n_p = new Notehead(8); // ugh
+       note_l_ = n_p;
+       n_p->set_rhythmic(req_l->rhythmic());
+       n_p->position = req_l->note()->height() + -2;
+    } else {
+       note_l_ = new Rest ( req_l->rhythmic()->balltype,
+                            req_l->rhythmic()->dots);
+       if (req_l->rhythmic()->balltype <= 2)
+           note_l_->translate(
+               Offset(0,
+                      5 * walk_l_->staff()->paper()->internote()));
+    }
+    Staff_elem_info itinf(note_l_,req_l,this);
+    walk_l_->announce_element(itinf);
+}
+
+void
+Notehead_register::do_pre_move_process()
+{
+    if (note_l_) {
+       walk_l_->typeset_element(note_l_);
+       note_l_ = 0;
+    }
+}
+
+/****************/
+/****************/
+
+Slur_register::Slur_register(Complex_walker* w)
+    : Request_register(w)
+{
+}
+
+bool
+Slur_register::try_request(Request *req_l)
+{
+    if(!req_l->slur())
+       return false;
+
+    accepted_req_arr_.push(req_l);
+    return true;
+}
+
+void
+Slur_register::acknowledge_element(Staff_elem_info info)
+{
+    if (info.elem_p_->name() == String("Notehead")) { 
+       Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh
+       for (int i = 0; i < slur_l_stack_.size(); i++)
+           slur_l_stack_[i]->add(head_p );
+       for (int i = 0; i < end_slur_l_arr_.size(); i++)
+           end_slur_l_arr_[i]->add(head_p);
+    }
+}
+
+void
+Slur_register::process_request()
+{
+    Array<Slur*> start_slur_l_arr_;
+    for (int i=0; i< accepted_req_arr_.size(); i++) {
+       Slur_req* slur_req_l = accepted_req_arr_[i]->slur();
+       if (slur_req_l->spantype == Span_req::STOP) {
+           if (slur_l_stack_.empty())
+               error_t("can't find slur to end; ", 
+                       *walk_l_->col()->tdescription_);
+           end_slur_l_arr_.push(slur_l_stack_.pop());
+           
+       } else  if (slur_req_l->spantype == Span_req::START) {
+           Slur * s_p =new Slur;
+           start_slur_l_arr_.push(s_p);
+           walk_l_->announce_element(Staff_elem_info(s_p, slur_req_l, this));
+       }
+    }
+    for (int i=0; i < start_slur_l_arr_.size(); i++)
+       slur_l_stack_.push(start_slur_l_arr_[i]);
+}
+
+void
+Slur_register::do_pre_move_process()
+{
+    for (int i = 0; i < end_slur_l_arr_.size(); i++)
+       walk_l_->typeset_element(end_slur_l_arr_[i]);
+    end_slur_l_arr_.set_size(0);
+}
+
+Slur_register::~Slur_register()
+{
+    if (slur_l_stack_.size())
+       error("unterminated slur");
+}