Skip to content

Commit 0f0b465

Browse files
author
Andrii Verbytskyi
committed
Checks of spelling and fixes in docs
1 parent a8480fa commit 0f0b465

File tree

6 files changed

+162
-125
lines changed

6 files changed

+162
-125
lines changed

documentation/basics.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ do so.
4848
Running the Binder
4949
------------------
5050

51-
After the input file is ready the next step is to run Binder. Assuming that our include file conatining all headers from the
51+
After the input file is ready the next step is to run Binder. Assuming that our include file containing all headers from the
5252
project is named as ``all_includes.hpp`` it could be done as:
5353

5454
.. code-block:: bash
@@ -61,7 +61,7 @@ project is named as ``all_includes.hpp`` it could be done as:
6161
6262
6363
Note that we have to specify project-wide include path so Binder could find includes specifies in ``all_includes.hpp`` as well
64-
as path to any aditional C++ include headers that is used in project.
64+
as path to any additional C++ include headers that is used in project.
6565

6666
Most big project will probably require fine tunning of bindings generation process. This can be done by creating Binder config
6767
file and specifying it when calling Binder as ``--config my_project.config``. For detailed reference of config file options

documentation/config.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -161,27 +161,27 @@ Config file directives:
161161
162162
163163
* ``default_static_pointer_return_value_policy``, specify return value policy for static functions returning pointer to objects. Default is
164-
'pybind11::return_value_policy::automatic'.
164+
`pybind11::return_value_policy::automatic`.
165165

166166

167167
* ``default_static_lvalue_reference_return_value_policy``, specify return value policy for static functions returning l-value reference. Default
168-
is 'pybind11::return_value_policy::automatic'.
168+
is `pybind11::return_value_policy::automatic`.
169169

170170

171171
* ``default_static_rvalue_reference_return_value_policy``, specify return value policy for static functions returning r-value reference. Default
172-
is 'pybind11::return_value_policy::automatic'.
172+
is `pybind11::return_value_policy::automatic`.
173173

174174

175175
* ``default_member_pointer_return_value_policy``, specify return value policy for member functions returning pointer to objects. Default is
176-
'pybind11::return_value_policy::automatic'.
176+
`pybind11::return_value_policy::automatic`.
177177

178178

179179
* ``default_member_lvalue_reference_return_value_policy``, specify return value policy for member functions returning l-value reference. Default
180-
is 'pybind11::return_value_policy::automatic'.
180+
is `pybind11::return_value_policy::automatic`.
181181

182182

183183
* ``default_member_rvalue_reference_return_value_policy``, specify return value policy for member functions returning r-value reference. Default
184-
is 'pybind11::return_value_policy::automatic'.
184+
is `pybind11::return_value_policy::automatic`.
185185

186186
* ``default_call_guard``, optionally specify a call guard applied to all function definitions. See `pybind11 documentation <http://pybind11.readthedocs.io/en/stable/advanced/functions.html#call-guard>`_. Default None.
187187

documentation/debugging.rst

+48-47
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Debugging and troubleshooting
2-
##########
2+
#############################
33

44
This section is dedicated to the description of problems that
55
might appear while creating the python bindings with binder and the ways to avoid them.
@@ -13,15 +13,15 @@ Inconsistencies
1313

1414
Binder moves down the ``all_includes_file`` file sequentially, sometimes ending up with errors.
1515
This is almost always caused by the ``all_includes_file`` being
16-
different between runs. The order shouldn't be important, but nail it down to at least be
16+
different between runs. The order should not be important, but nail it down to at least be
1717
consistent, and then move on to the next step.
1818

1919
--------------
2020
Build failures
2121
--------------
2222

