int NetGameEventValue::get_character() const { if (is_character()) return value_char; else throw Exception("NetGameEventValue is not a character"); }
bool is_self_evaluating(object *exp) { return is_boolean(exp) || is_fixnum(exp) || is_character(exp) || is_empty(exp) || is_string(exp); }
static inline bool is_self_evaluating(obj_t expr) { return is_boolean(expr) || is_fixnum(expr) || is_character(expr) || is_string(expr) ; }
static bool is_self_evaluating(obj_t *expr) { return (is_boolean(expr) || is_fixnum(expr) || is_character(expr) || is_string(expr) || is_vector(expr) || is_bytevector(expr)); }
void newState(QList<State> &states, const char *token, const char *lexem) { int state = 0; bool character = is_character(*lexem); while(*lexem) { int next = states[state].next[(int)*lexem]; if(!next) { next = states.size(); states += State(character?"CHARACTER":"INCOMPLETE"); states[state].next[(int)*lexem] = next; } state = next; ++lexem; character = character && is_character(*lexem); } states[state].token = token; }
bool is_leagl_package_name(const char* name) { if (name == NULL || name[0] == '\0') { return false; } const char *p = name; while (*p != '\0') { if (*p != '.' && !is_character(*p)) { return false; } p++; } return true; }
int get_key_words(string s, var_map* var_map_point, replace_map* replace_map_point) { int length = s.size(); char* key_words[6]; char* reg = "reg"; char* wire = "wire"; char* parameter = "parameter"; char* input = "input"; char* output = "output"; char* module = "module"; key_words[0] = reg; key_words[1] = wire; key_words[2] = parameter; key_words[3] = input; key_words[4] = output; key_words[5] = module; int position[6]; for (int i = 0; i < 5; i++) { position[i] = s.find(key_words[i]); } for (int i = 0; i < 5; i++) { if (position[i] != -1) { bool is_error = true; //default, error happens int end = position[i] + strlen(key_words[i]); if (position[i] == 0) //key_word begin at the s[0] { if (is_separator(s[end])) //a separator follows the key_word is_error = false; //key_word is ture } else if (is_separator(s[position[i] - 1])) //key_word begin in the middle of s { if (is_separator(s[end])) is_error = false; } if (is_error) { position[i] = -1; continue; //if error happens, continue } //get the var name int var_begin = 0; int var_end = 0; int temp = end; while (!is_character(s[temp])) temp++; var_begin = temp; while (!is_separator(s[temp])) temp++; var_end = temp; string varname = s.substr(var_begin, var_end - var_begin); string replace_name; while (1) { int varname_repeat_flag = 0; int replace_name_repeat_flag = 0; //rand replace_name if (i != 3 && i != 4) { rand_str(&replace_name); // replace_name = varname + "_edited"; //for test } else replace_name = varname; //travel through the map to find if replace_name or var_name is repeated replace_map::iterator itr1 = replace_map_point->begin(); for (; itr1 != replace_map_point->end(); ++itr1) { if (itr1->first == varname) //if the varname has appeared before varname_repeat_flag = 1; // else if (itr1->second == replace_name) //if the replace name is repeated // replace_name_repeat_flag = 1; } if (varname_repeat_flag) break; else if (replace_name_repeat_flag) continue; else { var_map_point->insert(var_map::value_type(varname, i)); replace_map_point->insert(replace_map::value_type(varname, replace_name)); cout << var_map_point->size() << endl; // if (replace_name.size() != 20 && i != 3 && i != 4) // cout << "error!" << endl; } } } } return 0; }
/**** Identification ****/ static inline int is_self_evaluating(object *exp) { return is_number(exp) || is_boolean(exp) || is_character(exp) || is_string(exp); }
object *is_char_proc(object *arguments) { return make_boolean(is_character(car(arguments))); }
object *is_char_proc(object *arguments) { return is_character(car(arguments)) ? true : false; }
// Match word boundary (zero-width lookahead). const char* word_boundary(const char* src) { return is_character(*src) || *src == '#' ? 0 : src; }
const char* character(const char* src) { return is_character(*src) ? src + 1 : 0; }