add the units Ohm and Siemens

This commit is contained in:
donovaly
2020-01-03 01:07:34 +01:00
committed by wwmayer
parent c43315728c
commit 05dadb4c75
11 changed files with 455 additions and 304 deletions

View File

@@ -254,6 +254,15 @@ EXPO [eE][-+]?[0-9]+
"kV" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloVolt; yylval.quantity.unitStr = yytext; return UNIT; // kilo Volt
"mV" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliVolt; yylval.quantity.unitStr = yytext; return UNIT; // milli Volt
"S" COUNTCHARS; yylval.quantity.scaler = Quantity::Siemens; yylval.quantity.unitStr = yytext; return UNIT; // Siemens (A^2*s^3/kg/m^2)
"mS" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliSiemens; yylval.quantity.unitStr = yytext; return UNIT; // milli Siemens
"uS" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroSiemens; yylval.quantity.unitStr = yytext; return UNIT; // micro Siemens
"\xC2\xB5S" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroSiemens; yylval.quantity.unitStr = yytext; return UNIT; // micro Siemens
"Ohm" COUNTCHARS; yylval.quantity.scaler = Quantity::Ohm; yylval.quantity.unitStr = yytext; return UNIT; // Ohm (kg*m^2/A^2/s^3)
"kOhm" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloOhm; yylval.quantity.unitStr = yytext; return UNIT; // kilo Ohm
"MOhm" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliOhm; yylval.quantity.unitStr = yytext; return UNIT; // mega Ohm
"C" COUNTCHARS; yylval.quantity.scaler = Quantity::Coulomb; yylval.quantity.unitStr = yytext; return UNIT; // Coulomb (A*s)
"T" COUNTCHARS; yylval.quantity.scaler = Quantity::Tesla; yylval.quantity.unitStr = yytext; return UNIT; // Tesla (kg/s^2/A)
@@ -291,7 +300,7 @@ EXPO [eE][-+]?[0-9]+
"gon" COUNTCHARS; yylval.quantity.scaler = Quantity::Gon; yylval.quantity.unitStr = yytext; return UNIT; // gon
"M" COUNTCHARS; yylval.quantity.scaler = Quantity::AngMinute; yylval.quantity.unitStr = yytext; return UNIT; // angminute
"\xE2\x80\xB2" COUNTCHARS; yylval.quantity.scaler = Quantity::AngMinute; yylval.quantity.unitStr = yytext; return UNIT; // angminute U+2032 ′ ′
"S" COUNTCHARS; yylval.quantity.scaler = Quantity::AngSecond; yylval.quantity.unitStr = yytext; return UNIT; // angsecond
"AS" COUNTCHARS; yylval.quantity.scaler = Quantity::AngSecond; yylval.quantity.unitStr = yytext; return UNIT; // angsecond
"\xE2\x80\xB3" COUNTCHARS; yylval.quantity.scaler = Quantity::AngSecond; yylval.quantity.unitStr = yytext; return UNIT; // angsecond U+2033 ″ ″ ″
{DIGIT}*"."{DIGIT}+{EXPO}? COUNTCHARS; yylval.fvalue = num_change(yytext,'.',','); return yylval.fvalue == 1 ? ONE : NUM;

View File

@@ -715,6 +715,14 @@ App.Units.Volt = App.Units.Quantity('V')
App.Units.MilliVolt = App.Units.Quantity('mV')
App.Units.KiloVolt = App.Units.Quantity('kV')
App.Units.Siemens = App.Units.Quantity('S')
App.Units.MilliSiemens = App.Units.Quantity('mS')
App.Units.MicroSiemens = App.Units.Quantity('uS')
App.Units.Ohm = App.Units.Quantity('Ohm')
App.Units.KiloOhm = App.Units.Quantity('kOhm')
App.Units.MegaOhm = App.Units.Quantity('MOhm')
App.Units.Coulomb = App.Units.Quantity('C')
App.Units.Tesla = App.Units.Quantity('T')
@@ -776,6 +784,8 @@ App.Units.ElectricCharge = App.Units.Unit(0,0,1,1)
App.Units.MagneticFluxDensity = App.Units.Unit(0,1,-2,-1)
App.Units.ElectricalCapacitance = App.Units.Unit(-2,-1,4,2)
App.Units.ElectricalInductance = App.Units.Unit(2,1,-2,-2)
App.Units.ElectricalConductance = App.Units.Unit(-2,-1,3,2)
App.Units.ElectricalResistance = App.Units.Unit(2,1,-3,-2)
App.Units.AmountOfSubstance = App.Units.Unit(0,0,0,0,0,1)
App.Units.LuminousIntensity = App.Units.Unit(0,0,0,0,0,0,1)

View File

@@ -327,9 +327,17 @@ Quantity Quantity::MilliWatt (1e+3 ,Unit(2,1,-3));
Quantity Quantity::KiloWatt (1e+9 ,Unit(2,1,-3));
Quantity Quantity::VoltAmpere (1e+6 ,Unit(2,1,-3)); // VoltAmpere (kg*m^2/s^3)
Quantity Quantity::Volt (1e+6 ,Unit(2,1,-3,-1)); // Volt (kg*m^2/A/s^3)
Quantity Quantity::MilliVolt (1e+3 ,Unit(2,1,-3,-1));
Quantity Quantity::KiloVolt (1e+9 ,Unit(2,1,-3,-1));
Quantity Quantity::Volt(1e+6, Unit(2, 1, -3, -1)); // Volt (kg*m^2/A/s^3)
Quantity Quantity::MilliVolt(1e+3, Unit(2, 1, -3, -1));
Quantity Quantity::KiloVolt(1e+9, Unit(2, 1, -3, -1));
Quantity Quantity::Siemens (1e-6 ,Unit(-2,-1,3,2)); // Siemens (A^2*s^3/kg/m^2)
Quantity Quantity::MilliSiemens (1e-9 ,Unit(-2,-1,3,2));
Quantity Quantity::MicroSiemens (1e-12 ,Unit(-2,-1,3,2));
Quantity Quantity::Ohm (1e+6 ,Unit(2,1,-3,-2)); // Ohm (kg*m^2/A^2/s^3)
Quantity Quantity::KiloOhm (1e+9 ,Unit(2,1,-3,-2));
Quantity Quantity::MegaOhm (1e+12 ,Unit(2,1,-3,-2));
Quantity Quantity::Coulomb (1.0 ,Unit(0,0,1,1)); // Coulomb (A*s)

