From 8aeaed2e5fc606fc2c2c1d64ef2e0341637d8c0c Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Sat, 30 Oct 2004 14:30:51 +0000 Subject: [PATCH] fix libraries.html and other broken links [SVN r25983] --- doc/tutorial/doc/Jamfile.v2 | 1 + doc/tutorial/doc/catalog.xml | 9 --- doc/tutorial/doc/html/index.html | 30 ++++---- doc/tutorial/doc/html/python/embedding.html | 38 +++++----- doc/tutorial/doc/html/python/exception.html | 15 ++-- doc/tutorial/doc/html/python/exposing.html | 75 +++++++------------- doc/tutorial/doc/html/python/functions.html | 53 +++++--------- doc/tutorial/doc/html/python/hello.html | 21 +++--- doc/tutorial/doc/html/python/iterators.html | 15 ++-- doc/tutorial/doc/html/python/object.html | 45 ++++-------- doc/tutorial/doc/html/python/techniques.html | 36 ++++------ doc/tutorial/doc/tutorial.qbk | 8 +-- doc/tutorial/doc/tutorial.xml | 40 +++++------ 13 files changed, 145 insertions(+), 241 deletions(-) delete mode 100644 doc/tutorial/doc/catalog.xml diff --git a/doc/tutorial/doc/Jamfile.v2 b/doc/tutorial/doc/Jamfile.v2 index 7331b20b..a13adfca 100644 --- a/doc/tutorial/doc/Jamfile.v2 +++ b/doc/tutorial/doc/Jamfile.v2 @@ -3,5 +3,6 @@ import boostbook : boostbook ; boostbook tutorial : tutorial.xml : boost.root=../../../../../.. + boost.libraries=../../../../../libraries.htm ; diff --git a/doc/tutorial/doc/catalog.xml b/doc/tutorial/doc/catalog.xml deleted file mode 100644 index a2e40890..00000000 --- a/doc/tutorial/doc/catalog.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/doc/tutorial/doc/html/index.html b/doc/tutorial/doc/html/index.html index d3a440f4..d8be7da8 100644 --- a/doc/tutorial/doc/html/index.html +++ b/doc/tutorial/doc/html/index.html @@ -3,15 +3,15 @@ Chapter 1. python 1.0 - - + + - + @@ -19,8 +19,7 @@
Next
-
-
+

Chapter 1. python 1.0

@@ -30,17 +29,17 @@ David Abrahams

-

+

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt ) -

-
-
-
+

+
+

Table of Contents

@@ -84,11 +83,8 @@
-
-

-QuickStart

-
-
+

+QuickStart

The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes @@ -101,7 +97,7 @@ metaprogramming techniques simplifies its syntax for users, so that wrapping code takes on the look of a kind of declarative interface definition language (IDL).

-Hello World

+Hello World

Following C/C++ tradition, let's start with the "hello, world". A C++ Function:

@@ -128,7 +124,7 @@ hello, world
boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
- +

Last revised: October 12, 2004 at 03:11:11 GMT

Last revised: October 30, 2004 at 10:39:27 GMT


diff --git a/doc/tutorial/doc/html/python/embedding.html b/doc/tutorial/doc/html/python/embedding.html index a7dbabf6..c711ce64 100644 --- a/doc/tutorial/doc/html/python/embedding.html +++ b/doc/tutorial/doc/html/python/embedding.html @@ -3,17 +3,17 @@ Embedding - - + + - + - + @@ -23,11 +23,8 @@ PrevUpHomeNext
-
-

-Embedding

-
-
+

+Embedding

By now you should know how to use Boost.Python to call your C++ code from @@ -42,7 +39,7 @@ the gaps. However, Boost.Python already makes embedding a lot easier and, in a future version, it may become unnecessary to touch the Python/C API at all. So stay tuned...

-Building embedded programs

+Building embedded programs

To be able to use embedding in your programs, they have to be linked to both Boost.Python's and Python's static link library.

@@ -78,7 +75,7 @@ In a Jamfile, all the above boils down to:

<find-library>$(PYTHON_EMBEDDED_LIBRARY) ;

