diff options
Diffstat (limited to 'packages/special/lib/Numeric/GSL/Special/auto.hs')
-rwxr-xr-x | packages/special/lib/Numeric/GSL/Special/auto.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/special/lib/Numeric/GSL/Special/auto.hs b/packages/special/lib/Numeric/GSL/Special/auto.hs index b6276b2..36947ad 100755 --- a/packages/special/lib/Numeric/GSL/Special/auto.hs +++ b/packages/special/lib/Numeric/GSL/Special/auto.hs | |||
@@ -2,8 +2,10 @@ | |||
2 | 2 | ||
3 | -- automatic generation of wrappers for simple GSL special functions | 3 | -- automatic generation of wrappers for simple GSL special functions |
4 | 4 | ||
5 | {-# LANGUAGE NoMonomorphismRestriction #-} | ||
6 | |||
5 | import Text.ParserCombinators.Parsec | 7 | import Text.ParserCombinators.Parsec |
6 | import System | 8 | import System.Environment(getArgs) |
7 | import Data.List(intersperse, isPrefixOf) | 9 | import Data.List(intersperse, isPrefixOf) |
8 | import Data.Char(toUpper,isUpper,toLower) | 10 | import Data.Char(toUpper,isUpper,toLower) |
9 | 11 | ||
@@ -64,7 +66,7 @@ main = do | |||
64 | let exports = rep (")",") where") $ rep ("(\n","(\n ") $ rep (",\n",", ") $ unlines $ ["("]++intersperse "," (map (\(Header _ n _) -> hName n) (filter safe parsed))++[")"] | 66 | let exports = rep (")",") where") $ rep ("(\n","(\n ") $ rep (",\n",", ") $ unlines $ ["("]++intersperse "," (map (\(Header _ n _) -> hName n) (filter safe parsed))++[")"] |
65 | let defs = unlines $ map (showFull (name ++".h")) parsed | 67 | let defs = unlines $ map (showFull (name ++".h")) parsed |
66 | let imports = "\nimport Foreign(Ptr)\n" | 68 | let imports = "\nimport Foreign(Ptr)\n" |
67 | ++"import Foreign.C.Types(CInt)\n" | 69 | ++"import Foreign.C.Types\n" |
68 | ++"import Numeric.GSL.Special.Internal\n" | 70 | ++"import Numeric.GSL.Special.Internal\n" |
69 | let mod = modhead name ++ "module Numeric.GSL.Special."++ upperFirst name++exports++imports++defs | 71 | let mod = modhead name ++ "module Numeric.GSL.Special."++ upperFirst name++exports++imports++defs |
70 | writeFile (upperFirst name ++ ".hs") mod | 72 | writeFile (upperFirst name ++ ".hs") mod |
@@ -80,7 +82,7 @@ google name = "<http://www.google.com/search?q=" | |||
80 | 82 | ||
81 | modhead name = replicate 60 '-' ++ "\n-- |\n" | 83 | modhead name = replicate 60 '-' ++ "\n-- |\n" |
82 | ++"-- Module : Numeric.GSL.Special."++upperFirst name++"\n" | 84 | ++"-- Module : Numeric.GSL.Special."++upperFirst name++"\n" |
83 | ++"-- Copyright : (c) Alberto Ruiz 2006\n" | 85 | ++"-- Copyright : (c) Alberto Ruiz 2006-11\n" |
84 | ++"-- License : GPL\n" | 86 | ++"-- License : GPL\n" |
85 | ++"-- Maintainer : Alberto Ruiz (aruiz at um dot es)\n" | 87 | ++"-- Maintainer : Alberto Ruiz (aruiz at um dot es)\n" |
86 | ++"-- Stability : provisional\n" | 88 | ++"-- Stability : provisional\n" |