summaryrefslogtreecommitdiff
path: root/src/runtime/haskell/CRuntimeFFI/README
diff options
context:
space:
mode:
authorinari <inari@chalmers.se>2013-12-10 15:27:28 +0000
committerinari <inari@chalmers.se>2013-12-10 15:27:28 +0000
commitd7847f2f1378ca2a472daea23fc70ce87bae4867 (patch)
treee1ee8f7a3d7cdc2ae6c073db2c8c9477d5199c9c /src/runtime/haskell/CRuntimeFFI/README
parent0ece8f19abf4dba1d3c568aca60d2c960d75efa6 (diff)
Haskell bindings for the C runtime
Added Haskell bindings for the C runtime. Work in progress, the files are not (and should not be) included in makefiles or anything.
Diffstat (limited to 'src/runtime/haskell/CRuntimeFFI/README')
-rw-r--r--src/runtime/haskell/CRuntimeFFI/README32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/runtime/haskell/CRuntimeFFI/README b/src/runtime/haskell/CRuntimeFFI/README
new file mode 100644
index 000000000..64b6b7276
--- /dev/null
+++ b/src/runtime/haskell/CRuntimeFFI/README
@@ -0,0 +1,32 @@
+This is a work in progress, but usable as it is now.
+Some memory leaks and segfaults to be expected.
+
+
+The files are
+
+CRuntimeFFI.hsc -- user-friendly functions, almost the same as in the real Haskell PGF library.
+Gu.hsc -- mindlessly copypasted functions from various files in gu/
+PgfLow.hs -- mindlessly copypasted functions from various files in pgf/
+
+The first two files (.hsc) use some special constructions for accessing C objects from Haskell.
+See the syntax here: http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/hsc2hs.html
+
+HOW TO COMPILE:
+
+hsc2hs Gu.hsc CRuntimeFFI.hsc -v --cflag="-std=c99" && ghc -lpgf -lgu --make CRuntimeFFI
+
+HOW TO USE:
+
+- Symlink or copy the files in this directory to the directory you're working with; these files are not included in any makefiles
+- Import CRuntimeFFI to a Haskell program you're writing
+
+ module Main where
+ import CRuntimeFFI
+
+- Use the functions in your program
+
+ main = do
+ pgf <- readPGF "Foo.pgf"
+ let english = getConcr pgf (mkCId ("FooEng"))
+
+I haven't managed to make it work in ghci, get errors about unknown symbols (low level C functions).