X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/fbca05a1f15343b6e3a3b31edb3983e473fd7608..39d5f270dbd94d6b99b7a1b6bb62a93cdcbc0ec7:/catacomb-python.h?ds=sidebyside diff --git a/catacomb-python.h b/catacomb-python.h index 722d7ad..bd9a8e5 100644 --- a/catacomb-python.h +++ b/catacomb-python.h @@ -7,7 +7,7 @@ * (c) 2004 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the Python interface to Catacomb. * @@ -15,12 +15,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. @@ -152,6 +152,11 @@ return (0); \ } +#if PY_VERSION_HEX < 0x02050000 /* Compatibility hack */ +# define ht_name name +# define ht_type type +#endif + #define root_pytype 0 #define type_pytype &PyType_Type #define INITTYPE(ty, base) do { \ @@ -161,7 +166,7 @@ #define INSERT(name, ob) do { \ PyObject *_o = (PyObject *)(ob); \ - Py_INCREF(_o); \ + Py_INCREF(_o); \ PyModule_AddObject(mod, name, _o); \ } while (0) @@ -186,7 +191,8 @@ _(bytestring) _(buffer) \ _(rand) _(algorithms) _(pubkey) _(pgen) \ _(mp) _(field) _(ec) _(group) \ - _(passphrase) _(share) _(key) + _(passphrase) _(share) _(key) \ + _(util) #define DOMODINIT(m) m##_pyinit(); #define DOMODINSERT(m) m##_pyinsert(mod); #define INIT_MODULES do { MODULES(DOMODINIT) } while (0) @@ -262,7 +268,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) \ @@ -333,7 +339,7 @@ typedef struct fe_pyobj { field *f; mp *x; } fe_pyobj; - + extern PyTypeObject *field_pytype; extern PyTypeObject *primefield_pytype; extern PyTypeObject *niceprimefield_pytype; @@ -389,7 +395,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) @@ -555,7 +561,7 @@ extern PyObject *gmac_pywrap(PyObject *, gmac *, unsigned); extern int convgmac(PyObject *, void *); /*----- Key generation ----------------------------------------------------*/ - + typedef struct pfilt_pyobj { PyObject_HEAD pfilt f;