From a4fa261b775b72d5b263fa3f5d0d61e1f21a7103 Mon Sep 17 00:00:00 2001 From: Bruno da Silva de Oliveira Date: Sat, 22 Mar 2003 18:16:01 +0000 Subject: [PATCH] - New page about smart pointers, and misc fixes [SVN r18055] --- ...orting_all_declarations_from_a_header.html | 5 ++- pyste/doc/pyste.txt | 41 ++++++++++++++++++- pyste/doc/running_pyste.html | 6 ++- pyste/index.html | 5 +++ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/pyste/doc/exporting_all_declarations_from_a_header.html b/pyste/doc/exporting_all_declarations_from_a_header.html index 4f2418f5..00f11c2d 100644 --- a/pyste/doc/exporting_all_declarations_from_a_header.html +++ b/pyste/doc/exporting_all_declarations_from_a_header.html @@ -4,6 +4,7 @@ Exporting All Declarations from a Header + @@ -20,7 +21,7 @@ - +

@@ -63,7 +64,7 @@ the members of the header object like this:

- +
diff --git a/pyste/doc/pyste.txt b/pyste/doc/pyste.txt index b6fbb281..37d64dbf 100644 --- a/pyste/doc/pyste.txt +++ b/pyste/doc/pyste.txt @@ -81,6 +81,8 @@ where options are: use explicit declarations instead --pyste-ns= set the namespace where new types will be declared; default is "pyste" + -h, --help print this help and exit + -v, --version print version information ''' ] @@ -94,8 +96,8 @@ generated cpp, using the namespace boost::python explicitly in all declarations. Use only if you're having a name conflict in one of the files. Use [^--pyste-ns] to change the namespace where new types are declared (for -instance, the virtual wrappers). Use only if one of your header files declare a -namespace named "pyste" and this is causing conflicts. +instance, the virtual wrappers). Use only if you are having any problems. By +default, Pyste uses the empty namespace. So, the usage is simple enough: @@ -368,3 +370,38 @@ the members of the header object like this: rename(hello.World.greet, "Greet") exclude(hello.World.set, "Set") + +[page:1 Smart Pointers] + +Pyste for now has manual support for smart pointers. Suppose: + + struct C + { + int value; + }; + + boost::shared_ptr newC(int value) + { + boost::shared_ptr c( new C() ); + c->value = value; + return c; + } + + void printC(boost::shared_ptr c) + { + std::cout << c->value << std::endl; + } + +To make [^newC] and [^printC] work correctly, you have to tell Pyste that a +conversor for [^boost::shared_ptr] is needed. + + C = Class('C', 'C.h') + use_shared_ptr(C) + Function('newC', 'C.h') + Function('printC', 'C.h') + +For [^std::auto_ptr]'s, use the function [^use_auto_ptr]. + +This system is temporary, and in the future the conversors will automatically be +exported if needed, without the need to tell Pyste about them explicitly. + diff --git a/pyste/doc/running_pyste.html b/pyste/doc/running_pyste.html index 42834000..ceea231e 100644 --- a/pyste/doc/running_pyste.html +++ b/pyste/doc/running_pyste.html @@ -57,6 +57,8 @@ where options are: use explicit declarations instead --pyste-ns=<name> set the namespace where new types will be declared; default is "pyste" + -h, --help print this help and exit + -v, --version print version information

Options explained:

@@ -69,8 +71,8 @@ generated cpp, using the namespace boost::python explicitly in all declarations. Use only if you're having a name conflict in one of the files.

Use --pyste-ns to change the namespace where new types are declared (for -instance, the virtual wrappers). Use only if one of your header files declare a -namespace named "pyste" and this is causing conflicts.

+instance, the virtual wrappers). Use only if you are having any problems. By +default, Pyste uses the empty namespace.

So, the usage is simple enough:

>python pyste.py --module=mymodule file.pyste file2.pyste ...

diff --git a/pyste/index.html b/pyste/index.html index ff153b50..0abccae0 100644 --- a/pyste/index.html +++ b/pyste/index.html @@ -60,6 +60,11 @@ Exporting All Declarations from a Header + + + Smart Pointers + +