1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/usr/bin/python3
- import os
- import sys
- class bcolors:
- FAILURE = '\033[91m'
- NORMAL = '\033[0m'
- def list_files(directory):
- return list(map(lambda a : directory+a, list(filter(lambda a:a.count(".h") and not a.count("starpu_deprecated_api.h"),os.listdir(directory)))))
- def loadFunctionsAndDatatypes(flist, dtlist, file_name):
- f = open(file_name, 'r')
- for line in f:
- mline = line[:-1]
- if mline.count("\\fn"):
- if mline.count("fft") == 0:
- func = mline.replace("\\fn ", "")
- l = func.split("(")[0].split()
- func_name = l[len(l)-1].replace("*", "")
- flist.append(list([func, func_name, file_name]))
- if mline.count("\\struct ") or mline.count("\\def ") or mline.count("\\typedef ") or mline.count("\\enum "):
- datatype = mline.replace("\\struct ", "").replace("\\def ", "").replace("\\typedef ", "").replace("\\enum ","")
- l = datatype.split("(")
- if len(l) > 1:
- datatype_name = l[0]
- else:
- datatype_name = datatype
- dtlist.append(list([datatype, datatype_name, file_name]))
- f.close()
- functions = []
- datatypes = []
- dirname=os.path.dirname(sys.argv[0])
- docfile_dir=dirname+"/../chapters/api/"
- for docfile in os.listdir(docfile_dir):
- if docfile.count(".doxy"):
- loadFunctionsAndDatatypes(functions, datatypes, docfile_dir+docfile)
- list_incfiles = [dirname + "/../../../include/starpu_config.h.in"]
- for d in [dirname+"/../../../include/", dirname + "/../../../mpi/include/", dirname + "/../../../starpufft/include/", dirname + "/../../../sc_hypervisor/include/"]:
- list_incfiles.extend(list_files(d))
- incfiles=" ".join(list_incfiles)
- for function in functions:
- x = os.system("sed 's/ *STARPU_ATTRIBUTE_UNUSED *//g' " + incfiles + "| sed 's/ STARPU_WARN_UNUSED_RESULT//g' | fgrep \"" + function[0] + "\" > /dev/null")
- if x != 0:
- print("Function <" + bcolors.FAILURE + function[0] + bcolors.NORMAL + "> documented in <" + function[2] + "> does not exist in StarPU's API")
- os.system("grep " + function[1] + " " + dirname+"/../../../include/starpu_deprecated_api.h")
- for datatype in datatypes:
- x = os.system("fgrep -l \"" + datatype[0] + "\" " + incfiles + " > /dev/null")
- if x != 0:
- print("Datatype <" + bcolors.FAILURE + datatype[0] + bcolors.NORMAL + "> documented in <" + datatype[2] + "> does not exist in StarPU's API")
- os.system("grep " + datatype[1] + " " + dirname+"/../../../include/starpu_deprecated_api.h")
|