starpu_check_documented.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/python
  2. import os
  3. import sys
  4. class bcolors:
  5. FAILURE = '\033[91m'
  6. NORMAL = '\033[0m'
  7. def loadFunctionsAndDatatypes(flist, dtlist, fname):
  8. f = open(fname, 'r')
  9. for line in f:
  10. mline = line[:-1]
  11. if mline.count("\\fn"):
  12. if mline.count("fft") == 0:
  13. func = mline.replace("\\fn ", "")
  14. flist.append(list([func, fname]))
  15. if mline.count("\\struct ") or mline.count("\\def ") or mline.count("\\typedef ") or mline.count("\\enum "):
  16. datatype = mline.replace("\\struct ", "").replace("\\def ", "").replace("\\typedef ", "").replace("\\enum ","")
  17. dtlist.append(list([datatype, fname]))
  18. f.close()
  19. functions = []
  20. datatypes = []
  21. dirname=os.path.dirname(sys.argv[0])
  22. docfile_dir=dirname+"/../chapters/api/"
  23. for docfile in os.listdir(docfile_dir):
  24. if docfile.count(".doxy"):
  25. loadFunctionsAndDatatypes(functions, datatypes, docfile_dir+docfile)
  26. incfiles=dirname+"/../../../include/*.h " + dirname + "/../../../mpi/include/*.h " + dirname + "/../../../starpufft/*h " + dirname + "/../../../sc_hypervisor/include/*.h " + dirname + "/../../../include/starpu_config.h.in"
  27. for function in functions:
  28. x = os.system("fgrep -l \"" + function[0] + "\" " + incfiles + " > /dev/null")
  29. if x != 0:
  30. print "Function <" + bcolors.FAILURE + function[0] + bcolors.NORMAL + "> documented in <" + function[1] + "> does not exist in StarPU's API"
  31. for datatype in datatypes:
  32. x = os.system("fgrep -l \"" + datatype[0] + "\" " + incfiles + " > /dev/null")
  33. if x != 0:
  34. print "Datatype <" + bcolors.FAILURE + datatype[0] + bcolors.NORMAL + "> documented in <" + datatype[1] + "> does not exist in StarPU's API"