提交 2f9ec49d authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix the new doc warnings with the newer sphinx.

上级 75cbdac1
...@@ -132,7 +132,7 @@ The following ResultBase represents a double (we only care about the C part). ...@@ -132,7 +132,7 @@ The following ResultBase represents a double (we only care about the C part).
.. code-block:: python .. code-block:: python
class Double(ResultBase): class Double(ResultBase):
<snip> # <snip>
def c_declare(self): def c_declare(self):
return "double %(name)s;" return "double %(name)s;"
def c_init(self): def c_init(self):
...@@ -153,7 +153,7 @@ The following ResultBase represents addition of two nonnegative doubles (we only ...@@ -153,7 +153,7 @@ The following ResultBase represents addition of two nonnegative doubles (we only
.. code-block:: python .. code-block:: python
class Add(Op): class Add(Op):
<snip> # <snip>
def c_var_names(self): def c_var_names(self):
return "[['x', 'y'], ['z']]" return "[['x', 'y'], ['z']]"
def c_validate_update(self): def c_validate_update(self):
...@@ -170,7 +170,7 @@ Generating a C function ...@@ -170,7 +170,7 @@ Generating a C function
For the example Op, the generated C function will typically look like this: For the example Op, the generated C function will typically look like this:
.. code-block:: python .. code-block:: cpp
void add(PyObject* storage_x, PyObject* storage_y, PyObject* storage_z) { void add(PyObject* storage_x, PyObject* storage_y, PyObject* storage_z) {
PyObject* py_x = PyList_GET_ITEM(storage_x, 0); Py_XINCREF(py_x); // automatic PyObject* py_x = PyList_GET_ITEM(storage_x, 0); Py_XINCREF(py_x); // automatic
...@@ -232,16 +232,16 @@ Here is a sketch of the struct equivalent of the previous function: ...@@ -232,16 +232,16 @@ Here is a sketch of the struct equivalent of the previous function:
double z; // z.c_declare double z; // z.c_declare
void init(PyObject* storage_x, PyObject* storage_y, PyObject* storage_z) { void init(PyObject* storage_x, PyObject* storage_y, PyObject* storage_z) {
<set the struct members of the same names> // <set the struct members of the same names>
<init the struct members corresponding to z> // <init the struct members corresponding to z>
} }
void cleanup(void) { void cleanup(void) {
<cleanup z> // <cleanup z>
} }
void run(void) { void run(void) {
<same code as before minus z's cleanup> // <same code as before minus z's cleanup>
} }
add() { this->init(); } add() { this->init(); }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论