summaryrefslogtreecommitdiffstats
path: root/Include/abstract.h
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-24 20:09:45 (GMT)
committerThomas Wouters <thomas@python.org>2000-08-24 20:09:45 (GMT)
commitdd8dbdb7172fbafb5ffab8600e620103fc19879e (patch)
treed0706f5e94cb061057f85138e8637885c9f4cb57 /Include/abstract.h
parente289e0bd0c3db9755bb2ddd49b08091049bc301d (diff)
downloadcpython-dd8dbdb7172fbafb5ffab8600e620103fc19879e.zip
cpython-dd8dbdb7172fbafb5ffab8600e620103fc19879e.tar.gz
cpython-dd8dbdb7172fbafb5ffab8600e620103fc19879e.tar.bz2
The real suport for augmented assignment: new opcodes, new PyNumber and
PySequence methods and functions, new tokens.
Diffstat (limited to 'Include/abstract.h')
-rw-r--r--Include/abstract.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index fe1fa4b..9c18bbd 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -664,6 +664,108 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
float(o).
*/
+/* In-place variants of (some of) the above number protocol functions */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of adding o2 to o1, possibly in-place, or null
+ on failure. This is the equivalent of the Python expression:
+ o1 += o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of subtracting o2 from o1, possibly in-place or
+ null on failure. This is the equivalent of the Python expression:
+ o1 -= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of multiplying o1 by o2, possibly in-place, or
+ null on failure. This is the equivalent of the Python expression:
+ o1 *= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of dividing o1 by o2, possibly in-place, or null
+ on failure. This is the equivalent of the Python expression:
+ o1 /= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the remainder of dividing o1 by o2, possibly in-place, or
+ null on failure. This is the equivalent of the Python expression:
+ o1 %= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
+ PyObject *o3);
+
+ /*
+ Returns the result of raising o1 to the power of o2, possibly
+ in-place, or null on failure. This is the equivalent of the Python
+ expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of left shifting o1 by o2, possibly in-place, or
+ null on failure. This is the equivalent of the Python expression:
+ o1 <<= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of right shifting o1 by o2, possibly in-place or
+ null on failure. This is the equivalent of the Python expression:
+ o1 >>= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of bitwise and of o1 and o2, possibly in-place,
+ or null on failure. This is the equivalent of the Python
+ expression: o1 &= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
+ null on failure. This is the equivalent of the Python expression:
+ o1 ^= o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2);
+
+ /*
+ Returns the result of bitwise or or o1 and o2, possibly in-place,
+ or null on failure. This is the equivalent of the Python
+ expression: o1 |= o2.
+
+ */
+
/* Sequence protocol:*/
@@ -824,6 +926,26 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
expression: o.index(value).
*/
+/* In-place versions of some of the above Sequence functions. */
+
+ DL_IMPORT(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2);
+
+ /*
+ Append o2 to o1, in-place when possible. Return the resulting
+ object, which could be o1, or NULL on failure. This is the
+ equivalent of the Python expression: o1 += o2.
+
+ */
+
+ DL_IMPORT(PyObject *) PySequence_InPlaceRepeat(PyObject *o, int count);
+
+ /*
+ Repeat o1 by count, in-place when possible. Return the resulting
+ object, which could be o1, or NULL on failure. This is the
+ equivalent of the Python expression: o1 *= count.
+
+ */
+
/* Mapping protocol:*/
DL_IMPORT(int) PyMapping_Check(PyObject *o);