summaryrefslogtreecommitdiff
path: root/examples/slowApp/MkApp.hs
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2015-06-02 12:59:29 +0000
committeraarne <aarne@chalmers.se>2015-06-02 12:59:29 +0000
commit3643e20406abf83d2a41d8d46dd5c66237ef1727 (patch)
tree0256c6bfd6b2a4b356ff5a648763b15d96c2cd48 /examples/slowApp/MkApp.hs
parenteb07e4e8622e11087c5f6c14cd35d1575fcea3a8 (diff)
copied examples/app to examples/slowApp; the new app is a bit scaled down but much faster
Diffstat (limited to 'examples/slowApp/MkApp.hs')
-rw-r--r--examples/slowApp/MkApp.hs35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/slowApp/MkApp.hs b/examples/slowApp/MkApp.hs
new file mode 100644
index 000000000..e53392feb
--- /dev/null
+++ b/examples/slowApp/MkApp.hs
@@ -0,0 +1,35 @@
+-- update the import list of every language
+-- although possibly some extra definitions at the end
+-- the new files are produced in ./tmp/
+-- usage: runghc MkApp.hs
+
+langs = words "Bul Cat Chi Dut Eng Fin Fre Ger Hin Ita Spa Swe"
+appCnc lang = "App" ++ lang ++ ".gf"
+
+appAbs = "App.gf"
+
+main = do
+ imports <- readFile appAbs >>= return . getImports
+ mapM_ (\f -> readFile f >>= writeFile ("tmp/" ++ f) . (putImports imports)) (map appCnc langs)
+
+getImports = takeWhile (/= ']') . tail . dropWhile (/='[')
+
+putImports i s =
+ let
+ (s1,_:s2) = span (/='[') s
+ (_, s3) = span (/=']') s2
+ in s1 ++ "[" ++ i ++ extra s3
+
+extra s = unlines (init (lines s) ++ extraLines ++ ["}"])
+
+extraLines = -- [] -- default: no extra
+
+ [
+ "",
+ "ComplV2V v np vp = mkVP v np vp ;",
+ "ComplV2A v np vp = mkVP v np vp ;",
+ "ComplV2Q v np vp = mkVP v np vp ;",
+ "ComplV2S v np vp = mkVP v np vp ;",
+ "ComplV3 v np vp = mkVP v np vp ;",
+ ""
+ ] \ No newline at end of file