starpu_check_documented.py 1.5 KB

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