diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2019-01-11 19:31:37 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2019-01-11 19:35:17 +0000 |
commit | d6cd52f5863bdb6494fa91b7d4ffa9dddca17cd3 (patch) | |
tree | b5e2417b4f5263f80625ca8bf376297197a9ebe1 /Lib/ocaml/typemaps.i | |
parent | 5bdb52b31975834ece1ec69fd82a7f9774c8573e (diff) | |
download | swig-d6cd52f5863bdb6494fa91b7d4ffa9dddca17cd3.tar.gz |
Fix OCAML typemap warnings wrapping C code
Fixes:
Lib/ocaml/typemaps.i:366: Warning 453: Can't apply (SWIGTYPE &). No typemaps are defined.
Lib/ocaml/typemaps.i:367: Warning 453: Can't apply (SWIGTYPE &&). No typemaps are defined.
Lib/ocaml/typemaps.i:372: Warning 453: Can't apply (SWIGTYPE &). No typemaps are defined.
Diffstat (limited to 'Lib/ocaml/typemaps.i')
-rw-r--r-- | Lib/ocaml/typemaps.i | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/Lib/ocaml/typemaps.i b/Lib/ocaml/typemaps.i index b70b78928..3e0233ffa 100644 --- a/Lib/ocaml/typemaps.i +++ b/Lib/ocaml/typemaps.i @@ -27,7 +27,16 @@ $result = caml_val_ptr($1,$descriptor); } -#ifdef __cplusplus +%typemap(in) char *& (char *temp) { + /* %typemap(in) char *& */ + temp = (char*)caml_val_ptr($1,$descriptor); + $1 = &temp; +} + +%typemap(argout) char *& { + /* %typemap(argout) char *& */ + swig_result = caml_list_append(swig_result,caml_val_string_len(*$1, strlen(*$1))); +} %typemap(in) SWIGTYPE & { /* %typemap(in) SWIGTYPE & */ @@ -105,6 +114,8 @@ $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; } +#ifdef __cplusplus + %typemap(out) SWIGTYPE { /* %typemap(out) SWIGTYPE */ $&1_ltype temp = new $ltype((const $1_ltype &) $1); @@ -116,23 +127,8 @@ } } -%typemap(in) char *& (char *temp) { - /* %typemap(in) char *& */ - temp = (char*)caml_val_ptr($1,$descriptor); - $1 = &temp; -} - -%typemap(argout) char *& { - /* %typemap(argout) char *& */ - swig_result = caml_list_append(swig_result,caml_val_string_len(*$1, strlen(*$1))); -} - #else -%typemap(in) SWIGTYPE { - $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; -} - %typemap(out) SWIGTYPE { /* %typemap(out) SWIGTYPE */ void *temp = calloc(1,sizeof($ltype)); @@ -145,9 +141,6 @@ } } -%apply SWIGTYPE { const SWIGTYPE & }; -%apply SWIGTYPE { const SWIGTYPE && }; - #endif /* The SIMPLE_MAP macro below defines the whole set of typemaps needed |