mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-09-28 13:13:37 -06:00
now we can load PGF files as precompiled modules
This commit is contained in:
@@ -19,6 +19,7 @@ module PGF2 (-- * PGF
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
writePGF_,
|
||||
#endif
|
||||
pgfFilePath,
|
||||
|
||||
-- * Abstract syntax
|
||||
AbsName,abstractName,globalFlag,abstractFlag,
|
||||
@@ -278,6 +279,9 @@ cookie_write cookie buf size = do
|
||||
fmap fromIntegral $ (callback :: Ptr Word8 -> Int -> IO Int) buf (fromIntegral size)
|
||||
#endif
|
||||
|
||||
pgfFilePath :: PGF -> FilePath
|
||||
pgfFilePath p = unsafePerformIO (pgf_file_path (a_db p) >>= peekCString)
|
||||
|
||||
showPGF :: PGF -> String
|
||||
showPGF p =
|
||||
render (text "abstract" <+> ppAbstractName p <+> char '{' $$
|
||||
|
||||
@@ -93,6 +93,8 @@ foreign import ccall pgf_write_pgf_cookie :: Ptr () -> FunPtr (Ptr () -> Ptr Wor
|
||||
foreign import ccall pgf_write_pgf_cookie :: Ptr () -> FunPtr (Ptr () -> Ptr Word8 -> CInt -> IO CInt) -> Ptr PgfDB -> Ptr PGF -> Ptr (Ptr PgfText) -> Ptr PgfExn -> IO ()
|
||||
#endif
|
||||
|
||||
foreign import ccall pgf_file_path :: Ptr PgfDB -> IO CString
|
||||
|
||||
foreign import ccall "pgf_free_revision" pgf_free_revision_ :: Ptr PgfDB -> Ptr PGF -> IO ()
|
||||
|
||||
foreign import ccall "&pgf_free_revision" pgf_free_revision :: FinalizerEnvPtr PgfDB PGF
|
||||
|
||||
Reference in New Issue
Block a user