From 76e636f439171f694b89380b03d5be63bda798b1 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:26:37 +0000 Subject: [PATCH] lilypond-0.0.16 --- Sources.make | 2 +- Variables.make | 8 +++++--- hdr/identifier.hh | 6 ++++++ hdr/identparent.hh | 18 ++++++++++-------- src/identifier.cc | 11 +++++++++++ src/notename.cc | 46 ++++++++++++++++++++++++++++++++-------------- 6 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 src/identifier.cc diff --git a/Sources.make b/Sources.make index 7a648e169b..25bd89dfb1 100644 --- a/Sources.make +++ b/Sources.make @@ -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 diff --git a/Variables.make b/Variables.make index 34bfb9fb6f..35959bd20c 100644 --- a/Variables.make +++ b/Variables.make @@ -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) diff --git a/hdr/identifier.hh b/hdr/identifier.hh index 3ac537f63e..da4bfb6b7b 100644 --- a/hdr/identifier.hh +++ b/hdr/identifier.hh @@ -11,9 +11,12 @@ #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 diff --git a/hdr/identparent.hh b/hdr/identparent.hh index dafeed96fa..2e65537fc0 100644 --- a/hdr/identparent.hh +++ b/hdr/identparent.hh @@ -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 index 0000000000..5b552898a9 --- /dev/null +++ b/src/identifier.cc @@ -0,0 +1,11 @@ +#include + +#include "identparent.hh" +#include "lexer.hh" + +void +Identifier::error() +{ + String e("Wrong identifier type: "); + yyerror(e + classname()); +} diff --git a/src/notename.cc b/src/notename.cc index 8ebc4df244..dec6d47701 100644 --- a/src/notename.cc +++ b/src/notename.cc @@ -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; } -- 2.39.5