View File

@@ -268,6 +268,14 @@ public:
static Quantity MilliVolt;
static Quantity KiloVolt;
static Quantity Siemens;
static Quantity MilliSiemens;
static Quantity MicroSiemens;
static Quantity Ohm;
static Quantity KiloOhm;
static Quantity MegaOhm;
static Quantity Coulomb;
static Quantity Tesla;

View File

@@ -353,8 +353,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 143
#define YY_END_OF_BUFFER 144
#define YY_NUM_RULES 150
#define YY_END_OF_BUFFER 151
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -362,35 +362,37 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static const flex_int16_t yy_accept[249] =
static const flex_int16_t yy_accept[262] =
{ 0,
0, 0, 0, 0, 144, 142, 4, 5, 45, 47,
6, 142, 7, 142, 120, 119, 33, 85, 87, 142,
93, 98, 37, 115, 61, 142, 117, 86, 82, 78,
1, 142, 142, 142, 142, 125, 142, 27, 32, 142,
142, 17, 15, 142, 142, 142, 142, 30, 29, 142,
142, 142, 142, 3, 143, 2, 5, 123, 121, 122,
120, 120, 0, 103, 0, 0, 19, 36, 0, 64,
0, 0, 0, 101, 65, 0, 0, 81, 104, 0,
0, 0, 0, 0, 0, 43, 0, 13, 0, 0,
0, 14, 106, 0, 46, 0, 44, 35, 0, 100,
0, 0, 0, 0, 151, 149, 4, 5, 45, 47,
6, 149, 7, 149, 127, 126, 33, 92, 94, 149,
100, 105, 37, 122, 61, 149, 149, 85, 93, 82,
78, 1, 149, 149, 149, 149, 132, 149, 27, 32,
149, 149, 17, 15, 149, 149, 149, 149, 30, 29,
149, 149, 149, 149, 3, 150, 2, 5, 130, 128,
129, 127, 127, 0, 124, 110, 0, 0, 19, 36,
0, 64, 0, 0, 0, 0, 108, 0, 65, 0,
0, 81, 111, 0, 0, 0, 0, 0, 0, 43,
0, 13, 0, 0, 0, 14, 113, 0, 46, 0,
63, 0, 83, 80, 0, 0, 28, 16, 0, 55,
0, 34, 88, 94, 99, 38, 62, 0, 84, 79,
0, 26, 51, 18, 12, 0, 0, 91, 97, 9,
57, 92, 124, 0, 0, 0, 0, 0, 58, 0,
0, 90, 96, 40, 0, 24, 10, 50, 111, 0,
0, 0, 0, 0, 122, 0, 120, 0, 0, 120,
22, 68, 21, 67, 108, 0, 23, 0, 102, 132,
0, 0, 0, 69, 109, 54, 130, 59, 112, 131,
114, 20, 66, 105, 0, 107, 76, 60, 56, 134,
0, 0, 49, 31, 0, 133, 41, 52, 136, 75,
44, 35, 0, 107, 63, 0, 0, 83, 80, 0,
0, 28, 16, 0, 55, 0, 34, 95, 101, 106,
38, 62, 86, 0, 84, 79, 0, 26, 51, 18,
12, 0, 0, 98, 104, 9, 57, 99, 131, 0,
0, 0, 0, 0, 58, 0, 0, 97, 103, 40,
88, 0, 24, 10, 50, 118, 0, 0, 0, 0,
0, 129, 0, 127, 0, 0, 127, 22, 68, 21,
0, 67, 115, 0, 89, 23, 0, 109, 139, 0,
0, 0, 69, 116, 54, 137, 59, 119, 138, 121,
20, 0, 66, 112, 0, 114, 76, 60, 56, 141,
113, 137, 0, 0, 139, 0, 0, 89, 95, 39,
0, 25, 11, 116, 118, 8, 0, 123, 0, 121,
0, 122, 0, 120, 77, 71, 126, 127, 128, 110,
0, 0, 70, 42, 138, 53, 141, 140, 48, 0,
0, 129, 135, 72, 73, 0, 74, 0
0, 0, 49, 31, 0, 140, 41, 52, 143, 75,
120, 144, 0, 0, 146, 0, 0, 96, 102, 39,
87, 0, 25, 11, 123, 125, 8, 0, 130, 0,
128, 0, 129, 0, 127, 91, 77, 71, 133, 134,
135, 90, 117, 0, 0, 70, 42, 145, 53, 148,
147, 48, 0, 0, 136, 142, 72, 73, 0, 74,
0
} ;
static const YY_CHAR yy_ec[256] =
@@ -402,30 +404,30 @@ static const YY_CHAR yy_ec[256] =
6, 6, 7, 8, 9, 10, 6, 11, 12, 13,
14, 14, 14, 14, 14, 14, 14, 1, 1, 1,
6, 1, 1, 1, 15, 1, 16, 1, 17, 18,
19, 20, 1, 21, 22, 1, 23, 24, 1, 25,
1, 1, 26, 27, 1, 28, 29, 1, 1, 1,
30, 1, 31, 6, 1, 1, 32, 33, 34, 35,
19, 20, 1, 21, 22, 1, 23, 24, 25, 26,
1, 1, 27, 28, 1, 29, 30, 1, 1, 1,
31, 1, 32, 6, 1, 1, 33, 34, 35, 36,
36, 37, 38, 39, 40, 1, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 1, 52, 53,
54, 55, 1, 1, 1, 1, 1, 56, 1, 1,
1, 1, 1, 1, 1, 57, 1, 1, 1, 1,
37, 38, 39, 40, 41, 1, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 1, 53, 54,
55, 56, 1, 1, 1, 1, 1, 57, 1, 1,
1, 1, 1, 1, 1, 58, 1, 1, 1, 1,
1, 1, 1, 1, 1, 59, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 59, 1, 60, 61, 1,
62, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 63, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 60, 1, 61, 62, 1,
63, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 64, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 64, 1, 1, 1, 1,
1, 1, 1, 1, 1, 65, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static const YY_CHAR yy_meta[65] =
static const YY_CHAR yy_meta[66] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -433,125 +435,130 @@ static const YY_CHAR yy_meta[65] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1
1, 1, 1, 1, 1
} ;
static const flex_int16_t yy_base[250] =
static const flex_int16_t yy_base[263] =
{ 0,
0, 0, 62, 63, 378, 379, 379, 374, 379, 379,
379, 56, 379, 60, 67, 75, 379, 348, 379, 70,
320, 379, 379, 76, 331, 341, 379, 62, 357, 322,
379, 64, 338, 73, 63, 74, 319, 323, 379, 323,
113, 76, 148, 97, 311, 86, 333, 89, 91, 160,
329, 84, 63, 379, 379, 379, 360, 147, 188, 195,
202, 215, 141, 379, 307, 329, 379, 379, 305, 379,
327, 330, 308, 379, 379, 301, 307, 305, 379, 304,
307, 311, 318, 301, 306, 379, 297, 379, 297, 295,
306, 379, 379, 297, 379, 298, 379, 379, 286, 379,
0, 0, 63, 64, 391, 392, 392, 387, 392, 392,
392, 57, 392, 61, 68, 76, 362, 359, 392, 57,
331, 392, 392, 77, 342, 345, 351, 392, 71, 368,
332, 392, 65, 348, 74, 67, 65, 329, 333, 392,
333, 113, 75, 149, 88, 321, 105, 343, 108, 89,
179, 339, 81, 68, 392, 392, 392, 371, 191, 198,
208, 219, 229, 173, 392, 392, 317, 339, 392, 392,
315, 392, 330, 336, 339, 317, 392, 322, 392, 309,
315, 313, 392, 312, 315, 319, 326, 309, 314, 392,
305, 392, 305, 303, 314, 392, 392, 305, 392, 306,
379, 308, 379, 300, 306, 309, 379, 379, 296, 128,
297, 379, 379, 379, 379, 379, 379, 289, 379, 379,
301, 379, 153, 379, 287, 132, 292, 379, 379, 379,
379, 379, 379, 278, 242, 245, 235, 136, 379, 233,
231, 379, 379, 379, 222, 379, 379, 379, 379, 215,
84, 205, 232, 243, 248, 257, 261, 274, 278, 282,
379, 379, 379, 379, 379, 209, 379, 200, 379, 379,
198, 196, 192, 379, 379, 379, 379, 379, 379, 379,
379, 379, 379, 379, 192, 379, 379, 379, 379, 218,
174, 173, 379, 379, 178, 379, 379, 379, 379, 379,
392, 392, 265, 392, 392, 264, 267, 392, 251, 256,
253, 392, 392, 239, 92, 233, 392, 392, 392, 392,
392, 392, 392, 224, 392, 392, 235, 392, 102, 392,
219, 117, 220, 392, 392, 392, 392, 392, 392, 206,
214, 218, 208, 116, 392, 206, 203, 392, 392, 392,
392, 201, 392, 392, 392, 392, 230, 100, 185, 264,
272, 250, 281, 285, 294, 298, 302, 392, 392, 392,
194, 392, 392, 193, 392, 392, 180, 392, 392, 177,
181, 179, 392, 392, 392, 392, 392, 392, 392, 392,
392, 173, 392, 392, 173, 392, 392, 392, 392, 202,
379, 179, 167, 161, 171, 153, 148, 379, 379, 379,
147, 379, 379, 379, 379, 379, 287, 291, 295, 299,
303, 307, 311, 315, 379, 379, 379, 379, 176, 379,
174, 131, 379, 379, 379, 379, 379, 379, 379, 109,
84, 379, 379, 379, 379, 76, 379, 379, 75
164, 151, 392, 392, 155, 392, 392, 392, 392, 392,
392, 154, 140, 138, 141, 123, 125, 392, 392, 392,
392, 126, 392, 392, 392, 392, 392, 306, 312, 316,
320, 324, 328, 332, 336, 392, 392, 392, 392, 392,
155, 392, 392, 155, 109, 392, 392, 392, 392, 392,
392, 392, 91, 86, 392, 392, 392, 392, 82, 392,
392, 97
} ;
static const flex_int16_t yy_def[250] =
static const flex_int16_t yy_def[263] =
{ 0,
248, 1, 249, 249, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
261, 1, 262, 262, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 0, 248
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
0, 261
} ;
static const flex_int16_t yy_nxt[444] =
static const flex_int16_t yy_nxt[458] =
{ 0,
6, 7, 8, 9, 10, 11, 11, 12, 13, 14,
15, 16, 15, 15, 17, 18, 6, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
6, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 6, 47, 48, 49,
50, 6, 6, 51, 6, 6, 6, 6, 6, 6,
6, 6, 52, 53, 55, 55, 58, 58, 58, 58,
59, 59, 59, 59, 60, 54, 61, 62, 62, 62,
62, 76, 60, 63, 61, 62, 62, 62, 62, 65,
68, 63, 56, 56, 66, 69, 80, 81, 91, 70,
32, 6, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 6, 48, 49,
50, 51, 6, 6, 52, 6, 6, 6, 6, 6,
6, 6, 6, 53, 54, 56, 56, 59, 59, 59,
59, 60, 60, 60, 60, 61, 67, 62, 63, 63,
63, 63, 68, 61, 64, 62, 63, 63, 63, 63,
80, 70, 64, 97, 57, 57, 71, 55, 84, 85,
71, 93, 63, 132, 85, 92, 77, 86, 110, 87,
63, 72, 82, 83, 128, 88, 129, 89, 151, 152,
111, 73, 140, 247, 90, 133, 94, 98, 137, 141,
134, 246, 99, 100, 135, 138, 101, 102, 139, 130,
103, 104, 149, 214, 215, 150, 105, 159, 106, 159,
107, 160, 160, 160, 160, 108, 245, 58, 58, 58,
58, 109, 112, 153, 188, 113, 196, 114, 115, 116,
189, 117, 203, 197, 118, 119, 120, 142, 244, 143,
121, 144, 153, 204, 243, 122, 145, 123, 242, 124,
125, 241, 126, 127, 193, 240, 194, 146, 59, 59,
72, 73, 74, 95, 64, 134, 89, 135, 115, 90,
96, 91, 64, 75, 86, 87, 81, 92, 98, 93,
116, 146, 138, 76, 158, 159, 94, 102, 147, 198,
260, 136, 103, 104, 259, 199, 105, 106, 107, 258,
156, 108, 109, 157, 203, 139, 204, 110, 143, 111,
140, 112, 206, 213, 141, 144, 113, 257, 145, 207,
225, 226, 114, 117, 214, 256, 118, 255, 119, 120,
121, 254, 122, 253, 252, 123, 124, 125, 126, 166,
251, 166, 127, 167, 167, 167, 167, 128, 250, 129,
249, 130, 131, 248, 132, 133, 148, 247, 149, 246,
59, 59, 147, 239, 154, 155, 155, 155, 155, 238,
237, 156, 157, 157, 157, 157, 236, 235, 158, 234,
233, 232, 60, 154, 61, 62, 62, 62, 62, 231,
156, 63, 208, 230, 209, 229, 210, 158, 217, 228,
217, 211, 218, 218, 218, 218, 227, 226, 225, 219,
63, 219, 212, 220, 220, 220, 220, 213, 155, 155,
155, 155, 216, 221, 156, 221, 207, 222, 222, 222,
222, 157, 157, 157, 157, 206, 205, 158, 202, 201,
223, 200, 223, 156, 224, 224, 224, 224, 160, 160,
160, 160, 160, 160, 160, 160, 158, 218, 218, 218,
150, 59, 59, 59, 59, 151, 152, 160, 60, 60,
60, 60, 245, 244, 161, 243, 242, 153, 162, 162,
162, 162, 154, 241, 163, 240, 239, 160, 238, 164,
164, 164, 164, 237, 161, 165, 61, 236, 62, 63,
63, 63, 63, 227, 163, 64, 217, 218, 216, 219,
215, 220, 212, 211, 210, 165, 221, 222, 209, 208,
162, 162, 162, 162, 205, 64, 163, 202, 223, 201,
228, 200, 228, 224, 229, 229, 229, 229, 230, 197,
230, 196, 231, 231, 231, 231, 163, 232, 195, 232,
194, 233, 233, 233, 233, 164, 164, 164, 164, 193,
218, 218, 218, 218, 218, 220, 220, 220, 220, 220,
220, 220, 220, 222, 222, 222, 222, 222, 222, 222,
222, 224, 224, 224, 224, 224, 224, 224, 224, 199,
198, 195, 192, 191, 190, 187, 186, 185, 184, 183,
182, 181, 180, 179, 178, 177, 176, 175, 174, 173,
172, 171, 170, 169, 168, 167, 166, 165, 164, 163,
162, 161, 57, 148, 136, 131, 97, 96, 95, 84,
79, 78, 75, 74, 67, 64, 57, 248, 5, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
234, 165, 234, 192, 235, 235, 235, 235, 167, 167,
167, 167, 167, 167, 167, 167, 229, 229, 229, 229,
191, 165, 229, 229, 229, 229, 231, 231, 231, 231,
231, 231, 231, 231, 233, 233, 233, 233, 233, 233,
233, 233, 235, 235, 235, 235, 235, 235, 235, 235,
190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
180, 179, 178, 177, 176, 175, 174, 173, 172, 171,
170, 169, 168, 58, 155, 142, 137, 101, 100, 99,
88, 83, 82, 79, 78, 77, 69, 66, 65, 58,
261, 5, 261, 261, 261, 261, 261, 261, 261, 261,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261
} ;
static const flex_int16_t yy_chk[444] =
static const flex_int16_t yy_chk[458] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -559,49 +566,50 @@ static const flex_int16_t yy_chk[444] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 3, 4, 12, 12, 12, 12,
14, 14, 14, 14, 15, 249, 15, 15, 15, 15,
15, 28, 16, 15, 16, 16, 16, 16, 16, 20,
24, 16, 3, 4, 20, 24, 32, 32, 35, 24,
1, 1, 1, 1, 1, 3, 4, 12, 12, 12,
12, 14, 14, 14, 14, 15, 20, 15, 15, 15,
15, 15, 20, 16, 15, 16, 16, 16, 16, 16,
29, 24, 16, 37, 3, 4, 24, 262, 33, 33,
24, 36, 15, 46, 34, 35, 28, 34, 42, 34,
16, 24, 32, 32, 44, 34, 44, 34, 53, 53,
42, 24, 49, 246, 34, 46, 36, 41, 48, 49,
46, 241, 41, 41, 46, 48, 41, 41, 48, 44,
41, 41, 52, 151, 151, 52, 41, 63, 41, 63,
41, 63, 63, 63, 63, 41, 240, 58, 58, 58,
58, 41, 43, 58, 110, 43, 126, 43, 43, 43,
110, 43, 138, 126, 43, 43, 43, 50, 232, 50,
43, 50, 58, 138, 231, 43, 50, 43, 229, 43,
43, 211, 43, 43, 123, 207, 123, 50, 59, 59,
24, 24, 24, 36, 15, 45, 35, 45, 43, 35,
36, 35, 16, 24, 33, 33, 29, 35, 37, 35,
43, 50, 47, 24, 54, 54, 35, 42, 50, 115,
259, 45, 42, 42, 254, 115, 42, 42, 42, 253,
53, 42, 42, 53, 129, 47, 129, 42, 49, 42,
47, 42, 132, 144, 47, 49, 42, 245, 49, 132,
158, 158, 42, 44, 144, 244, 44, 241, 44, 44,
44, 222, 44, 217, 216, 44, 44, 44, 44, 64,
215, 64, 44, 64, 64, 64, 64, 44, 214, 44,
213, 44, 44, 212, 44, 44, 51, 205, 51, 202,
59, 59, 50, 206, 59, 60, 60, 60, 60, 205,
204, 60, 61, 61, 61, 61, 203, 202, 61, 195,
192, 191, 62, 59, 62, 62, 62, 62, 62, 190,
60, 62, 150, 185, 150, 173, 150, 61, 153, 172,
153, 150, 153, 153, 153, 153, 171, 168, 166, 154,
62, 154, 150, 154, 154, 154, 154, 150, 155, 155,
155, 155, 152, 156, 155, 156, 145, 156, 156, 156,
156, 157, 157, 157, 157, 141, 140, 157, 137, 136,
158, 135, 158, 155, 158, 158, 158, 158, 159, 159,
159, 159, 160, 160, 160, 160, 157, 217, 217, 217,
51, 59, 59, 59, 59, 51, 51, 59, 60, 60,
60, 60, 201, 200, 60, 195, 192, 51, 61, 61,
61, 61, 51, 182, 61, 181, 180, 59, 177, 62,
62, 62, 62, 174, 60, 62, 63, 171, 63, 63,
63, 63, 63, 159, 61, 63, 152, 157, 147, 157,
146, 157, 143, 142, 141, 62, 157, 157, 140, 133,
162, 162, 162, 162, 131, 63, 162, 127, 157, 124,
160, 116, 160, 157, 160, 160, 160, 160, 161, 114,
161, 111, 161, 161, 161, 161, 162, 163, 110, 163,
109, 163, 163, 163, 163, 164, 164, 164, 164, 107,
217, 218, 218, 218, 218, 219, 219, 219, 219, 220,
220, 220, 220, 221, 221, 221, 221, 222, 222, 222,
222, 223, 223, 223, 223, 224, 224, 224, 224, 134,
127, 125, 121, 118, 111, 109, 106, 105, 104, 102,
99, 96, 94, 91, 90, 89, 87, 85, 84, 83,
82, 81, 80, 78, 77, 76, 73, 72, 71, 69,
66, 65, 57, 51, 47, 45, 40, 38, 37, 33,
30, 29, 26, 25, 21, 18, 8, 5, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
165, 164, 165, 106, 165, 165, 165, 165, 166, 166,
166, 166, 167, 167, 167, 167, 228, 228, 228, 228,
103, 164, 229, 229, 229, 229, 230, 230, 230, 230,
231, 231, 231, 231, 232, 232, 232, 232, 233, 233,
233, 233, 234, 234, 234, 234, 235, 235, 235, 235,
100, 98, 95, 94, 93, 91, 89, 88, 87, 86,
85, 84, 82, 81, 80, 78, 76, 75, 74, 73,
71, 68, 67, 58, 52, 48, 46, 41, 39, 38,
34, 31, 30, 27, 26, 25, 21, 18, 17, 8,
5, 261, 261, 261, 261, 261, 261, 261, 261, 261,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248, 248, 248,
248, 248, 248
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
261, 261, 261, 261, 261, 261, 261
} ;
static yy_state_type yy_last_accepting_state;
@@ -634,12 +642,12 @@ char *yytext;
* on Win32. The C++ scanner uses STL streams instead. */
#define YY_NO_UNISTD_H
#line 637 "QuantityLexer.c"
#line 645 "QuantityLexer.c"
/*** Flex Declarations and Options ***/
/* the manual says "somewhat more optimized" */
/* no support for include files is planned */
#line 642 "QuantityLexer.c"
#line 650 "QuantityLexer.c"
#define INITIAL 0
#define C_COMMENT 1
@@ -858,7 +866,7 @@ YY_DECL
#line 37 "QuantityParser.l"
#line 861 "QuantityLexer.c"
#line 869 "QuantityLexer.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -885,13 +893,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 249 )
if ( yy_current_state >= 262 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_current_state != 248 );
while ( yy_current_state != 261 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
@@ -1335,299 +1343,334 @@ yylval = Quantity::MilliVolt; return UNIT; // milli Volt
case 85:
YY_RULE_SETUP
#line 148 "QuantityParser.l"
yylval = Quantity::Coulomb; return UNIT; // Coulomb (A*s)
yylval = Quantity::Siemens; return UNIT; // Siemens (A^2*s^3/kg/m^2)
YY_BREAK
case 86:
YY_RULE_SETUP
#line 150 "QuantityParser.l"
yylval = Quantity::Tesla; return UNIT; // Tesla (kg/s^2/A)
#line 149 "QuantityParser.l"
yylval = Quantity::MilliSiemens; return UNIT; // milli Siemens
YY_BREAK
case 87:
YY_RULE_SETUP
#line 152 "QuantityParser.l"
yylval = Quantity::Farad; return UNIT; // Farad (s^4*A^2/m^2/kg)
#line 150 "QuantityParser.l"
yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
YY_BREAK
case 88:
YY_RULE_SETUP
#line 153 "QuantityParser.l"
yylval = Quantity::MilliFarad; return UNIT; // milli Farad
#line 151 "QuantityParser.l"
yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
YY_BREAK
case 89:
YY_RULE_SETUP
#line 154 "QuantityParser.l"
yylval = Quantity::MicroFarad; return UNIT; // micro Farad
#line 153 "QuantityParser.l"
yylval = Quantity::Ohm; return UNIT; // Ohm (kg*m^2/A^2/s^3)
YY_BREAK
case 90:
YY_RULE_SETUP
#line 155 "QuantityParser.l"
yylval = Quantity::MicroFarad; return UNIT; // micro Farad
#line 154 "QuantityParser.l"
yylval = Quantity::KiloOhm; return UNIT; // kilo Ohm
YY_BREAK
case 91:
YY_RULE_SETUP
#line 156 "QuantityParser.l"
yylval = Quantity::NanoFarad; return UNIT; // nano Farad
#line 155 "QuantityParser.l"
yylval = Quantity::MegaOhm; return UNIT; // mega Ohm
YY_BREAK
case 92:
YY_RULE_SETUP
#line 157 "QuantityParser.l"
yylval = Quantity::PicoFarad; return UNIT; // pico Farad
yylval = Quantity::Coulomb; return UNIT; // Coulomb (A*s)
YY_BREAK
case 93:
YY_RULE_SETUP
#line 159 "QuantityParser.l"
yylval = Quantity::Henry; return UNIT; // Henry (kg*m^2/s^2/A^2)
yylval = Quantity::Tesla; return UNIT; // Tesla (kg/s^2/A)
YY_BREAK
case 94:
YY_RULE_SETUP
#line 160 "QuantityParser.l"
yylval = Quantity::MilliHenry; return UNIT; // milli Henry
#line 161 "QuantityParser.l"
yylval = Quantity::Farad; return UNIT; // Farad (s^4*A^2/m^2/kg)
YY_BREAK
case 95:
YY_RULE_SETUP
#line 161 "QuantityParser.l"
yylval = Quantity::MicroHenry; return UNIT; // micro Henry
#line 162 "QuantityParser.l"
yylval = Quantity::MilliFarad; return UNIT; // milli Farad
YY_BREAK
case 96:
YY_RULE_SETUP
#line 162 "QuantityParser.l"
yylval = Quantity::MicroHenry; return UNIT; // micro Henry
#line 163 "QuantityParser.l"
yylval = Quantity::MicroFarad; return UNIT; // micro Farad
YY_BREAK
case 97:
YY_RULE_SETUP
#line 163 "QuantityParser.l"
yylval = Quantity::NanoHenry; return UNIT; // nano Henry
#line 164 "QuantityParser.l"
yylval = Quantity::MicroFarad; return UNIT; // micro Farad
YY_BREAK
case 98:
YY_RULE_SETUP
#line 165 "QuantityParser.l"
yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2)
yylval = Quantity::NanoFarad; return UNIT; // nano Farad
YY_BREAK
case 99:
YY_RULE_SETUP
#line 166 "QuantityParser.l"
yylval = Quantity::MilliJoule; return UNIT; // milli Joule
yylval = Quantity::PicoFarad; return UNIT; // pico Farad
YY_BREAK
case 100:
YY_RULE_SETUP
#line 167 "QuantityParser.l"
yylval = Quantity::KiloJoule; return UNIT; // kilo Joule
#line 168 "QuantityParser.l"
yylval = Quantity::Henry; return UNIT; // Henry (kg*m^2/s^2/A^2)
YY_BREAK
case 101:
YY_RULE_SETUP
#line 168 "QuantityParser.l"
yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule
#line 169 "QuantityParser.l"
yylval = Quantity::MilliHenry; return UNIT; // milli Henry
YY_BREAK
case 102:
YY_RULE_SETUP
#line 169 "QuantityParser.l"
yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule
#line 170 "QuantityParser.l"
yylval = Quantity::MicroHenry; return UNIT; // micro Henry
YY_BREAK
case 103:
YY_RULE_SETUP
#line 170 "QuantityParser.l"
yylval = Quantity::WattSecond; return UNIT; //
#line 171 "QuantityParser.l"
yylval = Quantity::MicroHenry; return UNIT; // micro Henry
YY_BREAK
case 104:
YY_RULE_SETUP
#line 171 "QuantityParser.l"
yylval = Quantity::WattSecond; return UNIT; // W*s = Joule
#line 172 "QuantityParser.l"
yylval = Quantity::NanoHenry; return UNIT; // nano Henry
YY_BREAK
case 105:
YY_RULE_SETUP
#line 172 "QuantityParser.l"
yylval = Quantity::KiloWattHour; return UNIT; // 1 kWh = 3.6e6 J
#line 174 "QuantityParser.l"
yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2)
YY_BREAK
case 106:
YY_RULE_SETUP
#line 173 "QuantityParser.l"
yylval = Quantity::ElectronVolt; return UNIT; // 1 eV = 1.602176634e-19 J
#line 175 "QuantityParser.l"
yylval = Quantity::MilliJoule; return UNIT; // milli Joule
YY_BREAK
case 107:
YY_RULE_SETUP
#line 174 "QuantityParser.l"
yylval = Quantity::KiloElectronVolt; return UNIT;
#line 176 "QuantityParser.l"
yylval = Quantity::KiloJoule; return UNIT; // kilo Joule
YY_BREAK
case 108:
YY_RULE_SETUP
#line 175 "QuantityParser.l"
yylval = Quantity::MegaElectronVolt; return UNIT;
#line 177 "QuantityParser.l"
yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule
YY_BREAK
case 109:
YY_RULE_SETUP
#line 176 "QuantityParser.l"
yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
#line 178 "QuantityParser.l"
yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule
YY_BREAK
case 110:
YY_RULE_SETUP
#line 177 "QuantityParser.l"
yylval = Quantity::KiloCalorie; return UNIT;
#line 179 "QuantityParser.l"
yylval = Quantity::WattSecond; return UNIT; //
YY_BREAK
case 111:
YY_RULE_SETUP
#line 179 "QuantityParser.l"
yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
#line 180 "QuantityParser.l"
yylval = Quantity::WattSecond; return UNIT; // W*s = Joule
YY_BREAK
case 112:
YY_RULE_SETUP
#line 180 "QuantityParser.l"
yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
#line 181 "QuantityParser.l"
yylval = Quantity::KiloWattHour; return UNIT; // 1 kWh = 3.6e6 J
YY_BREAK
case 113:
YY_RULE_SETUP
#line 181 "QuantityParser.l"
yylval = Quantity::Radian; return UNIT; // radian
#line 182 "QuantityParser.l"
yylval = Quantity::ElectronVolt; return UNIT; // 1 eV = 1.602176634e-19 J
YY_BREAK
case 114:
YY_RULE_SETUP
#line 182 "QuantityParser.l"
yylval = Quantity::Gon; return UNIT; // gon
#line 183 "QuantityParser.l"
yylval = Quantity::KiloElectronVolt; return UNIT;
YY_BREAK
case 115:
YY_RULE_SETUP
#line 183 "QuantityParser.l"
yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
#line 184 "QuantityParser.l"
yylval = Quantity::MegaElectronVolt; return UNIT;
YY_BREAK
case 116:
YY_RULE_SETUP
#line 184 "QuantityParser.l"
yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
#line 185 "QuantityParser.l"
yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
YY_BREAK
case 117:
YY_RULE_SETUP
#line 185 "QuantityParser.l"
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
#line 186 "QuantityParser.l"
yylval = Quantity::KiloCalorie; return UNIT;
YY_BREAK
case 118:
YY_RULE_SETUP
#line 186 "QuantityParser.l"
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
#line 188 "QuantityParser.l"
yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
YY_BREAK
case 119:
YY_RULE_SETUP
#line 188 "QuantityParser.l"
yylval = Quantity(1.0); return ONE;
#line 189 "QuantityParser.l"
yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
YY_BREAK
case 120:
YY_RULE_SETUP
#line 189 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,'.',','));return NUM; }
#line 190 "QuantityParser.l"
yylval = Quantity::Radian; return UNIT; // radian
YY_BREAK
case 121:
YY_RULE_SETUP
#line 190 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,'.',','));return NUM; }
#line 191 "QuantityParser.l"
yylval = Quantity::Gon; return UNIT; // gon
YY_BREAK
case 122:
YY_RULE_SETUP
#line 191 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,',','.'));return NUM; }
#line 192 "QuantityParser.l"
yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
YY_BREAK
case 123:
YY_RULE_SETUP
#line 192 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,',','.'));return NUM; }
#line 193 "QuantityParser.l"
yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
YY_BREAK
case 124:
YY_RULE_SETUP
#line 195 "QuantityParser.l"
{yylval = Quantity(M_PI) ; return NUM;} // constant pi
#line 194 "QuantityParser.l"
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
YY_BREAK
case 125:
YY_RULE_SETUP
#line 196 "QuantityParser.l"
{yylval = Quantity(M_E) ; return NUM;} // constant e
#line 195 "QuantityParser.l"
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
YY_BREAK
case 126:
YY_RULE_SETUP
#line 198 "QuantityParser.l"
return ACOS;
#line 197 "QuantityParser.l"
yylval = Quantity(1.0); return ONE;
YY_BREAK
case 127:
YY_RULE_SETUP
#line 199 "QuantityParser.l"
return ASIN;
#line 198 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,'.',','));return NUM; }
YY_BREAK
case 128:
YY_RULE_SETUP
#line 200 "QuantityParser.l"
return ATAN;
#line 199 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,'.',','));return NUM; }
YY_BREAK
case 129:
YY_RULE_SETUP
#line 201 "QuantityParser.l"
return ATAN2;
#line 200 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,',','.'));return NUM; }
YY_BREAK
case 130:
YY_RULE_SETUP
#line 202 "QuantityParser.l"
return COS;
#line 201 "QuantityParser.l"
{ yylval = Quantity(num_change(yytext,',','.'));return NUM; }
YY_BREAK
case 131:
YY_RULE_SETUP
#line 203 "QuantityParser.l"
return EXP;
#line 204 "QuantityParser.l"
{yylval = Quantity(M_PI) ; return NUM;} // constant pi
YY_BREAK
case 132:
YY_RULE_SETUP
#line 204 "QuantityParser.l"
return ABS;
#line 205 "QuantityParser.l"
{yylval = Quantity(M_E) ; return NUM;} // constant e
YY_BREAK
case 133:
YY_RULE_SETUP
#line 205 "QuantityParser.l"
return MOD;
#line 207 "QuantityParser.l"
return ACOS;
YY_BREAK
case 134:
YY_RULE_SETUP
#line 206 "QuantityParser.l"
return LOG;
#line 208 "QuantityParser.l"
return ASIN;
YY_BREAK
case 135:
YY_RULE_SETUP
#line 207 "QuantityParser.l"
return LOG10;
#line 209 "QuantityParser.l"
return ATAN;
YY_BREAK
case 136:
YY_RULE_SETUP
#line 208 "QuantityParser.l"
return POW;
#line 210 "QuantityParser.l"
return ATAN2;
YY_BREAK
case 137:
YY_RULE_SETUP
#line 209 "QuantityParser.l"
return SIN;
#line 211 "QuantityParser.l"
return COS;
YY_BREAK
case 138:
YY_RULE_SETUP
#line 210 "QuantityParser.l"
return SINH;
#line 212 "QuantityParser.l"
return EXP;
YY_BREAK
case 139:
YY_RULE_SETUP
#line 211 "QuantityParser.l"
return TAN;
#line 213 "QuantityParser.l"
return ABS;
YY_BREAK
case 140:
YY_RULE_SETUP
#line 212 "QuantityParser.l"
return TANH;
#line 214 "QuantityParser.l"
return MOD;
YY_BREAK
case 141:
YY_RULE_SETUP
#line 213 "QuantityParser.l"
return SQRT;
#line 215 "QuantityParser.l"
return LOG;
YY_BREAK
case 142:
YY_RULE_SETUP
#line 215 "QuantityParser.l"
return *yytext;
#line 216 "QuantityParser.l"
return LOG10;
YY_BREAK
case 143:
YY_RULE_SETUP
#line 216 "QuantityParser.l"
#line 217 "QuantityParser.l"
return POW;
YY_BREAK
case 144:
YY_RULE_SETUP
#line 218 "QuantityParser.l"
return SIN;
YY_BREAK
case 145:
YY_RULE_SETUP
#line 219 "QuantityParser.l"
return SINH;
YY_BREAK
case 146:
YY_RULE_SETUP
#line 220 "QuantityParser.l"
return TAN;
YY_BREAK
case 147:
YY_RULE_SETUP
#line 221 "QuantityParser.l"
return TANH;
YY_BREAK
case 148:
YY_RULE_SETUP
#line 222 "QuantityParser.l"
return SQRT;
YY_BREAK
case 149:
YY_RULE_SETUP
#line 224 "QuantityParser.l"
return *yytext;
YY_BREAK
case 150:
YY_RULE_SETUP
#line 225 "QuantityParser.l"
ECHO;
YY_BREAK
#line 1630 "QuantityLexer.c"
#line 1673 "QuantityLexer.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(C_COMMENT):
yyterminate();
@@ -1926,7 +1969,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 249 )
if ( yy_current_state >= 262 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1954,11 +1997,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 249 )
if ( yy_current_state >= 262 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 248);
yy_is_jam = (yy_current_state == 261);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2597,4 +2640,4 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 216 "QuantityParser.l"
#line 225 "QuantityParser.l"

