summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind/PGF2.hsc
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-12-19 10:14:41 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-12-19 10:14:41 +0000
commit13f4af49109058986e744dc2173afad9ff0868f0 (patch)
tree8f1ee9bcec512cf409d1734335eba09227ce239e /src/runtime/haskell-bind/PGF2.hsc
parent856683f79f698d50555ef832adf00c15591f344c (diff)
bugfix and tiny optimization for callbacks from Haskell
Diffstat (limited to 'src/runtime/haskell-bind/PGF2.hsc')
-rw-r--r--src/runtime/haskell-bind/PGF2.hsc14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc
index aa752d4b0..44f9d2b1c 100644
--- a/src/runtime/haskell-bind/PGF2.hsc
+++ b/src/runtime/haskell-bind/PGF2.hsc
@@ -318,11 +318,8 @@ mkCallbacksMap concr callbacks pool = do
where
match_callback match _ clin_idx csentence poffset out_pool = do
sentence <- peekCString csentence
- coffset <- peek poffset
- offset <- alloca $ \pcsentence -> do
- poke pcsentence csentence
- gu2hs_string_offset pcsentence (plusPtr csentence (fromIntegral coffset)) 0
- case match (fromIntegral clin_idx) sentence offset of
+ coffset <- peek poffset
+ case match (fromIntegral clin_idx) sentence (fromIntegral coffset) of
Nothing -> return nullPtr
Just (e,prob,offset') -> do poke poffset (fromIntegral offset')
@@ -345,13 +342,6 @@ mkCallbacksMap concr callbacks pool = do
predict_callback _ _ _ _ = return nullPtr
- gu2hs_string_offset pcstart cend offset = do
- cstart <- peek pcstart
- if cstart < cend
- then do gu_utf8_decode pcstart
- gu2hs_string_offset pcstart cend (offset+1)
- else return offset
-
linearize :: Concr -> Expr -> String
linearize lang e = unsafePerformIO $
withGuPool $ \pl ->