]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.30
authorfred <fred>
Sun, 24 Mar 2002 19:31:09 +0000 (19:31 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:31:09 +0000 (19:31 +0000)
input/error.ly
src/lexer.l
src/note.cc
src/parser.y
src/scriptdef.cc
src/scriptreg.cc [new file with mode: 0644]
src/sourcefile.cc
src/wordwrap.cc

index 9aa92d0710327365ca9df97aaf941adcb3e15b2a..82e5d190c68bd8e25712a3cc3d042650ad6b229a 100644 (file)
@@ -13,6 +13,7 @@ mwa = music {
        a b ,c
        a b c-*
        a b c&
+       { a-. b-. }
        $
 }
 
@@ -22,6 +23,9 @@ bla = music {
        @
 }
 
+
+include "this-is-hopefully-a-nonexisting-file"
+
 score {
        staff { 
                lyric music { bla }
index 0771cafcde864e89880e08155405d98733b84c2b..f0652ac6c78d757f15cee3b22b9a7c8d72089438 100644 (file)
@@ -9,6 +9,7 @@
 #include "parser.hh"
 #include "debug.hh"
 #include "inputscore.hh"
+#include "parseconstruct.hh"
 #include "main.hh"
 
 %}
@@ -220,7 +221,8 @@ include           {
 <incl>[ \t]*      { /* eat the whitespace */ }
 <incl>\"[^"]*\"+   { /* got the include file name */
    String s (YYText()+1);
-       s = s.left(s.len()-1);
+   s = s.left(s.len()-1);
+   defined_ch_c_l = here_ch_c_l() - String( YYText() ).len() - 1;
    new_input(s);
    yy_pop_state();
 }
index 226b10a6015942e9e5938d1c2bff95831d84019a..5c9daee9fd8050985ff403d66c338fb3d7cdfe4e 100644 (file)
@@ -1,7 +1,7 @@
 /*
   could use cleanup
  */
-  #include <ctype.h>
+#include <ctype.h>
 #include "lexer.hh"
 #include "string.hh"
 #include "real.hh"
@@ -121,7 +121,7 @@ get_note_element(String pitch, int * notename, int * duration )
     parse_pitchmod(pitch, i, oct, forceacc);
     rq->notename =notename[0];
     rq->accidental = notename[1];
-    rq->octave = oct;
+    rq->octave = oct + notename[2];
     rq->forceacc = forceacc;
     rq->balltype = dur;
     rq->dots = dots;
@@ -289,7 +289,9 @@ Request*
 get_script_req(int d , Script_def*def)
 {
     Script_req* script_req_p = new Script_req(d, def);
-    script_req_p->defined_ch_c_l_m = defined_ch_c_l;
+//    script_req_p->defined_ch_c_l_m = req_defined_ch_c_l;
+    // all terminal symbols, rather set directly here:
+    script_req_p->defined_ch_c_l_m = lexer->here_ch_c_l();
     return script_req_p;
 }
 
index 09e4bd310aa9a101b1cabb12c40693d1c188378f..71926f60ca6d4d5267c7fd9fbf5f67d628aa3cce 100644 (file)
@@ -64,7 +64,7 @@ int fatal_error_i = 0;
 }
 
 %token VOICE STAFF SCORE TITLE  BAR  OUTPUT MULTIVOICE
-%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
+%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
@@ -78,7 +78,7 @@ int fatal_error_i = 0;
 %token <string> STRING
 
 %token <i> DOTS INT
-%type <consstr> unit
+%type <real> unit
 %type <intvec> pitch_list 
 %type <c> open_request_parens close_request_parens
 %type <id> declaration
@@ -517,7 +517,9 @@ mudela_text:
        ;
 
 script_req:
-       script_dir mudela_script        { $$ = get_script_req($1, $2); }
+       script_dir mudela_script        { 
+               $$ = get_script_req($1, $2);
+       }
        ;
 
 mudela_script:
