To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at https://github.com/sonic-visualiser/sv-dependency-builds .
This repository is a read-only copy which is updated automatically every hour.
root / src / fftw-3.3.8 / api / f03api.sh @ 167:bd3cc4d1df30
History | View | Annotate | Download (1.42 KB)
| 1 |
#! /bin/sh |
|---|---|
| 2 |
|
| 3 |
# Script to generate Fortran 2003 interface declarations for FFTW from |
| 4 |
# the fftw3.h header file. |
| 5 |
|
| 6 |
# This is designed so that the Fortran caller can do: |
| 7 |
# use, intrinsic :: iso_c_binding |
| 8 |
# implicit none |
| 9 |
# include 'fftw3.f03' |
| 10 |
# and then call the C FFTW functions directly, with type checking. |
| 11 |
|
| 12 |
echo "! Generated automatically. DO NOT EDIT!" |
| 13 |
echo |
| 14 |
|
| 15 |
# C_FFTW_R2R_KIND is determined by configure and inserted by the Makefile |
| 16 |
# echo " integer, parameter :: C_FFTW_R2R_KIND = @C_FFTW_R2R_KIND@" |
| 17 |
|
| 18 |
# Extract constants |
| 19 |
perl -pe 's/([A-Z0-9_]+)=([+-]?[0-9]+)/\n integer\(C_INT\), parameter :: \1 = \2\n/g' < fftw3.h | grep 'integer(C_INT)' |
| 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)' |
| 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)'
|
| 22 |
|
| 23 |
# Extract function declarations |
| 24 |
for p in $*; do |
| 25 |
if test "$p" = "d"; then p=""; fi |
| 26 |
|
| 27 |
echo |
| 28 |
cat <<EOF |
| 29 |
type, bind(C) :: fftw${p}_iodim
|
| 30 |
integer(C_INT) n, is, os |
| 31 |
end type fftw${p}_iodim
|
| 32 |
type, bind(C) :: fftw${p}_iodim64
|
| 33 |
integer(C_INTPTR_T) n, is, os |
| 34 |
end type fftw${p}_iodim64
|
| 35 |
EOF |
| 36 |
|
| 37 |
echo |
| 38 |
echo " interface" |
| 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
|
| 40 |
echo " end interface" |
| 41 |
|
| 42 |
done |