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