[OCaml] Fix member var getters and setters

Add `membervariableHandler()` to the `OCAML` class in ocaml.cxx (it is
partly based on the code in python.cxx and octave.cxx).

In Lib/ocaml/class.swg, wrapped classes/structs were not being added
to `class_master_list`. This is fixed by adding a call to
`register_class_byname`.

Add a unit test in the form of struct_value_runme.ml.
This commit is contained in:
Zackery Spytz 2019-01-06 09:40:25 -07:00
commit 4a912668fc
4 changed files with 40 additions and 19 deletions

View file

@ -56,6 +56,7 @@ begin
(fun mth arg -> invoke_inner raw_ptr mth arg)
end
let _ = register_class_byname "$realname" create_$classname_from_ptr
let _ = Callback.register
"create_$normalized_from_ptr"
create_$classname_from_ptr

View file

@ -155,5 +155,5 @@ let _ = Callback.register "swig_set_type_info" set_type_info
let class_master_list = Hashtbl.create 20
let register_class_byname nm co =
Hashtbl.replace class_master_list nm (Obj.magic co)
let create_class nm arg =
let create_class nm =
try (Obj.magic (Hashtbl.find class_master_list nm)) with _ -> raise (NoSuchClass nm)