]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.16
authorfred <fred>
Sun, 24 Mar 2002 19:26:37 +0000 (19:26 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:26:37 +0000 (19:26 +0000)
Sources.make
Variables.make
hdr/identifier.hh
hdr/identparent.hh
src/identifier.cc [new file with mode: 0644]
src/notename.cc

index 7a648e169b270592ae1af233e8290c1b1d8b5617..25bd89dfb16a6a760e09d0d7a0917f55b7a5d604 100644 (file)
@@ -39,7 +39,7 @@ mycc=   qlp.cc qlpsolve.cc leastsquares.cc\
        swalker.cc scoreline.cc\
        simplewalker.cc\
        texbeam.cc texslur.cc clef.cc key.cc slur.cc beam.cc\
-       idealspacing.cc inputcommand.cc grouping.cc\
+       idealspacing.cc inputcommand.cc grouping.cc identifier.cc\
        template1.cc template2.cc template3.cc template4.cc\
        version.cc
 
index 34bfb9fb6f8c83d777b88f772688511febf85dd3..35959bd20c2b270b744e51165065f10d5f947660 100644 (file)
@@ -6,10 +6,11 @@
 OPTIFLAG=-DNDEBUG -DNPRINT -O2
 DEBUGFLAG=-g
 # turn off -pipe if linker doesn't support it
-EXTRACXXFLAGS=-pipe -Wall -W  -pedantic 
+EXTRACXXFLAGS=-pipe -Wall -W   -Wmissing-prototypes 
+#      -Woverloaded-virtual
 
 ####
-#### EN USER CONFIGURABLE part.
+#### END USER CONFIGURABLE part.
 ####
 
 ifdef PROFILEFLAG
@@ -28,8 +29,9 @@ endif
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=15
+PATCHLEVEL=16
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
+CXXVER=`$(CXX) --version`
 
 # directories
 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
index 3ac537f63e1b84914d7bd2bc7aa014964a60087e..da4bfb6b7b913e71c11b64a9daa1ba62c1dc05e4 100644 (file)
 #include "symtable.hh"
 #include "inputstaff.hh"
 #include "inputmusic.hh"
+#include "notename.hh"
+#include "lookup.hh"
 
 #define make_id_class(Idclass, Class, accessor)        \
 struct Idclass : Identifier {\
+    virtual const char *classname() { return #Class; }\
     Idclass(String s, Class*st):Identifier(s) { data = st; }\
     virtual Class* accessor(bool copy=false) {\
        if (copy)\
@@ -24,11 +27,14 @@ struct Idclass : Identifier {\
     ~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);
+make_id_class(Notetab_id, Notename_tab, notename_tab);
 
 #endif // IDENTIFIER_HH
 
index dafeed96fae0d3683fed6f5a129784bd877328fe..2e65537fc077915b564fd53477909feca410d29a 100644 (file)
@@ -17,14 +17,16 @@ struct Identifier
     
     Identifier(String n) : name(n) { }
     virtual ~Identifier() {}
-    
-    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); }
+    virtual const char*classname() { return "new Identifier"; }
+    void error();
+    virtual Input_staff * staff(bool = false) { error(); return 0; }
+    virtual Horizontal_music*hmusic(bool = false) { error(); return 0; }
+    virtual Vertical_music*vmusic(bool = false) { error(); return 0; }
+    virtual Music_voice *mvoice(bool = false) { error(); return 0; }
+    virtual Symtables *symtables(bool = false) { error(); return 0; }
+    virtual Music_general_chord *mchord(bool = false) { error(); return 0; }
+    virtual Lookup*lookup(bool = false) { error(); return 0; }
+    virtual Notename_tab*notename_tab(bool = false) { error(); return 0; }
 };
 #endif // IDENTPARENT_HH
 
diff --git a/src/identifier.cc b/src/identifier.cc
new file mode 100644 (file)
index 0000000..5b55289
--- /dev/null
@@ -0,0 +1,11 @@
+#include <assert.h>
+
+#include "identparent.hh"
+#include "lexer.hh"
+
+void
+Identifier::error()
+{
+    String e("Wrong identifier type: ");
+    yyerror(e + classname());
+}
index 8ebc4df2442a6bc0ffaab666259ccf31970d4a41..dec6d47701c222d1f5143266674fab14f510b2dd 100644 (file)
@@ -1,30 +1,48 @@
 #include "glob.hh"
 #include "string.hh"
+#include "notename.hh"
+#include "lexer.hh"
+#include "identifier.hh"
 
+static Notename_tab * defaulttab = 0;
 
-/// change this along with lex file for other notenames.
-const char *notetab[] = 
+void
+set_notename_tab(Notename_tab*n)
 {
-"ceses", "ces", "c", "cis", "cisis",
-"deses", "des", "d", "dis", "disis",
-"eses", "es", "e", "eis", "eisis",
-"feses", "fes", "f", "fis", "fisis",
-"geses", "ges", "g", "gis", "gisis",
-"ases", "as", "a", "ais", "aisis",
-"beses", "bes", "b", "bis", "bisis",
-0
-};
+    delete defaulttab;
+    defaulttab = n;
+}
 
 void
 lookup_notename(int &large, int &small, String s)
 {
-    int i;
-    for (i =0; notetab[i]; i++)
+    if (!defaulttab)
+       set_notename_tab(lookup_identifier("default_table")->
+                        notename_tab(true));
+    
+    defaulttab->lookup(large, small, s);
+}
+    
+
+void
+Notename_tab::lookup(int &large, int &small, String s)
+{    
+    large = -1;
+    small = 0;
+
+    for (int i =0; i < 7*5; i++)
        if (s == notetab[i]) 
            {
            large = i /5;
            small = i %5 - 2;
            return;         
            }
-    assert(false);    
+}
+
+
+void
+Notename_tab::set(int l, int s, String n)
+{
+    assert(l < 8 && s <= 2 && s >= -2 && l >=0);
+    notetab[l * 5 + s +2] = n;
 }