View File

@@ -145,6 +145,15 @@ CGRP '\,'[0-9][0-9][0-9]
"kV" yylval = Quantity::KiloVolt; return UNIT; // kilo Volt
"mV" yylval = Quantity::MilliVolt; return UNIT; // milli Volt
"S" yylval = Quantity::Siemens; return UNIT; // Siemens (A^2*s^3/kg/m^2)
"mS" yylval = Quantity::MilliSiemens; return UNIT; // milli Siemens
"\xC2\xB5S" yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
"uS" yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
"Ohm" yylval = Quantity::Ohm; return UNIT; // Ohm (kg*m^2/A^2/s^3)
"kOhm" yylval = Quantity::KiloOhm; return UNIT; // kilo Ohm
"MOhm" yylval = Quantity::MegaOhm; return UNIT; // mega Ohm
"C" yylval = Quantity::Coulomb; return UNIT; // Coulomb (A*s)
"T" yylval = Quantity::Tesla; return UNIT; // Tesla (kg/s^2/A)
@@ -182,7 +191,7 @@ CGRP '\,'[0-9][0-9][0-9]
"gon" yylval = Quantity::Gon; return UNIT; // gon
"M" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
"\xE2\x80\xB2" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
"S" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"AS" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"\xE2\x80\xB3" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"1" yylval = Quantity(1.0); return ONE;

