Setup proper bindings for mruby.
- and a lot more stuff.
This commit is contained in:
+29
-1
@@ -1,6 +1,31 @@
|
||||
open Ctypes
|
||||
open Foreign
|
||||
|
||||
module Mrb_value = struct
|
||||
type t
|
||||
|
||||
let typ : t structure typ = structure "mrb_value"
|
||||
let value = field typ "w" uintptr_t
|
||||
let () = seal typ
|
||||
end
|
||||
|
||||
module Mrb_sym = struct
|
||||
type t
|
||||
|
||||
let typ = uint32_t
|
||||
end
|
||||
|
||||
module Mrb_class = struct
|
||||
type t
|
||||
type class_ptr = t structure ptr
|
||||
|
||||
let typ : t structure typ = structure "RClass"
|
||||
|
||||
(* as it builds by default on x86_64 linux *)
|
||||
let padding = field typ "padding" (array 40 char)
|
||||
let () = seal typ
|
||||
end
|
||||
|
||||
module Mrb_state = struct
|
||||
type t
|
||||
type mrb_ptr = t structure ptr
|
||||
@@ -11,9 +36,11 @@ module Mrb_state = struct
|
||||
let root_c = field typ "root_c" (ptr void)
|
||||
let globals = field typ "globals" (ptr void)
|
||||
let exc = field typ "exc" (ptr void)
|
||||
let top_self = field typ "top_self" (ptr void)
|
||||
let object_class = field typ "object_class" (ptr Mrb_class.typ)
|
||||
|
||||
(* as it builds by default on x86_64 linux *)
|
||||
let padding = field typ "padding" (array 24472 char)
|
||||
let padding = field typ "padding" (array 24464 char)
|
||||
let () = seal typ
|
||||
|
||||
let has_error mrb_ptr =
|
||||
@@ -21,4 +48,5 @@ module Mrb_state = struct
|
||||
not (is_null exc_val)
|
||||
|
||||
let clear_error mrb_ptr = setf !@mrb_ptr exc null
|
||||
let get_object_class mrb_ptr = getf !@mrb_ptr object_class
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user