diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2017-08-30 15:59:43 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2017-08-30 15:59:43 +0200 |
| commit | 08a728799a8920fc3d82cdb8c1bdba99a0d1afdf (patch) | |
| tree | 0a027f963a5b78997a5f284a080ff376fff8cbd0 | |
| parent | 97fe5df267dc7e5611a5a93699d031727165bd2a (diff) | |
change tabularLinearize in the Haskell binding to return a list instead of map this preserves the order
| -rw-r--r-- | doc/runtime-api.html | 2 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/PGF2.hsc | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/doc/runtime-api.html b/doc/runtime-api.html index a441703f7..31a5b623d 100644 --- a/doc/runtime-api.html +++ b/doc/runtime-api.html @@ -363,7 +363,7 @@ then the right method to use is <tt>tabularLinearize</tt>: </pre> <pre class="haskell"> Prelude PGF2> tabularLinearize eng e -fromList [("s Pl Gen","red theatres'"),("s Pl Nom","red theatres"),("s Sg Gen","red theatre's"),("s Sg Nom","red theatre")] +[("s Sg Nom","red theatre"),("s Sg Gen","red theatre's"),("s Pl Nom","red theatres"),("s Pl Gen","red theatres'")] </pre> <pre class="java"> for (Map.Entry<String,String> entry : eng.tabularLinearize(e).entrySet()) { diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 104d06cb1..7ebba4846 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -648,7 +648,7 @@ linearizeAll lang e = unsafePerformIO $ throwIO (PGFError "The abstract tree cannot be linearized") -- | Generates a table of linearizations for an expression -tabularLinearize :: Concr -> Expr -> Map.Map String String +tabularLinearize :: Concr -> Expr -> [(String, String)] tabularLinearize lang e = unsafePerformIO $ withGuPool $ \tmpPl -> do exn <- gu_new_exn tmpPl @@ -660,7 +660,7 @@ tabularLinearize lang e = unsafePerformIO $ peek ptr if ctree == nullPtr then do touchExpr e - return Map.empty + return [] else do labels <- alloca $ \p_n_lins -> alloca $ \p_labels -> do pgf_lzr_get_table (concr lang) ctree p_n_lins p_labels @@ -670,7 +670,7 @@ tabularLinearize lang e = unsafePerformIO $ labels <- mapM peekCString labels return labels lins <- collect lang ctree 0 labels exn tmpPl - return (Map.fromList lins) + return lins where collect lang ctree lin_idx [] exn tmpPl = return [] collect lang ctree lin_idx (label:labels) exn tmpPl = do |
