]> git.donarmstrong.com Git - lilypond.git/blob - src/table.cc
release: 0.0.9
[lilypond.git] / src / table.cc
1 #include "glob.hh"
2 #include "debug.hh"
3 #include "string.hh"
4 #include "identifier.hh"
5 #include "keyword.hh"
6 #include "associter.hh"
7 #include "parser.hh"
8
9 static Keyword_ent  the_key_tab[]={
10     "voice", VOICE,
11     "rhythmstaff", RHYTHMSTAFF,
12     "melodicstaff", MELODICSTAFF,
13     "score", SCORE,
14     "bar", BAR,
15     "output", OUTPUT,
16     "cm", CM,
17     "start", START_T,
18     "pt", PT,
19     "in", IN,
20     "mm", MM,
21     "paper", PAPER,
22     "width", WIDTH,
23     "meter", METER,
24     "unitspace", UNITSPACE,
25     "skip", SKIP,
26     "octave", OCTAVECOMMAND,
27     "commands", COMMANDS,
28     "staff", STAFF,
29     "geometric", GEOMETRIC,
30     "duration", DURATIONCOMMAND,
31     0,0
32 } ;
33
34
35 int
36 lookup_keyword(String s)
37 {
38     static Keyword_table table(the_key_tab);
39     return table.lookup(s);
40 }
41
42 Assoc<String, Identifier*> the_id_tab;
43
44 Identifier*
45 lookup_identifier(String s)
46 {
47     if (!the_id_tab.elt_query(s))
48         return 0;
49     
50     return the_id_tab[s];
51 }
52
53 void
54 add_identifier(Identifier*i)
55 {    
56     the_id_tab[i->name] = i;
57 }
58
59 void
60 delete_identifiers()
61 {
62     
63     for (Assoc_iter<String,Identifier*> ai(the_id_tab); ai.ok(); ai++) {
64         mtor << "deleting: " << ai.key()<<'\n';
65         delete ai.val();
66     }
67 }