mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-13 05:02:50 -06:00
writePGF now allows to select list of languages
This commit is contained in:
@@ -188,11 +188,15 @@ newNGF abs_name mb_fpath =
|
||||
fptr <- newForeignPtrEnv pgf_free_revision c_db c_revision
|
||||
return (PGF c_db fptr Map.empty)
|
||||
|
||||
writePGF :: FilePath -> PGF -> IO ()
|
||||
writePGF fpath p =
|
||||
writePGF :: FilePath -> PGF -> Maybe [ConcName] -> IO ()
|
||||
writePGF fpath p mb_langs =
|
||||
withCString fpath $ \c_fpath ->
|
||||
withForeignPtr (a_revision p) $ \c_revision ->
|
||||
withPgfExn "writePGF" (pgf_write_pgf c_fpath (a_db p) c_revision)
|
||||
maybe (\f -> f nullPtr) (withLangs []) mb_langs $ \c_langs ->
|
||||
withPgfExn "writePGF" (pgf_write_pgf c_fpath (a_db p) c_revision c_langs)
|
||||
where
|
||||
withLangs clangs [] f = withArray0 nullPtr (reverse clangs) f
|
||||
withLangs clangs (lang:langs) f = withText lang $ \clang -> withLangs (clang:clangs) langs f
|
||||
|
||||
showPGF :: PGF -> String
|
||||
showPGF p =
|
||||
|
||||
@@ -78,7 +78,7 @@ foreign import ccall pgf_new_ngf :: Ptr PgfText -> CString -> Ptr (Ptr PGF) -> P
|
||||
|
||||
foreign import ccall pgf_merge_pgf :: Ptr PgfDB -> Ptr PGF -> CString -> Ptr PgfExn -> IO ()
|
||||
|
||||
foreign import ccall pgf_write_pgf :: CString -> Ptr PgfDB -> Ptr PGF -> Ptr PgfExn -> IO ()
|
||||
foreign import ccall pgf_write_pgf :: CString -> Ptr PgfDB -> Ptr PGF -> Ptr (Ptr PgfText) -> Ptr PgfExn -> IO ()
|
||||
|
||||
foreign import ccall "pgf_free_revision" pgf_free_revision_ :: Ptr PgfDB -> Ptr PGF -> IO ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user