annotate src/fftw-3.3.5/api/f03api.sh @ 158:fa7c54aeb697

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