diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2017-09-25 18:31:36 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2017-09-25 18:31:36 +0200 |
| commit | 404154d16b2fea65e05395e4326ee9c105339e41 (patch) | |
| tree | 0ec8ccd75b328046892f09b99a0847cb0fdcd039 /src/runtime/haskell-bind | |
| parent | d79ac5687024252eb03a0bfe567f2b9d239546f9 (diff) | |
added showPGF in the Haskell API
Diffstat (limited to 'src/runtime/haskell-bind')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2.hsc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 0d65822f9..e1b0acd03 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -19,7 +19,7 @@ #include <gu/exn.h> module PGF2 (-- * PGF - PGF,readPGF, + PGF,readPGF,showPGF, -- * Identifiers CId, @@ -137,6 +137,17 @@ readPGF fpath = pgfFPtr <- newForeignPtr gu_pool_finalizer pool return (PGF pgf (touchForeignPtr pgfFPtr)) +showPGF :: PGF -> String +showPGF p = + unsafePerformIO $ + withGuPool $ \tmpPl -> + do (sb,out) <- newOut tmpPl + exn <- gu_new_exn tmpPl + pgf_print (pgf p) out exn + touchPGF p + s <- gu_string_buf_freeze sb tmpPl + peekUtf8CString s + -- | List of all languages available in the grammar. languages :: PGF -> Map.Map ConcName Concr languages p = |
