t_shape *is_valid_shape(char *s) { t_shape *tmp; tmp = NULL; if ((tmp = is_i(s)) != NULL) return (tmp); if ((tmp = is_o(s)) != NULL) return (tmp); if ((tmp = is_t(s)) != NULL) return (tmp); if ((tmp = is_l(s)) != NULL) return (tmp); if ((tmp = is_j(s)) != NULL) return (tmp); if ((tmp = is_z(s)) != NULL) return (tmp); if ((tmp = is_s(s)) != NULL) return (tmp); return (NULL); }
//====================================================================== bool sccan_point_pair_handler:: is_string_a_sccan_run_config(std::string line){ if(verbosity){ std::cout<<"sccan_point_pair_handler -> "; std::cout<<"is_string_a_sccan_run_config() -> line: "; std::cout<<line<<std::endl; } // use DEAs for the std::string control // find enum TokenT{ digit, point, underscore, char_c, char_f, char_g, char_s, char_a, char_n, ERR }; int GetState[][23] ={ //dig point under c f g s a n { 1, -1, -1, -1, -1, -1, -1, -1, -1 }, //0 d { 2, -1, -1, -1, -1, -1, -1, -1, -1 }, //1 d { 3, -1, -1, -1, -1, -1, -1, -1, -1 }, //2 d { 4, -1, -1, -1, -1, -1, -1, -1, -1 }, //3 d { 5, -1, -1, -1, -1, -1, -1, -1, -1 }, //4 d { 6, -1, -1, -1, -1, -1, -1, -1, -1 }, //5 d { 7, -1, -1, -1, -1, -1, -1, -1, -1 }, //6 d { 8, -1, -1, -1, -1, -1, -1, -1, -1 }, //7 d { -1, -1, 9, -1, -1, -1, -1, -1, -1 }, //8 _ { 10, -1, -1, -1, -1, -1, -1, -1, -1 }, //9 d { 11, -1, -1, -1, -1, -1, -1, -1, -1 }, //10 d { 12, -1, -1, -1, -1, -1, -1, -1, -1 }, //11 d { 13, -1, -1, -1, -1, -1, -1, -1, -1 }, //12 d { -1, -1, 14, -1, -1, -1, -1, -1, -1 }, //13 _ { -1, -1, -1, -1, -1, -1, 15, -1, -1 }, //14 s { -1, -1, -1, 16, -1, -1, -1, -1, -1 }, //15 c { -1, -1, -1, 17, -1, -1, -1, -1, -1 }, //16 c { -1, -1, -1, -1, -1, -1, -1, 18, -1 }, //17 a { -1, -1, -1, -1, -1, -1, -1, -1, 19 }, //18 n { -1, -1, 20, -1, -1, -1, -1, -1, -1 }, //19 _ { 20, 21, -1, -1, -1, -1, -1, -1, -1 }, //20 d { -1, -1, -1, 22, -1, -1, -1, -1, -1 }, //21 . { -1, -1, -1, -1, 23, -1, -1, -1, -1 }, //22 c { -1, -1, -1, -1, -1, 24, -1, -1, -1 }, //23 f //24 g }; //for( int i=0; i<11;i++){std::cout<<"("<<i<<")"<<GetState[26][i]<<", ";} //std::cout<<std::endl; std::string ID; std::string tilt_x; std::string tilt_y; std::string tilt_z; std::string str_vec2D_x; std::string str_vec2D_y; int int_vec2D_count = 0; int state = 0; int char_number = 0; //std::cout<<"str laenge: "<<line.size()<<std::endl; while(state != -1 && char_number<line.size()){ TokenT token = ERR; char s = line.at( char_number); if(is_c(s)) token = char_c; if(is_f(s)) token = char_f; if(is_g(s)) token = char_g; if(is_s(s)) token = char_s; if(is_a(s)) token = char_a; if(is_n(s)) token = char_n; if(isdigit(s)) token = digit; //std::cout<<char(s)<<"==digit"<<std::endl;} if(is_point(s)) token = point; if(is_underscore(s)) token = underscore; //std::cout<<"check"<<char_number<<": "; //std::cout<<char(s)<<" state: "<<state<<" token: "<<token<<std::endl; state = (token == ERR) ? :GetState[state][token]; char_number ++; } if(state==24){return true;}else{return false;}; }