aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/kiwisolver/py2/py/types.h
blob: 628efafbca4450b4e85dc8817dfb43546896f37c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*-----------------------------------------------------------------------------
| Copyright (c) 2013-2017, Nucleic Development Team.
|
| Distributed under the terms of the Modified BSD License.
|
| The full license is in the file COPYING.txt, distributed with this software.
|----------------------------------------------------------------------------*/
#pragma once
#include <Python.h>
#include <kiwi/kiwi.h>


int import_variable();

int import_term();

int import_expression();

int import_constraint();

int import_solver();

int import_strength();


extern PyTypeObject Variable_Type;

extern PyTypeObject Term_Type;

extern PyTypeObject Expression_Type;

extern PyTypeObject Constraint_Type;

extern PyTypeObject Solver_Type;

extern PyTypeObject strength_Type;

extern PyObject* DuplicateConstraint;

extern PyObject* UnsatisfiableConstraint;

extern PyObject* UnknownConstraint;

extern PyObject* DuplicateEditVariable;

extern PyObject* UnknownEditVariable;

extern PyObject* BadRequiredStrength;


struct Variable
{
	PyObject_HEAD
	PyObject* context;
	kiwi::Variable variable;

	static bool TypeCheck( PyObject* obj )
	{
		return PyObject_TypeCheck( obj, &Variable_Type ) != 0;
	}
};


struct Term
{
	PyObject_HEAD
	PyObject* variable;
	double coefficient;

	static bool TypeCheck( PyObject* obj )
	{
		return PyObject_TypeCheck( obj, &Term_Type ) != 0;
	}
};


struct Expression
{
	PyObject_HEAD
	PyObject* terms;
	double constant;

	static bool TypeCheck( PyObject* obj )
	{
		return PyObject_TypeCheck( obj, &Expression_Type ) != 0;
	}
};


struct Constraint
{
	PyObject_HEAD
	PyObject* expression;
	kiwi::Constraint constraint;

	static bool TypeCheck( PyObject* obj )
	{
		return PyObject_TypeCheck( obj, &Constraint_Type ) != 0;
	}
};


struct Solver
{
	PyObject_HEAD
	kiwi::Solver solver;

	static bool TypeCheck( PyObject* obj )
	{
		return PyObject_TypeCheck( obj, &Solver_Type ) != 0;
	}
};