From: fred Date: Tue, 17 Dec 1996 10:33:12 +0000 (+0000) Subject: lilypond-0.0.17 X-Git-Tag: release/1.5.59~6567 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=032fea50d94105dc3274377a2902de198e6508db;p=lilypond.git lilypond-0.0.17 --- diff --git a/src/parser.y b/src/parser.y index 91f6deaca1..a0b9ed9b2f 100644 --- a/src/parser.y +++ b/src/parser.y @@ -2,6 +2,8 @@ #include #include "lookup.hh" + +#include "misc.hh" #include "lexer.hh" #include "paper.hh" #include "inputstaff.hh" @@ -35,8 +37,7 @@ Paperdef*default_paper(); String *string; const char *consstr; Paperdef *paper; - Horizontal_music *horizontal; - Vertical_music *vertical; + Input_music *music; Music_general_chord *chord; Music_voice *mvoice; int i; @@ -71,15 +72,17 @@ Paperdef*default_paper(); %token NOTENAME %token REAL %token STRING -%token OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS +%token OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS %token DOTS INT %type unit %type pitch_list -%type declaration +%type declaration +%type declarable_identifier %type paper_block paper_body %type dim %type duration +%type duration_length %type voice_elt full_element %type score_command staff_command skipcommand %type score_block score_body @@ -90,9 +93,9 @@ Paperdef*default_paper(); %type staff_commands_block staff_commands_body %type post_request pre_request %type clef_id pitchmod -%type vertical_music +%type music %type music_chord music_chord_body -%type horizontal_music + %type music_voice_body music_voice %type dinterval @@ -113,35 +116,40 @@ mudela: /* empty */ ; mudela_command: - notename_tab { set_notename_tab($1); } + notename_tab { lexer->set($1); } ; /* DECLARATIONS */ add_declaration: declaration { - add_identifier($1); + lexer->add_identifier($1); } ; +declarable_identifier: + NEWIDENTIFIER { $$ = $1; } + | IDENTIFIER { $$ = new String($1->name); } + ; + declaration: - NEWIDENTIFIER '=' staff_block { + declarable_identifier '=' staff_block { $$ = new Staff_id(*$1, $3); delete $1; // this sux } - | NEWIDENTIFIER '=' music_voice { + | declarable_identifier '=' music_voice { $$ = new M_voice_id(*$1, $3); delete $1; } - | NEWIDENTIFIER '=' music_chord { + | declarable_identifier '=' music_chord { $$ = new M_chord_id(*$1, $3); delete $1; } - | NEWIDENTIFIER '=' symtables { + | declarable_identifier '=' symtables { $$ = new Lookup_id(*$1, $3); delete $1; } - | NEWIDENTIFIER '=' notename_tab { + | declarable_identifier '=' notename_tab { $$ = new Notetab_id(*$1, $3); delete $1; } @@ -216,8 +224,14 @@ staff_command: } ; +duration_length: + duration { + $$ = wholes($1[0], $1[1]); + } + ; + skipcommand: - SKIP int ':' REAL { + SKIP int ':' duration_length { $$ = get_skip_command($2, $4); } @@ -226,7 +240,7 @@ score_command: | METER int int { $$ = get_meterchange_command($2, $3); } - | PARTIAL REAL { + | PARTIAL duration_length { $$ = get_partial_command($2); } | GROUPING int_list { @@ -278,7 +292,7 @@ staff_init: staff_body: staff_init - | staff_body horizontal_music { + | staff_body music { $$->add($2); } | staff_body staff_commands_block { @@ -290,15 +304,12 @@ staff_body: /* MUSIC */ -horizontal_music: +music: music_voice { $$ = $1; } + | music_chord { $$ = $1; } ; -vertical_music: - music_chord { $$ = $1; } - ; - -music_voice: MUSIC '{' music_voice_body '}' { $$ = $3; } +music_voice: MUSIC '{' music_voice_body '}' { $$ = $3; } ; music_voice_body: { @@ -308,28 +319,31 @@ music_voice_body: { $$->concatenate($2->mvoice()); } | music_voice_body full_element { - $$->add($2); + $$->add_elt($2); } | music_voice_body voice_command { } - | music_voice_body vertical_music { + | music_voice_body music { $$->add($2); } ; -music_chord: CHORD '{' music_chord_body '}' { $$ = $3; } +music_chord: '{' music_chord_body '}' { $$ = $2; } ; music_chord_body: { $$ = new Music_general_chord; } - | music_voice_body IDENTIFIER { + | music_chord_body IDENTIFIER { $$->concatenate($2->mchord()); } - | music_chord_body horizontal_music { + | music_chord_body music { $$ -> add($2); } + | music_chord_body full_element { + $$ ->add_elt($2); + } ; @@ -424,7 +438,7 @@ int: REAL { $$ = int($1); if (ABS($1-Real(int($$))) > 1e-8) - yyerror("expecting integer number"); + error("expecting integer number"); } | INT ; @@ -491,11 +505,16 @@ symtable_body: ; symboldef: - STRING box { + STRING box { $$ = new Symbol(*$1, *$2); delete $1; delete $2; } + | STRING { + Box b; + $$ = new Symbol(*$1, b); + delete $1; + } ; box: @@ -522,18 +541,16 @@ parse_file(String s) yydebug = !monitor.silence("Parser") && check_debug; #endif - new_input("symbol.ini"); + set_lexer(); + lexer->new_input("symbol.ini"); yyparse(); - new_input(s); + lexer->new_input(s); yyparse(); - - delete_identifiers(); kill_lexer(); - *mlog << "\n"; } Paperdef* default_paper() { - return new Paperdef(lookup_identifier("default_table")->lookup(true)); + return new Paperdef(lexer->lookup_identifier("default_table")->lookup(true)); } diff --git a/src/qlpsolve.cc b/src/qlpsolve.cc index 13bd30e89b..21af7cdcb0 100644 --- a/src/qlpsolve.cc +++ b/src/qlpsolve.cc @@ -67,6 +67,7 @@ Active_constraints::add(int k) // update of matrices Vector Ha = H*a; Real aHa = a*Ha; + Vector addrow(Ha.dim()); if (ABS(aHa) > EPS) { /* a != 0, so if Ha = O(EPS), then @@ -74,13 +75,14 @@ Active_constraints::add(int k) if H*a == 0, the constraints are dependent. */ - H -= Matrix(Ha , Ha)/(aHa); + H -= Matrix(Ha/aHa , Ha); /* sorry, don't know how to justify this. .. */ - Vector addrow(Ha/(aHa)); + addrow=Ha; + addrow/= aHa; A -= Matrix(A*a, addrow); A.insert_row(addrow,A.rows()); }else @@ -103,12 +105,16 @@ Active_constraints::drop(int k) /* */ - H += Matrix(a,a)/(a*opt->quad*a); - A -= A*opt->quad*Matrix(a,a)/(a*opt->quad*a); + Real q = a*opt->quad*a; + H += Matrix(a,a/q); + A -= A*opt->quad*Matrix(a,a/q); }else WARN << "degenerate constraints"; + #ifndef NDEBUG Vector rem_row(A.row(q)); - assert(rem_row.norm() < EPS); + assert(rem_row.norm() < EPS); + #endif + A.delete_row(q); } diff --git a/src/score.cc b/src/score.cc index ca468ee6ae..4c584c4ea7 100644 --- a/src/score.cc +++ b/src/score.cc @@ -10,7 +10,7 @@ void Score::process() { - *mlog << "Processing ... "; + *mlog << "\nProcessing ... "; assert (paper_);