From 5061da0712c43dcd07384e5275b2bcab76e8667e Mon Sep 17 00:00:00 2001 From: nancy.liao <huihui.liao@greentest.com.cn> Date: 周二, 22 4月 2025 18:59:59 +0800 Subject: [PATCH] 修改通用的版本 现阶段可用[:MEASure][:DC] --- libscpi/src/utils_private.h | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/libscpi/src/utils_private.h b/libscpi/src/utils_private.h index 165e23c..485ba16 100644 --- a/libscpi/src/utils_private.h +++ b/libscpi/src/utils_private.h @@ -42,6 +42,14 @@ #include<scpi/config.h> #include<scpi/types.h> + +#ifdef _WIN32 +#include <string.h> +#define strncasecmp _strnicmp +#else +#include <strings.h> +#endif + #ifdef __cplusplus extern "C" { #endif @@ -70,6 +78,17 @@ scpi_bool_t matchCommand(const char * pattern, const char * cmd, size_t len, int32_t *numbers, size_t numbers_len, int32_t default_value) LOCAL; scpi_bool_t composeCompoundCommand(const scpi_token_t * prev, scpi_token_t * current) LOCAL; + + + typedef struct { + bool is_variable; // 鏄惁涓哄彲鍙橀儴鍒嗭紙鐢╗]鎷捣鏉ョ殑锛� + char text[32]; // 娈靛唴瀹癸紙涓嶅寘鍚玔]锛� + } Segment; + + int parse_pattern(const char* pattern, Segment segments[], int max_segments); + bool match_command(const char* command, Segment segments[], int seg_count); + bool test_match(const char* pattern, const char* command); + #define SCPI_DTOSTRE_UPPERCASE 1 #define SCPI_DTOSTRE_ALWAYS_SIGN 2 #define SCPI_DTOSTRE_PLUS_SIGN 4 -- Gitblit v1.9.1