_isocbind.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. iso_c_binding_map = {
  2. 'integer': {
  3. 'c_int': 'int',
  4. 'c_short': 'short int',
  5. 'c_long': 'long int',
  6. 'c_long_long': 'long long int',
  7. 'c_signed_char': 'signed char',
  8. 'c_size_t': 'size_t',
  9. 'c_int8_t': 'int8_t',
  10. 'c_int16_t': 'int16_t',
  11. 'c_int32_t': 'int32_t',
  12. 'c_int64_t': 'int64_t',
  13. 'c_int_least8_t': 'int_least8_t',
  14. 'c_int_least16_t': 'int_least16_t',
  15. 'c_int_least32_t': 'int_least32_t',
  16. 'c_int_least64_t': 'int_least64_t',
  17. 'c_int_fast8_t': 'int_fast8_t',
  18. 'c_int_fast16_t': 'int_fast16_t',
  19. 'c_int_fast32_t': 'int_fast32_t',
  20. 'c_int_fast64_t': 'int_fast64_t',
  21. 'c_intmax_t': 'intmax_t',
  22. 'c_intptr_t': 'intptr_t',
  23. 'c_ptrdiff_t': 'intptr_t',
  24. },
  25. 'real': {
  26. 'c_float': 'float',
  27. 'c_double': 'double',
  28. 'c_long_double': 'long double'
  29. },
  30. 'complex': {
  31. 'c_float_complex': 'float _Complex',
  32. 'c_double_complex': 'double _Complex',
  33. 'c_long_double_complex': 'long double _Complex'
  34. },
  35. 'logical': {
  36. 'c_bool': '_Bool'
  37. },
  38. 'character': {
  39. 'c_char': 'char'
  40. }
  41. }
  42. isoc_kindmap = {}
  43. for fortran_type, c_type_dict in iso_c_binding_map.items():
  44. for c_type in c_type_dict.keys():
  45. isoc_kindmap[c_type] = fortran_type