diff --git a/src/Base/Quantity.cpp b/src/Base/Quantity.cpp index 0c9acf129..29e6e4bfb 100644 --- a/src/Base/Quantity.cpp +++ b/src/Base/Quantity.cpp @@ -24,6 +24,7 @@ #ifndef _PreComp_ #endif +#include #include "Quantity.h" #include "Exception.h" @@ -101,7 +102,7 @@ Quantity& Quantity::operator = (const Quantity &New) // include the Scanner and the Parser for the Quantitys -Quantity ScanResult; +Quantity QuantResult; #ifndef DOUBLE_MAX # define DOUBLE_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/ @@ -144,13 +145,13 @@ Quantity Quantity::parse(const char* buffer) // parse from buffer QuantityParser::YY_BUFFER_STATE my_string_buffer = QuantityParser::yy_scan_string (buffer); // set the global return variables - ScanResult = Quantity(DOUBLE_MIN); + QuantResult = Quantity(DOUBLE_MIN); // run the parser QuantityParser::yyparse (); // free the scan buffer QuantityParser::yy_delete_buffer (my_string_buffer); - if (ScanResult == Quantity(DOUBLE_MIN)) + if (QuantResult == Quantity(DOUBLE_MIN)) throw Base::Exception("Unknown error in Quantity expression"); - return ScanResult; + return QuantResult; } diff --git a/src/Base/QuantityParser.c b/src/Base/QuantityParser.c index db70da22d..0410baa6c 100644 --- a/src/Base/QuantityParser.c +++ b/src/Base/QuantityParser.c @@ -1322,7 +1322,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 25 "QuantityParser.y" - { ScanResult = (yyvsp[(1) - (1)]) ; ;} + { QuantResult = (yyvsp[(1) - (1)]) ; ;} break; case 3: diff --git a/src/Base/QuantityParser.y b/src/Base/QuantityParser.y index 146e06605..5ab6b1723 100644 --- a/src/Base/QuantityParser.y +++ b/src/Base/QuantityParser.y @@ -22,7 +22,7 @@ %% - input: exp { ScanResult = $1 ; } + input: exp { QuantResult = $1 ; } ; exp: NUM { $$ = $1; } diff --git a/src/Base/Unit.h b/src/Base/Unit.h index e2c416cb4..8c1f92701 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -29,6 +29,7 @@ #else # include #endif +#include namespace Base { @@ -60,8 +61,8 @@ public: /** Operators. */ //@{ - Unit& operator *=(const Unit&that) const {return *this * that;} - Unit& operator /=(const Unit&that) const {return *this / that;} + inline Unit& operator *=(const Unit& that); + inline Unit& operator /=(const Unit& that); Unit operator *(const Unit&) const; Unit operator /(const Unit&) const; bool operator ==(const Unit&) const; @@ -77,6 +78,18 @@ protected: UnitSignature Sig; }; +inline Unit& Unit::operator *=(const Unit& that) +{ + *this = *this * that; + return *this; +} + +inline Unit& Unit::operator /=(const Unit& that) +{ + *this = *this / that; + return *this; +} + } // namespace Base #endif // BASE_Unit_H