--- a/stage4/generate_c/generate_c_il.cc Thu Nov 08 17:31:29 2012 +0000
+++ b/stage4/generate_c/generate_c_il.cc Thu Nov 08 17:31:50 2012 +0000
@@ -847,8 +847,8 @@
}
/* Check whether we are calling an overloaded function! */
- /* (fdecl_mutiplicity==2) => calling overloaded function */
- int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name);
+ /* (fdecl_mutiplicity > 1) => calling overloaded function */
+ int fdecl_mutiplicity = function_symtable.count(symbol->function_name);
if (fdecl_mutiplicity == 0) ERROR;
this->implicit_variable_result.accept(*this);
@@ -868,7 +868,7 @@
fbname->accept(*this);
s4o.print("_");
function_name->accept(*this);
- if (fdecl_mutiplicity == 2) {
+ if (fdecl_mutiplicity > 1) {
/* function being called is overloaded! */
s4o.print("__");
print_function_parameter_data_types_c overloaded_func_suf(&s4o);
@@ -879,7 +879,7 @@
else {
if (function_name != NULL) {
function_name->accept(*this);
- if (fdecl_mutiplicity == 2) {
+ if (fdecl_mutiplicity > 1) {
/* function being called is overloaded! */
s4o.print("__");
print_function_parameter_data_types_c overloaded_func_suf(&s4o);
@@ -1234,8 +1234,8 @@
}
/* Check whether we are calling an overloaded function! */
- /* (fdecl_mutiplicity==2) => calling overloaded function */
- int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name);
+ /* (fdecl_mutiplicity > 1) => calling overloaded function */
+ int fdecl_mutiplicity = function_symtable.count(symbol->function_name);
if (fdecl_mutiplicity == 0) ERROR;
if (fdecl_mutiplicity == 1)
/* function being called is NOT overloaded! */
@@ -1258,7 +1258,7 @@
fbname->accept(*this);
s4o.print("_");
function_name->accept(*this);
- if (fdecl_mutiplicity == 2) {
+ if (fdecl_mutiplicity > 1) {
/* function being called is overloaded! */
s4o.print("__");
print_function_parameter_data_types_c overloaded_func_suf(&s4o);
@@ -1269,7 +1269,7 @@
else {
if (function_name != NULL) {
function_name->accept(*this);
- if (fdecl_mutiplicity == 2) {
+ if (fdecl_mutiplicity > 1) {
/* function being called is overloaded! */
s4o.print("__");
print_function_parameter_data_types_c overloaded_func_suf(&s4o);
--- a/stage4/generate_c/generate_c_inlinefcall.cc Thu Nov 08 17:31:29 2012 +0000
+++ b/stage4/generate_c/generate_c_inlinefcall.cc Thu Nov 08 17:31:50 2012 +0000
@@ -527,8 +527,8 @@
}
/* Check whether we are calling an overloaded function! */
- /* (fdecl_mutiplicity==2) => calling overloaded function */
- int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name);
+ /* (fdecl_mutiplicity > 1) => calling overloaded function */
+ int fdecl_mutiplicity = function_symtable.count(symbol->function_name);
if (fdecl_mutiplicity == 0) ERROR;
if (fdecl_mutiplicity == 1)
/* function being called is NOT overloaded! */
@@ -684,8 +684,8 @@
}
/* Check whether we are calling an overloaded function! */
- /* (fdecl_mutiplicity==2) => calling overloaded function */
- int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name);
+ /* (fdecl_mutiplicity > 1) => calling overloaded function */
+ int fdecl_mutiplicity = function_symtable.count(symbol->function_name);
if (fdecl_mutiplicity == 0) ERROR;
if (fdecl_mutiplicity == 1)
/* function being called is NOT overloaded! */
@@ -846,8 +846,8 @@
}
/* Check whether we are calling an overloaded function! */
- /* (fdecl_mutiplicity==2) => calling overloaded function */
- int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name);
+ /* (fdecl_mutiplicity > 1) => calling overloaded function */
+ int fdecl_mutiplicity = function_symtable.count(symbol->function_name);
if (fdecl_mutiplicity == 0) ERROR;
if (fdecl_mutiplicity == 1)
/* function being called is NOT overloaded! */
--- a/stage4/generate_c/generate_c_st.cc Thu Nov 08 17:31:29 2012 +0000
+++ b/stage4/generate_c/generate_c_st.cc Thu Nov 08 17:31:50 2012 +0000
@@ -711,8 +711,8 @@
}
/* Check whether we are calling an overloaded function! */
- /* (fdecl_mutiplicity==2) => calling overloaded function */
- int fdecl_mutiplicity = function_symtable.multiplicity(symbol->function_name);
+ /* (fdecl_mutiplicity > 1) => calling overloaded function */
+ int fdecl_mutiplicity = function_symtable.count(symbol->function_name);
if (fdecl_mutiplicity == 0) ERROR;
if (has_output_params) {
@@ -721,7 +721,7 @@
fbname->accept(*this);
s4o.print("_");
function_name->accept(*this);
- if (fdecl_mutiplicity == 2) {
+ if (fdecl_mutiplicity > 1) {
/* function being called is overloaded! */
s4o.print("__");
print_function_parameter_data_types_c overloaded_func_suf(&s4o);
@@ -731,7 +731,7 @@
}
else {
function_name->accept(*this);
- if (fdecl_mutiplicity == 2) {
+ if (fdecl_mutiplicity > 1) {
/* function being called is overloaded! */
s4o.print("__");
print_function_parameter_data_types_c overloaded_func_suf(&s4o);
--- a/util/dsymtable.cc Thu Nov 08 17:31:29 2012 +0000
+++ b/util/dsymtable.cc Thu Nov 08 17:31:50 2012 +0000
@@ -37,9 +37,6 @@
-
-
-
/* clear all entries... */
template<typename value_type, value_type null_value>
void dsymtable_c<value_type, null_value>::reset(void) {
@@ -88,26 +85,6 @@
-/* Determine how many entries are associated to key identifier_str */
-/* returns:
- * 0: if no entry is found
- * 1: if 1 entry is found
- * 2: if more than 1 entry is found
- */
-template<typename value_type, value_type null_value>
-int dsymtable_c<value_type, null_value>::multiplicity(const char *identifier_str) {
- iterator lower = _base.lower_bound(identifier_str);
- if (lower == _base.end()) return 0;
-
- iterator upper = _base.upper_bound(identifier_str);
- iterator second = lower;
- second++;
-
- if (second == upper) return 1;
-
- return 2;
-}
-
/* returns null_value if not found! */
template<typename value_type, value_type null_value>
--- a/util/dsymtable.hh Thu Nov 08 17:31:29 2012 +0000
+++ b/util/dsymtable.hh Thu Nov 08 17:31:50 2012 +0000
@@ -77,26 +77,23 @@
typedef typename base_t::const_reverse_iterator const_reverse_iterator;
private:
- void reset(void); /* clear all entries... */
const char *symbol_to_string(const symbol_c *symbol);
public:
dsymtable_c(void) {};
+ void reset(void); /* clear all entries... */
+
void insert(const char *identifier_str, value_t value);
void insert(const symbol_c *symbol, value_t value);
/* Determine how many entries are associated to key identifier_str */
- /* returns:
- * 0: if no entry is found
- * 1: if 1 entry is found
- * 2: if more than 1 entry is found
- */
- int multiplicity(const char *identifier_str);
- int multiplicity(const symbol_c *symbol) {return multiplicity(symbol_to_string(symbol));}
+ /* returns: 0 if no entry is found, 1 if 1 entry is found, ..., n if n entries are found */
+ 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 end_value(void) {return _base.end(); 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));}