diff options
| author | krangelov <kr.angelov@gmail.com> | 2021-07-26 16:52:11 +0200 |
|---|---|---|
| committer | krangelov <kr.angelov@gmail.com> | 2021-07-26 16:52:11 +0200 |
| commit | e47042424ee2450c69c509601ddc3c1cc8cd9a39 (patch) | |
| tree | 5cfad2acca46f8c9aafa3a5f97600ae26bbe0e1c /src/runtime | |
| parent | ecf309a28e9935923308da4b6aa2b1cc6c4b52e2 (diff) | |
| parent | d0a881f9038d2ca1620e0d95f90c297a452774d5 (diff) | |
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/c/INSTALL | 7 | ||||
| -rwxr-xr-x | src/runtime/c/install.sh | 3 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/PGF2/Expr.hsc | 14 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/pgf2.cabal | 22 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/stack-ghc7.10.3.yaml | 3 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/stack-ghc8.0.2.yaml | 1 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/stack-ghc8.10.4.yaml | 1 | ||||
| -rw-r--r-- | src/runtime/haskell/Data/Binary/Builder.hs | 4 | ||||
| -rw-r--r-- | src/runtime/haskell/Data/Binary/Get.hs | 2 | ||||
| -rw-r--r-- | src/runtime/haskell/PGF/Binary.hs | 3 | ||||
| -rw-r--r-- | src/runtime/haskell/PGF/TypeCheck.hs | 2 | ||||
| -rw-r--r-- | src/runtime/haskell/pgf.cabal | 37 | ||||
| -rw-r--r-- | src/runtime/haskell/stack-ghc7.10.3.yaml | 3 | ||||
| -rw-r--r-- | src/runtime/haskell/stack-ghc8.0.2.yaml | 1 | ||||
| -rw-r--r-- | src/runtime/haskell/stack-ghc8.10.4.yaml | 1 |
15 files changed, 64 insertions, 40 deletions
diff --git a/src/runtime/c/INSTALL b/src/runtime/c/INSTALL index 6bbaefdce..c45c18fa9 100644 --- a/src/runtime/c/INSTALL +++ b/src/runtime/c/INSTALL @@ -14,6 +14,9 @@ For Linux users You will need the packages: autoconf, automake, libtool, make +- On Ubuntu: $ apt-get install autotools-dev +- On Fedora: $ dnf install autoconf automake libtool + The compilation steps are: $ autoreconf -i @@ -28,7 +31,7 @@ For Mac OSX users The following is what I did to make it work on MacOSX 10.8: - Install XCode and XCode command line tools -- Install Homebrew: http://mxcl.github.com/homebrew/ +- Install Homebrew: https://brew.sh $ brew install automake autoconf libtool $ glibtoolize @@ -49,7 +52,7 @@ For Windows users After the installation, don't forget to fix the fstab file. See here: http://www.mingw.org/wiki/Getting_Started -- From the MSYS shell (c:/MinGW/msys/1.0/msys.bat) go to the directory +- From the MSYS shell (c:/MinGW/msys/1.0/msys.bat) go to the directory which contains the INSTALL file and do: $ autoreconf -i diff --git a/src/runtime/c/install.sh b/src/runtime/c/install.sh new file mode 100755 index 000000000..78483719d --- /dev/null +++ b/src/runtime/c/install.sh @@ -0,0 +1,3 @@ +bash setup.sh configure +bash setup.sh build +bash setup.sh install diff --git a/src/runtime/haskell-bind/PGF2/Expr.hsc b/src/runtime/haskell-bind/PGF2/Expr.hsc index 85e55ab40..35ee628d1 100644 --- a/src/runtime/haskell-bind/PGF2/Expr.hsc +++ b/src/runtime/haskell-bind/PGF2/Expr.hsc @@ -19,7 +19,7 @@ wildCId = "_" :: CId type Cat = CId -- ^ Name of syntactic category type Fun = CId -- ^ Name of function -data BindType = +data BindType = Explicit | Implicit deriving Show @@ -38,7 +38,7 @@ instance Show Expr where show = showExpr [] instance Eq Expr where - (Expr e1 e1_touch) == (Expr e2 e2_touch) = + (Expr e1 e1_touch) == (Expr e2 e2_touch) = unsafePerformIO $ do res <- pgf_expr_eq e1 e2 e1_touch >> e2_touch @@ -113,9 +113,9 @@ unApp (Expr expr touch) = appl <- pgf_expr_unapply expr pl if appl == nullPtr then return Nothing - else do + else do fun <- peekCString =<< (#peek PgfApplication, fun) appl - arity <- (#peek PgfApplication, n_args) appl :: IO CInt + arity <- (#peek PgfApplication, n_args) appl :: IO CInt c_args <- peekArray (fromIntegral arity) (appl `plusPtr` (#offset PgfApplication, args)) return $ Just (fun, [Expr c_arg touch | c_arg <- c_args]) @@ -140,7 +140,9 @@ unStr (Expr expr touch) = touch return (Just s) --- | Constructs an expression from an integer literal +-- | Constructs an expression from an integer literal. +-- Note that the C runtime does not support long integers, and you may run into overflow issues with large values. +-- See [here](https://github.com/GrammaticalFramework/gf-core/issues/109) for more details. mkInt :: Int -> Expr mkInt val = unsafePerformIO $ do @@ -267,7 +269,7 @@ foreign import ccall "wrapper" -- in the expression in order reverse to the order -- of binding. showExpr :: [CId] -> Expr -> String -showExpr scope e = +showExpr scope e = unsafePerformIO $ withGuPool $ \tmpPl -> do (sb,out) <- newOut tmpPl diff --git a/src/runtime/haskell-bind/pgf2.cabal b/src/runtime/haskell-bind/pgf2.cabal index 91e77c77b..1d5f61991 100644 --- a/src/runtime/haskell-bind/pgf2.cabal +++ b/src/runtime/haskell-bind/pgf2.cabal @@ -1,19 +1,21 @@ name: pgf2 version: 1.3.0 + +cabal-version: 1.22 +build-type: Simple +license: LGPL-3 +license-file: LICENSE +category: Natural Language Processing synopsis: Bindings to the C version of the PGF runtime description: GF, Grammatical Framework, is a programming language for multilingual grammar applications. GF grammars are compiled into Portable Grammar Format (PGF) which can be used with the PGF runtime, written in C. This package provides Haskell bindings to that runtime. -homepage: https://www.grammaticalframework.org -license: LGPL-3 -license-file: LICENSE +homepage: https://www.grammaticalframework.org/ +bug-reports: https://github.com/GrammaticalFramework/gf-core/issues author: Krasimir Angelov -maintainer: kr.angelov@gmail.com -category: Language -build-type: Simple extra-source-files: CHANGELOG.md, README.md -cabal-version: >=1.10 +tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4 library exposed-modules: @@ -24,9 +26,9 @@ library PGF2.Expr, PGF2.Type build-depends: - base >=4.3 && <5, - containers, - pretty + base >= 4.9.1 && < 4.15, + containers >= 0.5.7 && < 0.7, + pretty >= 1.1.3 && < 1.2 default-language: Haskell2010 build-tools: hsc2hs extra-libraries: pgf gu diff --git a/src/runtime/haskell-bind/stack-ghc7.10.3.yaml b/src/runtime/haskell-bind/stack-ghc7.10.3.yaml new file mode 100644 index 000000000..c916b4bb0 --- /dev/null +++ b/src/runtime/haskell-bind/stack-ghc7.10.3.yaml @@ -0,0 +1,3 @@ +resolver: lts-6.35 # ghc 7.10.3 + +allow-newer: true diff --git a/src/runtime/haskell-bind/stack-ghc8.0.2.yaml b/src/runtime/haskell-bind/stack-ghc8.0.2.yaml new file mode 100644 index 000000000..af08206d9 --- /dev/null +++ b/src/runtime/haskell-bind/stack-ghc8.0.2.yaml @@ -0,0 +1 @@ +resolver: lts-9.21 # ghc 8.0.2 diff --git a/src/runtime/haskell-bind/stack-ghc8.10.4.yaml b/src/runtime/haskell-bind/stack-ghc8.10.4.yaml new file mode 100644 index 000000000..195e90993 --- /dev/null +++ b/src/runtime/haskell-bind/stack-ghc8.10.4.yaml @@ -0,0 +1 @@ +resolver: lts-18.0 # ghc 8.10.4 diff --git a/src/runtime/haskell/Data/Binary/Builder.hs b/src/runtime/haskell/Data/Binary/Builder.hs index b69371f0e..a74428f20 100644 --- a/src/runtime/haskell/Data/Binary/Builder.hs +++ b/src/runtime/haskell/Data/Binary/Builder.hs @@ -68,7 +68,7 @@ import qualified Data.ByteString.Lazy as L import Data.ByteString.Base (inlinePerformIO) import qualified Data.ByteString.Base as S #else -import Data.ByteString.Internal (inlinePerformIO) +import Data.ByteString.Internal (accursedUnutterablePerformIO) import qualified Data.ByteString.Internal as S --import qualified Data.ByteString.Lazy.Internal as L #endif @@ -199,7 +199,7 @@ defaultSize = 32 * k - overhead -- | Sequence an IO operation on the buffer unsafeLiftIO :: (Buffer -> IO Buffer) -> Builder -unsafeLiftIO f = Builder $ \ k buf -> inlinePerformIO $ do +unsafeLiftIO f = Builder $ \ k buf -> accursedUnutterablePerformIO $ do buf' <- f buf return (k buf') {-# INLINE unsafeLiftIO #-} diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index 01561d7d9..54f17ae95 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -423,7 +423,7 @@ readN n f = fmap f $ getBytes n getPtr :: Storable a => Int -> Get a getPtr n = do (fp,o,_) <- readN n B.toForeignPtr - return . B.inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o) + return . B.accursedUnutterablePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o) {- INLINE getPtr -} ------------------------------------------------------------------------ diff --git a/src/runtime/haskell/PGF/Binary.hs b/src/runtime/haskell/PGF/Binary.hs index e0e50f4be..a78472ea9 100644 --- a/src/runtime/haskell/PGF/Binary.hs +++ b/src/runtime/haskell/PGF/Binary.hs @@ -28,7 +28,7 @@ instance Binary PGF where let v = (major,minor)
if major==pgfMajorVersion && minor<=pgfMinorVersion
then getPGF'
- else if v==Old.version
+ else if v==Old.version
then Old.getPGF'
else fail $ "Unsupported PGF version "++show (major,minor)
@@ -185,6 +185,7 @@ instance Binary Instr where put (PUSH_ACCUM (LFlt d)) = putWord8 78 >> put d
put (POP_ACCUM ) = putWord8 80
put (ADD ) = putWord8 84
+ get = fail "Missing implementation for ‘get’ in the instance declaration for ‘Binary Instr’"
instance Binary Type where
put (DTyp hypos cat exps) = put (hypos,cat,exps)
diff --git a/src/runtime/haskell/PGF/TypeCheck.hs b/src/runtime/haskell/PGF/TypeCheck.hs index 5db4ef439..c5cc44b4e 100644 --- a/src/runtime/haskell/PGF/TypeCheck.hs +++ b/src/runtime/haskell/PGF/TypeCheck.hs @@ -41,7 +41,7 @@ import Control.Applicative import Control.Monad --import Control.Monad.Identity import Control.Monad.State -import Control.Monad.Error +import Control.Monad.Except import Text.PrettyPrint ----------------------------------------------------- diff --git a/src/runtime/haskell/pgf.cabal b/src/runtime/haskell/pgf.cabal index 76e12bd2c..41e67f6ae 100644 --- a/src/runtime/haskell/pgf.cabal +++ b/src/runtime/haskell/pgf.cabal @@ -1,28 +1,32 @@ name: pgf -version: 3.10 +version: 3.11.0-git -cabal-version: >= 1.20 +cabal-version: 1.22 build-type: Simple license: OtherLicense category: Natural Language Processing synopsis: Grammatical Framework description: A library for interpreting the Portable Grammar Format (PGF) -homepage: http://www.grammaticalframework.org/ +homepage: https://www.grammaticalframework.org/ bug-reports: https://github.com/GrammaticalFramework/gf-core/issues -maintainer: Thomas Hallgren -tested-with: GHC==7.6.3, GHC==7.8.3, GHC==7.10.3, GHC==8.0.2 +tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4 -Library - default-language: Haskell2010 - build-depends: base >= 4.6 && <5, - array, - containers, - bytestring, - utf8-string, - random, - pretty, - mtl, - exceptions +library + default-language: Haskell2010 + build-depends: + array >= 0.5.1 && < 0.6, + base >= 4.9.1 && < 4.15, + bytestring >= 0.10.8 && < 0.11, + containers >= 0.5.7 && < 0.7, + ghc-prim >= 0.5.0 && < 0.7, + mtl >= 2.2.1 && < 2.3, + pretty >= 1.1.3 && < 1.2, + random >= 1.1 && < 1.3, + utf8-string >= 1.0.1.1 && < 1.1 + + if impl(ghc<8.0) + build-depends: + fail >= 4.9.0 && < 4.10 other-modules: -- not really part of GF but I have changed the original binary library @@ -37,7 +41,6 @@ Library --if impl(ghc>=7.8) -- ghc-options: +RTS -A20M -RTS ghc-prof-options: -fprof-auto - extensions: exposed-modules: PGF diff --git a/src/runtime/haskell/stack-ghc7.10.3.yaml b/src/runtime/haskell/stack-ghc7.10.3.yaml new file mode 100644 index 000000000..c916b4bb0 --- /dev/null +++ b/src/runtime/haskell/stack-ghc7.10.3.yaml @@ -0,0 +1,3 @@ +resolver: lts-6.35 # ghc 7.10.3 + +allow-newer: true diff --git a/src/runtime/haskell/stack-ghc8.0.2.yaml b/src/runtime/haskell/stack-ghc8.0.2.yaml new file mode 100644 index 000000000..af08206d9 --- /dev/null +++ b/src/runtime/haskell/stack-ghc8.0.2.yaml @@ -0,0 +1 @@ +resolver: lts-9.21 # ghc 8.0.2 diff --git a/src/runtime/haskell/stack-ghc8.10.4.yaml b/src/runtime/haskell/stack-ghc8.10.4.yaml new file mode 100644 index 000000000..195e90993 --- /dev/null +++ b/src/runtime/haskell/stack-ghc8.10.4.yaml @@ -0,0 +1 @@ +resolver: lts-18.0 # ghc 8.10.4 |
