#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
--- /dev/null
+/*
+ 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
+
+
+
#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"
"geometric", GEOMETRIC,
"in", IN,
"key", KEY,
- "melodicstaff", MELODICSTAFF,
+ "melodic", MELODIC,
"meter", METER,
"mm", MM,
"octave", OCTAVECOMMAND,
"partial", PARTIAL,
"paper", PAPER,
"pt", PT,
- "rhythmstaff", RHYTHMSTAFF,
+ "rhythmic", RHYTHMIC,
"score", SCORE,
"skip", SKIP,
"staff", STAFF,
"violin", VIOLIN,
"voice", VOICE,
"voices", VOICES,
- "width", WIDTH,
+ "width", WIDTH,
+ "music", MUSIC,
0,0
-} ;
+};
int