aboutsummaryrefslogtreecommitdiff
path: root/stub/ocaml.h
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2016-11-15 13:00:01 +0100
committerSébastien Dailly <sebastien@chimrod.com>2016-11-15 13:00:01 +0100
commitef312564ca84a2b49fc291434d8fb2f8501bb618 (patch)
tree79415fcf225e6da1042c8edaae5e4a74c7a983cb /stub/ocaml.h
Initial commit
Diffstat (limited to 'stub/ocaml.h')
-rwxr-xr-xstub/ocaml.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/stub/ocaml.h b/stub/ocaml.h
new file mode 100755
index 0000000..6d26382
--- /dev/null
+++ b/stub/ocaml.h
@@ -0,0 +1,28 @@
+#ifndef OC__STUB_OCAML_H
+
+#include <caml/custom.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include <caml/fail.h>
+#include <caml/mlvalues.h>
+
+#define Val_none Val_int(0)
+
+value get_opt(value opt, int index);
+
+/**
+ * Convert a « string option » to char* or Null
+ */
+char* string_opt(const value opt);
+
+/**
+ * Store the given value as an option.
+ */
+value Val_some(value v);
+
+/**
+ * Create a field of one element containing the value v.
+ */
+value Val_1field(value v);
+
+#endif