*.c: Split the constant definitions into the various submodules.
[catacomb-python] / key.c
diff --git a/key.c b/key.c
index 919b8f9..a78b15e 100644 (file)
--- a/key.c
+++ b/key.c
@@ -2060,6 +2060,21 @@ static const PyTypeObject keyfile_pytype_skel = {
 
 /*----- Initialization ----------------------------------------------------*/
 
+static const struct nameval consts[] = {
+  CONST(KOPEN_READ), CONST(KOPEN_WRITE), CONST(KOPEN_NOFILE),
+  CONST(KEXP_FOREVER), CONST(KEXP_EXPIRE),
+  CONST(KF_ENCMASK), CONST(KENC_BINARY), CONST(KENC_MP), CONST(KENC_STRUCT),
+    CONST(KENC_ENCRYPT), CONST(KENC_STRING), CONST(KENC_EC),
+  CONST(KF_CATMASK), CONST(KCAT_SYMM), CONST(KCAT_PRIV), CONST(KCAT_PUB),
+    CONST(KCAT_SHARE),
+  CONST(KF_NONSECRET),
+  CONST(KF_BURN), CONST(KF_OPT),
+#define ENTRY(tag, val, str) CONSTFLAG(CF_SIGNED, KERR_##tag),
+  KEY_ERRORS(ENTRY)
+#undef ENTRY
+  { 0 }
+};
+
 void key_pyinit(void)
 {
   INITTYPE(keyfile, root);
@@ -2095,6 +2110,7 @@ void key_pyinsert(PyObject *mod)
   INSERT("KeyDataString", keydatastr_pytype);
   INSERT("KeyDataStructured", keydatastruct_pytype);
   INSERT("SubKeyIter", subkeyiter_pytype);
+  setconstants(mod, consts);
 }
 
 /*----- That's all, folks -------------------------------------------------*/