]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/identifier.cc
release: 1.3.107
[lilypond.git] / lily / identifier.cc
index 8419dd36073386b9d0bc300d31c7f11bf32a0ab0..28e450ac496c99cd4a8c2a41d15ec4736ce94552 100644 (file)
@@ -3,37 +3,40 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+
+/*
+  JUNKTHIS!
+ */
 #include <assert.h>
-#include "midi-def.hh"
-#include "paper-def.hh"
+
+#include "music-output-def.hh"
 #include "score.hh"
 #include "identifier.hh"
 #include "my-lily-lexer.hh"
 #include "debug.hh"
-#include "request.hh"
-#include "translator.hh"
-#include "notename-table.hh"
+#include "ly-smobs.icc"
 
 
+IMPLEMENT_UNSMOB(Identifier, identifier);
+IMPLEMENT_SMOBS(Identifier);
+IMPLEMENT_DEFAULT_EQUAL_P(Identifier);
 
 Identifier::Identifier (int code)
 {
   token_code_i_ = code;
   accessed_b_ = 0;
-  init_b_ = 0;
+  smobify_self ();
 }
 
-
-
 Identifier::Identifier (Identifier const&s)
   : Input (s)
 {
+  smobify_self ();  
   token_code_i_ = s.token_code_i_;
   accessed_b_ = s.accessed_b_;
-  init_b_ = s.init_b_;
 }
 
 Identifier::~Identifier()
@@ -43,9 +46,7 @@ Identifier::~Identifier()
 void
 Identifier::error (String expect) const
 {
-  String e (_("Wrong identifier type: "));
-  e += _f ("%s expected", expect);
-  ::error (e);
+  ::error (_f ("wrong identifier type, expected: `%s'", expect));
 }
 
 String
@@ -60,33 +61,6 @@ Identifier::do_str () const
   return "";
 }
 
-void
-Identifier::print () const
-{
-  DOUT << "identifier ";
-  do_print ();
-}
-void
-Identifier::do_print () const
-{
-}
-
-/* ugh. */
-#define DEFAULT_PRINT(Class) \
-void \
-Class ## _identifier::do_print () const { \
-  Class *cl = ((Class ## _identifier *)this)->access_content_ ## Class(false);\
-  cl->print (); \
-}
-
-
-
-DEFAULT_PRINT(Translator);
-DEFAULT_PRINT(Music);
-DEFAULT_PRINT(Request);
-DEFAULT_PRINT(Score);
-DEFAULT_PRINT(Midi_def);
-DEFAULT_PRINT(Paper_def);
 
 /* ugh. */
 #define DUMMY_STR(Class) \
@@ -95,29 +69,9 @@ Class ## _identifier::do_str () const { \
   return String (#Class); \
 }
 
-
-DUMMY_STR(Notename_table);
-DUMMY_STR(Translator);
-DUMMY_STR(Music);
-DUMMY_STR(Request);
 DUMMY_STR(Score);
-DUMMY_STR(Midi_def);
-DUMMY_STR(Paper_def);
-DUMMY_STR(Duration);
-
-#define STRING_PRINT(Class) \
-void \
-Class ## _identifier::do_print () const\
-{\
-  DOUT << do_str () << '\n';\
-}\
-
+DUMMY_STR(Music_output_def);
 
-STRING_PRINT(Duration);
-STRING_PRINT(Real);
-STRING_PRINT(int);
-STRING_PRINT(String);
-STRING_PRINT(Notename_table);
   
 #define DEFAULT_STR(Class) \
 String \
@@ -126,9 +80,6 @@ Class ## _identifier::do_str () const\
   return to_str (*data_p_);\
 }
 
-DEFAULT_STR(int);
-DEFAULT_STR(Real);
-DEFAULT_STR(String);
   
 
 /*
@@ -146,7 +97,7 @@ Class ## _identifier::access_content_ ## Class (bool copy_b) const {\
 Class*\
 Class ## _identifier::access_content_ ## Class (bool copy_b) const{\
   ((Class ## _identifier*)this)->accessed_b_ = true;\
-  return copy_b ? (Class*)data_p_->clone() : data_p_;\
+  return copy_b ? dynamic_cast<Class*> (data_p_->clone()) : data_p_;\
 }
 
 #define IMPLEMENT_ID_CLASS(Class)      \
@@ -163,26 +114,23 @@ Class ## _identifier::Class ## _identifier (Class ## _identifier const &s) \
 } 
 
 
-IMPLEMENT_ID_CLASS(Duration);
-IMPLEMENT_ID_CLASS(Translator);
-IMPLEMENT_ID_CLASS(int);
-IMPLEMENT_ID_CLASS(Real);
-IMPLEMENT_ID_CLASS(String);
-IMPLEMENT_ID_CLASS(Music);
 IMPLEMENT_ID_CLASS(Score);
-IMPLEMENT_ID_CLASS(Request);
-IMPLEMENT_ID_CLASS(Midi_def);
-IMPLEMENT_ID_CLASS(Paper_def);
-IMPLEMENT_ID_CLASS(Notename_table);
-VIRTUAL_ACCESSOR(Music);
-VIRTUAL_ACCESSOR(Request);
-VIRTUAL_ACCESSOR(Translator);
-DEFAULT_ACCESSOR(Notename_table);
-DEFAULT_ACCESSOR(Duration);
-DEFAULT_ACCESSOR(int);
-DEFAULT_ACCESSOR(Real);
-DEFAULT_ACCESSOR(String);
+IMPLEMENT_ID_CLASS(Music_output_def);
+VIRTUAL_ACCESSOR(Music_output_def);
 DEFAULT_ACCESSOR(Score);
-DEFAULT_ACCESSOR(Midi_def);
-DEFAULT_ACCESSOR(Paper_def);
+
+
+int
+Identifier::print_smob (SCM s, SCM p, scm_print_state*)
+{
+ return 1;  
+}
+
+SCM
+Identifier::mark_smob (SCM s)
+{
+  return SCM_EOL;
+}
+
+