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