source: app/src/dgp/symbol.cc @ 1e551bd

Last change on this file since 1e551bd was 0214596, checked in by pawelk <pawelk@…>, 17 years ago

Dodalismy do pakietu utt komponent dgp (brak configow i innych bajerow).

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@24 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

  • Property mode set to 100644
File size: 550 bytes
Line 
1#include "symbol.hh"
2
3// CLASS symbols
4
5//int Symbols::_no_of_spaces=0;
6
7Symbols::~Symbols()
8{
9  while(!table.empty())
10  {
11    free((void*)table.back());
12    table.pop_back();
13  }
14}
15
16void Symbols::load(const char* filename)
17{
18  ifstream f(filename);
19  char s[100];
20  while(f)
21  {
22    f >> s >> ws;
23    if(strlen(s)) add(s);
24  }
25} 
26
27void Symbols::add(const char* sym)
28{
29  if(hash.count(sym)==0)
30  {
31    char* symdup=strdup(sym);
32    hash[symdup]=table.size();
33    table.push_back(symdup);
34  }
35}
36
37
38//template<int space>
39//Symbols Symbol<space>::defs;
Note: See TracBrowser for help on using the repository browser.