]> git.donarmstrong.com Git - lilypond.git/blob - src/table.cc
release: 0.0.16
[lilypond.git] / src / table.cc
1 #include "glob.hh"
2 #include "debug.hh"
3 #include "string.hh"
4 #include "inputstaff.hh"
5 #include "identparent.hh"
6 #include "keyword.hh"
7 #include "associter.hh"
8 #include "parser.hh"
9
10 static Keyword_ent the_key_tab[]={
11     "bar", BAR,
12     "bass", BASS,
13     "clef", CLEF,
14     "cm", CM,
15     "commands", COMMANDS,
16     "duration", DURATIONCOMMAND,
17     "geometric", GEOMETRIC,
18     "in", IN,
19     "key", KEY, 
20     "melodic", MELODIC,
21     "meter", METER,
22     "mm", MM,
23     "octave", OCTAVECOMMAND,
24     "output", OUTPUT,
25     "partial", PARTIAL,
26     "paper", PAPER,
27     "pt", PT,
28     "rhythmic", RHYTHMIC,
29     "score", SCORE,
30     "skip", SKIP,
31     "staff", STAFF,
32     "start", START_T,
33     "table", TABLE,
34     "symboltables", SYMBOLTABLES,
35     "notenames", NOTENAMES,
36     "texid", TEXID,
37     "chord", CHORD,
38     "multi", MULTI,
39     "unitspace", UNITSPACE,
40     "violin", VIOLIN,
41     "voice", VOICE,
42     "voices", VOICES,
43     "width", WIDTH,
44     "music", MUSIC,
45     "grouping", GROUPING,
46     0,0
47 };
48
49
50 int
51 lookup_keyword(String s)
52 {
53     static Keyword_table table(the_key_tab);
54     return table.lookup(s);
55 }
56
57 Assoc<String, Identifier*> the_id_tab;
58
59 Identifier*
60 lookup_identifier(String s)
61 {
62     if (!the_id_tab.elt_query(s))
63         return 0;
64     
65     return the_id_tab[s];
66 }
67
68 void
69 add_identifier(Identifier*i)
70 {    
71     the_id_tab[i->name] = i;
72 }
73
74 void
75 delete_identifiers()
76 {    
77     for (Assoc_iter<String,Identifier*> ai(the_id_tab); ai.ok(); ai++) {
78         mtor << "deleting: " << ai.key()<<'\n';
79         delete ai.val();
80     }
81 }