]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.6
authorfred <fred>
Thu, 31 Oct 1996 21:43:32 +0000 (21:43 +0000)
committerfred <fred>
Thu, 31 Oct 1996 21:43:32 +0000 (21:43 +0000)
lookupsyms.cc
lookupsyms.hh

index 14b3ab11e3c4fe0a53443f40f7a27b962861ffcb..f0624cad1e0b29dc1822dd888a072726f14f183a 100644 (file)
@@ -3,35 +3,50 @@
 #include "symtable.hh"
 #include "dimen.hh"
 #include "tex.hh"
+void
+Lookup::parse(Text_db&t)
+{
+    symtables_->read(t) ;
+}
 
-Symtables the_sym_tables("symbol.ini");
+Lookup::Lookup()
+{
+    symtables_ = new Symtables;
+}
+
+Lookup::~Lookup()
+{
+    delete symtables_;
+}
 
 Symbol
 Lookup::ball(int j)
 {
-    if (j > 4) j = 4;
-    Symtable * st = the_sym_tables("balls");
+    if (j > 4)
+       j = 4;
+
+    Symtable * st = (*symtables_)("balls");
     return st->lookup(String(j));
 }
 
 Symbol
 Lookup::rest(int j)
 {
-    return the_sym_tables("rests")->lookup(String(j));
+    return (*symtables_)("rests")->lookup(String(j));
 }
 
 
- Symbol
+Symbol
 Lookup::bar(String s)
 {
-    return the_sym_tables("bars")->lookup(s);
+    return (*symtables_)("bars")->lookup(s);
 }
  Symbol
 Lookup::dots(int j)
 {
     if (j>3)
        error("max 3 dots");
-    return the_sym_tables("dots")->lookup(j);
+    return (*symtables_)("dots")->lookup(j);
 }
 
 /****************************************************************/
@@ -39,7 +54,7 @@ Lookup::dots(int j)
 
 struct Linestaf_symbol : Parametric_symbol {
     int lines;
-    Linestaf_symbol(int n) { lines = n;}
+    Linestaf_symbol(int n, Symtables*s): Parametric_symbol(s) { lines = n;}
     Symbol eval(svec<String>)const;
 };
 
@@ -51,26 +66,27 @@ Linestaf_symbol::eval(svec<String> w)const
 
     Symbol s;
     s.dim.x = Interval(0,wid);
-    s.dim.y = Interval(0, lines*convert_dimen(5,"pt"));
+    Real dy=lines*convert_dimen(5,"pt");
+    s.dim.y = Interval(0,dy);
     svec<String> a;
     a.add(lines);
     a.add(w[0]);
-    s.tex = the_sym_tables("param")->lookup("linestaf").tex;
+    s.tex = (*symtables_)("param")->lookup("linestaf").tex;
     s.tex = substitute_args(s.tex, a);
     return s;
 }
 
-/****************************************************************
- */
+/****************************************************************/
 
 
 struct Meter_sym:Parametric_symbol {
 
+    Meter_sym(Symtables*s) : Parametric_symbol(s){  }
     Symbol eval(svec<String> a) const{
        Symbol s;
        s.dim.x = Interval( convert_dimen(-5,"pt"), convert_dimen(10,"pt"));
        s.dim.y = Interval(0, convert_dimen(10,"pt") ); // todo
-       String src = the_sym_tables("param")->lookup("meter").tex;
+       String src = (*symtables_)("param")->lookup("meter").tex;
        s.tex = substitute_args(src,a);
        return s;
     }
@@ -80,12 +96,12 @@ struct Meter_sym:Parametric_symbol {
 Parametric_symbol *
 Lookup::meter(String )
 {
-    return new Meter_sym;
+    return new Meter_sym(symtables_);
 }
 
 Parametric_symbol *
 Lookup::linestaff(int n)
 {
-    return new Linestaf_symbol(n);
+    return new Linestaf_symbol(n,symtables_);
 }
 
index d4e08667dbae8533192dd63280d3b6a1b45f25d0..a3c0750d0e4e213cf9ece91b71b4b3b96e3780ea 100644 (file)
@@ -7,12 +7,19 @@
 #include "symbol.hh"
 
 struct Lookup {
-    static Parametric_symbol *linestaff(int n);
-    static Parametric_symbol *meter(String);
-    static Symbol ball(int);
-    static Symbol rest(int);
-    static Symbol bar(String);
-    static Symbol dots(int);
+    Symtables *symtables_;
+    
+    /****************/
+
+    void parse (Text_db&t);
+    Parametric_symbol *linestaff(int n);
+    Parametric_symbol *meter(String);
+    Symbol ball(int);
+    Symbol rest(int);
+    Symbol bar(String);
+    Symbol dots(int);
+    Lookup();
+    ~Lookup();
 };
 
 #endif