-Getting started

+Getting started

Being able to build is nice, but there is nothing to build yet. Embedding the Python interpreter into one of your C++ programs requires these 4 @@ -104,11 +101,8 @@ Call

-
-

-Using the interpreter

-
-
+

+Using the interpreter

As you probably already know, objects in Python are reference-counted. Naturally, the PyObjects of the Python/C API are also reference-counted. @@ -119,7 +113,7 @@ messy and especially hard to get right in the presence of C++ exceptions. Fortunately Boost.Python provides the handle and object class templates to automate the process.

-Reference-counting handles and objects

+Reference-counting handles and objects

There are two ways in which a function in the Python/C API can return a PyObject*: as a borrowed reference or as a new reference. Which of @@ -152,7 +146,7 @@ discuss in the next section.

boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More

-Running Python code

+Running Python code

To run Python code from C++ there is a family of functions in the API starting with the PyRun prefix. You can find the full list of these @@ -167,7 +161,7 @@ The start parameter is the start symbol from the Python for interpreting the code. The possible values are:

-Start symbols +Start symbols

@@ -230,12 +224,12 @@ containing a phrase that is well-known in programming circles.

do this, the the returned object would be kept alive unnecessarily. Unless you want to be a Dr. Frankenstein, always wrap PyObject*s in handles.

-Beyond handles

+Beyond handles

It's nice that handle manages the reference counting details for us, but other than that it doesn't do much. Often we'd like to have a more useful class to manipulate Python objects. But we have already seen such a class -above, and in the previous section: the aptly +above, and in the previous section: the aptly named object class and it's derivatives. We've already seen that they can be constructed from a handle. The following examples should further illustrate this fact:

@@ -272,7 +266,7 @@ int five_squared =< take into account the different functions that object and handle perform.

-Exception handling

+Exception handling

If an exception occurs in the execution of some Python code, the PyRun_String function returns a null pointer. Constructing a handle out of this null diff --git a/doc/tutorial/doc/html/python/exception.html b/doc/tutorial/doc/html/python/exception.html index 5419290e..b401fe53 100644 --- a/doc/tutorial/doc/html/python/exception.html +++ b/doc/tutorial/doc/html/python/exception.html @@ -3,17 +3,17 @@ Exception Translation - - + + - +

- + @@ -23,11 +23,8 @@ PrevUpHomeNext
-
-

- Exception Translation

-
-
+

+ Exception Translation

All C++ exceptions must be caught at the boundary with Python code. This boundary is the point where C++ meets Python. Boost.Python provides a diff --git a/doc/tutorial/doc/html/python/exposing.html b/doc/tutorial/doc/html/python/exposing.html index 7afeeadf..4c841e3e 100644 --- a/doc/tutorial/doc/html/python/exposing.html +++ b/doc/tutorial/doc/html/python/exposing.html @@ -3,17 +3,17 @@ Exposing Classes - - + + - +

boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
- + @@ -23,11 +23,8 @@ PrevUpHomeNext
-
-

- Exposing Classes

-
-
+

+ Exposing Classes

Constructors
Class Data Members
@@ -71,11 +68,8 @@ may use our class World in Python. Here's a sample Pyth >>> planet.greet() 'howdy'
-
-

-Constructors

-
-
+

+Constructors

Our previous example didn't have any explicit constructors. Since World is declared as a plain struct, it has an implicit default @@ -128,11 +122,8 @@ This actually adds an _init_< Python RuntimeError exception.

-
-

-Class Data Members

-
-
+

+Class Data Members

Data members may also be exposed to Python so that they can be accessed as attributes of the corresponding Python class. Each data @@ -166,11 +157,8 @@ as read-write.

-
-

-Class Properties

-
-
+

+Class Properties

In C++, classes with public data members are usually frowned upon. Well designed classes that take advantage of encapsulation hide @@ -205,11 +193,8 @@ since the rovalue setter member function is not passed

.add_property("rovalue", &Num::get)
-
-

-Inheritance

-
-
+

+Inheritance

