1
// python stuff
2
#include <Python.h>
3
#include "structmember.h"
4
5
// pbc stuff
6
#include <pbc/pbc.h>
7
8
/*******************************************************************************
9
pypbc.h
10
11
Written by Geremy Condra
12
Licensed under GPLv3
13
Released 11 October 2009
14
15
This header contains the declarations for the functions needed to use PBC
16
from Python3
17
*******************************************************************************/
18
19
#ifndef PYPBC_H
20
#define PYPBC_H
21
22
// we need debugging symbols for compile warnings
23
#define PBC_DEBUG
24
25
// used to see which group a given element is in
26
enum Group {G1, G2, GT, Zr};
27
28
// We're going to need a few types
29
// the param type
30
typedef struct {
31
    PyObject_HEAD
32
    pbc_param_t pbc_params;
33
    int ready;
34
} Parameters;
35
36
PyObject *Parameters_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
37
int Parameters_init(Parameters *self, PyObject *args, PyObject *kwargs);
38
void Parameters_dealloc(Parameters *parameter);
39
40
PyMemberDef Parameters_members[];
41
PyMethodDef Parameters_methods[];
42
PyTypeObject ParametersType;
43
44
// the pairing type
45
typedef struct {
46
    PyObject_HEAD
47
    pairing_t pbc_pairing;
48
    int ready;
49
} Pairing;
50
51
PyObject *Pairing_new(PyTypeObject *type, PyObject *args, PyObject *kwargs);
52
int Pairing_init(Pairing *self, PyObject *args);
53
void Pairing_dealloc(Pairing *pairing);
54
PyObject* Pairing_apply(PyObject *self, PyObject *args);
55
56
PyMemberDef Pairing_members[];
57
PyMethodDef Pairing_methods[];
58
PyTypeObject PairingType;
59
60
// the element type
61
typedef struct {
62
    PyObject_HEAD
63
    enum Group group;
64
    PyObject *pairing;
65
    element_t pbc_element;
66
    int ready;
67
} Element;
68
69
PyMemberDef Element_members[];
70
PyMethodDef Element_methods[];
71
PyTypeObject ElementType;
72
73
PyObject *Element_new(PyTypeObject *type, PyObject *args, PyObject *kwargs);
74
int Element_init(PyObject *self, PyObject *args, PyObject *kwargs);
75
void Element_dealloc(Element *element);
76
77
#endif