Fixed incorrect implementation of EXISTS function. Ref. issue #527.

Added missing clear of parser tool change state when cycle start signal is asserted.
Affects tool change mode 'Normal' ($341=0).
This commit is contained in:
Terje Io
2024-06-04 12:57:17 +07:00
parent f8e0150c77
commit 0a86e57ddc
6 changed files with 44 additions and 20 deletions

View File

@@ -53,7 +53,7 @@ typedef enum {
NGCBinaryOp_LE,
NGCBinaryOp_GE,
NGCBinaryOp_GT,
NGCBinaryOp_RelationalLast = NGCBinaryOp_GT,
NGCBinaryOp_RelationalLast = NGCBinaryOp_GT
} ngc_binary_op_t;
typedef enum {
@@ -70,7 +70,7 @@ typedef enum {
NGCUnaryOp_SIN,
NGCUnaryOp_SQRT,
NGCUnaryOp_TAN,
NGCUnaryOp_Exists, // Not implemented
NGCUnaryOp_Exists
} ngc_unary_op_t;
/*! \brief Executes the operations: /, MOD, ** (POW), *.
@@ -675,19 +675,22 @@ static status_code_t read_unary (char *line, uint_fast8_t *pos, float *value)
else {
if (operation == NGCUnaryOp_Exists) {
if(operation == NGCUnaryOp_Exists) {
char *arg = &line[++(*pos)], *s;
char *arg = &line[++(*pos)], *s = NULL;
s = arg;
while(*s && *s != ']')
s++;
if(*arg == '#' && *(arg + 1) == '<') {
arg += 2;
s = arg;
while(*s && *s != ']')
s++;
}
if(*s == ']') {
*s = '\0';
if(s && *s == ']' && *(s - 1) == '>') {
*(s - 1) = '\0';
*value = ngc_named_param_exists(arg) ? 1.0f : 0.0f;
*s = ']';
*pos = *pos + s - arg + 1;
*(s - 1) = '>';
*pos = *pos + s - arg + 3;
} else
status = Status_ExpressionSyntaxError;