remove weave python example - license is unclear
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11902 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
cfcafc807a
commit
8e1f9274cc
6 changed files with 0 additions and 3708 deletions
|
|
@ -1,22 +0,0 @@
|
||||||
TOP = ../..
|
|
||||||
SWIG = $(TOP)/../preinst-swig
|
|
||||||
CXXSRCS =
|
|
||||||
TARGET = example
|
|
||||||
INTERFACE = example.i
|
|
||||||
LIBS = -lm
|
|
||||||
SWIGOPT =
|
|
||||||
|
|
||||||
all::
|
|
||||||
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
|
||||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
|
|
||||||
|
|
||||||
static::
|
|
||||||
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
|
||||||
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
|
|
||||||
|
|
||||||
clean::
|
|
||||||
$(MAKE) -f $(TOP)/Makefile python_clean
|
|
||||||
rm -f $(TARGET).py
|
|
||||||
|
|
||||||
check: all
|
|
||||||
$(MAKE) -f $(TOP)/Makefile python_run
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
This directory contains a simple example to test weave support for
|
|
||||||
SWIG wrapped objects.
|
|
||||||
|
|
||||||
The weave package provides tools for including C/C++ code in Python
|
|
||||||
code. This offers both another level of optimization to those who need
|
|
||||||
it, and an easy way to modify and extend any supported extension
|
|
||||||
libraries. Weave automatically builds an extension module from the
|
|
||||||
given C/C++ code and runs that. This can result in very significant
|
|
||||||
speedups (of upto 500x) depending on the problem. Weave also supports
|
|
||||||
inlining SWIG-1.3.x wrapped objects.
|
|
||||||
|
|
||||||
The example in this directory requires that weave be installed. Weave
|
|
||||||
is distributed as part of SciPy (http://www.scipy.org). More
|
|
||||||
information on Weave may be had from here:
|
|
||||||
|
|
||||||
http://www.scipy.org/documentation/weave
|
|
||||||
|
|
||||||
As of November 22, 2004, this example only works with weave from CVS.
|
|
||||||
If there is a more recent release of SciPy after this date, it should
|
|
||||||
work fine.
|
|
||||||
|
|
||||||
|
|
||||||
Also, you need to replace the weave file swigptr2.py by the one
|
|
||||||
provided here.
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef _EXAMPLE_H
|
|
||||||
#define _EXAMPLE_H
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
public:
|
|
||||||
int x;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Bar {
|
|
||||||
public:
|
|
||||||
int y;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FooBar : public Foo, public Bar {
|
|
||||||
public:
|
|
||||||
int z;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
%module(directors="1") example
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include "example.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "std_vector.i"
|
|
||||||
|
|
||||||
%director Foo;
|
|
||||||
%director Bar;
|
|
||||||
%include "example.h"
|
|
||||||
|
|
||||||
|
|
||||||
%template(VectorBar) std::vector<Bar*>;
|
|
||||||
%template(VectorFoo) std::vector<Foo*>;
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
"""
|
|
||||||
Test weave support for SWIG wrapped objects.
|
|
||||||
|
|
||||||
This example requires that one has weave installed. Weave is
|
|
||||||
distributed as part of SciPy (http://www.scipy.org). More information
|
|
||||||
on Weave may be had from here:
|
|
||||||
|
|
||||||
http://www.scipy.org/documentation/weave
|
|
||||||
|
|
||||||
As of November 22, 2004, this only works with weave from CVS. If
|
|
||||||
there is a more recent release of SciPy after this date, it should
|
|
||||||
work fine.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import example
|
|
||||||
import weave
|
|
||||||
from weave import converters
|
|
||||||
from weave import swig2_spec
|
|
||||||
|
|
||||||
# Weave does not support swig2 by default (yet). So add this to the
|
|
||||||
# list of default converters to test.
|
|
||||||
converters.default.insert(0, swig2_spec.swig2_converter())
|
|
||||||
|
|
||||||
def test():
|
|
||||||
""" A simple test case for weave."""
|
|
||||||
a = example.Foo()
|
|
||||||
a.x = 1
|
|
||||||
b = example.Bar()
|
|
||||||
b.y = 2
|
|
||||||
c = example.FooBar()
|
|
||||||
c.x = 1
|
|
||||||
c.y = 2
|
|
||||||
c.z = 3
|
|
||||||
v = example.VectorBar()
|
|
||||||
v.append(b)
|
|
||||||
v.append(c)
|
|
||||||
d = v[0]
|
|
||||||
e = v[1]
|
|
||||||
v = example.VectorFoo()
|
|
||||||
v.append(a)
|
|
||||||
v.append(c)
|
|
||||||
f = v[0]
|
|
||||||
g = v[1]
|
|
||||||
|
|
||||||
code = """
|
|
||||||
std::cout << a->x << std::endl;
|
|
||||||
assert(a->x == 1);
|
|
||||||
std::cout << b->y << std::endl;
|
|
||||||
assert(b->y == 2);
|
|
||||||
std::cout << c->x << std::endl;
|
|
||||||
std::cout << c->y << std::endl;
|
|
||||||
std::cout << c->z << std::endl;
|
|
||||||
assert(c->x == 1);
|
|
||||||
assert(c->y == 2);
|
|
||||||
assert(c->z == 3);
|
|
||||||
std::cout << d->y << std::endl;
|
|
||||||
assert(d->y == 2);
|
|
||||||
std::cout << e->y << std::endl;
|
|
||||||
assert(e->y == 2);
|
|
||||||
std::cout << f->x << std::endl;
|
|
||||||
assert(f->x == 1);
|
|
||||||
std::cout << g->x << std::endl;
|
|
||||||
assert(g->x == 1);
|
|
||||||
"""
|
|
||||||
weave.inline(code, ['a', 'b', 'c', 'd', 'e', 'f', 'g'],
|
|
||||||
include_dirs=['.'],
|
|
||||||
headers=['"example.h"'],
|
|
||||||
verbose=2)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test()
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue