Uniform SWIGSTATIC on all prototypes.
#ifdef __GNUC__ -> static inline to remove warning spew using gcc typemaps: tweaks for arrays, enums ocaml.cxx: remove Swig. qualifier everywhere it's not needed git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6655 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c477876252
commit
3101067a2d
6 changed files with 94 additions and 54 deletions
|
|
@ -17,10 +17,12 @@
|
|||
%}
|
||||
|
||||
%insert(mltail) %{
|
||||
let swig_val t v =
|
||||
let rec swig_val t v =
|
||||
match v with
|
||||
C_enum e -> enum_to_int t v
|
||||
| _ -> Obj.magic v
|
||||
C_enum e -> enum_to_int t v
|
||||
| C_list l -> Swig.C_list (List.map (swig_val t) l)
|
||||
| C_array a -> Swig.C_array (Array.map (swig_val t) a)
|
||||
| _ -> Obj.magic v
|
||||
%}
|
||||
|
||||
/*#ifndef SWIG_NOINCLUDE*/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ SWIGEXT {
|
|||
#include <caml/fail.h>
|
||||
#include <caml/misc.h>
|
||||
|
||||
#define caml_array_set swig_caml_array_set
|
||||
|
||||
// Adapted from memory.h and mlvalues.h
|
||||
|
||||
#define SWIG_CAMLlocal1(x) \
|
||||
|
|
@ -79,7 +81,12 @@ CAMLextern int64 Int64_val(caml_value_t v);
|
|||
#define SWIG_Int64_val(v) Int64_val(v)
|
||||
#endif
|
||||
|
||||
# define SWIGSTATIC static
|
||||
#ifdef __GNUC__
|
||||
# define SWIGSTATIC static inline
|
||||
#else
|
||||
# define SWIGSTATIC static
|
||||
#endif
|
||||
|
||||
|
||||
#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type)
|
||||
|
||||
|
|
@ -91,48 +98,48 @@ CAMLextern int64 Int64_val(caml_value_t v);
|
|||
SWIGSTATIC void *
|
||||
SWIG_MustGetPtr (CAML_VALUE v, swig_type_info *type);
|
||||
|
||||
static CAML_VALUE _wrap_delete_void( CAML_VALUE );
|
||||
SWIGSTATIC CAML_VALUE _wrap_delete_void( CAML_VALUE );
|
||||
|
||||
static int enum_to_int( char *name, CAML_VALUE v );
|
||||
static CAML_VALUE int_to_enum( char *name, int v );
|
||||
SWIGSTATIC int enum_to_int( char *name, CAML_VALUE v );
|
||||
SWIGSTATIC CAML_VALUE int_to_enum( char *name, int v );
|
||||
|
||||
static CAML_VALUE caml_list_nth( CAML_VALUE lst, int n );
|
||||
static CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt );
|
||||
static int caml_list_length( CAML_VALUE lst );
|
||||
static CAML_VALUE caml_array_new( int n );
|
||||
static void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item );
|
||||
static CAML_VALUE caml_array_nth( CAML_VALUE arr, int n );
|
||||
static int caml_array_length( CAML_VALUE arr );
|
||||
SWIGSTATIC CAML_VALUE caml_list_nth( CAML_VALUE lst, int n );
|
||||
SWIGSTATIC CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt );
|
||||
SWIGSTATIC int caml_list_length( CAML_VALUE lst );
|
||||
SWIGSTATIC CAML_VALUE caml_array_new( int n );
|
||||
SWIGSTATIC void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item );
|
||||
SWIGSTATIC CAML_VALUE caml_array_nth( CAML_VALUE arr, int n );
|
||||
SWIGSTATIC int caml_array_length( CAML_VALUE arr );
|
||||
|
||||
static CAML_VALUE caml_val_char( char c );
|
||||
static CAML_VALUE caml_val_uchar( unsigned char c );
|
||||
SWIGSTATIC CAML_VALUE caml_val_char( char c );
|
||||
SWIGSTATIC CAML_VALUE caml_val_uchar( unsigned char c );
|
||||
|
||||
static CAML_VALUE caml_val_short( short s );
|
||||
static CAML_VALUE caml_val_ushort( unsigned short s );
|
||||
SWIGSTATIC CAML_VALUE caml_val_short( short s );
|
||||
SWIGSTATIC CAML_VALUE caml_val_ushort( unsigned short s );
|
||||
|
||||
static CAML_VALUE caml_val_int( int x );
|
||||
static CAML_VALUE caml_val_uint( unsigned int x );
|
||||
SWIGSTATIC CAML_VALUE caml_val_int( int x );
|
||||
SWIGSTATIC CAML_VALUE caml_val_uint( unsigned int x );
|
||||
|
||||
static CAML_VALUE caml_val_long( long x );
|
||||
static CAML_VALUE caml_val_ulong( unsigned long x );
|
||||
SWIGSTATIC CAML_VALUE caml_val_long( long x );
|
||||
SWIGSTATIC CAML_VALUE caml_val_ulong( unsigned long x );
|
||||
|
||||
static CAML_VALUE caml_val_float( float f );
|
||||
static CAML_VALUE caml_val_double( double d );
|
||||
SWIGSTATIC CAML_VALUE caml_val_float( float f );
|
||||
SWIGSTATIC CAML_VALUE caml_val_double( double d );
|
||||
|
||||
static CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor );
|
||||
SWIGSTATIC CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor );
|
||||
|
||||
static CAML_VALUE caml_val_string( const char *str );
|
||||
static CAML_VALUE caml_val_string_len( const char *str, int len );
|
||||
SWIGSTATIC CAML_VALUE caml_val_string( const char *str );
|
||||
SWIGSTATIC CAML_VALUE caml_val_string_len( const char *str, int len );
|
||||
|
||||
static long caml_long_val( CAML_VALUE v );
|
||||
static double caml_double_val( CAML_VALUE v );
|
||||
SWIGSTATIC long caml_long_val( CAML_VALUE v );
|
||||
SWIGSTATIC double caml_double_val( CAML_VALUE v );
|
||||
|
||||
static int caml_ptr_val_internal( CAML_VALUE v, void **out,
|
||||
SWIGSTATIC int caml_ptr_val_internal( CAML_VALUE v, void **out,
|
||||
swig_type_info *descriptor );
|
||||
static void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor );
|
||||
SWIGSTATIC void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor );
|
||||
|
||||
static char *caml_string_val( CAML_VALUE v );
|
||||
static int caml_string_len( CAML_VALUE v );
|
||||
SWIGSTATIC char *caml_string_val( CAML_VALUE v );
|
||||
SWIGSTATIC int caml_string_len( CAML_VALUE v );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,16 +284,37 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
|
|||
%swigtype_ptr_out(varout);
|
||||
%swigtype_ptr_out(directorin);
|
||||
|
||||
%define %swigtype_array_fail(how,msg)
|
||||
%typemap(how) SWIGTYPE [] {
|
||||
failwith(msg);
|
||||
}
|
||||
%enddef
|
||||
|
||||
%swigtype_array_fail(in,"Array arguments for arbitrary types need a typemap");
|
||||
%swigtype_array_fail(varin,"Assignment to global arrays for arbitrary types need a typemap");
|
||||
%swigtype_array_fail(out,"Array arguments for arbitrary types need a typemap");
|
||||
%swigtype_array_fail(varout,"Array variables need a typemap");
|
||||
%swigtype_array_fail(directorin,"Array results with arbitrary types need a typemap");
|
||||
%swigtype_array_fail(directorout,"Array arguments with arbitrary types need a typemap");
|
||||
|
||||
/* C++ References */
|
||||
|
||||
/* Enums */
|
||||
%typemap(in) enum SWIGTYPE {
|
||||
%define %swig_enum_in(how)
|
||||
%typemap(how) enum SWIGTYPE {
|
||||
$1 = ($type)caml_long_val_full($input,"$type_marker");
|
||||
}
|
||||
%enddef
|
||||
|
||||
%typemap(varin) enum SWIGTYPE {
|
||||
$1 = ($type)caml_long_val_full($input,"$type_marker");
|
||||
%define %swig_enum_out(how)
|
||||
%typemap(how) enum SWIGTYPE {
|
||||
$result = callback2(*caml_named_value(SWIG_MODULE "_int_to_enum"),*caml_named_value("$type_marker"),Val_int((int)$1));
|
||||
}
|
||||
%enddef
|
||||
|
||||
%typemap(out) enum SWIGTYPE "$result = callback2(*caml_named_value(SWIG_MODULE \"_int_to_enum\"),*caml_named_value(\"$type_marker\"),Val_int($1));"
|
||||
%typemap(varout) enum SWIGTYPE "$result = callback2(*caml_named_value(SWIG_MODULE \"_int_to_enum\"),*caml_named_value(\"$type_marker\"),Val_int($1));"
|
||||
%swig_enum_in(in)
|
||||
%swig_enum_in(varin)
|
||||
%swig_enum_in(directorout)
|
||||
%swig_enum_out(out)
|
||||
%swig_enum_out(varout)
|
||||
%swig_enum_out(directorin)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue