X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fidentifier.hh;h=de26489e32547afc6f0a5c0f177bbe9ac22ef2dd;hb=55fa3168d0fb5326341ff56d7a1638c89eb2ebaf;hp=1fca04eee3f4f780c390d2602352026aa47f9b46;hpb=a2896b23ce12cc61e9cd4495324c9ca5551cb947;p=lilypond.git diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 1fca04eee3..de26489e32 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -1,7 +1,7 @@ /* identifier.hh -- part of GNU LilyPond - (c) 1996,97 Han-Wen Nienhuys + (c) 1996--1998 Han-Wen Nienhuys */ #ifndef IDENTIFIER_HH @@ -12,60 +12,97 @@ #include "input.hh" #include "virtual-methods.hh" -/* boolean argument to accesor is copy_b..*/ -#define IDACCESSOR( Input_staff, staff)\ - virtual Input_staff * staff(bool) { error(#Input_staff); return 0; } +#define DECLARE_TYPE_NAME(Class) +class Translator_identifier; +class Music_identifier; +class General_script_def_identifier; +class Symtables_identifier; +class Midi_def_identifier; +class Paper_def_identifier; +class Lookup_identifier; +class Real_identifier; +class int_identifier; +class String_identifier; +class Request_identifier; +class Score_identifier; +class Duration_identifier; + + +#define IDACCESSOR(Class)\ +virtual Class * access_ ## Class (bool=true) const { error (#Class + String ("_identifier")); return 0; }\ +virtual Class ## _identifier * access_ ## Class ## _identifier () { return 0; } + +/** + A declarable data structure in mudela. + + + */ struct Identifier : public Input { - void *data; - String name_str_; - bool init_b_; - bool accessed_b_; - int token_code_i_; - - Identifier(String n, int code) ; - virtual ~Identifier() ; - - void print()const; - NAME_MEMBERS(); - void error(String); - IDACCESSOR(Music, music) - IDACCESSOR(Input_engraver, igravs) - IDACCESSOR(General_script_def, script) - IDACCESSOR(Symtables, symtables) - IDACCESSOR(Paper_def, paperdef) - IDACCESSOR(Lookup,lookup) - IDACCESSOR(Real,real) - IDACCESSOR(Request, request) - IDACCESSOR(Score, score) - IDACCESSOR(int, intid) + bool init_b_; + bool accessed_b_; + int token_code_i_; + Identifier (Identifier const&); + Identifier (int code) ; + virtual ~Identifier() ; + + + void print() const; + DECLARE_MY_RUNTIME_TYPEINFO; + void error (String) const; + String str () const; + IDACCESSOR(Translator) + IDACCESSOR(Music) + IDACCESSOR(General_script_def) + IDACCESSOR(Symtables) + IDACCESSOR(Midi_def) + IDACCESSOR(Paper_def) + IDACCESSOR(Lookup) + IDACCESSOR(Real) + IDACCESSOR(String) + IDACCESSOR(Request) + IDACCESSOR(Score) + IDACCESSOR(int) + IDACCESSOR(Duration) + VIRTUAL_COPY_CONS (Identifier, Identifier); protected: - virtual void do_print()const=0; -private: - Identifier(Identifier const&); + virtual void do_print () const; + virtual String do_str () const; }; -#define declare_id_class(Idclass, Class, accessor) \ -struct Idclass : Identifier {\ - NAME_MEMBERS(); \ - Idclass(String s, Class*st, int code);\ - virtual Class* accessor(bool copy);\ - ~Idclass();\ - virtual void do_print()const; \ +#define DECLARE_ID_CLASS(Class) \ +struct Class ## _identifier : Identifier {\ + Class *data_p_; \ + DECLARE_MY_RUNTIME_TYPEINFO; \ + Class ## _identifier (Class ## _identifier const&);\ + Class ## _identifier (Class*st, int code);\ + VIRTUAL_COPY_CONS (Class ## _identifier, Identifier);\ + virtual Class ## _identifier * access_ ## Class ## _identifier ()\ + {\ + return this;\ + }\ + virtual Class* access_ ## Class (bool copy_b = true) const;\ + ~Class ## _identifier();\ + virtual void do_print () const; \ + virtual String do_str () const; \ }\ +DECLARE_ID_CLASS(Translator); +DECLARE_ID_CLASS(Duration); +DECLARE_ID_CLASS(Real); +DECLARE_ID_CLASS(String); +DECLARE_ID_CLASS(General_script_def); +DECLARE_ID_CLASS(Lookup); +DECLARE_ID_CLASS(Symtables); +DECLARE_ID_CLASS(Music); +DECLARE_ID_CLASS(int); +DECLARE_ID_CLASS(Score); +DECLARE_ID_CLASS(Request); +DECLARE_ID_CLASS(Paper_def); +DECLARE_ID_CLASS(Midi_def); + +#endif // IDENTIFIER_HH -declare_id_class(Real_id, Real, real); -declare_id_class(Script_id, General_script_def, script); -declare_id_class(Lookup_id, Lookup, lookup); -declare_id_class(Symtables_id, Symtables, symtables); -declare_id_class(Music_id, Music, music); -declare_id_class(Int_id, int, intid); -declare_id_class(Score_id, Score, score); -declare_id_class(Request_id, Request, request); -declare_id_class(Input_gravs_id, Input_engraver, igravs); -declare_id_class(Paper_def_id,Paper_def, paperdef); -#endif // IDENTIFIER_