Mercurial > cpython-lru_cache-weakref
annotate Tools/modulator/Templates/object_tp_as_sequence @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | cd9d86ecc175 |
| children | 847425d5bca8 |
| rev | line source |
|---|---|
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 /* Code to handle accessing $name$ objects as sequence objects */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 static int |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 $abbrev$_length(self) |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 $abbrev$object *self; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 /* XXXX Return the size of the object */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
11 static PyObject * |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 $abbrev$_concat(self, bb) |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 $abbrev$object *self; |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
14 PyObject *bb; |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 /* XXXX Return the concatenation of self and bb */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
19 static PyObject * |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 $abbrev$_repeat(self, n) |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 $abbrev$object *self; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 int n; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 /* XXXX Return a new object that is n times self */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
27 static PyObject * |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 $abbrev$_item(self, i) |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 $abbrev$object *self; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 int i; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 /* XXXX Return the i-th object of self */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
35 static PyObject * |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 $abbrev$_slice(self, ilow, ihigh) |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 $abbrev$object *self; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 int ilow, ihigh; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 /* XXXX Return the ilow..ihigh slice of self in a new object */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 static int |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 $abbrev$_ass_item(self, i, v) |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 $abbrev$object *self; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 int i; |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
47 PyObject *v; |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 /* XXXX Assign to the i-th element of self */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 return 0; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 static int |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 $abbrev$_ass_slice(self, ilow, ihigh, v) |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
55 PyListObject *self; |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 int ilow, ihigh; |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
57 PyObject *v; |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 { |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 /* XXXX Replace ilow..ihigh slice of self with v */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 return 0; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 } |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
63 static PySequenceMethods $abbrev$_as_sequence = { |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 (inquiry)$abbrev$_length, /*sq_length*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 (binaryfunc)$abbrev$_concat, /*sq_concat*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 (intargfunc)$abbrev$_repeat, /*sq_repeat*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 (intargfunc)$abbrev$_item, /*sq_item*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 (intintargfunc)$abbrev$_slice, /*sq_slice*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 (intobjargproc)$abbrev$_ass_item, /*sq_ass_item*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 (intintobjargproc)$abbrev$_ass_slice, /*sq_ass_slice*/ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 }; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 /* -------------------------------------------------------------- */ |
