From: fred Date: Mon, 2 Dec 1996 22:44:48 +0000 (+0000) Subject: lilypond-0.0.14 X-Git-Tag: release/1.5.59~6691 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6440d194c41927e5f624728e872ffc0b79b2c1ba;p=lilypond.git lilypond-0.0.14 --- diff --git a/hdr/identifier.hh b/hdr/identifier.hh index f1d99678d9..c5d7a5b5b7 100644 --- a/hdr/identifier.hh +++ b/hdr/identifier.hh @@ -7,30 +7,21 @@ #ifndef IDENTIFIER_HH #define IDENTIFIER_HH -#include "proto.hh" -#include "string.hh" - -struct Identifier -{ - void *data; - String name; - - Identifier(String n) ; - virtual ~Identifier(); - virtual Staff * staff() { assert(false); } - virtual Voice_list * voices() { assert(false); } -}; - -struct Staff_id : Identifier { - Staff_id(String s, Staff*st):Identifier(s) { data = st; } - virtual Staff* staff() { return (Staff*) data; } - ~Staff_id(); -}; - -struct Voices_id : Identifier { - Voices_id(String s, Voice_list*st):Identifier(s) { data = st; } - virtual Voice_list * voices() { return (Voice_list*)data; } - ~Voices_id(); -}; +#include "identparent.hh" +#include "inputstaff.hh" +#include "inputmusic.hh" + +#define make_id_class(Idclass, Class, accessor) \ +struct Idclass : Identifier {\ + Idclass(String s, Class*st):Identifier(s) { data = st; }\ + virtual Class* accessor() { return (Class*) data; }\ + ~Idclass() { delete accessor(); }\ +}\ + + +make_id_class(Staff_id, Input_staff, staff); +make_id_class(M_chord_id, Music_general_chord, mchord); +make_id_class(M_voice_id, Music_voice, mvoice); + #endif // IDENTIFIER_HH diff --git a/hdr/identparent.hh b/hdr/identparent.hh new file mode 100644 index 0000000000..d8d3cb1735 --- /dev/null +++ b/hdr/identparent.hh @@ -0,0 +1,30 @@ +/* + identparent.hh -- part of LilyPond + + (c) 1996 Han-Wen Nienhuys +*/ + +#ifndef IDENTPARENT_HH +#define IDENTPARENT_HH + +#include "proto.hh" +#include "string.hh" + +struct Identifier +{ + void *data; + String name; + + Identifier(String n) : name(n) { } + virtual ~Identifier() {} + virtual Input_staff * staff() { assert(false); } + virtual Voice_list * voices() { assert(false); } + virtual Horizontal_music*hmusic() { assert(false); } + virtual Vertical_music*vmusic() { assert(false); } + virtual Music_voice *mvoice() { assert(false); } + virtual Music_general_chord *mchord() { assert(false); } +}; +#endif // IDENTPARENT_HH + + + diff --git a/src/table.cc b/src/table.cc index 7a54241f9f..cfb0db0cb9 100644 --- a/src/table.cc +++ b/src/table.cc @@ -1,7 +1,8 @@ #include "glob.hh" #include "debug.hh" #include "string.hh" -#include "identifier.hh" +#include "inputstaff.hh" +#include "identparent.hh" #include "keyword.hh" #include "associter.hh" #include "parser.hh" @@ -16,7 +17,7 @@ static Keyword_ent the_key_tab[]={ "geometric", GEOMETRIC, "in", IN, "key", KEY, - "melodicstaff", MELODICSTAFF, + "melodic", MELODIC, "meter", METER, "mm", MM, "octave", OCTAVECOMMAND, @@ -24,7 +25,7 @@ static Keyword_ent the_key_tab[]={ "partial", PARTIAL, "paper", PAPER, "pt", PT, - "rhythmstaff", RHYTHMSTAFF, + "rhythmic", RHYTHMIC, "score", SCORE, "skip", SKIP, "staff", STAFF, @@ -36,9 +37,10 @@ static Keyword_ent the_key_tab[]={ "violin", VIOLIN, "voice", VOICE, "voices", VOICES, - "width", WIDTH, + "width", WIDTH, + "music", MUSIC, 0,0 -} ; +}; int