From c1e514e03ab7de4399ca12c9ae988b0707a99f8b Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周二, 15 9月 2015 03:13:35 +0800 Subject: [PATCH] Resolve #46: Detect missing parameter --- libscpi/src/expression.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libscpi/src/expression.c b/libscpi/src/expression.c index e0cae6c..833c7fd 100644 --- a/libscpi/src/expression.c +++ b/libscpi/src/expression.c @@ -62,7 +62,7 @@ { lex_state_t lex; int i; - scpi_expr_result_t res; + scpi_expr_result_t res = SCPI_EXPR_OK; if (!isRange || !valueFrom || !valueTo || !param) { SCPI_ErrorPush(context, SCPI_ERROR_SYSTEM_ERROR); @@ -85,7 +85,7 @@ } if (i != index) { if (!scpiLex_Comma(&lex, valueFrom)) { - res = SCPI_EXPR_ERROR; + res = scpiLex_IsEos(&lex) ? SCPI_EXPR_NO_MORE : SCPI_EXPR_ERROR; break; } } @@ -106,9 +106,10 @@ res = SCPI_ExprNumericListEntry(context, param, index, &range, ¶mFrom, ¶mTo); if (res == SCPI_EXPR_OK) { + *isRange = range; SCPI_ParamToInt(context, ¶mFrom, valueFrom); if (range) { - SCPI_ParamToInt(context, ¶mTo, valueFrom); + SCPI_ParamToInt(context, ¶mTo, valueTo); } } @@ -124,9 +125,10 @@ res = SCPI_ExprNumericListEntry(context, param, index, &range, ¶mFrom, ¶mTo); if (res == SCPI_EXPR_OK) { + *isRange = range; SCPI_ParamToDouble(context, ¶mFrom, valueFrom); if (range) { - SCPI_ParamToDouble(context, ¶mTo, valueFrom); + SCPI_ParamToDouble(context, ¶mTo, valueTo); } } -- Gitblit v1.9.1