This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,18 +7,18 @@ huku <[[email protected]](mailto:[email protected])> | |
|
||
## Converting C datatypes to Python PyObjects | ||
|
||
Most functions exported to Python are simple wrappers around the low level C API | ||
Most functions exported to Python are simple wrappers around the low level C API | ||
offered by XED2. To be properly returned to the user, the return values of those | ||
C functions must be converted to one of the datatypes recognized by the Python | ||
runtime (i.e. **PyObject** pointers). For the sake of developing **pyxed**, I | ||
C functions must be converted to one of the datatypes recognized by the Python | ||
runtime (i.e. `PyObject` pointers). For the sake of developing **pyxed**, I | ||
settled down to the following set of simple guidelines: | ||
|
||
* When a XED2 function returns **xed_uint_t** to indicate a true/false result, | ||
or **xed_bool_t** (also **typedef**'ed to **unsigned int**), use | ||
**PyBool_FromLong()** to retrieve the corresponding Python object. | ||
* When a XED2 function returns `xed_uint_t` to indicate a true/false result, | ||
or `xed_bool_t` (also `typedef`'ed to `unsigned int`), use `PyBool_FromLong()` | ||
to retrieve the corresponding Python object. | ||
|
||
* When functions return arbitrary values of type **xed_uint_t**, use | ||
**PyLong_FromUnsignedLong()**. | ||
* When functions return arbitrary values of type `xed_uint_t`, use | ||
`PyLong_FromUnsignedLong()`. | ||
|
||
* For return values of type **xed_*_enum_t**, use **PyInt_FromLong()** | ||
(according to the C standard, enumerations are treated as **int** values). | ||
* For return values of type `xed_*_enum_t`, use `PyInt_FromLong()` | ||
(according to the C standard, enumerations are treated as `int` values). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
2014-12-23 huku <[email protected]> | ||
|
||
* Add new class `pyxed.Encoder'. | ||
|