def findoldincludeguardset(path,filename): return_value = [] full_file_name = path + filename file_pointer = open(full_file_name,'r') include_guard_name = '' for line in file_pointer: if (include_guard_name == ''): for compare_string in include_guard_begin_identifier: if (stringmanipulation.issubstring(compare_string, line) != -1): include_guard_name = findincludeguardidentifier(line) if (include_guard_name == ''): break line = line.rstrip('\r\n') return_value.append(line) break else: for compare_string in include_guard_second_identifier: if (stringmanipulation.issubstring(compare_string, line) != -1): if (stringmanipulation.issubstring(include_guard_name, line) != -1): line = line.rstrip('\r\n') return_value.append(line) return_value.append(include_guard_name) return return_value include_guard_name = '' return_value = [] return []
def findoldincludeguardset(path, filename): return_value = [] full_file_name = path + filename file_pointer = open(full_file_name, 'r') include_guard_name = '' for line in file_pointer: if (include_guard_name == ''): for compare_string in include_guard_begin_identifier: if (stringmanipulation.issubstring(compare_string, line) != -1): include_guard_name = findincludeguardidentifier(line) if (include_guard_name == ''): break line = line.rstrip('\r\n') return_value.append(line) break else: for compare_string in include_guard_second_identifier: if (stringmanipulation.issubstring(compare_string, line) != -1): if (stringmanipulation.issubstring(include_guard_name, line) != -1): line = line.rstrip('\r\n') return_value.append(line) return_value.append(include_guard_name) return return_value include_guard_name = '' return_value = [] return []
def findstringstoreplace(line): original_line = line # Dont replace compiler directives if (line[0] == '#'): return [] # Dont allow global removal of namespace gips since it is very intrusive for sub_string_compare in do_not_replace_line_table: index = stringmanipulation.issubstring(line, sub_string_compare) if (index != -1): return [] return_value = [] line = stringmanipulation.removeccomment(line) line = stringmanipulation.whitespacestoonespace(line) if (len(line) == 0): return [] if (line[0] == '*'): return [] index = stringmanipulation.issubstring(line, prefix_to_filter) while index >= 0: dont_store_hit = False word_position = stringmanipulation.getword(line, index) start_of_word = word_position[0] size_of_word = word_position[1] end_of_word = start_of_word + size_of_word old_word = line[start_of_word:end_of_word] if (isinmanualremovetable(old_word)): dont_store_hit = True if((end_of_word + 2 < len(line)) and\ name_space_to_ignore == line[start_of_word:end_of_word+2]): dont_store_hit = True result = stringmanipulation.removeprefix(old_word, prefix_to_filter) new_word = result[1] for word_to_filter in words_to_filter: new_word = stringmanipulation.removealloccurances( new_word, word_to_filter) result = stringmanipulation.removeprefix(new_word, '_') new_word = result[1] new_word = stringmanipulation.fixabbreviations(new_word) new_word = stringmanipulation.removealloccurances(new_word, '_') if (not dont_store_hit): return_value.append([old_word, new_word]) # remove the word we found from the string so we dont find it again line = line[0:start_of_word] + line[end_of_word:len(line)] index = stringmanipulation.issubstring(line, 'GIPS') return return_value
def findstringstoreplace(line): original_line = line # Dont replace compiler directives if(line[0] == '#'): return [] # Dont allow global removal of namespace gips since it is very intrusive for sub_string_compare in do_not_replace_line_table: index = stringmanipulation.issubstring(line,sub_string_compare) if(index != -1): return [] return_value = [] line = stringmanipulation.removeccomment(line) line = stringmanipulation.whitespacestoonespace(line) if(len(line) == 0): return [] if(line[0] == '*'): return [] index = stringmanipulation.issubstring(line,prefix_to_filter) while index >= 0: dont_store_hit = False word_position = stringmanipulation.getword(line, index) start_of_word = word_position[0] size_of_word = word_position[1] end_of_word = start_of_word + size_of_word old_word = line[start_of_word:end_of_word] if(isinmanualremovetable(old_word)): dont_store_hit = True if((end_of_word + 2 < len(line)) and\ name_space_to_ignore == line[start_of_word:end_of_word+2]): dont_store_hit = True result = stringmanipulation.removeprefix(old_word,prefix_to_filter) new_word = result[1] for word_to_filter in words_to_filter: new_word = stringmanipulation.removealloccurances(new_word,word_to_filter) result = stringmanipulation.removeprefix(new_word,'_') new_word = result[1] new_word = stringmanipulation.fixabbreviations(new_word) new_word = stringmanipulation.removealloccurances(new_word,'_') if(not dont_store_hit): return_value.append([old_word,new_word]) # remove the word we found from the string so we dont find it again line = line[0:start_of_word] + line[end_of_word:len(line)] index = stringmanipulation.issubstring(line,'GIPS') return return_value
def removekeywordfound(line): return stringmanipulation.issubstring(line, trace_remove_key_word) != -1
def endofstatement(line): return stringmanipulation.issubstring(line, ';') != -1
def istracebegining(line): return stringmanipulation.issubstring(line, trace_identifier) != -1