From bb55c4a8550a07cdc41ddde64e613639bc570a70 Mon Sep 17 00:00:00 2001 From: Bruno da Silva de Oliveira Date: Sat, 31 May 2003 20:57:03 +0000 Subject: [PATCH] no message [SVN r18628] --- pyste/example/.cvsignore | 2 - pyste/example/README | 5 --- pyste/example/basic.cpp | 8 ---- pyste/example/basic.h | 59 ---------------------------- pyste/example/basic.pyste | 5 --- pyste/example/enums.h | 24 ----------- pyste/example/enums.pyste | 8 ---- pyste/example/header_test.h | 38 ------------------ pyste/example/header_test.pyste | 4 -- pyste/example/inherit.h | 18 --------- pyste/example/inherit.pyste | 8 ---- pyste/example/nested.cpp | 4 -- pyste/example/nested.h | 26 ------------ pyste/example/nested.pyste | 1 - pyste/example/opaque.h | 47 ---------------------- pyste/example/opaque.pyste | 5 --- pyste/example/operators.cpp | 3 -- pyste/example/operators.h | 49 ----------------------- pyste/example/operators.pyste | 2 - pyste/example/smart_ptr.h | 44 --------------------- pyste/example/smart_ptr.pyste | 13 ------ pyste/example/templates.h | 10 ----- pyste/example/templates.pyste | 8 ---- pyste/example/unions.h | 16 -------- pyste/example/unions.pyste | 2 - pyste/example/vars.h | 19 --------- pyste/example/vars.pyste | 1 - pyste/example/virtual.h | 28 ------------- pyste/example/virtual.pyste | 2 - pyste/example/virtual2.h | 27 ------------- pyste/example/virtual2.pyste | 4 -- pyste/example/wrappertest.h | 46 ---------------------- pyste/example/wrappertest.pyste | 21 ---------- pyste/example/wrappertest_wrappers.h | 28 ------------- 34 files changed, 585 deletions(-) delete mode 100644 pyste/example/.cvsignore delete mode 100644 pyste/example/README delete mode 100644 pyste/example/basic.cpp delete mode 100644 pyste/example/basic.h delete mode 100644 pyste/example/basic.pyste delete mode 100644 pyste/example/enums.h delete mode 100644 pyste/example/enums.pyste delete mode 100644 pyste/example/header_test.h delete mode 100644 pyste/example/header_test.pyste delete mode 100644 pyste/example/inherit.h delete mode 100644 pyste/example/inherit.pyste delete mode 100644 pyste/example/nested.cpp delete mode 100644 pyste/example/nested.h delete mode 100644 pyste/example/nested.pyste delete mode 100644 pyste/example/opaque.h delete mode 100644 pyste/example/opaque.pyste delete mode 100644 pyste/example/operators.cpp delete mode 100644 pyste/example/operators.h delete mode 100644 pyste/example/operators.pyste delete mode 100644 pyste/example/smart_ptr.h delete mode 100644 pyste/example/smart_ptr.pyste delete mode 100644 pyste/example/templates.h delete mode 100644 pyste/example/templates.pyste delete mode 100644 pyste/example/unions.h delete mode 100644 pyste/example/unions.pyste delete mode 100644 pyste/example/vars.h delete mode 100644 pyste/example/vars.pyste delete mode 100644 pyste/example/virtual.h delete mode 100644 pyste/example/virtual.pyste delete mode 100644 pyste/example/virtual2.h delete mode 100644 pyste/example/virtual2.pyste delete mode 100644 pyste/example/wrappertest.h delete mode 100644 pyste/example/wrappertest.pyste delete mode 100644 pyste/example/wrappertest_wrappers.h diff --git a/pyste/example/.cvsignore b/pyste/example/.cvsignore deleted file mode 100644 index 7ee0168b..00000000 --- a/pyste/example/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.sconsign -*.obj diff --git a/pyste/example/README b/pyste/example/README deleted file mode 100644 index 868345b0..00000000 --- a/pyste/example/README +++ /dev/null @@ -1,5 +0,0 @@ -To use this examples, just execute the command-line: - -pyste --module= .pyste - -For more information, please refer to the documentation. diff --git a/pyste/example/basic.cpp b/pyste/example/basic.cpp deleted file mode 100644 index 9e6ed996..00000000 --- a/pyste/example/basic.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "basic.h" - -namespace basic { - - int C::static_value = 3; - const int C::const_static_value = 100; - -} diff --git a/pyste/example/basic.h b/pyste/example/basic.h deleted file mode 100644 index 5ab6ca58..00000000 --- a/pyste/example/basic.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef BASIC_H -#define BASIC_H - - -#include - -namespace basic { - -struct C -{ - // test virtuallity - C(): value(1), const_value(0) {} - virtual int f(int x = 10) - { - return x*2; - } - - int foo(int x=1){ - return x+1; - } - - const std::string& name() { return _name; } - void set_name(const std::string& name) { _name = name; } - std::string _name; - - // test data members - static int static_value; - static const int const_static_value; - - int value; - const int const_value; - - // test static functions - static int mul(int x=2, int y=3) { return x*y; } -}; - -inline int call_f(C& c) -{ - return c.f(); -} - -inline int call_f(C& c, int x) -{ - return c.f(x); -} - -inline int get_static() -{ - return C::static_value; -} - -inline int get_value(C& c) -{ - return c.value; -} - -} - -#endif diff --git a/pyste/example/basic.pyste b/pyste/example/basic.pyste deleted file mode 100644 index 4fe0b5b3..00000000 --- a/pyste/example/basic.pyste +++ /dev/null @@ -1,5 +0,0 @@ -Class('basic::C', 'basic.h') -Function('basic::call_f', 'basic.h') -Function('basic::get_static', 'basic.h') -Function('basic::get_value', 'basic.h') - diff --git a/pyste/example/enums.h b/pyste/example/enums.h deleted file mode 100644 index 207001e0..00000000 --- a/pyste/example/enums.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ENUMS_H -#define ENUMS_H - -namespace enums { - -enum color { red, blue }; - -struct X -{ - enum choices - { - good = 1, - bad = 2 - }; - - int set(choices c) - { - return (int)c; - } -}; - -} - -#endif diff --git a/pyste/example/enums.pyste b/pyste/example/enums.pyste deleted file mode 100644 index a6cc740a..00000000 --- a/pyste/example/enums.pyste +++ /dev/null @@ -1,8 +0,0 @@ -color = Enum('enums::color', 'enums.h') -rename(color.red, 'Red') -rename(color.blue, 'Blue') -X = Class('enums::X', 'enums.h') -rename(X.choices.bad, 'Bad') -rename(X.choices.good, 'Good') -rename(X.choices, 'Choices') - diff --git a/pyste/example/header_test.h b/pyste/example/header_test.h deleted file mode 100644 index ada44ac0..00000000 --- a/pyste/example/header_test.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef HEADER_TEST_H -#define HEADER_TEST_H - -#include -#include - -namespace header_test { - -enum choice { red, blue }; - -inline std::string choice_str(choice c) -{ - std::map choice_map; - choice_map[red] = "red"; - choice_map[blue] = "blue"; - return choice_map[c]; -} - -struct C -{ - choice c; - - std::string get() - { - return choice_str(c); - } -}; - -// test the exclusion of the following - -struct ForwardDeclared; // should be excluded automatically -struct A {}; -void foo(); -enum bar { value }; - -} - -#endif diff --git a/pyste/example/header_test.pyste b/pyste/example/header_test.pyste deleted file mode 100644 index 3bd55501..00000000 --- a/pyste/example/header_test.pyste +++ /dev/null @@ -1,4 +0,0 @@ -h = AllFromHeader('header_test.h') -exclude(h.A) -exclude(h.foo) -exclude(h.bar) diff --git a/pyste/example/inherit.h b/pyste/example/inherit.h deleted file mode 100644 index 04caddae..00000000 --- a/pyste/example/inherit.h +++ /dev/null @@ -1,18 +0,0 @@ -template -class A -{ -public: - void set(T v) { mData = v; } - - T get() const { return mData; } - -private: - T mData; -}; - - -class B : public A -{ -public: - int go() { return get(); } -}; diff --git a/pyste/example/inherit.pyste b/pyste/example/inherit.pyste deleted file mode 100644 index 2531ba83..00000000 --- a/pyste/example/inherit.pyste +++ /dev/null @@ -1,8 +0,0 @@ -# Doesn't work: -A = Template('A', 'inherit.h') -A_int = A('int') - -Class('B', 'inherit.h') - -# Does work: -#AllFromHeader('inherit.h') diff --git a/pyste/example/nested.cpp b/pyste/example/nested.cpp deleted file mode 100644 index 9a37a226..00000000 --- a/pyste/example/nested.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "nested.h" - -int nested::X::staticXValue = 10; -int nested::X::Y::staticYValue = 20; diff --git a/pyste/example/nested.h b/pyste/example/nested.h deleted file mode 100644 index e62adab5..00000000 --- a/pyste/example/nested.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef NESTED_H -#define NESTED_H - -namespace nested { - -struct X -{ - struct Y - { - int valueY; - static int staticYValue; - struct Z - { - int valueZ; - }; - }; - - static int staticXValue; - int valueX; -}; - -typedef X Root; - -} - -#endif diff --git a/pyste/example/nested.pyste b/pyste/example/nested.pyste deleted file mode 100644 index 48bb26b5..00000000 --- a/pyste/example/nested.pyste +++ /dev/null @@ -1 +0,0 @@ -Class('nested::Root', 'nested.h') diff --git a/pyste/example/opaque.h b/pyste/example/opaque.h deleted file mode 100644 index 50ebf508..00000000 --- a/pyste/example/opaque.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef OPAQUE_H -#define OPAQUE_H - -#include - -namespace opaque { - - -struct C { - C(int v): value(v) {} - int value; -}; - - -inline C* new_C() -{ - return new C(10); -} - -inline int get(C* c) -{ - return c->value; -} - -struct D { - D(double v): value(v) {} - double value; -}; - -struct A -{ - D* new_handle() - { - return new D(3.0); - } - - double get(D* d) - { - return d->value; - } - - int f(int x=0) { return x; } -}; - -} - -#endif diff --git a/pyste/example/opaque.pyste b/pyste/example/opaque.pyste deleted file mode 100644 index 2e6a3bc5..00000000 --- a/pyste/example/opaque.pyste +++ /dev/null @@ -1,5 +0,0 @@ -foo = Function('opaque::new_C', 'opaque.h') -set_policy(foo, return_value_policy(return_opaque_pointer)) -Function('opaque::get', 'opaque.h' ) -A = Class('opaque::A', 'opaque.h') -set_policy(A.new_handle, return_value_policy(return_opaque_pointer)) diff --git a/pyste/example/operators.cpp b/pyste/example/operators.cpp deleted file mode 100644 index cc8e881d..00000000 --- a/pyste/example/operators.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "operators.h" - -double operators::C::x = 10; diff --git a/pyste/example/operators.h b/pyste/example/operators.h deleted file mode 100644 index a9d3759e..00000000 --- a/pyste/example/operators.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef OPERATORS_H -#define OPERATORS_H - - -#include - -namespace operators { - -struct C -{ - static double x; - double value; - - const C operator+(const C other) const - { - C c; - c.value = value + other.value; - return c; - } - operator int() const - { - return (int)value; - } - - double operator()() - { - return C::x; - } - - double operator()(double other) - { - return C::x + other; - } - - operator const char*() { return "C"; } -}; - -inline const C operator*(const C& lhs, const C& rhs) -{ - C c; - c.value = lhs.value * rhs.value; - return c; -} - - -} - - -#endif diff --git a/pyste/example/operators.pyste b/pyste/example/operators.pyste deleted file mode 100644 index 4ab7a370..00000000 --- a/pyste/example/operators.pyste +++ /dev/null @@ -1,2 +0,0 @@ -C = Class('operators::C', 'operators.h') -#exclude(C.operator['+']) diff --git a/pyste/example/smart_ptr.h b/pyste/example/smart_ptr.h deleted file mode 100644 index 05b9149c..00000000 --- a/pyste/example/smart_ptr.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SMART_PTR_H -#define SMART_PTR_H - - -#include -#include - -namespace smart_ptr { - -struct C -{ - int value; -}; - -inline boost::shared_ptr NewC() { return boost::shared_ptr( new C() ); } - -struct D -{ - boost::shared_ptr Get() { return ptr; } - void Set( boost::shared_ptr c ) { ptr = c; } -private: - boost::shared_ptr ptr; -}; - -inline std::auto_ptr NewD() { return std::auto_ptr( new D() ); } - - -// test an abstract class -struct A -{ - virtual int f() = 0; -}; - -struct B: A -{ - virtual int f(){ return 1; } -}; - -inline boost::shared_ptr NewA() { return boost::shared_ptr(new B()); } -inline int GetA(boost::shared_ptr a) { return a->f(); } - -} - -#endif diff --git a/pyste/example/smart_ptr.pyste b/pyste/example/smart_ptr.pyste deleted file mode 100644 index cfbdd81a..00000000 --- a/pyste/example/smart_ptr.pyste +++ /dev/null @@ -1,13 +0,0 @@ -C = Class('smart_ptr::C', 'smart_ptr.h') -use_shared_ptr(C) - -D = Class('smart_ptr::D', 'smart_ptr.h') -use_auto_ptr(D) - -A = Class('smart_ptr::A', 'smart_ptr.h') -use_shared_ptr(A) - -Function('smart_ptr::NewC', 'smart_ptr.h') -Function('smart_ptr::NewD', 'smart_ptr.h') -Function('smart_ptr::NewA', 'smart_ptr.h') -Function('smart_ptr::GetA', 'smart_ptr.h') diff --git a/pyste/example/templates.h b/pyste/example/templates.h deleted file mode 100644 index c34f4a81..00000000 --- a/pyste/example/templates.h +++ /dev/null @@ -1,10 +0,0 @@ -namespace templates { - -template -struct Point -{ - T x; - T y; -}; - -} diff --git a/pyste/example/templates.pyste b/pyste/example/templates.pyste deleted file mode 100644 index 77eaceaa..00000000 --- a/pyste/example/templates.pyste +++ /dev/null @@ -1,8 +0,0 @@ -Point = Template('templates::Point', 'templates.h') -rename(Point.x, 'i') -rename(Point.y, 'j') -IPoint = Point('int') -FPoint = Point('double', 'FPoint') -rename(IPoint, 'IPoint') -rename(IPoint.x, 'x') -rename(IPoint.y, 'y') diff --git a/pyste/example/unions.h b/pyste/example/unions.h deleted file mode 100644 index 06287dec..00000000 --- a/pyste/example/unions.h +++ /dev/null @@ -1,16 +0,0 @@ -namespace unions { - -class UnionTest -{ -public: - union // unions are not supported for now - { - int i; - short s1; - short s2; - } mBad; - - int mGood; -}; - -} diff --git a/pyste/example/unions.pyste b/pyste/example/unions.pyste deleted file mode 100644 index 726ab6a2..00000000 --- a/pyste/example/unions.pyste +++ /dev/null @@ -1,2 +0,0 @@ -UnionTest = Class('unions::UnionTest', 'unions.h') -exclude(UnionTest.mBad) diff --git a/pyste/example/vars.h b/pyste/example/vars.h deleted file mode 100644 index 23de92b5..00000000 --- a/pyste/example/vars.h +++ /dev/null @@ -1,19 +0,0 @@ - -struct Color -{ - Color(int r_ = 0, int g_ = 0, int b_ = 0): - r(r_), g(g_), b(b_) - {} - Color( const Color &c): - r(c.r), g(c.g), b(c.b) - {} - int r; - int g; - int b; -}; - -const Color black = Color(0, 0, 0); -const Color red = Color(255, 0, 0); -const Color green = Color(0, 255, 0); -const Color blue = Color(0, 0, 255); -Color in_use = black; diff --git a/pyste/example/vars.pyste b/pyste/example/vars.pyste deleted file mode 100644 index 3fd9d689..00000000 --- a/pyste/example/vars.pyste +++ /dev/null @@ -1 +0,0 @@ -AllFromHeader('vars.h') diff --git a/pyste/example/virtual.h b/pyste/example/virtual.h deleted file mode 100644 index cd194315..00000000 --- a/pyste/example/virtual.h +++ /dev/null @@ -1,28 +0,0 @@ -namespace virtual_ { - -struct C -{ -public: - virtual int f() - { - return f_abs(); - } - - virtual void bar(int) {} - virtual void bar(char*) {} - - const char* get_name() - { - return name(); - } - -protected: - virtual int f_abs() = 0; - -private: - virtual const char* name() { return "C"; } -}; - -inline int call_f(C& c) { return c.f(); } - -} diff --git a/pyste/example/virtual.pyste b/pyste/example/virtual.pyste deleted file mode 100644 index 3fa072f8..00000000 --- a/pyste/example/virtual.pyste +++ /dev/null @@ -1,2 +0,0 @@ -Class('virtual_::C', 'virtual.h') -Function('virtual_::call_f', 'virtual.h') diff --git a/pyste/example/virtual2.h b/pyste/example/virtual2.h deleted file mode 100644 index 0f5aab32..00000000 --- a/pyste/example/virtual2.h +++ /dev/null @@ -1,27 +0,0 @@ - -namespace virtual2 { - -struct A -{ - virtual int f() { return 0; } - virtual int f1() { return 10; } -}; - -struct B: A -{ - virtual int f() { return 1; } - virtual int f2() { return 20; } -}; - -inline int call_fs(A*a) -{ - int r = a->f1(); - B* b = dynamic_cast(a); - return r + b->f2(); -} - -inline int call_f(A* a) -{ - return a->f(); -} -} diff --git a/pyste/example/virtual2.pyste b/pyste/example/virtual2.pyste deleted file mode 100644 index 2ca567e6..00000000 --- a/pyste/example/virtual2.pyste +++ /dev/null @@ -1,4 +0,0 @@ -Class('virtual2::A', 'virtual2.h') -Class('virtual2::B', 'virtual2.h') -Function('virtual2::call_fs', 'virtual2.h') -Function('virtual2::call_f', 'virtual2.h') diff --git a/pyste/example/wrappertest.h b/pyste/example/wrappertest.h deleted file mode 100644 index 4cce28ee..00000000 --- a/pyste/example/wrappertest.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef WRAPPER_TEST -#define WRAPPER_TEST - - -#include - -namespace wrappertest { - -inline std::vector Range(int count) -{ - std::vector v; - v.reserve(count); - for (int i = 0; i < count; ++i){ - v.push_back(i); - } - return v; -} - - -struct C -{ - C() {} - - std::vector Mul(int value) - { - std::vector res; - res.reserve(value); - std::vector::const_iterator it; - std::vector v(Range(value)); - for (it = v.begin(); it != v.end(); ++it){ - res.push_back(*it * value); - } - return res; - } -}; - - -struct A -{ - virtual int f() { return 1; }; -}; - -inline int call_foo(A* a){ return a->f(); } -} -#endif - diff --git a/pyste/example/wrappertest.pyste b/pyste/example/wrappertest.pyste deleted file mode 100644 index 12ba47b6..00000000 --- a/pyste/example/wrappertest.pyste +++ /dev/null @@ -1,21 +0,0 @@ -Include('wrappertest_wrappers.h') - -f = Function('wrappertest::Range', 'wrappertest.h') -set_wrapper(f, 'RangeWrapper') - -mul = Wrapper('MulWrapper', -''' -list MulWrapper(wrappertest::C& c, int value){ - return VectorToList(c.Mul(value)); -} -''' -) - -C = Class('wrappertest::C', 'wrappertest.h') -set_wrapper(C.Mul, mul) - - -A = Class('wrappertest::A', 'wrappertest.h') -set_wrapper(A.f, 'f_wrapper') - -Function('wrappertest::call_foo', 'wrappertest.h') diff --git a/pyste/example/wrappertest_wrappers.h b/pyste/example/wrappertest_wrappers.h deleted file mode 100644 index a0b5d946..00000000 --- a/pyste/example/wrappertest_wrappers.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef WRAPPER_TEST_WRAPPERS -#define WRAPPER_TEST_WRAPPERS - -#include -#include -#include "wrappertest.h" - -using namespace boost::python; - -template -list VectorToList(const std::vector & v) -{ - list res; - typename std::vector::const_iterator it; - for(it = v.begin(); it != v.end(); ++it){ - res.append(*it); - } - Py_XINCREF(res.ptr()); - return res; -} - -inline list RangeWrapper(int count){ - return VectorToList(wrappertest::Range(count)); -} - -inline int f_wrapper(wrappertest::A*) { return 10; } - -#endif