X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/blobdiff_plain/24b3d57bcf320d9d7a90a40d5f6176b1f087ab3e..de3b64326f850d72b0cbbf269e9fa98dd4c093eb:/catacomb-python.h diff --git a/catacomb-python.h b/catacomb-python.h index 79034af..80f5854 100644 --- a/catacomb-python.h +++ b/catacomb-python.h @@ -1,13 +1,11 @@ /* -*-c-*- - * - * $Id$ * * Definitions for Catacomb bindings * * (c) 2004 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the Python interface to Catacomb. * @@ -15,12 +13,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * Catacomb/Python is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Catacomb/Python; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -39,13 +37,11 @@ #include #include -#undef ULLONG_MAX -#undef ULONG_LONG_MAX - #include #include #include #include +#include #include @@ -77,6 +73,7 @@ #include #include #include +#include #include #include @@ -128,7 +125,6 @@ #define VALERR(str) EXCERR(PyExc_ValueError, str) #define TYERR(str) EXCERR(PyExc_TypeError, str) #define ZDIVERR(str) EXCERR(PyExc_ZeroDivisionError, str) -#define SYNERR(str) EXCERR(PyExc_SyntaxError, str) #define SYSERR(str) EXCERR(PyExc_SystemError, str) #define NIERR(str) EXCERR(PyExc_NotImplementedError, str) #define INDEXERR(idx) do { \ @@ -166,7 +162,7 @@ #define INSERT(name, ob) do { \ PyObject *_o = (PyObject *)(ob); \ - Py_INCREF(_o); \ + Py_INCREF(_o); \ PyModule_AddObject(mod, name, _o); \ } while (0) @@ -188,6 +184,7 @@ { #name, ty, offsetof(MEMBERSTRUCT, name), f, doc }, #define MODULES(_) \ + _(util) \ _(bytestring) _(buffer) \ _(rand) _(algorithms) _(pubkey) _(pgen) \ _(mp) _(field) _(ec) _(group) \ @@ -245,7 +242,8 @@ extern PyObject *getbool(int); extern PyObject *getulong(unsigned long); extern void *newtype(PyTypeObject *, const PyTypeObject *, const char *); -extern PyObject * mkexc(PyObject *, PyObject *, const char *, PyMethodDef *); +extern PyObject *mkexc(PyObject *, PyObject *, const char *, PyMethodDef *); +extern void typeready(PyTypeObject *); extern PyTypeObject *inittype(PyTypeObject *); extern void addmethods(const PyMethodDef *); extern PyMethodDef *donemethods(void); @@ -267,7 +265,7 @@ extern PyMethodDef *donemethods(void); METH (items, "D.items() -> LIST") \ METH (iterkeys, "D.iterkeys() -> ITER") \ METH (itervalues, "D.itervalues() -> ITER") \ - METH (iteritems, "D.iteritems() -> ITER") \ + METH (iteritems, "D.iteritems() -> ITER") \ KWMETH(get, "D.get(KEY, [default = None]) -> VALUE") \ #define GMAP_DOMETHODS(METH, KWMETH) \ @@ -281,7 +279,7 @@ extern PyMethodDef *donemethods(void); GMAP_DOMETHODS(GMAP_METHDECL, GMAP_KWMETHDECL) #define GMAP_ROMETHODS GMAP_DOROMETHODS(GMAP_METH, GMAP_KWMETH) #define GMAP_METHODS GMAP_DOMETHODS(GMAP_METH, GMAP_KWMETH) -extern int gmap_pysize(PyObject *); +extern Py_ssize_t gmap_pysize(PyObject *); extern PySequenceMethods gmap_pysequence; extern PyMethodDef gmap_pymethods[]; @@ -338,7 +336,7 @@ typedef struct fe_pyobj { field *f; mp *x; } fe_pyobj; - + extern PyTypeObject *field_pytype; extern PyTypeObject *primefield_pytype; extern PyTypeObject *niceprimefield_pytype; @@ -394,7 +392,7 @@ typedef struct ecinfo_pyobj { ec_info ei; PyObject *cobj; } ecinfo_pyobj; - + extern PyTypeObject *ecinfo_pytype; #define ECINFO_PYCHECK(o) PyObject_TypeCheck((o), ecinfo_pytype) #define ECINFO_EI(o) (&((ecinfo_pyobj *)(o))->ei) @@ -560,7 +558,7 @@ extern PyObject *gmac_pywrap(PyObject *, gmac *, unsigned); extern int convgmac(PyObject *, void *); /*----- Key generation ----------------------------------------------------*/ - + typedef struct pfilt_pyobj { PyObject_HEAD pfilt f;