From 31c1e390d2f7a5278e73491aee3568a6352482d1 Mon Sep 17 00:00:00 2001 From: nancy.liao <huihui.liao@greentest.com.cn> Date: 周三, 23 4月 2025 18:30:16 +0800 Subject: [PATCH] 完善了SCPI库对于<>内可选参数的解析 --- libscpi/src/utils_private.h | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) diff --git a/libscpi/src/utils_private.h b/libscpi/src/utils_private.h index fbc81e0..101bd71 100644 --- a/libscpi/src/utils_private.h +++ b/libscpi/src/utils_private.h @@ -79,18 +79,11 @@ scpi_bool_t composeCompoundCommand(const scpi_token_t * prev, scpi_token_t * current) LOCAL; -#define MAX_SEGMENTS 16 - -typedef struct { - bool is_variable; // 鏄惁涓哄彲鍙橀儴鍒嗭紙鐢╗]鎷捣鏉ョ殑锛� - bool is_required; // 鏄惁涓哄繀閫夐儴鍒嗭紙鐢�<>鎷捣鏉ョ殑锛� - bool is_option; // 鏄惁涓洪�夐」缁勯儴鍒嗭紙鐢▅鍒嗛殧锛� - char text[32]; // 娈靛唴瀹癸紙涓嶅寘鍚玔]鎴�<>锛� -} Segment; - -//鍖归厤[:MEASure][:VOLTage] -int parse_pattern(const char* pattern, Segment segments[], int max_segments); -bool match_command(const char* command, Segment segments[], int seg_count); +#define MAX_OPTION_LEN 256 +#define MAX_TAGS 10 +#define MAX_INPUT_LEN 256 +int extract_required_options(const char* pattern, char options[MAX_TAGS][MAX_OPTION_LEN][MAX_OPTION_LEN], int max_tags); +int match_input_to_options(const char* input, char options[MAX_TAGS][MAX_OPTION_LEN][MAX_OPTION_LEN], int num_tags); bool test_match(const char* pattern, const char* command); -- Gitblit v1.9.1