File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1878,6 +1878,14 @@ General Statements
18781878 (abbreviated ` W. ` ). If no type is
18791879 given, a word data is assumed.
18801880
1881+ If the name _ arr_ ends with a ` % `
1882+ symbol, this defines a floating point
1883+ array, in this case you can't specify
1884+ a type. It is important that at least
1885+ the first element of each line in the
1886+ data has a decimal point to force
1887+ storing the data as floating point.
1888+
18811889 If you end the ` DATA ` statement with
18821890 a comma, the following line must be
18831891 another ` DATA ` statement without the
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ void labelType::set_type(std::string str)
117117 type = 128 ;
118118 else if (str == " VT_ARRAY_BYTE" )
119119 type = 129 ;
120+ else if (str == " VT_ARRAY_FLOAT" )
121+ type = 130 ;
120122 else
121123 throw std::runtime_error (" invalid label type " + str);
122124}
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ FP_FUNCS:
8888ADR_EXPR:
8989 emit { TOK_VAR_LOAD, VT_ARRAY_FLOAT } E_VAR_SEARCH " %"
9090 emit { TOK_VAR_ADDR, VT_FLOAT } E_VAR_SEARCH " %"
91+ emit { TOK_NUM, VT_ARRAY_FLOAT } E_LABEL " %"
9192
9293INT_FUNCTIONS:
9394 " Int" FP_T_EXPR emit TOK_FP_INT
@@ -135,6 +136,16 @@ DIM_VAR_TYPE:<
135136DIM_VAR:
136137 emit { VT_FLOAT } E_VAR_SEARCH " %" E_PUSH_VAR
137138
139+ DATA_FLOATS: data number
140+ " ," E_NUMBER_FP DATA_FLOATS
141+ pass
142+
143+ DATA_TYPE:
144+ emit { VT_ARRAY_FLOAT } DATA_EXT_TYPE EQUAL E_LABEL_SET_TYPE E_NUMBER_FP DATA_FLOATS
145+
146+ DATA_VAR:
147+ E_LABEL_CREATE " %()" emit { TOK_JUMP } E_LABEL_DEF DATA_TYPE
148+
138149# Can create Float variables now
139150VAR_CREATE_TYPE:
140151 " %" emit VT_FLOAT
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ A%(2) = 0.03125
1616@SUM &A %, 3
1717? SUM%
1818
19+ DATA B%() = -0.125 , 0.0625 , 0.03125
20+ @SUM &B %, 3
21+ ? SUM%
22+
1923X%=1234.5
2024
2125@SUM &X %, 1
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ Name: Test for using address of floating point vars
22Test: run-fp
33Output:
440.21875
5+ -0.03125
561234.5
You can’t perform that action at this time.
0 commit comments