Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
This commit is contained in:
commit
fab311cb00
|
@ -198,7 +198,7 @@ Quantity Quantity::parse(const char* buffer)
|
|||
// free the scan buffer
|
||||
QuantityParser::yy_delete_buffer (my_string_buffer);
|
||||
|
||||
if (QuantResult == Quantity(DOUBLE_MIN))
|
||||
throw Base::Exception("Unknown error in Quantity expression");
|
||||
//if (QuantResult == Quantity(DOUBLE_MIN))
|
||||
// throw Base::Exception("Unknown error in Quantity expression");
|
||||
return QuantResult;
|
||||
}
|
||||
|
|
|
@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] );
|
|||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 63
|
||||
#define YY_END_OF_BUFFER 64
|
||||
#define YY_NUM_RULES 76
|
||||
#define YY_END_OF_BUFFER 77
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
|
@ -370,20 +370,22 @@ struct yy_trans_info
|
|||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[107] =
|
||||
static yyconst flex_int16_t yy_accept[126] =
|
||||
{ 0,
|
||||
0, 0, 64, 63, 1, 2, 33, 35, 3, 44,
|
||||
20, 24, 63, 63, 63, 63, 46, 63, 14, 19,
|
||||
63, 63, 11, 9, 63, 63, 63, 63, 17, 16,
|
||||
63, 2, 43, 44, 23, 0, 0, 0, 0, 28,
|
||||
7, 0, 0, 0, 8, 0, 34, 0, 32, 22,
|
||||
15, 10, 38, 0, 21, 25, 13, 0, 6, 0,
|
||||
4, 39, 45, 0, 0, 0, 0, 40, 0, 36,
|
||||
26, 12, 5, 37, 43, 0, 53, 0, 0, 0,
|
||||
51, 41, 29, 52, 31, 55, 18, 54, 27, 57,
|
||||
30, 58, 0, 60, 0, 42, 47, 48, 49, 0,
|
||||
0, 0, 0, 0, 77, 76, 4, 5, 36, 38,
|
||||
6, 57, 23, 76, 50, 27, 76, 45, 76, 76,
|
||||
48, 1, 76, 76, 76, 59, 76, 17, 22, 76,
|
||||
76, 14, 12, 76, 76, 76, 76, 20, 19, 76,
|
||||
3, 2, 5, 56, 57, 53, 26, 51, 46, 49,
|
||||
54, 0, 0, 0, 0, 31, 10, 0, 0, 0,
|
||||
11, 0, 37, 0, 35, 25, 18, 13, 41, 0,
|
||||
24, 28, 16, 0, 9, 0, 7, 42, 58, 0,
|
||||
0, 0, 0, 0, 43, 0, 39, 29, 15, 8,
|
||||
40, 56, 0, 52, 66, 0, 0, 0, 64, 44,
|
||||
|
||||
59, 62, 61, 50, 56, 0
|
||||
32, 65, 34, 68, 21, 67, 30, 70, 47, 33,
|
||||
71, 0, 73, 0, 55, 60, 61, 62, 0, 72,
|
||||
75, 74, 63, 69, 0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
|
@ -394,14 +396,14 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 2, 1, 4, 1, 1, 1, 1, 5, 6,
|
||||
6, 6, 7, 8, 7, 8, 6, 9, 10, 11,
|
||||
12, 12, 12, 12, 12, 12, 12, 1, 1, 1,
|
||||
6, 1, 1, 1, 13, 1, 1, 1, 14, 1,
|
||||
1, 1, 1, 1, 15, 1, 16, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 6, 1, 1, 17, 18, 19, 20,
|
||||
6, 1, 1, 1, 13, 1, 14, 1, 15, 1,
|
||||
1, 1, 1, 16, 17, 1, 18, 19, 1, 20,
|
||||
1, 1, 1, 1, 1, 21, 22, 1, 1, 1,
|
||||
23, 1, 24, 6, 1, 1, 25, 26, 27, 28,
|
||||
|
||||
21, 22, 23, 24, 25, 1, 26, 27, 28, 29,
|
||||
30, 31, 32, 33, 34, 35, 1, 1, 36, 37,
|
||||
38, 39, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
29, 30, 31, 32, 33, 1, 34, 35, 36, 37,
|
||||
38, 39, 40, 41, 42, 43, 1, 1, 44, 45,
|
||||
46, 47, 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,
|
||||
|
@ -418,90 +420,105 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[40] =
|
||||
{ 0,
|
||||
1, 1, 1, 2, 1, 1, 1, 2, 3, 3,
|
||||
3, 3, 1, 4, 1, 1, 1, 1, 1, 1,
|
||||
4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[109] =
|
||||
{ 0,
|
||||
0, 0, 134, 135, 135, 130, 135, 135, 135, 36,
|
||||
135, 135, 119, 23, 23, 24, 94, 100, 99, 135,
|
||||
99, 33, 30, 49, 99, 87, 24, 108, 38, 51,
|
||||
61, 121, 57, 61, 135, 89, 92, 96, 103, 135,
|
||||
135, 85, 83, 94, 135, 85, 135, 86, 135, 135,
|
||||
135, 135, 135, 91, 135, 135, 135, 84, 135, 60,
|
||||
135, 135, 135, 76, 91, 63, 58, 135, 61, 135,
|
||||
135, 135, 135, 135, 67, 86, 135, 52, 56, 54,
|
||||
135, 135, 135, 135, 135, 72, 135, 135, 135, 135,
|
||||
135, 43, 31, 31, 90, 94, 135, 135, 39, 38,
|
||||
|
||||
135, 135, 135, 135, 135, 135, 105, 106
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[109] =
|
||||
{ 0,
|
||||
106, 1, 106, 106, 106, 106, 106, 106, 106, 107,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 108, 107, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 108, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
|
||||
106, 106, 106, 106, 106, 0, 106, 106
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[175] =
|
||||
{ 0,
|
||||
4, 5, 6, 7, 8, 9, 9, 4, 10, 10,
|
||||
10, 10, 11, 4, 12, 13, 14, 4, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||||
27, 4, 28, 29, 30, 4, 4, 31, 4, 33,
|
||||
36, 37, 40, 33, 44, 50, 105, 53, 63, 104,
|
||||
41, 45, 42, 64, 103, 51, 38, 39, 43, 54,
|
||||
52, 55, 66, 56, 33, 102, 101, 69, 33, 67,
|
||||
76, 57, 68, 58, 70, 71, 59, 76, 60, 88,
|
||||
76, 100, 99, 72, 98, 97, 89, 76, 73, 94,
|
||||
93, 92, 95, 74, 96, 96, 96, 96, 96, 96,
|
||||
|
||||
96, 96, 96, 96, 96, 96, 34, 34, 75, 75,
|
||||
91, 90, 87, 86, 85, 84, 83, 82, 81, 80,
|
||||
79, 78, 77, 32, 65, 62, 61, 49, 48, 47,
|
||||
46, 35, 32, 106, 3, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[175] =
|
||||
static yyconst flex_int32_t yy_meta[48] =
|
||||
{ 0,
|
||||
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, 10,
|
||||
14, 14, 15, 10, 16, 22, 100, 23, 27, 99,
|
||||
15, 16, 15, 27, 94, 22, 14, 14, 15, 23,
|
||||
22, 24, 29, 24, 34, 93, 92, 30, 34, 29,
|
||||
33, 24, 29, 24, 30, 31, 24, 33, 24, 60,
|
||||
75, 86, 80, 31, 79, 78, 60, 75, 31, 69,
|
||||
67, 66, 76, 31, 76, 76, 76, 76, 95, 95,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
95, 95, 96, 96, 96, 96, 107, 107, 108, 108,
|
||||
65, 64, 58, 54, 48, 46, 44, 43, 42, 39,
|
||||
38, 37, 36, 32, 28, 26, 25, 21, 19, 18,
|
||||
17, 13, 6, 3, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
106, 106, 106, 106
|
||||
static yyconst flex_int16_t yy_base[127] =
|
||||
{ 0,
|
||||
0, 0, 45, 46, 167, 168, 168, 163, 168, 168,
|
||||
168, 46, 168, 144, 168, 168, 151, 127, 137, 148,
|
||||
118, 168, 25, 35, 24, 114, 120, 119, 168, 119,
|
||||
46, 36, 59, 119, 107, 42, 128, 45, 61, 70,
|
||||
168, 168, 149, 93, 105, 168, 168, 168, 168, 109,
|
||||
168, 108, 111, 115, 122, 168, 168, 104, 102, 113,
|
||||
168, 104, 168, 105, 168, 168, 168, 168, 168, 110,
|
||||
168, 168, 168, 103, 168, 61, 168, 168, 168, 95,
|
||||
104, 84, 73, 66, 168, 63, 168, 168, 168, 168,
|
||||
168, 109, 116, 168, 168, 57, 61, 57, 168, 168,
|
||||
|
||||
168, 168, 168, 81, 168, 168, 168, 168, 168, 168,
|
||||
51, 38, 34, 120, 124, 168, 168, 54, 55, 168,
|
||||
168, 168, 168, 168, 168, 60
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[127] =
|
||||
{ 0,
|
||||
125, 1, 126, 126, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 0, 125
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[216] =
|
||||
{ 0,
|
||||
6, 7, 8, 9, 10, 11, 11, 6, 12, 12,
|
||||
12, 12, 13, 14, 6, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 6, 23, 6, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 34, 35, 36, 6,
|
||||
37, 38, 39, 6, 6, 40, 6, 6, 6, 44,
|
||||
52, 53, 60, 44, 45, 45, 45, 45, 66, 61,
|
||||
41, 69, 56, 124, 123, 122, 54, 55, 42, 42,
|
||||
57, 71, 58, 70, 79, 72, 67, 83, 59, 80,
|
||||
121, 68, 120, 81, 84, 86, 88, 85, 106, 73,
|
||||
119, 74, 87, 118, 75, 107, 76, 117, 116, 113,
|
||||
|
||||
89, 92, 92, 92, 92, 90, 112, 93, 44, 111,
|
||||
91, 110, 44, 45, 45, 45, 45, 92, 92, 92,
|
||||
92, 93, 114, 93, 115, 115, 115, 115, 115, 115,
|
||||
115, 115, 115, 115, 115, 115, 109, 93, 108, 105,
|
||||
104, 103, 102, 101, 100, 99, 98, 97, 96, 95,
|
||||
94, 43, 82, 78, 77, 65, 64, 63, 62, 51,
|
||||
50, 49, 48, 47, 46, 43, 125, 5, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[216] =
|
||||
{ 0,
|
||||
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, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 3, 4, 12,
|
||||
23, 23, 25, 12, 12, 12, 12, 12, 31, 25,
|
||||
126, 32, 24, 119, 118, 113, 23, 23, 3, 4,
|
||||
24, 33, 24, 32, 36, 33, 31, 38, 24, 36,
|
||||
112, 31, 111, 36, 38, 39, 40, 38, 76, 33,
|
||||
104, 33, 39, 98, 33, 76, 33, 97, 96, 86,
|
||||
|
||||
40, 44, 44, 44, 44, 40, 84, 44, 45, 83,
|
||||
40, 82, 45, 45, 45, 45, 45, 92, 92, 92,
|
||||
92, 44, 93, 92, 93, 93, 93, 93, 114, 114,
|
||||
114, 114, 115, 115, 115, 115, 81, 92, 80, 74,
|
||||
70, 64, 62, 60, 59, 58, 55, 54, 53, 52,
|
||||
50, 43, 37, 35, 34, 30, 28, 27, 26, 21,
|
||||
20, 19, 18, 17, 14, 8, 5, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
|
||||
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
|
||||
125, 125, 125, 125, 125
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
|
@ -531,9 +548,11 @@ char *yytext;
|
|||
/*** Flex Declarations and Options ***/
|
||||
/* the manual says "somewhat more optimized" */
|
||||
/* no support for include files is planned */
|
||||
#line 535 "QuantityLexer.c"
|
||||
|
||||
#line 553 "QuantityLexer.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define C_COMMENT 1
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
|
@ -711,11 +730,10 @@ YY_DECL
|
|||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 27 "QuantityParser.l"
|
||||
#line 28 "QuantityParser.l"
|
||||
|
||||
|
||||
|
||||
#line 719 "QuantityLexer.c"
|
||||
#line 737 "QuantityLexer.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
|
@ -768,13 +786,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 >= 107 )
|
||||
if ( yy_current_state >= 126 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_current_state != 106 );
|
||||
while ( yy_current_state != 125 );
|
||||
yy_cp = (yy_last_accepting_cpos);
|
||||
yy_current_state = (yy_last_accepting_state);
|
||||
|
||||
|
@ -797,321 +815,387 @@ do_action: /* This label is used only to access EOF actions. */
|
|||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 30 "QuantityParser.l"
|
||||
;
|
||||
{ BEGIN(C_COMMENT); }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
/* rule 2 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 31 "QuantityParser.l"
|
||||
;
|
||||
{ BEGIN(INITIAL); }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 33 "QuantityParser.l"
|
||||
{ return *yytext; }
|
||||
#line 32 "QuantityParser.l"
|
||||
{ ;}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 35 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-6 ,Unit(1)); return UNIT; // nano meter
|
||||
;
|
||||
YY_BREAK
|
||||
case 5:
|
||||
/* rule 5 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 36 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-3 ,Unit(1)); return UNIT; // micro meter
|
||||
;
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 37 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(1)); return UNIT; // milli meter
|
||||
#line 38 "QuantityParser.l"
|
||||
{ return *yytext; }
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 38 "QuantityParser.l"
|
||||
yylval = Quantity(10.0 ,Unit(1)); return UNIT; // centi meter
|
||||
#line 40 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-6 ,Unit(1)); return UNIT; // nano meter
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 39 "QuantityParser.l"
|
||||
yylval = Quantity(100.0 ,Unit(1)); return UNIT; // deci meter
|
||||
#line 41 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-3 ,Unit(1)); return UNIT; // micro meter
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 40 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e3 ,Unit(1)); return UNIT; // meter
|
||||
#line 42 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(1)); return UNIT; // milli meter
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 41 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e6 ,Unit(1)); return UNIT; // kilo meter
|
||||
#line 43 "QuantityParser.l"
|
||||
yylval = Quantity(10.0 ,Unit(1)); return UNIT; // centi meter
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 42 "QuantityParser.l"
|
||||
yylval = Quantity(1000000.0 ,Unit(3)); return UNIT; // Liter dm^3
|
||||
#line 44 "QuantityParser.l"
|
||||
yylval = Quantity(100.0 ,Unit(1)); return UNIT; // deci meter
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 44 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-9 ,Unit(0,1)); return UNIT; // milli gram
|
||||
#line 45 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e3 ,Unit(1)); return UNIT; // meter
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 45 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-6 ,Unit(0,1)); return UNIT; // milli gram
|
||||
#line 46 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e6 ,Unit(1)); return UNIT; // kilo meter
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 46 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-3 ,Unit(0,1)); return UNIT; // gram
|
||||
#line 47 "QuantityParser.l"
|
||||
yylval = Quantity(1000000.0 ,Unit(3)); return UNIT; // Liter dm^3
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 47 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,1)); return UNIT; // kilo gram
|
||||
#line 49 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-9 ,Unit(0,1)); return UNIT; // milli gram
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 48 "QuantityParser.l"
|
||||
yylval = Quantity(1000.0 ,Unit(0,1)); return UNIT; // ton
|
||||
#line 50 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-6 ,Unit(0,1)); return UNIT; // milli gram
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 50 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,1)); return UNIT; // second (internal standard time)
|
||||
#line 51 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e-3 ,Unit(0,1)); return UNIT; // gram
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 51 "QuantityParser.l"
|
||||
yylval = Quantity(60.0 ,Unit(0,0,1)); return UNIT; // minute
|
||||
#line 52 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,1)); return UNIT; // kilo gram (internal standard for mass)
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 52 "QuantityParser.l"
|
||||
yylval = Quantity(3600.0 ,Unit(0,0,1)); return UNIT; // hour
|
||||
#line 53 "QuantityParser.l"
|
||||
yylval = Quantity(1000.0 ,Unit(0,1)); return UNIT; // ton
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 54 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,1)); return UNIT; // Ampere (internal standard electric current)
|
||||
#line 55 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,1)); return UNIT; // second (internal standard time)
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 55 "QuantityParser.l"
|
||||
yylval = Quantity(0.001 ,Unit(0,0,0,1)); return UNIT; // milli Ampere
|
||||
#line 56 "QuantityParser.l"
|
||||
yylval = Quantity(60.0 ,Unit(0,0,1)); return UNIT; // minute
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 56 "QuantityParser.l"
|
||||
yylval = Quantity(1000.0 ,Unit(0,0,0,1)); return UNIT; // kilo Ampere
|
||||
#line 57 "QuantityParser.l"
|
||||
yylval = Quantity(3600.0 ,Unit(0,0,1)); return UNIT; // hour
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 57 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e6 ,Unit(0,0,0,1)); return UNIT; // Mega Ampere
|
||||
#line 59 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,1)); return UNIT; // Ampere (internal standard electric current)
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 59 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin (internal standard thermodynamic temperature)
|
||||
#line 60 "QuantityParser.l"
|
||||
yylval = Quantity(0.001 ,Unit(0,0,0,1)); return UNIT; // milli Ampere
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 60 "QuantityParser.l"
|
||||
yylval = Quantity(0.001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
#line 61 "QuantityParser.l"
|
||||
yylval = Quantity(1000.0 ,Unit(0,0,0,1)); return UNIT; // kilo Ampere
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 61 "QuantityParser.l"
|
||||
yylval = Quantity(0.000001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
#line 62 "QuantityParser.l"
|
||||
yylval = Quantity(1.0e6 ,Unit(0,0,0,1)); return UNIT; // Mega Ampere
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 63 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,0,1)); return UNIT; // Mole (internal standard amount of substance)
|
||||
#line 64 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin (internal standard thermodynamic temperature)
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 65 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,1)); return UNIT; // Candela (internal standard luminous intensity)
|
||||
yylval = Quantity(0.001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 67 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // degree (internal standard angle)
|
||||
#line 66 "QuantityParser.l"
|
||||
yylval = Quantity(0.000001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 68 "QuantityParser.l"
|
||||
yylval = Quantity(180/M_PI ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // radian
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,0,1)); return UNIT; // Mole (internal standard amount of substance)
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 69 "QuantityParser.l"
|
||||
yylval = Quantity(360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // gon
|
||||
#line 70 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,1)); return UNIT; // Candela (internal standard luminous intensity)
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 71 "QuantityParser.l"
|
||||
yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
#line 72 "QuantityParser.l"
|
||||
yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // degree (internal standard angle)
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 72 "QuantityParser.l"
|
||||
yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
#line 73 "QuantityParser.l"
|
||||
yylval = Quantity(180/M_PI ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // radian
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 73 "QuantityParser.l"
|
||||
yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
#line 74 "QuantityParser.l"
|
||||
yylval = Quantity(360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // gon
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 74 "QuantityParser.l"
|
||||
yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
#line 76 "QuantityParser.l"
|
||||
yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
YY_BREAK
|
||||
case 36:
|
||||
YY_RULE_SETUP
|
||||
#line 75 "QuantityParser.l"
|
||||
yylval = Quantity(0.0254 ,Unit(1)); return UNIT; // thou
|
||||
#line 77 "QuantityParser.l"
|
||||
yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 76 "QuantityParser.l"
|
||||
yylval = Quantity(914.4 ,Unit(1)); return UNIT; // yard
|
||||
#line 78 "QuantityParser.l"
|
||||
yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 79 "QuantityParser.l"
|
||||
yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // pound
|
||||
yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 80 "QuantityParser.l"
|
||||
yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // ounce
|
||||
yylval = Quantity(0.0254 ,Unit(1)); return UNIT; // thou
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 81 "QuantityParser.l"
|
||||
yylval = Quantity(6.35029318 ,Unit(0,1)); return UNIT; // Stone
|
||||
yylval = Quantity(914.4 ,Unit(1)); return UNIT; // yard
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 82 "QuantityParser.l"
|
||||
yylval = Quantity(50.80234544 ,Unit(0,1)); return UNIT; // hundredweights
|
||||
#line 84 "QuantityParser.l"
|
||||
yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // pound
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 86 "QuantityParser.l"
|
||||
{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
#line 85 "QuantityParser.l"
|
||||
yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // ounce
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 87 "QuantityParser.l"
|
||||
{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
#line 86 "QuantityParser.l"
|
||||
yylval = Quantity(6.35029318 ,Unit(0,1)); return UNIT; // Stone
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 88 "QuantityParser.l"
|
||||
{yylval = atof( yytext ); return NUM;}
|
||||
#line 87 "QuantityParser.l"
|
||||
yylval = Quantity(50.80234544 ,Unit(0,1)); return UNIT; // hundredweights
|
||||
YY_BREAK
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 90 "QuantityParser.l"
|
||||
{yylval = M_PI ; return NUM;} // constant pi
|
||||
#line 89 "QuantityParser.l"
|
||||
yylval = Quantity(1000.0 ,Unit(1,1,-2)); return UNIT; // Newton (kg*m/s^2)
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 91 "QuantityParser.l"
|
||||
{yylval = M_E ; return NUM;} // constant e
|
||||
yylval = Quantity(0.001 ,Unit(-1,1,-2)); return UNIT; // Pascal (kg/m*s^2)
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 93 "QuantityParser.l"
|
||||
return ACOS;
|
||||
#line 92 "QuantityParser.l"
|
||||
yylval = Quantity(0.145038 ,Unit(-1,1,-2)); return UNIT; // pounds/in^2
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 94 "QuantityParser.l"
|
||||
return ASIN;
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-3)); return UNIT; // Watt (kg*m^2/s^3)
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 95 "QuantityParser.l"
|
||||
return ATAN;
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-3)); return UNIT; // VoltAmpere (kg*m^2/s^3)
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 96 "QuantityParser.l"
|
||||
return ATAN2;
|
||||
#line 97 "QuantityParser.l"
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 97 "QuantityParser.l"
|
||||
return COS;
|
||||
#line 98 "QuantityParser.l"
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 98 "QuantityParser.l"
|
||||
return EXP;
|
||||
#line 99 "QuantityParser.l"
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 99 "QuantityParser.l"
|
||||
return ABS;
|
||||
#line 100 "QuantityParser.l"
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 100 "QuantityParser.l"
|
||||
return MOD;
|
||||
#line 101 "QuantityParser.l"
|
||||
yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 101 "QuantityParser.l"
|
||||
return LOG;
|
||||
#line 103 "QuantityParser.l"
|
||||
{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 102 "QuantityParser.l"
|
||||
return LOG10;
|
||||
#line 104 "QuantityParser.l"
|
||||
{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 103 "QuantityParser.l"
|
||||
return POW;
|
||||
#line 105 "QuantityParser.l"
|
||||
{yylval = atof( yytext ); return NUM;}
|
||||
YY_BREAK
|
||||
case 58:
|
||||
YY_RULE_SETUP
|
||||
#line 104 "QuantityParser.l"
|
||||
return SIN;
|
||||
#line 107 "QuantityParser.l"
|
||||
{yylval = M_PI ; return NUM;} // constant pi
|
||||
YY_BREAK
|
||||
case 59:
|
||||
YY_RULE_SETUP
|
||||
#line 105 "QuantityParser.l"
|
||||
return SINH;
|
||||
#line 108 "QuantityParser.l"
|
||||
{yylval = M_E ; return NUM;} // constant e
|
||||
YY_BREAK
|
||||
case 60:
|
||||
YY_RULE_SETUP
|
||||
#line 106 "QuantityParser.l"
|
||||
return TAN;
|
||||
#line 110 "QuantityParser.l"
|
||||
return ACOS;
|
||||
YY_BREAK
|
||||
case 61:
|
||||
YY_RULE_SETUP
|
||||
#line 107 "QuantityParser.l"
|
||||
return TANH;
|
||||
#line 111 "QuantityParser.l"
|
||||
return ASIN;
|
||||
YY_BREAK
|
||||
case 62:
|
||||
YY_RULE_SETUP
|
||||
#line 108 "QuantityParser.l"
|
||||
return SQRT;
|
||||
#line 112 "QuantityParser.l"
|
||||
return ATAN;
|
||||
YY_BREAK
|
||||
case 63:
|
||||
YY_RULE_SETUP
|
||||
#line 110 "QuantityParser.l"
|
||||
#line 113 "QuantityParser.l"
|
||||
return ATAN2;
|
||||
YY_BREAK
|
||||
case 64:
|
||||
YY_RULE_SETUP
|
||||
#line 114 "QuantityParser.l"
|
||||
return COS;
|
||||
YY_BREAK
|
||||
case 65:
|
||||
YY_RULE_SETUP
|
||||
#line 115 "QuantityParser.l"
|
||||
return EXP;
|
||||
YY_BREAK
|
||||
case 66:
|
||||
YY_RULE_SETUP
|
||||
#line 116 "QuantityParser.l"
|
||||
return ABS;
|
||||
YY_BREAK
|
||||
case 67:
|
||||
YY_RULE_SETUP
|
||||
#line 117 "QuantityParser.l"
|
||||
return MOD;
|
||||
YY_BREAK
|
||||
case 68:
|
||||
YY_RULE_SETUP
|
||||
#line 118 "QuantityParser.l"
|
||||
return LOG;
|
||||
YY_BREAK
|
||||
case 69:
|
||||
YY_RULE_SETUP
|
||||
#line 119 "QuantityParser.l"
|
||||
return LOG10;
|
||||
YY_BREAK
|
||||
case 70:
|
||||
YY_RULE_SETUP
|
||||
#line 120 "QuantityParser.l"
|
||||
return POW;
|
||||
YY_BREAK
|
||||
case 71:
|
||||
YY_RULE_SETUP
|
||||
#line 121 "QuantityParser.l"
|
||||
return SIN;
|
||||
YY_BREAK
|
||||
case 72:
|
||||
YY_RULE_SETUP
|
||||
#line 122 "QuantityParser.l"
|
||||
return SINH;
|
||||
YY_BREAK
|
||||
case 73:
|
||||
YY_RULE_SETUP
|
||||
#line 123 "QuantityParser.l"
|
||||
return TAN;
|
||||
YY_BREAK
|
||||
case 74:
|
||||
YY_RULE_SETUP
|
||||
#line 124 "QuantityParser.l"
|
||||
return TANH;
|
||||
YY_BREAK
|
||||
case 75:
|
||||
YY_RULE_SETUP
|
||||
#line 125 "QuantityParser.l"
|
||||
return SQRT;
|
||||
YY_BREAK
|
||||
case 76:
|
||||
YY_RULE_SETUP
|
||||
#line 127 "QuantityParser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1114 "QuantityLexer.c"
|
||||
#line 1197 "QuantityLexer.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(C_COMMENT):
|
||||
yyterminate();
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
|
@ -1403,7 +1487,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 >= 107 )
|
||||
if ( yy_current_state >= 126 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1431,11 +1515,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 >= 107 )
|
||||
if ( yy_current_state >= 126 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 106);
|
||||
yy_is_jam = (yy_current_state == 125);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -2068,4 +2152,4 @@ void yyfree (void * ptr )
|
|||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 110 "QuantityParser.l"
|
||||
#line 127 "QuantityParser.l"
|
||||
|
|
|
@ -65,12 +65,19 @@
|
|||
/* Line 371 of yacc.c */
|
||||
#line 6 "QuantityParser.y"
|
||||
|
||||
#define YYSTYPE Quantity
|
||||
#define yyparse Quantity_yyparse
|
||||
#define yyerror Quantity_yyerror
|
||||
#define YYSTYPE Quantity
|
||||
#define yyparse Quantity_yyparse
|
||||
#define yyerror Quantity_yyerror
|
||||
#ifndef DOUBLE_MAX
|
||||
# define DOUBLE_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
|
||||
#endif
|
||||
#ifndef DOUBLE_MIN
|
||||
# define DOUBLE_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
|
||||
#endif
|
||||
|
||||
|
||||
/* Line 371 of yacc.c */
|
||||
#line 74 "QuantityParser.c"
|
||||
#line 81 "QuantityParser.c"
|
||||
|
||||
# ifndef YY_NULL
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
|
@ -154,7 +161,7 @@ int yyparse ();
|
|||
/* Copy the second part of user declarations. */
|
||||
|
||||
/* Line 390 of yacc.c */
|
||||
#line 158 "QuantityParser.c"
|
||||
#line 165 "QuantityParser.c"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
|
@ -381,18 +388,18 @@ union yyalloc
|
|||
#endif /* !YYCOPY_NEEDED */
|
||||
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 43
|
||||
#define YYFINAL 45
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 259
|
||||
#define YYLAST 262
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 30
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 5
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 34
|
||||
#define YYNRULES 36
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 102
|
||||
#define YYNSTATES 106
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
|
@ -439,39 +446,39 @@ static const yytype_uint8 yytranslate[] =
|
|||
YYRHS. */
|
||||
static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
0, 0, 3, 5, 7, 9, 12, 14, 18, 22,
|
||||
26, 30, 33, 37, 41, 46, 51, 56, 63, 68,
|
||||
73, 80, 85, 90, 97, 102, 107, 112, 117, 122,
|
||||
127, 129, 133, 137, 141
|
||||
0, 0, 3, 4, 6, 8, 10, 13, 15, 19,
|
||||
23, 27, 31, 34, 38, 42, 47, 52, 57, 64,
|
||||
69, 74, 81, 86, 91, 98, 103, 108, 113, 118,
|
||||
123, 128, 130, 134, 138, 142, 146
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
31, 0, -1, 32, -1, 33, -1, 34, -1, 34,
|
||||
34, -1, 4, -1, 32, 22, 32, -1, 32, 21,
|
||||
32, -1, 32, 23, 32, -1, 32, 24, 32, -1,
|
||||
21, 32, -1, 32, 26, 32, -1, 27, 32, 28,
|
||||
-1, 5, 27, 32, 28, -1, 6, 27, 32, 28,
|
||||
-1, 7, 27, 32, 28, -1, 8, 27, 32, 29,
|
||||
32, 28, -1, 11, 27, 32, 28, -1, 10, 27,
|
||||
32, 28, -1, 12, 27, 32, 29, 32, 28, -1,
|
||||
13, 27, 32, 28, -1, 14, 27, 32, 28, -1,
|
||||
15, 27, 32, 29, 32, 28, -1, 16, 27, 32,
|
||||
28, -1, 17, 27, 32, 28, -1, 18, 27, 32,
|
||||
28, -1, 19, 27, 32, 28, -1, 20, 27, 32,
|
||||
28, -1, 9, 27, 32, 28, -1, 3, -1, 33,
|
||||
23, 33, -1, 33, 24, 33, -1, 33, 26, 32,
|
||||
-1, 32, 33, -1
|
||||
31, 0, -1, -1, 32, -1, 33, -1, 34, -1,
|
||||
34, 34, -1, 4, -1, 32, 22, 32, -1, 32,
|
||||
21, 32, -1, 32, 23, 32, -1, 32, 24, 32,
|
||||
-1, 21, 32, -1, 32, 26, 32, -1, 27, 32,
|
||||
28, -1, 5, 27, 32, 28, -1, 6, 27, 32,
|
||||
28, -1, 7, 27, 32, 28, -1, 8, 27, 32,
|
||||
29, 32, 28, -1, 11, 27, 32, 28, -1, 10,
|
||||
27, 32, 28, -1, 12, 27, 32, 29, 32, 28,
|
||||
-1, 13, 27, 32, 28, -1, 14, 27, 32, 28,
|
||||
-1, 15, 27, 32, 29, 32, 28, -1, 16, 27,
|
||||
32, 28, -1, 17, 27, 32, 28, -1, 18, 27,
|
||||
32, 28, -1, 19, 27, 32, 28, -1, 20, 27,
|
||||
32, 28, -1, 9, 27, 32, 28, -1, 3, -1,
|
||||
33, 23, 33, -1, 33, 24, 33, -1, 33, 26,
|
||||
32, -1, 27, 33, 28, -1, 32, 33, -1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 26, 26, 27, 28, 29, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
|
||||
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
|
||||
57, 58, 59, 60, 62
|
||||
0, 33, 33, 34, 35, 36, 37, 39, 40, 41,
|
||||
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
||||
62, 65, 66, 67, 68, 69, 71
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -501,19 +508,19 @@ static const yytype_uint16 yytoknum[] =
|
|||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 30, 31, 31, 31, 31, 32, 32, 32, 32,
|
||||
0, 30, 31, 31, 31, 31, 31, 32, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
33, 33, 33, 33, 34
|
||||
32, 33, 33, 33, 33, 33, 34
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 1, 1, 1, 2, 1, 3, 3, 3,
|
||||
3, 2, 3, 3, 4, 4, 4, 6, 4, 4,
|
||||
6, 4, 4, 6, 4, 4, 4, 4, 4, 4,
|
||||
1, 3, 3, 3, 2
|
||||
0, 2, 0, 1, 1, 1, 2, 1, 3, 3,
|
||||
3, 3, 2, 3, 3, 4, 4, 4, 6, 4,
|
||||
4, 6, 4, 4, 6, 4, 4, 4, 4, 4,
|
||||
4, 1, 3, 3, 3, 3, 2
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
||||
|
@ -521,47 +528,47 @@ static const yytype_uint8 yyr2[] =
|
|||
means the default is an error. */
|
||||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
0, 30, 6, 0, 0, 0, 0, 0, 0, 0,
|
||||
2, 31, 7, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 2, 3, 4, 0, 0, 0, 0, 0,
|
||||
0, 0, 3, 4, 5, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 11, 0, 1, 0, 0, 0, 0, 0, 34,
|
||||
0, 0, 0, 0, 5, 0, 0, 0, 0, 0,
|
||||
0, 0, 12, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 36, 0, 0, 0, 0, 6, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 13, 8, 7, 9, 10, 12, 31, 32, 33,
|
||||
14, 15, 16, 0, 29, 19, 18, 0, 21, 22,
|
||||
0, 24, 25, 26, 27, 28, 0, 0, 0, 17,
|
||||
20, 23
|
||||
0, 0, 0, 0, 14, 35, 9, 8, 10, 11,
|
||||
13, 32, 33, 34, 15, 16, 17, 0, 30, 20,
|
||||
19, 0, 22, 23, 0, 25, 26, 27, 28, 29,
|
||||
0, 0, 0, 18, 21, 24
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
-1, 21, 22, 49, 24
|
||||
-1, 21, 43, 44, 24
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -25
|
||||
#define YYPACT_NINF -23
|
||||
static const yytype_int16 yypact[] =
|
||||
{
|
||||
69, -25, -25, -24, -23, -5, -4, -3, 3, 4,
|
||||
5, 27, 28, 29, 35, 40, 72, 78, 86, 30,
|
||||
30, 70, 88, 229, 30, 30, 30, 30, 30, 30,
|
||||
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
||||
30, 81, 80, -25, 30, 30, 30, 30, 30, 229,
|
||||
95, 95, 30, 88, -25, 103, 111, 119, 37, 127,
|
||||
135, 143, 71, 151, 159, 94, 167, 175, 183, 191,
|
||||
199, -25, 233, 233, 81, 81, 81, 93, 93, 43,
|
||||
-25, -25, -25, 30, -25, -25, -25, 30, -25, -25,
|
||||
30, -25, -25, -25, -25, -25, 207, 215, 223, -25,
|
||||
-25, -25
|
||||
92, -23, -23, -22, -19, -13, -10, -5, -4, 16,
|
||||
17, 36, 39, 44, 54, 65, 89, 111, 124, 116,
|
||||
92, 7, 38, 91, 116, 116, 116, 116, 116, 116,
|
||||
116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
|
||||
116, 116, 31, 30, 62, -23, 116, 116, 116, 116,
|
||||
116, 18, 91, 18, 18, 116, 38, -23, 56, 118,
|
||||
126, -20, 134, 142, 150, -11, 158, 166, 46, 174,
|
||||
182, 190, 198, 206, -23, -23, 236, 236, 31, 31,
|
||||
31, 57, 57, 67, -23, -23, -23, 116, -23, -23,
|
||||
-23, 116, -23, -23, 116, -23, -23, -23, -23, -23,
|
||||
214, 222, 230, -23, -23, -23
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-25, -25, -19, 2, 97
|
||||
-23, -23, 0, 20, -8
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
|
@ -570,68 +577,70 @@ static const yytype_int8 yypgoto[] =
|
|||
#define YYTABLE_NINF -1
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
41, 42, 23, 25, 26, 53, 55, 56, 57, 58,
|
||||
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
|
||||
69, 70, 27, 28, 29, 72, 73, 74, 75, 76,
|
||||
30, 31, 32, 79, 2, 3, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 77, 78, 33, 34, 35, 20, 44, 45,
|
||||
46, 47, 36, 48, 96, 45, 83, 37, 97, 48,
|
||||
43, 98, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 1, 44, 45, 46, 47, 20, 48, 1, 38,
|
||||
87, 44, 45, 46, 47, 39, 48, 48, 71, 44,
|
||||
45, 46, 47, 40, 48, 44, 45, 46, 47, 52,
|
||||
48, 54, 0, 90, 44, 45, 46, 47, 0, 48,
|
||||
0, 80, 44, 45, 46, 47, 0, 48, 0, 81,
|
||||
44, 45, 46, 47, 0, 48, 0, 82, 44, 45,
|
||||
46, 47, 0, 48, 0, 84, 44, 45, 46, 47,
|
||||
0, 48, 0, 85, 44, 45, 46, 47, 0, 48,
|
||||
0, 86, 44, 45, 46, 47, 0, 48, 0, 88,
|
||||
44, 45, 46, 47, 0, 48, 0, 89, 44, 45,
|
||||
46, 47, 0, 48, 0, 91, 44, 45, 46, 47,
|
||||
0, 48, 0, 92, 44, 45, 46, 47, 0, 48,
|
||||
0, 93, 44, 45, 46, 47, 0, 48, 0, 94,
|
||||
44, 45, 46, 47, 0, 48, 0, 95, 44, 45,
|
||||
46, 47, 0, 48, 0, 99, 44, 45, 46, 47,
|
||||
0, 48, 0, 100, 44, 45, 46, 47, 0, 48,
|
||||
0, 101, 50, 51, 0, 52, 46, 47, 0, 48
|
||||
22, 46, 47, 48, 49, 25, 50, 45, 26, 87,
|
||||
46, 47, 48, 49, 27, 50, 57, 28, 91, 42,
|
||||
23, 1, 29, 30, 56, 58, 59, 60, 61, 62,
|
||||
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
|
||||
73, 1, 52, 31, 32, 51, 76, 77, 78, 79,
|
||||
80, 46, 47, 48, 49, 83, 50, 50, 74, 46,
|
||||
47, 48, 49, 33, 50, 51, 34, 46, 47, 48,
|
||||
49, 35, 50, 81, 82, 94, 52, 46, 47, 48,
|
||||
49, 36, 50, 55, 84, 53, 54, 100, 55, 47,
|
||||
75, 101, 37, 50, 102, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 53, 54, 38, 55, 0, 20,
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
12, 13, 14, 15, 16, 17, 18, 19, 39, 46,
|
||||
47, 48, 49, 41, 50, 0, 85, 46, 47, 48,
|
||||
49, 40, 50, 0, 86, 46, 47, 48, 49, 0,
|
||||
50, 0, 88, 46, 47, 48, 49, 0, 50, 0,
|
||||
89, 46, 47, 48, 49, 0, 50, 0, 90, 46,
|
||||
47, 48, 49, 0, 50, 0, 92, 46, 47, 48,
|
||||
49, 0, 50, 0, 93, 46, 47, 48, 49, 0,
|
||||
50, 0, 95, 46, 47, 48, 49, 0, 50, 0,
|
||||
96, 46, 47, 48, 49, 0, 50, 0, 97, 46,
|
||||
47, 48, 49, 0, 50, 0, 98, 46, 47, 48,
|
||||
49, 0, 50, 0, 99, 46, 47, 48, 49, 0,
|
||||
50, 0, 103, 46, 47, 48, 49, 0, 50, 0,
|
||||
104, 46, 47, 48, 49, 0, 50, 0, 105, 48,
|
||||
49, 0, 50
|
||||
};
|
||||
|
||||
#define yypact_value_is_default(Yystate) \
|
||||
(!!((Yystate) == (-25)))
|
||||
(!!((Yystate) == (-23)))
|
||||
|
||||
#define yytable_value_is_error(Yytable_value) \
|
||||
YYID (0)
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
19, 20, 0, 27, 27, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
||||
39, 40, 27, 27, 27, 44, 45, 46, 47, 48,
|
||||
27, 27, 27, 52, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 50, 51, 27, 27, 27, 27, 21, 22,
|
||||
23, 24, 27, 26, 83, 22, 29, 27, 87, 26,
|
||||
0, 90, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 3, 21, 22, 23, 24, 27, 26, 3, 27,
|
||||
29, 21, 22, 23, 24, 27, 26, 26, 28, 21,
|
||||
22, 23, 24, 27, 26, 21, 22, 23, 24, 26,
|
||||
26, 24, -1, 29, 21, 22, 23, 24, -1, 26,
|
||||
-1, 28, 21, 22, 23, 24, -1, 26, -1, 28,
|
||||
21, 22, 23, 24, -1, 26, -1, 28, 21, 22,
|
||||
23, 24, -1, 26, -1, 28, 21, 22, 23, 24,
|
||||
-1, 26, -1, 28, 21, 22, 23, 24, -1, 26,
|
||||
-1, 28, 21, 22, 23, 24, -1, 26, -1, 28,
|
||||
21, 22, 23, 24, -1, 26, -1, 28, 21, 22,
|
||||
23, 24, -1, 26, -1, 28, 21, 22, 23, 24,
|
||||
-1, 26, -1, 28, 21, 22, 23, 24, -1, 26,
|
||||
-1, 28, 21, 22, 23, 24, -1, 26, -1, 28,
|
||||
21, 22, 23, 24, -1, 26, -1, 28, 21, 22,
|
||||
23, 24, -1, 26, -1, 28, 21, 22, 23, 24,
|
||||
-1, 26, -1, 28, 21, 22, 23, 24, -1, 26,
|
||||
-1, 28, 23, 24, -1, 26, 23, 24, -1, 26
|
||||
0, 21, 22, 23, 24, 27, 26, 0, 27, 29,
|
||||
21, 22, 23, 24, 27, 26, 24, 27, 29, 19,
|
||||
0, 3, 27, 27, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||
40, 3, 22, 27, 27, 27, 46, 47, 48, 49,
|
||||
50, 21, 22, 23, 24, 55, 26, 26, 28, 21,
|
||||
22, 23, 24, 27, 26, 27, 27, 21, 22, 23,
|
||||
24, 27, 26, 53, 54, 29, 56, 21, 22, 23,
|
||||
24, 27, 26, 26, 28, 23, 24, 87, 26, 22,
|
||||
28, 91, 27, 26, 94, 3, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 20, 21, 23, 24, 27, 26, -1, 27,
|
||||
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 27, 21,
|
||||
22, 23, 24, 27, 26, -1, 28, 21, 22, 23,
|
||||
24, 27, 26, -1, 28, 21, 22, 23, 24, -1,
|
||||
26, -1, 28, 21, 22, 23, 24, -1, 26, -1,
|
||||
28, 21, 22, 23, 24, -1, 26, -1, 28, 21,
|
||||
22, 23, 24, -1, 26, -1, 28, 21, 22, 23,
|
||||
24, -1, 26, -1, 28, 21, 22, 23, 24, -1,
|
||||
26, -1, 28, 21, 22, 23, 24, -1, 26, -1,
|
||||
28, 21, 22, 23, 24, -1, 26, -1, 28, 21,
|
||||
22, 23, 24, -1, 26, -1, 28, 21, 22, 23,
|
||||
24, -1, 26, -1, 28, 21, 22, 23, 24, -1,
|
||||
26, -1, 28, 21, 22, 23, 24, -1, 26, -1,
|
||||
28, 21, 22, 23, 24, -1, 26, -1, 28, 23,
|
||||
24, -1, 26
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
|
@ -642,13 +651,13 @@ static const yytype_uint8 yystos[] =
|
|||
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
27, 31, 32, 33, 34, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 32, 32, 0, 21, 22, 23, 24, 26, 33,
|
||||
23, 24, 26, 32, 34, 32, 32, 32, 32, 32,
|
||||
27, 27, 32, 32, 33, 0, 21, 22, 23, 24,
|
||||
26, 27, 33, 23, 24, 26, 32, 34, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 28, 32, 32, 32, 32, 32, 33, 33, 32,
|
||||
28, 28, 28, 29, 28, 28, 28, 29, 28, 28,
|
||||
29, 28, 28, 28, 28, 28, 32, 32, 32, 28,
|
||||
28, 28
|
||||
32, 32, 32, 32, 28, 28, 32, 32, 32, 32,
|
||||
32, 33, 33, 32, 28, 28, 28, 29, 28, 28,
|
||||
28, 29, 28, 28, 29, 28, 28, 28, 28, 28,
|
||||
32, 32, 32, 28, 28, 28
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
|
@ -1441,205 +1450,217 @@ yyreduce:
|
|||
{
|
||||
case 2:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 26 "QuantityParser.y"
|
||||
{ QuantResult = (yyvsp[(1) - (1)]) ; }
|
||||
#line 33 "QuantityParser.y"
|
||||
{ QuantResult = Quantity(DOUBLE_MIN); /* empty input */ }
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 27 "QuantityParser.y"
|
||||
#line 34 "QuantityParser.y"
|
||||
{ QuantResult = (yyvsp[(1) - (1)]) ; }
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 28 "QuantityParser.y"
|
||||
#line 35 "QuantityParser.y"
|
||||
{ QuantResult = (yyvsp[(1) - (1)]) ; }
|
||||
break;
|
||||
|
||||
case 5:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 29 "QuantityParser.y"
|
||||
{ QuantResult = (yyvsp[(1) - (2)]) + (yyvsp[(2) - (2)]); }
|
||||
#line 36 "QuantityParser.y"
|
||||
{ QuantResult = (yyvsp[(1) - (1)]) ; }
|
||||
break;
|
||||
|
||||
case 6:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 31 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (1)]); }
|
||||
#line 37 "QuantityParser.y"
|
||||
{ QuantResult = (yyvsp[(1) - (2)]) + (yyvsp[(2) - (2)]); }
|
||||
break;
|
||||
|
||||
case 7:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 32 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() + (yyvsp[(3) - (3)]).getValue(); }
|
||||
#line 39 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (1)]); }
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 33 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() - (yyvsp[(3) - (3)]).getValue(); }
|
||||
#line 40 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() + (yyvsp[(3) - (3)]).getValue(); }
|
||||
break;
|
||||
|
||||
case 9:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 34 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() * (yyvsp[(3) - (3)]).getValue(); }
|
||||
#line 41 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() - (yyvsp[(3) - (3)]).getValue(); }
|
||||
break;
|
||||
|
||||
case 10:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 35 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() / (yyvsp[(3) - (3)]).getValue(); }
|
||||
#line 42 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() * (yyvsp[(3) - (3)]).getValue(); }
|
||||
break;
|
||||
|
||||
case 11:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 36 "QuantityParser.y"
|
||||
{ (yyval) = -(yyvsp[(2) - (2)]).getValue(); }
|
||||
#line 43 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).getValue() / (yyvsp[(3) - (3)]).getValue(); }
|
||||
break;
|
||||
|
||||
case 12:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 37 "QuantityParser.y"
|
||||
{ (yyval) = pow ((yyvsp[(1) - (3)]).getValue(), (yyvsp[(3) - (3)]).getValue());}
|
||||
#line 44 "QuantityParser.y"
|
||||
{ (yyval) = -(yyvsp[(2) - (2)]).getValue(); }
|
||||
break;
|
||||
|
||||
case 13:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 38 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(2) - (3)]); }
|
||||
#line 45 "QuantityParser.y"
|
||||
{ (yyval) = pow ((yyvsp[(1) - (3)]).getValue(), (yyvsp[(3) - (3)]).getValue());}
|
||||
break;
|
||||
|
||||
case 14:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 39 "QuantityParser.y"
|
||||
{ (yyval) = acos((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 46 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(2) - (3)]); }
|
||||
break;
|
||||
|
||||
case 15:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 40 "QuantityParser.y"
|
||||
{ (yyval) = asin((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 47 "QuantityParser.y"
|
||||
{ (yyval) = acos((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 16:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 41 "QuantityParser.y"
|
||||
{ (yyval) = atan((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 48 "QuantityParser.y"
|
||||
{ (yyval) = asin((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 17:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 42 "QuantityParser.y"
|
||||
{ (yyval) = atan2((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue());}
|
||||
#line 49 "QuantityParser.y"
|
||||
{ (yyval) = atan((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 18:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 43 "QuantityParser.y"
|
||||
{ (yyval) = fabs((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 50 "QuantityParser.y"
|
||||
{ (yyval) = atan2((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue());}
|
||||
break;
|
||||
|
||||
case 19:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 44 "QuantityParser.y"
|
||||
{ (yyval) = exp((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 51 "QuantityParser.y"
|
||||
{ (yyval) = fabs((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 20:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 45 "QuantityParser.y"
|
||||
{ (yyval) = fmod((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue()); }
|
||||
#line 52 "QuantityParser.y"
|
||||
{ (yyval) = exp((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 21:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 46 "QuantityParser.y"
|
||||
{ (yyval) = log((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 53 "QuantityParser.y"
|
||||
{ (yyval) = fmod((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 22:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 47 "QuantityParser.y"
|
||||
{ (yyval) = log10((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 54 "QuantityParser.y"
|
||||
{ (yyval) = log((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 23:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 48 "QuantityParser.y"
|
||||
{ (yyval) = pow((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue()); }
|
||||
#line 55 "QuantityParser.y"
|
||||
{ (yyval) = log10((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 24:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 49 "QuantityParser.y"
|
||||
{ (yyval) = sin((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 56 "QuantityParser.y"
|
||||
{ (yyval) = pow((yyvsp[(3) - (6)]).getValue(),(yyvsp[(5) - (6)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 25:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 50 "QuantityParser.y"
|
||||
{ (yyval) = sinh((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 57 "QuantityParser.y"
|
||||
{ (yyval) = sin((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 26:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 51 "QuantityParser.y"
|
||||
{ (yyval) = tan((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 58 "QuantityParser.y"
|
||||
{ (yyval) = sinh((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 27:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 52 "QuantityParser.y"
|
||||
{ (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 59 "QuantityParser.y"
|
||||
{ (yyval) = tan((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 28:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 53 "QuantityParser.y"
|
||||
#line 60 "QuantityParser.y"
|
||||
{ (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 29:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 54 "QuantityParser.y"
|
||||
{ (yyval) = cos((yyvsp[(3) - (4)]).getValue()); }
|
||||
#line 61 "QuantityParser.y"
|
||||
{ (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 30:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 57 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (1)]); }
|
||||
#line 62 "QuantityParser.y"
|
||||
{ (yyval) = cos((yyvsp[(3) - (4)]).getValue()); }
|
||||
break;
|
||||
|
||||
case 31:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 58 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]) * (yyvsp[(3) - (3)]); }
|
||||
#line 65 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (1)]); }
|
||||
break;
|
||||
|
||||
case 32:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 59 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]) / (yyvsp[(3) - (3)]); }
|
||||
#line 66 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]) * (yyvsp[(3) - (3)]); }
|
||||
break;
|
||||
|
||||
case 33:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 60 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).pow ((yyvsp[(3) - (3)])); }
|
||||
#line 67 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]) / (yyvsp[(3) - (3)]); }
|
||||
break;
|
||||
|
||||
case 34:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 62 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (2)])*(yyvsp[(2) - (2)]); }
|
||||
#line 68 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (3)]).pow ((yyvsp[(3) - (3)])); }
|
||||
break;
|
||||
|
||||
case 35:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 69 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(2) - (3)]); }
|
||||
break;
|
||||
|
||||
case 36:
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 71 "QuantityParser.y"
|
||||
{ (yyval) = (yyvsp[(1) - (2)])*(yyvsp[(2) - (2)]); }
|
||||
break;
|
||||
|
||||
|
||||
/* Line 1787 of yacc.c */
|
||||
#line 1643 "QuantityParser.c"
|
||||
#line 1664 "QuantityParser.c"
|
||||
default: break;
|
||||
}
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
|
@ -1871,5 +1892,5 @@ yyreturn:
|
|||
|
||||
|
||||
/* Line 2050 of yacc.c */
|
||||
#line 66 "QuantityParser.y"
|
||||
#line 75 "QuantityParser.y"
|
||||
|
||||
|
|
|
@ -23,9 +23,14 @@
|
|||
DIGIT [0-9]
|
||||
ID [a-z][a-z0-9]*
|
||||
|
||||
%x C_COMMENT
|
||||
|
||||
%% /*** Filter language Part ***/
|
||||
|
||||
"\[" { BEGIN(C_COMMENT); }
|
||||
<C_COMMENT>"\]" { BEGIN(INITIAL); }
|
||||
<C_COMMENT>. { ;}
|
||||
|
||||
|
||||
[ \t] ;
|
||||
[\n]+ ;
|
||||
|
@ -41,47 +46,59 @@ ID [a-z][a-z0-9]*
|
|||
"km" yylval = Quantity(1.0e6 ,Unit(1)); return UNIT; // kilo meter
|
||||
"l" yylval = Quantity(1000000.0 ,Unit(3)); return UNIT; // Liter dm^3
|
||||
|
||||
"yg" yylval = Quantity(1.0e-9 ,Unit(0,1)); return UNIT; // milli gram
|
||||
"mg" yylval = Quantity(1.0e-6 ,Unit(0,1)); return UNIT; // milli gram
|
||||
"g" yylval = Quantity(1.0e-3 ,Unit(0,1)); return UNIT; // gram
|
||||
"kg" yylval = Quantity(1.0 ,Unit(0,1)); return UNIT; // kilo gram
|
||||
"t" yylval = Quantity(1000.0 ,Unit(0,1)); return UNIT; // ton
|
||||
"yg" yylval = Quantity(1.0e-9 ,Unit(0,1)); return UNIT; // milli gram
|
||||
"mg" yylval = Quantity(1.0e-6 ,Unit(0,1)); return UNIT; // milli gram
|
||||
"g" yylval = Quantity(1.0e-3 ,Unit(0,1)); return UNIT; // gram
|
||||
"kg" yylval = Quantity(1.0 ,Unit(0,1)); return UNIT; // kilo gram (internal standard for mass)
|
||||
"t" yylval = Quantity(1000.0 ,Unit(0,1)); return UNIT; // ton
|
||||
|
||||
"s" yylval = Quantity(1.0 ,Unit(0,0,1)); return UNIT; // second (internal standard time)
|
||||
"min" yylval = Quantity(60.0 ,Unit(0,0,1)); return UNIT; // minute
|
||||
"h" yylval = Quantity(3600.0 ,Unit(0,0,1)); return UNIT; // hour
|
||||
"s" yylval = Quantity(1.0 ,Unit(0,0,1)); return UNIT; // second (internal standard time)
|
||||
"min" yylval = Quantity(60.0 ,Unit(0,0,1)); return UNIT; // minute
|
||||
"h" yylval = Quantity(3600.0 ,Unit(0,0,1)); return UNIT; // hour
|
||||
|
||||
"A" yylval = Quantity(1.0 ,Unit(0,0,0,1)); return UNIT; // Ampere (internal standard electric current)
|
||||
"mA" yylval = Quantity(0.001 ,Unit(0,0,0,1)); return UNIT; // milli Ampere
|
||||
"kA" yylval = Quantity(1000.0 ,Unit(0,0,0,1)); return UNIT; // kilo Ampere
|
||||
"MA" yylval = Quantity(1.0e6 ,Unit(0,0,0,1)); return UNIT; // Mega Ampere
|
||||
"A" yylval = Quantity(1.0 ,Unit(0,0,0,1)); return UNIT; // Ampere (internal standard electric current)
|
||||
"mA" yylval = Quantity(0.001 ,Unit(0,0,0,1)); return UNIT; // milli Ampere
|
||||
"kA" yylval = Quantity(1000.0 ,Unit(0,0,0,1)); return UNIT; // kilo Ampere
|
||||
"MA" yylval = Quantity(1.0e6 ,Unit(0,0,0,1)); return UNIT; // Mega Ampere
|
||||
|
||||
"K" yylval = Quantity(1.0 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin (internal standard thermodynamic temperature)
|
||||
"mK" yylval = Quantity(0.001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
"yK" yylval = Quantity(0.000001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
"K" yylval = Quantity(1.0 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin (internal standard thermodynamic temperature)
|
||||
"mK" yylval = Quantity(0.001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
"yK" yylval = Quantity(0.000001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
|
||||
"mol" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,1)); return UNIT; // Mole (internal standard amount of substance)
|
||||
"mol" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,1)); return UNIT; // Mole (internal standard amount of substance)
|
||||
|
||||
"cd" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,1)); return UNIT; // Candela (internal standard luminous intensity)
|
||||
"cd" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,1)); return UNIT; // Candela (internal standard luminous intensity)
|
||||
|
||||
"deg" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // degree (internal standard angle)
|
||||
"rad" yylval = Quantity(180/M_PI ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // radian
|
||||
"gon" yylval = Quantity(360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // gon
|
||||
"deg" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // degree (internal standard angle)
|
||||
"rad" yylval = Quantity(180/M_PI ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // radian
|
||||
"gon" yylval = Quantity(360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // gon
|
||||
|
||||
"in" yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
"\"" yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
"fo" yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
"'" yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
"th" yylval = Quantity(0.0254 ,Unit(1)); return UNIT; // thou
|
||||
"yr" yylval = Quantity(914.4 ,Unit(1)); return UNIT; // yard
|
||||
"in" yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
"\"" yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
"fo" yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
"'" yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
"th" yylval = Quantity(0.0254 ,Unit(1)); return UNIT; // thou
|
||||
"yr" yylval = Quantity(914.4 ,Unit(1)); return UNIT; // yard
|
||||
|
||||
|
||||
"lb" yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // pound
|
||||
"oz" yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // ounce
|
||||
"st" yylval = Quantity(6.35029318 ,Unit(0,1)); return UNIT; // Stone
|
||||
"cwt" yylval = Quantity(50.80234544 ,Unit(0,1)); return UNIT; // hundredweights
|
||||
"lb" yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // pound
|
||||
"oz" yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // ounce
|
||||
"st" yylval = Quantity(6.35029318 ,Unit(0,1)); return UNIT; // Stone
|
||||
"cwt" yylval = Quantity(50.80234544 ,Unit(0,1)); return UNIT; // hundredweights
|
||||
|
||||
"N" yylval = Quantity(1000.0 ,Unit(1,1,-2)); return UNIT; // Newton (kg*m/s^2)
|
||||
|
||||
"Pa" yylval = Quantity(0.001 ,Unit(-1,1,-2)); return UNIT; // Pascal (kg/m*s^2)
|
||||
"psi" yylval = Quantity(0.145038 ,Unit(-1,1,-2)); return UNIT; // pounds/in^2
|
||||
|
||||
"W" yylval = Quantity(1e+6 ,Unit(2,1,-3)); return UNIT; // Watt (kg*m^2/s^3)
|
||||
"VA" yylval = Quantity(1e+6 ,Unit(2,1,-3)); return UNIT; // VoltAmpere (kg*m^2/s^3)
|
||||
|
||||
"J" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"Nm" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"VAs" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"CV" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"Ws" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
|
||||
{DIGIT}+["."","]{DIGIT}*[eE][-+]?[0-9]+ {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
{DIGIT}+["."","]{DIGIT}* {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
|
|
|
@ -4,9 +4,16 @@
|
|||
|
||||
/* Represents the many different ways we can access our data */
|
||||
%{
|
||||
#define YYSTYPE Quantity
|
||||
#define yyparse Quantity_yyparse
|
||||
#define yyerror Quantity_yyerror
|
||||
#define YYSTYPE Quantity
|
||||
#define yyparse Quantity_yyparse
|
||||
#define yyerror Quantity_yyerror
|
||||
#ifndef DOUBLE_MAX
|
||||
# define DOUBLE_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
|
||||
#endif
|
||||
#ifndef DOUBLE_MIN
|
||||
# define DOUBLE_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
/* Bison declarations. */
|
||||
|
@ -23,7 +30,8 @@
|
|||
|
||||
%%
|
||||
|
||||
input: num { QuantResult = $1 ; }
|
||||
input: { QuantResult = Quantity(DOUBLE_MIN); /* empty input */ }
|
||||
| num { QuantResult = $1 ; }
|
||||
| unit { QuantResult = $1 ; }
|
||||
| quantity { QuantResult = $1 ; }
|
||||
| quantity quantity { QuantResult = $1 + $2; }
|
||||
|
@ -58,8 +66,9 @@
|
|||
| unit '*' unit { $$ = $1 * $3; }
|
||||
| unit '/' unit { $$ = $1 / $3; }
|
||||
| unit '^' num { $$ = $1.pow ($3); }
|
||||
| '(' unit ')' { $$ = $2; }
|
||||
;
|
||||
quantity: num unit { $$ = $1*$2; }
|
||||
quantity: num unit { $$ = $1*$2; }
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -174,42 +174,59 @@ std::string Unit::getString(void) const
|
|||
Sig.AmountOfSubstance > 0 ||
|
||||
Sig.LuminoseIntensity > 0 ||
|
||||
Sig.Angle > 0 ){
|
||||
|
||||
bool mult = false;
|
||||
if(Sig.Length > 0){
|
||||
mult = true;
|
||||
ret << "mm";
|
||||
if(Sig.Length >1)
|
||||
ret << "^" << Sig.Length;
|
||||
}
|
||||
if(Sig.Mass > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "kg";
|
||||
if(Sig.Mass >1)
|
||||
ret << "^" << Sig.Mass;
|
||||
}
|
||||
if(Sig.Time > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "s";
|
||||
if(Sig.Time >1)
|
||||
ret << "^" << Sig.Time;
|
||||
}
|
||||
if(Sig.ElectricCurrent > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "A";
|
||||
if(Sig.ElectricCurrent >1)
|
||||
ret << "^" << Sig.ElectricCurrent;
|
||||
}
|
||||
if(Sig.ThermodynamicTemperature > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "K";
|
||||
if(Sig.ThermodynamicTemperature >1)
|
||||
ret << "^" << Sig.ThermodynamicTemperature;
|
||||
}
|
||||
if(Sig.AmountOfSubstance > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "mol";
|
||||
if(Sig.AmountOfSubstance >1)
|
||||
ret << "^" << Sig.AmountOfSubstance;
|
||||
}
|
||||
if(Sig.LuminoseIntensity > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "cd";
|
||||
if(Sig.LuminoseIntensity >1)
|
||||
ret << "^" << Sig.LuminoseIntensity;
|
||||
}
|
||||
if(Sig.Angle > 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "deg";
|
||||
if(Sig.Angle >1)
|
||||
ret << "^" << Sig.Angle;
|
||||
|
@ -227,46 +244,73 @@ std::string Unit::getString(void) const
|
|||
Sig.LuminoseIntensity < 0 ||
|
||||
Sig.Angle < 0 ){
|
||||
ret << "/";
|
||||
|
||||
int nnom = Sig.Length<0?1:2 +
|
||||
Sig.Mass<0?1:2 +
|
||||
Sig.Time<0?1:2 +
|
||||
Sig.ElectricCurrent<0?1:2 +
|
||||
Sig.ThermodynamicTemperature<0?1:2 +
|
||||
Sig.AmountOfSubstance<0?1:2 +
|
||||
Sig.LuminoseIntensity<0?1:2 +
|
||||
Sig.Angle<0?1:2 ;
|
||||
if (nnom > 1) ret << '(';
|
||||
bool mult=false;
|
||||
if(Sig.Length < 0){
|
||||
ret << "mm";
|
||||
mult = true;
|
||||
if(Sig.Length <-1)
|
||||
ret << "^" << abs(Sig.Length);
|
||||
}
|
||||
if(Sig.Mass < 0){
|
||||
ret << "kg";
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "kg";
|
||||
if(Sig.Mass <-1)
|
||||
ret << "^" << abs(Sig.Mass);
|
||||
}
|
||||
if(Sig.Time < 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "s";
|
||||
if(Sig.Time <-1)
|
||||
ret << "^" << abs(Sig.Time);
|
||||
}
|
||||
if(Sig.ElectricCurrent < 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "A";
|
||||
if(Sig.ElectricCurrent <-1)
|
||||
ret << "^" << abs(Sig.ElectricCurrent);
|
||||
}
|
||||
if(Sig.ThermodynamicTemperature < 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "K";
|
||||
if(Sig.ThermodynamicTemperature <-1)
|
||||
ret << "^" << abs(Sig.ThermodynamicTemperature);
|
||||
}
|
||||
if(Sig.AmountOfSubstance < 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "mol";
|
||||
if(Sig.AmountOfSubstance <-1)
|
||||
ret << "^" << abs(Sig.AmountOfSubstance);
|
||||
}
|
||||
if(Sig.LuminoseIntensity < 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "cd";
|
||||
if(Sig.LuminoseIntensity <-1)
|
||||
ret << "^" << abs(Sig.LuminoseIntensity);
|
||||
}
|
||||
if(Sig.Angle < 0){
|
||||
if(mult) ret<<'*';
|
||||
mult = true;
|
||||
ret << "deg";
|
||||
if(Sig.Angle <-1)
|
||||
ret << "^" << abs(Sig.Angle);
|
||||
}
|
||||
if (nnom > 1) ret << ')';
|
||||
}
|
||||
|
||||
return ret.str();
|
||||
|
|
|
@ -535,13 +535,13 @@ def mergeCells(objectslist):
|
|||
FreeCAD.ActiveDocument.recompute()
|
||||
return base
|
||||
|
||||
def download(url):
|
||||
def download(url,force=False):
|
||||
'''downloads a file from the given URL and saves it in the
|
||||
user directory. Returns the path to the saved file'''
|
||||
import urllib2, os
|
||||
name = url.split('/')[-1]
|
||||
filepath = os.path.join(FreeCAD.ConfigGet("UserAppData"),name)
|
||||
if os.path.exists(filepath):
|
||||
if os.path.exists(filepath) and not(force):
|
||||
return filepath
|
||||
try:
|
||||
FreeCAD.Console.PrintMessage("downloading "+url+" ...\n")
|
||||
|
|
|
@ -40,6 +40,7 @@ texts, colors,layers (from groups)
|
|||
'''
|
||||
|
||||
TEXTSCALING = 1.35 # scaling factor between autocad font sizes and coin font sizes
|
||||
CURRENTDXFLIB = 1.35 # the minimal version of the dxfLibrary needed to run
|
||||
|
||||
import sys, FreeCAD, os, Part, math, re, string, Mesh, Draft, DraftVecUtils, DraftGeomUtils
|
||||
from Draft import _Dimension, _ViewProviderDimension
|
||||
|
@ -50,24 +51,37 @@ try:
|
|||
draftui = FreeCADGui.draftToolBar
|
||||
except:
|
||||
draftui = None
|
||||
|
||||
files = ['dxfColorMap.py','dxfImportObjects.py','dxfLibrary.py','dxfReader.py']
|
||||
baseurl = 'https://raw.github.com/yorikvanhavre/Draft-dxf-importer/master/'
|
||||
for f in files:
|
||||
p = os.path.join(FreeCAD.ConfigGet("UserAppData"),f)
|
||||
if not os.path.exists(p):
|
||||
import ArchCommands
|
||||
|
||||
# check dxfLibrary version
|
||||
try:
|
||||
import dxfLibrary
|
||||
import dxfColorMap
|
||||
import dxfReader
|
||||
except:
|
||||
libsok = False
|
||||
FreeCAD.Console.PrintWarning("DXF libraries not found. Downloading...\n")
|
||||
else:
|
||||
if "v"+str(CURRENTDXFLIB) in dxfLibrary.__version__:
|
||||
libsok = True
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("DXF libraries need to be updated. Downloading...\n")
|
||||
libsok = False
|
||||
if not libsok:
|
||||
files = ['dxfColorMap.py','dxfImportObjects.py','dxfLibrary.py','dxfReader.py']
|
||||
baseurl = 'https://raw.github.com/yorikvanhavre/Draft-dxf-importer/master/'
|
||||
import ArchCommands
|
||||
for f in files:
|
||||
p = None
|
||||
p = ArchCommands.download(baseurl+f)
|
||||
p = ArchCommands.download(baseurl+f,force=True)
|
||||
if not p:
|
||||
FreeCAD.Console.PrintWarning("Download of dxf libraries failed. Please download them manually from https://github.com/yorikvanhavre/Draft-dxf-importer\n")
|
||||
|
||||
sys.path.append(FreeCAD.ConfigGet("UserAppData"))
|
||||
try:
|
||||
import dxfColorMap, dxfLibrary, dxfReader
|
||||
except:
|
||||
dxfReader = None
|
||||
dxfLibrary = None
|
||||
sys.path.append(FreeCAD.ConfigGet("UserAppData"))
|
||||
try:
|
||||
import dxfColorMap, dxfLibrary, dxfReader
|
||||
except:
|
||||
dxfReader = None
|
||||
dxfLibrary = None
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
pythonopen = open # to distinguish python built-in open function from the one declared here
|
||||
|
|
Loading…
Reference in New Issue
Block a user