cannam@127: #! /bin/sh cannam@127: cannam@127: # Script to generate Fortran 2003 interface declarations for FFTW from cannam@127: # the fftw3.h header file. cannam@127: cannam@127: # This is designed so that the Fortran caller can do: cannam@127: # use, intrinsic :: iso_c_binding cannam@127: # implicit none cannam@127: # include 'fftw3.f03' cannam@127: # and then call the C FFTW functions directly, with type checking. cannam@127: cannam@127: echo "! Generated automatically. DO NOT EDIT!" cannam@127: echo cannam@127: cannam@127: # C_FFTW_R2R_KIND is determined by configure and inserted by the Makefile cannam@127: # echo " integer, parameter :: C_FFTW_R2R_KIND = @C_FFTW_R2R_KIND@" cannam@127: cannam@127: # Extract constants cannam@127: perl -pe 's/([A-Z0-9_]+)=([+-]?[0-9]+)/\n integer\(C_INT\), parameter :: \1 = \2\n/g' < fftw3.h | grep 'integer(C_INT)' cannam@127: perl -pe 's/#define +([A-Z0-9_]+) +\(([+-]?[0-9]+)U?\)/\n integer\(C_INT\), parameter :: \1 = \2\n/g' < fftw3.h | grep 'integer(C_INT)' cannam@127: perl -pe 'if (/#define +([A-Z0-9_]+) +\(([0-9]+)U? *<< *([0-9]+)\)/) { print "\n integer\(C_INT\), parameter :: $1 = ",$2 << $3,"\n"; }' < fftw3.h | grep 'integer(C_INT)' cannam@127: cannam@127: # Extract function declarations cannam@127: for p in $*; do cannam@127: if test "$p" = "d"; then p=""; fi cannam@127: cannam@127: echo cannam@127: cat <