nancy.liao
5 天以前 31c1e390d2f7a5278e73491aee3568a6352482d1
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);