In the previous examples, we dealt with classes that are not polymorphic. This is not often the case. Much of the time, we will be wrapping @@ -264,11 +249,8 @@ Boost.Python <manage_new_object>());

-
-

-Class Virtual Functions

-
-
+

+Class Virtual Functions

In this section, we shall learn how to make functions behave polymorphically through virtual functions. Continuing our example, let us @@ -367,11 +349,8 @@ to define the Python wrapper with no_init as we have do so will disallow abstract base classes such as Base to be instantiated.

-
-

-Deriving a Python Class

-
-
+

+Deriving a Python Class

Continuing, we can derive from our base class Base in Python and override the virtual function in Python. Before we can do that, we have to set up @@ -426,11 +405,8 @@ The overridden virtual function f of -

-

-Virtual Functions with Default Implementations

-
-
+

+Virtual Functions with Default Implementations

Recall that in the previous section, we wrapped a class with a pure virtual function that we then implemented in @@ -495,13 +471,10 @@ Calling call_f, passing in a derive 42

-
-

-Class Operators/Special Functions

-
-
+

+Class Operators/Special Functions

-Python Operators

+Python Operators

C is well known for the abundance of operators. C++ extends this to the extremes by allowing operator overloading. Boost.Python takes advantage of @@ -538,7 +511,7 @@ you might need to interact with in an operator expression is (cheaply) default-constructible. You can use other<T>() in place of an actual T instance when writing "self expressions".

-Special Methods

+Special Methods

Python has a few more Special Methods. Boost.Python supports all of the standard special method names supported by real Python class instances. A diff --git a/doc/tutorial/doc/html/python/functions.html b/doc/tutorial/doc/html/python/functions.html index 027c84bb..6dbf93bd 100644 --- a/doc/tutorial/doc/html/python/functions.html +++ b/doc/tutorial/doc/html/python/functions.html @@ -3,17 +3,17 @@ Functions - - + + - +

boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
- + @@ -23,11 +23,8 @@ PrevUpHomeNext
-
-

-Functions

-
-
+

+Functions

Call Policies
Overloading
@@ -68,11 +65,8 @@ But before you do, you might want to fire up Python 2.2 or later and type Namespaces are one honking great idea -- let's do more of those!
-
-

-Call Policies

-
-
+

+Call Policies

