From bac0db0bb1a25aa8be87a79492517aa8098670e6 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 1 Feb 2008 13:29:30 +0000 Subject: improved autoall --- lib/Numeric/GSL/Special/auto.hs | 2 ++ lib/Numeric/GSL/Special/autoall.sh | 53 +++++++++++++++++++++----------------- lib/Numeric/GSL/Special/replace.hs | 14 ++++++++++ 3 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 lib/Numeric/GSL/Special/replace.hs (limited to 'lib/Numeric') 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 @@ +#!/usr/bin/env runhaskell + -- automatic generation of wrappers for simple GSL special functions 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 @@ #!/bin/bash -#Airy.hs -# include Precision (..) in the export list +function rep { + ./replace.hs "$1" "$2" < $3 > /tmp/tmp-rep + cp /tmp/tmp-rep $3 +} + #Exp.hs # remove extern inline definition, qualify name #Coupling @@ -13,29 +16,31 @@ #Log.hs # remove extern inline, qualify name -#runhaskell auto airy -runhaskell auto bessel -runhaskell auto clausen -runhaskell auto coulomb -#runhaskell auto coupling -runhaskell auto dawson -runhaskell auto debye -runhaskell auto dilog -runhaskell auto elementary -runhaskell auto ellint -runhaskell auto erf +./auto.hs airy +rep ') where' ', Precision(..)\n) where' Airy.hs +./auto.hs bessel +./auto.hs clausen +./auto.hs coulomb +runhaskell auto coupling +rep ', coupling_6j_INCORRECT_e\n, coupling_6j_INCORRECT\n' '' Coupling.hs +./auto.hs dawson +./auto.hs debye +./auto.hs dilog +./auto.hs elementary +./auto.hs ellint +./auto.hs erf #runhaskell auto exp -runhaskell auto expint -runhaskell auto fermi_dirac -runhaskell auto gamma -runhaskell auto gegenbauer -runhaskell auto hyperg -runhaskell auto laguerre -runhaskell auto lambert +./auto.hs expint +./auto.hs fermi_dirac +./auto.hs gamma +./auto.hs gegenbauer +./auto.hs hyperg +./auto.hs laguerre +./auto.hs lambert #runhaskell auto legendre legendre.h #runhaskell auto log -runhaskell auto pow_int -runhaskell auto psi -runhaskell auto synchrotron +./auto.hs pow_int +./auto.hs psi +./auto.hs synchrotron #runhaskell auto trig -runhaskell auto zeta \ No newline at end of file +./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 @@ +#!/usr/bin/env runhaskell + +import Data.List(isPrefixOf) +import System(getArgs) + +rep (c,r) [] = [] +rep (c,r) f@(x:xs) + | c `isPrefixOf` f = r ++ rep (c,r) (drop (length c) f) + | otherwise = x:(rep (c,r) xs) + +main = do + args <- getArgs + let [p',r'] = map (rep ("\\n","\n")) args + interact $ rep (p',r') -- cgit v1.2.3