def update_moved_functions(filename): xml = objectify.parse(filename) doxygen = xml.getroot() xmlfunctionsfile = doxygen.compounddef if xmlfunctionsfile.find('sectiondef') != None: if len([ s for s in xmlfunctionsfile.sectiondef if s.get('kind') == 'func' ]) > 0: file_split = os.path.splitext(xmlfunctionsfile.compoundname.text) functionsfile = getfunctionsfile(file_split[0]) for section in xmlfunctionsfile.sectiondef: if section.get('kind') == 'func': for xmlfunction in section.memberdef: for function in missing_functions: if function.name == xmlfunction.name.text: argstring = str(xmlfunction.argsstring.text) params = argstring[argstring.find('(') + 1:argstring.rfind(')')] returns = xmlfunction.type.ref.text if hasattr( xmlfunction.type, 'ref') else xmlfunction.type.text moved_function = functionsfile.function_by_signature( xmlfunction.name.text, returns, params) moved_function.returns = returns moved_function.description = moved_function.description + '\n\n' + function.description print "moved function: " + function.name setfunctionsfile(functionsfile)
def update_moved_functions(filename,is_addon=False): xml = objectify.parse(filename) doxygen = xml.getroot() xmlfunctionsfile = doxygen.compounddef if xmlfunctionsfile.find('sectiondef')!=None: if len([ s for s in xmlfunctionsfile.sectiondef if s.get('kind')=='func'])>0: file_split = os.path.splitext(xmlfunctionsfile.compoundname.text) functionsfile = getfunctionsfile(file_split[0]) for section in xmlfunctionsfile.sectiondef: if section.get('kind')=='func': for xmlfunction in section.memberdef: for function in missing_functions: if function.name == xmlfunction.name.text: argstring = str(xmlfunction.argsstring.text) params = argstring[argstring.find('(')+1:argstring.rfind(')')] returns = xmlfunction.type.ref.text if hasattr(xmlfunction.type,'ref') else xmlfunction.type.text moved_function = functionsfile.function_by_signature(xmlfunction.name.text, returns, params) moved_function.returns = returns moved_function.description = moved_function.description + '\n\n' + function.description print "moved function: " + function.name setfunctionsfile(functionsfile,is_addon)
def serialize_functionsfile(cursor,filename,is_addon=False): functionsfile = getfunctionsfile(filename) functions_fromcode = [] functions_for_fuzzy_search = [] for member in cursor.get_children(): if is_function(member) and str(member.location.file) == cursor.spelling: function = parse_function(functionsfile, None, member, functions_fromcode) if function is not None: functions_fromcode.append(function) else: functions_for_fuzzy_search.append(member) for member in functions_for_fuzzy_search: function = parse_function(functionsfile, None, member, functions_fromcode, True) if function is not None: functions_fromcode.append(function) thisfile_missing_functions = [] for function in functionsfile.function_list: if not function in functions_fromcode: missing_functions.append(function) thisfile_missing_functions.append(function) for function in thisfile_missing_functions: functionsfile.function_list.remove(function) functionsfile.function_list.sort(key=lambda function: function.name) if len(functionsfile.function_list)>0: setfunctionsfile(functionsfile,is_addon)
def serialize_functionsfile(cursor, filename, is_addon=False): functionsfile = getfunctionsfile(filename) functions_fromcode = [] functions_for_fuzzy_search = [] for member in cursor.get_children(): if is_function(member) and str( member.location.file) == cursor.spelling: function = parse_function(functionsfile, None, member, functions_fromcode) if function is not None: functions_fromcode.append(function) else: functions_for_fuzzy_search.append(member) for member in functions_for_fuzzy_search: function = parse_function(functionsfile, None, member, functions_fromcode, True) if function is not None: functions_fromcode.append(function) thisfile_missing_functions = [] for function in functionsfile.function_list: if not function in functions_fromcode: missing_functions.append(function) thisfile_missing_functions.append(function) for function in thisfile_missing_functions: functionsfile.function_list.remove(function) functionsfile.function_list.sort(key=lambda function: function.name) if len(functionsfile.function_list) > 0: setfunctionsfile(functionsfile, is_addon)
def serialize_functionsfile(filename): xml = objectify.parse(filename) doxygen = xml.getroot() xmlfunctionsfile = doxygen.compounddef if xmlfunctionsfile.find('sectiondef') != None: if len([ s for s in xmlfunctionsfile.sectiondef if s.get('kind') == 'func' ]) > 0: print '\n' file_split = os.path.splitext(xmlfunctionsfile.compoundname.text) print file_split[0] functionsfile = getfunctionsfile(file_split[0]) print 'new: ' + str(functionsfile.new) functions_fromxml = [] for section in xmlfunctionsfile.sectiondef: if section.get('kind') == 'func': for xmlfunction in section.memberdef: argstring = str(xmlfunction.argsstring.text) params = argstring[argstring.find('(') + 1:argstring.rfind(')')] returns = xmlfunction.type.ref.text if hasattr( xmlfunction.type, 'ref') else xmlfunction.type.text function = functionsfile.function_by_signature( xmlfunction.name.text, returns, params) #function.description = function.description.replace("~~~~{.brush cpp}","~~~~{.cpp}").replace('</pre>',"~~~~") function.description = function.description.replace( '<p>', '').replace('</p>', '').replace( '<code>', '').replace('</code>', '').replace('<pre>', '') function.returns = returns functions_fromxml.append(function.name) #print function.returns + " " + function.name + xmlfunction.argsstring.text + " new: " + str(function.new) print "missing functions" thisfile_missing_functions = [] #[f for f in functionsfile.function_list if f not in functions_fromxml.function_list] for function in functionsfile.function_list: if not function.name in functions_fromxml: print function.name + "(" + function.parameters + ")" missing_functions.append(function) thisfile_missing_functions.append(function) for function in thisfile_missing_functions: functionsfile.function_list.remove(function) deprecated_functions = [] for function in functionsfile.function_list: if function.name.find("OF_DEPRECATED_MSG") != -1: deprecated_functions.append(function) for function in deprecated_functions: functionsfile.function_list.remove(function) functionsfile.function_list.sort( key=lambda function: function.name) setfunctionsfile(functionsfile)
def serialize_functionsfile(filename): xml = objectify.parse(filename) doxygen = xml.getroot() xmlfunctionsfile = doxygen.compounddef if xmlfunctionsfile.find('sectiondef')!=None: if len([ s for s in xmlfunctionsfile.sectiondef if s.get('kind')=='func'])>0: print '\n' file_split = os.path.splitext(xmlfunctionsfile.compoundname.text) print file_split[0] functionsfile = getfunctionsfile(file_split[0]) print 'new: ' + str(functionsfile.new) functions_fromxml = [] for section in xmlfunctionsfile.sectiondef: if section.get('kind')=='func': for xmlfunction in section.memberdef: argstring = str(xmlfunction.argsstring.text) params = argstring[argstring.find('(')+1:argstring.rfind(')')] returns = xmlfunction.type.ref.text if hasattr(xmlfunction.type,'ref') else xmlfunction.type.text function = functionsfile.function_by_signature(xmlfunction.name.text, returns, params) #function.description = function.description.replace("~~~~{.brush cpp}","~~~~{.cpp}").replace('</pre>',"~~~~") function.description = function.description.replace('<p>','').replace('</p>','').replace('<code>','').replace('</code>','').replace('<pre>','') function.returns = returns functions_fromxml.append(function.name) #print function.returns + " " + function.name + xmlfunction.argsstring.text + " new: " + str(function.new) print "missing functions" thisfile_missing_functions = [] #[f for f in functionsfile.function_list if f not in functions_fromxml.function_list] for function in functionsfile.function_list: if not function.name in functions_fromxml: print function.name+"("+function.parameters+")" missing_functions.append(function) thisfile_missing_functions.append(function) for function in thisfile_missing_functions: functionsfile.function_list.remove(function) deprecated_functions = [] for function in functionsfile.function_list: if function.name.find("OF_DEPRECATED_MSG")!=-1: deprecated_functions.append(function) for function in deprecated_functions: functionsfile.function_list.remove(function); functionsfile.function_list.sort(key=lambda function: function.name) setfunctionsfile(functionsfile)
def export_functionsfiles(db,group_dir,group): dbfiles = dbtools_files.list_all(db,group.id) for dbfile in dbfiles: functions = dbtools_functions.list_all(db,dbfile[0],'files') if len(functions)>0: print dbfile[1] functionsfile = DocsFunctionsFile(dbfile[0]) functionsfile.module = group.name functionsfile.name = dbfile[1] functionsfile.new = 0 functionsfile.advanced = False functionsfile.visible = True functionsfile.description = dbfile[2] functionsfile.addons = False functionsfile.function_list = functions for function in functions: print " " + function.name markdown_file.setfunctionsfile(functionsfile)
def parse_folder(root, base, files, is_addon=False, is_glm = False): file_count=0 prefix = "" if root != base: prefix = os.path.relpath(root, base) + "_" for name in files: file_count+=1 filename = os.path.join(root, name) if (name.find('of')==0 and os.path.splitext(name)[1]=='.h') or os.path.splitext(name)[1]=='.hpp': tu = clang_utils.get_tu_from_file(filename, of_root) num_functions = 0 # filter so it only parses elements from this unit not includes def f(child): return str(child.location.file) == str(tu.spelling) for child in filter(f, tu.cursor.get_children()): if child.spelling.find("glm") != -1 and child.kind == CursorKind.NAMESPACE: for ns_child in child.get_children(): if is_glm_class(ns_child): i=0 for c in ns_child.get_children(): if is_variable(c) or is_method(c) or c.kind == CursorKind.CXX_BASE_SPECIFIER: i+=1 if i>0 and ns_child.spelling not in visited_classes: serialize_class(ns_child, is_addon, "glm", substitute_glm_spelling(ns_child.spelling)) visited_classes.append(ns_child.spelling) if is_function(ns_child): num_functions+=1 if is_class(child) and child.spelling.find('of')==0: i=0 for c in child.get_children(): if is_variable(c) or is_method(c) or c.kind == CursorKind.CXX_BASE_SPECIFIER: i+=1 if i>0 and child.spelling not in visited_classes: serialize_class(child, is_addon) visited_classes.append(child.spelling) if is_function(child) and child.spelling.find('of')==0: num_functions+=1 functions_fromcode = [] functions_name = os.path.splitext(name)[0] functionsfile = getfunctionsfile(prefix + functions_name) if num_functions>0 and functions_name not in visited_function_files and functions_name != "ofMain": if is_glm: for child in tu.cursor.get_children(): if child.spelling == "glm" and child.kind == CursorKind.NAMESPACE: functions_fromcode += serialize_functionsfile(child, functionsfile, is_addon, str(tu.cursor.spelling), False, "glm") if len(functions_fromcode) > 0: visited_function_files.append(functions_name) else: functions_fromcode = serialize_functionsfile(tu.cursor, functionsfile, is_addon) visited_function_files.append(functions_name) # We need to do this check outside of serialize_functionsfile cause glm is calling it several times per function thisfile_missing_functions = [] for function in functionsfile.function_list: if not function in functions_fromcode: missing_functions.append(function) thisfile_missing_functions.append(function) for function in thisfile_missing_functions: functionsfile.function_list.remove(function) functionsfile.function_list.sort(key=lambda function: function.syntax) if len(functionsfile.function_list)>0: setfunctionsfile(functionsfile, is_addon) else: remove_functionsfile(functionsfile, is_addon) return file_count
import markdown_file addons = markdown_file.list_all_addons() classes = markdown_file.getclass_list() for clazz_name in classes: clazz = markdown_file.getclass(clazz_name,True) markdown_file.setclass(clazz,clazz.module in addons) function_files = markdown_file.getfunctionsfiles_list() for function_file_name in function_files: functions_file = markdown_file.getfunctionsfile(function_file_name) markdown_file.setfunctionsfile(functions_file, functions_file.module in addons)