In C++, we often deal with arguments and return types such as pointers and references. Such primitive types are rather, ummmm, low level and @@ -178,7 +172,7 @@ A reference to y.x is returned

  • BOOM!
  • -Call Policies

    +Call Policies

    Call Policies may be used in situations such as the example detailed above. In our example, return_internal_reference and with_custodian_and_ward @@ -253,11 +247,8 @@ Boost.Python v1 approach

    boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
    -
    -

    -Overloading

    -
    -
    +

    +Overloading

    The following illustrates a scheme for manually wrapping an overloaded member functions. Of course, the same technique can be applied to wrapping @@ -301,11 +292,8 @@ With these in hand, we can proceed to define and wrap this for Python:

    .def("f", fx4)
    -
    -

    -Default Arguments

    -
    -
    +

    +Default Arguments

    Boost.Python wraps (member) function pointers. Unfortunately, C++ function pointers carry no default argument info. Take a function f with default @@ -347,7 +335,7 @@ are overloaded with a common sequence of initial arguments

    -BOOST_PYTHON_FUNCTION_OVERLOADS

    +BOOST_PYTHON_FUNCTION_OVERLOADS

    Boost.Python now has a way to make it easier. For instance, given a function:

    int foo(int a, char b = 1, unsigned c = 2, double d = 3)
    @@ -366,7 +354,7 @@ and the maximum number of arguments is 4. The def(...)
     automatically add all the foo variants for us:

    def("foo", foo, foo_overloads());

    -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS

    +BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS

    Objects here, objects there, objects here there everywhere. More frequently than anything else, we need to expose member functions of our classes to @@ -398,7 +386,7 @@ fourth macro argument). The thin wrappers are all enclosed in a class named See the overloads reference for details.

    -init and optional

    +init and optional

    A similar facility is provided for class constructors, again, with default arguments or a sequence of overloads. Remember init<...>? For example, @@ -416,11 +404,8 @@ Notice the use of init<...> and -

    -

    -Auto-Overloading

    -
    -
    +

    +Auto-Overloading

    It was mentioned in passing in the previous section that BOOST_PYTHON_FUNCTION_OVERLOADS and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS @@ -456,7 +441,7 @@ Then...

    Notice though that we have a situation now where we have a minimum of zero (0) arguments and a maximum of 3 arguments.

    -Manual Wrapping

    +Manual Wrapping

    It is important to emphasize however that the overloaded functions must have a common sequence of initial arguments. Otherwise, our scheme above diff --git a/doc/tutorial/doc/html/python/hello.html b/doc/tutorial/doc/html/python/hello.html index 71ef2839..0af79eb3 100644 --- a/doc/tutorial/doc/html/python/hello.html +++ b/doc/tutorial/doc/html/python/hello.html @@ -3,17 +3,17 @@ Building Hello World - - + + - + - + @@ -23,13 +23,10 @@ PrevUpHomeNext
    -
    -

    - Building Hello World

    -
    -
    +

    + Building Hello World

    -From Start To Finish

    +From Start To Finish

    Now the first thing you'd want to do is to build the Hello World module and try it for yourself in Python. In this section, we shall outline the steps @@ -98,7 +95,7 @@ the command line. Pre-built Boost.Jam executables are available for most platforms. The complete list of Bjam executables can be found here.

    -Let's Jam!

    +Let's Jam!

    Here is our minimalist Jamfile:

    @@ -131,7 +128,7 @@ Finally we declare our hello extension:

    ;

    -Running bjam

    +Running bjam

    bjam is run using your operating system's command line interpreter.

    Start it up.

    diff --git a/doc/tutorial/doc/html/python/iterators.html b/doc/tutorial/doc/html/python/iterators.html index 12c9ebe7..d34df38a 100644 --- a/doc/tutorial/doc/html/python/iterators.html +++ b/doc/tutorial/doc/html/python/iterators.html @@ -3,17 +3,17 @@ Iterators - - + + - +

    boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
    - + @@ -23,11 +23,8 @@ PrevUpHomeNext
    -
    -

    -Iterators

    -
    -
    +

    +Iterators

    In C++, and STL in particular, we see iterators everywhere. Python also has iterators, but these are two very different beasts.

    diff --git a/doc/tutorial/doc/html/python/object.html b/doc/tutorial/doc/html/python/object.html index a86a8f13..1764e057 100644 --- a/doc/tutorial/doc/html/python/object.html +++ b/doc/tutorial/doc/html/python/object.html @@ -3,17 +3,17 @@ Object Interface - - + + - +
    boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
    - + @@ -23,11 +23,8 @@ PrevUpHomeNext
    -
    -

    - Object Interface

    -
    -
    +

    + Object Interface

    Basic Interface
    Derived Object types
    @@ -47,11 +44,8 @@ feel. Boost.Python C++ objects are as close as possible should minimize the learning curve significantly.

    -
    -

    -Basic Interface

    -
    -
    +

    +Basic Interface

    Class object wraps PyObject*. All the intricacies of dealing with PyObjects such as managing reference counting are handled by the @@ -86,11 +80,8 @@ code in C++, the look and feel should be immediately apparent to the Python coder.

    -
    -

    -Derived Object types

    -
    -
    +

    +Derived Object types

    Boost.Python comes with a set of derived object types corresponding to that of Python's:

    @@ -155,7 +146,7 @@ C++:

    dict d(x.attr("__dict__"));  # copies x.__dict__
     d['whatever'] = 3;           # modifies the copy

    -class_<T> as objects

    +class_<T> as objects

    Due to the dynamic nature of Boost.Python objects, any class_<T> may also be one of these types! The following code snippet wraps the class @@ -171,11 +162,8 @@ We can use this to create wrapped instances. Example:

    assert(vec345.attr("length") == 5.0);
    -
    -

    -Extracting C++ objects

    -
    -
    +

    +Extracting C++ objects

    At some point, we will need to get C++ values out of object instances. This can be achieved with the extract<T> function. Consider the following:

    @@ -208,11 +196,8 @@ facility in fact solves the mutable copying problem:

    d['whatever'] = 3;          # modifies x.__dict__ !
    -
    -

    -Enums

    -
    -
    +

    +Enums

    Boost.Python has a nifty facility to capture and wrap C++ enums. While Python has no enum type, we'll often want to expose our C++ enums to diff --git a/doc/tutorial/doc/html/python/techniques.html b/doc/tutorial/doc/html/python/techniques.html index ad00d5fb..3be6d38b 100644 --- a/doc/tutorial/doc/html/python/techniques.html +++ b/doc/tutorial/doc/html/python/techniques.html @@ -3,16 +3,16 @@ General Techniques - - + + - +

    boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More
    - + @@ -22,11 +22,8 @@ PrevUpHome
    -
    -

    - General Techniques

    -
    -
    +

    + General Techniques

    Creating Packages
    Extending Wrapped Objects in Python
    @@ -35,11 +32,8 @@

    Here are presented some useful techniques that you can use while wrapping code with Boost.Python.

    -
    -

    -Creating Packages

    -
    -
    +

    +Creating Packages

    A Python package is a collection of modules that provide to the user a certain functionality. If you're not familiar on how to create packages, a good @@ -187,11 +181,8 @@ from the filters package:

    >>> sounds.filters.echo_noise(...)
    -
    -

    -Extending Wrapped Objects in Python

    -
    -
    +

    +Extending Wrapped Objects in Python

    Thanks to Python's flexibility, you can easily add new methods to a class, even after it was already created:

    @@ -289,11 +280,8 @@ with virtually zero memory footprint and zero compile-time overhead for the keyword support.

    -
    -

    -Reducing Compiling Time

    -
    -
    +

    +Reducing Compiling Time

    If you have ever exported a lot of classes, you know that it takes quite a good time to compile the Boost.Python wrappers. Plus the memory consumption can diff --git a/doc/tutorial/doc/tutorial.qbk b/doc/tutorial/doc/tutorial.qbk index 039e0722..bc622480 100644 --- a/doc/tutorial/doc/tutorial.qbk +++ b/doc/tutorial/doc/tutorial.qbk @@ -17,10 +17,10 @@ [/ QuickBook Document version 0.9 ] -[def __note__ [$../images/note.png]] -[def __alert__ [$../images/alert.png]] -[def __tip__ [$../images/tip.png]] -[def :-) [$../images/smiley.png]] +[def __note__ [$images/note.png]] +[def __alert__ [$images/alert.png]] +[def __tip__ [$images/tip.png]] +[def :-) [$images/smiley.png]] [section QuickStart] diff --git a/doc/tutorial/doc/tutorial.xml b/doc/tutorial/doc/tutorial.xml index 7e95aff0..1a9c1c5f 100644 --- a/doc/tutorial/doc/tutorial.xml +++ b/doc/tutorial/doc/tutorial.xml @@ -108,7 +108,7 @@ with every boost distribution: bjam.

    - Building without bjam + Building without bjam Besides bjam, there are of course other ways to get your module built. @@ -165,7 +165,7 @@ the command line. Pre-built Boost.Jam executables are available for most platforms. The complete list of Bjam executables can be found here. Let's Jam! - + Here is our minimalist Jamfile: subproject libs/python/example/tutorial ; @@ -222,7 +222,7 @@ appropriately. - Be sure not to include a third number, e.g. not "2.2.1", + Be sure not to include a third number, e.g. not "2.2.1", even if that's the version you have. @@ -647,7 +647,7 @@ struct BaseWrap member function and methods + member function and methods Python, like many object oriented languages uses the term methods. Methods @@ -667,7 +667,7 @@ of the Python object self, which is a pointer back to the Pyt - Why do we need BaseWrap? + Why do we need BaseWrap? @@ -966,7 +966,7 @@ Need we say more? - What is the business of operator<< .def(str(self))? + What is the business of operator<< .def(str(self))? Well, the method str requires the operator<< to do its work (i.e. operator<< is used by the method defined by def(str(self)). @@ -1211,7 +1211,7 @@ Boost.Python v1 approach - Remember the Zen, Luke: + Remember the Zen, Luke: "Explicit is better than implicit" @@ -1525,7 +1525,7 @@ bidirectional mapping between C++ and Python while maintaining the Python feel. Boost.Python C++ objects are as close as possible to Python. This should minimize the learning curve significantly. - +
    Basic Interface @@ -1645,7 +1645,7 @@ member functions. Demonstrates that you can write the C++ equivalent of "format" % x,y,z in Python, which is useful since there's no easy way to do that in std C++. - Beware the common pitfall of forgetting that the constructors + Beware the common pitfall of forgetting that the constructors of most of Python's mutable types make copies, just as in Python. Python: @@ -1721,7 +1721,7 @@ if (x - The astute reader might have noticed that the extract<T> + The astute reader might have noticed that the extract<T> facility in fact solves the mutable copying problem: @@ -1765,7 +1765,7 @@ associated with the C++ type passed as its first parameter.
    - what is a scope? + what is a scope? The scope is a class that has an associated global Python object which controls the Python namespace in @@ -1814,7 +1814,7 @@ when embedding. Therefore you'll need to use the Python/C API to fill in the gaps. However, Boost.Python already makes embedding a lot easier and, in a future version, it may become unnecessary to touch the Python/C API at -all. So stay tuned... +all. So stay tuned... Building embedded programs To be able to use embedding in your programs, they have to be linked to both Boost.Python's and Python's static link library. @@ -1915,7 +1915,7 @@ discuss in the next section. - Handle is a class template, so why haven't we been using any template parameters? + Handle is a class template, so why haven't we been using any template parameters? @@ -1993,7 +1993,7 @@ the object's ptr member function to retrieve the PyO This should create a file called 'hello.txt' in the current directory containing a phrase that is well-known in programming circles. - Note that we wrap the return value of PyRun_String in a + Note that we wrap the return value of PyRun_String in a (nameless) handle even though we are not interested in it. If we didn't do this, the the returned object would be kept alive unnecessarily. Unless you want to be a Dr. Frankenstein, always wrap PyObject*s in handles. @@ -2001,7 +2001,7 @@ you want to be a Dr. Frankenstein, always wrap PyObject*s in It's nice that handle manages the reference counting details for us, but other than that it doesn't do much. Often we'd like to have a more useful class to manipulate Python objects. But we have already seen such a class -above, and in the previous section: the aptly +above, and in the previous section: the aptly named object class and it's derivatives. We've already seen that they can be constructed from a handle. The following examples should further illustrate this fact: @@ -2042,7 +2042,7 @@ int five_squared Note that object's member function to return the wrapped + Note that object's member function to return the wrapped PyObject* is called ptr instead of get. This makes sense if you take into account the different functions that object and handle perform. @@ -2325,7 +2325,7 @@ Compiling these files will generate the following Python extensions: - The extension .pyd is used for python extension modules, which + The extension .pyd is used for python extension modules, which are just shared libraries. Using the default for your system, like .so for Unix and .dll for Windows, works just as well. @@ -2477,7 +2477,7 @@ A C instan -Yes, Python rox. +Yes, Python rox. We can do the same with classes that were wrapped with Boost.Python. Suppose we have a class point in C++: @@ -2643,7 +2643,7 @@ the compilation of a single cpp, instead of the entire wrapper code. - If you're exporting your classes with Pyste, + If you're exporting your classes with Pyste, take a look at the --multiple option, that generates the wrappers in various files as demonstrated here. @@ -2656,7 +2656,7 @@ various files as demonstrated here. - This method is useful too if you are getting the error message + This method is useful too if you are getting the error message "fatal error C1204:Compiler limit:internal structure overflow" when compiling a large source file, as explained in the FAQ.
    boost.png (6897 bytes) HomeLibrariesLibraries People FAQ More