]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.15
authorfred <fred>
Tue, 10 Dec 1996 14:05:30 +0000 (14:05 +0000)
committerfred <fred>
Tue, 10 Dec 1996 14:05:30 +0000 (14:05 +0000)
hdr/identifier.hh
hdr/identparent.hh
src/symtable.cc

index c5d7a5b5b729a858057181ba594a407f940e0245..3ac537f63e1b84914d7bd2bc7aa014964a60087e 100644 (file)
@@ -8,17 +8,24 @@
 #ifndef IDENTIFIER_HH
 #define IDENTIFIER_HH
 #include "identparent.hh"
+#include "symtable.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; }\
+    virtual Class* accessor(bool copy=false) {\
+       if (copy)\
+           return new Class(* (Class*) data);\
+       else\
+           return (Class*) data;\
+    }\
     ~Idclass() { delete accessor(); }\
 }\
 
-
+make_id_class(Lookup_id, Lookup, lookup);
+make_id_class(Symtables_id, Symtables, symtables);
 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);
index d8d3cb17356463dec1bf160ac404e2d236f474ab..dafeed96fae0d3683fed6f5a129784bd877328fe 100644 (file)
@@ -17,12 +17,14 @@ struct Identifier
     
     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); }    
+    
+    virtual Input_staff * staff(bool = false) { assert(false); }
+    virtual Horizontal_music*hmusic(bool = false) { assert(false); }
+    virtual Vertical_music*vmusic(bool = false) { assert(false); }
+    virtual Music_voice *mvoice(bool = false) { assert(false); }
+    virtual Symtables *symtables(bool = false) { assert(false); }
+    virtual Music_general_chord *mchord(bool = false) { assert(false); }
+    virtual Lookup*lookup(bool = false) { assert(false); }
 };
 #endif // IDENTPARENT_HH
 
index 39b6fdead0437943f07df05d00763b4a9b7b41bf..bc5d173869d79c60cbd074914581b56d784e7077 100644 (file)
@@ -5,8 +5,25 @@
 #include "real.hh"
 #include "symbol.hh"
 #include "assoc.hh"
+#include "associter.hh"
 #include "symtable.hh"
+Symtables::Symtables()
+{
+}
+
+Symtables::Symtables(Symtables const &s)
+{
+    for (Assoc_iter<String, Symtable*>  i(s); i.ok(); i++) {
+       add(i.key(), new Symtable(*i.val()));
+    }
+}
 
+Symtables::~Symtables()
+{
+    for (Assoc_iter<String, Symtable*>  i(*this); i.ok(); i++) {
+       delete i.val();
+    }
+}
 
 Symbol 
 Symtable::lookup(String s) const
@@ -25,36 +42,3 @@ Symtables::operator()(String s)
 {
     return Assoc<String, Symtable*>::operator[](s);
 } 
-
-void
-Symtables::read(Text_db &symini)
-{
-     while (!symini.eof()) {
-        Text_record  r(symini++);
-        if (r[0] == "end" )
-            return;
-        assert (r[0] == "table");
-        
-        String tabnam = r[1];
-        Symtable * sp = new Symtable;
-        while (!symini.eof()){
-            r = symini++;
-            if (r[0] == "end")
-                break;
-            
-            if (r.sz() != 6)
-                error("Not enough fields in symbol init");
-            
-            int i=0;
-            String id=r[i++];
-            String tex=r[i++];
-            svec<Real> dims;
-            for (int j=0; j < 4; j++)
-                dims.add( parse_dimen(r[i++]));
-            
-            Symbol s(tex, Box(dims));
-            (*sp)[id] = s;
-        }
-        (*this)[tabnam] = sp;           
-     }
-}