diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2017-10-04 09:45:56 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2017-10-04 09:45:56 +0200 |
| commit | e3aa392e63b0d0f314b286d207cd187be5837ad8 (patch) | |
| tree | 65bbe804e9997669982550859178e69b64f27968 /src/runtime/haskell-bind/PGF2.hsc | |
| parent | e426e87cf8a0eb722e4ffc2239d864d53f5e476f (diff) | |
further extend the API of the C runtime
Diffstat (limited to 'src/runtime/haskell-bind/PGF2.hsc')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2.hsc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 6ffa6ff37..409283981 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -45,7 +45,7 @@ module PGF2 (-- * PGF -- ** Types Type, Hypo, BindType(..), startCat, - readType, showType, + readType, showType, showContext, mkType, unType, -- ** Type checking @@ -1083,8 +1083,7 @@ categoryContext :: PGF -> Cat -> [Hypo] categoryContext p cat = unsafePerformIO $ withGuPool $ \tmpPl -> - do (sb,out) <- newOut tmpPl - c_cat <- newUtf8CString cat tmpPl + do c_cat <- newUtf8CString cat tmpPl c_hypos <- pgf_category_context (pgf p) c_cat if c_hypos == nullPtr then return [] @@ -1104,6 +1103,15 @@ categoryContext p cat = toBindType (#const PGF_BIND_TYPE_EXPLICIT) = Explicit toBindType (#const PGF_BIND_TYPE_IMPLICIT) = Implicit +categoryProb :: PGF -> Cat -> Float +categoryProb p cat = + unsafePerformIO $ + withGuPool $ \tmpPl -> + do c_cat <- newUtf8CString cat tmpPl + c_prob <- pgf_category_prob (pgf p) c_cat + touchPGF p + return (realToFrac c_prob) + ----------------------------------------------------------------------------- -- Helper functions |
