merge revisions 11243-11872 from trunk to gsoc2009-matevz

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-07-20 21:58:41 +00:00
commit ab1cd03979
387 changed files with 12383 additions and 4412 deletions

View file

@ -319,7 +319,7 @@ python_clean:
rm -f *_wrap* *~ .~* mypython@EXEEXT@ *.pyc
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@ *@PYTHON_SO@
if [ -f runme.py ]; then (rm -f runme3.py runme3.py.bak;) fi;
if [ -f runme.py ]; then rm -f runme3.py runme3.py.bak; fi
##################################################################
@ -336,12 +336,13 @@ OCTAVE_SO = @OCTAVE_SO@
# ----------------------------------------------------------------
# Build a C dynamically loadable module
# Note: Octave requires C++ compiler when compiling C wrappers
# ----------------------------------------------------------------
octave: $(SRCS)
$(SWIG) -octave $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -g -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(CXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE)
$(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES) $(OCTAVE_INCLUDE)
$(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
# -----------------------------------------------------------------
@ -1124,11 +1125,11 @@ RRSRC = $(INTERFACE:.i=.R)
r: $(SRCS)
$(SWIG) -r $(SWIGOPT) $(INTERFACEPATH)
+( PKG_LIBS="$(SRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) )
+( PKG_LIBS="$(SRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -fPIC -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) )
r_cpp: $(CXXSRCS)
$(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACEPATH)
+( PKG_LIBS="$(CXXSRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) )
+( PKG_LIBS="$(CXXSRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -fPIC -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) )
r_clean:
rm -f *_wrap* *~ .~*

View file

@ -143,7 +143,7 @@ extraction.
<ul>
<li> <a href="example.c">example.c</a> (C Source)
<li> <a href="example.i">example.i</a> (Swig interface)
<li> <a href="example.i">example.i</a> (SWIG interface)
<li> <a href="runme.java">runme.java</a> (Java program)
</ul>

View file

@ -66,24 +66,6 @@ The examples have been extensively tested on the following platforms:
Please see the <a href="../../Doc/Manual/Windows.html">Windows</a> page in the main manual for information on using the examples on Windows. <p>
The most recent version of Perl used for testing is as follows:
<blockquote>
<pre>
% perl -version
This is perl, v5.6.0 built for sun4-solaris
Copyright 1987-2000, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
</pre>
</blockquote>
<p>
Due to wide variations in the Perl C API and differences between versions such as the ActivePerl release for Windows,
the code generated by SWIG is extremely messy. We have made every attempt to maintain compatibility with

View file

@ -144,7 +144,7 @@ extraction.
<ul>
<li> <a href="example.c">example.c</a> (C Source)
<li> <a href="example.i">example.i</a> (Swig interface)
<li> <a href="example.i">example.i</a> (SWIG interface)
<li> <a href="runme.pl">runme.pl</a> (Perl Script)
</ul>

View file

@ -0,0 +1,22 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
SWIGOPT =
all::
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php_cpp
static::
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' php_cpp_static
clean::
$(MAKE) -f $(TOP)/Makefile php_clean
rm -f $(TARGET).php
check: all
$(MAKE) -f $(TOP)/Makefile php_run

View file

@ -0,0 +1,4 @@
/* File : example.cxx */
#include "example.h"

View file

@ -0,0 +1,22 @@
/* File : example.h */
#include <iostream>
class Callback {
public:
virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; }
virtual void run() { std::cout << "Callback::run()" << std::endl; }
};
class Caller {
private:
Callback *_callback;
public:
Caller(): _callback(0) {}
~Caller() { delCallback(); }
void delCallback() { delete _callback; _callback = 0; }
void setCallback(Callback *cb) { delCallback(); _callback = cb; }
void call() { if (_callback) _callback->run(); }
};

View file

@ -0,0 +1,13 @@
/* File : example.i */
%module(directors="1") example
%{
#include "example.h"
%}
%include "std_string.i"
/* turn on director wrapping Callback */
%feature("director") Callback;
%include "example.h"

View file

@ -0,0 +1,19 @@
<html>
<head>
<title>SWIG:Examples:php:callback</title>
</head>
<body bgcolor="#ffffff">
<tt>SWIG/Examples/php/callback/</tt>
<hr>
<H2>Implementing C++ callbacks in PHP</H2>
<p>
This example illustrates how to use directors to implement C++ callbacks in PHP.
<hr>
</body>
</html>

View file

@ -0,0 +1,47 @@
<?php
# This file illustrates the cross language polymorphism using directors.
require("example.php");
# Class, which overwrites Callback::run().
class PhpCallback extends Callback {
function run() {
print "PhpCallback.run()\n";
}
};
# Create an Caller instance
$caller = new Caller();
# Add a simple C++ callback (caller owns the callback, so
# we disown it first by clearing the .thisown flag).
print "Adding and calling a normal C++ callback\n";
print "----------------------------------------\n";
$callback = new Callback();
$callback->thisown = 0;
$caller->setCallback($callback);
$caller->call();
$caller->delCallback();
print "\n";
print "Adding and calling a PHP callback\n";
print "------------------------------------\n";
# Add a PHP callback.
$callback = new PhpCallback();
$callback->thisown = 0;
$caller->setCallback($callback);
$caller->call();
$caller->delCallback();
# All done.
print "php exit\n";
?>

View file

@ -1,16 +1,18 @@
# see top-level Makefile.in
# (see also top-level configure.in kludge)
callback
class
constants
cpointer
disown
enum
extend
funcptr
overloading
pointer
pragmas
reference
proxy
reference
simple
sync
value

View file

@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS =
SWIGOPT = -noproxy
SWIGOPT =
all::
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \

View file

@ -1,22 +1,20 @@
<?php
# This file illustrates the low-level C++ interface
# created by SWIG. In this case, all of our C++ classes
# get converted into function calls.
# This example illustrates how member variables are wrapped.
require("example.php");
# ----- Object creation -----
print "Creating some objects:\n";
$c = new_Circle(10);
print " Created circle $c\n";
$s = new_Square(10);
print " Created square $s\n";
$c = new Circle(10);
print " Created circle\n";
$s = new Square(10);
print " Created square\n";
# ----- Access a static member -----
print "\nA total of " . nshapes() . " shapes were created\n";
print "\nA total of " . Shape::get_nshapes() . " shapes were created\n";
# ----- Member data access -----
@ -24,14 +22,14 @@ print "\nA total of " . nshapes() . " shapes were created\n";
# Note: methods in the base class Shape are used since
# x and y are defined there.
Shape_x_set($c, 20);
Shape_y_set($c, 30);
Shape_x_set($s,-10);
Shape_y_set($s,5);
$c->x = 20;
$c->y = 30;
$s->x = -10;
$s->y = 5;
print "\nHere is their current position:\n";
print " Circle = (" . Shape_x_get($c) . "," . Shape_y_get($c) . ")\n";
print " Square = (" . Shape_x_get($s) . "," . Shape_y_get($s) . ")\n";
print " Circle = ({$c->x},{$c->y})\n";
print " Square = ({$s->x},{$s->y})\n";
# ----- Call some methods -----
@ -39,18 +37,16 @@ print " Square = (" . Shape_x_get($s) . "," . Shape_y_get($s) . ")\n";
# invoke the appropriate virtual method on each object.
print "\nHere are some properties of the shapes:\n";
foreach (array($c,$s) as $o) {
print " $o\n";
print " area = " . Shape_area($o) . "\n";
print " perimeter = " . Shape_perimeter($o) . "\n";
}
print " ". get_class($o) . "\n";
print " area = {$o->area()}\n";
print " perimeter = {$o->perimeter()}\n";
}
# ----- Delete everything -----
print "\nGuess I'll clean up now\n";
# Note: this invokes the virtual destructor
#delete_Shape($c);
#delete_Shape($s);
$c = NULL;
$s = NULL;
@ -58,7 +54,7 @@ $s = NULL;
# the square.
$o = NULL;
print nshapes() . " shapes remain\n";
print Shape::get_nshapes() . " shapes remain\n";
print "Goodbye\n";
?>

View file

@ -22,7 +22,7 @@
# Now get the result
$r = intp_value($c);
print " 38 + 42 = $r\n";
print " 37 + 42 = $r\n";
# Clean up the pointers
delete_intp($a);

View file

@ -0,0 +1,22 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
SWIGOPT =
all::
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php_cpp
static::
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' php_cpp_static
clean::
$(MAKE) -f $(TOP)/Makefile php_clean
rm -f $(TARGET).php
check: all
$(MAKE) -f $(TOP)/Makefile php_run

View file

@ -0,0 +1,4 @@
/* File : example.cxx */
#include "example.h"

View file

@ -0,0 +1,56 @@
/* File : example.h */
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
class Employee {
private:
std::string name;
public:
Employee(const char* n): name(n) {}
virtual std::string getTitle() { return getPosition() + " " + getName(); }
virtual std::string getName() { return name; }
virtual std::string getPosition() const { return "Employee"; }
virtual ~Employee() { printf("~Employee() @ %p\n", this); }
};
class Manager: public Employee {
public:
Manager(const char* n): Employee(n) {}
virtual std::string getPosition() const { return "Manager"; }
};
class EmployeeList {
std::vector<Employee*> list;
public:
EmployeeList() {
list.push_back(new Employee("Bob"));
list.push_back(new Employee("Jane"));
list.push_back(new Manager("Ted"));
}
void addEmployee(Employee *p) {
list.push_back(p);
std::cout << "New employee added. Current employees are:" << std::endl;
std::vector<Employee*>::iterator i;
for (i=list.begin(); i!=list.end(); i++) {
std::cout << " " << (*i)->getTitle() << std::endl;
}
}
const Employee *get_item(int i) {
return list[i];
}
~EmployeeList() {
std::vector<Employee*>::iterator i;
std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl;
for (i=list.begin(); i!=list.end(); i++) {
delete *i;
}
std::cout << "~EmployeeList empty." << std::endl;
}
};

View file

@ -0,0 +1,15 @@
/* File : example.i */
%module(directors="1") example
%{
#include "example.h"
%}
%include "std_vector.i"
%include "std_string.i"
/* turn on director wrapping for Manager */
%feature("director") Employee;
%feature("director") Manager;
%include "example.h"

View file

@ -0,0 +1,19 @@
<html>
<head>
<title>SWIG:Examples:php:extend</title>
</head>
<body bgcolor="#ffffff">
<tt>SWIG/Examples/php/extend/</tt>
<hr>
<H2>Extending a simple C++ class in PHP</H2>
<p>
This example illustrates the extending of a C++ class with cross language polymorphism.
<hr>
</body>
</html>

View file

@ -0,0 +1,76 @@
<?php
# This file illustrates the cross language polymorphism using directors.
require("example.php");
# CEO class, which overrides Employee::getPosition().
class CEO extends Manager {
function getPosition() {
return "CEO";
}
}
# Create an instance of our employee extension class, CEO. The calls to
# getName() and getPosition() are standard, the call to getTitle() uses
# the director wrappers to call CEO.getPosition.
$e = new CEO("Alice");
print $e->getName() . " is a " . $e->getPosition() . "\n";
printf("Just call her \"%s\"\n", $e->getTitle());
print "----------------------\n";
# Create a new EmployeeList instance. This class does not have a C++
# director wrapper, but can be used freely with other classes that do.
$list = new EmployeeList();
# EmployeeList owns its items, so we must surrender ownership of objects
# we add. This involves first clearing the ->disown member to tell the
# C++ director to start reference counting.
$e->thisown = 0;
$list->addEmployee($e);
print "----------------------\n";
# Now we access the first four items in list (three are C++ objects that
# EmployeeList's constructor adds, the last is our CEO). The virtual
# methods of all these instances are treated the same. For items 0, 1, and
# 2, both all methods resolve in C++. For item 3, our CEO, getTitle calls
# getPosition which resolves in PHP. The call to getPosition is
# slightly different, however, from the e.getPosition() call above, since
# now the object reference has been "laundered" by passing through
# EmployeeList as an Employee*. Previously, PHP resolved the call
# immediately in CEO, but now PHP thinks the object is an instance of
# class Employee (actually EmployeePtr). So the call passes through the
# Employee proxy class and on to the C wrappers and C++ director,
# eventually ending up back at the CEO implementation of getPosition().
# The call to getTitle() for item 3 runs the C++ Employee::getTitle()
# method, which in turn calls getPosition(). This virtual method call
# passes down through the C++ director class to the PHP implementation
# in CEO. All this routing takes place transparently.
print "(position, title) for items 0-3:\n";
printf(" %s, \"%s\"\n", $list->get_item(0)->getPosition(), $list->get_item(0)->getTitle());
printf(" %s, \"%s\"\n", $list->get_item(1)->getPosition(), $list->get_item(1)->getTitle());
printf(" %s, \"%s\"\n", $list->get_item(2)->getPosition(), $list->get_item(2)->getTitle());
printf(" %s, \"%s\"\n", $list->get_item(3)->getPosition(), $list->get_item(3)->getTitle());
print "----------------------\n";
# Time to delete the EmployeeList, which will delete all the Employee*
# items it contains. The last item is our CEO, which gets destroyed as its
# reference count goes to zero. The PHP destructor runs, and is still
# able to call the getName() method since the underlying C++ object still
# exists. After this destructor runs the remaining C++ destructors run as
# usual to destroy the object.
unset($list);
print "----------------------\n";
# All done.
print "php exit\n";
?>

View file

@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS =
SWIGOPT = -noproxy
SWIGOPT =
all::
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \

View file

@ -17,7 +17,7 @@ Vector operator+(const Vector &a, const Vector &b) {
return r;
}
char *Vector::print() {
char *Vector::as_string() {
static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);
return temp;
@ -47,4 +47,3 @@ int VectorArray::size() {
printf("VectorArray: size %d self=%p\n",maxsize,this);
return maxsize;
}

View file

@ -7,7 +7,7 @@ public:
Vector() : x(0), y(0), z(0) { };
Vector(double x, double y, double z) : x(x), y(y), z(z) { };
friend Vector operator+(const Vector &a, const Vector &b);
char *print();
char *as_string();
};
class VectorArray {

View file

@ -1,6 +1,10 @@
/* File : example.i */
/* This file has a few "typical" uses of C++ references. */
/* This example has nothing to do with references but the name is used by all
* the other languages so it's hard to rename to something more meaningful.
*
* Mostly it shows how to use %extend.
*/
%module example
@ -12,7 +16,7 @@ class Vector {
public:
Vector(double x, double y, double z);
~Vector();
char *print();
char *as_string();
};
/* This helper function calls an overloaded operator */
@ -41,4 +45,3 @@ public:
}
}
};

View file

@ -1,18 +1,17 @@
<?php
# This file illustrates the manipulation of C++ references in Php.
# This uses the low-level interface. Proxy classes work differently.
# This file illustrates the manipulation of C++ references in PHP.
require "example.php";
# ----- Object creation -----
print "Creating some objects:\n";
$a = new_Vector(3,4,5);
$b = new_Vector(10,11,12);
$a = new Vector(3, 4, 5);
$b = new Vector(10, 11, 12);
print " Created a: $a " . Vector_print($a) . "\n";
print " Created b: $b " . Vector_print($b) . "\n";
print " Created a: {$a->as_string()}\n";
print " Created b: {$b->as_string()}\n";
# ----- Call an overloaded operator -----
@ -23,56 +22,28 @@ print " Created b: $b " . Vector_print($b) . "\n";
# It returns a new allocated object.
print "Adding a+b\n";
$c = addv($a,$b);
print " a+b =". Vector_print($c)."\n";
# Note: Unless we free the result, a memory leak will occur
$c = None;
$c = example::addv($a, $b);
print " a+b ={$c->as_string()}\n";
# ----- Create a vector array -----
# Note: Using the high-level interface here
print "Creating an array of vectors\n";
$va = new_VectorArray(10);
$va = new VectorArray(10);
print " va: $va size=".VectorArray_size($va)."\n";
print " va: size={$va->size()}\n";
# ----- Set some values in the array -----
# These operators copy the value of $a and $b to the vector array
VectorArray_set($va,0,$a);
VectorArray_set($va,1,$b);
VectorArray_get($va,0);
# This will work, but it will cause a memory leak!
VectorArray_set($va,2,addv($a,$b));
# The non-leaky way to do it
$c = addv($a,$b);
VectorArray_set($va,3,$c);
$c = None;
$va->set(0, $a);
$va->set(1, $b);
$va->set(2, addv($a, $b));
# Get some values from the array
print "Getting some array values\n";
for ($i = 0; $i < 5; $i++) {
print "do $i\n";
print " va($i) = ". Vector_print(VectorArray_get($va,$i)). "\n";
print " va[$i] = {$va->get($i)->as_string()}\n";
}
# Watch under resource meter to check on this
#print "Making sure we don't leak memory.\n";
#for ($i = 0; $i < 1000000; $i++) {
# $c = VectorArray_get($va,$i % 10);
#}
# ----- Clean up -----
print "Cleaning up\n";
# wants fixing FIXME
$va = None;
$a = None;
$b = None;
?>

View file

@ -1,6 +1,5 @@
/* File : example.h */
#include <cstdio>
#include <iostream>
class Callback {

View file

@ -144,7 +144,7 @@ extraction.
<ul>
<li> <a href="example.c">example.c</a> (C Source)
<li> <a href="example.i">example.i</a> (Swig interface)
<li> <a href="example.i">example.i</a> (SWIG interface)
<li> <a href="example.py">example.py</a> (Python Script)
</ul>

View file

@ -20,7 +20,7 @@ extern int gcd(int x, int y);
if (TYPE($input) != T_ARRAY) {
SWIG_exception(SWIG_ValueError, "Expected an array");
}
$1 = RARRAY($input)->len;
$1 = RARRAY_LEN($input);
if ($1 == 0) {
SWIG_exception(SWIG_ValueError, "List must contain at least 1 element");
}
@ -47,7 +47,7 @@ extern int gcdmain(int argc, char *argv[]);
SWIG_exception(SWIG_ValueError, "Expected a string");
}
$1 = STR2CSTR($input);
$2 = RSTRING($input)->len;
$2 = RSTRING_LEN($input);
}
extern int count(char *bytes, int len, char c);
@ -61,7 +61,7 @@ extern int count(char *bytes, int len, char c);
SWIG_exception(SWIG_ValueError,"Expected a string");
}
temp = STR2CSTR($input);
$2 = RSTRING($input)->len;
$2 = RSTRING_LEN($input);
$1 = (char *) malloc($2+1);
memmove($1,temp,$2);
}

View file

@ -144,7 +144,7 @@ extraction.
<ul>
<li> <a href="example.c">example.c</a> (C Source)
<li> <a href="example.i">example.i</a> (Swig interface)
<li> <a href="example.i">example.i</a> (SWIG interface)
<li> <a href="runme.rb">runme.rb</a> (Ruby Script)
</ul>

View file

@ -144,7 +144,7 @@ extraction.
<ul>
<li> <a href="example.c">example.c</a> (C Source)
<li> <a href="example.i">example.i</a> (Swig interface)
<li> <a href="example.i">example.i</a> (SWIG interface)
<li> <a href="runme.tcl">runme.tcl</a> (Tcl Script)
</ul>

View file

@ -89,8 +89,12 @@ SKIP_CPP_STD_CASES = Yes
include $(srcdir)/../common.mk
# Overridden variables here
# SWIGOPT += -debug-module 4
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -110,9 +114,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
%.clean:
@rm -f $*.cl

View file

@ -0,0 +1,33 @@
%module catches
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
%}
%include <exception.i> // for throws(...) typemap
%catches(int, const char *, const ThreeException&) test_catches(int i);
%catches(int, ...) test_exception_specification(int i); // override the exception specification
%catches(...) test_catches_all(int i);
%inline %{
struct ThreeException {};
void test_catches(int i) {
if (i == 1) {
throw int(1);
} else if (i == 2) {
throw (const char *)"two";
} else if (i == 3) {
throw ThreeException();
}
}
void test_exception_specification(int i) throw(int, const char *, const ThreeException&) {
test_catches(i);
}
void test_catches_all(int i) {
test_catches(i);
}
%}

View file

@ -11,10 +11,14 @@ top_builddir = @top_builddir@
include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now
CPP_TEST_CASES =
#C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -34,9 +38,9 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra cffi code)
%.clean:

View file

@ -149,6 +149,18 @@ const char global_const_char_array2[sizeof(CPLUSPLUS_MSG)+1] = CPLUSPLUS_MSG;
%inline %{
// char *& tests
char *&GetCharPointerRef() {
static char str[] = CPLUSPLUS_MSG;
static char *ptr = str;
return ptr;
}
bool SetCharPointerRef(char *&str, unsigned int number) {
static char static_str[] = CPLUSPLUS_MSG;
strcpy(static_str, str);
return check(static_str, number);
}
const char *&GetConstCharPointerRef() {
static const char str[] = CPLUSPLUS_MSG;
static const char *ptr = str;

View file

@ -23,70 +23,73 @@ EXTRA_TEST_CASES += chicken_ext_test.externaltest
include $(srcdir)/../common.mk
# Overridden variables here
SWIGOPT += -nounit
# Custom tests - tests with additional commandline options
# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
# with the -proxy argument
%.cppproxy: SWIGOPT += -proxy
%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.cproxy: SWIGOPT += -proxy
%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.multiproxy: SWIGOPT += -proxy -noclosuses
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
# Rules for the different types of tests
%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
$(MAKE) $*.cppproxy; ) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.cppproxy; \
fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
$(MAKE) $*.cproxy; ) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.cproxy; \
fi
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
$(MAKE) $*.multiproxy; ) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.multiproxy; \
fi
%.externaltest:
$(setup)
+$(swig_and_compile_external)
$(run_testcase)
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
# with the -proxy argument
%.cppproxy: SWIGOPT += -proxy
%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.cppproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_cpp)
$(run_testcase)
%.cproxy: SWIGOPT += -proxy
%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.cproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_c)
$(run_testcase)
%.multiproxy: SWIGOPT += -proxy -noclosuses
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.multiproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_multi_cpp)
$(run_testcase)
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -11,10 +11,14 @@ top_builddir = @top_builddir@
include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now
CPP_TEST_CASES =
#C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -34,9 +38,9 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISPBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISPBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra clisp code)
%.clean:

View file

@ -16,8 +16,8 @@
# b) Define rules for %.ctest, %.cpptest, %.multicpptest and %.clean.
# c) Define srcdir, top_srcdir and top_builddir (these are the
# equivalent to configure's variables of the same name).
# 3) One off special commandline options can be achieved by adding a
# test case to CUSTOM_TEST_CASES and defining rules to run and test.
# 3) One off special commandline options for a testcase can be added.
# See custom tests below.
#
# The 'check' target runs the testcases including SWIG invocation,
# C/C++ compilation, target language compilation (if any) and runtime
@ -28,12 +28,14 @@
# The 'clean' target cleans up.
#
# Note that the RUNTOOL, COMPILETOOL and SWIGTOOL variables can be used
# for # invoking tools for the runtime tests and target language
# for invoking tools for the runtime tests and target language
# compiler (eg javac) respectively. For example, valgrind can be used
# for memory checking of the runtime tests using:
# make RUNTOOL="valgrind --leak-check-full"
# make RUNTOOL="valgrind --leak-check=full"
# and valgrind can be used when invoking SWIG using:
# make SWIGTOOL="valgrind --tool=memcheck"
# make SWIGTOOL="valgrind --tool=memcheck --trace-children=yes"
# Note: trace-children needed because of preinst-swig shell wrapper
# to the swig executable.
#
# The variables below can be overridden after including this makefile
#######################################################################
@ -71,27 +73,25 @@ INTERFACEDIR = ../
# Note that any whitespace after the last entry in each list will break make
#
# 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 += \
constants \
cpp_broken \
exception_partial_info \
extend_variable \
li_std_vector_ptr \
namespace_union \
nested_struct \
overload_complicated \
template_default_pointer \
template_expr \
$(CPP0X_TEST_BROKEN)
# Broken C test cases. (Can be run individually using make testcase.ctest.)
# Broken C test cases. (Can be run individually using: make testcase.ctest)
C_TEST_BROKEN += \
tag_no_clash_with_variable
# C++ test cases. (Can be run individually using make testcase.cpptest.)
# C++ test cases. (Can be run individually using: make testcase.cpptest)
CPP_TEST_CASES += \
$(CPP0X_TEST_CASES) \
abstract_access \
@ -119,6 +119,7 @@ CPP_TEST_CASES += \
arrays_scope \
bloody_hell \
bools \
catches \
cast_operator \
casts \
char_strings \
@ -190,6 +191,7 @@ CPP_TEST_CASES += \
extend_placement \
extend_template \
extend_template_ns \
extern_c \
extern_namespace \
extern_throws \
features \
@ -198,6 +200,7 @@ CPP_TEST_CASES += \
fvirtual \
global_namespace \
global_ns_arg \
global_scope_types \
global_vars \
grouping \
ignore_parameter \
@ -222,6 +225,7 @@ CPP_TEST_CASES += \
li_typemaps \
li_windows \
long_long_apply \
memberin_extend \
member_pointer \
member_template \
minherit \
@ -238,9 +242,12 @@ CPP_TEST_CASES += \
namespace_template \
namespace_typedef_class \
namespace_typemap \
namespace_union \
namespace_virtual_method \
naturalvar \
nested_class \
nested_comment \
nested_workaround \
newobject1 \
null_pointer \
operator_overload \
@ -255,6 +262,7 @@ CPP_TEST_CASES += \
overload_template \
overload_template_fast \
pointer_reference \
preproc_constants \
primitive_ref \
private_assign \
protected_rename \
@ -293,10 +301,13 @@ CPP_TEST_CASES += \
smart_pointer_templatevariables \
smart_pointer_typedef \
special_variables \
special_variable_macros \
static_array_member \
static_const_member \
static_const_member_2 \
struct_initialization_cpp \
struct_value \
symbol_clash \
template \
template_arg_replace \
template_arg_scope \
@ -326,6 +337,8 @@ CPP_TEST_CASES += \
template_inherit_abstract \
template_int_const \
template_methods \
template_nested \
template_nested_typemaps \
template_ns \
template_ns2 \
template_ns3 \
@ -335,6 +348,8 @@ CPP_TEST_CASES += \
template_ns_inherit \
template_ns_scope \
template_partial_arg \
template_partial_specialization \
template_partial_specialization_typedef \
template_qualifier \
template_qualifier \
template_ref_type \
@ -370,9 +385,11 @@ CPP_TEST_CASES += \
typedef_scope \
typedef_sizet \
typedef_struct \
typemap_global_scope \
typemap_namespace \
typemap_ns_using \
typemap_numinputs \
typemap_template \
typemap_out_optimal \
typemap_variables \
typemap_various \
@ -396,6 +413,7 @@ CPP_TEST_CASES += \
virtual_destructor \
virtual_poly \
voidtest \
wallkw \
wrapmacro
# C++0x test cases.
@ -437,8 +455,10 @@ CPP0X_TEST_BROKEN =
CPP_STD_TEST_CASES += \
director_string \
ignore_template_constructor \
li_std_combinations \
li_std_deque \
li_std_except \
li_std_map \
li_std_pair \
li_std_string \
li_std_vector \
@ -455,11 +475,12 @@ CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
endif
# C test cases. (Can be run individually using make testcase.ctest.)
# C test cases. (Can be run individually using: make testcase.ctest)
C_TEST_CASES += \
arrays \
char_constant \
const_const \
constant_expr \
empty \
enums \
extern_declaration \
@ -477,24 +498,28 @@ C_TEST_CASES += \
li_cpointer \
li_math \
long_long \
memberin_extend_c \
name \
nested \
nested_structs \
newobject2 \
overload_extend \
overload_extendc \
preproc \
preproc_constants_c \
ret_by_value \
simple_array \
sizeof_pointer \
sneaky1 \
struct_rename \
struct_initialization \
typedef_struct \
typemap_subst \
union_parameter \
unions
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest.)
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
MULTI_CPP_TEST_CASES += \
clientdata_prop \
imports \
@ -503,10 +528,13 @@ MULTI_CPP_TEST_CASES += \
template_typedef_import \
multi_import
# Custom tests - tests with additional commandline options
wallkw.cpptest: SWIGOPT += -Wallkw
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
$(C_TEST_CASES:=.ctest) \
$(MULTI_CPP_TEST_CASES:=.multicpptest) \
$(CUSTOM_TEST_CASES:=.customtest) \
$(EXTRA_TEST_CASES)
BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \
@ -515,7 +543,6 @@ BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \
ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \
$(C_TEST_CASES:=.clean) \
$(MULTI_CPP_TEST_CASES:=.clean) \
$(CUSTOM_TEST_CASES:=.clean) \
$(CPP_TEST_BROKEN:=.clean) \
$(C_TEST_BROKEN:=.clean)

View file

@ -0,0 +1,11 @@
%module constant_expr;
/* Tests of constant expressions. */
%inline %{
/* % didn't work in SWIG 1.3.40 and earlier. */
const int X = 123%7;
#define FOO 12 % 6
double d_array[12 % 6];
%}

View file

@ -121,7 +121,8 @@ int* const globalRet2() {return &GlobalInt;}
%{
static int wxEVT_COMMAND_BUTTON_CLICKEDv;
static int **wxEVT_COMMAND_BUTTON_CLICKEDp;
static int *wxEVT_COMMAND_BUTTON_CLICKEDp;
static int **wxEVT_COMMAND_BUTTON_CLICKEDpp = &wxEVT_COMMAND_BUTTON_CLICKEDp;
#if defined(SWIGR)
#undef lang1 /* conflicts with symbol in R internals */
#endif
@ -137,7 +138,7 @@ char *langs[] ={ lang1 };
#define EWXWEXPORT_VAR
const int* wxEVENT_COMMAND_BUTTON_CLICKEDr = (int*) &wxEVT_COMMAND_BUTTON_CLICKEDv;
const int* wxEVENT_COMMAND_BUTTON_CLICKEDp = (int*) *wxEVT_COMMAND_BUTTON_CLICKEDp;
const int* wxEVENT_COMMAND_BUTTON_CLICKEDp = (int*) *wxEVT_COMMAND_BUTTON_CLICKEDpp;
char **languages1 = &langs[0];
char **languages2 = (char **)&langs[0];
}

View file

@ -73,10 +73,6 @@ public:
%include "std_vector.i"
#if defined(SWIGCSHARP)
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Flow, Space::Flow)
#endif
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Space::Flow>::vector(size_type);

View file

@ -1,36 +1,6 @@
%module cpp_broken
// bug #1060789
%inline %{
#define MASK(shift, size) (((1 << (size)) - 1) << (shift))
#define SOME_MASK_DEF (80*MASK(8, 10))
%}
// bug #1060079
%inline %{
#define FIELD(name, width) unsigned int name:width
#define SOME_CONST 2
#define NEXT_CONST (2 * SOME_CONST)
typedef struct {
FIELD(a, SOME_CONST);
FIELD(b, NEXT_CONST);
} MyStruct_t;
%}
%{
#ifdef max
#undef max
#endif
%}
// bug #994301
%inline %{
#define max(a,b) ((a) > (b) ? (a) : (b))
%}
// bug #940318
%inline %{
typedef enum {
@ -40,36 +10,3 @@ eZero = 0
%}
// bug #754443
%inline %{
#define MAG_STYLE_BORDER_OFFS 0
#define MAG_STYLE_BORDER_BITS 3
#define MAG_STYLE_BORDER_MASK (((1UL<<MAG_STYLE_BORDER_BITS)-1)<<MAG_STYLE_BORDER_OFFS)
/* these CANNOT be combined */
#define MAG_STYLE_BORDER_NONE (1 << MAG_STYLE_BORDER_OFFS)
#define MAG_STYLE_BORDER_STATIC (2 << MAG_STYLE_BORDER_OFFS)
#define MAG_STYLE_BORDER_SIMPLE (3 << MAG_STYLE_BORDER_OFFS)
#define MAG_STYLE_BORDER_RAISED (4 << MAG_STYLE_BORDER_OFFS)
#define MAG_STYLE_BORDER_DOUBLE (5 << MAG_STYLE_BORDER_OFFS)
#define MAG_STYLE_BORDER_DEFAULT MAG_STYLE_BORDER_SIMPLE
#define MAG_STYLE_CAPTION_OFFS ( MAG_STYLE_BORDER_OFFS + MAG_STYLE_BORDER_BITS )
#define MAG_STYLE_CAPTION_BITS 8
#define MAG_STYLE_CAPTION_MASK (((1UL<<MAG_STYLE_CAPTION_BITS)-1)<<MAG_STYLE_CAPTION_OFFS)
/* these CAN be combined */
#define MAG_STYLE_CAPTION_NONE ( 1 << ( 0 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_PRESENT ( 1 << ( 1 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_SYSMENU ( 1 << ( 2 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_MINIMIZE ( 1 << ( 3 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_MAXIMIZE ( 1 << ( 4 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_RESIZE ( 1 << ( 5 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_TINYHOR ( 1 << ( 6 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_TINYVER ( 1 << ( 7 + MAG_STYLE_CAPTION_OFFS ))
#define MAG_STYLE_CAPTION_DEFAULT ( MAG_STYLE_CAPTION_RESIZE + MAG_STYLE_CAPTION_MAXIMIZE + MAG_STYLE_CAPTION_MINIMIZE + MAG_STYLE_CAPTION_SYSMENU + MAG_STYLE_CAPTION_PRESENT )
%}

View file

@ -15,24 +15,26 @@ CPP_TEST_CASES = \
csharp_attributes \
csharp_exceptions \
csharp_features \
csharp_lib_arrays \
csharp_prepost \
csharp_typemaps \
enum_thorough_simple \
enum_thorough_typesafe \
exception_partial_info
CUSTOM_TEST_CASES = \
csharp_lib_arrays \
exception_partial_info \
intermediary_classname
include $(srcdir)/../common.mk
# Overridden variables here
SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)
SWIGOPT += -namespace $*Namespace
INTERFACEDIR = ../../
CSHARPFLAGSSPECIAL =
# Custom tests - tests with additional commandline options
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -49,12 +51,6 @@ CSHARPFLAGSSPECIAL =
+(cd $* && $(swig_and_compile_multi_cpp))
+$(run_testcase)
# Rules for custom tests
intermediary_classname.customtest:
$(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname"
csharp_lib_arrays.customtest:
$(MAKE) csharp_lib_arrays.cpptest CSHARPFLAGSSPECIAL="-unsafe"
# Makes a directory for the testcase if it does not exist
setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
@ -63,31 +59,31 @@ setup = \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
fi;
mkdir $*; \
fi
# Compiles C# files then runs the testcase. A testcase is only run if
# a file is found which has _runme.cs appended after the testcase name.
# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` \
$*$(CSHARPPATHSEPARATOR)*.cs' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; ) \
else ( \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
CSHARPSRCS='*.cs' csharp_compile; ); \
fi;
CSHARPSRCS='*.cs' csharp_compile && cd .. ; \
fi
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
fi;
rm -rf $*; \
fi
clean:
@rm -f *.exe *.exe.mdb

View file

@ -0,0 +1,66 @@
using System;
using catchesNamespace;
public class runme {
static void Main() {
// test_catches()
try {
catches.test_catches(1);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ int exception thrown, value: 1")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
catches.test_catches(2);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "two")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
catches.test_catches(3);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ ThreeException const & exception thrown")
throw new ApplicationException("bad exception order: " + e.Message);
}
// test_exception_specification()
try {
catches.test_exception_specification(1);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ int exception thrown, value: 1")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
catches.test_exception_specification(2);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "unknown exception")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
catches.test_exception_specification(3);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "unknown exception")
throw new ApplicationException("bad exception order: " + e.Message);
}
// test_catches_all()
try {
catches.test_catches_all(1);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "unknown exception")
throw new ApplicationException("bad exception order: " + e.Message);
}
}
}

View file

@ -120,15 +120,26 @@ public class char_strings_runme {
// char *& tests
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharPointerRef();
String str = char_strings.GetCharPointerRef();
if (str != CPLUSPLUS_MSG)
throw new Exception("Test char pointer ref get failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i))
throw new Exception("Test char pointer ref set failed, iteration " + i);
}
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharPointerRef();
if (str != CPLUSPLUS_MSG)
throw new Exception("Test const char pointer ref get failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
throw new Exception("Test const char pointer ref set failed, iteration " + i);
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Reflection;
using System.ComponentModel;
using csharp_attributesNamespace;
public class runme
@ -171,6 +172,24 @@ public class runme
if (Attribute.GetCustomAttribute(member, typeof(Eurostar2Attribute)) == null)
throw new Exception("No attribute for " + member.Name);
}
// Enum value attributes
Type walesType = typeof(MoreStations.Wales);
{
MemberInfo member = (MemberInfo)walesType.GetMember("Cardiff")[0];
DescriptionAttribute attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(System.ComponentModel.DescriptionAttribute));
if (attribute == null)
throw new Exception("No attribute for " + member.Name);
if (attribute.Description != "Cardiff city station")
throw new Exception("Incorrect attribute value for " + member.Name);
}
{
MemberInfo member = (MemberInfo)walesType.GetMember("Swansea")[0];
DescriptionAttribute attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(System.ComponentModel.DescriptionAttribute));
if (attribute == null)
throw new Exception("No attribute for " + member.Name);
if (attribute.Description != "Swansea city station")
throw new Exception("Incorrect attribute value for " + member.Name);
}
// Enum csattribute typemap
{
Type cymrutype = typeof(Cymru);
@ -179,6 +198,8 @@ public class runme
if (tgv == null)
throw new Exception("No attribute for Cymru");
}
// No runtime test for directorinattributes and directoroutattributes
}
}
@ -237,3 +258,9 @@ public class ThreadSafeAttribute : Attribute {
public ThreadSafeAttribute() {}
}
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
public class DirectorIntegerOutAttribute : Attribute {}
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
public class DirectorIntegerInAttribute : Attribute {}

View file

@ -358,12 +358,51 @@ public class runme {
i.MemberInstance = Instances.memberinstance3;
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
}
{
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
}
{
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
}
{
if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
}
{
if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if ((int)enum_thorough.repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed");
if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
if ((int)enum_thorough.repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed");
if ((int)enum_thorough.repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed");
if ((int)enum_thorough.repeatTest(repeat.last) != 3) throw new Exception("repeatTest 5 failed");
if ((int)enum_thorough.repeatTest(repeat.llast) != 3) throw new Exception("repeatTest 5 failed");
if ((int)enum_thorough.repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
}
}

View file

@ -358,12 +358,51 @@ public class runme {
i.MemberInstance = Instances.memberinstance3;
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
}
{
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
}
{
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
}
{
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
}
{
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_simple.repeatTest(enum_thorough_simple.one) != 1) throw new Exception("repeatTest 1 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.two) != 2) throw new Exception("repeatTest 3 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.three) != 3) throw new Exception("repeatTest 4 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.last) != 3) throw new Exception("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.llast) != 3) throw new Exception("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.end) != 3) throw new Exception("repeatTest 6 failed");
}
}

View file

@ -358,12 +358,51 @@ public class runme {
i.MemberInstance = Instances.memberinstance3;
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue != 0) throw new Exception("ignoreATest 0 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue != 3) throw new Exception("ignoreATest 3 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue != 10) throw new Exception("ignoreATest 10 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue != 11) throw new Exception("ignoreATest 11 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue != 13) throw new Exception("ignoreATest 13 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue != 14) throw new Exception("ignoreATest 14 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue != 20) throw new Exception("ignoreATest 20 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue != 30) throw new Exception("ignoreATest 30 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue != 32) throw new Exception("ignoreATest 32 failed");
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue != 33) throw new Exception("ignoreATest 33 failed");
}
{
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue != 11) throw new Exception("ignoreBTest 11 failed");
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue != 12) throw new Exception("ignoreBTest 12 failed");
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue != 31) throw new Exception("ignoreBTest 31 failed");
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue != 32) throw new Exception("ignoreBTest 32 failed");
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue != 41) throw new Exception("ignoreBTest 41 failed");
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue != 42) throw new Exception("ignoreBTest 42 failed");
}
{
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue != 10) throw new Exception("ignoreCTest 10 failed");
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue != 12) throw new Exception("ignoreCTest 12 failed");
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue != 30) throw new Exception("ignoreCTest 30 failed");
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue != 32) throw new Exception("ignoreCTest 32 failed");
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue != 40) throw new Exception("ignoreCTest 40 failed");
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue != 42) throw new Exception("ignoreCTest 42 failed");
}
{
if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue != 21) throw new Exception("ignoreDTest 21 failed");
if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue != 22) throw new Exception("ignoreDTest 22 failed");
}
{
if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue != 0) throw new Exception("ignoreETest 0 failed");
if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue != 21) throw new Exception("ignoreETest 21 failed");
if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue != 22) throw new Exception("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_typesafe.repeatTest(repeat.one).swigValue != 1) throw new Exception("repeatTest 1 failed");
if (enum_thorough_typesafe.repeatTest(repeat.initial).swigValue != 1) throw new Exception("repeatTest 2 failed");
if (enum_thorough_typesafe.repeatTest(repeat.two).swigValue != 2) throw new Exception("repeatTest 3 failed");
if (enum_thorough_typesafe.repeatTest(repeat.three).swigValue != 3) throw new Exception("repeatTest 4 failed");
if (enum_thorough_typesafe.repeatTest(repeat.last).swigValue != 3) throw new Exception("repeatTest 5 failed");
if (enum_thorough_typesafe.repeatTest(repeat.llast).swigValue != 3) throw new Exception("repeatTest 5 failed");
if (enum_thorough_typesafe.repeatTest(repeat.end).swigValue != 3) throw new Exception("repeatTest 6 failed");
}
}

View file