@@ -704,14 +706,14 @@ int_list:         {
 
 
 dim:
-       real unit       { $$ = convert_dimen($1,$2); }
+       real unit       { $$ = $1*$2; }
        ;
 
 
-unit:  CM              { $$ = "cm"; }
-       |IN             { $$ = "in"; }
-       |MM             { $$ = "mm"; }
-       |PT             { $$ = "pt"; }
+unit:  CM_T            { $$ = 1 CM; }
+       |IN_T           { $$ = 1 INCH; }
+       |MM_T           { $$ = 1 MM; }
+       |PT_T           { $$ = 1 PT; }
        ;
        
 /*
index 1e11de72c29934611a0ee275584e9e97afb2c432..508ae6a24ba939b5f1816c21ecdf93c1878fc75b 100644 (file)
@@ -17,7 +17,7 @@ Script_def::print() const
 int
 Script_def::compare(Script_def const & c)
 {
-    return (symidx == c.symidx &&
+    return !(symidx == c.symidx &&
        stemdir == c.stemdir&&
        staffdir == c.staffdir&&
        invertsym == c.invertsym);
diff --git a/src/scriptreg.cc b/src/scriptreg.cc
new file mode 100644 (file)
index 0000000..88375db
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+  scriptreg.cc -- implement Script_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "scriptreg.hh"
+#include "script.hh"
+#include "request.hh"
+#include "complexwalker.hh"
+
+Script_register::Script_register(Complex_walker*w)
+    : Request_register(w)
+{
+    script_p_ = 0;
+}
+
+bool
+Script_register::try_request(Request *r_l)
+{
+    if (!r_l->script())
+       return false ;
+
+    if (accepted_req_arr_.size()
+       && Script_req::compare(*accepted_req_arr_[0]->script(), *r_l->script()))
+       
+       return false;
+
+    accepted_req_arr_.push(r_l);
+    
+    return true;
+}
+
+void
+Script_register::process_request()
+{
+    if (accepted_req_arr_.size() ) {
+       script_p_ = new Script(accepted_req_arr_[0]->script(), 10);
+       announce_element(
+           Staff_elem_info(script_p_, accepted_req_arr_[0], this));
+    }
+}
+
+void
+Script_register::acknowledge_element(Staff_elem_info info)
+{
+    if (!script_p_)
+       return;
+    if (info.elem_p_->name() == String("Stem"))
+       script_p_->set_stem((Stem*)info.elem_p_);
+    else if (info.req_l_->rhythmic())
+       script_p_->set_support(info.elem_p_->item());
+}
+
+void
+Script_register::do_pre_move_process()
+{
+    if (script_p_){
+       script_p_->dir = dir_i_;
+       typeset_element(script_p_);
+       script_p_ = 0;
+    }
+}
+
+void
+Script_register::set_dir(int i)
+{
+    dir_i_ = i;
+}
index 1fe2aa3d53cab26beb474293efbebd2d2192992a..ac164fd94ab84b37a2071bb668eecdde3a13f1e8 100644 (file)
@@ -17,6 +17,9 @@
 #include "string.hh"
 #include "proto.hh"
 #include "plist.hh"
+#include "lexer.hh"
+#include "debug.hh"
+#include "parseconstruct.hh"
 #include "main.hh"                     // find_file
 
 #include "sourcefile.hh"
@@ -143,12 +146,13 @@ Source_file::line_i( char const* pos_ch_c_l )
 void
 Source_file::map()
 {
+    if ( fildes_i_m == -1 )
+       return;
+
     data_caddr_m = (caddr_t)mmap( (void*)0, size_off_m, PROT_READ, MAP_SHARED, fildes_i_m, 0 );
 
-    if ( (int)data_caddr_m == -1 ) {
-       cerr << "lilypond: can't map: " << name_str_m << ": " << strerror( errno ) << endl;
-       assert( 0 );
-    }
+    if ( (int)data_caddr_m == -1 )
+       warning( String( "can't map: " ) + name_str_m + String( ": " ) + strerror( errno ), defined_ch_c_l ); //lexer->here_ch_c_l() );
 }
 
 String
@@ -160,12 +164,15 @@ Source_file::name_str()
 void
 Source_file::open()
 {
-    name_str_m = find_file( name_str_m );
+    String name_str = find_file( name_str_m );
+    if ( name_str != "" ) 
+        name_str_m = name_str;
+
     fildes_i_m = ::open( name_str_m, O_RDONLY );       
-    
+           
     if ( fildes_i_m == -1 ) {
-       cerr << "lilypond: can't open: " << name_str_m << ": " << strerror( errno ) << endl;
-       assert( 0 );
+       warning( String( "can't open: " ) + name_str_m + String( ": " ) + strerror( errno ), defined_ch_c_l ); // lexer->here_ch_c_l() );
+        return;
     }
 
     struct stat file_stat;
index 469d2d1d293205919a0ce4b9b9020c37a4c0083a..90d4d542dc7504ab23a8efa956d61c42cd210353 100644 (file)
@@ -2,13 +2,12 @@
 #include "pscore.hh"
 #include "debug.hh"
 
-/* el stupido. This should be done more accurately:
+/** el stupido. This should be done more accurately:
 
    It would be nice to have a Dynamic Programming type of algorithm
    similar to TeX's
    
     */
-
 Array<Col_hpositions>
 Word_wrap::solve()
 {
@@ -64,7 +63,8 @@ Word_wrap::solve()
            curcol ++;
            break_idx_i++;
        }
-       mtor << "Adding cols~, next breakpoint " << break_idx_i << '\n';
+
+       *mlog << "[" <<break_idx_i<<"]"<<flush;
        breaking.push(minimum);
     }