From 6a30b6a86ca4fb7852275a4e8cb2f389d3477da6 Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 18 Nov 1996 12:30:01 +0000 Subject: [PATCH] lilypond-0.0.10 --- src/clefitem.cc | 34 ++++++++++++++++++++++++++++++++++ src/parser.y | 29 +++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 src/clefitem.cc diff --git a/src/clefitem.cc b/src/clefitem.cc new file mode 100644 index 0000000000..796cda389e --- /dev/null +++ b/src/clefitem.cc @@ -0,0 +1,34 @@ +#include "clefitem.hh" +#include "string.hh" +#include "molecule.hh" +#include "paper.hh" +#include "lookup.hh" +#include "clef.hh" + +Clef_item::Clef_item() +{ + read("violin"); +} +void +Clef_item::read(String t) +{ + type = t; + if (type == "violin") + y_off = 2; + if (type == "bass") + y_off = 6; +} +void +Clef_item::read(Clef k) +{ + read(k.clef_type); +} + +void +Clef_item::preprocess() +{ + Symbol s = paper()->lookup_->clef(type); + output = new Molecule(Atom(s)); + output->translate(Offset(0, paper()->interline()/2 * y_off)); +} + diff --git a/src/parser.y b/src/parser.y index 691d306e78..376df8226d 100644 --- a/src/parser.y +++ b/src/parser.y @@ -36,11 +36,13 @@ svec pre_reqs, post_reqs; Request* request; int i; char c; + svec * strvec; } %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS %token MELODICSTAFF GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND +%token KEY CLEF VIOLIN BASS %token IDENTIFIER %token NEWIDENTIFIER @@ -64,8 +66,8 @@ svec pre_reqs, post_reqs; %type int %type score_commands_block score_commands_body %type post_request pre_request - - +%type pitch_list +%type clef_id %% mudela: /* empty */ @@ -235,7 +237,7 @@ voice_command: ; voice_elt: - PITCH DURATION { + PITCH DURATION { $$ = get_note_element(*$1, *$2); delete $1; delete $2; @@ -253,6 +255,14 @@ voice_elt: } ; +pitch_list: { + $$ = new svec; + } + | pitch_list PITCH { + $$->add(*$2); + delete $2; + } + score_command: SKIP int ':' REAL { $$ = get_skip_command($2, $4); @@ -260,12 +270,23 @@ score_command: | METER int int { $$ = get_meterchange_command($2, $3); } + | KEY '$' pitch_list '$' {/*UGH*/ + $$ = get_key_interpret_command(*$3); + delete $3; + } + | CLEF clef_id { + $$ = get_clef_interpret_command(*$2); + delete $2; + } /* | PARTIALMEASURE REAL { $$ = get_partial_command($2); }*/ ; - +clef_id: + VIOLIN { $$ = new String("violin"); } + | BASS { $$ = new String("bass"); } + ; int: REAL { $$ = int($1); -- 2.39.5