@ -0,0 +1,48 @@
using System;
using exception_orderNamespace;
public class runme {
static void Main() {
A a = new A();
try {
a.foo();
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ E1 exception thrown")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
a.bar();
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ E2 exception thrown")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
a.foobar();
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "postcatch unknown")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
a.barfoo(1);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ E1 exception thrown")
throw new ApplicationException("bad exception order: " + e.Message);
}
try {
a.barfoo(2);
throw new Exception("missed exception");
} catch (ApplicationException e) {
if (e.Message != "C++ E2 * exception thrown")
throw new ApplicationException("bad exception order: " + e.Message);
}
}
}

View file

@ -164,7 +164,7 @@ public class li_std_map_runme {
if (keyStringified != " 1 2 3 4 5")
throw new Exception("Wrapped method stringifyKeys test failed. Got " + keyStringified);
// Test a map with a new specialized type (Struct)
// Test a map with a new complex type (Struct)
{
IntStructMap ismap = new IntStructMap();
for (int i = 0; i < 10; i++)
@ -173,12 +173,12 @@ public class li_std_map_runme {
}
if (ismap.Count != 10)
throw new Exception("Count test on specialized map failed");
throw new Exception("Count test on complex type map failed");
foreach (KeyValuePair<int, Struct> p in ismap)
{
if ((p.Key * 10.1) != p.Value.num)
throw new Exception("Iteration test on specialized map failed for index " + p.Key);
throw new Exception("Iteration test on complex type map failed for index " + p.Key);
}
}
@ -191,12 +191,12 @@ public class li_std_map_runme {
}
if (ispmap.Count != 10)
throw new Exception("Count test on specialized pointer map failed");
throw new Exception("Count test on complex type pointer map failed");
foreach (KeyValuePair<int, Struct> p in ispmap)
{
if ((p.Key * 10.1) != p.Value.num)
throw new Exception("Iteration test on specialized pointer map failed for index " + p.Key);
throw new Exception("Iteration test on complex type pointer map failed for index " + p.Key);
}
}
{
@ -207,29 +207,29 @@ public class li_std_map_runme {
}
if (iscpmap.Count != 10)
throw new Exception("Count test on specialized const pointer map failed");
throw new Exception("Count test on complex type const pointer map failed");
foreach (KeyValuePair<int, Struct> p in iscpmap)
{
if ((p.Key * 10.1) != p.Value.num)
throw new Exception("Iteration test on specialized const pointer map failed for index " + p.Key);
throw new Exception("Iteration test on complex type const pointer map failed for index " + p.Key);
}
}
// Test non-specialized map
// Test complex type as key (Struct)
{
StructIntMap limap = new StructIntMap();
Struct s7 = new Struct(7);
Struct s8 = new Struct(8);
limap.setitem(s7 , 8);
if (limap.getitem(s7) != 8)
throw new Exception("Assignment test on non-specialized map failed");
limap[s7] = 8;
if (limap[s7] != 8)
throw new Exception("Assignment test on complex key map failed");
if (!limap.ContainsKey(s7))
throw new Exception("Key test (1) on non-specialized map failed");
throw new Exception("Key test (1) on complex key map failed");
if (limap.ContainsKey(s8))
throw new Exception("Key test (2) on non-specialized map failed");
throw new Exception("Key test (2) on complex key map failed");
}
// All done

View file

@ -158,7 +158,8 @@ public class li_std_vector_runme {
} catch (ArgumentNullException) {
}
{
myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
// Collection initializer test, requires C# 3.0
// myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
}
// IndexOf() test
@ -542,8 +543,8 @@ public class li_std_vector_runme {
// Dispose()
{
using (StructVector vs = new StructVector() { new Struct(0.0), new Struct(11.1) } )
using (DoubleVector vd = new DoubleVector() { 0.0, 11.1 } ) {
using (StructVector vs = new StructVector( new Struct[] { new Struct(0.0), new Struct(11.1) } ) )
using (DoubleVector vd = new DoubleVector( new double[] { 0.0, 11.1 } ) ) {
}
}

View file

@ -7,8 +7,8 @@ public class runme
{
int f = overload_template.foo();
f += overload_template.max(3,4);
double b = overload_template.max(3.4,5.2);
f += overload_template.maximum(3,4);
double b = overload_template.maximum(3.4,5.2);
b++; // warning suppression
// mix 1

View file

@ -0,0 +1,70 @@
using System;
using System.Reflection;
using preproc_constants_cNamespace;
// Same as preproc_constants_c.i testcase, but bool types are int instead
public class runme {
static void Main() {
assert( typeof(int) == preproc_constants_c.CONST_INT1.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_INT2.GetType() );
assert( typeof(uint) == preproc_constants_c.CONST_UINT1.GetType() );
assert( typeof(uint) == preproc_constants_c.CONST_UINT2.GetType() );
assert( typeof(uint) == preproc_constants_c.CONST_UINT3.GetType() );
assert( typeof(uint) == preproc_constants_c.CONST_UINT4.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_LONG1.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_LONG2.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_LONG3.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_LONG4.GetType() );
assert( typeof(long) == preproc_constants_c.CONST_LLONG1.GetType() );
assert( typeof(long) == preproc_constants_c.CONST_LLONG2.GetType() );
assert( typeof(long) == preproc_constants_c.CONST_LLONG3.GetType() );
assert( typeof(long) == preproc_constants_c.CONST_LLONG4.GetType() );
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG1.GetType() );
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG2.GetType() );
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG3.GetType() );
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG4.GetType() );
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE1.GetType() );
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE2.GetType() );
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE3.GetType() );
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE4.GetType() );
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE5.GetType() );
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE6.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_BOOL1.GetType() );
assert( typeof(int) == preproc_constants_c.CONST_BOOL2.GetType() );
assert( typeof(char) == preproc_constants_c.CONST_CHAR.GetType() );
assert( typeof(string) == preproc_constants_c.CONST_STRING1.GetType() );
assert( typeof(string) == preproc_constants_c.CONST_STRING2.GetType() );
assert( typeof(int) == preproc_constants_c.INT_AND_BOOL.GetType() );
// assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
assert( typeof(int) == preproc_constants_c.INT_AND_INT.GetType() );
assert( typeof(uint) == preproc_constants_c.INT_AND_UINT.GetType() );
assert( typeof(int) == preproc_constants_c.INT_AND_LONG.GetType() );
assert( typeof(uint) == preproc_constants_c.INT_AND_ULONG.GetType() );
assert( typeof(long) == preproc_constants_c.INT_AND_LLONG.GetType() );
assert( typeof(ulong) == preproc_constants_c.INT_AND_ULLONG.GetType() );
assert( typeof(int ) == preproc_constants_c.BOOL_AND_BOOL.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_MULTIPLY.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_DIVIDE.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_PLUS.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_LTE.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_GTE.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_EQUALITY.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_AND.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_XOR.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_OR.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
}
static void assert(bool assertion) {
if (!assertion)
throw new ApplicationException("test failed");
}
}

View file

@ -0,0 +1,69 @@
using System;
using System.Reflection;
using preproc_constantsNamespace;
public class runme {
static void Main() {
assert( typeof(int) == preproc_constants.CONST_INT1.GetType() );
assert( typeof(int) == preproc_constants.CONST_INT2.GetType() );
assert( typeof(uint) == preproc_constants.CONST_UINT1.GetType() );
assert( typeof(uint) == preproc_constants.CONST_UINT2.GetType() );
assert( typeof(uint) == preproc_constants.CONST_UINT3.GetType() );
assert( typeof(uint) == preproc_constants.CONST_UINT4.GetType() );
assert( typeof(int) == preproc_constants.CONST_LONG1.GetType() );
assert( typeof(int) == preproc_constants.CONST_LONG2.GetType() );
assert( typeof(int) == preproc_constants.CONST_LONG3.GetType() );
assert( typeof(int) == preproc_constants.CONST_LONG4.GetType() );
assert( typeof(long) == preproc_constants.CONST_LLONG1.GetType() );
assert( typeof(long) == preproc_constants.CONST_LLONG2.GetType() );
assert( typeof(long) == preproc_constants.CONST_LLONG3.GetType() );
assert( typeof(long) == preproc_constants.CONST_LLONG4.GetType() );
assert( typeof(ulong) == preproc_constants.CONST_ULLONG1.GetType() );
assert( typeof(ulong) == preproc_constants.CONST_ULLONG2.GetType() );
assert( typeof(ulong) == preproc_constants.CONST_ULLONG3.GetType() );
assert( typeof(ulong) == preproc_constants.CONST_ULLONG4.GetType() );
assert( typeof(double) == preproc_constants.CONST_DOUBLE1.GetType() );
assert( typeof(double) == preproc_constants.CONST_DOUBLE2.GetType() );
assert( typeof(double) == preproc_constants.CONST_DOUBLE3.GetType() );
assert( typeof(double) == preproc_constants.CONST_DOUBLE4.GetType() );
assert( typeof(double) == preproc_constants.CONST_DOUBLE5.GetType() );
assert( typeof(double) == preproc_constants.CONST_DOUBLE6.GetType() );
assert( typeof(bool) == preproc_constants.CONST_BOOL1.GetType() );
assert( typeof(bool) == preproc_constants.CONST_BOOL2.GetType() );
assert( typeof(char) == preproc_constants.CONST_CHAR.GetType() );
assert( typeof(string) == preproc_constants.CONST_STRING1.GetType() );
assert( typeof(string) == preproc_constants.CONST_STRING2.GetType() );
assert( typeof(int) == preproc_constants.INT_AND_BOOL.GetType() );
// assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
assert( typeof(int) == preproc_constants.INT_AND_INT.GetType() );
assert( typeof(uint) == preproc_constants.INT_AND_UINT.GetType() );
assert( typeof(int) == preproc_constants.INT_AND_LONG.GetType() );
assert( typeof(uint) == preproc_constants.INT_AND_ULONG.GetType() );
assert( typeof(long) == preproc_constants.INT_AND_LLONG.GetType() );
assert( typeof(ulong) == preproc_constants.INT_AND_ULLONG.GetType() );
assert( typeof(int ) == preproc_constants.BOOL_AND_BOOL.GetType() );
assert( typeof(int) == preproc_constants.EXPR_MULTIPLY.GetType() );
assert( typeof(int) == preproc_constants.EXPR_DIVIDE.GetType() );
assert( typeof(int) == preproc_constants.EXPR_PLUS.GetType() );
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_LTE.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_GTE.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_EQUALITY.GetType() );
assert( typeof(int) == preproc_constants.EXPR_AND.GetType() );
assert( typeof(int) == preproc_constants.EXPR_XOR.GetType() );
assert( typeof(int) == preproc_constants.EXPR_OR.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
}
static void assert(bool assertion) {
if (!assertion)
throw new ApplicationException("test failed");
}
}

