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
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
# 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)
#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)\
~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
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
--- /dev/null
+#include <assert.h>
+
+#include "identparent.hh"
+#include "lexer.hh"
+
+void
+Identifier::error()
+{
+ String e("Wrong identifier type: ");
+ yyerror(e + classname());
+}
#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;
}