diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2019-02-09 22:28:10 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2019-02-09 22:28:10 +0000 |
commit | d7bb500315b212e6c3237637ac2934ccbb3220b6 (patch) | |
tree | cb9d34b6660b8ce115fd3ad47132b669c19cc084 /Lib/ocaml | |
parent | b80b4d5638ceec55a7f86c7737b97f2ea1ed4d9f (diff) | |
parent | 828ce477c8e7791f718cb01616e0bf80c2773e02 (diff) | |
download | swig-d7bb500315b212e6c3237637ac2934ccbb3220b6.tar.gz |
Merge branch 'ZackerySpytz-OCaml-director-ctors'
* ZackerySpytz-OCaml-director-ctors:
[OCaml] Fix a bug in the ctors of director classes
Diffstat (limited to 'Lib/ocaml')
-rw-r--r-- | Lib/ocaml/std_string.i | 5 | ||||
-rw-r--r-- | Lib/ocaml/swig.ml | 7 | ||||
-rw-r--r-- | Lib/ocaml/swig.mli | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/Lib/ocaml/std_string.i b/Lib/ocaml/std_string.i index 770353052..0ea9b4e2d 100644 --- a/Lib/ocaml/std_string.i +++ b/Lib/ocaml/std_string.i @@ -70,6 +70,11 @@ class wstring; swig_result = caml_list_append(swig_result,caml_val_string_len((*$1).c_str(), (*$1).size())); } +%typemap(directorin) string { + swig_result = caml_val_string_len($1.c_str(), $1.size()); + args = caml_list_append(args, swig_result); +} + %typemap(directorout) string { $result.assign((char *)caml_ptr_val($input,0), caml_string_len($input)); } diff --git a/Lib/ocaml/swig.ml b/Lib/ocaml/swig.ml index 8ac301dc6..58a93347b 100644 --- a/Lib/ocaml/swig.ml +++ b/Lib/ocaml/swig.ml @@ -44,6 +44,13 @@ let _ = Callback.register "swig_runmethod" invoke let fnhelper arg = match arg with C_list l -> l | C_void -> [] | _ -> [ arg ] +let director_core_helper fnargs = + try + match List.hd fnargs with + | C_director_core (o,r) -> fnargs + | _ -> C_void :: fnargs + with Failure _ -> C_void :: fnargs + let rec get_int x = match x with C_bool b -> if b then 1 else 0 diff --git a/Lib/ocaml/swig.mli b/Lib/ocaml/swig.mli index 3207b9e73..c5ffadb15 100644 --- a/Lib/ocaml/swig.mli +++ b/Lib/ocaml/swig.mli @@ -30,6 +30,7 @@ exception NoSuchClass of string val invoke : ('a c_obj_t) -> (string -> 'a c_obj_t -> 'a c_obj_t) val fnhelper : 'a c_obj_t -> 'a c_obj_t list +val director_core_helper : 'a c_obj_t list -> 'a c_obj_t list val get_int : 'a c_obj_t -> int val get_float : 'a c_obj_t -> float |