annotate src/fftw-3.3.8/api/f03api.sh @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents bd3cc4d1df30
children
rev   line source
cannam@167 1 #! /bin/sh
cannam@167 2
cannam@167 3 # Script to generate Fortran 2003 interface declarations for FFTW from
cannam@167 4 # the fftw3.h header file.
cannam@167 5
cannam@167 6 # This is designed so that the Fortran caller can do:
cannam@167 7 # use, intrinsic :: iso_c_binding
cannam@167 8 # implicit none
cannam@167 9 # include 'fftw3.f03'
cannam@167 10 # and then call the C FFTW functions directly, with type checking.
cannam@167 11
cannam@167 12 echo "! Generated automatically. DO NOT EDIT!"
cannam@167 13 echo
cannam@167 14
cannam@167 15 # C_FFTW_R2R_KIND is determined by configure and inserted by the Makefile
cannam@167 16 # echo " integer, parameter :: C_FFTW_R2R_KIND = @C_FFTW_R2R_KIND@"
cannam@167 17
cannam@167 18 # Extract constants
cannam@167 19 perl -pe 's/([A-Z0-9_]+)=([+-]?[0-9]+)/\n integer\(C_INT\), parameter :: \1 = \2\n/g' < fftw3.h | grep 'integer(C_INT)'
cannam@167 20 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@167 21 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@167 22
cannam@167 23 # Extract function declarations
cannam@167 24 for p in $*; do
cannam@167 25 if test "$p" = "d"; then p=""; fi
cannam@167 26
cannam@167 27 echo
cannam@167 28 cat <<EOF
cannam@167 29 type, bind(C) :: fftw${p}_iodim
cannam@167 30 integer(C_INT) n, is, os
cannam@167 31 end type fftw${p}_iodim
cannam@167 32 type, bind(C) :: fftw${p}_iodim64
cannam@167 33 integer(C_INTPTR_T) n, is, os
cannam@167 34 end type fftw${p}_iodim64
cannam@167 35 EOF
cannam@167 36
cannam@167 37 echo
cannam@167 38 echo " interface"
cannam@167 39 gcc -D__GNUC__=5 -D__i386__ -E fftw3.h |grep "fftw${p}_plan_dft" |tr ';' '\n' | grep -v "fftw${p}_execute(" | perl genf03.pl
cannam@167 40 echo " end interface"
cannam@167 41
cannam@167 42 done