| | |
| | | */ |
| | | |
| | | //负命令回调的执行、参数处理和错误管理 |
| | | static scpi_bool_t processCommand(scpi_t * context) { |
| | | //这个地方修改为 读comdlist->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; |
| | | // 先检测是否为查询命令(以?结尾) |
| | |
| | | */ |
| | | scpi_bool_t findCommandHeader(scpi_t * context, const char * header, int len) |
| | | { |
| | | //参数已经在前面部分解析完成,匹配命令时就不再需要参数部分 将命令拆除即可 |
| | | char *header_copy = strdup(header); |
| | | char *first_part = strtok(header_copy, " "); |
| | | |
| | | for(int i=0;i<get_pattern_count();i++) |
| | | { |
| | | if( match_segments_global(header,i) ) |
| | | if( match_segments_global(first_part,i) ) |
| | | { |
| | | context->param_list.cmd = &context->cmdlist[i]; |
| | | free(header_copy); |
| | | return TRUE; |
| | | } |
| | | } |