misc_specifics.m4 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. include(head.m4)dnl
  2. dnl
  3. dnl This file contains the specific functions that are not handled in the
  4. dnl m4/specific.m4 file.
  5. #include "config.h"
  6. #include "kinds.inc"
  7. dnl This is from GNU m4 examples file foreach.m4:
  8. divert(-1)
  9. # foreach(x, (item_1, item_2, ..., item_n), stmt)
  10. define(`foreach', `pushdef(`$1', `')_foreach(`$1', `$2',
  11. `$3')popdef(`$1')')
  12. define(`_arg1', `$1')
  13. define(`_foreach',
  14. `ifelse(`$2', `()', ,
  15. `define(`$1', _arg1$2)$3`'_foreach(`$1', (shift$2),
  16. `$3')')')
  17. # traceon(`define', `foreach', `_foreach', `ifelse')
  18. divert
  19. dnl NINT specifics
  20. foreach(`ikind', `(4, 8, 16)', `foreach(`rkind', `(4, 8, 10, 16)', `
  21. `#if defined (HAVE_GFC_REAL_'rkind`) && defined (HAVE_GFC_INTEGER_'ikind`)'
  22. elemental function _gfortran_specific__nint_`'ikind`_'rkind (parm)
  23. real (kind=rkind) , intent (in) :: parm
  24. integer (kind=ikind) :: _gfortran_specific__nint_`'ikind`_'rkind
  25. _gfortran_specific__nint_`'ikind`_'rkind = nint (parm)
  26. end function
  27. #endif
  28. ')')
  29. dnl CHAR specifics
  30. foreach(`ckind', `(1)', `foreach(`ikind', `(4, 8, 16)', `
  31. `#if defined (HAVE_GFC_INTEGER_'ikind`)'
  32. elemental function _gfortran_specific__char_`'ckind`_i'ikind (parm)
  33. integer (kind=ikind) , intent (in) :: parm
  34. character (kind=ckind,len=1) :: _gfortran_specific__char_`'ckind`_i'ikind
  35. _gfortran_specific__char_`'ckind`_i'ikind` = char (parm, kind='ckind`)'
  36. end function
  37. #endif
  38. ')')
  39. dnl LEN specifics
  40. foreach(`ckind', `(1)', `foreach(`ikind', `(4, 8, 16)', `
  41. `#if defined (HAVE_GFC_INTEGER_'ikind`)'
  42. elemental function _gfortran_specific__len_`'ckind`_i'ikind (parm)
  43. character (kind=ckind,len=*) , intent (in) :: parm
  44. integer (kind=ikind) :: _gfortran_specific__len_`'ckind`_i'ikind
  45. _gfortran_specific__len_`'ckind`_i'ikind` = len (parm)'
  46. end function
  47. #endif
  48. ')')
  49. dnl INDEX specifics
  50. foreach(`ckind', `(1)', `foreach(`ikind', `(4, 8, 16)', `
  51. `#if defined (HAVE_GFC_INTEGER_'ikind`)'
  52. elemental function _gfortran_specific__index_`'ckind`_i'ikind (parm1, parm2)
  53. character (kind=ckind,len=*) , intent (in) :: parm1, parm2
  54. integer (kind=ikind) :: _gfortran_specific__index_`'ckind`_i'ikind
  55. _gfortran_specific__index_`'ckind`_i'ikind` = index (parm1, parm2)'
  56. end function
  57. #endif
  58. ')')