iparm.m4 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. dnl Support macro file for intrinsic functions.
  2. dnl Works out all the function types from the filename.
  3. dnl This file is part of the GNU Fortran 95 Runtime Library (libgfortran)
  4. dnl Distributed under the GNU GPL with exception. See COPYING for details.
  5. dnl M4 macro file to get type names from filenames
  6. define(get_typename2, `GFC_$1_$2')dnl
  7. define(get_typename, `get_typename2(ifelse($1,i,INTEGER,ifelse($1,r,REAL,ifelse($1,l,LOGICAL,ifelse($1,c,COMPLEX,unknown)))),`$2')')dnl
  8. define(get_arraytype, `gfc_array_$1$2')dnl
  9. define(define_type, `dnl
  10. ifelse(regexp($2,`^[0-9]'),-1,`dnl
  11. define($1_letter, substr($2, 0, 1))dnl
  12. define($1_kind, substr($2, 1))dnl
  13. ',`dnl
  14. define($1_letter,i)dnl
  15. define($1_kind,$2)dnl
  16. ')dnl
  17. define($1_code,$1_letter`'$1_kind)dnl
  18. define($1,get_arraytype($1_letter,$1_kind))dnl
  19. define($1_name, get_typename($1_letter, $1_kind))')dnl
  20. dnl
  21. define_type(atype, regexp(file, `_\(.?[0-9]*\)\.c$', `\1'))dnl
  22. define(rtype_tmp, regexp(file, `_\(.?[0-9]*\)_[^_]*\.c$', `\1'))dnl
  23. ifelse(rtype_tmp,,`dnl
  24. define_type(rtype, atype_code)dnl
  25. define(rtype_qual,`')dnl
  26. ',`dnl
  27. define_type(rtype, rtype_tmp)dnl
  28. define(rtype_qual,`_'rtype_kind)dnl
  29. ')dnl
  30. define(atype_max, atype_name`_HUGE')dnl
  31. define(atype_min,ifelse(regexp(file, `_\(.\)[0-9]*\.c$', `\1'),`i',`(-'atype_max`-1)',`-'atype_max))dnl
  32. define(atype_inf, atype_name`_INFINITY')dnl
  33. define(atype_nan, atype_name`_QUIET_NAN')dnl
  34. define(name, regexp(regexp(file, `[^/]*$', `\&'), `^\([^_]*\)_', `\1'))dnl
  35. define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl
  36. define(`u_name',`regexp(upcase(name),`\([A-Z]*\)',`\1')')dnl
  37. define(rtype_ccode,ifelse(rtype_letter,`i',rtype_kind,rtype_code))dnl