📄 pfil_token_2.cc
字号:
// file: pfil_token_2.cc//// isip include files//#include "param_file.h"#include "param_file_constants.h"// system include files//#include <stdlib.h>#include <string.h>// method: compact_tokens_cc//// arguments:// char_1** values: (input/output) array of strings of values// int_4& num_values: (output) size of array of values// char_1* symbols_a: (input) non_word symbols//// return: a logical_1 indicating status//// this method removes the redundant braces//logical_1 Param_file::compact_tokens_cc(char_1** values_a, int_4& num_values_a, char_1* symbols_a) { // check arguments, allocate values_a if necessary // if (values_a == (char_1**)NULL) { error_handler_cc ((char_1*) "compact_token_cc", (char_1*) "no tokens to be compacted"); } int_4 state = 0; // loop all the tokens using state machine // for (int_4 i = 0; i< num_values_a; ) { if (state == 0) { if (strcmp((char*)values_a[i], PFIL_BRACE_START) == 0) { state = 1; } i++; } if (state == 1) { // if the next value is a word // if (strpbrk((char*)symbols_a, (char*)values_a[i]) == (char*)NULL) { state = 2; } else { state = 0; } i++; } if (state == 2) { if (strcmp((char*)values_a[i], PFIL_BRACE_CLOSE) == 0) { // remove the () // strcpy((char*)values_a[i-2], PFIL_EMPTY); strcpy((char*)values_a[i], PFIL_EMPTY); } state = 0; i++; } } // exit gracefully // return ISIP_TRUE; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -