lilypond-0.1.37
[lilypond.git] / src / identifier.cc
blob59f1ff5d83c0cfdc288728f995b74d11e3c066d3
1 /*
2 identifier.cc -- implement identifier and derived classes
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include <assert.h>
11 #include "identifier.hh"
12 #include "lexer.hh"
13 #include "debug.hh"
15 void
16 Identifier::error(String expect)
18 String e("Wrong identifier type: ");
19 e += String(classname()) + "(expected " + expect + ")";
20 ::error(e);
23 void
24 Identifier::print()const
26 mtor << "identifier \'" << name << "\'=";
27 do_print();
30 /* ugh. */
31 #define DEFAULT_PRINT(Class, Content_type, accessor) \
32 void \
33 Class::do_print() const { \
34 ((Class*)this)->accessor(false)->print(); \
35 } \
36 class Class
38 DEFAULT_PRINT(Script_id, Script_def, script);
39 DEFAULT_PRINT(Lookup_id, Lookup, lookup);
40 DEFAULT_PRINT(Symtables_id, Symtables, symtables);
41 DEFAULT_PRINT(Staff_id, Input_staff, staff);
42 DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord);
43 DEFAULT_PRINT(M_voice_id, Music_voice, mvoice);
45 void
46 Real_id::do_print() const
48 Identifier::print();
49 mtor << *((Real_id*)this)->real(false)<< "\n";
52 void
53 Notetab_id::do_print() const
55 mtor << "unknown" << "\n";