Many major improvements. Almost all testsuite compiles now.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@11189 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a2dc2756c8
commit
32e03aa13d
25 changed files with 1052 additions and 609 deletions
17
Examples/GIFPlot/C/Makefile
Normal file
17
Examples/GIFPlot/C/Makefile
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
TOP = ../..
|
||||||
|
SWIG = $(TOP)/../preinst-swig
|
||||||
|
SWIGOPT = -I../Include
|
||||||
|
SRCS =
|
||||||
|
TARGET = gifplot
|
||||||
|
INTERFACE = gifplot.i
|
||||||
|
LIBS = -L.. -lgifplot
|
||||||
|
INCLUDES = -I../Include
|
||||||
|
|
||||||
|
all::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' LIBS='$(LIBS)' \
|
||||||
|
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o *.out *.so *.a *.dll *.dylib *.exe *_wrap* *_proxy* *~ runme
|
||||||
|
|
||||||
|
check: all
|
||||||
15
Examples/GIFPlot/C/gifplot.i
Normal file
15
Examples/GIFPlot/C/gifplot.i
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
/* Oh what the heck, let's just grab the whole darn header file
|
||||||
|
and see what happens. */
|
||||||
|
|
||||||
|
%module gifplot
|
||||||
|
%{
|
||||||
|
|
||||||
|
/* Note: You still need this part because the %include directive
|
||||||
|
merely causes SWIG to interpret the contents of a file. It doesn't
|
||||||
|
include the right include headers for the resulting C code */
|
||||||
|
|
||||||
|
#include "../Include/gifplot.h"
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include gifplot.h
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# see top-level Makefile.in
|
# see top-level Makefile.in
|
||||||
class
|
|
||||||
simple
|
simple
|
||||||
|
class
|
||||||
|
std_vector
|
||||||
exception
|
exception
|
||||||
|
|
|
||||||
30
Examples/c/std_vector/Makefile
Normal file
30
Examples/c/std_vector/Makefile
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
TOP = ../..
|
||||||
|
SWIG = $(TOP)/../preinst-swig -debug-module 4 > tree.txt
|
||||||
|
CXXSRCS = example.cxx
|
||||||
|
TARGET = example
|
||||||
|
INTERFACE = example.i
|
||||||
|
RUNME = runme.c
|
||||||
|
PROXY = example_proxy.c
|
||||||
|
INCLUDES =
|
||||||
|
MEMTOOL = valgrind --leak-check=full
|
||||||
|
|
||||||
|
all::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||||
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INCLUDES='$(INCLUDES)' c_cpp
|
||||||
|
$(MAKE) -f $(TOP)/Makefile RUNME='$(RUNME)' PROXY='$(PROXY)' \
|
||||||
|
TARGET='$(TARGET)' c_compile
|
||||||
|
|
||||||
|
run:
|
||||||
|
env LD_LIBRARY_PATH=. ./runme
|
||||||
|
|
||||||
|
memchk:
|
||||||
|
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||||
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' CXXFLAGS='-g' INCLUDES='$(INCLUDES)' c_cpp
|
||||||
|
$(MAKE) -f $(TOP)/Makefile RUNME='$(RUNME)' PROXY='$(PROXY)' \
|
||||||
|
TARGET='$(TARGET)' CFLAGS='-g' c_compile
|
||||||
|
env LD_LIBRARY_PATH=. $(MEMTOOL) ./runme
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o *.out *.so *.a *.dll *.dylib *.exe *_wrap* *_proxy* *~ runme
|
||||||
|
|
||||||
|
check: all
|
||||||
2
Examples/c/std_vector/example.cxx
Normal file
2
Examples/c/std_vector/example.cxx
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
/* File : example.c */
|
||||||
|
|
||||||
18
Examples/c/std_vector/example.h
Normal file
18
Examples/c/std_vector/example.h
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
/* File : example.h */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class A {
|
||||||
|
public:
|
||||||
|
A() : name(""), value(0) {}
|
||||||
|
A(std::string str, int i) : name(str), value(i) {}
|
||||||
|
std::string name;
|
||||||
|
int value;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Klass {
|
||||||
|
public:
|
||||||
|
std::vector<int> vi;
|
||||||
|
std::vector<A> va;
|
||||||
|
};
|
||||||
14
Examples/c/std_vector/example.i
Normal file
14
Examples/c/std_vector/example.i
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* File : example.i */
|
||||||
|
%module example
|
||||||
|
%include <std_string.i>
|
||||||
|
%include <std_vector.i>
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include "example.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
/* Let's just grab the original header file here */
|
||||||
|
%include "example.h"
|
||||||
|
|
||||||
|
%template(Vint) std::vector<int>;
|
||||||
|
%template(VA) std::vector<A>;
|
||||||
37
Examples/c/std_vector/runme.c
Normal file
37
Examples/c/std_vector/runme.c
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "example_proxy.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Klass *klass = new_Klass();
|
||||||
|
Vint *vint = Klass_vi_get(klass);
|
||||||
|
VA *va = Klass_va_get(klass);
|
||||||
|
|
||||||
|
printf("Vector of ints:\n");
|
||||||
|
printf("size=%d\ncapacity=%d\n\n", Vint_size(vint), Vint_capacity(vint));
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
Vint_push_back(vint, i*i);
|
||||||
|
|
||||||
|
printf("size=%d\ncapacity=%d\n\n", Vint_size(vint), Vint_capacity(vint));
|
||||||
|
|
||||||
|
for (i = 0; i < Vint_size(vint); i++)
|
||||||
|
printf("%d%c", Vint_at(vint, i), i+1 == Vint_size(vint) ? '\n' : ',');
|
||||||
|
|
||||||
|
Vint_clear(vint);
|
||||||
|
Vint_reserve(vint, 100);
|
||||||
|
printf("\nsize=%d\ncapacity=%d\n", Vint_size(vint), Vint_capacity(vint));
|
||||||
|
|
||||||
|
printf("\nVector of objects:\n");
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++) {
|
||||||
|
A *a = new_A_std_string_i("hello", i);
|
||||||
|
VA_push_back(va, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < VA_size(va); i++) {
|
||||||
|
A *a = VA_at(va, i);
|
||||||
|
printf("%s %d\n", A_name_get(a), A_value_get(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
SWIG_exit(0);
|
||||||
|
}
|
||||||
|
|
@ -10,23 +10,29 @@ srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@/..
|
top_srcdir = @top_srcdir@/..
|
||||||
top_builddir = @top_builddir@/..
|
top_builddir = @top_builddir@/..
|
||||||
|
|
||||||
C_TEST_CASES =
|
include $(srcdir)/../common.mk
|
||||||
|
|
||||||
CPP_TEST_CASES = cast_operator \
|
|
||||||
char_strings \
|
|
||||||
exception_order \
|
|
||||||
exception_partial_info \
|
|
||||||
enums \
|
|
||||||
enum_plus
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BROKEN TEST CASES:
|
# BROKEN TEST CASES:
|
||||||
# default_constructor - last case: when using %extend generates 2 ctors wrappers,
|
# default_constructor - last case fail: using %extend generates 2 ctors wrappers,
|
||||||
# both using new, while the class constructor is private
|
# both using new, while the class constructor is private
|
||||||
|
# extend* - directive %extend is not fully supported yet
|
||||||
|
# li* - not supported at all yet
|
||||||
|
# long_long_apply - no INPUT, OUTPUT, INOUT typemaps defined
|
||||||
|
# template* - not fully supported yet
|
||||||
#
|
#
|
||||||
CPP_TEST_BROKEN_CXX = default_constructor
|
|
||||||
|
|
||||||
include $(srcdir)/../common.mk
|
C_CPP_TEST_BROKEN = \
|
||||||
|
default_constructor \
|
||||||
|
extend \
|
||||||
|
extend_default \
|
||||||
|
extend_placement \
|
||||||
|
li_attribute \
|
||||||
|
li_boost_shared_ptr \
|
||||||
|
li_carrays \
|
||||||
|
li_cdata \
|
||||||
|
li_windows \
|
||||||
|
long_long_apply
|
||||||
|
|
||||||
INTERFACEDIR = ../../
|
INTERFACEDIR = ../../
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "cast_operator/cast_operator_proxy.h"
|
#include "cast_operator/cast_operator_proxy.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
A *a = new_A();
|
A *a = new_A();
|
||||||
if (strcmp(A_tochar(a), "hi"))
|
if (strcmp(A_tochar(a), "hi"))
|
||||||
fprintf(stderr, "cast failed\n");
|
fprintf(stderr, "cast failed\n");
|
||||||
delete_A(a);
|
delete_A(a);
|
||||||
SWIG_exit(0);
|
SWIG_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ INTERFACEDIR = ../
|
||||||
|
|
||||||
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
||||||
CPP_TEST_BROKEN += \
|
CPP_TEST_BROKEN += \
|
||||||
|
abstract_access \
|
||||||
constants \
|
constants \
|
||||||
cpp_broken \
|
cpp_broken \
|
||||||
exception_partial_info \
|
exception_partial_info \
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ see bottom for a set of possible tests
|
||||||
SWIGWARN_IGNORE_OPERATOR_LOR);
|
SWIGWARN_IGNORE_OPERATOR_LOR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SWIGC)
|
||||||
|
%warnfilter(SWIGWARN_IGNORE_OPERATOR_EQ,
|
||||||
|
SWIGWARN_IGNORE_OPERATOR_PLUSPLUS);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(SWIGLUA) && !defined(SWIGR)
|
#if !defined(SWIGLUA) && !defined(SWIGR)
|
||||||
%rename(Equal) operator =;
|
%rename(Equal) operator =;
|
||||||
%rename(PlusEqual) operator +=;
|
%rename(PlusEqual) operator +=;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,19 @@ std::string ExceptionVars(double i, double j) {
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%rename(ExceptionVars) Space::exceptionvars;
|
%rename(ExceptionVars) Space::exceptionvars;
|
||||||
|
|
||||||
|
#ifdef SWIGC
|
||||||
|
|
||||||
|
%exception Space::exceptionvars %{
|
||||||
|
$action
|
||||||
|
result = (char*)$symname(1.0,2.0).c_str(); // Should expand to ExceptionVars
|
||||||
|
result = (char*)$name(3.0,4.0).c_str(); // Should expand to Space::exceptionvars
|
||||||
|
// above will not compile if the variables are not expanded properly
|
||||||
|
result = "$action $name $symname $overname $wrapname";
|
||||||
|
%}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
%exception Space::exceptionvars %{
|
%exception Space::exceptionvars %{
|
||||||
$action
|
$action
|
||||||
result = $symname(1.0,2.0); // Should expand to ExceptionVars
|
result = $symname(1.0,2.0); // Should expand to ExceptionVars
|
||||||
|
|
@ -34,6 +47,9 @@ std::string ExceptionVars(double i, double j) {
|
||||||
// above will not compile if the variables are not expanded properly
|
// above will not compile if the variables are not expanded properly
|
||||||
result = "$action $name $symname $overname $wrapname";
|
result = "$action $name $symname $overname $wrapname";
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
namespace Space {
|
namespace Space {
|
||||||
std::string exceptionvars(double i, double j) {
|
std::string exceptionvars(double i, double j) {
|
||||||
|
|
@ -43,6 +59,20 @@ std::string exceptionvars(double i, double j) {
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SWIGC
|
||||||
|
|
||||||
|
%exception Space::overloadedmethod %{
|
||||||
|
$action
|
||||||
|
result = (char*)Space::$symname(1.0).c_str();
|
||||||
|
result = (char*)$name().c_str();
|
||||||
|
result = (char*)$name(2.0).c_str();
|
||||||
|
// above will not compile if the variables are not expanded properly
|
||||||
|
result = "$action $name $symname $overname $wrapname";
|
||||||
|
// $decl
|
||||||
|
%}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
%exception Space::overloadedmethod %{
|
%exception Space::overloadedmethod %{
|
||||||
$action
|
$action
|
||||||
result = Space::$symname(1.0);
|
result = Space::$symname(1.0);
|
||||||
|
|
@ -53,6 +83,8 @@ std::string exceptionvars(double i, double j) {
|
||||||
// $decl
|
// $decl
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
namespace Space {
|
namespace Space {
|
||||||
std::string overloadedmethod(double j) {
|
std::string overloadedmethod(double j) {
|
||||||
|
|
|
||||||
390
Lib/c/c.swg
390
Lib/c/c.swg
|
|
@ -8,7 +8,7 @@
|
||||||
// WARNING: passing function pointers from C as parameters of type (or as
|
// WARNING: passing function pointers from C as parameters of type (or as
|
||||||
// return values) SWIGTYPE (CLASS::*) causes cast of C function to type
|
// return values) SWIGTYPE (CLASS::*) causes cast of C function to type
|
||||||
// void(*)() and it is user's responsibility to properly handle this
|
// void(*)() and it is user's responsibility to properly handle this
|
||||||
// function's arguments and return value.
|
// function's arguments and return value. See 'cpp_basic' test for details.
|
||||||
|
|
||||||
%insert("runtime") "clabels.swg"
|
%insert("runtime") "clabels.swg"
|
||||||
%insert("proxy_header") "cproxy.swg"
|
%insert("proxy_header") "cproxy.swg"
|
||||||
|
|
@ -28,25 +28,25 @@
|
||||||
%fragment("stdbool_inc", "proxy_header") {#include <stdbool.h>}
|
%fragment("stdbool_inc", "proxy_header") {#include <stdbool.h>}
|
||||||
|
|
||||||
// typemaps for function parameters
|
// typemaps for function parameters
|
||||||
|
%typemap(ctype) void, short, int, long, long long, char, float, double "$1_ltype"
|
||||||
|
%typemap(ctype) unsigned short, unsigned int, unsigned long, unsigned long long, unsigned char "$1_ltype"
|
||||||
|
%typemap(ctype) void *, short *, int *, long *, long long *, char *, float *, double * "$1_ltype"
|
||||||
|
%typemap(ctype) void **, short **, int **, long **, long long **, char **, float **, double ** "$1_ltype"
|
||||||
|
%typemap(ctype) unsigned short *, unsigned int *, unsigned long *, unsigned long long *, unsigned char * "$1_ltype"
|
||||||
|
%typemap(ctype) unsigned short **, unsigned int **, unsigned long **, unsigned long long **, unsigned char ** "$1_type"
|
||||||
|
%typemap(ctype) short &, int &, long &, long long &, char &, float &, double & "$1_ltype"
|
||||||
|
%typemap(ctype) unsigned short &, unsigned int &, unsigned long &, unsigned long long &, unsigned char & "$1_ltype"
|
||||||
|
%typemap(ctype) const short, const int, const long, const long long, const char, const float, const double "$1_ltype"
|
||||||
|
%typemap(ctype) const short &, const int &, const long &, const long long &, const char &, const float &, const double & "$1_ltype"
|
||||||
|
%typemap(ctype) const unsigned short, const unsigned int, const unsigned long, const unsigned long long, const unsigned char "$1_type"
|
||||||
|
%typemap(ctype) const unsigned short &, const unsigned int &, const unsigned long &, const unsigned long long &, const unsigned char & "$1_ltype"
|
||||||
|
%typemap(ctype) const void *, const short *, const int *, const long *, const long long *, const char *, const float *, const double * "$1_type"
|
||||||
|
%typemap(ctype) short *&, int *&, long *&, long long *&, char *&, float *&, double *& "$1_ltype"
|
||||||
|
%typemap(ctype) const short *&, const int *&, const long *&, const long long *&, const char *&, const float *&, const double *& "$1_basetype **"
|
||||||
|
%typemap(ctype) short [ANY], int [ANY], long [ANY], long long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY], unsigned int [ANY] "/*aaa*/ $1_ltype"
|
||||||
|
%typemap(ctype) void * [ANY], short * [ANY], int * [ANY], long * [ANY], long long * [ANY], char * [ANY], float * [ANY], double * [ANY] "/*bbb*/ $1_ltype"
|
||||||
|
|
||||||
%typemap(ctype) void, short, int, long, char, float, double "$1_ltype"
|
// special cases of array passing - does not intended to be used for objects
|
||||||
%typemap(ctype) unsigned short, unsigned int, unsigned long, unsigned char "$1_ltype"
|
|
||||||
%typemap(ctype) void *, short *, int *, long *, char *, float *, double * "$1_ltype"
|
|
||||||
%typemap(ctype) void **, short **, int **, long **, char **, float **, double ** "$1_ltype"
|
|
||||||
%typemap(ctype) unsigned short *, unsigned int *, unsigned long *, unsigned char * "$1_ltype"
|
|
||||||
%typemap(ctype) unsigned short **, unsigned int **, unsigned long **, unsigned char ** "$1_type"
|
|
||||||
%typemap(ctype) short &, int &, long &, char &, float &, double & "$1_ltype"
|
|
||||||
%typemap(ctype) unsigned short &, unsigned int &, unsigned long &, unsigned char & "$1_ltype"
|
|
||||||
%typemap(ctype) const short &, const int &, const long &, const char &, const float &, const double & "$1_ltype"
|
|
||||||
%typemap(ctype) const short, const int, const long, const char, const float, const double "$1_ltype"
|
|
||||||
%typemap(ctype) const unsigned short, const unsigned int, const unsigned long, const unsigned char "$1_type"
|
|
||||||
%typemap(ctype) const void *, const short *, const int *, const long *, const char *, const float *, const double * "/*hhhh*/$1_type"
|
|
||||||
%typemap(ctype) short *&, int *&, long *&, char *&, float *&, double *& "$1_ltype"
|
|
||||||
%typemap(ctype) const short *&, const int *&, const long *&, const char *&, const float *&, const double *& "$1_basetype **"
|
|
||||||
%typemap(ctype) short [ANY], int [ANY], long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY], unsigned int [ANY] "/*aaa*/ $1_ltype"
|
|
||||||
%typemap(ctype) void * [ANY], short * [ANY], int * [ANY], long * [ANY], char * [ANY], float * [ANY], double * [ANY] "/*bbb*/ $1_ltype"
|
|
||||||
|
|
||||||
// special cases of array passing - does not work for objects
|
|
||||||
%typemap(ctype) SWIGTYPE [] "$1_ltype"
|
%typemap(ctype) SWIGTYPE [] "$1_ltype"
|
||||||
%typemap(ctype) SWIGTYPE ((&)[ANY]) "$1_basetype **"
|
%typemap(ctype) SWIGTYPE ((&)[ANY]) "$1_basetype **"
|
||||||
|
|
||||||
|
|
@ -54,40 +54,41 @@
|
||||||
%typemap(ctype) SWIGTYPE "SwigObj *"
|
%typemap(ctype) SWIGTYPE "SwigObj *"
|
||||||
%typemap(ctype) SWIGTYPE * "SwigObj *"
|
%typemap(ctype) SWIGTYPE * "SwigObj *"
|
||||||
%typemap(ctype) SWIGTYPE & "SwigObj *"
|
%typemap(ctype) SWIGTYPE & "SwigObj *"
|
||||||
%typemap(ctype) SWIGTYPE [ANY][ANY], SWIGTYPE ** "/* whoa */ $*1_ltype *"
|
%typemap(ctype) SWIGTYPE [ANY][ANY], SWIGTYPE ** "/* whoa */ SwigObj ***"
|
||||||
%typemap(ctype) SWIGTYPE *[ANY] "/*ooooh*/ $*1_ltype"
|
%typemap(ctype) SWIGTYPE *[ANY] "/*ooooh*/ SwigObj **"
|
||||||
//%typemap(ctype) SWIGTYPE * [ANY][ANY], SWIGTYPE *** "SwigObj ***"
|
|
||||||
%typemap(ctype) SWIGTYPE *& "/* *& */ SwigObj **"
|
%typemap(ctype) SWIGTYPE *& "/* *& */ SwigObj **"
|
||||||
%typemap(ctype) enum SWIGTYPE "int"
|
%typemap(ctype) enum SWIGTYPE "int"
|
||||||
|
%typemap(ctype) enum SWIGTYPE & "int *"
|
||||||
%typemap(ctype, fragment="fptr_decl", fragment="fptr_decl_proxy") SWIGTYPE (CLASS::*) "SWIG_CPP_FP"
|
%typemap(ctype, fragment="fptr_decl", fragment="fptr_decl_proxy") SWIGTYPE (CLASS::*) "SWIG_CPP_FP"
|
||||||
|
|
||||||
%typemap(ctype, fragment="stdbool_inc") bool, bool *, bool **, const bool, const bool *, bool * [ANY] "$1_type"
|
%typemap(ctype, fragment="stdbool_inc") bool, bool *, bool **, const bool, const bool *, bool * [ANY] "$1_type"
|
||||||
%typemap(ctype, fragment="stdbool_inc") bool & "$1_ltype"
|
%typemap(ctype, fragment="stdbool_inc") bool & "$1_ltype"
|
||||||
%typemap(ctype, fragment="stdbool_inc") const bool & "$1_ltype const"
|
%typemap(ctype, fragment="stdbool_inc") const bool & "$1_ltype const"
|
||||||
|
|
||||||
%typemap(in) short, int, long, char, float, double "$1 = ($1_ltype) $input;"
|
%typemap(in) short, int, long, long long, char, float, double "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) void *, short *, int *, long *, char *, float *, double * "$1 = ($1_ltype) $input;"
|
%typemap(in) void *, short *, int *, long *, long long *, char *, float *, double * "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) void **, short **, int **, long **, char **, float **, double ** "$1 = ($1_basetype **) $input;"
|
%typemap(in) void **, short **, int **, long **, long long **, char **, float **, double ** "$1 = ($1_basetype **) $input;"
|
||||||
%typemap(in) unsigned short *, unsigned int *, unsigned long *, unsigned char * "$1 = ($1_ltype) $input;"
|
%typemap(in) unsigned short *, unsigned int *, unsigned long *, unsigned long long *, unsigned char * "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) unsigned short **, unsigned int **, unsigned long **, unsigned char ** "$1 = ($1_ltype) $input;"
|
%typemap(in) unsigned short **, unsigned int **, unsigned long **, unsigned long long **, unsigned char ** "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) const void *, const short *, const int *, const long *, const char *, const float *, const double * "$1 = ($1_ltype) $input;"
|
%typemap(in) const void *, const short *, const int *, const long *, const long long *, const char *, const float *, const double * "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) const unsigned short *, const unsigned int *, const unsigned long *, const unsigned char * "$1 = ($1_ltype) $input;"
|
%typemap(in) const unsigned short *, const unsigned int *, const unsigned long *, const unsigned long long *, const unsigned char * "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) unsigned short, unsigned int, unsigned long, unsigned char "$1 = ($1_ltype) $input;"
|
%typemap(in) unsigned short, unsigned int, unsigned long, unsigned long long, unsigned char "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) short &, int &, long &, char &, float &, double &, bool & "$1 = ($1_ltype) $input;"
|
%typemap(in) short &, int &, long &, long long &, char &, float &, double &, bool & "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) const short &, const int &, const long &, const char &, const float &, const double & "$1 = ($1_ltype) $input;"
|
%typemap(in) const short &, const int &, const long &, const long long &, const char &, const float &, const double & "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) unsigned short &, unsigned int &, unsigned long &, unsigned char & "$1 = ($1_ltype) $input;"
|
%typemap(in) unsigned short &, unsigned int &, unsigned long &, unsigned long long &, unsigned char & "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) const unsigned short &, const unsigned int &, const unsigned long &, const unsigned char & "$1 = ($1_ltype) $input;"
|
%typemap(in) const unsigned short &, const unsigned int &, const unsigned long &, const unsigned long long &, const unsigned char & "$1 = ($1_ltype) $input;"
|
||||||
|
|
||||||
%typemap(in) short *&, int *&, long *&, char *&, float *&, double *& "$1 = ($1_ltype) $input;"
|
%typemap(in) short *&, int *&, long *&, long long *&, char *&, float *&, double *& "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) const short *&, const int *&, const long *&, const char *&, const float *&, const double *& "$1 = ($1_ltype) $input;"
|
%typemap(in) const short *&, const int *&, const long *&, const long *&, const char *&, const float *&, const double *& "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) short [ANY], int [ANY], long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY] "$1 = ($1_basetype *) $input;"
|
%typemap(in) short [ANY], int [ANY], long [ANY], long long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY] "$1 = ($1_basetype *) $input;"
|
||||||
%typemap(in) void * [ANY], short * [ANY], int * [ANY], long * [ANY], char * [ANY], float * [ANY], double * [ANY] "$1 = ($1_basetype *) $input;"
|
%typemap(in) void * [ANY], short * [ANY], int * [ANY], long * [ANY], long long * [ANY], char * [ANY], float * [ANY], double * [ANY] "$1 = ($1_basetype *) $input;"
|
||||||
|
|
||||||
%typemap(in, fragment="stdbool_inc") bool, bool *, bool **, const bool, const bool * "$1 = ($1_ltype) $input;"
|
%typemap(in, fragment="stdbool_inc") bool, bool *, bool **, const bool, const bool * "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in, fragment="stdbool_inc") bool & "$1 = ($1_basetype *) $input;"
|
%typemap(in, fragment="stdbool_inc") bool & "$1 = ($1_basetype *) $input;"
|
||||||
%typemap(in, fragment="stdbool_inc") const bool &, const bool * "$1 = ($1_basetype *) $input;"
|
%typemap(in, fragment="stdbool_inc") const bool &, const bool * "$1 = ($1_basetype *) $input;"
|
||||||
|
|
||||||
%typemap(in) enum SWIGTYPE "$1 = ($1_type) $input;"
|
%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) $input;"
|
||||||
|
%typemap(in) enum SWIGTYPE & "$1 = ($1_ltype) $input;"
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE [] "$1 = ($1_ltype) $input;"
|
%typemap(in) SWIGTYPE [] "$1 = ($1_ltype) $input;"
|
||||||
%typemap(in) SWIGTYPE ((&)[ANY]) "$1 = ($1_ltype) $input;"
|
%typemap(in) SWIGTYPE ((&)[ANY]) "$1 = ($1_ltype) $input;"
|
||||||
|
|
@ -142,13 +143,10 @@
|
||||||
$1 = ($1_ltype) 0;
|
$1 = ($1_ltype) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* unsupported yet
|
|
||||||
%typemap(freearg) SWIGTYPE * [ANY], SWIGTYPE * [ANY][ANY], SWIGTYPE **, SWIGTYPE *** {
|
%typemap(freearg) SWIGTYPE * [ANY], SWIGTYPE * [ANY][ANY], SWIGTYPE **, SWIGTYPE *** {
|
||||||
if ($input)
|
if ($input)
|
||||||
free($input);
|
free($input);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE & {
|
%typemap(in) SWIGTYPE & {
|
||||||
if ($input)
|
if ($input)
|
||||||
|
|
@ -166,70 +164,151 @@
|
||||||
|
|
||||||
// typemaps for return values
|
// typemaps for return values
|
||||||
|
|
||||||
%typemap(couttype) void, short, int, long, char, float, double "$1_ltype"
|
// void
|
||||||
%typemap(couttype) unsigned short, unsigned int, unsigned long, unsigned char, signed char "$1_ltype"
|
%typemap(couttype) void "void"
|
||||||
%typemap(couttype) void *, short *, int *, long *, char *, float *, double*, unsigned char *, signed char * "$1_ltype"
|
%typemap(couttype) void*, const void* "void *"
|
||||||
%typemap(couttype) const short, const int, const long, const char, const float, const double "$1_ltype"
|
|
||||||
%typemap(couttype) const void *, const short *, const int *, const long *, const char *, const float *, const double * "$1_ltype"
|
// short
|
||||||
%typemap(couttype) short &, int &, long &, char &, float &, double & "$1_ltype"
|
%typemap(couttype) short, const short "short"
|
||||||
%typemap(couttype) const short &, const int &, const long &, const char &, const float &, const double & "$1_basetype const *"
|
%typemap(couttype) short*, short&, short[ANY], short[] "short *"
|
||||||
%typemap(couttype) short *&, int *&, long *&, char *&, float *&, double *& "$1_ltype"
|
%typemap(couttype) const short&, const short*, const short[ANY], const short[] "const short *"
|
||||||
%typemap(couttype) const short *&, const int *&, const long *&, const char *&, const float *&, const double *& "$1_ltype"
|
%typemap(couttype) unsigned short "unsigned short"
|
||||||
%typemap(couttype) short [ANY], int [ANY], long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY], signed char [ANY], unsigned int [ANY] "$1_ltype"
|
%typemap(couttype) const unsigned short "const unsigned short"
|
||||||
%typemap(couttype) short * [ANY], int * [ANY], long * [ANY], char * [ANY], float * [ANY], double * [ANY] "/*builtin * [ANY]*/ $1_ltype"
|
%typemap(couttype) unsigned short*, unsigned short&, unsigned short*, unsigned short[ANY], unsigned short[] "unsigned short *"
|
||||||
%typemap(couttype) short **, int **, long **, char **, float **, double ** "$1_ltype"
|
%typemap(couttype) const unsigned short*, const unsigned short&, const unsigned short[ANY], const unsigned short[] "const unsigned short *"
|
||||||
|
%typemap(couttype) short**, short*&, short*[ANY], short[ANY][ANY] "short **"
|
||||||
|
%typemap(couttype) const short**, const short*&, const short*[ANY], const short[ANY][ANY] "const short **"
|
||||||
|
%typemap(couttype) unsigned short**, unsigned short*&, unsigned short*[ANY], unsigned short[ANY][ANY] "unsigned short **"
|
||||||
|
%typemap(couttype) const unsigned short**,const unsigned short*&, const unsigned short[ANY][ANY] "const unsigned short **"
|
||||||
|
|
||||||
|
// int
|
||||||
|
%typemap(couttype) int, const int "int"
|
||||||
|
%typemap(couttype) int*, int&, int[ANY], int[] "int *"
|
||||||
|
%typemap(couttype) const int&, const int*, const int[ANY], const int[] "const int *"
|
||||||
|
%typemap(couttype) unsigned int "unsigned int"
|
||||||
|
%typemap(couttype) const unsigned int "unsigned int"
|
||||||
|
%typemap(couttype) unsigned int*, unsigned int&, unsigned int*, unsigned int[ANY], unsigned int[] "unsigned int *"
|
||||||
|
%typemap(couttype) const unsigned int*, const unsigned int&, const unsigned int[ANY], const unsigned int[] "const unsigned int *"
|
||||||
|
%typemap(couttype) int**, int*&, int*[ANY], int[ANY][ANY] "int **"
|
||||||
|
%typemap(couttype) const int**, const int*&, const int*[ANY], const int[ANY][ANY] "const int **"
|
||||||
|
%typemap(couttype) unsigned int**, unsigned int*&, unsigned int*[ANY], unsigned int[ANY][ANY] "unsigned int **"
|
||||||
|
%typemap(couttype) const unsigned int**,const unsigned int*&, const unsigned int[ANY][ANY] "const unsigned int **"
|
||||||
|
|
||||||
|
// long
|
||||||
|
%typemap(couttype) long, const long "long"
|
||||||
|
%typemap(couttype) long*, long&, long[ANY], long[] "long *"
|
||||||
|
%typemap(couttype) const long&, const long*, const long[ANY], const long[] "const long *"
|
||||||
|
%typemap(couttype) unsigned long "unsigned long"
|
||||||
|
%typemap(couttype) const unsigned long "const unsigned long"
|
||||||
|
%typemap(couttype) unsigned long*, unsigned long&, unsigned long*, unsigned long[ANY], unsigned long[] "unsigned long *"
|
||||||
|
%typemap(couttype) const unsigned long*, const unsigned long&, const unsigned long[ANY], const unsigned long[] "const unsigned long *"
|
||||||
|
%typemap(couttype) long**, long*&, long*[ANY], long[ANY][ANY] "long **"
|
||||||
|
%typemap(couttype) const long**, const long*&, const long*[ANY], const long[ANY][ANY] "const long **"
|
||||||
|
%typemap(couttype) unsigned long**, unsigned long*&, unsigned long*[ANY], unsigned long[ANY][ANY] "unsigned long **"
|
||||||
|
%typemap(couttype) const unsigned long**,const unsigned long*&, const unsigned long[ANY][ANY] "const unsigned long **"
|
||||||
|
|
||||||
|
// long long
|
||||||
|
%typemap(couttype) long long, const long long "long long"
|
||||||
|
%typemap(couttype) long long*, long long&, long long[ANY], long long[] "long long *"
|
||||||
|
%typemap(couttype) const long long&, const long long*, const long long[ANY], const long long[] "const long long *"
|
||||||
|
%typemap(couttype) unsigned long long "unsigned long long"
|
||||||
|
%typemap(couttype) const unsigned long long "const unsigned long long"
|
||||||
|
%typemap(couttype) unsigned long long*, unsigned long long&, unsigned long long*, unsigned long long[ANY], unsigned long long[] "unsigned long long *"
|
||||||
|
%typemap(couttype) const unsigned long long*, const unsigned long long&, const unsigned long long[ANY], const unsigned long long[] "const unsigned long long *"
|
||||||
|
%typemap(couttype) long long**, long long*&, long long*[ANY], long long[ANY][ANY] "long long **"
|
||||||
|
%typemap(couttype) const long long**, const long long*&, const long long*[ANY], const long long[ANY][ANY] "const long long **"
|
||||||
|
%typemap(couttype) unsigned long long**, unsigned long long*&, unsigned long long*[ANY], unsigned long long[ANY][ANY] "unsigned long long **"
|
||||||
|
%typemap(couttype) const unsigned long long**,const unsigned long long*&, const unsigned long long[ANY][ANY] "const unsigned long long **"
|
||||||
|
|
||||||
|
// char: signed/unsigned
|
||||||
|
%typemap(couttype) char, const char "char"
|
||||||
|
%typemap(couttype) char*, char&, char[ANY], char[] "$1_ltype"
|
||||||
|
%typemap(couttype) const char&, const char*, const char[ANY], const char[] "const char *"
|
||||||
|
%typemap(couttype) char**, char*&, char*[ANY], char[ANY][ANY] "char **"
|
||||||
|
%typemap(couttype) const char**, const char*&, const char*[ANY], const char[ANY][ANY] "char **"
|
||||||
|
%typemap(couttype) signed char**, signed char*&, signed char*[ANY], signed char[ANY][ANY] "signed char **"
|
||||||
|
%typemap(couttype) const signed char**, const signed char*&, const signed char[ANY][ANY] "const signed char **"
|
||||||
|
%typemap(couttype) signed char "signed char"
|
||||||
|
%typemap(couttype) const signed char "const signed char"
|
||||||
|
%typemap(couttype) signed char*, signed char&, signed char*, signed char[ANY], signed char[] "signed char *"
|
||||||
|
%typemap(couttype) const signed char*, const signed char&, const signed char[ANY], const signed char[] "const $1_ltype"
|
||||||
|
%typemap(couttype) unsigned char**, unsigned char*&, unsigned char*[ANY], unsigned char[ANY][ANY] "unsigned char **"
|
||||||
|
%typemap(couttype) const unsigned char**, const unsigned char*&, const unsigned char[ANY][ANY] "const unsigned char **"
|
||||||
|
%typemap(couttype) unsigned char "unsigned char"
|
||||||
|
%typemap(couttype) const unsigned char "const unsigned char"
|
||||||
|
%typemap(couttype) unsigned char*, unsigned char&, unsigned char*, unsigned char[ANY], unsigned char[] "unsigned char *"
|
||||||
|
%typemap(couttype) const unsigned char*, const unsigned char&, const unsigned char[ANY], const unsigned char[] "const unsigned char *"
|
||||||
|
|
||||||
|
// float
|
||||||
|
%typemap(couttype) float, const float "float"
|
||||||
|
%typemap(couttype) float*, float&, float[ANY], float[] "float *"
|
||||||
|
%typemap(couttype) const float&, const float*, const float[ANY], const float[] "const float *"
|
||||||
|
%typemap(couttype) float**, float*&, const float*&, float*[ANY], float[ANY][ANY] "float **"
|
||||||
|
%typemap(couttype) const float**, const float*[ANY], const float[ANY][ANY] "const float **"
|
||||||
|
|
||||||
|
// double
|
||||||
|
%typemap(couttype) double, const double "double"
|
||||||
|
%typemap(couttype) double*, double&, double[ANY], double[] "double *"
|
||||||
|
%typemap(couttype) const double&, const double*, const double[ANY], const double[] "const double *"
|
||||||
|
%typemap(couttype) double**, double*&, const double*&, double*[ANY], double[ANY][ANY] "double **"
|
||||||
|
%typemap(couttype) const double**, const double*[ANY], const double[ANY][ANY] "const double **"
|
||||||
|
|
||||||
|
// objects
|
||||||
%typemap(couttype) SWIGTYPE "SwigObj *"
|
%typemap(couttype) SWIGTYPE "SwigObj *"
|
||||||
%typemap(couttype) SWIGTYPE * "/*aaaaaa*/SwigObj *"
|
%typemap(couttype) SWIGTYPE * "/*aaaaaa*/SwigObj *"
|
||||||
%typemap(couttype) SWIGTYPE & "SwigObj *"
|
%typemap(couttype) SWIGTYPE & "SwigObj *"
|
||||||
%typemap(couttype) SWIGTYPE *& "SwigObj **"
|
%typemap(couttype) SWIGTYPE *& "SwigObj **"
|
||||||
%typemap(couttype) SWIGTYPE [ANY] "/*SWIGTYPE [ANY]*/ SwigObj **"
|
%typemap(couttype) SWIGTYPE [ANY] "/*SWIGTYPE [ANY]*/ SwigObj **"
|
||||||
%typemap(couttype) SWIGTYPE * [ANY], SWIGTYPE ** "/*SWIGTYPE *[ANY]/** */ SwigObj **"
|
%typemap(couttype) SWIGTYPE * [ANY] "/*SWIGTYPE *[ANY] */ SwigObj **"
|
||||||
//%typemap(couttype) SWIGTYPE * [ANY][ANY], SWIGTYPE *** "SwigObj ***"
|
%typemap(couttype) SWIGTYPE ** "/*SWIGTYPE ** */ SwigObj **"
|
||||||
%typemap(couttype) enum SWIGTYPE "int"
|
%typemap(couttype) enum SWIGTYPE "int"
|
||||||
|
%typemap(couttype) enum SWIGTYPE &, enum SWIGTYPE * "int *"
|
||||||
%typemap(couttype, fragment="fptr_decl") SWIGTYPE (CLASS::*) "SWIG_CPP_FP"
|
%typemap(couttype, fragment="fptr_decl") SWIGTYPE (CLASS::*) "SWIG_CPP_FP"
|
||||||
|
|
||||||
%typemap(couttype, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$1_ltype"
|
%typemap(couttype, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$1_ltype"
|
||||||
%typemap(couttype, fragment="stdbool_inc") bool & "$1_basetype*"
|
%typemap(couttype, fragment="stdbool_inc") bool & "$1_basetype*"
|
||||||
%typemap(couttype, fragment="stdbool_inc") const bool & "$1_basetype const *"
|
%typemap(couttype, fragment="stdbool_inc") const bool & "$1_basetype const *"
|
||||||
|
|
||||||
%typemap(out) short, int, long, char, float, double "$result = $1;"
|
%typemap(out) short, int, long, long long, char, float, double "$result = $1;"
|
||||||
%typemap(out) void*, short*, int*, long*, char*, float*, double* "$result = $1;"
|
%typemap(out) void*, short*, int*, long*, long long *, char*, float*, double* "$result = $1;"
|
||||||
%typemap(out) const short, const int, const long, const char, const float, const double "$result = ($1_ltype) $1;"
|
%typemap(out) const short, const int, const long, const long long, const char, const float, const double "$result = ($1_ltype) $1;"
|
||||||
%typemap(out) const void *, const short *, const int *, const long *, const char *, const float *, const double * "$result = ($1_ltype) $1;"
|
%typemap(out) const void *, const short *, const int *, const long *, const long long *, const char *, const float *, const double * "$result = ($1_ltype) $1;"
|
||||||
%typemap(out) unsigned short, unsigned int, unsigned long, unsigned char, signed char "$result = $1;"
|
%typemap(out) unsigned short, unsigned int, unsigned long, unsigned long long, unsigned char, signed char "$result = $1;"
|
||||||
%typemap(out) unsigned short *, unsigned int *, unsigned long *, unsigned char *, signed char * "$result = $1;"
|
%typemap(out) unsigned short *, unsigned int *, unsigned long *, unsigned long long *, unsigned char *, signed char * "$result = $1;"
|
||||||
%typemap(out) short &, int &, long &, char &, float &, double & "$result = $1;"
|
%typemap(out) short &, int &, long &, long long &, char &, float &, double & "$result = $1;"
|
||||||
%typemap(out) unsigned short &, unsigned int &, unsigned long &, unsigned char &, signed char & "$result = $1;"
|
%typemap(out) unsigned short &, unsigned int &, unsigned long &, unsigned long long &, unsigned char &, signed char & "$result = $1;"
|
||||||
%typemap(out) const short &, const int &, const long &, const char &, const float &, const double & "$result = $1;"
|
%typemap(out) const short &, const int &, const long &, const long long &, const char &, const float &, const double & "$result = $1;"
|
||||||
%typemap(out) const unsigned short &, const unsigned int &, const unsigned long &, const unsigned char &, const signed char & "$result = $1;"
|
%typemap(out) const unsigned short &, const unsigned int &, const unsigned long &, const unsigned long long &, const unsigned char &, const signed char & "$result = $1;"
|
||||||
%typemap(out) short *&, int *&, long *&, char *&, float *&, double *& "$result = $1;"
|
%typemap(out) short *&, int *&, long *&, long long *&, char *&, float *&, double *& "$result = $1;"
|
||||||
%typemap(out) const short *&, const int *&, const long *&, const char *&, const float *&, const double *& "$result = $1;"
|
%typemap(out) const short *&, const int *&, const long *&, const long long *&, const char *&, const float *&, const double *& "$result = $1;"
|
||||||
%typemap(out) short [ANY], int [ANY], long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY], signed char [ANY], unsigned int [ANY] "$result = $1;"
|
%typemap(out) short [ANY], int [ANY], long [ANY], long long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY], signed char [ANY], unsigned int [ANY] "$result = $1;"
|
||||||
%typemap(out) short * [ANY], int * [ANY], long * [ANY], char * [ANY], float * [ANY], double * [ANY] "$result = $1;"
|
%typemap(out) short * [ANY], int * [ANY], long * [ANY], long long * [ANY], char * [ANY], float * [ANY], double * [ANY] "$result = $1;"
|
||||||
%typemap(out) short **, int **, long **, char **, float **, double ** "$result = $1;"
|
%typemap(out) short **, int **, long **, long long **, char **, float **, double ** "$result = $1;"
|
||||||
%typemap(out) void ""
|
%typemap(out) void ""
|
||||||
|
|
||||||
%typemap(out, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$result = ($1_ltype) $1;"
|
%typemap(out, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$result = ($1_ltype) $1;"
|
||||||
%typemap(out, fragment="stdbool_inc") bool &, const bool & "$result = $1;"
|
%typemap(out, fragment="stdbool_inc") bool &, const bool & "$result = $1;"
|
||||||
|
|
||||||
%typemap(out) enum SWIGTYPE "$result = ($1_ltype) $1;"
|
%typemap(out) enum SWIGTYPE "$result = (int) $1;"
|
||||||
|
%typemap(out) enum SWIGTYPE &, enum SWIGTYPE * "$result = (int *) &$1;"
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE (CLASS::*) {
|
%typemap(out) SWIGTYPE (CLASS::*) {
|
||||||
*($&1_ltype) &$result = $1;
|
*($&1_ltype) &$result = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE *&, SWIGTYPE ** {
|
%typemap(out) SWIGTYPE *&, SWIGTYPE ** {
|
||||||
$result = &SWIG_temporary;
|
static SwigObj* _ptr = (SwigObj*) SWIG_create_object(SWIG_STR($1_basetype));
|
||||||
|
$result = &_ptr;
|
||||||
(*result)->obj = (void*) $1;
|
(*result)->obj = (void*) $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE {
|
%typemap(out) SWIGTYPE {
|
||||||
$result = SWIG_temporary;
|
$result = (SwigObj*) SWIG_create_object(SWIG_STR($1_basetype));
|
||||||
$result->obj = (void*) &$1;
|
$result->obj = (void*) &$1;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE *, SWIGTYPE & {
|
%typemap(out) SWIGTYPE *, SWIGTYPE & {
|
||||||
$result = SWIG_temporary;
|
$result = (SwigObj*) SWIG_create_object(SWIG_STR($1_basetype));
|
||||||
$result->obj = (void*) $1;
|
$result->obj = (void*) $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,65 +336,68 @@
|
||||||
$result = (SwigObj**) 0;
|
$result = (SwigObj**) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// typemaps for 'cppresult'
|
||||||
|
// this needs refactoring -- see 'couttype' typemaps
|
||||||
|
|
||||||
|
%typemap(cppouttype) void, short, int, long, long long, char, float, double "$1_ltype"
|
||||||
|
%typemap(cppouttype) unsigned short, unsigned int, unsigned long, unsigned long long, unsigned char, signed char "$1_ltype"
|
||||||
|
%typemap(cppouttype) void *, short *, int *, long *, long long *, char *, float *, double*, unsigned char *, unsigned int *, unsigned long *, unsigned char *, signed char * "$1_ltype"
|
||||||
|
%typemap(cppouttype) const short, const int, const long, const long long, const char, const float, const double "$1_ltype"
|
||||||
|
%typemap(cppouttype) const void *, const short *, const int *, const long *, const long long *, const char *, const float *, const double * "$1_ltype"
|
||||||
|
%typemap(cppouttype) short &, int &, long &, long long &, char &, float &, double &, unsigned short &, unsigned int &, unsigned long &, unsigned long long &, unsigned char &, signed char & "$1_ltype"
|
||||||
|
%typemap(cppouttype) const short &, const int &, const long &, const long long &, const char &, const float &, const double & "$1_ltype"
|
||||||
|
%typemap(cppouttype) short *&, int *&, long *&, long long *&, char *&, float *&, double *& "$1_ltype"
|
||||||
|
%typemap(cppouttype) const short *&, const int *&, const long *&, const long long *&, const char *&, const float *&, const double *& "$1_ltype"
|
||||||
|
%typemap(cppouttype) short [ANY], int [ANY], long [ANY], long long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY], signed char [ANY], unsigned int [ANY] "$1_ltype"
|
||||||
|
|
||||||
|
%typemap(cppouttype) const char* "const char *"
|
||||||
|
%typemap(cppouttype) const unsigned char* "const unsigned char *"
|
||||||
|
%typemap(cppouttype) const signed char* "const signed char *"
|
||||||
|
%typemap(cppouttype) short * [ANY], int * [ANY], long * [ANY], long long * [ANY], char * [ANY], float * [ANY], double * [ANY] "/*builtin * [ANY]*/ $1_ltype"
|
||||||
|
|
||||||
|
%typemap(cppouttype) short **, int **, long **, long long **, char **, float **, double ** "$1_ltype"
|
||||||
|
%typemap(cppouttype, retobj="1") SWIGTYPE "$1_ltype *"
|
||||||
|
%typemap(cppouttype) SWIGTYPE * "$1_ltype"
|
||||||
|
%typemap(cppouttype) const SWIGTYPE * "const $1_ltype"
|
||||||
|
%typemap(cppouttype) SWIGTYPE & "$1_ltype"
|
||||||
|
%typemap(cppouttype) SWIGTYPE *& "$1_ltype"
|
||||||
|
%typemap(cppouttype) SWIGTYPE [ANY] "$1_ltype"
|
||||||
|
%typemap(cppouttype) SWIGTYPE * [ANY] "/*SWIGTYPE *[ANY] */ $1_ltype"
|
||||||
|
%typemap(cppouttype) SWIGTYPE ** "/*SWIGTYPE ** */ $1_basetype **"
|
||||||
|
%typemap(cppouttype, retobj="1") enum SWIGTYPE "int"
|
||||||
|
%typemap(cppouttype) enum SWIGTYPE * "int *"
|
||||||
|
%typemap(cppouttype) enum SWIGTYPE & "int *"
|
||||||
|
%typemap(cppouttype, fragment="fptr_decl") SWIGTYPE (CLASS::*) "$1_ltype"
|
||||||
|
|
||||||
|
%typemap(cppouttype, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$1_ltype"
|
||||||
|
%typemap(cppouttype, fragment="stdbool_inc") bool & "$1_basetype*"
|
||||||
|
%typemap(cppouttype, fragment="stdbool_inc") const bool & "$1_basetype const *"
|
||||||
|
|
||||||
|
// templates typemaps - in progress...
|
||||||
/*
|
/*
|
||||||
* 2+ dim arrays - not supported yet
|
%typemap(ctype) SWIGTYPE<T>, const SWIGTYPE<T> &, const SWIGTYPE<T> * "SwigObj *"
|
||||||
%typemap(out) SWIGTYPE * [ANY][ANY], SWIGTYPE *** {
|
%typemap(in) SWIGTYPE<T>, const SWIGTYPE<T> &, const SWIGTYPE<T> * { $1 = ($1_ltype) $input; }
|
||||||
if ($1) {
|
|
||||||
$result = (SwigObj***) malloc($1_dim0 * $1_dim1 * sizeof(SwigObj*));
|
|
||||||
size_t i = 0, j = 0;
|
|
||||||
for ( ; i < $1_dim0; ++i) {
|
|
||||||
for ( ; j < $1_dim1; ++j) {
|
|
||||||
if ($1[i][j]) {
|
|
||||||
$result[i][j] = SWIG_create_object(SWIG_STR($1_ltype));
|
|
||||||
$result[i][j]->obj = (void*) $1[i][j];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$result[i][j] = (SwigObj*) 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$result = (SwigObj***) 0;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
%typemap(out) SWIGTYPE<T>, const SWIGTYPE<T> &, const SWIGTYPE<T> * "$result = ($1_ltype) $1;"
|
||||||
|
|
||||||
#ifdef SWIG_C_EXCEPT
|
%typemap(cppouttype) SWIGTYPE<T>, const SWIGTYPE<T> &, const SWIGTYPE<T> * "$1_ltype"
|
||||||
|
*/
|
||||||
|
|
||||||
|
//%define size_t unsigned long %enddef
|
||||||
|
|
||||||
|
%apply unsigned long { size_t };
|
||||||
|
%apply const unsigned long & { const size_t & };
|
||||||
|
|
||||||
|
#ifdef SWIG_CPPMODE
|
||||||
|
|
||||||
|
#ifdef SWIG_C_EXCEPT
|
||||||
|
|
||||||
%insert("runtime") %{
|
%insert("runtime") %{
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *obj;
|
void *obj;
|
||||||
const char **typenames;
|
const char **typenames;
|
||||||
} SwigObj;
|
} SwigObj;
|
||||||
%}
|
%}
|
||||||
%include "cexcept.swg"
|
|
||||||
#ifdef SWIG_CPPMODE
|
|
||||||
%insert("runtime") %{
|
|
||||||
SwigObj *SWIG_temporary = (SwigObj *) malloc(sizeof(SwigObj));
|
|
||||||
%}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
%insert("runtime") %{
|
|
||||||
typedef struct {
|
|
||||||
void *obj;
|
|
||||||
} SwigObj;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SWIGEXPORTC int SWIG_exit(int code) {
|
|
||||||
exit(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
#ifdef SWIG_CPPMODE
|
|
||||||
%insert("runtime") %{
|
|
||||||
SwigObj *SWIG_temporary = (SwigObj *) malloc(sizeof(SwigObj));
|
|
||||||
%}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
%insert("proxy_header") %{
|
%insert("proxy_header") %{
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -324,5 +406,61 @@ typedef struct {
|
||||||
} SwigObj;
|
} SwigObj;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
#endif
|
%include "cexcept.swg"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
%insert("runtime") %{
|
||||||
|
typedef struct {
|
||||||
|
void *obj;
|
||||||
|
} SwigObj;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
SWIGEXPORTC int SWIG_exit(int code) { exit(code); }
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
|
%insert("proxy_header") %{
|
||||||
|
typedef struct {
|
||||||
|
void *obj;
|
||||||
|
} SwigObj;
|
||||||
|
%}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
%insert(runtime) %{
|
||||||
|
SwigObj *SWIG_temporary = (SwigObj *) malloc(sizeof(SwigObj));
|
||||||
|
%}
|
||||||
|
|
||||||
|
%insert("proxy_header") %{
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#define SWIG_MAKE_DELETE(Name,Obj) void Name(Obj *op1, ...) {\
|
||||||
|
Obj *obj;\
|
||||||
|
va_list vl;\
|
||||||
|
va_start(vl, op1);\
|
||||||
|
do {\
|
||||||
|
obj = va_arg(vl, Obj *);\
|
||||||
|
delete_##Obj(obj);\
|
||||||
|
} while (obj);\
|
||||||
|
va_end(vl);\
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
%insert("runtime") %{
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
SWIGEXPORTC int SWIG_exit(int code) { exit(code); }
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,260 +1,265 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* clabels.swg
|
* clabels.swg
|
||||||
*
|
*
|
||||||
* Exception handling code and typemaps for C module.
|
* Exception handling code and typemaps for C module.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%typemap(throws) BASIC_INT_TYPES {
|
%typemap(throws) BASIC_INT_TYPES {
|
||||||
char error_msg[256];
|
char error_msg[256];
|
||||||
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
||||||
SWIG_CThrowException(0, error_msg);
|
SWIG_CThrowException(0, error_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
%apply BASIC_INT_TYPES { int, long, short, unsigned int, unsigned long, unsigned short, int &, long &, short &, unsigned int &, unsigned long &, unsigned short & };
|
%apply BASIC_INT_TYPES { int, long, short, unsigned int, unsigned long, unsigned short, int &, long &, short &, unsigned int &, unsigned long &, unsigned short & };
|
||||||
|
|
||||||
%typemap(throws) char *, const char * {
|
%typemap(throws) char *, const char * {
|
||||||
SWIG_CThrowException(0, $1);
|
SWIG_CThrowException(0, $1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this should match only SwigObj objects
|
// this should match only SwigObj objects
|
||||||
%typemap(throws) SWIGTYPE {
|
%typemap(throws) SWIGTYPE {
|
||||||
SwigObj *c_ex;
|
SwigObj *c_ex;
|
||||||
c_ex = SWIG_create_object(SWIG_STR($1_basetype));
|
c_ex = SWIG_create_object(SWIG_STR($1_basetype));
|
||||||
c_ex->obj = (void*) &$1;
|
c_ex->obj = (void*) &$1;
|
||||||
SWIG_CThrowException(c_ex, "C++ $1_type exception thrown");
|
SWIG_CThrowException(c_ex, "C++ $1_type exception thrown");
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(throws) SWIGTYPE * {
|
%typemap(throws) SWIGTYPE * {
|
||||||
SwigObj *c_ex;
|
SwigObj *c_ex;
|
||||||
c_ex = SWIG_create_object(SWIG_STR($1_basetype));
|
c_ex = SWIG_create_object(SWIG_STR($1_basetype));
|
||||||
c_ex->obj = (void*) $1;
|
c_ex->obj = (void*) $1;
|
||||||
SWIG_CThrowException(c_ex, "C++ $1_type exception thrown");
|
SWIG_CThrowException(c_ex, "C++ $1_type exception thrown");
|
||||||
}
|
}
|
||||||
|
|
||||||
%insert("runtime") %{
|
%insert("runtime") %{
|
||||||
#define SWIG_MAX_RT_STACK 256
|
#define SWIG_MAX_RT_STACK 256
|
||||||
#define SWIG_REGISTRY_INIT 256
|
#define SWIG_REGISTRY_INIT 256
|
||||||
|
|
||||||
SWIGINTERN SwigObj **SWIG_registry_base = 0;
|
SWIGINTERN SwigObj **SWIG_registry_base = 0;
|
||||||
SWIGINTERN SwigObj **SWIG_registry = 0;
|
SWIGINTERN SwigObj **SWIG_registry = 0;
|
||||||
SWIGINTERN int SWIG_registry_size = SWIG_REGISTRY_INIT;
|
SWIGINTERN int SWIG_registry_size = SWIG_REGISTRY_INIT;
|
||||||
|
|
||||||
SWIGINTERN SwigObj *SWIG_create_object(const char *classname);
|
SWIGINTERN SwigObj *SWIG_create_object(const char *classname);
|
||||||
SWIGINTERN void SWIG_destroy_object(SwigObj *object);
|
SWIGINTERN void SWIG_destroy_object(SwigObj *object);
|
||||||
|
SWIGINTERN void SWIG_free_SwigObj(SwigObj *object);
|
||||||
SWIGEXPORTC struct SWIG_exc_struct {
|
|
||||||
int code;
|
SWIGEXPORTC struct SWIG_exc_struct {
|
||||||
char *msg;
|
int code;
|
||||||
SwigObj *klass;
|
char *msg;
|
||||||
int handled;
|
SwigObj *klass;
|
||||||
} SWIG_exc = { 0, 0, 0, 0 };
|
int handled;
|
||||||
|
} SWIG_exc = { 0, 0, 0, 0 };
|
||||||
SWIGEXPORTC jmp_buf SWIG_rt_env;
|
|
||||||
SWIGEXPORTC int SWIG_rt_init = 0;
|
SWIGEXPORTC jmp_buf SWIG_rt_env;
|
||||||
SWIGINTERN jmp_buf SWIG_cpp_back_env;
|
SWIGEXPORTC int SWIG_rt_init = 0;
|
||||||
SWIGINTERN jmp_buf *SWIG_rt_stack_base = 0;
|
SWIGINTERN jmp_buf SWIG_cpp_back_env;
|
||||||
SWIGINTERN jmp_buf *SWIG_rt_stack_ptr = 0;
|
SWIGINTERN jmp_buf *SWIG_rt_stack_base = 0;
|
||||||
|
SWIGINTERN jmp_buf *SWIG_rt_stack_ptr = 0;
|
||||||
SWIGINTERN void SWIG_rt_stack_push() {
|
|
||||||
// TODO: check for stack overflow
|
SWIGINTERN void SWIG_rt_stack_push() {
|
||||||
memcpy(SWIG_rt_stack_ptr, SWIG_rt_env, sizeof(SWIG_rt_env));
|
// TODO: check for stack overflow
|
||||||
SWIG_rt_stack_ptr++;
|
memcpy(SWIG_rt_stack_ptr, SWIG_rt_env, sizeof(SWIG_rt_env));
|
||||||
}
|
SWIG_rt_stack_ptr++;
|
||||||
|
}
|
||||||
SWIGINTERN void SWIG_rt_stack_pop() {
|
|
||||||
if (SWIG_rt_stack_ptr == SWIG_rt_stack_base)
|
SWIGINTERN void SWIG_rt_stack_pop() {
|
||||||
return;
|
if (SWIG_rt_stack_ptr == SWIG_rt_stack_base)
|
||||||
SWIG_rt_stack_ptr--;
|
return;
|
||||||
memcpy(SWIG_rt_env, SWIG_rt_stack_ptr, sizeof(SWIG_rt_env));
|
SWIG_rt_stack_ptr--;
|
||||||
}
|
memcpy(SWIG_rt_env, SWIG_rt_stack_ptr, sizeof(SWIG_rt_env));
|
||||||
|
}
|
||||||
SWIGINTERN void SWIG_add_registry_entry(SwigObj *entry) {
|
|
||||||
if (SWIG_registry_base == 0) {
|
SWIGINTERN void SWIG_add_registry_entry(SwigObj *entry) {
|
||||||
SWIG_registry_base = SWIG_registry = (SwigObj **) malloc(SWIG_registry_size * sizeof(SwigObj *));
|
if (SWIG_registry_base == 0) {
|
||||||
memset(SWIG_registry_base, 0, SWIG_registry_size * sizeof(SwigObj *));
|
SWIG_registry_base = SWIG_registry = (SwigObj **) malloc(SWIG_registry_size * sizeof(SwigObj *));
|
||||||
}
|
memset(SWIG_registry_base, 0, SWIG_registry_size * sizeof(SwigObj *));
|
||||||
*SWIG_registry = entry;
|
}
|
||||||
SWIG_registry++;
|
*SWIG_registry = entry;
|
||||||
if ((SWIG_registry - SWIG_registry_base) == SWIG_registry_size) {
|
SWIG_registry++;
|
||||||
SWIG_registry = SWIG_registry_base;
|
if ((SWIG_registry - SWIG_registry_base) == SWIG_registry_size) {
|
||||||
SWIG_registry_size += SWIG_REGISTRY_INIT;
|
SWIG_registry = SWIG_registry_base;
|
||||||
int new_size = SWIG_registry_size * sizeof(SwigObj *);
|
SWIG_registry_size += SWIG_REGISTRY_INIT;
|
||||||
SWIG_registry_base = (SwigObj **) malloc(new_size);
|
int new_size = SWIG_registry_size * sizeof(SwigObj *);
|
||||||
memset(SWIG_registry_base, 0, new_size);
|
SWIG_registry_base = (SwigObj **) malloc(new_size);
|
||||||
memcpy(SWIG_registry_base, SWIG_registry, (SWIG_registry_size - SWIG_REGISTRY_INIT) * sizeof(SwigObj *));
|
memset(SWIG_registry_base, 0, new_size);
|
||||||
free(SWIG_registry);
|
memcpy(SWIG_registry_base, SWIG_registry, (SWIG_registry_size - SWIG_REGISTRY_INIT) * sizeof(SwigObj *));
|
||||||
SWIG_registry = SWIG_registry_base + (SWIG_registry_size - SWIG_REGISTRY_INIT);
|
free(SWIG_registry);
|
||||||
}
|
SWIG_registry = SWIG_registry_base + (SWIG_registry_size - SWIG_REGISTRY_INIT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
SWIGINTERN void SWIG_remove_registry_entry(SwigObj *entry) {
|
|
||||||
int i;
|
SWIGINTERN void SWIG_remove_registry_entry(SwigObj *entry) {
|
||||||
for (i = 0; i < SWIG_registry_size; ++i) {
|
int i;
|
||||||
if (*(SWIG_registry_base + i) == entry) {
|
for (i = 0; i < SWIG_registry_size; ++i) {
|
||||||
*(SWIG_registry_base + i) = 0;
|
if (*(SWIG_registry_base + i) == entry) {
|
||||||
break;
|
*(SWIG_registry_base + i) = 0;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
SWIGINTERN void SWIG_cleanup() {
|
|
||||||
if (SWIG_rt_stack_base)
|
SWIGINTERN void SWIG_free_SwigObj(SwigObj *object) {
|
||||||
free(SWIG_rt_stack_base);
|
if (object) {
|
||||||
if (SWIG_exc.msg)
|
if (object->typenames)
|
||||||
free(SWIG_exc.msg);
|
free(object->typenames);
|
||||||
if (SWIG_exc.klass) {
|
free(object);
|
||||||
if (SWIG_exc.klass->typenames)
|
object = (SwigObj *) 0;
|
||||||
free(SWIG_exc.klass->typenames);
|
}
|
||||||
free(SWIG_exc.klass);
|
}
|
||||||
}
|
|
||||||
int i;
|
SWIGINTERN void SWIG_cleanup() {
|
||||||
if (SWIG_registry_base) {
|
if (SWIG_rt_stack_base)
|
||||||
for (i = 0; i < SWIG_registry_size; ++i) {
|
free(SWIG_rt_stack_base);
|
||||||
if (*(SWIG_registry_base + i)) {
|
if (SWIG_exc.msg)
|
||||||
SWIG_destroy_object(*(SWIG_registry_base + i));
|
free(SWIG_exc.msg);
|
||||||
*(SWIG_registry_base + i) = 0;
|
if (SWIG_exc.klass) {
|
||||||
}
|
if (SWIG_exc.klass->typenames)
|
||||||
}
|
free(SWIG_exc.klass->typenames);
|
||||||
}
|
free(SWIG_exc.klass);
|
||||||
free(SWIG_registry_base);
|
}
|
||||||
SWIG_registry_base = 0;
|
int i;
|
||||||
}
|
if (SWIG_registry_base) {
|
||||||
|
for (i = 0; i < SWIG_registry_size; ++i) {
|
||||||
#ifdef __cplusplus
|
if (*(SWIG_registry_base + i)) {
|
||||||
extern "C" {
|
SWIG_free_SwigObj(*(SWIG_registry_base + i));
|
||||||
#endif
|
*(SWIG_registry_base + i) = 0;
|
||||||
|
}
|
||||||
SWIGEXPORTC void SWIG_rt_try() {
|
}
|
||||||
SWIG_rt_stack_push();
|
}
|
||||||
}
|
free(SWIG_registry_base);
|
||||||
|
SWIG_registry_base = 0;
|
||||||
SWIGEXPORTC int SWIG_rt_catch(const char *type) {
|
}
|
||||||
int result = 0;
|
|
||||||
if (!type || (strcmp("SWIG_AnyException", type) == 0)) {
|
#ifdef __cplusplus
|
||||||
result = 1;
|
extern "C" {
|
||||||
}
|
#endif
|
||||||
else if (SWIG_exc.klass) {
|
|
||||||
int i = 0;
|
SWIGEXPORTC void SWIG_rt_try() {
|
||||||
while (SWIG_exc.klass->typenames[i]) {
|
SWIG_rt_stack_push();
|
||||||
if (strcmp(SWIG_exc.klass->typenames[i++], type) == 0) {
|
}
|
||||||
result = 1;
|
|
||||||
break;
|
SWIGEXPORTC int SWIG_rt_catch(const char *type) {
|
||||||
}
|
int result = 0;
|
||||||
}
|
if (!type || (strcmp("SWIG_AnyException", type) == 0)) {
|
||||||
}
|
result = 1;
|
||||||
if (result) {
|
}
|
||||||
SWIG_rt_stack_pop();
|
else if (SWIG_exc.klass) {
|
||||||
SWIG_exc.handled = 1;
|
int i = 0;
|
||||||
}
|
while (SWIG_exc.klass->typenames[i]) {
|
||||||
return result;
|
if (strcmp(SWIG_exc.klass->typenames[i++], type) == 0) {
|
||||||
}
|
result = 1;
|
||||||
|
break;
|
||||||
SWIGEXPORTC void SWIG_rt_throw(SwigObj *klass, const char *msg) {
|
}
|
||||||
if (SWIG_exc.msg) {
|
}
|
||||||
free(SWIG_exc.msg);
|
}
|
||||||
SWIG_exc.msg = (char *) 0;
|
if (result) {
|
||||||
}
|
SWIG_rt_stack_pop();
|
||||||
if (msg) {
|
SWIG_exc.handled = 1;
|
||||||
SWIG_exc.msg = (char *) malloc(strlen(msg) + 1);
|
}
|
||||||
strcpy(SWIG_exc.msg, msg);
|
return result;
|
||||||
}
|
}
|
||||||
SWIG_exc.klass = klass;
|
|
||||||
SWIG_exc.handled = 0;
|
SWIGEXPORTC void SWIG_rt_throw(SwigObj *klass, const char *msg) {
|
||||||
longjmp(SWIG_rt_env, 1);
|
if (SWIG_exc.msg) {
|
||||||
}
|
free(SWIG_exc.msg);
|
||||||
|
SWIG_exc.msg = (char *) 0;
|
||||||
SWIGEXPORTC void SWIG_rt_unhandled() {
|
}
|
||||||
if (SWIG_exc.msg) {
|
if (msg) {
|
||||||
free(SWIG_exc.msg);
|
SWIG_exc.msg = (char *) malloc(strlen(msg) + 1);
|
||||||
SWIG_exc.msg = 0;
|
strcpy(SWIG_exc.msg, msg);
|
||||||
}
|
}
|
||||||
SWIG_rt_stack_pop();
|
SWIG_exc.klass = klass;
|
||||||
longjmp(SWIG_rt_env, SWIG_exc.code);
|
SWIG_exc.handled = 0;
|
||||||
}
|
longjmp(SWIG_rt_env, 1);
|
||||||
|
}
|
||||||
SWIGEXPORTC void SWIG_rt_endtry() {
|
|
||||||
if (SWIG_exc.handled) {
|
SWIGEXPORTC void SWIG_rt_unhandled() {
|
||||||
if (setjmp(SWIG_rt_env) == 0) {
|
if (SWIG_exc.msg) {
|
||||||
SWIG_rt_stack_push();
|
free(SWIG_exc.msg);
|
||||||
longjmp(SWIG_cpp_back_env, 1);
|
SWIG_exc.msg = 0;
|
||||||
}
|
}
|
||||||
}
|
SWIG_rt_stack_pop();
|
||||||
else {
|
longjmp(SWIG_rt_env, SWIG_exc.code);
|
||||||
SWIG_rt_stack_pop(); // pop the SWIG_try context
|
}
|
||||||
}
|
|
||||||
}
|
SWIGEXPORTC void SWIG_rt_endtry() {
|
||||||
|
if (SWIG_exc.handled) {
|
||||||
SWIGEXPORTC int SWIG_exit(int code) {
|
if (setjmp(SWIG_rt_env) == 0) {
|
||||||
SWIG_cleanup();
|
SWIG_rt_stack_push();
|
||||||
exit(code);
|
longjmp(SWIG_cpp_back_env, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#ifdef __cplusplus
|
else {
|
||||||
}
|
SWIG_rt_stack_pop(); // pop the SWIG_try context
|
||||||
#endif
|
}
|
||||||
|
}
|
||||||
SWIGINTERN void SWIG_terminate() {
|
|
||||||
fprintf(stderr, "Unhandled exception: %s\n%s\nExitting...\n",
|
SWIGEXPORTC int SWIG_exit(int code) {
|
||||||
SWIG_exc.klass->typenames[0],
|
SWIG_cleanup();
|
||||||
SWIG_exc.msg ? SWIG_exc.msg : "");
|
exit(code);
|
||||||
SWIG_exit(SWIG_exc.code);
|
}
|
||||||
}
|
|
||||||
|
#ifdef __cplusplus
|
||||||
SWIGINTERN void SWIG_runtime_init() {
|
}
|
||||||
int i, code;
|
#endif
|
||||||
if (!SWIG_rt_init) {
|
|
||||||
SWIG_rt_init = 1;
|
SWIGINTERN void SWIG_terminate() {
|
||||||
SWIG_rt_stack_base = SWIG_rt_stack_ptr = (jmp_buf *) malloc(sizeof(jmp_buf) * SWIG_MAX_RT_STACK);
|
fprintf(stderr, "Unhandled exception: %s\n%s\nExitting...\n",
|
||||||
if (SWIG_exc.code = setjmp(SWIG_rt_env)) {
|
SWIG_exc.klass->typenames[0],
|
||||||
// deallocate C++ exception
|
SWIG_exc.msg ? SWIG_exc.msg : "");
|
||||||
if (setjmp(SWIG_rt_env) == 0) {
|
SWIG_exit(SWIG_exc.code);
|
||||||
SWIG_rt_stack_push();
|
}
|
||||||
SWIG_exc.handled = 1;
|
|
||||||
longjmp(SWIG_cpp_back_env, 1);
|
SWIGINTERN void SWIG_runtime_init() {
|
||||||
}
|
int i, code;
|
||||||
SWIG_terminate();
|
if (!SWIG_rt_init) {
|
||||||
}
|
SWIG_rt_init = 1;
|
||||||
}
|
SWIG_rt_stack_base = SWIG_rt_stack_ptr = (jmp_buf *) malloc(sizeof(jmp_buf) * SWIG_MAX_RT_STACK);
|
||||||
}
|
if (SWIG_exc.code = setjmp(SWIG_rt_env)) {
|
||||||
|
// deallocate C++ exception
|
||||||
#define SWIG_CThrowException(klass, msg) \
|
if (setjmp(SWIG_rt_env) == 0) {
|
||||||
if (setjmp(SWIG_cpp_back_env) == 0) \
|
SWIG_rt_stack_push();
|
||||||
SWIG_rt_throw((SwigObj *) klass, msg);
|
SWIG_exc.handled = 1;
|
||||||
%}
|
longjmp(SWIG_cpp_back_env, 1);
|
||||||
|
}
|
||||||
%insert("proxy_header") %{
|
SWIG_terminate();
|
||||||
// special value indicating any type of exception like 'catch(...)'
|
}
|
||||||
#define SWIG_AnyException "SWIG_AnyException"
|
}
|
||||||
|
}
|
||||||
#include <setjmp.h>
|
|
||||||
|
#define SWIG_CThrowException(klass, msg) \
|
||||||
SWIGIMPORT jmp_buf SWIG_rt_env;
|
if (setjmp(SWIG_cpp_back_env) == 0) \
|
||||||
|
SWIG_rt_throw((SwigObj *) klass, msg);
|
||||||
typedef struct {
|
%}
|
||||||
void *obj;
|
|
||||||
const char **typenames;
|
%insert("proxy_header") %{
|
||||||
} SwigObj;
|
// special value indicating any type of exception like 'catch(...)'
|
||||||
|
#define SWIG_AnyException "SWIG_AnyException"
|
||||||
SWIGIMPORT struct SWIG_exc_struct {
|
|
||||||
int code;
|
#include <setjmp.h>
|
||||||
char *msg;
|
|
||||||
SwigObj *klass;
|
SWIGIMPORT jmp_buf SWIG_rt_env;
|
||||||
} SWIG_exc;
|
|
||||||
|
SWIGIMPORT struct SWIG_exc_struct {
|
||||||
SWIGIMPORT void SWIG_rt_try();
|
int code;
|
||||||
SWIGIMPORT int SWIG_rt_catch(const char *type);
|
char *msg;
|
||||||
SWIGIMPORT void SWIG_rt_throw(SwigObj *klass, const char * msg);
|
SwigObj *klass;
|
||||||
SWIGIMPORT int SWIG_rt_unhandled();
|
} SWIG_exc;
|
||||||
SWIGIMPORT void SWIG_rt_endtry();
|
|
||||||
SWIGIMPORT int SWIG_exit(int code);
|
SWIGIMPORT void SWIG_rt_try();
|
||||||
|
SWIGIMPORT int SWIG_rt_catch(const char *type);
|
||||||
#define SWIG_try \
|
SWIGIMPORT void SWIG_rt_throw(SwigObj *klass, const char * msg);
|
||||||
SWIG_rt_try(); \
|
SWIGIMPORT int SWIG_rt_unhandled();
|
||||||
if ((SWIG_exc.code = setjmp(SWIG_rt_env)) == 0)
|
SWIGIMPORT void SWIG_rt_endtry();
|
||||||
#define SWIG_catch(type) else if (SWIG_rt_catch(#type))
|
SWIGIMPORT int SWIG_exit(int code);
|
||||||
#define SWIG_throw(klass) SWIG_rt_throw((SwigObj *) klass, 0);
|
|
||||||
#define SWIG_throw_msg(klass, msg) SWIG_rt_throw((SwigObj *) klass, msg);
|
#define SWIG_try \
|
||||||
#define SWIG_endtry else SWIG_rt_unhandled(); SWIG_rt_endtry();
|
SWIG_rt_try(); \
|
||||||
|
if ((SWIG_exc.code = setjmp(SWIG_rt_env)) == 0)
|
||||||
%}
|
#define SWIG_catch(type) else if (SWIG_rt_catch(#type))
|
||||||
|
#define SWIG_throw(klass) SWIG_rt_throw((SwigObj *) klass, 0);
|
||||||
|
#define SWIG_throw_msg(klass, msg) SWIG_rt_throw((SwigObj *) klass, msg);
|
||||||
|
#define SWIG_endtry else SWIG_rt_unhandled(); SWIG_rt_endtry();
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,4 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
4
Lib/c/std_common.i
Normal file
4
Lib/c/std_common.i
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
%include <std_except.i>
|
||||||
|
|
||||||
|
%apply size_t { std::size_t };
|
||||||
|
%apply const size_t& { const std::size_t & };
|
||||||
34
Lib/c/std_except.i
Normal file
34
Lib/c/std_except.i
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* See the LICENSE file for information on copyright, usage and redistribution
|
||||||
|
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||||
|
*
|
||||||
|
* std_except.i
|
||||||
|
*
|
||||||
|
* Typemaps used by the STL wrappers that throw exceptions.
|
||||||
|
* These typemaps are used when methods are declared with an STL exception specification, such as
|
||||||
|
* size_t at() const throw (std::out_of_range);
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdexcept>
|
||||||
|
%}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
%ignore exception;
|
||||||
|
struct exception {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
%typemap(throws) std::bad_exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::domain_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::invalid_argument "SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::length_error "SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::logic_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::out_of_range "SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::overflow_error "SWIG_JavaThrowException(jenv, SWIG_JavaArithmeticException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::range_error "SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::runtime_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::underflow_error "SWIG_JavaThrowException(jenv, SWIG_JavaArithmeticException, $1.what());\n return $null;"
|
||||||
|
*/
|
||||||
1
Lib/c/std_map.i
Normal file
1
Lib/c/std_map.i
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
%include <std/std_map.i>
|
||||||
1
Lib/c/std_pair.i
Normal file
1
Lib/c/std_pair.i
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
%include <std/std_pair.i>
|
||||||
|
|
@ -16,6 +16,8 @@ class string;
|
||||||
%typemap(couttype) string "char *"
|
%typemap(couttype) string "char *"
|
||||||
%typemap(couttype) const string & "char *"
|
%typemap(couttype) const string & "char *"
|
||||||
%typemap(couttype) string * "char *"
|
%typemap(couttype) string * "char *"
|
||||||
|
%typemap(cppouttype, retobj="1") string "std::string*"
|
||||||
|
%typemap(cppouttype) const string &, string * "std::string*"
|
||||||
|
|
||||||
%typemap(in) string {
|
%typemap(in) string {
|
||||||
if ($input) {
|
if ($input) {
|
||||||
|
|
@ -50,4 +52,3 @@ class string;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
64
Lib/c/std_vector.i
Normal file
64
Lib/c/std_vector.i
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* See the LICENSE file for information on copyright, usage and redistribution
|
||||||
|
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||||
|
*
|
||||||
|
* std_vector.i
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
%include <std_common.i>
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <vector>
|
||||||
|
#include <stdexcept>
|
||||||
|
%}
|
||||||
|
|
||||||
|
// C module specific: $tt expands to the type the template is instantiated
|
||||||
|
%typemap(ctype) std::vector<T> "$tt"
|
||||||
|
%typemap(in) std::vector<T> "$1 = ($1_ltype) $input;"
|
||||||
|
%typemap(out) std::vector<T> "$result = ($1_ltype) $1;"
|
||||||
|
%typemap(cppouttype) std::vector<T> "$1_ltype"
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
template<class T> class vector {
|
||||||
|
public:
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef T value_type;
|
||||||
|
typedef const value_type& const_reference;
|
||||||
|
vector();
|
||||||
|
vector(size_type n);
|
||||||
|
size_type size() const;
|
||||||
|
size_type capacity() const;
|
||||||
|
void reserve(size_type n);
|
||||||
|
bool empty() const;
|
||||||
|
void clear();
|
||||||
|
void push_back(const value_type& x);
|
||||||
|
const_reference at(size_type i);
|
||||||
|
};
|
||||||
|
|
||||||
|
%define specialize_std_vector(T)
|
||||||
|
template<> class vector<T> {
|
||||||
|
public:
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef T value_type;
|
||||||
|
vector();
|
||||||
|
vector(size_type n);
|
||||||
|
size_type size() const;
|
||||||
|
size_type capacity() const;
|
||||||
|
void reserve(size_type n);
|
||||||
|
bool empty() const;
|
||||||
|
void clear();
|
||||||
|
void push_back(T x) { this->push_back(x); }
|
||||||
|
T at(size_type i) { return this->at(i); }
|
||||||
|
};
|
||||||
|
%enddef
|
||||||
|
|
||||||
|
specialize_std_vector(int);
|
||||||
|
specialize_std_vector(bool);
|
||||||
|
/*specialize_std_vector(long);
|
||||||
|
specialize_std_vector(char);
|
||||||
|
specialize_std_vector(double);
|
||||||
|
specialize_std_vector(int*);
|
||||||
|
specialize_std_vector(char*);*/
|
||||||
|
}
|
||||||
|
|
||||||
12
Lib/c/stl.i
Normal file
12
Lib/c/stl.i
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* See the LICENSE file for information on copyright, usage and redistribution
|
||||||
|
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||||
|
*
|
||||||
|
* stl.i
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
%include <std_common.i>
|
||||||
|
%include <std_string.i>
|
||||||
|
%include <std_vector.i>
|
||||||
|
%include <std_map.i>
|
||||||
|
%include <std_pair.i>
|
||||||
12
Lib/c/typemaps.i
Normal file
12
Lib/c/typemaps.i
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* See the LICENSE file for information on copyright, usage and redistribution
|
||||||
|
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||||
|
*
|
||||||
|
* typemaps.i
|
||||||
|
*
|
||||||
|
* Pointer handling
|
||||||
|
* These mappings provide support for input/output arguments and common
|
||||||
|
* uses for C/C++ pointers.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
%include <typemaps/typemaps.swg>
|
||||||
|
|
@ -14,7 +14,8 @@ char cvsroot_c_cxx[] = "$Id: c.cxx 11186 2009-04-11 10:46:13Z maciekd $";
|
||||||
|
|
||||||
int SwigType_isbuiltin(SwigType *t) {
|
int SwigType_isbuiltin(SwigType *t) {
|
||||||
const char* builtins[] = { "void", "short", "int", "long", "char", "float", "double", "bool",
|
const char* builtins[] = { "void", "short", "int", "long", "char", "float", "double", "bool",
|
||||||
"unsigned short", "unsigned int", "unsigned long", "unsigned char", "signed char", 0 };
|
"unsigned short", "unsigned int", "unsigned long", "unsigned char", "signed char",
|
||||||
|
"long long", "unsigned long long", 0 };
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char *c = Char(t);
|
char *c = Char(t);
|
||||||
if (!t)
|
if (!t)
|
||||||
|
|
@ -30,6 +31,7 @@ int SwigType_isbuiltin(SwigType *t) {
|
||||||
class C:public Language {
|
class C:public Language {
|
||||||
static const char *usage;
|
static const char *usage;
|
||||||
|
|
||||||
|
File *f_begin;
|
||||||
File *f_runtime;
|
File *f_runtime;
|
||||||
File *f_header;
|
File *f_header;
|
||||||
File *f_wrappers;
|
File *f_wrappers;
|
||||||
|
|
@ -127,6 +129,7 @@ public:
|
||||||
|
|
||||||
String *finish_create_object() {
|
String *finish_create_object() {
|
||||||
String *s = create_object;
|
String *s = create_object;
|
||||||
|
Printf(s, "SWIG_add_registry_entry(result);\n");
|
||||||
Printf(s, "return result;\n");
|
Printf(s, "return result;\n");
|
||||||
Printf(s, "}\n\n");
|
Printf(s, "}\n\n");
|
||||||
return create_object;
|
return create_object;
|
||||||
|
|
@ -150,13 +153,7 @@ public:
|
||||||
|
|
||||||
String *finish_destroy_object() {
|
String *finish_destroy_object() {
|
||||||
String *s = destroy_object;
|
String *s = destroy_object;
|
||||||
if (except_flag)
|
Printf(s, "SWIG_free_SwigObj(object);\n}\n}\n}\n");
|
||||||
Printf(s, "free(object->typenames);\n");
|
|
||||||
Printf(s, "free(object);\n");
|
|
||||||
Printf(s, "object = (SwigObj *) 0;\n");
|
|
||||||
if (except_flag)
|
|
||||||
Printf(s, "}\n");
|
|
||||||
Printf(s, "}\n}\n");
|
|
||||||
return destroy_object;
|
return destroy_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,16 +166,17 @@ public:
|
||||||
String *outfile = Getattr(n, "outfile");
|
String *outfile = Getattr(n, "outfile");
|
||||||
|
|
||||||
// initialize I/O
|
// initialize I/O
|
||||||
f_runtime = NewFile(outfile, "w", SWIG_output_files());
|
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||||
if (!f_runtime) {
|
if (!f_begin) {
|
||||||
FileErrorDisplay(outfile);
|
FileErrorDisplay(outfile);
|
||||||
SWIG_exit(EXIT_FAILURE);
|
SWIG_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
f_runtime = NewString("");
|
||||||
f_init = NewString("");
|
f_init = NewString("");
|
||||||
f_header = NewString("");
|
f_header = NewString("");
|
||||||
f_wrappers = NewString("");
|
f_wrappers = NewString("");
|
||||||
|
|
||||||
Swig_banner(f_runtime);
|
Swig_banner(f_begin);
|
||||||
|
|
||||||
// generate proxy files if enabled
|
// generate proxy files if enabled
|
||||||
if (proxy_flag) {
|
if (proxy_flag) {
|
||||||
|
|
@ -209,6 +207,7 @@ public:
|
||||||
Printf(f_proxy_header, "#ifndef _%s_proxy_H_\n#define _%s_proxy_H_\n\n", Char(module), Char(module));
|
Printf(f_proxy_header, "#ifndef _%s_proxy_H_\n#define _%s_proxy_H_\n\n", Char(module), Char(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Swig_register_filebyname("begin", f_begin);
|
||||||
Swig_register_filebyname("header", f_header);
|
Swig_register_filebyname("header", f_header);
|
||||||
Swig_register_filebyname("wrapper", f_wrappers);
|
Swig_register_filebyname("wrapper", f_wrappers);
|
||||||
Swig_register_filebyname("runtime", f_runtime);
|
Swig_register_filebyname("runtime", f_runtime);
|
||||||
|
|
@ -218,16 +217,19 @@ public:
|
||||||
Printf(f_wrappers, "extern \"C\" {\n");
|
Printf(f_wrappers, "extern \"C\" {\n");
|
||||||
Printf(f_wrappers, "#endif\n\n");
|
Printf(f_wrappers, "#endif\n\n");
|
||||||
|
|
||||||
start_create_object();
|
|
||||||
if (except_flag)
|
if (except_flag) {
|
||||||
|
start_create_object();
|
||||||
start_destroy_object();
|
start_destroy_object();
|
||||||
|
}
|
||||||
|
|
||||||
// emit code for children
|
// emit code for children
|
||||||
Language::top(n);
|
Language::top(n);
|
||||||
|
|
||||||
Append(f_header, finish_create_object());
|
if (except_flag) {
|
||||||
if (except_flag)
|
Append(f_header, finish_create_object());
|
||||||
Append(f_header, finish_destroy_object());
|
Append(f_header, finish_destroy_object());
|
||||||
|
}
|
||||||
|
|
||||||
Printf(f_wrappers, "#ifdef __cplusplus\n");
|
Printf(f_wrappers, "#ifdef __cplusplus\n");
|
||||||
Printf(f_wrappers, "}\n");
|
Printf(f_wrappers, "}\n");
|
||||||
|
|
@ -245,11 +247,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// write all to the file
|
// write all to the file
|
||||||
Wrapper_pretty_print(f_header, f_runtime);
|
Dump(f_header, f_runtime);
|
||||||
Dump(f_wrappers, f_runtime);
|
Wrapper_pretty_print(f_wrappers, f_runtime);
|
||||||
Wrapper_pretty_print(f_init, f_runtime);
|
Dump(f_init, f_runtime);
|
||||||
|
Dump(f_runtime, f_begin);
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
Delete(f_begin);
|
||||||
Delete(f_header);
|
Delete(f_header);
|
||||||
Delete(f_wrappers);
|
Delete(f_wrappers);
|
||||||
Delete(f_init);
|
Delete(f_init);
|
||||||
|
|
@ -274,7 +278,6 @@ public:
|
||||||
char *c = Char(type_str);
|
char *c = Char(type_str);
|
||||||
c[Len(type_str) - Len(dims) - 1] = '\0';
|
c[Len(type_str) - Len(dims) - 1] = '\0';
|
||||||
String *bare_type = NewStringf("%s", c);
|
String *bare_type = NewStringf("%s", c);
|
||||||
//Printv(f_proxy_header, "SWIGIMPORT ", bare_type, " *", name, ";\n\n", NIL);
|
|
||||||
Printv(f_proxy_header, "SWIGIMPORT ", bare_type, " ", name, "[];\n\n", NIL);
|
Printv(f_proxy_header, "SWIGIMPORT ", bare_type, " ", name, "[];\n\n", NIL);
|
||||||
Delete(bare_type);
|
Delete(bare_type);
|
||||||
}
|
}
|
||||||
|
|
@ -297,11 +300,12 @@ public:
|
||||||
String *arg_list = NewString("");
|
String *arg_list = NewString("");
|
||||||
String *call = empty_string;
|
String *call = empty_string;
|
||||||
String *cres = empty_string;
|
String *cres = empty_string;
|
||||||
|
|
||||||
call = Swig_cfunction_call(Getattr(n, "name"), parms);
|
call = Swig_cfunction_call(Getattr(n, "name"), parms);
|
||||||
cres = Swig_cresult(type, "result", call);
|
cres = Swig_cresult(type, "result", call);
|
||||||
Setattr(n, "wrap:action", cres);
|
Setattr(n, "wrap:action", cres);
|
||||||
|
Setattr(n, "c:globalfun", "1");
|
||||||
|
|
||||||
if (!SwigType_ispointer(type) && !SwigType_isreference(type))
|
if (!SwigType_ispointer(type) && !SwigType_isreference(type))
|
||||||
Setattr(n, "c:retval", "1");
|
Setattr(n, "c:retval", "1");
|
||||||
|
|
||||||
|
|
@ -355,19 +359,20 @@ public:
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *get_mangled_type(SwigType *type_arg) {
|
String *get_mangled_type(SwigType *type_arg) {
|
||||||
static String *result = 0;
|
String *result = NewString("");
|
||||||
SwigType *prefix = 0;
|
SwigType *prefix = 0;
|
||||||
if (result)
|
SwigType *type = 0;
|
||||||
Delete(result);
|
SwigType *tdtype = SwigType_typedef_resolve_all(type_arg);
|
||||||
result = NewString("");
|
if (tdtype)
|
||||||
|
type = tdtype;
|
||||||
SwigType *type = Copy(type_arg);
|
else
|
||||||
|
type = Copy(type_arg);
|
||||||
|
|
||||||
|
// special cases for ptr to function as an argument
|
||||||
if (SwigType_ismemberpointer(type)) {
|
if (SwigType_ismemberpointer(type)) {
|
||||||
SwigType_del_memberpointer(type);
|
SwigType_del_memberpointer(type);
|
||||||
SwigType_add_pointer(type);
|
SwigType_add_pointer(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SwigType_ispointer(type)) {
|
if (SwigType_ispointer(type)) {
|
||||||
SwigType_del_pointer(type);
|
SwigType_del_pointer(type);
|
||||||
if (SwigType_isfunction(type)) {
|
if (SwigType_isfunction(type)) {
|
||||||
|
|
@ -395,13 +400,14 @@ public:
|
||||||
else if (SwigType_isenum(type))
|
else if (SwigType_isenum(type))
|
||||||
Printf(result, "e%s", Swig_scopename_last(type));
|
Printf(result, "e%s", Swig_scopename_last(type));
|
||||||
else
|
else
|
||||||
Printf(result, "%s", Char(SwigType_base(type)));
|
Printf(result, "%s", Char(Swig_name_mangle(SwigType_base(type))));
|
||||||
|
|
||||||
ready:
|
ready:
|
||||||
if (prefix)
|
if (prefix)
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
if (type)
|
if (type)
|
||||||
Delete(type);
|
Delete(type);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -410,7 +416,7 @@ ready:
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int functionWrapper(Node *n) {
|
virtual int functionWrapper(Node *n) {
|
||||||
String *name = Getattr(n, "sym:name");
|
String *name = Copy(Getattr(n, "sym:name"));
|
||||||
String *storage = Getattr(n, "storage");
|
String *storage = Getattr(n, "storage");
|
||||||
SwigType *type = Getattr(n, "type");
|
SwigType *type = Getattr(n, "type");
|
||||||
SwigType *otype = Copy(type);
|
SwigType *otype = Copy(type);
|
||||||
|
|
@ -422,9 +428,10 @@ ready:
|
||||||
String *tm;
|
String *tm;
|
||||||
String *proto = NewString("");
|
String *proto = NewString("");
|
||||||
String *over_suffix = NewString("");
|
String *over_suffix = NewString("");
|
||||||
SwigType *return_var_type = empty_string;
|
|
||||||
int gencomma;
|
int gencomma;
|
||||||
|
bool is_global = Cmp(Getattr(n, "c:globalfun"), "1") == 0; // possibly no longer neede
|
||||||
bool is_void_return = (SwigType_type(type) == T_VOID);
|
bool is_void_return = (SwigType_type(type) == T_VOID);
|
||||||
|
bool return_object = false;
|
||||||
|
|
||||||
// create new function wrapper object
|
// create new function wrapper object
|
||||||
Wrapper *wrapper = NewWrapper();
|
Wrapper *wrapper = NewWrapper();
|
||||||
|
|
@ -483,7 +490,7 @@ ready:
|
||||||
// C++ function wrapper
|
// C++ function wrapper
|
||||||
|
|
||||||
// mark the first parameter as object-struct
|
// mark the first parameter as object-struct
|
||||||
if (storage && Cmp(storage, "static") != 0) {
|
if (!is_global && storage && Cmp(storage, "static") != 0) {
|
||||||
if ((Cmp(Getattr(n, "ismember"), "1") == 0) &&
|
if ((Cmp(Getattr(n, "ismember"), "1") == 0) &&
|
||||||
(Cmp(nodeType(n), "constructor") != 0)) {
|
(Cmp(nodeType(n), "constructor") != 0)) {
|
||||||
Setattr(parms, "c:objstruct", "1");
|
Setattr(parms, "c:objstruct", "1");
|
||||||
|
|
@ -507,11 +514,17 @@ ready:
|
||||||
Append(name, over_suffix);
|
Append(name, over_suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwigType *tdtype = SwigType_typedef_resolve_all(type);
|
||||||
|
if (tdtype)
|
||||||
|
type = tdtype;
|
||||||
|
|
||||||
|
Setattr(n, "type", type);
|
||||||
|
|
||||||
// create new wrapper name
|
// create new wrapper name
|
||||||
wname = Swig_name_wrapper(name);
|
wname = Swig_name_wrapper(name);
|
||||||
Setattr(n, "wrap:name", wname);
|
Setattr(n, "wrap:name", wname);
|
||||||
|
|
||||||
// set the return type
|
// set the return type
|
||||||
if (Cmp(Getattr(n, "c:objstruct"), "1") == 0) {
|
if (Cmp(Getattr(n, "c:objstruct"), "1") == 0) {
|
||||||
Printv(return_type, SwigType_str(type, 0), NIL);
|
Printv(return_type, SwigType_str(type, 0), NIL);
|
||||||
|
|
@ -521,115 +534,30 @@ ready:
|
||||||
if (ctypeout)
|
if (ctypeout)
|
||||||
tm = ctypeout;
|
tm = ctypeout;
|
||||||
Printf(return_type, "%s", tm);
|
Printf(return_type, "%s", tm);
|
||||||
|
// template handling
|
||||||
|
Replaceall(return_type, "$tt", SwigType_lstr(type, 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No couttype typemap defined for %s\n", SwigType_str(type, 0));
|
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No couttype typemap defined for %s\n", SwigType_str(type, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add variable for holding result of original function 'cppresult'
|
|
||||||
// WARNING: Here we possibly make change to 'type' attribute of the node.
|
|
||||||
// This is done before the standard typemaps are attached, so they will
|
|
||||||
// use the modified type.
|
|
||||||
// In order to refer to the original type use 'otype' variable.
|
|
||||||
bool return_object = false;
|
|
||||||
if (!is_void_return && (Cmp(Getattr(n, "c:objstruct"), "1") != 0)) {
|
|
||||||
SwigType *tdtype = SwigType_typedef_resolve_all(type);
|
|
||||||
if (tdtype)
|
|
||||||
type = tdtype;
|
|
||||||
|
|
||||||
if (SwigType_ismemberpointer(type)) {
|
|
||||||
Wrapper_add_local(wrapper, "cppresult", SwigType_str(type, "cppresult"));
|
|
||||||
}
|
|
||||||
else if (SwigType_isenum(type)) {
|
|
||||||
Wrapper_add_localv(wrapper, "cppresult", "int", "cppresult", NIL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (SwigType_isbuiltin(SwigType_base(type))) {
|
|
||||||
// type is built-in (int, char, double, etc.)
|
|
||||||
|
|
||||||
//Printf(stdout, "BUILTIN %s %s\n", name, SwigType_str(type, 0));
|
|
||||||
|
|
||||||
if (SwigType_isconst(type))
|
|
||||||
SwigType_del_qualifier(type);
|
|
||||||
|
|
||||||
if (SwigType_isreference(type)) {
|
// add variable for holding result of original function 'cppresult'
|
||||||
if (SwigType_isconst(SwigType_del_reference(type))) {
|
// WARNING: testing typemap approach
|
||||||
return_var_type = SwigType_base(type);
|
SwigType *cpptype;
|
||||||
SwigType_add_qualifier(return_var_type, "const");
|
if (!is_void_return && (Cmp(Getattr(n, "c:objstruct"), "1") != 0)) {
|
||||||
SwigType_add_pointer(return_var_type);
|
if ((tm = Swig_typemap_lookup("cppouttype", n, "", 0))) {
|
||||||
}
|
SwigType *tdtype = SwigType_typedef_resolve_all(tm);
|
||||||
else {
|
if (tdtype)
|
||||||
return_var_type = SwigType_base(type);
|
cpptype = tdtype;
|
||||||
SwigType_add_pointer(return_var_type);
|
else
|
||||||
}
|
cpptype = tm;
|
||||||
if (SwigType_ispointer(type)) {
|
if (SwigType_ismemberpointer(type))
|
||||||
SwigType_add_pointer(return_var_type);
|
Wrapper_add_local(wrapper, "cppresult", SwigType_str(type, "cppresult"));
|
||||||
}
|
Wrapper_add_local(wrapper, "cppresult", SwigType_str(cpptype, "cppresult"));
|
||||||
SwigType_add_reference(type);
|
return_object = checkAttribute(n, "tmap:cppouttype:retobj", "1");
|
||||||
}
|
}
|
||||||
else if (SwigType_isarray(type)) {
|
else {
|
||||||
|
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No cppouttype typemap defined for %s\n", SwigType_str(type, 0));
|
||||||
return_var_type = SwigType_base(type);
|
|
||||||
SwigType *atype = Copy(type);
|
|
||||||
do {
|
|
||||||
SwigType_del_array(atype);
|
|
||||||
SwigType_add_pointer(return_var_type);
|
|
||||||
} while (SwigType_isarray(atype));
|
|
||||||
if (SwigType_ispointer(atype))
|
|
||||||
SwigType_add_pointer(return_var_type);
|
|
||||||
Delete(atype);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return_var_type = type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// type is class
|
|
||||||
|
|
||||||
//Printf(stdout, "CLASS %s %s\n", name, SwigType_str(type, 0));
|
|
||||||
if (SwigType_ispointer(type)) {
|
|
||||||
return_var_type = type;
|
|
||||||
}
|
|
||||||
else if (SwigType_isreference(type)) {
|
|
||||||
return_var_type = type;
|
|
||||||
SwigType_del_reference(return_var_type);
|
|
||||||
SwigType_add_pointer(return_var_type);
|
|
||||||
}
|
|
||||||
else if (SwigType_isarray(type)) {
|
|
||||||
return_var_type = SwigType_base(type);
|
|
||||||
SwigType *atype = Copy(type);
|
|
||||||
do {
|
|
||||||
SwigType_del_array(atype);
|
|
||||||
SwigType_add_pointer(return_var_type);
|
|
||||||
} while (SwigType_isarray(atype));
|
|
||||||
Delete(atype);
|
|
||||||
//if (Cmp(Getattr(n, "c:retval"), "1"))
|
|
||||||
SwigType_add_pointer(return_var_type);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SwigType_add_pointer(type);
|
|
||||||
return_var_type = type;
|
|
||||||
}
|
|
||||||
return_object = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// hack for handling const 'cppresult' return values,
|
|
||||||
// including cases like: A const *&
|
|
||||||
SwigType *temp1 = Copy(otype), *temp2 = 0;
|
|
||||||
if (SwigType_isreference(temp1)) {
|
|
||||||
SwigType_del_reference(temp1);
|
|
||||||
temp2 = Copy(temp1);
|
|
||||||
if (SwigType_ispointer(temp2))
|
|
||||||
SwigType_del_pointer(temp2);
|
|
||||||
}
|
|
||||||
String *var_name = SwigType_str(return_var_type, 0);
|
|
||||||
if (SwigType_isconst(otype) || SwigType_isconst(temp1) || SwigType_isconst(temp2))
|
|
||||||
Replaceall(var_name, "const", "");
|
|
||||||
Wrapper_add_localv(wrapper, "cppresult", var_name, "cppresult", NIL);
|
|
||||||
Delete(var_name);
|
|
||||||
Delete(temp1);
|
|
||||||
if (temp2)
|
|
||||||
Delete(temp2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -658,12 +586,10 @@ ready:
|
||||||
gencomma = 0;
|
gencomma = 0;
|
||||||
for (p = parms; p; ) {
|
for (p = parms; p; ) {
|
||||||
|
|
||||||
//Printf(stdout, "TYPE: %s ", SwigType_str(Getattr(p, "type"), 0));
|
while (p && checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||||
//Swig_print_node(p);
|
|
||||||
|
|
||||||
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
|
||||||
p = Getattr(p, "tmap:in:next");
|
p = Getattr(p, "tmap:in:next");
|
||||||
}
|
}
|
||||||
|
if (!p) break;
|
||||||
|
|
||||||
SwigType *type = Getattr(p, "type");
|
SwigType *type = Getattr(p, "type");
|
||||||
if (SwigType_type(type) == T_VOID) {
|
if (SwigType_type(type) == T_VOID) {
|
||||||
|
|
@ -684,16 +610,13 @@ ready:
|
||||||
// set the appropriate type for parameter
|
// set the appropriate type for parameter
|
||||||
if ((tm = Getattr(p, "tmap:ctype"))) {
|
if ((tm = Getattr(p, "tmap:ctype"))) {
|
||||||
Printv(c_parm_type, tm, NIL);
|
Printv(c_parm_type, tm, NIL);
|
||||||
|
// template handling
|
||||||
|
Replaceall(c_parm_type, "$tt", SwigType_lstr(type, 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(type, 0));
|
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(type, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack for handling arrays of objects, as typemap SWIGOBJ *[ANY]
|
|
||||||
// precedes int *[ANY] for int arrays
|
|
||||||
if (!SwigType_isbuiltin(SwigType_base(type)))
|
|
||||||
Replaceall(c_parm_type, SwigType_base(type), SwigType_isarray(type) ? "SwigObj *" : "SwigObj");
|
|
||||||
|
|
||||||
// use proxy-type for parameter if supplied
|
// use proxy-type for parameter if supplied
|
||||||
String* stype = Getattr(p, "c:stype");
|
String* stype = Getattr(p, "c:stype");
|
||||||
if (stype) {
|
if (stype) {
|
||||||
|
|
@ -755,12 +678,19 @@ ready:
|
||||||
String *action = Getattr(n, "wrap:action");
|
String *action = Getattr(n, "wrap:action");
|
||||||
if (!action)
|
if (!action)
|
||||||
action = NewString("");
|
action = NewString("");
|
||||||
|
|
||||||
|
String *cbase_name = Getattr(n, "c:base_name");
|
||||||
|
if (cbase_name) {
|
||||||
|
Replaceall(action, "arg1)->", NewStringf("(%s*)arg1)->", Getattr(n, "c:inherited_from")));
|
||||||
|
Replaceall(action, Getattr(n, "name"), cbase_name);
|
||||||
|
}
|
||||||
|
|
||||||
// handle special cases of cpp return result
|
// handle special cases of cpp return result
|
||||||
if (Cmp(nodeType(n), "constructor") != 0) {
|
if (Cmp(nodeType(n), "constructor") != 0) {
|
||||||
if (SwigType_isenum(type)) {
|
if (SwigType_isenum(SwigType_base(type))){
|
||||||
// returning enum value
|
if (return_object)
|
||||||
Replace(action, "result =", "cppresult = (int)", DOH_REPLACE_FIRST);
|
Replaceall(action, "result =", "cppresult = (int)");
|
||||||
|
else Replaceall(action, "result =", "cppresult = (int*)");
|
||||||
}
|
}
|
||||||
else if (return_object && Getattr(n, "c:retval") && !SwigType_isarray(type)
|
else if (return_object && Getattr(n, "c:retval") && !SwigType_isarray(type)
|
||||||
&& Cmp(Getattr(n, "storage"), "static") != 0) {
|
&& Cmp(Getattr(n, "storage"), "static") != 0) {
|
||||||
|
|
@ -769,25 +699,28 @@ ready:
|
||||||
String *lstr = SwigType_lstr(type, 0);
|
String *lstr = SwigType_lstr(type, 0);
|
||||||
if (Cmp(Getattr(n, "kind"), "variable") == 0) {
|
if (Cmp(Getattr(n, "kind"), "variable") == 0) {
|
||||||
Delete(action);
|
Delete(action);
|
||||||
action = NewStringf("const %s = %s;\n", str, Swig_cmemberget_call(Getattr(n, "name"), type, 0, 0));
|
action = NewStringf("{const %s = %s;", str, Swig_cmemberget_call(Getattr(n, "name"), type, 0, 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String *call_str = NewStringf("const %s = %s", str,
|
String *call_str = NewStringf("{const %s = %s", str,
|
||||||
SwigType_ispointer(SwigType_typedef_resolve_all(otype)) ? "*" : "");
|
SwigType_ispointer(SwigType_typedef_resolve_all(otype)) ? "*" : "");
|
||||||
Replace(action, "result =", call_str, DOH_REPLACE_FIRST);
|
Replaceall(action, "result =", call_str);
|
||||||
Delete(call_str);
|
Delete(call_str);
|
||||||
}
|
}
|
||||||
Printf(action, "\ncppresult = (%s) &_result_ref;\n", lstr);
|
if (Getattr(n, "nested"))
|
||||||
|
Replaceall(action, "=", NewStringf("= *(%s)(void*) &", SwigType_str(otype, 0)));
|
||||||
|
Printf(action, "cppresult = (%s*) &_result_ref;}", lstr);
|
||||||
Delete(str);
|
Delete(str);
|
||||||
Delete(lstr);
|
Delete(lstr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Replace(action, "result =", "cppresult = ", DOH_REPLACE_FIRST);
|
Replaceall(action, "result =", "cppresult = ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare action code to use, e.g. insert try-catch blocks
|
// prepare action code to use, e.g. insert try-catch blocks
|
||||||
action = emit_action(n);
|
action = emit_action(n);
|
||||||
|
|
||||||
|
Setattr(n, "type", type);
|
||||||
// emit output typemap if needed
|
// emit output typemap if needed
|
||||||
if (!is_void_return && (Cmp(Getattr(n, "c:objstruct"), "1") != 0)) {
|
if (!is_void_return && (Cmp(Getattr(n, "c:objstruct"), "1") != 0)) {
|
||||||
if ((tm = Swig_typemap_lookup_out("out", n, "cppresult", wrapper, action))) {
|
if ((tm = Swig_typemap_lookup_out("out", n, "cppresult", wrapper, action))) {
|
||||||
|
|
@ -861,6 +794,7 @@ ready:
|
||||||
Delete(wname);
|
Delete(wname);
|
||||||
Delete(return_type);
|
Delete(return_type);
|
||||||
Delete(otype);
|
Delete(otype);
|
||||||
|
Delete(name);
|
||||||
DelWrapper(wrapper);
|
DelWrapper(wrapper);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -879,6 +813,9 @@ ready:
|
||||||
Setattr(new_node, "parms", Copy(Getattr(node, "parms")));
|
Setattr(new_node, "parms", Copy(Getattr(node, "parms")));
|
||||||
Setattr(new_node, "type", Copy(Getattr(node, "type")));
|
Setattr(new_node, "type", Copy(Getattr(node, "type")));
|
||||||
Setattr(new_node, "decl", Copy(Getattr(node, "decl")));
|
Setattr(new_node, "decl", Copy(Getattr(node, "decl")));
|
||||||
|
String *cif = Getattr(node, "c:inherited_from");
|
||||||
|
if (cif)
|
||||||
|
Setattr(new_node, "c:inherited_from", Copy(cif));
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -888,13 +825,13 @@ ready:
|
||||||
* tests if given name already exists in one of child nodes of n
|
* tests if given name already exists in one of child nodes of n
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
bool is_in(String *name, Node *n) {
|
Hash *is_in(String *name, Node *n) {
|
||||||
Hash *h;
|
Hash *h;
|
||||||
for (h = firstChild(n); h; h = nextSibling(h)) {
|
for (h = firstChild(n); h; h = nextSibling(h)) {
|
||||||
if (Cmp(name, Getattr(h, "name")) == 0)
|
if (Cmp(name, Getattr(h, "name")) == 0)
|
||||||
return true;
|
return h;
|
||||||
}
|
}
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
|
|
@ -910,6 +847,7 @@ ready:
|
||||||
Printv(f_proxy_header, " ", SwigType_str(type, 0), " ", Getattr(node, "name"), ";\n", NIL);
|
Printv(f_proxy_header, " ", SwigType_str(type, 0), " ", Getattr(node, "name"), ";\n", NIL);
|
||||||
Delete(type);
|
Delete(type);
|
||||||
}
|
}
|
||||||
|
// WARNING: proxy delaration can be different than original code
|
||||||
if (Cmp(nodeType(node), "extend") == 0)
|
if (Cmp(nodeType(node), "extend") == 0)
|
||||||
emit_c_struct_def(firstChild(node));
|
emit_c_struct_def(firstChild(node));
|
||||||
}
|
}
|
||||||
|
|
@ -920,16 +858,10 @@ ready:
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int classHandler(Node *n) {
|
virtual int classHandler(Node *n) {
|
||||||
String *name = NewString("");
|
String *name = Getattr(n, "sym:name");
|
||||||
String *sobj = NewString("");
|
String *sobj = NewString("");
|
||||||
List *baselist = Getattr(n, "bases");
|
List *baselist = Getattr(n, "bases");
|
||||||
|
|
||||||
String *prefix = Swig_scopename_prefix(Getattr(n, "classtype"));
|
|
||||||
if (prefix)
|
|
||||||
Printf(name, "%s_", Swig_name_mangle(prefix));
|
|
||||||
Append(name, Getattr(n, "sym:name"));
|
|
||||||
Setattr(n, "sym:name", name);
|
|
||||||
|
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
// inheritance support: attach all members from base classes to this class
|
// inheritance support: attach all members from base classes to this class
|
||||||
if (baselist) {
|
if (baselist) {
|
||||||
|
|
@ -942,22 +874,39 @@ ready:
|
||||||
|| (Cmp(Getattr(node, "kind"), "function") == 0)) {
|
|| (Cmp(Getattr(node, "kind"), "function") == 0)) {
|
||||||
if ((Cmp(Getattr(node, "access"), "public") == 0)
|
if ((Cmp(Getattr(node, "access"), "public") == 0)
|
||||||
&& (Cmp(Getattr(node, "storage"), "static") != 0)) {
|
&& (Cmp(Getattr(node, "storage"), "static") != 0)) {
|
||||||
if (!is_in(Getattr(node, "name"), n)) {
|
Node *new_node = copy_node(node);
|
||||||
Node* new_node = copy_node(node);
|
String *parent_name = Getattr(parentNode(node), "name");
|
||||||
Setattr(new_node, "sym:name", Getattr(new_node, "name"));
|
Hash *dupl_name_node = is_in(Getattr(node, "name"), n);
|
||||||
Setattr(new_node, "sym:symtab", Getattr(n, "symtab"));
|
// if there's a duplicate inherited name, due to the C++ multiple
|
||||||
set_nodeType(new_node, "cdecl");
|
// inheritance, change both names to avoid ambiguity
|
||||||
appendChild(n, new_node);
|
if (dupl_name_node) {
|
||||||
}
|
String *cif = Getattr(dupl_name_node, "c:inherited_from");
|
||||||
|
String *old_name = Getattr(dupl_name_node, "name");
|
||||||
|
if (cif && parent_name && (Cmp(cif, parent_name) != 0)) {
|
||||||
|
Setattr(dupl_name_node, "name", NewStringf("%s%s", cif ? cif : "", old_name));
|
||||||
|
Setattr(dupl_name_node, "c:base_name", old_name);
|
||||||
|
Setattr(new_node, "name", NewStringf("%s%s", parent_name, old_name));
|
||||||
|
Setattr(new_node, "c:base_name", old_name);
|
||||||
|
Setattr(new_node, "c:inherited_from", parent_name);
|
||||||
|
Setattr(new_node, "sym:name", Getattr(new_node, "name"));
|
||||||
|
Setattr(new_node, "sym:symtab", Getattr(n, "symtab"));
|
||||||
|
set_nodeType(new_node, "cdecl");
|
||||||
|
appendChild(n, new_node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Setattr(new_node, "c:inherited_from", parent_name);
|
||||||
|
Setattr(new_node, "sym:name", Getattr(new_node, "name"));
|
||||||
|
Setattr(new_node, "sym:symtab", Getattr(n, "symtab"));
|
||||||
|
set_nodeType(new_node, "cdecl");
|
||||||
|
appendChild(n, new_node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (except_flag)
|
|
||||||
Printv(f_header, "const char* Swig_typename_", name, " = \"", name, "\";\n\n", NIL);
|
|
||||||
|
|
||||||
// declare type for specific class in the proxy header
|
// declare type for specific class in the proxy header
|
||||||
if (proxy_flag)
|
if (proxy_flag)
|
||||||
Printv(f_proxy_header, "\ntypedef SwigObj ", name, ";\n\n", NIL);
|
Printv(f_proxy_header, "\ntypedef SwigObj ", name, ";\n\n", NIL);
|
||||||
|
|
@ -967,12 +916,20 @@ ready:
|
||||||
return Language::classHandler(n);
|
return Language::classHandler(n);
|
||||||
}
|
}
|
||||||
else if (Cmp(Getattr(n, "kind"), "struct") == 0) {
|
else if (Cmp(Getattr(n, "kind"), "struct") == 0) {
|
||||||
// this is C struct, just declare it in proxy
|
// this is C struct, just declare it in the proxy
|
||||||
if (proxy_flag) {
|
if (proxy_flag) {
|
||||||
Printv(f_proxy_header, "struct ", name, " {\n", NIL);
|
String *storage = Getattr(n, "storage");
|
||||||
|
int usetd = storage && Cmp(storage, "typedef") == 0;
|
||||||
|
if (usetd)
|
||||||
|
Append(f_proxy_header, "typedef struct {\n");
|
||||||
|
else
|
||||||
|
Printv(f_proxy_header, "struct ", name, " {\n", NIL);
|
||||||
Node *node = firstChild(n);
|
Node *node = firstChild(n);
|
||||||
emit_c_struct_def(node);
|
emit_c_struct_def(node);
|
||||||
Append(f_proxy_header, "};\n\n");
|
if (usetd)
|
||||||
|
Printv(f_proxy_header, "} ", name, ";\n\n", NIL);
|
||||||
|
else
|
||||||
|
Append(f_proxy_header, "};\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Delete(sobj);
|
Delete(sobj);
|
||||||
|
|
@ -1015,7 +972,6 @@ ready:
|
||||||
return Language::memberfunctionHandler(n);
|
return Language::memberfunctionHandler(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* staticmembervariableHandler()
|
* staticmembervariableHandler()
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
|
|
@ -1095,13 +1051,17 @@ ready:
|
||||||
Printf(s, "result->typenames[%d] = 0;\n", i);
|
Printf(s, "result->typenames[%d] = 0;\n", i);
|
||||||
Printf(s, "}\n");
|
Printf(s, "}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------
|
||||||
|
* add_to_destroy_object()
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
void add_to_destroy_object(Node *n, String *classname) {
|
void add_to_destroy_object(Node *n, String *classname, String *classtype) {
|
||||||
String *s = destroy_object;
|
String *s = destroy_object;
|
||||||
String *access = Getattr(n, "access");
|
String *access = Getattr(n, "access");
|
||||||
if (access && Cmp(access, "private") != 0) {
|
if (access && Cmp(access, "private") != 0) {
|
||||||
Printv(s, "if (strcmp(object->typenames[0], \"", classname, "\") == 0) {\n", NIL);
|
Printv(s, "if (strcmp(object->typenames[0], \"", classname, "\") == 0) {\n", NIL);
|
||||||
Printv(s, "if (object->obj)\ndelete (", classname, " *) (object->obj);\n", NIL);
|
Printv(s, "if (object->obj)\ndelete (", classtype, " *) (object->obj);\n", NIL);
|
||||||
Printf(s, "}\n");
|
Printf(s, "}\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1118,7 +1078,7 @@ ready:
|
||||||
return copyconstructorHandler(n);
|
return copyconstructorHandler(n);
|
||||||
|
|
||||||
Node *klass = Swig_methodclass(n);
|
Node *klass = Swig_methodclass(n);
|
||||||
String *classname = Getattr(klass, "classtype");
|
String *classname = Getattr(klass, "name");
|
||||||
String *newclassname = Getattr(klass, "sym:name");
|
String *newclassname = Getattr(klass, "sym:name");
|
||||||
String *sobj_name = NewString("");
|
String *sobj_name = NewString("");
|
||||||
String *ctype;
|
String *ctype;
|
||||||
|
|
@ -1148,18 +1108,18 @@ ready:
|
||||||
|
|
||||||
// generate action code
|
// generate action code
|
||||||
if (except_flag) {
|
if (except_flag) {
|
||||||
add_to_create_object(n, classname, newclassname);
|
if (!Getattr(klass, "c:create")) {
|
||||||
|
add_to_create_object(n, classname, newclassname);
|
||||||
|
Setattr(klass, "c:create", "1");
|
||||||
|
}
|
||||||
Printv(code, "result = SWIG_create_object(\"", classname, "\");\n", NIL);
|
Printv(code, "result = SWIG_create_object(\"", classname, "\");\n", NIL);
|
||||||
Printf(code, "SWIG_add_registry_entry(result);\n");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Printf(code, "result = SWIG_create_object();\n");
|
Printf(code, "result = SWIG_create_object();\n");
|
||||||
}
|
}
|
||||||
|
Printv(code, "result->obj = (void*) new ", Getattr(klass, "classtype"), arg_lnames, ";\n", NIL);
|
||||||
Printv(code, "result->obj = (void*) new ", classname, arg_lnames, ";\n", NIL);
|
|
||||||
|
|
||||||
Setattr(n, "wrap:action", code);
|
Setattr(n, "wrap:action", code);
|
||||||
|
|
||||||
functionWrapper(n);
|
functionWrapper(n);
|
||||||
|
|
||||||
Delete(arg_lnames);
|
Delete(arg_lnames);
|
||||||
|
|
@ -1205,18 +1165,18 @@ ready:
|
||||||
|
|
||||||
// generate action code
|
// generate action code
|
||||||
if (except_flag) {
|
if (except_flag) {
|
||||||
add_to_create_object(n, classname, newclassname);
|
if (!Getattr(klass, "c:create")) {
|
||||||
|
add_to_create_object(n, classname, newclassname);
|
||||||
|
Setattr(klass, "c:create", "1");
|
||||||
|
}
|
||||||
Printv(code, "result = SWIG_create_object(\"", classname, "\");\n", NIL);
|
Printv(code, "result = SWIG_create_object(\"", classname, "\");\n", NIL);
|
||||||
Printf(code, "SWIG_add_registry_entry(result);\n");
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
Printf(code, "result = SWIG_create_object();\n");
|
Printf(code, "result = SWIG_create_object();\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Printv(code, "result->obj = (void*) new ", classname, "((", classname, " const &)*arg1);\n", NIL);
|
Printv(code, "result->obj = (void*) new ", classname, "((", classname, " const &)*arg1);\n", NIL);
|
||||||
|
|
||||||
Setattr(n, "wrap:action", code);
|
Setattr(n, "wrap:action", code);
|
||||||
|
|
||||||
functionWrapper(n);
|
functionWrapper(n);
|
||||||
|
|
||||||
Delete(constr_name);
|
Delete(constr_name);
|
||||||
|
|
@ -1233,7 +1193,8 @@ ready:
|
||||||
|
|
||||||
virtual int destructorHandler(Node *n) {
|
virtual int destructorHandler(Node *n) {
|
||||||
Node *klass = Swig_methodclass(n);
|
Node *klass = Swig_methodclass(n);
|
||||||
String *classname = Getattr(klass, "classtype");
|
String *classname = Getattr(klass, "name");
|
||||||
|
String *classtype = Getattr(klass, "classtype");
|
||||||
String *newclassname = Getattr(klass, "sym:name");
|
String *newclassname = Getattr(klass, "sym:name");
|
||||||
String *sobj_name = NewString("");
|
String *sobj_name = NewString("");
|
||||||
String *ctype;
|
String *ctype;
|
||||||
|
|
@ -1261,18 +1222,18 @@ ready:
|
||||||
|
|
||||||
// create action code
|
// create action code
|
||||||
if (except_flag) {
|
if (except_flag) {
|
||||||
add_to_destroy_object(n, classname);
|
add_to_destroy_object(n, classname, classtype);
|
||||||
Printf(code, "SWIG_remove_registry_entry(carg1);\n");
|
Printf(code, "SWIG_remove_registry_entry(carg1);\n");
|
||||||
Printf(code, "SWIG_destroy_object(carg1);");
|
Printf(code, "SWIG_destroy_object(carg1);");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Printv(code, "if (carg1->obj)\ndelete (", classname, " *) (carg1->obj);\n", NIL);
|
Printv(code, "if (carg1->obj)\ndelete (", classtype, " *) (carg1->obj);\n", NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Setattr(n, "wrap:action", code);
|
Setattr(n, "wrap:action", code);
|
||||||
|
|
||||||
functionWrapper(n);
|
functionWrapper(n);
|
||||||
|
|
||||||
Delete(p);
|
Delete(p);
|
||||||
Delete(destr_name);
|
Delete(destr_name);
|
||||||
Delete(code);
|
Delete(code);
|
||||||
|
|
@ -1318,7 +1279,38 @@ ready:
|
||||||
Printv(f_proxy_header, "#define ", name, " ", value, "\n", NIL);
|
Printv(f_proxy_header, "#define ", name, " ", value, "\n", NIL);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------
|
||||||
|
* classDeclaration()
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
virtual int classDeclaration(Node *n) {
|
||||||
|
String *name = NewString("");
|
||||||
|
String *classtype = Getattr(n, "classtype");
|
||||||
|
String *prefix = 0;
|
||||||
|
if (classtype) {
|
||||||
|
prefix = Swig_scopename_prefix(classtype);
|
||||||
|
if (prefix)
|
||||||
|
Printf(name, "%s_", Swig_name_mangle(prefix));
|
||||||
|
}
|
||||||
|
Append(name, Swig_name_mangle(Getattr(n, "sym:name")));
|
||||||
|
Setattr(n, "sym:name", name);
|
||||||
|
if (except_flag)
|
||||||
|
Printv(f_header, "const char* Swig_typename_", name, " = \"", Getattr(n, "name"), "\";\n\n", NIL);
|
||||||
|
return Language::classDeclaration(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------
|
||||||
|
* extendDirective()
|
||||||
|
*
|
||||||
|
* The idea is to extend the class with additional variables, using
|
||||||
|
* SwigObj structs. This is not implemented yet.
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
virtual int extendDirective(Node *n) {
|
||||||
|
return Language::extendDirective(n);
|
||||||
|
}
|
||||||
|
|
||||||
}; /* class C */
|
}; /* class C */
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue