annotate src/fftw-3.3.3/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 89f5e221ed7b
children
rev   line source
cannam@95 1 #! /bin/sh
cannam@95 2
cannam@95 3 # Script to generate Fortran 2003 interface declarations for FFTW from
cannam@95 4 # the fftw3.h header file.
cannam@95 5
cannam@95 6 # This is designed so that the Fortran caller can do:
cannam@95 7 # use, intrinsic :: iso_c_binding
cannam@95 8 # implicit none
cannam@95 9 # include 'fftw3.f03'
cannam@95 10 # and then call the C FFTW functions directly, with type checking.
cannam@95 11
cannam@95 12 echo "! Generated automatically. DO NOT EDIT!"
cannam@95 13 echo
cannam@95 14
cannam@95 15 # C_FFTW_R2R_KIND is determined by configure and inserted by the Makefile
cannam@95 16 # echo " integer, parameter :: C_FFTW_R2R_KIND = @C_FFTW_R2R_KIND@"
cannam@95 17
cannam@95 18 # Extract constants
cannam@95 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@95 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@95 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@95 22
cannam@95 23 # Extract function declarations
cannam@95 24 for p in $*; do
cannam@95 25 if test "$p" = "d"; then p=""; fi
cannam@95 26
cannam@95 27 echo
cannam@95 28 cat <<EOF
cannam@95 29 type, bind(C) :: fftw${p}_iodim
cannam@95 30 integer(C_INT) n, is, os
cannam@95 31 end type fftw${p}_iodim
cannam@95 32 type, bind(C) :: fftw${p}_iodim64
cannam@95 33 integer(C_INTPTR_T) n, is, os
cannam@95 34 end type fftw${p}_iodim64
cannam@95 35 EOF
cannam@95 36
cannam@95 37 echo
cannam@95 38 echo " interface"
cannam@95 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@95 40 echo " end interface"
cannam@95 41
cannam@95 42 done