Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

functions.py 850B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env python
  2. # $Id: functions.py,v 1.1 2001/11/18 23:16:56 brianp Exp $
  3. # Helper for the getprocaddress.c test.
  4. import string
  5. def PrintHead():
  6. print """
  7. static const char *functions[] = {"""
  8. def PrintTail():
  9. print"""
  10. NULL
  11. };
  12. """
  13. def PrintFunctions(specFile):
  14. # init some vars
  15. prevCategory = ''
  16. funcName = ''
  17. f = open(specFile)
  18. for line in f.readlines():
  19. # split line into tokens
  20. tokens = string.split(line)
  21. if len(tokens) > 0 and line[0] != '#':
  22. if tokens[0] == 'name':
  23. if funcName != '':
  24. if category != prevCategory:
  25. print ' "-%s",' % category
  26. prevCategory = category
  27. print ' "gl%s",' % funcName
  28. funcName = tokens[1]
  29. elif tokens[0] == 'category':
  30. category = tokens[1]
  31. #endif
  32. #endif
  33. #endfor
  34. #enddef
  35. PrintHead()
  36. PrintFunctions("../bin/APIspec")
  37. PrintTail()