annotate src/fftw-3.3.8/api/f03api.sh @ 84:08ae793730bd

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