cleanup the code for the FFI binding. The API is now more uniform with the Python and the Java bindings. Fixed a lot of memory leaks.

This commit is contained in:
kr.angelov
2014-02-09 20:45:11 +00:00
parent f30c60c3d7
commit adeeb47e06
7 changed files with 312 additions and 571 deletions

View File

@@ -13,9 +13,9 @@ import qualified Data.Map as M
import System.IO(hFlush,stdout)
import System.IO.Error(catchIOError)
import System.Environment
import CRuntimeFFI
import CId
import PGF2
import System.Mem(performGC)
import qualified Data.Map as Map
main = getPGF =<< getArgs
@@ -42,13 +42,13 @@ execute pgf cmd =
getConcr' pgf lang =
maybe (fail $ "Concrete syntax not found: "++show lang) return $
getConcr pgf lang
Map.lookup lang (languages pgf)
printl xs = putl $ map show xs
putl = putStr . unlines
-- | Abstracy syntax of shell commands
data Command = P CId String | L CId Tree | T CId CId String deriving Show
data Command = P String String | L String Expr | T String String String deriving Show
-- | Shell command parser
instance Read Command where