#include "symbol.hh"

// CLASS symbols

//int Symbols::_no_of_spaces=0;

Symbols::~Symbols()
{
  while(!table.empty())
  {
    free((void*)table.back());
    table.pop_back();
  }
}

void Symbols::load(const char* filename)
{
  ifstream f(filename);
  char s[100];
  while(f)
  {
    f >> s >> ws;
    if(strlen(s)) add(s);
  }
}  

void Symbols::add(const char* sym)
{
  if(hash.count(sym)==0)
  {
    char* symdup=strdup(sym);
    hash[symdup]=table.size();
    table.push_back(symdup);
  }
}


//template<int space>
//Symbols Symbol<space>::defs;