View file

@ -0,0 +1,22 @@
using System;
using special_variable_macrosNamespace;
public class runme {
static void Main() {
Name name = new Name();
if (special_variable_macros.testFred(name) != "none")
throw new Exception("test failed");
if (special_variable_macros.testJack(name) != "$specialname")
throw new Exception("test failed");
if (special_variable_macros.testJill(name) != "jilly")
throw new Exception("test failed");
if (special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap")
throw new Exception("test failed");
if (special_variable_macros.testJim(name) != "multiname num")
throw new Exception("test failed");
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
throw new Exception("test failed");
NewName newName = NewName.factory("factoryname");
name = newName.getStoredName();
}
}

View file

@ -1,4 +1,4 @@
%module csharp_attributes
%module(directors="1") csharp_attributes
// Test the inattributes and outattributes typemaps
%typemap(cstype, outattributes="[IntOut]", inattributes="[IntIn]") int "int"
@ -15,6 +15,8 @@ public:
int GlobalFunction(int myInt) { return myInt; }
%}
//%include "enumsimple.swg"
//%include "enumtypesafe.swg"
// Test the attributes feature
%csattributes MoreStations::MoreStations() "[InterCity1]"
@ -25,6 +27,8 @@ int GlobalFunction(int myInt) { return myInt; }
%csattributes Wales "[InterCity6]"
%csattributes Paddington() "[InterCity7]"
%csattributes DidcotParkway "[InterCity8]"
%csattributes MoreStations::Cardiff "[System.ComponentModel.Description(\"Cardiff city station\")]"
%csattributes Swansea "[System.ComponentModel.Description(\"Swansea city station\")]"
%typemap(csattributes) MoreStations "[Eurostar1]"
%typemap(csattributes) MoreStations::Wales "[Eurostar2]"
@ -46,3 +50,13 @@ enum Cymru { Llanelli };
double MoreStations::WestonSuperMare = 0.0;
%}
// Test directorinattributes and directoroutattributes
%typemap(imtype, directoroutattributes="[DirectorIntegerOut]", directorinattributes="[DirectorIntegerIn]") int "int"
%feature("director") YetMoreStations;
%inline %{
struct YetMoreStations {
virtual int Slough(int x) {}
virtual ~YetMoreStations() {}
};
%}

View file

@ -25,7 +25,10 @@
"$csclassname.getCPtr(d$csinput)"
// post only in csin typemap
%typemap(csin, post=" int size = $csinput.Count;\n for (int i=0; i<size; ++i) {\n $csinput[i] /= 100;\n }") std::vector<double> &vpost
%typemap(csin, post=" int size = $csinput.Count;\n"
" for (int i=0; i<size; ++i) {\n"
" $csinput[i] /= 100;\n"
" }") std::vector<double> &vpost
"$csclassname.getCPtr($csinput)"
%inline %{

View file

@ -119,6 +119,7 @@
// tests valuewrapper
%feature("compactdefaultargs") MyClass2::set;
%inline %{
enum MyType { Val1, Val2 };
@ -134,6 +135,7 @@
void set(MyClass1 cl1 = Val1) {}
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
// But it works in C++ since there is a "conversion" constructor in MyClass1.
void set2(MyClass1 cl1 = Val1) {}
};
%}

View file

@ -3,6 +3,11 @@ This was reported in bug #909389 */
%module derived_nested
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::CC;
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::DD;
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::EE;
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::FF;
%inline %{
class A { int x; };
@ -11,5 +16,12 @@ class B {
class D : public A { int z; }; //ok
};
struct BB {
class CC { int y; };
class DD : public A { int z; };
struct EE : public A { int z; };
struct FF : public A { int z; } ff_instance; // Bug 1960977
void useEE(const EE& e) {}
};
%}

View file

@ -15,7 +15,9 @@
%feature("director") Foo;
%newobject Foo::cloner();
%newobject Foo::get_class();
%newobject Bar::cloner();
%newobject Bar::get_class();
%inline {

View file

@ -11,6 +11,13 @@
%newobject *::create();
#ifdef SWIGPHP
// TODO: Currently we do not track the dynamic type of returned objects
// in PHP, so we need the factory helper.
%include factory.i
%factory(Foo *Bar::create, Bar);
#endif
%rename(a) Bar::hello;
%rename(s) Foo::p;
%rename(q) Foo::r;

View file

@ -17,7 +17,11 @@
%feature("director") Foo;
%feature("director:except") {
#ifndef SWIGPHP
if ($error != NULL) {
#else
if ($error == FAILURE) {
#endif
throw Swig::DirectorMethodException();
}
}

View file

@ -1,5 +1,7 @@
%module(directors="1",dirprot="1") director_using
%warnfilter(SWIGWARN_PHP_PUBLIC_BASE) FooBar;
%{
#include <string>
#include <iostream>

View file

@ -487,11 +487,53 @@ struct Instances {
// Repeated values
#if defined(SWIGJAVA)
%javaconst(1);
// needed for typesafe and proper enums only
%javaconst(0) ignoreA_three;
%javaconst(0) ignoreA_thirteen;
#elif defined(SWIGCSHARP)
// needed for typesafe enums only
#ifdef SWIG_TEST_NOCSCONST
%csconst(0) ignoreA_three;
%csconst(0) ignoreA_thirteen;
#endif
%csconst(1);
#endif
#if defined(SWIGPERL)
%ignore ignoreA_one;
%ignore ignoreA_two;
%ignore ignoreA_twelve;
%ignore ignoreA_thirty_one;
%ignore ignoreB_ten;
%ignore ignoreB_twenty;
%ignore ignoreB_thirty;
%ignore ignoreB_forty;
%ignore ignoreC_eleven;
%ignore ignoreC_thirty_one;
%ignore ignoreC_forty_one;
%ignore ignoreD_ten;
%ignore ignoreD_twenty;
%ignore ignoreE_twenty;
%inline %{
struct IgnoreTest {
enum IgnoreA { ignoreA_zero, ignoreA_one, ignoreA_two, ignoreA_three, ignoreA_ten=10, ignoreA_eleven, ignoreA_twelve, ignoreA_thirteen, ignoreA_fourteen, ignoreA_twenty=20, ignoreA_thirty=30, ignoreA_thirty_one, ignoreA_thirty_two, ignoreA_thirty_three };
enum IgnoreB { ignoreB_ten=10, ignoreB_eleven, ignoreB_twelve, ignoreB_twenty=20, ignoreB_thirty=30, ignoreB_thirty_one, ignoreB_thirty_two, ignoreB_forty=40, ignoreB_forty_one, ignoreB_forty_two };
enum IgnoreC { ignoreC_ten=10, ignoreC_eleven, ignoreC_twelve, ignoreC_twenty=20, ignoreC_thirty=30, ignoreC_thirty_one, ignoreC_thirty_two, ignoreC_forty=40, ignoreC_forty_one, ignoreC_forty_two };
enum IgnoreD { ignoreD_ten=10, ignoreD_twenty=20, ignoreD_twenty_one, ignoreD_twenty_two };
enum IgnoreE { ignoreE_zero, ignoreE_twenty=20, ignoreE_twenty_one, ignoreE_twenty_two };
};
IgnoreTest::IgnoreA ignoreATest(IgnoreTest::IgnoreA n) { return n; }
IgnoreTest::IgnoreB ignoreBTest(IgnoreTest::IgnoreB n) { return n; }
IgnoreTest::IgnoreC ignoreCTest(IgnoreTest::IgnoreC n) { return n; }
IgnoreTest::IgnoreD ignoreDTest(IgnoreTest::IgnoreD n) { return n; }
IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
%}
%inline %{
namespace RepeatSpace {
@ -509,24 +551,3 @@ repeat repeatTest(repeat e) { return e; }
%}
#else
%inline %{
namespace RepeatSpace {
typedef enum
{
one = 1,
initial = one,
two,
three,
last = three,
end = last
} repeat;
repeat repeatTest(repeat e) { return e; }
}
%}
#endif

View file

@ -3,5 +3,7 @@
// Test enum wrapping using the typesafe enum pattern in the target language
%include "enumtypesafe.swg"
#define SWIG_TEST_NOCSCONST // For C# typesafe enums
%include "enum_thorough.i"

View file

@ -8,6 +8,7 @@
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance1;
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance2;
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance3;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK);
%inline %{
@ -32,8 +33,14 @@ bar3(foo3 x) {}
enum sad { boo, hoo = 5 };
#ifdef __cplusplus /* For Octave and g++ which compiles C test code as C++ */
extern "C" {
#endif
/* Unnamed enum instance */
enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance;
#ifdef __cplusplus
}
#endif
/* Anonymous enum */
enum { AnonEnum1, AnonEnum2 = 100 };
@ -58,7 +65,7 @@ typedef struct _iFoo
enum {
Phoo = +50,
Char = 'a'
} e;
} e;
} iFoo;
%}
#else
@ -71,5 +78,20 @@ struct iFoo
};
};
%}
#endif
// enum declaration and initialization
%inline %{
enum Exclamation {
goodness,
gracious,
me
} enumInstance = me;
enum ContainYourself {
slap = 10,
my,
thigh
} Slap = slap, My = my, Thigh = thigh, *pThigh = &Thigh, arrayContainYourself[3] = {slap, my, thigh};
%}

View file

@ -0,0 +1,16 @@
%module extern_c
%inline %{
extern "C" {
void RealFunction(int value);
typedef void Function1(int value); // Fails
typedef int Integer1;
}
typedef void Function2(int value); // Works
typedef int Integer2;
%}
%{
void RealFunction(int value) {}
%}

View file

@ -11,8 +11,8 @@ class Klass6 {};
class Klass7 {};
struct KlassMethods {
static void methodA(::Klass1 v, const ::Klass2 cv, const ::Klass3 *cp, ::Klass4 *p, const ::Klass5 &cr, ::Klass6 &r, Klass7*& pr) {}
static void methodB( Klass1 v, const Klass2 cv, const Klass3 *cp, Klass4 *p, const Klass5 &cr, Klass6 &r, Klass7*& pr) {}
static void methodA(::Klass1 v, const ::Klass2 cv, const ::Klass3 *cp, ::Klass4 *p, const ::Klass5 &cr, ::Klass6 &r, ::Klass7*& pr) {}
static void methodB( Klass1 v, const Klass2 cv, const Klass3 *cp, Klass4 *p, const Klass5 &cr, Klass6 &r, Klass7*& pr) {}
};
%}
@ -28,8 +28,8 @@ class XYZ7 {};
}
struct XYZMethods {
static void methodA(::Space::XYZ1 v, const ::Space::XYZ2 cv, const ::Space::XYZ3 *cp, ::Space::XYZ4 *p, const ::Space::XYZ5 &cr, ::Space::XYZ6 &r, Space::XYZ7*& pr) {}
static void methodB( Space::XYZ1 v, const Space::XYZ2 cv, const Space::XYZ3 *cp, Space::XYZ4 *p, const Space::XYZ5 &cr, Space::XYZ6 &r, Space::XYZ7*& pr) {}
static void methodA(::Space::XYZ1 v, const ::Space::XYZ2 cv, const ::Space::XYZ3 *cp, ::Space::XYZ4 *p, const ::Space::XYZ5 &cr, ::Space::XYZ6 &r, ::Space::XYZ7*& pr) {}
static void methodB( Space::XYZ1 v, const Space::XYZ2 cv, const Space::XYZ3 *cp, Space::XYZ4 *p, const Space::XYZ5 &cr, Space::XYZ6 &r, Space::XYZ7*& pr) {}
};
%}