View File

@@ -443,6 +443,8 @@ QString Unit::getTypeString(void) const
if(*this == Unit::MagneticFluxDensity ) return QString::fromLatin1("MagneticFluxDensity");
if(*this == Unit::ElectricalCapacitance ) return QString::fromLatin1("ElectricalCapacitance");
if(*this == Unit::ElectricalInductance ) return QString::fromLatin1("ElectricalInductance");
if(*this == Unit::ElectricalConductance ) return QString::fromLatin1("ElectricalConductance");
if(*this == Unit::ElectricalResistance ) return QString::fromLatin1("ElectricalResistance");
if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance");
if(*this == Unit::LuminousIntensity ) return QString::fromLatin1("LuminousIntensity");
if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure");
@@ -486,6 +488,8 @@ Unit Unit::ElectricCharge(0,0,1,1);
Unit Unit::MagneticFluxDensity(0,1,-2,-1);
Unit Unit::ElectricalCapacitance(-2,-1,4,2);
Unit Unit::ElectricalInductance(2,1,-2,-2);
Unit Unit::ElectricalConductance(-2,-1,3,2);
Unit Unit::ElectricalResistance(2,1,-3,-2);
Unit Unit::AmountOfSubstance(0,0,0,0,0,1);
Unit Unit::LuminousIntensity(0,0,0,0,0,0,1);

View File

@@ -114,6 +114,8 @@ public:
static Unit MagneticFluxDensity;
static Unit ElectricalCapacitance;
static Unit ElectricalInductance;
static Unit ElectricalConductance;
static Unit ElectricalResistance;
static Unit AmountOfSubstance;
static Unit LuminousIntensity;

View File

@@ -295,7 +295,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
}
else if (unit == Unit::SpecificEnergy) {
unitString = QString::fromLatin1("m^2/s^2");
factor = 1000000;
factor = 1e6;
}
else if (unit == Unit::HeatFlux) {
unitString = QString::fromLatin1("W/m^2");
@@ -309,6 +309,34 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("T");
factor = 1.0;
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
unitString = QString::fromLatin1("\xC2\xB5S");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
unitString = QString::fromLatin1("mS");
factor = 1e-9;
}
else {
unitString = QString::fromLatin1("S");
factor = 1e-6;
}
}
else if (unit == Unit::ElectricalResistance) {
if (UnitValue < 1e9) {
unitString = QString::fromLatin1("Ohm");
factor = 1e6;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("kOhm");
factor = 1e9;
}
else {
unitString = QString::fromLatin1("MOhm");
factor = 1e12;
}
}
else if (unit == Unit::ElectricalCapacitance) {
if (UnitValue < 1e-15) {
unitString = QString::fromLatin1("pF");

View File

@@ -270,6 +270,34 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
unitString = QString::fromLatin1("T");
factor = 1.0;
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
unitString = QString::fromLatin1("\xC2\xB5S");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
unitString = QString::fromLatin1("mS");
factor = 1e-9;
}
else {
unitString = QString::fromLatin1("S");
factor = 1e-6;
}
}
else if (unit == Unit::ElectricalResistance) {
if (UnitValue < 1e9) {
unitString = QString::fromLatin1("Ohm");
factor = 1e6;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("kOhm");
factor = 1e9;
}
else {
unitString = QString::fromLatin1("MOhm");
factor = 1e12;
}
}
else if (unit == Unit::ElectricalCapacitance) {
if (UnitValue < 1e-15) {
unitString = QString::fromLatin1("pF");

View File

@@ -79,6 +79,8 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
<< Base::Unit::Density
<< Base::Unit::ElectricalCapacitance
<< Base::Unit::ElectricalInductance
<< Base::Unit::ElectricalConductance
<< Base::Unit::ElectricalResistance
<< Base::Unit::ElectricCharge
<< Base::Unit::ElectricCurrent
<< Base::Unit::ElectricPotential