forked from GitHub/gf-core
Improvements of "gf -server" mode and related setup
"gf -server" mode now contains everything needed to run the minibar and the grammar editor (including example-based grammar writing). The Setup.hs script installs the required files where gf -server can find them. These files have been moved to a new directory: src/www. The separate server program pgf-http is now obsolete.
This commit is contained in:
25
src/www/gfse/save.hs
Normal file
25
src/www/gfse/save.hs
Normal file
@@ -0,0 +1,25 @@
|
||||
import System(getArgs)
|
||||
import CGI(getQuery,string)
|
||||
import MUtils(apSnd)
|
||||
|
||||
main = save2 =<< getArgs
|
||||
|
||||
{-
|
||||
save1 [dir] =
|
||||
do fs@[ns,_] <- readIO =<< getContents
|
||||
nes <- save_all fs
|
||||
putStrLn $ unwords nes
|
||||
where
|
||||
save_all [ns,cs] = mapM (write1 dir) (zip ns cs)
|
||||
-}
|
||||
|
||||
write1 dir (n,c) =
|
||||
do writeFile (dir++"/"++ne) c
|
||||
return ne
|
||||
where
|
||||
ne=if '.' `elem` n then n else n++".gf"
|
||||
|
||||
save2 [dir] =
|
||||
do nfs <- getQuery
|
||||
nes <- mapM (write1 dir . apSnd string) nfs
|
||||
putStrLn $ unwords nes
|
||||
Reference in New Issue
Block a user