View file

@ -0,0 +1,44 @@
%module global_scope_types
// no constructor/destructor wrappers as they do not use global scope operator which we are trying to test here
%nodefaultctor Dingaling;
%nodefaultdtor Dingaling;
%inline %{
struct Dingaling {};
typedef Dingaling DINGALING;
template <typename T> struct MyTemplate {
T tt(T t) { return t; }
T& ttr(T& t) { return t; }
};
#ifndef SWIG
// This is added so that the code will not compile, if the global scope operator on Dingaling is omitted in the generated code
namespace Spac {
class Dingaling {
Dingaling();
Dingaling(const Dingaling& t);
Dingaling& operator=(const Dingaling t);
};
}
using namespace Spac;
#endif
namespace Spac {
struct Ting {};
typedef Ting TING;
class Test {
public:
void something(::Dingaling t, ::Dingaling* pt, ::Dingaling& rt, const ::Dingaling& crt) {}
void tsomething(MyTemplate< ::Dingaling > t1, MyTemplate< const ::Dingaling* > t2) {}
// void usomething(::MyTemplate< ::DINGALING > t3, ::MyTemplate< ::DINGALING *> t4) {} // needs fixing
void nothing(::Spac::Ting*, ::Spac::TING&) {}
};
}
void funcptrtest( void (*)(::Dingaling) ) {}
%}

View file

@ -9,14 +9,22 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
GUILE = @GUILE@
GUILE_RUNTIME=-runtime
C_TEST_CASES = long_long \
list_vector \
multivalue \
pointer_in_out
C_TEST_CASES = long_long list_vector pointer_in_out multivalue
include $(srcdir)/../common.mk
# Overridden variables here
# none!
# Custom tests - tests with additional commandline options
%.multicpptest: SWIGOPT += $(GUILE_RUNTIME)
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -28,19 +36,6 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
# override the default in common.mk by adding SWIGOPT +=
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
SWIGOPT=" -runtime "; \
export SWIGOPT; \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $$SWIGOPT" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
SWIGOPT=" -noruntime "; \
done
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
@ -49,9 +44,9 @@ swig_and_compile_multi_cpp = \
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -6,34 +6,29 @@ EXTRA_TEST_CASES += guilescm_ext_test.externaltest
include ../guile/Makefile
# Overridden variables here
INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guilescm
VARIANT =
# Refer to the guile directory for the run scripts
SCRIPTPREFIX = ../guile/
GUILE_RUNTIME=
# Custom tests - tests with additional commandline options
# none!
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
fi;
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $$SWIGOPT" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
fi
%.externaltest:
$(local_setup)
@ -46,9 +41,9 @@ local_setup = \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
fi;
fi
local_run_testcase = \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX); \
fi

View file

@ -40,6 +40,9 @@ include $(srcdir)/../common.mk
SWIGOPT += -package $*
INTERFACEDIR = ../../
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -64,24 +67,24 @@ setup = \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
fi;
mkdir $*; \
fi
# Compiles java files then runs the testcase. A testcase is only run if
# a file is found which has _runme.java appended after the testcase name.
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
run_testcase = \
(cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java) && \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
$(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme;) \
fi;
cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java && cd .. && \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme; \
fi
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
fi;
rm -rf $*; \
fi
clean:
@rm -f *.class hs_err*.log

View file

@ -127,15 +127,26 @@ public class char_strings_runme {
// char *& tests
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharPointerRef();
String str = char_strings.GetCharPointerRef();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char pointer ref get failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char pointer ref set failed, iteration " + i);
}
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharPointerRef();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test const char pointer ref get failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test const char pointer ref set failed, iteration " + i);
}
}
}

View file

@ -369,12 +369,51 @@ public class enum_thorough_proper_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_proper.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_proper.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_proper.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_proper.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough_proper.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_proper.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_proper.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
}
}

View file

@ -369,12 +369,51 @@ public class enum_thorough_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
}
}

View file

@ -369,12 +369,51 @@ public class enum_thorough_simple_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.one) != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.two) != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.three) != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.last) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.end) != 3) throw new RuntimeException("repeatTest 6 failed");
}
}

View file

@ -369,12 +369,51 @@ public class enum_thorough_typeunsafe_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_typeunsafe.repeatTest(repeat.one) != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.two) != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.three) != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.last) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.end) != 3) throw new RuntimeException("repeatTest 6 failed");
}
}

View file

@ -34,6 +34,12 @@ public class java_director_runme {
System.gc();
System.runFinalization();
// Give the finalizers a chance to run
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
/* Watch the Quux objects formerly in the QuuxContainer object
get reaped */
System.gc();
@ -73,3 +79,14 @@ class java_director_MyQuux extends Quux {
return "java_director_MyQuux:" + member();
}
}
class java_director_JavaExceptionTest extends JavaExceptionTest {
public java_director_JavaExceptionTest() {
super();
}
public void etest() throws Exception {
super.etest();
}
}

View file

@ -28,7 +28,7 @@ public class java_jnitypes_runme {
double doubleArray[] = new double[] {10.0, 20.0};
Test objectArray[] = new Test[] {new Test(), test};
if (java_jnitypes.jnifunc(true) != true) testFailed("jboolean");
if (java_jnitypes.jnifunc_bool(true) != true) testFailed("jboolean");
if (java_jnitypes.jnifunc('A') != 'A') testFailed("jchar");
if (java_jnitypes.jnifunc((byte)100) != (byte)100) testFailed("jbyte");
if (java_jnitypes.jnifunc((short)100) != (short)100) testFailed("jshort");

View file

@ -40,6 +40,16 @@ public class java_throws_runme {
if (!pass)
throw new RuntimeException("Test 2 failed");
// Check the exception class is used with %catches
pass = false;
try {
java_throws.catches_function(100);
}
catch (IllegalAccessException e) { pass = true; }
if (!pass)
throw new RuntimeException("Test 3 failed");
// Check newfree typemap throws attribute
try {
TestClass tc = java_throws.makeTestClass();

View 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());
}
}

View file

@ -0,0 +1,72 @@
import nested_class.*;
public class nested_class_runme {
static {
try {
System.loadLibrary("nested_class");
} 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[]) {
Outer outer = new Outer();
SWIGTYPE_p_Outer__InnerStruct1 is1 = outer.makeInnerStruct1();
SWIGTYPE_p_Outer__InnerClass1 ic1 = outer.makeInnerClass1();
SWIGTYPE_p_Outer__InnerUnion1 iu1 = outer.makeInnerUnion1();
SWIGTYPE_p_Outer__InnerStruct2 is2 = outer.makeInnerStruct2();
SWIGTYPE_p_Outer__InnerClass2 ic2 = outer.makeInnerClass2();
SWIGTYPE_p_Outer__InnerUnion2 iu2 = outer.makeInnerUnion2();
SWIGTYPE_p_Outer__InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
SWIGTYPE_p_Outer__InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
SWIGTYPE_p_Outer__InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
SWIGTYPE_p_Outer__InnerClass5 ic5 = outer.makeInnerClass5();
SWIGTYPE_p_Outer__InnerStruct5 is5 = outer.makeInnerStruct5();
SWIGTYPE_p_Outer__InnerUnion5 iu5 = outer.makeInnerUnion5();
ic5 = outer.makeInnerClass5Typedef();
is5 = outer.makeInnerStruct5Typedef();
iu5 = outer.makeInnerUnion5Typedef();
{
SWIGTYPE_p_Outer__InnerMultiple im1 = outer.getMultipleInstance1();
SWIGTYPE_p_Outer__InnerMultiple im2 = outer.getMultipleInstance2();
SWIGTYPE_p_Outer__InnerMultiple im3 = outer.getMultipleInstance3();
SWIGTYPE_p_Outer__InnerMultiple im4 = outer.getMultipleInstance4();
}
{
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
}
{
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
}
{
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef2 mat2 = outer.makeInnerMultipleAnonTypedef2();
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef3 mat3 = outer.makeInnerMultipleAnonTypedef3();
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt = outer.makeInnerMultipleNamedTypedef();
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt1 = outer.makeInnerMultipleNamedTypedef1();
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt2 = outer.makeInnerMultipleNamedTypedef2();
SWIGTYPE_p_p_Outer__InnerMultipleNamedTypedef mnt3 = outer.makeInnerMultipleNamedTypedef3();
}
{
SWIGTYPE_p_Outer__InnerSameName isn = outer.makeInnerSameName();
}
}
}

View file

@ -0,0 +1,37 @@
import nested_structs.*;
public class nested_structs_runme {
static {
try {
System.loadLibrary("nested_structs");
} 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[]) {
Outer outer = new Outer();
nested_structs.setValues(outer, 10);
Outer_inner1 inner1 = outer.getInner1();
Outer_inner2 inner2 = outer.getInner2();
Outer_inner3 inner3 = outer.getInner3();
Outer_inner4 inner4 = outer.getInner4();
if (inner1.getVal() != 10) throw new RuntimeException("failed inner1");
if (inner2.getVal() != 20) throw new RuntimeException("failed inner2");
if (inner3.getVal() != 20) throw new RuntimeException("failed inner3");
if (inner4.getVal() != 40) throw new RuntimeException("failed inner4");
Outer_inside1 inside1 = outer.getInside1();
Outer_inside2 inside2 = outer.getInside2();
Outer_inside3 inside3 = outer.getInside3();
Outer_inside4 inside4 = outer.getInside4();
if (inside1.getVal() != 100) throw new RuntimeException("failed inside1");
if (inside2.getVal() != 200) throw new RuntimeException("failed inside2");
if (inside3.getVal() != 200) throw new RuntimeException("failed inside3");
if (inside4.getVal() != 400) throw new RuntimeException("failed inside4");
}
}

