Merge branch 'ZackerySpytz-OCaml-overloaded-bools-typecheck'
* ZackerySpytz-OCaml-overloaded-bools-typecheck: [OCaml] Remove the last remnants of libswigocaml [OCaml] Fix the handling of bools in overloaded functions
This commit is contained in:
commit
8587fd7b0d
5 changed files with 16 additions and 23 deletions
15
Examples/test-suite/ocaml/overload_bool_runme.ml
Normal file
15
Examples/test-suite/ocaml/overload_bool_runme.ml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
open Swig
|
||||||
|
open Overload_bool
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
assert (_overloaded '(true) as string = "bool");
|
||||||
|
assert (_overloaded '(false) as string = "bool");
|
||||||
|
assert (_overloaded '(0) as string = "int");
|
||||||
|
assert (_overloaded '(1) as string = "int");
|
||||||
|
assert (_overloaded '(2) as string = "int");
|
||||||
|
assert (_overloaded '("1234") as string = "string");
|
||||||
|
assert (_boolfunction '(true) as string = "true");
|
||||||
|
assert (_boolfunction '(false) as string = "false");
|
||||||
|
assert (_intfunction '(true) as string = "int");
|
||||||
|
assert (_intfunction '(false) as string = "int");
|
||||||
|
;;
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
# see top-level Makefile.in
|
# see top-level Makefile.in
|
||||||
# libswigocaml is not needed anymore.
|
|
||||||
swigp4.ml
|
swigp4.ml
|
||||||
swig.mli
|
swig.mli
|
||||||
swig.ml
|
swig.ml
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
/* Ocaml runtime support */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int oc_bool;
|
|
||||||
extern void *nullptr;
|
|
||||||
|
|
||||||
extern oc_bool isnull( void *v );
|
|
||||||
|
|
||||||
extern void *get_char_ptr( char *str );
|
|
||||||
extern void *make_ptr_array( int size );
|
|
||||||
extern void *get_ptr( void *arrayptr, int elt );
|
|
||||||
extern void set_ptr( void *arrayptr, int elt, void *elt_v );
|
|
||||||
extern void *offset_ptr( void *ptr, int n );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typecheck(SWIG_TYPECHECK_INTEGER) bool, oc_bool, BOOL, const bool &, const oc_bool &, const BOOL & {
|
%typecheck(SWIG_TYPECHECK_BOOL) bool, const bool & {
|
||||||
if( !Is_block($input) ) $1 = 0;
|
if( !Is_block($input) ) $1 = 0;
|
||||||
else {
|
else {
|
||||||
switch( SWIG_Tag_val($input) ) {
|
switch( SWIG_Tag_val($input) ) {
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
SIMPLE_MAP(bool, caml_val_bool, caml_long_val);
|
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(char, caml_val_char, caml_long_val);
|
||||||
SIMPLE_MAP(signed 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(unsigned char, caml_val_uchar, caml_long_val);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue