merge from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11423 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
37ebcb9e67
31 changed files with 560 additions and 369 deletions
|
|
@ -1,6 +1,6 @@
|
|||
TOP = ../..
|
||||
SWIG = $(TOP)/../preinst-swig
|
||||
SRCS = example.i
|
||||
SRCS = example.c
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
FILE *fopen(char *filename, char *mode);
|
||||
int fputs(char* , FILE *);
|
||||
int fclose(FILE *);
|
||||
|
||||
%{
|
||||
extern void add(int *, int *, int *);
|
||||
extern void sub(int *, int *, int *);
|
||||
extern int divide(int, int, int *);
|
||||
%}
|
||||
|
||||
/* This example illustrates a couple of different techniques
|
||||
for manipulating C pointers */
|
||||
|
||||
/* First we'll use the pointer library */
|
||||
extern void add(int *x, int *y, int *result);
|
||||
%include cpointer.i
|
||||
%pointer_functions(int, intp);
|
||||
|
||||
/* Next we'll use some typemaps */
|
||||
|
||||
%include typemaps.i
|
||||
extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
|
||||
|
||||
/* Next we'll use typemaps and the %apply directive */
|
||||
|
||||
%apply int *OUTPUT { int *r };
|
||||
extern int divide(int n, int d, int *r);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
TOP = ../..
|
||||
SWIG = $(TOP)/../preinst-swig
|
||||
SRCS = example.i
|
||||
SRCS = example.c
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ CPP_TEST_BROKEN += \
|
|||
extend_variable \
|
||||
li_std_vector_ptr \
|
||||
namespace_union \
|
||||
nested_struct \
|
||||
nested_structs \
|
||||
overload_complicated \
|
||||
template_default_pointer \
|
||||
template_expr
|
||||
|
|
@ -220,6 +220,7 @@ CPP_TEST_CASES += \
|
|||
li_typemaps \
|
||||
li_windows \
|
||||
long_long_apply \
|
||||
memberin_extend \
|
||||
member_pointer \
|
||||
member_template \
|
||||
minherit \
|
||||
|
|
|
|||
26
Examples/test-suite/java/memberin_extend_runme.java
Normal file
26
Examples/test-suite/java/memberin_extend_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import memberin_extend.*;
|
||||
|
||||
public class memberin_extend_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("memberin_extend");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
ExtendMe em1 = new ExtendMe();
|
||||
ExtendMe em2 = new ExtendMe();
|
||||
em1.setThing("em1thing");
|
||||
em2.setThing("em2thing");
|
||||
if (!em1.getThing().equals("em1thing"))
|
||||
throw new RuntimeException("wrong: " + em1.getThing());
|
||||
if (!em2.getThing().equals("em2thing"))
|
||||
throw new RuntimeException("wrong: " + em2.getThing());
|
||||
}
|
||||
}
|
||||
|
||||
22
Examples/test-suite/memberin_extend.i
Normal file
22
Examples/test-suite/memberin_extend.i
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
%module memberin_extend
|
||||
|
||||
// Tests memberin typemap. The default char * memberin typemap will be used.
|
||||
// The test extends the struct with a pseudo member variable
|
||||
|
||||
%inline %{
|
||||
#include <string>
|
||||
struct ExtendMe {
|
||||
};
|
||||
%}
|
||||
|
||||
%{
|
||||
#include <map>
|
||||
std::map<ExtendMe*, char *> ExtendMeStringMap;
|
||||
#define ExtendMe_thing_set(self_, val_) ExtendMeStringMap[self_]
|
||||
#define ExtendMe_thing_get(self_) ExtendMeStringMap[self_]
|
||||
%}
|
||||
|
||||
%extend ExtendMe {
|
||||
char *thing;
|
||||
}
|
||||
|
||||
|
|
@ -1 +1,17 @@
|
|||
empty
|
||||
|
||||
printf("begin\n");
|
||||
who global
|
||||
|
||||
printf("after load\n");
|
||||
who global
|
||||
|
||||
#clear -g
|
||||
printf("after clear\n");
|
||||
who global
|
||||
|
||||
#clear empty
|
||||
printf("after clear specific\n");
|
||||
who global
|
||||
|
||||
printf("before shutdown\n");
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ require "rename_scope.php";
|
|||
|
||||
check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket"));
|
||||
|
||||
check::classmethods("Interface_UP",array("interface_up"));
|
||||
check::classmethods("Interface_BP",array("interface_bp"));
|
||||
check::classmethods("Natural_UP",array("interface_up","natural_up","rtest"));
|
||||
check::classmethods("Natural_BP",array("interface_bp","natural_bp","rtest"));
|
||||
check::classparent("Natural_UP","interface_up");
|
||||
check::classparent("Natural_BP","interface_bp");
|
||||
check::classmethods("Interface_UP",array("__construct"));
|
||||
check::classmethods("Interface_BP",array("__construct"));
|
||||
check::classmethods("Natural_UP",array("__construct","rtest"));
|
||||
check::classmethods("Natural_BP",array("__construct","rtest"));
|
||||
check::classparent("Natural_UP","Interface_UP");
|
||||
check::classparent("Natural_BP","Interface_BP");
|
||||
|
||||
check::done();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum1;
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum2;
|
||||
#ifdef SWIGPHP
|
||||
%warnfilter(SWIGWARN_PARSE_KEYWORD) Namespace;
|
||||
#endif
|
||||
|
||||
// Tests SWIG's automatic exception mechanism
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue