cannam@167
|
1 #! /bin/sh
|
cannam@167
|
2
|
cannam@167
|
3 if test "x$1" = "x--help" || test "x$1" = "x-h"; then
|
cannam@167
|
4 cat <<EOF
|
cannam@167
|
5 Usage: fftw-wisdom-to-conf [OPTIONS] [< INPUT] [> OUTPUT]
|
cannam@167
|
6 Convert wisdom (stdin) to C configuration routine (stdout).
|
cannam@167
|
7
|
cannam@167
|
8 Options:
|
cannam@167
|
9 -h, --help: print this help
|
cannam@167
|
10 -V, --version: print version/copyright info
|
cannam@167
|
11 EOF
|
cannam@167
|
12 exit 0
|
cannam@167
|
13 fi
|
cannam@167
|
14
|
cannam@167
|
15 if test "x$1" = "x--version" || test "x$1" = "x-V"; then
|
cannam@167
|
16 cat <<EOF
|
cannam@167
|
17 fftw-wisdom-to-conf from FFTW version @VERSION@
|
cannam@167
|
18
|
cannam@167
|
19 Copyright (c) 2003, 2007-14 Matteo Frigo
|
cannam@167
|
20 Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
|
cannam@167
|
21
|
cannam@167
|
22 This program is free software; you can redistribute it and/or modify
|
cannam@167
|
23 it under the terms of the GNU General Public License as published by
|
cannam@167
|
24 the Free Software Foundation; either version 2 of the License, or
|
cannam@167
|
25 (at your option) any later version.
|
cannam@167
|
26
|
cannam@167
|
27 This program is distributed in the hope that it will be useful,
|
cannam@167
|
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
cannam@167
|
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
cannam@167
|
30 GNU General Public License for more details.
|
cannam@167
|
31
|
cannam@167
|
32 You should have received a copy of the GNU General Public License
|
cannam@167
|
33 along with this program; if not, write to the Free Software
|
cannam@167
|
34 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
cannam@167
|
35 EOF
|
cannam@167
|
36 exit 0
|
cannam@167
|
37 fi
|
cannam@167
|
38
|
cannam@167
|
39 read preamble fftw_wisdom
|
cannam@167
|
40
|
cannam@167
|
41 case "$preamble $fftw_wisdom" in
|
cannam@167
|
42 \(@PACKAGE@-@VERSION@\ *_wisdom*)
|
cannam@167
|
43 prefix=`echo $fftw_wisdom | cut -d_ -f1`_
|
cannam@167
|
44 ;;
|
cannam@167
|
45 *)
|
cannam@167
|
46 echo "fftw-wisdom-to-conf: invalid wisdom" 1>&2
|
cannam@167
|
47 exit 1
|
cannam@167
|
48 ;;
|
cannam@167
|
49 esac
|
cannam@167
|
50
|
cannam@167
|
51 cat <<EOF
|
cannam@167
|
52 /* Automatically generated by fftw-wisdom-to-conf from @PACKAGE@ @VERSION@.
|
cannam@167
|
53 DO NOT EDIT! (Unless you really, really want to. Then it's okay.) */
|
cannam@167
|
54 void ${prefix}configure_planner(void *plnr)
|
cannam@167
|
55 {
|
cannam@167
|
56 struct solvtab_s { void (*reg)(void *); const char *reg_nam; };
|
cannam@167
|
57 extern void ${prefix}solvtab_exec(const struct solvtab_s s[], void *);
|
cannam@167
|
58
|
cannam@167
|
59 #define DECLARE(name) extern void name(void *);
|
cannam@167
|
60 #define STRINGIZEx(x) #x
|
cannam@167
|
61 #define STRINGIZE(x) STRINGIZEx(x)
|
cannam@167
|
62 #define SOLVTAB(s) { s, STRINGIZE(s) },
|
cannam@167
|
63 #define DO(X) \\
|
cannam@167
|
64 EOF
|
cannam@167
|
65
|
cannam@167
|
66 sed 's/ *(//' | cut -d" " -f1 | grep -v -- - | egrep -v '^ *\)*$' | sort | uniq | while read reg_nam; do
|
cannam@167
|
67 printf ' X(%s)\\\n' "$reg_nam"
|
cannam@167
|
68 done
|
cannam@167
|
69
|
cannam@167
|
70 cat <<EOF
|
cannam@167
|
71 /* end DO(X) */
|
cannam@167
|
72
|
cannam@167
|
73 DO(DECLARE)
|
cannam@167
|
74
|
cannam@167
|
75 const struct solvtab_s s[] = {
|
cannam@167
|
76 DO(SOLVTAB)
|
cannam@167
|
77 { 0, 0 }
|
cannam@167
|
78 };
|
cannam@167
|
79
|
cannam@167
|
80 ${prefix}solvtab_exec(s, plnr);
|
cannam@167
|
81 }
|
cannam@167
|
82 EOF
|