starpu_check_documented.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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("@deftypefun "):
  11. if mline.count("fft") == 0:
  12. func = mline.replace("@deftypefun ", "").replace("*} ", "*").replace("@var{", "").replace("}", "").replace("{", "").replace(" (", "(", 1)
  13. flist.append(list([func, fname]))
  14. if mline.count("@deftp"):
  15. datatype = mline.replace("@deftp {Data Type} {", "").replace("}", "")
  16. dtlist.append(list([datatype, fname]))
  17. f.close()
  18. functions = []
  19. datatypes = []
  20. loadFunctionsAndDatatypes(functions, datatypes, "doc/starpu.texi")
  21. for docfile in os.listdir('doc/chapters'):
  22. if docfile.count(".texi"):
  23. loadFunctionsAndDatatypes(functions, datatypes, "doc/chapters/"+docfile)
  24. for function in functions:
  25. x = os.system("fgrep -l \"" + function[0] + "\" include/*.h mpi/*.h starpufft/*h >foo")
  26. if x != 0:
  27. print "Function <" + bcolors.FAILURE + function[0] + bcolors.NORMAL + " > documented in <" + function[1] + "> does not exist in StarPU's API"
  28. for datatype in datatypes:
  29. x = os.system("fgrep -l \"" + datatype[0] + "\" include/*.h mpi/*.h starpufft/*h >foo")
  30. if x != 0:
  31. print "Datatype <" + bcolors.FAILURE + datatype[0] + bcolors.NORMAL + "> documented in <" + datatype[1] + "> does not exist in StarPU's API"