! \brief Reads a slash and the second argument to the ATAN function, starting at the index given by the pos offset. Then it computes the value of the ATAN operation applied to the two arguments. \param line pointer to RS274/NGC code (block). \param pos offset into line where expression starts. \param value pointer to float where result is to be stored. \returns #Error::Ok enum value if processed
| 621 | \returns #Error::Ok enum value if processed without error, appropriate \ref Error enum value if not. |
| 622 | */ |
| 623 | static Error read_atan(const char* line, size_t& pos, float& value) { |
| 624 | float argument2; |
| 625 | |
| 626 | if (line[pos] != '/') |
| 627 | return Error::ExpressionSyntaxError; // Slash missing after first ATAN argument |
| 628 | |
| 629 | pos++; |
| 630 | |
| 631 | if (line[pos] != '[') |
| 632 | return Error::ExpressionSyntaxError; // Left bracket missing after slash with ATAN; |
| 633 | |
| 634 | Error status; |
| 635 | |
| 636 | if ((status = expression(line, pos, argument2)) == Error::Ok) |
| 637 | value = atan2f(value, argument2) * DEGRAD; /* value in radians, convert to degrees */ |
| 638 | |
| 639 | return status; |
| 640 | } |
| 641 | |
| 642 | /*! \brief Reads the value out of an unary operation of the line, starting at the |
| 643 | index given by the pos offset. The ATAN operation is |
no test coverage detected