diff options
Diffstat (limited to 'lib/Numeric')
-rw-r--r-- | lib/Numeric/GSL/Special/auto.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Special/autoall.sh | 53 | ||||
-rw-r--r-- | lib/Numeric/GSL/Special/replace.hs | 14 |
3 files changed, 45 insertions, 24 deletions
diff --git a/lib/Numeric/GSL/Special/auto.hs b/lib/Numeric/GSL/Special/auto.hs index 732fdc9..9785fe7 100644 --- a/lib/Numeric/GSL/Special/auto.hs +++ b/lib/Numeric/GSL/Special/auto.hs | |||
@@ -1,3 +1,5 @@ | |||
1 | #!/usr/bin/env runhaskell | ||
2 | |||
1 | -- automatic generation of wrappers for simple GSL special functions | 3 | -- automatic generation of wrappers for simple GSL special functions |
2 | 4 | ||
3 | import Text.ParserCombinators.Parsec | 5 | import Text.ParserCombinators.Parsec |
diff --git a/lib/Numeric/GSL/Special/autoall.sh b/lib/Numeric/GSL/Special/autoall.sh index d5f07e8..387b8e2 100644 --- a/lib/Numeric/GSL/Special/autoall.sh +++ b/lib/Numeric/GSL/Special/autoall.sh | |||
@@ -1,7 +1,10 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | #Airy.hs | 3 | function rep { |
4 | # include Precision (..) in the export list | 4 | ./replace.hs "$1" "$2" < $3 > /tmp/tmp-rep |
5 | cp /tmp/tmp-rep $3 | ||
6 | } | ||
7 | |||
5 | #Exp.hs | 8 | #Exp.hs |
6 | # remove extern inline definition, qualify name | 9 | # remove extern inline definition, qualify name |
7 | #Coupling | 10 | #Coupling |
@@ -13,29 +16,31 @@ | |||
13 | #Log.hs | 16 | #Log.hs |
14 | # remove extern inline, qualify name | 17 | # remove extern inline, qualify name |
15 | 18 | ||
16 | #runhaskell auto airy | 19 | ./auto.hs airy |
17 | runhaskell auto bessel | 20 | rep ') where' ', Precision(..)\n) where' Airy.hs |
18 | runhaskell auto clausen | 21 | ./auto.hs bessel |
19 | runhaskell auto coulomb | 22 | ./auto.hs clausen |
20 | #runhaskell auto coupling | 23 | ./auto.hs coulomb |
21 | runhaskell auto dawson | 24 | runhaskell auto coupling |
22 | runhaskell auto debye | 25 | rep ', coupling_6j_INCORRECT_e\n, coupling_6j_INCORRECT\n' '' Coupling.hs |
23 | runhaskell auto dilog | 26 | ./auto.hs dawson |
24 | runhaskell auto elementary | 27 | ./auto.hs debye |
25 | runhaskell auto ellint | 28 | ./auto.hs dilog |
26 | runhaskell auto erf | 29 | ./auto.hs elementary |
30 | ./auto.hs ellint | ||
31 | ./auto.hs erf | ||
27 | #runhaskell auto exp | 32 | #runhaskell auto exp |
28 | runhaskell auto expint | 33 | ./auto.hs expint |
29 | runhaskell auto fermi_dirac | 34 | ./auto.hs fermi_dirac |
30 | runhaskell auto gamma | 35 | ./auto.hs gamma |
31 | runhaskell auto gegenbauer | 36 | ./auto.hs gegenbauer |
32 | runhaskell auto hyperg | 37 | ./auto.hs hyperg |
33 | runhaskell auto laguerre | 38 | ./auto.hs laguerre |
34 | runhaskell auto lambert | 39 | ./auto.hs lambert |
35 | #runhaskell auto legendre legendre.h | 40 | #runhaskell auto legendre legendre.h |
36 | #runhaskell auto log | 41 | #runhaskell auto log |
37 | runhaskell auto pow_int | 42 | ./auto.hs pow_int |
38 | runhaskell auto psi | 43 | ./auto.hs psi |
39 | runhaskell auto synchrotron | 44 | ./auto.hs synchrotron |
40 | #runhaskell auto trig | 45 | #runhaskell auto trig |
41 | runhaskell auto zeta \ No newline at end of file | 46 | ./auto.hs zeta \ No newline at end of file |
diff --git a/lib/Numeric/GSL/Special/replace.hs b/lib/Numeric/GSL/Special/replace.hs new file mode 100644 index 0000000..f20a6b8 --- /dev/null +++ b/lib/Numeric/GSL/Special/replace.hs | |||
@@ -0,0 +1,14 @@ | |||
1 | #!/usr/bin/env runhaskell | ||
2 | |||
3 | import Data.List(isPrefixOf) | ||
4 | import System(getArgs) | ||
5 | |||
6 | rep (c,r) [] = [] | ||
7 | rep (c,r) f@(x:xs) | ||
8 | | c `isPrefixOf` f = r ++ rep (c,r) (drop (length c) f) | ||
9 | | otherwise = x:(rep (c,r) xs) | ||
10 | |||
11 | main = do | ||
12 | args <- getArgs | ||
13 | let [p',r'] = map (rep ("\\n","\n")) args | ||
14 | interact $ rep (p',r') | ||