comparison python/pydc/README.txt @ 35:75fe1dec0eb4

- added support for signature-based calling convention switch
author Tassilo Philipp
date Mon, 13 Apr 2020 16:07:56 +0200
parents 2682a627168c
children 8c8f848131c6
comparison
equal deleted inserted replaced
34:2682a627168c 35:75fe1dec0eb4
35 35
36 36
37 SIGNATURE FORMAT 37 SIGNATURE FORMAT
38 ================ 38 ================
39 39
40 is a formated string 40 ignoring calling convention mode switching for simplicity, the signature is
41 a string with the following format (using * as regex-like repetition):
41 42
42 format: "xxxxx)y" 43 "x*)y"
43 44
44 x is positional parameter-type charcode, y is result-type charcode 45 where x is positional parameter-type charcode (per argument), y is result-type charcode
46
45 47
46 SIG | FROM PYTHON 2 | FROM PYTHON 3 | C/C++ | TO PYTHON 2 | TO PYTHON 3 48 SIG | FROM PYTHON 2 | FROM PYTHON 3 | C/C++ | TO PYTHON 2 | TO PYTHON 3
47 ----+---------------------------------+---------------------------------+---------------------------------+--------------------------------------+--------------------------------------- 49 ----+---------------------------------+---------------------------------+---------------------------------+--------------------------------------+---------------------------------------
48 'v' | | | void | None (Py_None) (e.g. ret of "...)v") | None (Py_None) (e.g. ret of "...)v") 50 'v' | | | void | None (Py_None) (e.g. ret of "...)v") | None (Py_None) (e.g. ret of "...)v")
49 'B' | bool (PyBool) | bool (PyBool) # | int/bool | bool (PyBool) | bool (PyBool) @ 51 'B' | bool (PyBool) | bool (PyBool) # | int/bool | bool (PyBool) | bool (PyBool) @
69 'Z' | str (PyString) ! | str (PyUnicode) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode) 71 'Z' | str (PyString) ! | str (PyUnicode) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
70 | unicode (PyUnicode) ! | - | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode) 72 | unicode (PyUnicode) ! | - | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
71 | - | bytes (PyBytes) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode) 73 | - | bytes (PyBytes) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
72 | bytearray (PyByteArray) ! | bytearray (PyByteArray) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode) 74 | bytearray (PyByteArray) ! | bytearray (PyByteArray) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
73 75
74 # converted to 1 if True and 0 otherwise 76 # converted to 1 if True and 0 otherwise
75 @ converted to False if 0 and True otherwise 77 @ converted to False if 0 and True otherwise
76 % range/length checked 78 % range/length checked
77 $ cast to single precision 79 $ cast to single precision
78 ^ cast to double precision 80 ^ cast to double precision
79 & mutable buffer when passed to C 81 & mutable buffer when passed to C
80 ! immutable buffer when passed to C, as strings (in any form) are considered objects, not buffers 82 ! immutable buffer when passed to C, as strings (in any form) are considered objects, not buffers
83
84
85 also supported are specifying calling convention mode switches using
86 '_'-prefixed signature characters; consult the dyncall docs for a list
87
81 88
82 TODO 89 TODO
83 ==== 90 ====
84 91
85 - signature suffixes used to indicate calling conventions are not supported yet!
86 - callback support 92 - callback support
93
87 94
88 BUGS 95 BUGS
89 ==== 96 ====
90 97
91 - when using Python 2, the dyncall call vm object is never dcFree'd, as there 98 - when using Python 2, the dyncall call vm object is never dcFree'd, as there