Skip to content

Commit 3ce88da

Browse files
committed
Tutorial Updates for Building BPL Projects
[SVN r28889]
1 parent 4cec6c4 commit 3ce88da

File tree

11 files changed

+274
-2776
lines changed

11 files changed

+274
-2776
lines changed

doc/tutorial/doc/html/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</h3></div></div>
3131
<div><p class="copyright">Copyright © 2002-2005 Joel de Guzman, David Abrahams</p></div>
3232
<div><div class="legalnotice">
33-
<a name="id446800"></a><p>
33+
<a name="id376623"></a><p>
3434
Distributed under the Boost Software License, Version 1.0.
3535
(See accompanying file LICENSE_1_0.txt or copy at
3636
<a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">
@@ -96,7 +96,7 @@
9696
wrapping code takes on the look of a kind of declarative interface
9797
definition language (IDL).</p>
9898
<a name="quickstart.hello_world"></a><h2>
99-
<a name="id376135"></a>Hello World</h2>
99+
<a name="id376137"></a>Hello World</h2>
100100
<p>
101101
Following C/C++ tradition, let's start with the "hello, world". A C++
102102
Function:</p>
@@ -125,7 +125,7 @@
125125
</div>
126126
</div>
127127
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
128-
<td align="left"><small><p>Last revised: May 02, 2005 at 15:44:52 GMT</p></small></td>
128+
<td align="left"><small><p>Last revised: May 14, 2005 at 02:47:50 GMT</p></small></td>
129129
<td align="right"><small></small></td>
130130
</tr></table>
131131
<hr>

doc/tutorial/doc/html/python/embedding.html

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
in a future version, it may become unnecessary to touch the Python/C API at
4040
all. So stay tuned... <span class="inlinemediaobject"><img src="../images/smiley.png"></span></p>
4141
<a name="embedding.building_embedded_programs"></a><h2>
42-
<a name="id460673"></a>Building embedded programs</h2>
42+
<a name="id460594"></a>Building embedded programs</h2>
4343
<p>
4444
To be able to use embedding in your programs, they have to be linked to
4545
both Boost.Python's and Python's static link library.</p>
@@ -61,21 +61,21 @@
6161
In a Jamfile, all the above boils down to:</p>
6262
<pre class="programlisting"><tt class="literal">projectroot c:\projects\embedded_program ; # location of the program
6363

64-
# bring in the rules for python
65-
SEARCH on python.jam = $(BOOST_BUILD_PATH) ;
66-
include python.jam ;
64+
# bring in the rules for python
65+
SEARCH on python.jam = $(BOOST_BUILD_PATH) ;
66+
include python.jam ;
6767

68-
exe embedded_program # name of the executable
69-
: #sources
70-
embedded_program.cpp
71-
: # requirements
72-
&lt;find-library&gt;boost_python &lt;library-path&gt;c:\boost\libs\python
73-
$(PYTHON_PROPERTIES)
74-
&lt;library-path&gt;$(PYTHON_LIB_PATH)
75-
&lt;find-library&gt;$(PYTHON_EMBEDDED_LIBRARY) ;
68+
exe embedded_program # name of the executable
69+
: #sources
70+
embedded_program.cpp
71+
: # requirements
72+
&lt;find-library&gt;boost_python &lt;library-path&gt;c:\boost\libs\python
73+
$(PYTHON_PROPERTIES)
74+
&lt;library-path&gt;$(PYTHON_LIB_PATH)
75+
&lt;find-library&gt;$(PYTHON_EMBEDDED_LIBRARY) ;
7676
</tt></pre>
7777
<a name="embedding.getting_started"></a><h2>
78-
<a name="id460764"></a>Getting started</h2>
78+
<a name="id460675"></a>Getting started</h2>
7979
<p>
8080
Being able to build is nice, but there is nothing to build yet. Embedding
8181
the Python interpreter into one of your C++ programs requires these 4
@@ -110,7 +110,7 @@
110110
Fortunately Boost.Python provides the <a href="../../../../v2/handle.html" target="_top">handle</a> and
111111
<a href="../../../../v2/object.html" target="_top">object</a> class templates to automate the process.</p>
112112
<a name="using_the_interpreter.reference_counting_handles_and_objects"></a><h2>
113-
<a name="id460895"></a>Reference-counting handles and objects</h2>
113+
<a name="id460807"></a>Reference-counting handles and objects</h2>
114114
<p>
115115
There are two ways in which a function in the Python/C API can return a
116116
<tt class="literal">PyObject*</tt>: as a <span class="emphasis"><em>borrowed reference</em></span> or as a <span class="emphasis"><em>new reference</em></span>. Which of
@@ -141,7 +141,7 @@
141141
</td></tr></tbody>
142142
</table></div>
143143
<a name="using_the_interpreter.running_python_code"></a><h2>
144-
<a name="id461200"></a>Running Python code</h2>
144+
<a name="id461112"></a>Running Python code</h2>
145145
<p>
146146
To run Python code from C++ there is a family of functions in the API
147147
starting with the PyRun prefix. You can find the full list of these
@@ -156,7 +156,7 @@
156156
for interpreting the code. The possible values are:</p>
157157
<div class="informaltable">
158158
<h4>
159-
<a name="id461362"></a><span class="table-title">Start symbols</span>
159+
<a name="id461274"></a><span class="table-title">Start symbols</span>
160160
</h4>
161161
<table class="table">
162162
<colgroup>
@@ -224,7 +224,7 @@ <h4>
224224
</td></tr></tbody>
225225
</table></div>
226226
<a name="using_the_interpreter.beyond_handles"></a><h2>
227-
<a name="id461811"></a>Beyond handles</h2>
227+
<a name="id461723"></a>Beyond handles</h2>
228228
<p>
229229
It's nice that <tt class="literal">handle</tt> manages the reference counting details for us, but
230230
other than that it doesn't do much. Often we'd like to have a more useful
@@ -271,7 +271,7 @@ <h4>
271271
</td></tr></tbody>
272272
</table></div>
273273
<a name="using_the_interpreter.exception_handling"></a><h2>
274-
<a name="id462393"></a>Exception handling</h2>
274+
<a name="id462304"></a>Exception handling</h2>
275275
<p>
276276
If an exception occurs in the execution of some Python code, the <a href="http://www.python.org/doc/current/api/veryhigh.html#l2h-55" target="_top">PyRun_String</a>
277277
function returns a null pointer. Constructing a <tt class="literal">handle</tt> out of this null

doc/tutorial/doc/html/python/exposing.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@
396396
<div class="titlepage"><div><div><h3 class="title">
397397
<a name="python.class_operators_special_functions"></a>Class Operators/Special Functions</h3></div></div></div>
398398
<a name="class_operators_special_functions.python_operators"></a><h2>
399-
<a name="id451998"></a>Python Operators</h2>
399+
<a name="id451926"></a>Python Operators</h2>
400400
<p>
401401
C is well known for the abundance of operators. C++ extends this to the
402402
extremes by allowing operator overloading. Boost.Python takes advantage of
@@ -434,7 +434,7 @@
434434
default-constructible. You can use <tt class="literal">other&lt;T&gt;()</tt> in place of an actual
435435
<tt class="literal">T</tt> instance when writing "self expressions".</p>
436436
<a name="class_operators_special_functions.special_methods"></a><h2>
437-
<a name="id452685"></a>Special Methods</h2>
437+
<a name="id452613"></a>Special Methods</h2>
438438
<p>
439439
Python has a few more <span class="emphasis"><em>Special Methods</em></span>. Boost.Python supports all of the
440440
standard special method names supported by real Python class instances. A

doc/tutorial/doc/html/python/functions.html

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,26 @@
4343
But before you do, you might want to fire up Python 2.2 or later and type
4444
<tt class="literal">&gt;&gt;&gt; import this</tt>.</p>
4545
<pre class="programlisting"><tt class="literal">&gt;&gt;&gt; import this
46-
The Zen of Python, by Tim Peters
47-
Beautiful is better than ugly.
48-
Explicit is better than implicit.
49-
Simple is better than complex.
50-
Complex is better than complicated.
51-
Flat is better than nested.
52-
Sparse is better than dense.
53-
Readability counts.
54-
Special cases aren't special enough to break the rules.
55-
Although practicality beats purity.
56-
Errors should never pass silently.
57-
Unless explicitly silenced.
58-
In the face of ambiguity, refuse the temptation to guess.
59-
There should be one-- and preferably only one --obvious way to do it
60-
Although that way may not be obvious at first unless you're Dutch.
61-
Now is better than never.
62-
Although never is often better than <span class="bold"><b>right</b></span> now.
63-
If the implementation is hard to explain, it's a bad idea.
64-
If the implementation is easy to explain, it may be a good idea.
65-
Namespaces are one honking great idea -- let's do more of those!
46+
The Zen of Python, by Tim Peters
47+
Beautiful is better than ugly.
48+
Explicit is better than implicit.
49+
Simple is better than complex.
50+
Complex is better than complicated.
51+
Flat is better than nested.
52+
Sparse is better than dense.
53+
Readability counts.
54+
Special cases aren't special enough to break the rules.
55+
Although practicality beats purity.
56+
Errors should never pass silently.
57+
Unless explicitly silenced.
58+
In the face of ambiguity, refuse the temptation to guess.
59+
There should be one-- and preferably only one --obvious way to do it
60+
Although that way may not be obvious at first unless you're Dutch.
61+
Now is better than never.
62+
Although never is often better than <span class="bold"><b>right</b></span> now.
63+
If the implementation is hard to explain, it's a bad idea.
64+
If the implementation is easy to explain, it may be a good idea.
65+
Namespaces are one honking great idea -- let's do more of those!
6666
</tt></pre>
6767
<div class="section" lang="en">
6868
<div class="titlepage"><div><div><h3 class="title">
@@ -174,7 +174,7 @@
174174
<li><span class="bold"><b>BOOM!</b></span></li>
175175
</ol></div>
176176
<a name="call_policies.call_policies"></a><h2>
177-
<a name="id454356"></a>Call Policies</h2>
177+
<a name="id454278"></a>Call Policies</h2>
178178
<p>
179179
Call Policies may be used in situations such as the example detailed above.
180180
In our example, <tt class="literal">return_internal_reference</tt> and <tt class="literal">with_custodian_and_ward</tt>
@@ -336,7 +336,7 @@
336336
</li>
337337
</ul></div>
338338
<a name="default_arguments.boost_python_function_overloads"></a><h2>
339-
<a name="id456178"></a>BOOST_PYTHON_FUNCTION_OVERLOADS</h2>
339+
<a name="id456100"></a>BOOST_PYTHON_FUNCTION_OVERLOADS</h2>
340340
<p>
341341
Boost.Python now has a way to make it easier. For instance, given a function:</p>
342342
<pre class="programlisting"><tt class="literal"><span class="keyword">int</span><span class="identifier"> foo</span><span class="special">(</span><span class="keyword">int</span><span class="identifier"> a</span><span class="special">,</span><span class="keyword"> char</span><span class="identifier"> b</span><span class="special"> =</span><span class="number"> 1</span><span class="special">,</span><span class="keyword"> unsigned</span><span class="identifier"> c</span><span class="special"> =</span><span class="number"> 2</span><span class="special">,</span><span class="keyword"> double</span><span class="identifier"> d</span><span class="special"> =</span><span class="number"> 3</span><span class="special">)</span><span class="special">
@@ -355,7 +355,7 @@
355355
automatically add all the foo variants for us:</p>
356356
<pre class="programlisting"><tt class="literal"><span class="identifier">def</span><span class="special">(</span><span class="string">"foo"</span><span class="special">,</span><span class="identifier"> foo</span><span class="special">,</span><span class="identifier"> foo_overloads</span><span class="special">());</span></tt></pre>
357357
<a name="default_arguments.boost_python_member_function_overloads"></a><h2>
358-
<a name="id456457"></a>BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS</h2>
358+
<a name="id456379"></a>BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS</h2>
359359
<p>
360360
Objects here, objects there, objects here there everywhere. More frequently
361361
than anything else, we need to expose member functions of our classes to
@@ -387,7 +387,7 @@
387387
See the <a href="../../../../v2/overloads.html#BOOST_PYTHON_FUNCTION_OVERLOADS-spec" target="_top">overloads reference</a>
388388
for details.</p>
389389
<a name="default_arguments.init_and_optional"></a><h2>
390-
<a name="id456784"></a>init and optional</h2>
390+
<a name="id456707"></a>init and optional</h2>
391391
<p>
392392
A similar facility is provided for class constructors, again, with
393393
default arguments or a sequence of overloads. Remember <tt class="literal">init&lt;...&gt;</tt>? For example,
@@ -442,7 +442,7 @@
442442
Notice though that we have a situation now where we have a minimum of zero
443443
(0) arguments and a maximum of 3 arguments.</p>
444444
<a name="auto_overloading.manual_wrapping"></a><h2>
445-
<a name="id457431"></a>Manual Wrapping</h2>
445+
<a name="id457353"></a>Manual Wrapping</h2>
446446
<p>
447447
It is important to emphasize however that <span class="bold"><b>the overloaded functions must
448448
have a common sequence of initial arguments</b></span>. Otherwise, our scheme above

0 commit comments

Comments
 (0)