]> git.donarmstrong.com Git - lilypond.git/blob - src/table.cc
release: 0.0.15
[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     "texid", TEXID,
36     "chord", CHORD,
37     "multi", MULTI,
38     "unitspace", UNITSPACE,
39     "violin", VIOLIN,
40     "voice", VOICE,
41     "voices", VOICES,
42     "width", WIDTH,
43     "music", MUSIC,
44     "grouping", GROUPING,
45     0,0
46 };
47
48
49 int
50 lookup_keyword(String s)
51 {
52     static Keyword_table table(the_key_tab);
53     return table.lookup(s);
54 }
55
56 Assoc<String, Identifier*> the_id_tab;
57
58 Identifier*
59 lookup_identifier(String s)
60 {
61     if (!the_id_tab.elt_query(s))
62         return 0;
63     
64     return the_id_tab[s];
65 }
66
67 void
68 add_identifier(Identifier*i)
69 {    
70     the_id_tab[i->name] = i;
71 }
72
73 void
74 delete_identifiers()
75 {    
76     for (Assoc_iter<String,Identifier*> ai(the_id_tab); ai.ok(); ai++) {
77         mtor << "deleting: " << ai.key()<<'\n';
78         delete ai.val();
79     }
80 }