diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-09-13 10:27:17 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-09-13 10:27:17 +0000 |
commit | 620d5008ea9a931a91907cd0c902bb64f005121f (patch) | |
tree | 7dd55acefdc49cbe1513fb0b1fbf60f954d3d364 /lib/GSL/Special/auto.hs | |
parent | 0ff13d993b880739295de343bca62f06fac5ca0c (diff) |
automatic google search in the docs for the special functions
Diffstat (limited to 'lib/GSL/Special/auto.hs')
-rw-r--r-- | lib/GSL/Special/auto.hs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/GSL/Special/auto.hs b/lib/GSL/Special/auto.hs index a6a0f9a..0ef7d0a 100644 --- a/lib/GSL/Special/auto.hs +++ b/lib/GSL/Special/auto.hs | |||
@@ -42,9 +42,14 @@ fixC s = rep ("gsl_mode_t","int") $ rep ("gsl_sf_result","double") $ rep ("gsl_s | |||
42 | 42 | ||
43 | main = do | 43 | main = do |
44 | args <- getArgs | 44 | args <- getArgs |
45 | file <- readFile (args!!1) | ||
46 | let name = args!!0 | 45 | let name = args!!0 |
47 | putStrLn (args!!1) | 46 | headerfile = |
47 | case args of | ||
48 | [n] -> "/usr/include/gsl/gsl_sf_"++n++".h" | ||
49 | [_,f] -> f | ||
50 | file <- readFile headerfile | ||
51 | |||
52 | putStrLn headerfile | ||
48 | --mapM_ print (headers $ fixlong file) | 53 | --mapM_ print (headers $ fixlong file) |
49 | let parsed = (headers $ fixlong file) | 54 | let parsed = (headers $ fixlong file) |
50 | writeFile (name ++".h") (fixC $ unlines $ map showC parsed) | 55 | writeFile (name ++".h") (fixC $ unlines $ map showC parsed) |
@@ -60,6 +65,10 @@ main = do | |||
60 | writeFile (upperFirst name ++ ".hs") mod | 65 | writeFile (upperFirst name ++ ".hs") mod |
61 | 66 | ||
62 | 67 | ||
68 | google name = "<http://www.google.com/search?q=" | ||
69 | ++name | ||
70 | ++"&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>" | ||
71 | |||
63 | modhead name = replicate 60 '-' ++ "\n" | 72 | modhead name = replicate 60 '-' ++ "\n" |
64 | ++"{- |\n" | 73 | ++"{- |\n" |
65 | ++"Module : GSL.Special."++upperFirst name++"\n" | 74 | ++"Module : GSL.Special."++upperFirst name++"\n" |
@@ -68,7 +77,9 @@ modhead name = replicate 60 '-' ++ "\n" | |||
68 | ++"Maintainer : Alberto Ruiz (aruiz at um dot es)\n" | 77 | ++"Maintainer : Alberto Ruiz (aruiz at um dot es)\n" |
69 | ++"Stability : provisional\n" | 78 | ++"Stability : provisional\n" |
70 | ++"Portability : uses ffi\n" | 79 | ++"Portability : uses ffi\n" |
71 | ++"\n\n\n-}\n" | 80 | ++"\nWrappers for selected functions described at:\n\n" |
81 | ++ google ( "gsl_sf_"++name++".h") | ||
82 | ++"\n\n-}\n" | ||
72 | ++ replicate 60 '-' ++ "\n\n" | 83 | ++ replicate 60 '-' ++ "\n\n" |
73 | 84 | ||
74 | upperFirst (x:xs) = toUpper x : xs | 85 | upperFirst (x:xs) = toUpper x : xs |
@@ -176,7 +187,10 @@ showHt (Pointer (s:ss)) = "Ptr "++toUpper s : ss | |||
176 | 187 | ||
177 | showHa (t,a) = showHt t | 188 | showHa (t,a) = showHt t |
178 | 189 | ||
179 | showFull hc h@(Header t n args) = "\n-- | wrapper for "++showC h++"\n"++ boiler h ++"\n" ++showH hc h | 190 | showFull hc h@(Header t n args) = "\n-- | wrapper for "++showC h |
191 | ++"\n--\n-- "++google n ++"\n" | ||
192 | ++ boiler h ++"\n" | ||
193 | ++showH hc h | ||
180 | 194 | ||
181 | fixmd1 = rep ("Gsl_mode_t","Precision") | 195 | fixmd1 = rep ("Gsl_mode_t","Precision") |
182 | fixmd2 = rep ("mode"," (precCode mode)") | 196 | fixmd2 = rep ("mode"," (precCode mode)") |