2323
Even when the bindings were generated successfully, there might be compilation errors when building the modules from the generated sources.
24-
Quite often the errors are caused by the implementation of the С++standard library, when the headers of the standard library
24+
Quite often the errors are caused by the implementation of the C++ standard library, when the headers of the standard library
2525
include each other, or include implementation-specific headers.
2626
Many cases like that are already handled in the functions from the ``source/types.cpp`` file,
2727
using the knowledge of the existing STL implementations.
@@ -38,7 +38,7 @@ For instance, the compilation could fail with the following error messages:
3838
3939
FAILED: CMakeFiles/statvec.dir/std/complex.o
4040
In file included from std/complex.cpp:1:0:
41-
/usr/include/c++/7/bits/stl_construct.h: In function void std::_Destroy(_ForwardIterator, _ForwardIterator):
41+
/usr/include/c++/7/bits/stl_construct.h: In function 'void std::_Destroy(_ForwardIterator, _ForwardIterator)':
4242
**long and cryptic error message**
4343
4444
The ways to handle this error:
@@ -47,62 +47,63 @@ The ways to handle this error:
4747
more information on the binded classes.
4848

4949
2. Since the includes from the ``bits`` directory should not appear in the generated code, one can grep for ``bits`` in the generated codes,
50-
i.e. ``grep -r "bits" cmake_bindings/*`` could yield:
51-
52-
.. code-block:: console
53-
54-
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Construct
55-
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy
56-
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy_aux
57-
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy_aux<true>::__destroy
58-
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy_n_aux
59-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy
60-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy<false>::__uninit_copy
61-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy<true>::__uninit_copy
62-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy_a
63-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_1
64-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n
65-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_1
66-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_1<false>::__uninit_default_n
67-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_1<true>::__uninit_default_n
68-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_a
69-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_novalue_1
70-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_novalue_n_1
71-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_fill
72-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_fill_n
73-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_move_if_noexcept_a
74-
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::uninitialized_copy
50+
i.e. ``grep -r "bits" cmake_bindings/*`` could yield:
51+
52+
53+
.. code-block:: console
54+
55+
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Construct
56+
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy
57+
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy_aux
58+
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy_aux<true>::__destroy
59+
cmake_bindings/std/complex.cpp:#include <bits/stl_construct.h> // std::_Destroy_n_aux
60+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy
61+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy<false>::__uninit_copy
62+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy<true>::__uninit_copy
63+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_copy_a
64+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_1
65+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n
66+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_1
67+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_1<false>::__uninit_default_n
68+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_1<true>::__uninit_default_n
69+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_n_a
70+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_novalue_1
71+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_default_novalue_n_1
72+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_fill
73+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_fill_n
74+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::__uninitialized_move_if_noexcept_a
75+
cmake_bindings/std/complex.cpp:#include <bits/stl_uninitialized.h> // std::uninitialized_copy
7576
76-
The important information in the output is the ``std::`` types/functions without the leading underscores.
77-
Those are STL-implementation independent types/functions that should be defined elsewhere, not in the headers from the ``bits`` directory.
78-
In this particular example, the function of interest is ``std::uninitialized_copy``.
77+
The important information in the output is the ``std::`` types/functions without the leading underscores.
78+
Those are STL-implementation independent types/functions that should be defined elsewhere, not in the headers from the ``bits`` directory.
79+
In this particular example, the function of interest is ``std::uninitialized_copy``.
7980

80-
A quick search in the C++ documentation at https://en.cppreference.com or other resources tells that this function is defined in the <memory> header.
81-
Therefore, this information should be hardcoded into the binder.
81+
A quick search in the C++ documentation at https://en.cppreference.com or other resources tells that this function is defined in the <memory> header.
82+
Therefore, this information should be hardcoded into the binder.
8283

8384

8485
3. The internal binder function that handles the STL library mappings is located in ``source/types.cpp``:``add_relevant_include_for_decl``.
85-
Briefly, the function has a map with the STL headers and the types those contain. That should look similar to this:
86+
Briefly, the function has a map with the STL headers and the types those contain. That should look similar to this:
8687

87-
.. code-block:: python
88+
.. code-block:: C++
8889

89-
{ "<algorithm>", {"std::move_backward", "std::iter_swap", "std::min"} },
90-
{ "<exception>", {"std::nested_exception"} }
90+
{ "<algorithm>", {"std::move_backward", "std::iter_swap", "std::min"} },
91+
{ "<exception>", {"std::nested_exception"} }
9192

9293

93-
If there is a need to make a simple change, like in our case, the map for the ``<memory>`` can be added like this:
94+
If there is a need to make a simple change, like in our case, the map for the ``<memory>`` can be added like this:
9495

95-
.. code-block:: python
96+
.. code-block:: C++
9697

97-
{ "<algorithm>", {"std::move_backward", "std::iter_swap", "std::min"} },
98-
{ "<exception>", {"std::nested_exception"} },
99-
{ "<memory>", {"std::uninitialized_copy"} },
98+
{ "<algorithm>", {"std::move_backward", "std::iter_swap", "std::min"} },
99+
{ "<exception>", {"std::nested_exception"} },
100+
{ "<memory>", {"std::uninitialized_copy"} },
100101

101102

102-
In addition to that, to ensure a better portability, some of the implementation-specific headers are replaced in binder with the standard ones.
103-
The map that holds the replacements is located in the ``source/types.cpp`` file as well. It should look similar to this:
103+
In addition to that, to ensure a better portability, some of the implementation-specific headers are replaced in binder with the standard ones.
104+
The map that holds the replacements is located in the ``source/types.cpp`` file as well. It should look similar to this:
104105

105-
.. code-block:: python
106+
.. code-block:: C++
106107

107108
static vector< std::pair<string, string> > const include_map = {
108109
make_pair("<bits/ios_base.h>", "<ios>"),
@@ -115,4 +116,4 @@ The map that holds the replacements is located in the ``source/types.cpp`` file
115116
In some cases, many iterations of the described procedure will be needed till all the STL types/functions will be mapped to the correct includes.
116117

117118
If this fixes your problem please let us know, or make a pull request!
118-
119+

documentation/examples.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ folder.
3636
Their names are self explanatory, but I would highly recommend that for your
3737
own applications that you follow the ``python`` & ``cmake`` workflow.
3838

39-
Each script's final running lines also imports the ``test_struct`` module and
40-
prints a variable or two of it to prove that it's working.
39+
Each script\'s final running lines also imports the ``test_struct`` module and
40+
prints a variable or two of it to prove that it is working.
4141

4242

4343
This example/tutorial will walk you through the step-by-step of both
4444
``via_bash`` scripts, because they will help you better understand what needs
4545
to be done to generate bindings. Upon understanding the more manual ``bash``
4646
method, the ``cmake`` code should make much more sense.
4747

48-
The rest of "Simple struct" will also take you through generating pybind11 stl
48+
The rest of \"Simple struct\" will also take you through generating pybind11 stl
4949
bindings (like making bindings for `std::vector` -> python list) and how to use
50-
binder's bindings for `std::vector` to access `std::vector` objects without
50+
binder\'s bindings for `std::vector` to access `std::vector` objects without
5151
converting them to python lists. This allows us to benefit from the speed of
52-
c++!
52+
C++!
5353

5454

5555
Building bindings basics
@@ -191,18 +191,18 @@ You may notice how ever that this will still fail:
191191
192192
python3 -c "import sys; sys.path.append('.'); import test_struct; f = test_struct.testers.test_my_struct(); print(f.a_float); f.add_float(); print(f.a_float); print(f.a_vector)"
193193
194-
This fails because python doesn't understand how to interact with the std
194+
This fails because python does not understand how to interact with the std
195195
library classes like ``std::vector``. You can get around this by remaking your
196196
bindings with this config file. **However**, you must note that when you are
197197
returning vectors into your python environment, or pushing lists to the c++
198-
side, there is a performance penalty when pybind converts from ``python
198+
side, there is a performance penalty when pybind11 converts from ``python
199199
list[]`` -> ``std::vector``, and vice-versa. This can be a problem when dealing
200200
with larger lists/vectors.
201201

202202
If performance is critical, it is advised that most work is done via c++,
203-
and you just use python as the 'glue'. For example, the following command
204-
doesn't fail, because python never has to 'see' the std::vector and all of
205-
the work is done in the c++ layer.
203+
and you just use python as the \"glue\". For example, the following command
204+
does not fail, because python never has to \"see\" the std::vector and all of
205+
the work is done in the C++ layer.
206206

207207
.. code-block:: console
208208

0 commit comments

Comments
 (0)