Last change
on this file since 93afab8 was
57728c1,
checked in by Mateusz Hromada <ruanda@…>, 15 years ago
|
Move old files to _old dir.
|
-
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 | |
---|
7 | Symbols::~Symbols() |
---|
8 | { |
---|
9 | while(!table.empty()) |
---|
10 | { |
---|
11 | free((void*)table.back()); |
---|
12 | table.pop_back(); |
---|
13 | } |
---|
14 | } |
---|
15 | |
---|
16 | void 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 | |
---|
27 | void 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.