From 1e139e410744eb791486dcee0ed4b1eebdf9a515 Mon Sep 17 00:00:00 2001 From: nancy.liao <huihui.liao@greentest.com.cn> Date: 周四, 24 4月 2025 09:32:54 +0800 Subject: [PATCH] 提交修改 --- libscpi/src/parser.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libscpi/src/parser.c b/libscpi/src/parser.c index ce17163..e51eb7a 100644 --- a/libscpi/src/parser.c +++ b/libscpi/src/parser.c @@ -180,16 +180,24 @@ * @param context * @result TRUE if context->paramlist is filled with correct values */ -static scpi_bool_t findCommandHeader(scpi_t * context, const char * header, int len) { - int32_t i; - const scpi_command_t * cmd; +scpi_bool_t findCommandHeader(scpi_t * context, const char * header, int len) +{ - for (i = 0; context->cmdlist[i].pattern != NULL; i++) { + int32_t i; + const scpi_command_t * cmd = NULL; + for (i = 0; i<context->cmdlistSize; i++) { cmd = &context->cmdlist[i]; - if (matchCommand(cmd->pattern, header, len, NULL, 0, 0)) { - context->param_list.cmd = cmd; + + bool result =test_match(cmd->pattern, header); + if(result) + { + context->param_list.cmd = &context->cmdlist[i]; return TRUE; } + // if (matchCommand(cmd->pattern, header, len, NULL, 0, 0)) { + // context->param_list.cmd = cmd; + // return TRUE; + // } } context->SCPIerror = RETURN_NotFind; return FALSE; @@ -316,6 +324,8 @@ context->buffer.data = input_buffer; context->buffer.length = input_buffer_length; context->buffer.position = 0; + + SCPI_ErrorInit(context, error_queue_data, error_queue_size); } -- Gitblit v1.9.1