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