chiark / gitweb /
Reorganization: split out utilities; mapping methods
[catacomb-python] / buffer.c
CommitLineData
46e6ad89 1/* -*-c-*-
2 *
3 * $Id$
4 *
5 * Reading and writing buffers of stuff
6 *
7 * (c) 2005 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the Python interface to Catacomb.
13 *
14 * Catacomb/Python is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * Catacomb/Python is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Catacomb/Python; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29/*----- Header files ------------------------------------------------------*/
30
31#include "catacomb-python.h"
32
33/*----- Data structures ---------------------------------------------------*/
34
35typedef struct buf_pyobj {
36 PyObject_HEAD
37 buf b;
0463996f 38 PyObject *sub;
46e6ad89 39} buf_pyobj;
40
41static PyTypeObject *rbuf_pytype, *wbuf_pytype;
42#define RBUF_PYCHECK(o) PyObject_TypeCheck((o), rbuf_pytype)
43#define WBUF_PYCHECK(o) PyObject_TypeCheck((o), wbuf_pytype)
44#define BUF_B(o) (&((buf_pyobj *)(o))->b)
0463996f 45#define BUF_SUB(o) (((buf_pyobj *)(o))->sub)
46e6ad89 46
47/*----- Exceptions --------------------------------------------------------*/
48
49static PyObject *buferr;
50
51#define BUFERR() do { PyErr_SetNone(buferr); goto end; } while (0)
52
53/*----- Read buffers ------------------------------------------------------*/
54
55static PyObject *rbuf_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
56{
57 char *p, *q;
58 int n;
59 buf_pyobj *me = 0;
60 static char *kwlist[] = { "data", 0 };
61
62 if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#:new", kwlist, &p, &n))
63 goto end;
46e6ad89 64 q = xmalloc(n);
65 memcpy(q, p, n);
0463996f 66 me = (buf_pyobj *)ty->tp_alloc(ty, 0);
67 me->sub = 0;
46e6ad89 68 buf_init(&me->b, q, n);
69end:
70 return ((PyObject *)me);
71}
72
73static void buf_pydealloc(PyObject *me)
0463996f 74{
75 if (BUF_SUB(me))
76 Py_DECREF(BUF_SUB(me));
77 else
78 xfree(BBASE(BUF_B(me)));
79 FREEOBJ(me);
80}
46e6ad89 81
82static int rbuf_pysegcount(PyObject *me, int *nn)
83 { if (nn) *nn = BSZ(BUF_B(me)); return (1); }
84
85static int rbuf_pyreadbuf(PyObject *me, int seg, void **q)
86 { assert(seg == 0); *q = BBASE(BUF_B(me)); return (BSZ(BUF_B(me))); }
87
88static PyObject *rbmeth_skip(PyObject *me, PyObject *arg)
89{
90 size_t n;
91
92 if (!PyArg_ParseTuple(arg, "O&:skip", convszt, &n)) goto end;
93 if (!buf_get(BUF_B(me), n)) BUFERR();
94 RETURN_ME;
95end:
96 return (0);
97}
98
99static PyObject *rbmeth_get(PyObject *me, PyObject *arg)
100{
101 void *p;
102 size_t n;
103
104 if (!PyArg_ParseTuple(arg, "O&:get", convszt, &n)) goto end;
105 if ((p = buf_get(BUF_B(me), n)) == 0) BUFERR();
106 return (bytestring_pywrap(p, n));
107end:
108 return (0);
109}
110
111#define RBMETH_GETU_(n, W, w) \
112 static PyObject *rbmeth_getu##w(PyObject *me, PyObject *arg) \
113 { \
114 uint##n x; \
115 if (!PyArg_ParseTuple(arg, ":getu" #w)) goto end; \
116 if (buf_getu##w(BUF_B(me), &x)) BUFERR(); \
117 return (getu32(x)); \
118 end: \
119 return (0); \
120 }
121DOUINTCONV(RBMETH_GETU_)
122
123#define RBMETH_GETBLK_(n, W, w) \
124 static PyObject *rbmeth_getblk##w(PyObject *me, PyObject *arg) \
125 { \
126 size_t sz; \
127 char *q; \
128 if (!PyArg_ParseTuple(arg, ":getblk" #w)) goto end; \
129 if ((q = buf_getmem##w(BUF_B(me), &sz)) == 0) BUFERR(); \
130 return (bytestring_pywrap(q, sz)); \
131 end: \
132 return (0); \
133 }
134BUF_DOSUFFIXES(RBMETH_GETBLK_)
135
0463996f 136#define RBMETH_GETBUF_(n, W, w) \
137 static PyObject *rbmeth_getbuf##w(PyObject *me, PyObject *arg) \
138 { \
139 buf_pyobj *b; \
140 buf bb; \
141 if (!PyArg_ParseTuple(arg, ":getbuf" #w)) goto end; \
142 if (buf_getbuf##w(BUF_B(me), &bb)) BUFERR(); \
143 b = PyObject_NEW(buf_pyobj, rbuf_pytype); \
144 b->b = bb; \
145 b->sub = me; \
146 Py_INCREF(me); \
147 return ((PyObject *)b); \
148 end: \
149 return (0); \
150 }
151BUF_DOSUFFIXES(RBMETH_GETBUF_)
152
46e6ad89 153static PyObject *rbmeth_getmp(PyObject *me, PyObject *arg)
154{
155 mp *x;
156 if (!PyArg_ParseTuple(arg, ":getmp")) goto end;
157 if ((x = buf_getmp(BUF_B(me))) == 0) BUFERR();
158 return (mp_pywrap(x));
159end:
160 return (0);
161}
162
163static PyObject *rbmeth_getgf(PyObject *me, PyObject *arg)
164{
165 mp *x;
166 if (!PyArg_ParseTuple(arg, ":getgf")) goto end;
167 if ((x = buf_getmp(BUF_B(me))) == 0) BUFERR();
168 return (gf_pywrap(x));
169end:
170 return (0);
171}
172
173static PyObject *rbmeth_getecpt(PyObject *me, PyObject *arg, PyObject *kw)
174{
175 PyObject *cobj = Py_None;
176 static char *kwlist[] = { "curve", 0 };
177 ec pt = EC_INIT;
178 if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O:getecpt", kwlist, &cobj))
179 goto end;
180 if (cobj == Py_None) cobj = (PyObject *)ecpt_pytype;
181 if (!PyType_Check(cobj) ||
182 !PyType_IsSubtype((PyTypeObject *)cobj, ecpt_pytype))
183 TYERR("expected elliptic curve type");
184 if (buf_getec(BUF_B(me), &pt)) BUFERR();
185 return (ecpt_pywrapout(cobj, &pt));
186end:
187 return (0);
188}
189
190static PyObject *rbmeth_getecptraw(PyObject *me, PyObject *arg)
191{
192 PyTypeObject *cobj = ecpt_pytype;
193 ec pt = EC_INIT;
194 if (!PyArg_ParseTuple(arg, "O!:getecptraw", eccurve_pytype, &cobj))
195 goto end;
196 if (ec_getraw(ECCURVE_C(cobj), BUF_B(me), &pt)) BUFERR();
197 return (ecpt_pywrapout(cobj, &pt));
198end:
199 return (0);
200}
201
202static PyObject *rbmeth_getge(PyObject *me, PyObject *arg)
203{
204 PyObject *gobj;
205 ge *x = 0;
206 if (!PyArg_ParseTuple(arg, "O!:getge", group_pytype, &gobj)) goto end;
207 x = G_CREATE(GROUP_G(gobj));
208 if (G_FROMBUF(GROUP_G(gobj), BUF_B(me), x)) BUFERR();
209 return (ge_pywrap(gobj, x));
210end:
211 if (x) G_DESTROY(GROUP_G(gobj), x);
212 return (0);
213}
214
215static PyObject *rbmeth_getgeraw(PyObject *me, PyObject *arg)
216{
217 PyObject *gobj;
218 ge *x = 0;
219 if (!PyArg_ParseTuple(arg, "O!:getgeraw", group_pytype, &gobj)) goto end;
220 x = G_CREATE(GROUP_G(gobj));
221 if (G_FROMRAW(GROUP_G(gobj), BUF_B(me), x)) BUFERR();
222 return (ge_pywrap(gobj, x));
223end:
224 if (x) G_DESTROY(GROUP_G(gobj), x);
225 return (0);
226}
227
228static PyObject *rbget_size(PyObject *me, void *hunoz)
229 { return (PyInt_FromLong(BSZ(BUF_B(me)))); }
230static PyObject *rbget_left(PyObject *me, void *hunoz)
231 { return (PyInt_FromLong(BLEFT(BUF_B(me)))); }
232static PyObject *rbget_endp(PyObject *me, void *hunoz)
233 { return (getbool(!BLEFT(BUF_B(me)))); }
0463996f 234static PyObject *rbget_offset(PyObject *me, void *hunoz)
235 { return (PyInt_FromLong(BLEN(BUF_B(me)))); }
236static int rbset_offset(PyObject *me, PyObject *x, void *hunoz)
237{
238 size_t n;
239 if (!convszt(x, &n)) goto end;
240 if (n > BSZ(BUF_B(me))) VALERR("out of range");
241 BCUR(BUF_B(me)) = BBASE(BUF_B(me)) + n;
242 return (0);
243end:
244 return (-1);
245}
46e6ad89 246
247static PyGetSetDef rbuf_pygetset[] = {
248#define GETSETNAME(op, name) rb##op##_##name
249 GET (size, "RBUF.size -> SIZE")
250 GET (left, "RBUF.left -> REMAINDER")
251 GET (endp, "RBUF.endp -> BOOL")
0463996f 252 GETSET(offset, "RBUF.offset -> OFFSET")
46e6ad89 253#undef GETSETNAME
254 { 0 }
255};
256
257static PyMethodDef rbuf_pymethods[] = {
258#define METHNAME(func) rbmeth_##func
259 METH (skip, "RBUF.skip(N)")
260 METH (get, "RBUF.get(N) -> BYTES")
261#define RBMETH_DECL_GETU_(n, W, w) \
262 METH(getu##w, "RBUF.getu" #w "() -> INT")
263 DOUINTCONV(RBMETH_DECL_GETU_)
264#define RBMETH_DECL_GETBLK_(n, W, w) \
265 METH(getblk##w, "RBUF.getblk" #w "() -> INT")
266 BUF_DOSUFFIXES(RBMETH_DECL_GETBLK_)
0463996f 267#define RBMETH_DECL_GETBUF_(n, W, w) \
268 METH(getbuf##w, "RBUF.getbuf" #w "() -> INT")
269 BUF_DOSUFFIXES(RBMETH_DECL_GETBUF_)
46e6ad89 270 METH (getmp, "RBUF.getmp() -> X")
271 METH (getgf, "RBUF.getgf() -> X")
272 KWMETH(getecpt, "RBUF.getecpt(curve = None) -> P")
273 METH (getecptraw, "RBUF.getecptraw(CURVE) -> P")
274 METH (getge, "RBUF.getge(GROUP) -> X")
275 METH (getgeraw, "RBUF.getgeraw(GROUP) -> X")
276#undef METHNAME
277 { 0 }
278};
279
280static PyBufferProcs rbuf_pybuffer = {
281 rbuf_pyreadbuf, /* @bf_getreadbuffer@ */
282 0, /* @bf_getwritebuffer@ */
283 rbuf_pysegcount, /* @bf_getsegcount@ */
284 0 /* @bf_getcharbuffer@ */
285};
286
287static PyTypeObject rbuf_pytype_skel = {
288 PyObject_HEAD_INIT(0) 0, /* Header */
289 "catacomb.ReadBuffer", /* @tp_name@ */
290 sizeof(buf_pyobj), /* @tp_basicsize@ */
291 0, /* @tp_itemsize@ */
292
293 buf_pydealloc, /* @tp_dealloc@ */
294 0, /* @tp_print@ */
295 0, /* @tp_getattr@ */
296 0, /* @tp_setattr@ */
297 0, /* @tp_compare@ */
298 0, /* @tp_repr@ */
299 0, /* @tp_as_number@ */
300 0, /* @tp_as_sequence@ */
301 0, /* @tp_as_mapping@ */
302 0, /* @tp_hash@ */
303 0, /* @tp_call@ */
304 0, /* @tp_str@ */
305 0, /* @tp_getattro@ */
306 0, /* @tp_setattro@ */
307 &rbuf_pybuffer, /* @tp_as_buffer@ */
308 Py_TPFLAGS_DEFAULT | /* @tp_flags@ */
309 Py_TPFLAGS_BASETYPE,
310
311 /* @tp_doc@ */
312 "A read buffer.",
313
314 0, /* @tp_traverse@ */
315 0, /* @tp_clear@ */
316 0, /* @tp_richcompare@ */
317 0, /* @tp_weaklistoffset@ */
318 0, /* @tp_iter@ */
963a6148 319 0, /* @tp_iternext@ */
46e6ad89 320 rbuf_pymethods, /* @tp_methods@ */
321 0, /* @tp_members@ */
322 rbuf_pygetset, /* @tp_getset@ */
323 0, /* @tp_base@ */
324 0, /* @tp_dict@ */
325 0, /* @tp_descr_get@ */
326 0, /* @tp_descr_set@ */
327 0, /* @tp_dictoffset@ */
328 0, /* @tp_init@ */
329 PyType_GenericAlloc, /* @tp_alloc@ */
330 rbuf_pynew, /* @tp_new@ */
331 0, /* @tp_free@ */
332 0 /* @tp_is_gc@ */
333};
334
335/*----- Write buffers -----------------------------------------------------*/
336
337static void ensure(PyObject *me, size_t n)
338{
339 buf *b = BUF_B(me);
340
341 if (BLEFT(b) < n) {
342 size_t nn = BSZ(b);
343 octet *p;
344 size_t want = BLEFT(b) + n;
345 while (nn < want) nn <<= 1;
346 p = xrealloc(BBASE(b), nn, BSZ(b));
347 BCUR(b) = p + BLEN(b);
348 BLIM(b) = p + nn;
349 BBASE(b) = p;
350 }
351}
352
353static PyObject *wbuf_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
354{
355 char *p;
356 size_t n = 64;
357 buf_pyobj *me = 0;
358 static char *kwlist[] = { "size", 0 };
359
360 if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:new", kwlist,
361 convszt, &n))
362 goto end;
363 me = (buf_pyobj *)ty->tp_alloc(ty, 0);
364 p = xmalloc(n);
0463996f 365 me->sub = 0;
46e6ad89 366 buf_init(&me->b, p, n);
367end:
368 return ((PyObject *)me);
369}
370
371static int wbuf_pysegcount(PyObject *me, int *nn)
372 { if (nn) *nn = BLEN(BUF_B(me)); return (1); }
373
374static int wbuf_pyreadbuf(PyObject *me, int seg, void **q)
375 { assert(seg == 0); *q = BBASE(BUF_B(me)); return (BLEN(BUF_B(me))); }
376
377static PyObject *wbmeth_zero(PyObject *me, PyObject *arg)
378{
379 void *p;
380 size_t n;
381 if (!PyArg_ParseTuple(arg, "O&:zero", convszt, &n)) return (0);
382 ensure(me, n);
383 p = buf_get(BUF_B(me), n); assert(p && BOK(BUF_B(me)));
384 memset(p, 0, n);
385 RETURN_ME;
386}
387
388static PyObject *wbmeth_put(PyObject *me, PyObject *arg)
389{
390 void *p;
391 int n;
392 if (!PyArg_ParseTuple(arg, "s#:put", &p, &n)) return (0);
393 ensure(me, n);
394 buf_put(BUF_B(me), p, n); assert(BOK(BUF_B(m)));
395 RETURN_ME;
396}
397
398#define WBMETH_PUTU_(n, W, w) \
399 static PyObject *wbmeth_putu##w(PyObject *me, PyObject *arg) \
400 { \
401 uint##n i; \
402 if (!PyArg_ParseTuple(arg, "O&:putu" #w, convu##n, &i)) return (0); \
403 ensure(me, SZ_##n); \
404 buf_putu##w(BUF_B(me), i); assert(BOK(BUF_B(me))); \
405 RETURN_ME; \
406 }
407DOUINTCONV(WBMETH_PUTU_)
408
409#define SZ_z 1
410#define WBMETH_PUTBLK_(n, W, w) \
411 static PyObject *wbmeth_putblk##w(PyObject *me, PyObject *arg) \
412 { \
413 char *p; \
414 int sz; \
415 if (!PyArg_ParseTuple(arg, "s#:putblk" #w, &p, &sz)) return (0); \
416 ensure(me, sz + SZ_##n); \
417 buf_putmem##w(BUF_B(me), p, sz); assert(BOK(BUF_B(me))); \
418 RETURN_ME; \
419 }
420BUF_DOSUFFIXES(WBMETH_PUTBLK_)
421
422static PyObject *wbmeth_putmp(PyObject *me, PyObject *arg)
423{
424 mp *x = 0;
425 if (!PyArg_ParseTuple(arg, "O&:putmp", convmp, &x)) return (0);
426 ensure(me, mp_octets(x) + 2);
427 buf_putmp(BUF_B(me), x); assert(BOK(BUF_B(me)));
428 RETURN_ME;
429}
430
431static PyObject *wbmeth_putgf(PyObject *me, PyObject *arg)
432{
433 mp *x = 0;
434 if (!PyArg_ParseTuple(arg, "O&:putgf", convgf, &x)) return (0);
435 ensure(me, mp_octets(x) + 2);
436 buf_putmp(BUF_B(me), x); assert(BOK(BUF_B(me)));
437 MP_DROP(x);
438 RETURN_ME;
439}
440
441static PyObject *wbmeth_putecpt(PyObject *me, PyObject *arg)
442{
443 ec pt = EC_INIT;
444 if (!PyArg_ParseTuple(arg, "O&:putecpt", convecpt, &pt)) return (0);
445 if (EC_ATINF(&pt)) ensure(me, 2);
446 else ensure(me, 4 + mp_octets(pt.x) + mp_octets(pt.y));
447 buf_putec(BUF_B(me), &pt); assert(BOK(BUF_B(me)));
448 EC_DESTROY(&pt);
449 RETURN_ME;
450}
451
452static PyObject *wbmeth_putecptraw(PyObject *me, PyObject *arg)
453{
454 PyObject *ptobj;
455 ec pt = EC_INIT;
456 if (!PyArg_ParseTuple(arg, "O!:putecptraw", ecptcurve_pytype, &ptobj))
457 return (0);
458 EC_OUT(ECPT_C(ptobj), &pt, ECPT_P(ptobj));
459 ensure(me, ECPT_C(ptobj)->f->noctets * 2 + 1);
460 ec_putraw(ECPT_C(ptobj), BUF_B(me), &pt); assert(BOK(BUF_B(me)));
461 EC_DESTROY(&pt);
462 RETURN_ME;
463}
464
465static PyObject *wbmeth_putge(PyObject *me, PyObject *arg)
466{
467 PyObject *geobj;
468 if (!PyArg_ParseTuple(arg, "O!:putge", ge_pytype, &geobj)) return (0);
469 ensure(me, GE_G(geobj)->noctets);
470 G_TOBUF(GE_G(geobj), BUF_B(me), GE_X(geobj)); assert(BOK(BUF_B(me)));
471 RETURN_ME;
472}
473
474static PyObject *wbmeth_putgeraw(PyObject *me, PyObject *arg)
475{
476 PyObject *geobj;
477 if (!PyArg_ParseTuple(arg, "O!:putgeraw", ge_pytype, &geobj)) return (0);
478 ensure(me, GE_G(geobj)->noctets);
479 G_TORAW(GE_G(geobj), BUF_B(me), GE_X(geobj)); assert(BOK(BUF_B(me)));
480 RETURN_ME;
481}
482
483static PyObject *wbget_size(PyObject *me, void *hunoz)
484 { return (PyInt_FromLong(BLEN(BUF_B(me)))); }
485
486static PyGetSetDef wbuf_pygetset[] = {
487#define GETSETNAME(op, name) wb##op##_##name
488 GET (size, "WBUF.size -> SIZE")
489#undef GETSETNAME
490 { 0 }
491};
492
493static PyMethodDef wbuf_pymethods[] = {
494#define METHNAME(func) wbmeth_##func
495 METH (zero, "WBUF.skip(N)")
496 METH (put, "WBUF.put(BYTES)")
497#define WBMETH_DECL_PUTU_(n, W, w) \
498 METH(putu##w, "WBUF.putu" #w "(INT)")
499 DOUINTCONV(WBMETH_DECL_PUTU_)
500#define WBMETH_DECL_PUTBLK_(n, W, w) \
501 METH(putblk##w, "WBUF.putblk" #w "(BYTES)")
502 BUF_DOSUFFIXES(WBMETH_DECL_PUTBLK_)
503 METH (putmp, "WBUF.putmp(X)")
504 METH (putgf, "WBUF.putgf(X)")
505 KWMETH(putecpt, "WBUF.putecpt(P)")
506 METH (putecptraw, "WBUF.putecptraw(P)")
507 METH (putge, "WBUF.putge(X)")
508 METH (putgeraw, "WBUF.putgeraw(X)")
509#undef METHNAME
510 { 0 }
511};
512
513static PyBufferProcs wbuf_pybuffer = {
514 wbuf_pyreadbuf, /* @bf_getreadbuffer@ */
515 0, /* @bf_getwritebuffer@ */
516 wbuf_pysegcount, /* @bf_getsegcount@ */
517 0 /* @bf_getcharbuffer@ */
518};
519
520static PyTypeObject wbuf_pytype_skel = {
521 PyObject_HEAD_INIT(0) 0, /* Header */
522 "catacomb.WriteBuffer", /* @tp_name@ */
523 sizeof(buf_pyobj), /* @tp_basicsize@ */
524 0, /* @tp_itemsize@ */
525
526 buf_pydealloc, /* @tp_dealloc@ */
527 0, /* @tp_print@ */
528 0, /* @tp_getattr@ */
529 0, /* @tp_setattr@ */
530 0, /* @tp_compare@ */
531 0, /* @tp_repr@ */
532 0, /* @tp_as_number@ */
533 0, /* @tp_as_sequence@ */
534 0, /* @tp_as_mapping@ */
535 0, /* @tp_hash@ */
536 0, /* @tp_call@ */
537 0, /* @tp_str@ */
538 0, /* @tp_getattro@ */
539 0, /* @tp_setattro@ */
540 &wbuf_pybuffer, /* @tp_as_buffer@ */
541 Py_TPFLAGS_DEFAULT | /* @tp_flags@ */
542 Py_TPFLAGS_BASETYPE,
543
544 /* @tp_doc@ */
545 "A write buffer.",
546
547 0, /* @tp_traverse@ */
548 0, /* @tp_clear@ */
549 0, /* @tp_richcompare@ */
550 0, /* @tp_weaklistoffset@ */
551 0, /* @tp_iter@ */
963a6148 552 0, /* @tp_iternext@ */
46e6ad89 553 wbuf_pymethods, /* @tp_methods@ */
554 0, /* @tp_members@ */
555 wbuf_pygetset, /* @tp_getset@ */
556 0, /* @tp_base@ */
557 0, /* @tp_dict@ */
558 0, /* @tp_descr_get@ */
559 0, /* @tp_descr_set@ */
560 0, /* @tp_dictoffset@ */
561 0, /* @tp_init@ */
562 PyType_GenericAlloc, /* @tp_alloc@ */
563 wbuf_pynew, /* @tp_new@ */
564 0, /* @tp_free@ */
565 0 /* @tp_is_gc@ */
566};
567
568/*----- Initialization ----------------------------------------------------*/
569
570void buffer_pyinit(void)
571{
572 INITTYPE(rbuf, root);
573 INITTYPE(wbuf, root);
574}
575
576void buffer_pyinsert(PyObject *mod)
577{
578 INSEXC("BufferError", buferr, PyExc_Exception, 0);
579 INSERT("ReadBuffer", rbuf_pytype);
580 INSERT("WriteBuffer", wbuf_pytype);
581}
582
583/*----- That's all, folks -------------------------------------------------*/