View file

@ -0,0 +1,31 @@
import nested_workaround.*;
public class nested_workaround_runme {
static {
try {
System.loadLibrary("nested_workaround");
} 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[]) {
{
Inner inner = new Inner(5);
Outer outer = new Outer();
Inner newInner = outer.doubleInnerValue(inner);
if (newInner.getValue() != 10)
throw new RuntimeException("inner failed");
}
{
Outer outer = new Outer();
Inner inner = outer.createInner(3);
Inner newInner = outer.doubleInnerValue(inner);
if (outer.getInnerValue(newInner) != 6)
throw new RuntimeException("inner failed");
}
}
}

View file

@ -16,8 +16,8 @@ public class overload_template_runme {
public static void main(String argv[]) {
int f = overload_template.foo();
int a = overload_template.max(3,4);
double b = overload_template.max(3.4,5.2);
int a = overload_template.maximum(3,4);
double b = overload_template.maximum(3.4,5.2);
// mix 1
if (overload_template.mix1("hi") != 101)

View file

@ -0,0 +1,32 @@
import special_variable_macros.*;
public class special_variable_macros_runme {
static {
try {
System.loadLibrary("special_variable_macros");
} 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[]) {
Name name = new Name();
if (!special_variable_macros.testFred(name).equals("none"))
throw new RuntimeException("test failed");
if (!special_variable_macros.testJack(name).equals("$specialname"))
throw new RuntimeException("test failed");
if (!special_variable_macros.testJill(name).equals("jilly"))
throw new RuntimeException("test failed");
if (!special_variable_macros.testMary(name).equals("SWIGTYPE_p_NameWrap"))
throw new RuntimeException("test failed");
if (!special_variable_macros.testJim(name).equals("multiname num"))
throw new RuntimeException("test failed");
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
throw new RuntimeException("test failed");
NewName newName = NewName.factory("factoryname");
name = newName.getStoredName();
}
}

View file

@ -32,6 +32,13 @@ public class template_methods_runme {
k.KlassTMethodBool();
b = Klass.KlassStaticTMethodBoolRenamed(true);
Klass.KlassStaticTMethodBool();
//
ComponentProperties cp = new ComponentProperties();
cp.adda("key1", "val1", "key2", 22.2);
cp.adda("key1", "val1", "key2", "val2", "key3", "val3");
cp.adda("key1", 1, "key2", 2, "key3", 3);
}
}

View file

@ -0,0 +1,30 @@
import template_nested.*;
public class template_nested_runme {
static {
try {
System.loadLibrary("template_nested");
} 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[]) {
new T_NormalTemplateNormalClass().tmethod(new NormalClass());
new OuterClass().T_OuterTMethodNormalClass(new NormalClass());
TemplateFuncs tf = new TemplateFuncs();
if (tf.T_TemplateFuncs1Int(-10) != -10)
throw new RuntimeException("it failed");
if (tf.T_TemplateFuncs2Double(-12.3) != -12.3)
throw new RuntimeException("it failed");
T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
if (tn.hohum(-12.3) != -12.3)
throw new RuntimeException("it failed");
}
}

View file

@ -0,0 +1,39 @@
import template_nested_typemaps.*;
public class template_nested_typemaps_runme {
static {
try {
System.loadLibrary("template_nested_typemaps");
} 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[]) {
BreezeString b = new BreezeString();
{
int v = 88;
short vTypemap = -99;
if (b.methodInt1(v) != v) throw new RuntimeException("failed");
if (b.methodInt2(v) != vTypemap) throw new RuntimeException("failed");
if (template_nested_typemaps.globalInt1(v) != v) throw new RuntimeException("failed");
if (template_nested_typemaps.globalInt2(v) != v) throw new RuntimeException("failed");
if (template_nested_typemaps.globalInt3(v) != vTypemap) throw new RuntimeException("failed");
}
{
short v = 88;
short vTypemap = -77;
if (b.methodShort1(v) != v) throw new RuntimeException("failed");
if (b.methodShort2(v) != vTypemap) throw new RuntimeException("failed");
if (template_nested_typemaps.globalShort1(v) != v) throw new RuntimeException("failed");
if (template_nested_typemaps.globalShort2(v) != v) throw new RuntimeException("failed");
if (template_nested_typemaps.globalShort3(v) != vTypemap) throw new RuntimeException("failed");
}
}
}

View file

@ -0,0 +1,59 @@
import template_partial_specialization.*;
public class template_partial_specialization_runme {
static {
try {
System.loadLibrary("template_partial_specialization");
} 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[]) {
// One parameter tests
new A().a();
new B().b();
new C().c();
new D().d();
new E().e();
new F().f();
new G().g();
new H().h();
new I().i();
new J().j();
new K().k();
new L().l();
new BB().b();
new BBB().b();
new BBBB().b();
new BBBBB().b();
new B1().b();
new B2().b();
new B3().b();
new B4().b();
// Two parameter tests
new A_().a();
new B_().b();
new C_().c();
new D_().d();
new E_().e();
new F_().f();
new G_().g();
new C1_().c();
new C2_().c();
new C3_().c();
new C4_().c();
new B1_().b();
new E1_().e();
new E2_().e();
}
}

View file

@ -0,0 +1,59 @@
import template_partial_specialization_typedef.*;
public class template_partial_specialization_typedef_runme {
static {
try {
System.loadLibrary("template_partial_specialization_typedef");
} 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[]) {
// One parameter tests
new A().a();
new B().b();
new C().c();
new D().d();
new E().e();
new F().f();
new G().g();
new H().h();
new I().i();
new J().j();
new K().k();
new L().l();
new BB().b();
new BBB().b();
new BBBB().b();
new BBBBB().b();
new B1().b();
new B2().b();
new B3().b();
new B4().b();
// Two parameter tests
new A_().a();
new B_().b();
new C_().c();
new D_().d();
new E_().e();
new F_().f();
new G_().g();
new C1_().c();
new C2_().c();
new C3_().c();
new C4_().c();
new B1_().b();
new E1_().e();
new E2_().e();
}
}

View file

@ -0,0 +1,25 @@
import wallkw.*;
public class wallkw_runme {
static {
try {
System.loadLibrary("wallkw");
} 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[]) {
if (!wallkw.c_clone().equals("clone"))
throw new RuntimeException("clone_c keyword fail");
if (!wallkw._delegate().equals("delegate"))
throw new RuntimeException("delegate keyword fail");
if (!wallkw._pass().equals("pass"))
throw new RuntimeException("pass keyword fail");
if (!wallkw.C_alias().equals("alias"))
throw new RuntimeException("alias keyword fail");
}
}

View file

@ -122,3 +122,11 @@ struct JObjectTest {
%}
%javaexception("Exception") etest "$action"
%inline %{
struct JavaExceptionTest {
virtual ~JavaExceptionTest() {}
virtual void etest() {}
};
%}

View file

@ -5,7 +5,7 @@
%inline %{
jboolean jnifunc(jboolean in) { return in; }
jboolean jnifunc_bool(jboolean in) { return in; } /* some JVM implementations won't allow overloading of the jboolean type with some of the others on the c++ level */
jchar jnifunc(jchar in) { return in; }
jbyte jnifunc(jbyte in) { return in; }
jshort jnifunc(jshort in) { return in; }

View file

@ -42,12 +42,16 @@ short full_of_exceptions(int num) {
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
void throw_spec_function(int value) throw (int) { throw (int)0; }
bool throw_spec_function(int value) throw (int) { throw (int)0; }
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
%}
%catches(int) catches_function(int value);
%inline %{
bool catches_function(int value) { throw (int)0; }
%}
// Check newfree typemap throws attribute
%newobject makeTestClass;

View file

@ -30,13 +30,13 @@ code is not functioning properly it will fail to compile.
%typemap(in) Animal ()
{
void *space_needed = malloc(HEIGHT_$1_lextype * WIDTH_$1_lextype);
$1 = space_needed;
$1 = ($1_ltype)space_needed;
}
%typemap(in) Animal[2] ()
{
void *space_needed = malloc(2 * HEIGHT_$1_lextype * WIDTH_$1_lextype);
$1 = space_needed;
$1 = ($1_ltype)space_needed;
}
%inline %{

View file

@ -5,4 +5,4 @@
%cdata(int);
%cdata(double);
void *malloc(size_t size);

View file

@ -6,6 +6,9 @@
%newobject Geometry::clone;
%factory(Geometry *Geometry::create, Point, Circle);
%factory(Geometry *Geometry::clone, Point, Circle);
#ifdef SWIGPHP
%rename(clone_) clone;
#endif
%factory(Geometry *Point::clone, Point, Circle);
%factory(Geometry *Circle::clone, Point, Circle);

View file

@ -1,2 +1,7 @@
%module li_math
#ifdef SWIGPHP
// PHP already provides these functions with the same names, so just kill that
// warning.
%warnfilter(SWIGWARN_PARSE_KEYWORD);
#endif
%include math.i

View file

@ -0,0 +1,52 @@
%module li_reference
%include "reference.i"
%inline %{
double FrVal;
double ToVal;
void PDouble(double *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
void RDouble(double &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = FrVal + t; }
void PFloat(float *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (float)(FrVal + t); }
void RFloat(float &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (float)(FrVal + t); }
void PInt(int *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (int)(FrVal + t); }
void RInt(int &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (int)(FrVal + t); }
void PShort(short *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (short)(FrVal + t); }
void RShort(short &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (short)(FrVal + t); }
void PLong(long *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (long)(FrVal + t); }
void RLong(long &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (long)(FrVal + t); }
void PUInt(unsigned int *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (unsigned int)(FrVal + t); }
void RUInt(unsigned int &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (unsigned int)(FrVal + t); }
void PUShort(unsigned short *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (unsigned short)(FrVal + t); }
void RUShort(unsigned short &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (unsigned short)(FrVal + t); }
void PULong(unsigned long *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (unsigned long)(FrVal + t); }
void RULong(unsigned long &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (unsigned long)(FrVal + t); }
void PUChar(unsigned char *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (unsigned char)(FrVal + t); }
void RUChar(unsigned char &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (unsigned char)(FrVal + t); }
void PChar(signed char *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (signed char)(FrVal + t); }
void RChar(signed char &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (signed char)(FrVal + t); }
void PBool(bool *REFERENCE, int t = 0)
{ ToVal = *REFERENCE; *REFERENCE = (FrVal + t) ? true : false; }
void RBool(bool &REFERENCE, int t = 0)
{ ToVal = REFERENCE; REFERENCE = (FrVal + t) ? true : false; }
%}

Some files were not shown because too many files have changed in this diff Show more