source file of the GNU LilyPond music typesetter
- (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
SCM run_music_function (Lily_parser *, SCM expr);
SCM get_first_context_id (SCM type, Music *m);
SCM make_chord_elements (SCM pitch, SCM dur, SCM modification_list);
-SCM make_chord_step (int step, int alter);
+SCM make_chord_step (int step, Rational alter);
SCM make_simple_markup (SCM a);
bool is_duration (int t);
bool is_regular_identifier (SCM id);
%type <book> book_body
%type <i> bare_unsigned
-%type <i> figured_bass_alteration
+%type <scm> figured_bass_alteration
%type <i> dots
%type <i> exclamations
%type <i> optional_rest
%type <scm> absolute_pitch
%type <scm> assignment_id
%type <scm> bare_number
+%type <scm> unsigned_number
%type <scm> bass_figure
%type <scm> figured_bass_modification
%type <scm> br_bass_figure
lilypond_header_body:
{
- $$ = get_header(PARSER);
+ $$ = get_header (PARSER);
PARSER->lexer_->add_scope ($$);
}
| lilypond_header_body assignment {
repeated_music:
- REPEAT simple_string bare_unsigned music alternative_music
+ REPEAT simple_string unsigned_number music alternative_music
{
- $$ = MAKE_SYNTAX ("repeat", @$, $2, scm_int2num ($3), $4, $5);
+ $$ = MAKE_SYNTAX ("repeat", @$, $2, $3, $4, $5);
}
;
generic_prefix_music_scm {
$$ = run_music_function (PARSER, $1);
}
- | CONTEXT simple_string optional_id optional_context_mod music {
+ | CONTEXT simple_string optional_id optional_context_mod music {
$$ = MAKE_SYNTAX ("context-specification", @$, $2, $3, $5, $4, SCM_BOOL_F);
}
| NEWCONTEXT simple_string optional_id optional_context_mod music {
octave_check:
/**/ { $$ = SCM_EOL; }
| '=' { $$ = scm_from_int (0); }
- | '=' sub_quotes { $$ = scm_from_int ($2); }
+ | '=' sub_quotes { $$ = scm_from_int (-$2); }
| '=' sup_quotes { $$ = scm_from_int ($2); }
;
$$ = p.smobbed_copy ();
}
| TONICNAME_PITCH sub_quotes {
- Pitch p =* unsmob_pitch ($1);
+ Pitch p = *unsmob_pitch ($1);
p = p.transposed (Pitch (-$2,0,0));
$$ = p.smobbed_copy ();
script_abbreviation:
'^' {
- $$ = scm_makfrom0str ("Hat");
+ $$ = scm_from_locale_string ("Hat");
}
| '+' {
- $$ = scm_makfrom0str ("Plus");
+ $$ = scm_from_locale_string ("Plus");
}
| '-' {
- $$ = scm_makfrom0str ("Dash");
+ $$ = scm_from_locale_string ("Dash");
}
| '|' {
- $$ = scm_makfrom0str ("Bar");
+ $$ = scm_from_locale_string ("Bar");
}
| ANGLE_CLOSE {
- $$ = scm_makfrom0str ("Larger");
+ $$ = scm_from_locale_string ("Larger");
}
| '.' {
- $$ = scm_makfrom0str ("Dot");
+ $$ = scm_from_locale_string ("Dot");
}
| '_' {
- $$ = scm_makfrom0str ("Underscore");
+ $$ = scm_from_locale_string ("Underscore");
}
;
;
figured_bass_alteration:
- '-' { $$ = -2; }
- | '+' { $$ = 2; }
- | '!' { $$ = 0; }
+ '-' { $$ = ly_rational2scm (FLAT_ALTERATION); }
+ | '+' { $$ = ly_rational2scm (SHARP_ALTERATION); }
+ | '!' { $$ = scm_from_int (0); }
;
bass_figure:
}
| bass_figure figured_bass_alteration {
Music *m = unsmob_music ($1);
- if ($2) {
+ if (scm_to_double ($2)) {
SCM salter = m->get_property ("alteration");
- int alter = scm_is_number (salter) ? scm_to_int (salter) : 0;
+ SCM alter = scm_is_number (salter) ? salter : scm_from_int (0);
m->set_property ("alteration",
- scm_from_int (alter + $2));
+ scm_sum (alter, $2));
} else {
m->set_property ("alteration", scm_from_int (0));
}
$$ = make_chord_step ($1, 0);
}
| bare_unsigned '+' {
- $$ = make_chord_step ($1, SHARP);
+ $$ = make_chord_step ($1, SHARP_ALTERATION);
}
| bare_unsigned CHORD_MINUS {
- $$ = make_chord_step ($1, FLAT);
+ $$ = make_chord_step ($1, FLAT_ALTERATION);
}
;
}
;
+unsigned_number:
+ bare_unsigned { $$ = scm_from_int ($1); }
+ | NUMBER_IDENTIFIER {
+ $$ = $1;
+ }
+ ;
+
+
exclamations:
{ $$ = 0; }
| exclamations '!' { $$ ++; }
SCM
get_next_unique_context_id ()
{
- return scm_makfrom0str ("$uniqueContextId");
+ return scm_from_locale_string ("$uniqueContextId");
}
static int new_context_count;
char s[128];
snprintf (s, sizeof (s)-1, "uniqueContext%d", new_context_count++);
- return scm_makfrom0str (s);
+ return scm_from_locale_string (s);
}
SCM
-make_chord_step (int step, int alter)
+make_chord_step (int step, Rational alter)
{
if (step == 7)
- alter += FLAT;
+ alter += FLAT_ALTERATION;
while (step < 0)
step += 7;