--- a/absyntax_utils/absyntax_utils.cc Fri Dec 26 09:57:02 2014 +0000
+++ b/absyntax_utils/absyntax_utils.cc Fri Dec 26 10:09:27 2014 +0000
@@ -104,8 +104,7 @@
/* A symbol table with all globally declared functions... */
-function_declaration_c null_symbol1(NULL,NULL,NULL,NULL);
-dsymtable_c<function_declaration_c *, &null_symbol1> function_symtable;
+dsymtable_c<function_declaration_c *> function_symtable;
/* A symbol table with all globally declared functions block types... */
symtable_c<function_block_declaration_c *> function_block_type_symtable;
--- a/absyntax_utils/absyntax_utils.hh Fri Dec 26 09:57:02 2014 +0000
+++ b/absyntax_utils/absyntax_utils.hh Fri Dec 26 10:09:27 2014 +0000
@@ -56,8 +56,7 @@
int compare_identifiers(symbol_c *ident1, symbol_c *ident2);
/* A symbol table with all globally declared functions... */
-extern function_declaration_c null_symbol1;
-typedef dsymtable_c<function_declaration_c *, &null_symbol1> function_symtable_t;
+typedef dsymtable_c<function_declaration_c *> function_symtable_t;
extern function_symtable_t function_symtable;
/* A symbol table with all globally declared functions block types... */
--- a/stage3/fill_candidate_datatypes.cc Fri Dec 26 09:57:02 2014 +0000
+++ b/stage3/fill_candidate_datatypes.cc Fri Dec 26 10:09:27 2014 +0000
@@ -90,8 +90,7 @@
*/
/* NOTE: we do not store any NULL values in this symbol table, so we can safely use NULL and the null value. */
-symbol_c null_enumvalue_symbol; /* cannot be static, so it may be used in the template!! */
-typedef dsymtable_c<symbol_c *, &null_enumvalue_symbol> enumerated_value_symtable_t;
+typedef dsymtable_c<symbol_c *> enumerated_value_symtable_t;
static enumerated_value_symtable_t global_enumerated_value_symtable;
@@ -1052,8 +1051,8 @@
enumerated_type = symbol->type;
}
else {
- symbol_c *global_enumerated_type = global_enumerated_value_symtable.find_value (symbol->value);
- symbol_c * local_enumerated_type = local_enumerated_value_symtable.find_value (symbol->value);
+ symbol_c *global_enumerated_type = global_enumerated_value_symtable.find (symbol->value)->second;
+ symbol_c * local_enumerated_type = local_enumerated_value_symtable.find (symbol->value)->second;
int global_multiplicity = global_enumerated_value_symtable.count(symbol->value);
int local_multiplicity = local_enumerated_value_symtable.count(symbol->value);
--- a/util/dsymtable.cc Fri Dec 26 09:57:02 2014 +0000
+++ b/util/dsymtable.cc Fri Dec 26 10:09:27 2014 +0000
@@ -38,22 +38,22 @@
/* clear all entries... */
-template<typename value_type, value_type null_value>
-void dsymtable_c<value_type, null_value>::reset(void) {
+template<typename value_type>
+void dsymtable_c<value_type>::reset(void) {
_base.clear();
}
-template<typename value_type, value_type null_value>
-void dsymtable_c<value_type, null_value>::insert(const char *identifier_str, value_t new_value) {
+template<typename value_type>
+void dsymtable_c<value_type>::insert(const char *identifier_str, value_t new_value) {
// std::cout << "store_identifier(" << identifier_str << "): \n";
std::pair<const char *, value_t> new_element(identifier_str, new_value);
/* iterator res = */ _base.insert(new_element);
}
-template<typename value_type, value_type null_value>
-void dsymtable_c<value_type, null_value>::insert(const symbol_c *symbol, value_t new_value) {
+template<typename value_type>
+void dsymtable_c<value_type>::insert(const symbol_c *symbol, value_t new_value) {
const token_c *name = dynamic_cast<const token_c *>(symbol);
if (name == NULL)
ERROR;
@@ -62,8 +62,8 @@
#if 0
-template<typename value_type, value_type null_value>
-void dsymtable_c<value_type, null_value>::insert_noduplicate(const char *identifier_str, value_t new_value) {
+template<typename value_type>
+void dsymtable_c<value_type>::insert_noduplicate(const char *identifier_str, value_t new_value) {
if (find_value(identifier_str) != null_value)
/* already present in the set! */
ERROR;
@@ -74,8 +74,8 @@
}
-template<typename value_type, value_type null_value>
-void dsymtable_c<value_type, null_value>::insert_noduplicate(const symbol_c *symbol, value_t new_value) {
+template<typename value_type>
+void dsymtable_c<value_type>::insert_noduplicate(const symbol_c *symbol, value_t new_value) {
const token_c *name = dynamic_cast<const token_c *>(symbol);
if (name == NULL)
ERROR;
@@ -86,20 +86,8 @@
-/* returns null_value if not found! */
-template<typename value_type, value_type null_value>
-value_type dsymtable_c<value_type, null_value>::find_value(const char *identifier_str) {
- iterator i = _base.find(identifier_str);
-
- if (i == _base.end())
- return null_value;
- else
- return i->second;
-}
-
-
-template<typename value_type, value_type null_value>
-const char * dsymtable_c<value_type, null_value>::symbol_to_string(const symbol_c *symbol) {
+template<typename value_type>
+const char * dsymtable_c<value_type>::symbol_to_string(const symbol_c *symbol) {
const token_c *name = dynamic_cast<const token_c *>(symbol);
if (name == NULL)
ERROR;
@@ -108,8 +96,8 @@
/* debuging function... */
-template<typename value_type, value_type null_value>
-void dsymtable_c<value_type, null_value>::print(void) {
+template<typename value_type>
+void dsymtable_c<value_type>::print(void) {
for(iterator i = _base.begin();
i != _base.end();
i++)
--- a/util/dsymtable.hh Fri Dec 26 09:57:02 2014 +0000
+++ b/util/dsymtable.hh Fri Dec 26 10:09:27 2014 +0000
@@ -44,7 +44,7 @@
-template<typename value_type, value_type null_value> class dsymtable_c {
+template<typename value_type> class dsymtable_c {
/* Case insensitive string compare copied from
* "The C++ Programming Language" - 3rd Edition
* by Bjarne Stroustrup, ISBN 0201889544.
@@ -92,11 +92,6 @@
int count(const char *identifier_str) {return _base.count(identifier_str);}
int count(const symbol_c *symbol) {return count(symbol_to_string(symbol));}
- /* Search for an entry. Will return end_value() if not found */
- value_t end_value(void) {return null_value;}
- value_t find_value(const char *identifier_str);
- value_t find_value(const symbol_c *symbol) {return find_value(symbol_to_string(symbol));}
-
/* Search for an entry associated with identifier_str. Will return end() if not found */
iterator find(const char *identifier_str) {return _base.find(identifier_str);}
iterator find(const symbol_c *symbol) {return find(symbol_to_string(symbol));}