diff options
author | Art Yerkes <ayerkes@speakeasy.net> | 2003-06-06 04:01:56 +0000 |
---|---|---|
committer | Art Yerkes <ayerkes@speakeasy.net> | 2003-06-06 04:01:56 +0000 |
commit | f31bcd2a0e57760d9091c4b260bce55f4eb3d400 (patch) | |
tree | fea967a5e346d346ad6871a7283de4d30e093099 /Lib | |
parent | e50fa507728e430b04b4369706ac494ba5fdff0d (diff) | |
download | swig-f31bcd2a0e57760d9091c4b260bce55f4eb3d400.tar.gz |
Three test cases remaining. Gotta fix em all!
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4867 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ocaml/typemaps.i | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/Lib/ocaml/typemaps.i b/Lib/ocaml/typemaps.i index 4961aa49e..ab06dafa3 100644 --- a/Lib/ocaml/typemaps.i +++ b/Lib/ocaml/typemaps.i @@ -38,13 +38,18 @@ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); } +%typemap(varin) SWIGTYPE & { + /* %typemap(varin) SWIGTYPE & */ + $1 = *(($ltype) caml_ptr_val($input,$1_descriptor)); +} + %typemap(out) SWIGTYPE & { /* %typemap(out) SWIGTYPE & */ CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); if( fromval ) { - $result = callback(*fromval,caml_val_ptr((void *) $1,$1_descriptor)); + $result = callback(*fromval,caml_val_ptr((void *) &$1,$1_descriptor)); } else { - $result = caml_val_ptr ((void *) $1,$1_descriptor); + $result = caml_val_ptr ((void *) &$1,$1_descriptor); } } @@ -107,17 +112,22 @@ for simple types. */ %define SIMPLE_MAP(C_NAME, C_TO_MZ, MZ_TO_C) +/* In */ %typemap(in) C_NAME { $1 = MZ_TO_C($input); } %typemap(varin) C_NAME { $1 = MZ_TO_C($input); } -%typemap(out) C_NAME { - $result = C_TO_MZ($1); +%typemap(in) C_NAME & ($*1_ltype temp) { + temp = ($*1_ltype) MZ_TO_C($input); + $1 = &temp; } -%typemap(varout) C_NAME { - $result = C_TO_MZ($1); +%typemap(varin) C_NAME & { + $1 = MZ_TO_C($input); +} +%typemap(outv) C_NAME { + $1 = MZ_TO_C($input); } %typemap(in) C_NAME *INPUT ($*1_ltype temp) { temp = ($*1_ltype) MZ_TO_C($input); @@ -126,18 +136,23 @@ %typemap(in,numinputs=0) C_NAME *OUTPUT ($*1_ltype temp) { $1 = &temp; } -%typemap(argout) C_NAME *OUTPUT { - swig_result = caml_list_append(swig_result,C_TO_MZ((long)*$1)); +/* Out */ +%typemap(out) C_NAME { + $result = C_TO_MZ($1); } -%typemap(in) C_NAME & ($*1_ltype temp) { - temp = ($*1_ltype) MZ_TO_C($input); - $1 = &temp; +%typemap(varout) C_NAME { + $result = C_TO_MZ($1); } -%typemap(varin) C_NAME & { - $1 = MZ_TO_C($input); +%typemap(varout) C_NAME & { + /* %typemap(varout) C_NAME & (generic) */ + $result = C_TO_MZ($1); } -%typemap(outv) C_NAME { - $1 = MZ_TO_C($input); +%typemap(argout) C_NAME *OUTPUT { + swig_result = caml_list_append(swig_result,C_TO_MZ((long)*$1)); +} +%typemap(out) C_NAME & { + /* %typemap(out) C_NAME & (generic) */ + $result = C_TO_MZ(*$1); } %typemap(argout) C_NAME & { swig_result = caml_list_append(swig_result,C_TO_MZ((long)*$1)); @@ -150,6 +165,7 @@ SIMPLE_MAP(bool, caml_val_bool, caml_long_val); SIMPLE_MAP(oc_bool, caml_val_bool, caml_long_val); SIMPLE_MAP(char, caml_val_char, caml_long_val); +SIMPLE_MAP(signed char, caml_val_char, caml_long_val); SIMPLE_MAP(unsigned char, caml_val_uchar, caml_long_val); SIMPLE_MAP(int, caml_val_int, caml_long_val); SIMPLE_MAP(short, caml_val_short, caml_long_val); |