From bf8143c649292042de87c0cef63e6cb3c523388f Mon Sep 17 00:00:00 2001
From: nancy.liao <huihui.liao@greentest.com.cn>
Date: 周四, 08 5月 2025 16:40:10 +0800
Subject: [PATCH] 修改了一些警告信息

---
 libscpi/src/parser.c |   30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/libscpi/src/parser.c b/libscpi/src/parser.c
index e51eb7a..8530871 100644
--- a/libscpi/src/parser.c
+++ b/libscpi/src/parser.c
@@ -37,6 +37,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include "scpi/externinterface.h"
 
 #include "scpi/config.h"
 #include "scpi/parser.h"
@@ -45,7 +46,7 @@
 #include "scpi/error.h"
 #include "scpi/constants.h"
 #include "scpi/utils.h"
-
+#include "scpi/externinterface.h"
 /**
  * Write data to SCPI output
  * @param context
@@ -126,10 +127,9 @@
  */
 
  //璐熷懡浠ゅ洖璋冪殑鎵ц銆佸弬鏁板鐞嗗拰閿欒绠$悊
-static scpi_bool_t processCommand(scpi_t * context) {
-    //杩欎釜鍦版柟淇敼涓� 璇籧omdlist->pattern
+static scpi_bool_t processCommand(scpi_t * context)
+{
     const scpi_command_t * cmd = context->param_list.cmd;
-    //const scpi_command_t * cmd = context->cmdlist->pattern;
     lex_state_t * state = &context->param_list.lex_state;
     scpi_bool_t result = TRUE;
     // 鍏堟娴嬫槸鍚︿负鏌ヨ鍛戒护(浠�?缁撳熬)
@@ -180,24 +180,20 @@
  * @param context
  * @result TRUE if context->paramlist is filled with correct values
  */
-scpi_bool_t findCommandHeader(scpi_t * context, const char * header, int len)
+scpi_bool_t findCommandHeader(scpi_t * context, const char * header,int len)
 {
+    //鍙傛暟宸茬粡鍦ㄥ墠闈㈤儴鍒嗚В鏋愬畬鎴�,鍖归厤鍛戒护鏃跺氨涓嶅啀闇�瑕佸弬鏁伴儴鍒� 灏嗗懡浠ゆ媶闄ゅ嵆鍙�
+    char *header_copy = strdup(header);
+    char *first_part = strtok(header_copy, " ");
 
-    int32_t i;
-    const scpi_command_t * cmd = NULL;
-    for (i = 0; i<context->cmdlistSize; i++) {
-        cmd = &context->cmdlist[i];
-
-        bool result =test_match(cmd->pattern, header);
-        if(result)
+    for(int i=0;i<get_pattern_count();i++)
+    {
+        if( match_segments_global(first_part,i) )
         {
-             context->param_list.cmd = &context->cmdlist[i];
+            context->param_list.cmd = &context->cmdlist[i];
+            free(header_copy);
             return TRUE;
         }
-        // if (matchCommand(cmd->pattern, header, len, NULL, 0, 0)) {
-        //     context->param_list.cmd = cmd;
-        //     return TRUE;
-        // }
     }
     context->SCPIerror = RETURN_NotFind;
     return FALSE;

--
Gitblit v1.9.1